Browse Source

[util] Tidy up output of disrom.pl

tags/v0.9.7
Michael Brown 16 years ago
parent
commit
48b2f70ee4
1 changed files with 26 additions and 21 deletions
  1. 26
    21
      src/util/disrom.pl

+ 26
- 21
src/util/disrom.pl View File

@@ -36,41 +36,46 @@ die "ROM image truncated (is $filelength, should be $romlength)\n"
36 36
     if $filelength < $romlength;
37 37
 
38 38
 printf "ROM header:\n\n";
39
-printf "  Length:\t0x%02x (%d)\n", $rom->{length}, ( $rom->{length} * 512 );
40
-printf "  Checksum:\t0x%02x (0x%02x)\n", $rom->{checksum}, $rom->checksum;
41
-printf "  Init:\t\t0x%04x\n", $rom->{init};
42
-printf "  UNDI header:\t0x%04x\n", $rom->{undi_header};
43
-printf "  PCI header:\t0x%04x\n", $rom->{pci_header};
44
-printf "  PnP header:\t0x%04x\n", $rom->{pnp_header};
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};
45 46
 printf "\n";
46 47
 
47 48
 my $pci = $rom->pci_header();
48 49
 if ( $pci ) {
49 50
   printf "PCI header:\n\n";
50
-  printf "  Signature:\t%s\n", $pci->{signature};
51
-  printf "  Vendor id:\t0x%04x\n", $pci->{vendor_id};
52
-  printf "  Device id:\t0x%04x\n", $pci->{device_id};
53
-  printf "  Device class:\t0x%02x%02x%02x\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:",
54 55
 	 $pci->{base_class}, $pci->{sub_class}, $pci->{prog_intf};
55
-  printf "  Image length:\t0x%04x (%d)\n",
56
+  printf "  %-16s 0x%04x (%d)\n", "Image length:",
56 57
 	 $pci->{image_length}, ( $pci->{image_length} * 512 );
57
-  printf "  Runtime length:\t0x%04x (%d)\n",
58
+  printf "  %-16s 0x%04x (%d)\n", "Runtime length:",
58 59
 	 $pci->{runtime_length}, ( $pci->{runtime_length} * 512 );
59
-  printf "  Config header:\t0x%04x\n", $pci->{conf_header};
60
-  printf "  CLP entry:\t0x%04x\n", $pci->{clp_entry};
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
+  }
61 64
   printf "\n";
62 65
 }
63 66
 
64 67
 my $pnp = $rom->pnp_header();
65 68
 if ( $pnp ) {
66 69
   printf "PnP header:\n\n";
67
-  printf "  Signature:\t%s\n", $pnp->{signature};
68
-  printf "  Checksum:\t0x%02x (0x%02x)\n", $pnp->{checksum}, $pnp->checksum;
69
-  printf "  Manufacturer:\t0x%04x \"%s\"\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:",
70 74
 	 $pnp->{manufacturer}, $pnp->manufacturer;
71
-  printf "  Product:\t0x%04x \"%s\"\n", $pnp->{product}, $pnp->product;
72
-  printf "  BCV:\t\t0x%04x\n", $pnp->{bcv};
73
-  printf "  BDV:\t\t0x%04x\n", $pnp->{bdv};
74
-  printf "  BEV:\t\t0x%04x\n", $pnp->{bev};
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};
75 80
   printf "\n";
76 81
 }

Loading…
Cancel
Save