|
@@ -27,55 +27,61 @@ my $romfile = shift || "-";
|
27
|
27
|
my $rom = new Option::ROM;
|
28
|
28
|
$rom->load ( $romfile );
|
29
|
29
|
|
30
|
|
-die "Not an option ROM image\n"
|
31
|
|
- unless $rom->{signature} == ROM_SIGNATURE;
|
|
30
|
+do {
|
32
|
31
|
|
33
|
|
-my $romlength = ( $rom->{length} * 512 );
|
34
|
|
-my $filelength = $rom->length;
|
35
|
|
-die "ROM image truncated (is $filelength, should be $romlength)\n"
|
36
|
|
- if $filelength < $romlength;
|
|
32
|
+ die "Not an option ROM image\n"
|
|
33
|
+ unless $rom->{signature} == ROM_SIGNATURE;
|
37
|
34
|
|
38
|
|
-printf "ROM header:\n\n";
|
39
|
|
-printf " %-16s 0x%02x (%d)\n", "Length:", $rom->{length}, ( $rom->{length} * 512 );
|
40
|
|
-printf " %-16s 0x%02x (%s0x%02x)\n", "Checksum:", $rom->{checksum},
|
41
|
|
- ( ( $rom->checksum == 0 ) ? "" : "INCORRECT: " ), $rom->checksum;
|
42
|
|
-printf " %-16s 0x%04x\n", "Init:", $rom->{init};
|
43
|
|
-printf " %-16s 0x%04x\n", "UNDI header:", $rom->{undi_header};
|
44
|
|
-printf " %-16s 0x%04x\n", "PCI header:", $rom->{pci_header};
|
45
|
|
-printf " %-16s 0x%04x\n", "PnP header:", $rom->{pnp_header};
|
46
|
|
-printf "\n";
|
|
35
|
+ my $romlength = ( $rom->{length} * 512 );
|
|
36
|
+ my $filelength = $rom->length;
|
|
37
|
+ die "ROM image truncated (is $filelength, should be $romlength)\n"
|
|
38
|
+ if $filelength < $romlength;
|
47
|
39
|
|
48
|
|
-my $pci = $rom->pci_header();
|
49
|
|
-if ( $pci ) {
|
50
|
|
- printf "PCI header:\n\n";
|
51
|
|
- printf " %-16s %s\n", "Signature:", $pci->{signature};
|
52
|
|
- printf " %-16s 0x%04x\n", "Vendor ID:", $pci->{vendor_id};
|
53
|
|
- printf " %-16s 0x%04x\n", "Device ID:", $pci->{device_id};
|
54
|
|
- printf " %-16s 0x%02x%02x%02x\n", "Device class:",
|
55
|
|
- $pci->{base_class}, $pci->{sub_class}, $pci->{prog_intf};
|
56
|
|
- printf " %-16s 0x%04x (%d)\n", "Image length:",
|
57
|
|
- $pci->{image_length}, ( $pci->{image_length} * 512 );
|
58
|
|
- printf " %-16s 0x%04x (%d)\n", "Runtime length:",
|
59
|
|
- $pci->{runtime_length}, ( $pci->{runtime_length} * 512 );
|
60
|
|
- if ( exists $pci->{conf_header} ) {
|
61
|
|
- printf " %-16s 0x%04x\n", "Config header:", $pci->{conf_header};
|
62
|
|
- printf " %-16s 0x%04x\n", "CLP entry:", $pci->{clp_entry};
|
63
|
|
- }
|
|
40
|
+ printf "ROM header:\n\n";
|
|
41
|
+ printf " %-16s 0x%02x (%d)\n", "Length:",
|
|
42
|
+ $rom->{length}, ( $rom->{length} * 512 );
|
|
43
|
+ printf " %-16s 0x%02x (%s0x%02x)\n", "Checksum:", $rom->{checksum},
|
|
44
|
+ ( ( $rom->checksum == 0 ) ? "" : "INCORRECT: " ), $rom->checksum;
|
|
45
|
+ printf " %-16s 0x%04x\n", "Init:", $rom->{init};
|
|
46
|
+ printf " %-16s 0x%04x\n", "UNDI header:", $rom->{undi_header};
|
|
47
|
+ printf " %-16s 0x%04x\n", "PCI header:", $rom->{pci_header};
|
|
48
|
+ printf " %-16s 0x%04x\n", "PnP header:", $rom->{pnp_header};
|
64
|
49
|
printf "\n";
|
65
|
|
-}
|
66
|
50
|
|
67
|
|
-my $pnp = $rom->pnp_header();
|
68
|
|
-if ( $pnp ) {
|
69
|
|
- printf "PnP header:\n\n";
|
70
|
|
- printf " %-16s %s\n", "Signature:", $pnp->{signature};
|
71
|
|
- printf " %-16s 0x%02x (%s0x%02x)\n", "Checksum:", $pnp->{checksum},
|
72
|
|
- ( ( $pnp->checksum == 0 ) ? "" : "INCORRECT: " ), $pnp->checksum;
|
73
|
|
- printf " %-16s 0x%04x \"%s\"\n", "Manufacturer:",
|
74
|
|
- $pnp->{manufacturer}, $pnp->manufacturer;
|
75
|
|
- printf " %-16s 0x%04x \"%s\"\n", "Product:",
|
76
|
|
- $pnp->{product}, $pnp->product;
|
77
|
|
- printf " %-16s 0x%04x\n", "BCV:", $pnp->{bcv};
|
78
|
|
- printf " %-16s 0x%04x\n", "BDV:", $pnp->{bdv};
|
79
|
|
- printf " %-16s 0x%04x\n", "BEV:", $pnp->{bev};
|
80
|
|
- printf "\n";
|
81
|
|
-}
|
|
51
|
+ my $pci = $rom->pci_header();
|
|
52
|
+ if ( $pci ) {
|
|
53
|
+ printf "PCI header:\n\n";
|
|
54
|
+ printf " %-16s %s\n", "Signature:", $pci->{signature};
|
|
55
|
+ printf " %-16s 0x%04x\n", "Vendor ID:", $pci->{vendor_id};
|
|
56
|
+ printf " %-16s 0x%04x\n", "Device ID:", $pci->{device_id};
|
|
57
|
+ printf " %-16s 0x%02x%02x%02x\n", "Device class:",
|
|
58
|
+ $pci->{base_class}, $pci->{sub_class}, $pci->{prog_intf};
|
|
59
|
+ printf " %-16s 0x%04x (%d)\n", "Image length:",
|
|
60
|
+ $pci->{image_length}, ( $pci->{image_length} * 512 );
|
|
61
|
+ printf " %-16s 0x%04x (%d)\n", "Runtime length:",
|
|
62
|
+ $pci->{runtime_length}, ( $pci->{runtime_length} * 512 );
|
|
63
|
+ printf " %-16s 0x%02x\n", "Code type:", $pci->{code_type};
|
|
64
|
+ if ( exists $pci->{conf_header} ) {
|
|
65
|
+ printf " %-16s 0x%04x\n", "Config header:", $pci->{conf_header};
|
|
66
|
+ printf " %-16s 0x%04x\n", "CLP entry:", $pci->{clp_entry};
|
|
67
|
+ }
|
|
68
|
+ printf "\n";
|
|
69
|
+ }
|
|
70
|
+
|
|
71
|
+ my $pnp = $rom->pnp_header();
|
|
72
|
+ if ( $pnp ) {
|
|
73
|
+ printf "PnP header:\n\n";
|
|
74
|
+ printf " %-16s %s\n", "Signature:", $pnp->{signature};
|
|
75
|
+ printf " %-16s 0x%02x (%s0x%02x)\n", "Checksum:", $pnp->{checksum},
|
|
76
|
+ ( ( $pnp->checksum == 0 ) ? "" : "INCORRECT: " ), $pnp->checksum;
|
|
77
|
+ printf " %-16s 0x%04x \"%s\"\n", "Manufacturer:",
|
|
78
|
+ $pnp->{manufacturer}, $pnp->manufacturer;
|
|
79
|
+ printf " %-16s 0x%04x \"%s\"\n", "Product:",
|
|
80
|
+ $pnp->{product}, $pnp->product;
|
|
81
|
+ printf " %-16s 0x%04x\n", "BCV:", $pnp->{bcv};
|
|
82
|
+ printf " %-16s 0x%04x\n", "BDV:", $pnp->{bdv};
|
|
83
|
+ printf " %-16s 0x%04x\n", "BEV:", $pnp->{bev};
|
|
84
|
+ printf "\n";
|
|
85
|
+ }
|
|
86
|
+
|
|
87
|
+} while ( $rom = $rom->next_image );
|