]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[util] Add ability to dump PCI device ID list
authorMichael Brown <mcb30@ipxe.org>
Mon, 13 Apr 2015 15:22:35 +0000 (16:22 +0100)
committerMichael Brown <mcb30@ipxe.org>
Mon, 13 Apr 2015 15:22:35 +0000 (16:22 +0100)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/util/Option/ROM.pm
src/util/disrom.pl

index 6c396730e399c14514415b378959a525b779593a..232cf16b8355ad419ffbbcab9e6e4e1fbd3d94a1 100644 (file)
@@ -529,6 +529,26 @@ sub new {
   return $hash;  
 }
 
+sub device_list {
+  my $hash = shift;
+  my $self = tied(%$hash);
+
+  my $device_list = $hash->{device_list};
+  return undef unless $device_list;
+
+  my @ids;
+  my $offset = ( $self->{offset} + $device_list );
+  while ( 1 ) {
+    my $raw = substr ( ${$self->{data}}, $offset, 2 );
+    my $id = unpack ( "S", $raw );
+    last unless $id;
+    push @ids, $id;
+    $offset += 2;
+  }
+
+  return @ids;
+}
+
 ##############################################################################
 #
 # Option::ROM::PnP
index 574957acda8cce1b702459e1c4600ae21e621697..920a86b24560599ff56edca9000c7131ca0b50ec 100755 (executable)
@@ -55,6 +55,10 @@ do {
     printf "  %-16s %s\n", "Signature:", $pci->{signature};
     printf "  %-16s 0x%04x\n", "Vendor ID:", $pci->{vendor_id};
     printf "  %-16s 0x%04x\n", "Device ID:", $pci->{device_id};
+    if ( $pci->{device_list} ) {
+      printf "  %-16s %s\n", "Device list:",
+            ( join ( ", ", map { sprintf "0x%04x", $_ } $pci->device_list ) );
+    }
     printf "  %-16s 0x%02x%02x%02x\n", "Device class:",
           $pci->{base_class}, $pci->{sub_class}, $pci->{prog_intf};
     printf "  %-16s 0x%04x (%d)\n", "Image length:",