package partition_table; # $Id: partition_table.pm 268438 2010-05-10 14:25:50Z pterjan $ use diagnostics; use strict; use common; use fs::type; use partition_table::raw; use detect_devices; use log; sub hd2minimal_part { my ($hd) = @_; { rootDevice => $hd->{device}, if_($hd->{usb_media_type}, is_removable => 1), }; } #- works for both hard disk drives and partitions ;p sub description { my ($hd) = @_; my $win = $hd->{device_windobe}; sprintf "%s%s (%s)", $hd->{device}, $win && " [$win:]", join(', ', grep { $_ } formatXiB($hd->{totalsectors} || $hd->{size}, 512), $hd->{info}, $hd->{mntpoint}, $hd->{fs_type}); } #- align partition start to the next MB boundary sub align_to_MB_boundaries { my ($part) = @_; my $end = $part->{start} + $part->{size}; $part->{start} = round_up($part->{start}, MB(1)); $part->{size} = $end - $part->{start}; } sub adjustStartAndEnd { my ($hd, $part) = @_; # always align partition start to MB boundaries # (this accounts for devices with non-512 physical sector sizes): align_to_MB_boundaries($part); $hd->adjustStart($part); $hd->adjustEnd($part); } sub verifyNotOverlap { my ($a, $b) = @_; $a->{start} + $a->{size} <= $b->{start} || $b->{start} + $b->{size} <= $a->{start}; } sub verifyInside { my ($a, $b) = @_; $b->{start} <= $a->{start} && $a->{start} + $a->{size} <= $b->{start} + $b->{size}; } sub verifyParts_ { foreach my $i (@_) { foreach (@_) { next if !$i || !$_ || $i == $_ || isWholedisk($i) || isExtended($i); #- avoid testing twice for simplicity :-) if (isWholedisk($_)) { verifyInside($i, $_) or cdie sprintf("partition sector #$i->{start} (%s) is not inside whole disk (%s)!", formatXiB($i->{size}, 512), formatXiB($_->{size}, 512)); } elsif (isExtended($_)) { verifyNotOverlap($i, $_) or log::l(sprintf("warning partition sector #$i->{start} (%s) is overlapping with extended partition!", formatXiB($i->{size}, 512))); #- only warning for this one is acceptable } else { verifyNotOverlap($i, $_) or cdie sprintf("partitions sector #$i->{start} (%s) and sector #$_->{start} (%s) are overlapping!", formatXiB($i->{size}, 512), formatXiB($_->{size}, 512)); } } } } sub verifyParts { my ($hd) = @_; verifyParts_(get_normal_parts($hd)); } sub verifyPrimary { my ($pt) = @_; $_->{start} > 0 || arch() =~ /^sparc/ || die "partition must NOT start at sector 0" foreach @{$pt->{normal}}; verifyParts_(@{$pt->{normal}}, $pt->{extended}); } sub compute_device_name { my ($part, $hd) = @_; $part->{device} = _compute_device_name($hd, $part->{part_number}); } sub _compute_device_name { my ($hd, $nb) = @_; my $prefix = $hd->{prefix} || devices::prefix_for_dev($hd->{device}); $prefix . $nb; } sub assign_device_numbers { my ($hd) = @_; my $i = 1; my $start = 1; #- on PPC we need to assign device numbers to the holes too - big FUN! #- not if it's an IBM machine using a DOS partition table though if (arch() =~ /ppc/ && detect_devices::get_mac_model() !~ /^IBM/) { #- first sort the normal parts $hd->{primary}{normal} = [ sort { $a->{start} <=> $b->{start} } @{$hd->{primary}{normal}} ]; #- now loop through them, assigning partition numbers - reserve one for the holes foreach (@{$hd->{primary}{normal}}) { if ($_->{start} > $start) { log::l("PPC: found a hole on $hd->{device} before $_->{start}, skipping device..."); $i++; } $_->{part_number} = $i; compute_device_name($_, $hd); $start = $_->{start} + $_->{size}; $i++; } } else { foreach (@{$hd->{primary}{raw}}) { $_->{part_number} = $i; compute_device_name($_, $hd); $i++; } foreach (map { $_->{normal} } @{$hd->{extended} || []}) { my $dev = _compute_device_name($hd, $i); my $renumbered = $_->{device} && $dev ne $_->{device}; if ($renumbered) { require fs::mount; eval { fs::mount::umount_part($_) }; #- at least try to umount it will_tell_kernel($hd, del => $_, 'delay_del'); push @{$hd->{partitionsRenumbered}}, [ $_->{device}, $dev ]; } $_->{part_number} = $i; compute_device_name($_, $hd); if ($renumbered) { will_tell_kernel($hd, add => $_, 'delay_add'); } $i++; } } #- try to figure what the windobe drive letter could be! # #- first verify there's at least one primary dos partition, otherwise it #- means it is a secondary disk and all will be false :( #- my ($c, @others) = grep { isFat_or_NTFS($_) } @{$hd->{primary}{normal}}; $i = ord 'C'; $c->{device_windobe} = chr($i++) if $c; $_->{device_windobe} = chr($i++) foreach grep { isFat_or_NTFS($_) } map { $_->{normal} } @{$hd->{extended}}; $_->{device_windobe} = chr($i++) foreach @others; } sub remove_empty_extended { my ($hd) = @_; my $last = $hd->{primary}{extended} or return; @{$hd->{extended}} = grep { if ($_->{normal}) { $last = $_; } else { %{$last->{extended}} = $_->{extended} ? %{$_->{extended}} : (); } $_->{normal}; } @{$hd->{extended}}; adjust_main_extended($hd); } sub adjust_main_extended { my ($hd) = @_; if (!is_empty_array_ref $hd->{extended}) { my ($l, @l) = @{$hd->{extended}}; # the first is a special case, must recompute its real size my $start = round_down($l->{normal}{start} - 1, $hd->{geom}{sectors}); my $end = $l->{normal}{start} + $l->{normal}{size}; my $only_linux = 1; my $has_win_lba = 0; foreach (map { $_->{normal} } $l, @l) { $start = min($start, $_->{start}); $end = max($end, $_->{start} + $_->{size}); $only_linux &&= isTrueLocalFS($_) || isSwap($_); $has_win_lba ||= $_->{pt_type} == 0xc || $_->{pt_type} == 0xe; } $l->{start} = $hd->{primary}{extended}{start} = $start; $l->{size} = $hd->{primary}{extended}{size} = $end - $start; } if (!@{$hd->{extended} || []} && $hd->{primary}{extended}) { will_tell_kernel($hd, del => $hd->{primary}{extended}); %{$hd->{primary}{extended}} = (); #- modify the raw entry delete $hd->{primary}{extended}; } verifyParts($hd); #- verify everything is all right } sub adjust_local_extended { my ($hd, $part) = @_; my $extended = find { $_->{normal} == $part } @{$hd->{extended} || []} or return; $extended->{size} = $part->{size} + $part->{start} - $extended->{start}; #- must write it there too because values are not shared my $prev = find { $_->{extended}{start} == $extended->{start} } @{$hd->{extended} || []} or return; $prev->{extended}{size} = $part->{size} + $part->{start} - $prev->{extended}{start}; } sub get_normal_parts { my ($hd) = @_; @{$hd->{primary}{normal} || []}, map { $_->{normal} } @{$hd->{extended} || []}; } sub get_normal_parts_and_holes { my ($hd) = @_; my ($start, $last) = ($hd->first_usable_sector, $hd->last_usable_sector); ref($hd) or print("get_normal_parts_and_holes: bad hd" . backtrace(), "\n"); my $minimal_hole = put_in_hash({ pt_type => 0 }, hd2minimal_part($hd)); my @l = map { my $current = $start; $start = $_->{start} + $_->{size}; my $hole = { start => $current, size => $_->{start} - $current, %$minimal_hole }; put_in_hash($hole, hd2minimal_part($hd)); $hole, $_; } sort { $a->{start} <=> $b->{start} } grep { !isWholedisk($_) } get_normal_parts($hd); push @l, { start => $start, size => min($last - $start, $hd->max_partition_size), %$minimal_hole } if $start < $hd->max_partition_start; grep { !isEmpty($_) || $_->{size} >= $hd->cylinder_size } @l; } sub _default_type { my ($hd) = @_; arch() =~ /ia64/ ? 'gpt' : arch() eq "alpha" ? "bsd" : arch() =~ /^sparc/ ? "sun" : arch() eq "ppc" && detect_devices::get_mac_model() !~ /^IBM/ ? "mac" : $hd->{totalsectors} > 4 * 1024 * 1024 * 2048 ? 'lvm' : "dos"; #- default to LVM on full disk when >4TB } sub initialize { my ($hd, $o_type) = @_; my $type = $o_type || _default_type($hd); require "partition_table/$type.pm"; "partition_table::$type"->initialize($hd); delete $hd->{extended}; if (detect_devices::is_xbox()) { my $part = { start => 1, size => 15632048, pt_type => 0x0bf, isFormatted => 1 }; partition_table::dos::compute_CHS($hd, $part); $hd->{primary}{raw}[0] = $part; } } sub read_primary { my ($hd) = @_; #- it can be safely considered that the first sector is used to probe the partition table #- but other sectors (typically for extended partition ones) have to match this type! my @parttype = ( if_(arch() =~ /^ia64/, 'gpt'), # gpt must be tried before dos as it presents a fake compatibility mbr arch() =~ /^sparc/ ? ('sun', 'bsd') : ('gpt', 'lvm', 'dmcrypt', 'dos', 'bsd', 'sun', 'mac'), ); foreach ('empty', @parttype, 'unknown') { /unknown/ and die "unknown partition table format on disk " . $hd->{file}; # perl_checker: require partition_table::bsd # perl_checker: require partition_table::dos # perl_checker: require partition_table::empty # perl_checker: require partition_table::dmcrypt # perl_checker: require partition_table::lvm # perl_checker: require partition_table::gpt # perl_checker: require partition_table::mac # perl_checker: require partition_table::sun require "partition_table/$_.pm"; bless $hd, "partition_table::$_"; if ($hd->read_primary) { log::l("found a $_ partition table on $hd->{file} at sector 0"); return 1; } } 0; } sub read { my ($hd) = @_; read_primary($hd) or return 0; eval { my $need_removing_empty_extended; if ($hd->{primary}{extended}) { read_extended($hd, $hd->{primary}{extended}, \$need_removing_empty_extended) or return 0; } if ($need_removing_empty_extended) { #- special case when hda5 is empty, it must be skipped #- (windows XP generates such partition tables) remove_empty_extended($hd); #- includes adjust_main_extended } }; die "extended partition: $@" if $@; assign_device_numbers($hd); remove_empty_extended($hd); $hd->set_best_geometry_for_the_partition_table; 1; } sub read_extended { my ($hd, $extended, $need_removing_empty_extended) = @_; my $pt = do { my ($pt, $info) = $hd->read_one($extended->{start}) or return 0; partition_table::raw::pt_info_to_primary($hd, $pt, $info); }; $pt = { %$extended, %$pt }; push @{$hd->{extended}}, $pt; @{$hd->{extended}} > 100 and die "oops, seems like we're looping here :( (or you have more than 100 extended partitions!)"; if (@{$pt->{normal}} == 0) { $$need_removing_empty_extended = 1; delete $pt->{normal}; print "need_removing_empty_extended\n"; } elsif (@{$pt->{normal}} > 1) { die "more than one normal partition in extended partition"; } else { $pt->{normal} = $pt->{normal}[0]; #- in case of extended partitions, the start sector is local to the partition or to the first extended_part! $pt->{normal}{start} += $pt->{start}; #- the following verification can broke an existing partition table that is #- correctly read by fdisk or cfdisk. maybe the extended partition can be #- recomputed to get correct size. if (!verifyInside($pt->{normal}, $extended)) { $extended->{size} = $pt->{normal}{start} + $pt->{normal}{size}; verifyInside($pt->{normal}, $extended) or die "partition $pt->{normal}{device} is not inside its extended partition"; } } if ($pt->{extended}) { $pt->{extended}{start} += $hd->{primary}{extended}{start}; return read_extended($hd, $pt->{extended}, $need_removing_empty_extended); } else { 1; } } sub will_tell_kernel { my ($hd, $action, $o_part, $o_delay) = @_; if ($action eq 'resize') { will_tell_kernel($hd, del => $o_part); will_tell_kernel($hd, add => $o_part); } else { my $part_number; if ($o_part) { ($part_number) = $o_part->{device} =~ /(\d+)$/ or #- do not die, it occurs when we zero_MBR_and_dirty a raw_lvm_PV log::l("ERROR: will_tell_kernel bad device " . description($o_part)), return; } my @para = $action eq 'force_reboot' ? () : $action eq 'add' ? ($part_number, $o_part->{start}, $o_part->{size}) : $action eq 'del' ? $part_number : internal_error("unknown action $action"); push @{$hd->{'will_tell_kernel' . ($o_delay || '')} ||= []}, [ $action, @para ]; } if (!$o_delay) { foreach my $delay ('delay_del', 'delay_add') { my $l = delete $hd->{"will_tell_kernel$delay"} or next; push @{$hd->{will_tell_kernel} ||= []}, @$l; } } $hd->{isDirty} = 1; } sub tell_kernel { my ($hd, $tell_kernel) = @_; my $F = partition_table::raw::openit($hd); run_program::run('udevadm', 'control', '--stop-exec-queue') unless $::isInstall; my $force_reboot = any { $_->[0] eq 'force_reboot' } @$tell_kernel; if (!$force_reboot) { foreach (@$tell_kernel) { my ($action, $part_number, $o_start, $o_size) = @$_; if ($action eq 'add') { $force_reboot ||= !c::add_partition(fileno $F, $part_number, $o_start, $o_size); } elsif ($action eq 'del') { $force_reboot ||= !c::del_partition(fileno $F, $part_number); } log::l("tell kernel $action ($hd->{device} $part_number $o_start $o_size) force_reboot=$force_reboot rebootNeeded=$hd->{rebootNeeded}"); } } run_program::run('udevadm', 'control', '--start-exec-queue') unless $::isInstall; if ($force_reboot) { # FIXME Handle LVM/dmcrypt/RAID my @magic_parts = grep { $_->{isMounted} && $_->{real_mntpoint} } get_normal_parts($hd); foreach (@magic_parts) { syscall_('umount', $_->{real_mntpoint}) or log::l(N("error unmounting %s: %s", $_->{real_mntpoint}, $!)); } $hd->{rebootNeeded} = !ioctl($F, c::BLKRRPART(), 0); log::l("tell kernel force_reboot ($hd->{device}), rebootNeeded=$hd->{rebootNeeded}"); foreach (@magic_parts) { syscall_('mount', $_->{real_mntpoint}, $_->{fs_type}, c::MS_MGC_VAL()) or log::l(N("mount failed: ") . $!); } } } # write the partition table sub write { my ($hd) = @_; $hd->{isDirty} or return; $hd->{readonly} and internal_error("a read-only partition table should not be dirty ($hd->{device})!"); #- set first primary partition active if no primary partitions are marked as active. if (my @l = @{$hd->{primary}{raw}}) { foreach (@l) { $_->{local_start} = $_->{start}; $_->{active} ||= 0; } $l[0]{active} = 0x80 if !any { $_->{active} } @l; } #- last chance for verification, this make sure if an error is detected, #- it will never be writed back on partition table. verifyParts($hd); $hd->write(0, $hd->{primary}{raw}, $hd->{primary}{info}) or die "writing of partition table failed"; #- should be fixed but a extended exist with no real extended partition, that blanks mbr! if (arch() !~ /^sparc/) { foreach (@{$hd->{extendedpci:v00001002d000095CFsv*sd*bc*sc*i* pci:v00001002d000095CEsv*sd*bc*sc*i* pci:v00001002d000095CDsv*sd*bc*sc*i* pci:v00001002d0000719Bsv*sd*bc*sc*i* pci:v00001002d00005B65sv*sd*bc*sc*i* pci:v00001002d00003151sv*sd*bc*sc*i* pci:v00001002d0000944Esv*sd*bc*sc*i* pci:v00001002d00009446sv*sd*bc*sc*i* pci:v00001002d00009456sv*sd*bc*sc*i* pci:v00001002d00009444sv*sd*bc*sc*i* pci:v00001002d0000949Csv*sd*bc*sc*i* pci:v00001002d0000949Esv*sd*bc*sc*i* pci:v00001002d0000949Fsv*sd*bc*sc*i* pci:v00001002d00009511sv*sd*bc*sc*i* pci:v00001002d0000958Dsv*sd*bc*sc*i* pci:v00001002d0000958Csv*sd*bc*sc*i* pci:v00001002d000095CCsv*sd*bc*sc*i* pci:v00001002d0000728Csv*sd*bc*sc*i* pci:v00001002d000071DAsv*sd*bc*sc*i* pci:v00001002d000071D2sv*sd*bc*sc*i* pci:v00001002d00007153sv*sd*bc*sc*i* pci:v00001002d00007152sv*sd*bc*sc*i* pci:v00001002d00005E48sv*sd*bc*sc*i* pci:v00001002d00003E54sv*sd*bc*sc*i* pci:v00001002d00005B64sv*sd*bc*sc*i* pci:v00001002d00004154sv*sd*bc*sc*i* pci:v00001002d0000944Fsv*sd*bc*sc*i* pci:v00001002d00009447sv*sd*bc*sc*i* pci:v00001002d0000940Asv*sd*bc*sc*i* pci:v00001002d0000940Bsv*sd*bc*sc*i* pci:v00001002d0000940Fsv*sd*bc*sc*i* pci:v00001002d0000710Fsv*sd*bc*sc*i* pci:v00001002d0000710Esv*sd*bc*sc*i* pci:v00001002d00007105sv*sd*bc*sc*i* pci:v00001002d00007104sv*sd*bc*sc*i* pci:v00001002d00005D51sv*sd*bc*sc*i* pci:v00001002d00005D50sv*sd*bc*sc*i* pci:v00001002d00005554sv*sd*bc*sc*i* pci:v00001002d00005555sv*sd*bc*sc*i* pci:v00001002d00005550sv*sd*bc*sc*i* pci:v00001002d00005551sv*sd*bc*sc*i* pci:v00001002d00004A4Dsv*sd*bc*sc*i* pci:v00001002d00004E4Bsv*sd*bc*sc*i* pci:v00001002d00004147sv*sd*bc*sc*i* pci:v00001002d00004E47sv*sd*bc*sc*i* pci:v00001002d0000946Bsv*sd*bc*sc*i* pci:v00001002d0000946Asv*sd*bc*sc*i* pci:v00001002d0000947Bsv*sd*bc*sc*i* pci:v00001002d0000947Asv*sd*bc*sc*i* pci:v00001002d00009489sv*sd*bc*sc*i* pci:v00001002d0000959Bsv*sd*bc*sc*i* pci:v00001002d00009595sv*sd*bc*sc*i* pci:v00001002d0000958Fsv*sd*bc*sc*i* pci:v00001002d000071D4sv*sd*bc*sc*i* pci:v00001002d00007103sv*sd*bc*sc*i* pci:v00001002d00007106sv*sd*bc*sc*i* pci:v00001002d000071C4sv*sd*bc*sc*i* pci:v00001002d00007144sv*sd*bc*sc*i* pci:v00001002d00005D49sv*sd*bc*sc*i* pci:v00001002d0000564Bsv*sd*bc*sc*i* pci:v00001002d0000564Asv*sd*bc*sc*i* pci:v00001002d00003154sv*sd*bc*sc*i* pci:v00001002d00005464sv*sd*bc*sc*i* pci:v00001002d00004E54sv*sd*bc*sc*i* pci:v00001002d0000944Bsv*sd*bc*sc*i* pci:v00001002d0000944Asv*sd*bc*sc*i* pci:v00001002d0000945Bsv*sd*bc*sc*i* pci:v00001002d0000945Asv*sd*bc*sc*i* pci:v00001002d00009488sv*sd*bc*sc*i* pci:v00001002d00009480sv*sd*bc*sc*i* pci:v00001002d00009509sv*sd*bc*sc*i* pci:v00001002d00009504sv*sd*bc*sc*i* pci:v00001002d00009508sv*sd*bc*sc*i* pci:v00001002d00009506sv*sd*bc*sc*i* pci:v00001002d00009593sv*sd*bc*sc*i* pci:v00001002d00009591sv*sd*bc*sc*i* pci:v00001002d000095C2sv*sd*bc*sc*i* pci:v00001002d000095C4sv*sd*bc*sc*i* pci:v00001002d0000958Bsv*sd*bc*sc*i* pci:v00001002d00009583sv*sd*bc*sc*i* pci:v00001002d00009581sv*sd*bc*sc*i* pci:v00001002d000094C8sv*sd*bc*sc*i* pci:v00001002d000094CBsv*sd*bc*sc*i* pci:v00001002d000094C9sv*sd*bc*sc*i* pci:v00001002d00007211sv*sd*bc*sc*i* pci:v00001002d00007210sv*sd*bc*sc*i* pci:v00001002d00007284sv*sd*bc*sc*i* pci:v00001002d000071D5sv*sd*bc*sc*i* pci:v00001002d000071D6sv*sd*bc*sc*i* pci:v00001002d000071DEsv*sd*bc*sc*i* pci:v00001002d0000718Asv*sd*bc*sc*i* pci:v00001002d00007188sv*sd*bc*sc*i* pci:v00001002d0000718Dsv*sd*bc*sc*i* pci:v00001002d00007186sv*sd*bc*sc*i* pci:v00001002d00007196sv*sd*bc*sc*i* pci:v00001002d0000718Csv*sd*bc*sc*i* pci:v00001002d0000718Bsv*sd*bc*sc*i* pci:v00001002d00007102sv*sd*bc*sc*i* pci:v00001002d00007101sv*sd*bc*sc*i* pci:v00001002d000071C5sv*sd*bc*sc*i* pci:v00001002d00007145sv*sd*bc*sc*i* pci:v00001002d0000714Asv*sd*bc*sc*i* pci:v00001002d0000714Csv*sd*bc*sc*i* pci:v00001002d0000714Bsv*sd*bc*sc*i* pci:v00001002d00007149sv*sd*bc*sc*i* pci:v00001002d00005D4Asv*sd*bc*sc*i* pci:v00001002d00005D48sv*sd*bc*sc*i* pci:v00001002d00005652sv*sd*bc*sc*i* pci:v00001002d00005653sv*sd*bc*sc*i* pci:v00001002d00003150sv*sd*bc*sc*i* pci:v00001002d00005462sv*sd*bc*sc*i* pci:v00001002d00005461sv*sd*bc*sc*i* pci:v00001002d00005460sv*sd*bc*sc*i* pci:v00001002d00003152sv*sd*bc*sc*i* pci:v00001002d00004A4Esv*sd*bc*sc*i* pci:v00001002d00004E56sv*sd*bc*sc*i* pci:v00001002d00004E52sv*sd*bc*sc*i* pci:v00001002d0000944Csv*sd*bc*sc*i* pci:v00001002d00009452sv*sd*bc*sc*i* pci:v00001002d00009440sv*sd*bc*sc*i* pci:v00001002d00009442sv*sd*bc*sc*i* pci:v00001002d00009490sv*sd*bc*sc*i* pci:v00001002d00009498sv*sd*bc*sc*i* pci:v00001002d0000948Fsv*sd*bc*sc*i* pci:v00001002d00009487sv*sd*bc*sc*i* pci:v00001002d0000954Fsv*sd*bc*sc*i* pci:v00001002d0000954Esv*sd*bc*sc*i* pci:v00001002d00009542sv*sd*bc*sc*i* pci:v00001002d00009541sv*sd*bc*sc*i* pci:v00001002d00009540sv*sd*bc*sc*i* pci:v00001002d00009517sv*sd*bc*sc*i* pci:v00001002d00009519sv*sd*bc*sc*i* pci:v00001002d00009515sv*sd*bc*sc*i* pci:v00001002d00009500sv*sd*bc*sc*i* pci:v00001002d00009507sv*sd*bc*sc*i* pci:v00001002d00009501sv*sd*bc*sc*i* pci:v00001002d00009505sv*sd*bc*sc*i* pci:v00001002d00009597sv*sd*bc*sc*i* pci:v00001002d00009596sv*sd*bc*sc*i* pci:v00001002d00009599sv*sd*bc*sc*i* pci:v00001002d00009598sv*sd*bc*sc*i* pci:v00001002d00009590sv*sd*bc*sc*i* pci:v00001002d00009589sv*sd*bc*sc*i* pci:v00001002d00009588sv*sd*bc*sc*i* pci:v00001002d00009580sv*sd*bc*sc*i* pci:v00001002d00009587sv*sd*bc*sc*i* pci:v00001002d00009586sv*sd*bc*sc*i* pci:v00001002d0000958Asv*sd*bc*sc*i* pci:v00001002d0000958Esv*sd*bc*sc*i* pci:v00001002d000095C9sv*sd*bc*sc*i* pci:v00001002d000095C6sv*sd*bc*sc*i* pci:v00001002d000095C7sv*sd*bc*sc*i* pci:v00001002d000095C5sv*sd*bc*sc*i* pci:v00001002