Browse Source

[util] Add ability to dump PCI device ID list

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
452aa157be
2 changed files with 24 additions and 0 deletions
  1. 20
    0
      src/util/Option/ROM.pm
  2. 4
    0
      src/util/disrom.pl

+ 20
- 0
src/util/Option/ROM.pm View File

@@ -529,6 +529,26 @@ sub new {
529 529
   return $hash;  
530 530
 }
531 531
 
532
+sub device_list {
533
+  my $hash = shift;
534
+  my $self = tied(%$hash);
535
+
536
+  my $device_list = $hash->{device_list};
537
+  return undef unless $device_list;
538
+
539
+  my @ids;
540
+  my $offset = ( $self->{offset} + $device_list );
541
+  while ( 1 ) {
542
+    my $raw = substr ( ${$self->{data}}, $offset, 2 );
543
+    my $id = unpack ( "S", $raw );
544
+    last unless $id;
545
+    push @ids, $id;
546
+    $offset += 2;
547
+  }
548
+
549
+  return @ids;
550
+}
551
+
532 552
 ##############################################################################
533 553
 #
534 554
 # Option::ROM::PnP

+ 4
- 0
src/util/disrom.pl View File

@@ -55,6 +55,10 @@ do {
55 55
     printf "  %-16s %s\n", "Signature:", $pci->{signature};
56 56
     printf "  %-16s 0x%04x\n", "Vendor ID:", $pci->{vendor_id};
57 57
     printf "  %-16s 0x%04x\n", "Device ID:", $pci->{device_id};
58
+    if ( $pci->{device_list} ) {
59
+      printf "  %-16s %s\n", "Device list:",
60
+	     ( join ( ", ", map { sprintf "0x%04x", $_ } $pci->device_list ) );
61
+    }
58 62
     printf "  %-16s 0x%02x%02x%02x\n", "Device class:",
59 63
 	   $pci->{base_class}, $pci->{sub_class}, $pci->{prog_intf};
60 64
     printf "  %-16s 0x%04x (%d)\n", "Image length:",

Loading…
Cancel
Save