diff options
author | tyler_bell_hp <tyler_bell_hp> | 2015-08-04 15:28:50 +0000 |
---|---|---|
committer | tyler_bell_hp <tyler_bell_hp> | 2015-08-04 15:28:50 +0000 |
commit | b7aa6839a4c49bab70a6bc96a0c6302085622d3a (patch) | |
tree | b6a416ab8ba541158e350610779be5ebe69244ab /dmioem.c | |
parent | 866a482faa9688bc37da818a641d71c7d6a880d3 (diff) | |
download | dmidecode-master.tar.gz |
Decoded HP-specific DMI type 233, and refactored 209 and 221 to use a common function. Also documented specs for these typesHEADoriginmaster
Diffstat (limited to 'dmioem.c')
-rw-r--r-- | dmioem.c | 86 |
1 files changed, 71 insertions, 15 deletions
@@ -65,9 +65,34 @@ void dmi_set_vendor(const char *s) /* * HP-specific data structures are decoded here. * - * Code contributed by John Cagle. + * Code contributed by John Cagle and Tyler Bell. */ +static void dmi_print_hp_net_iface_rec(u8 id, u8 bus, u8 dev, const u8 *mac) +{ + /* Some systems do not provide an id. nic_ctr provides an artificial + * id, and assumes the records will be provided "in order". Also, + * using 0xFF marker is not future proof. 256 NICs is a lot, but + * 640K ought to be enough for anybody(said no one, ever). + * */ + static u8 nic_ctr; + + if (id == 0xFF) + id = ++nic_ctr; + + if (dev == 0x00 && bus == 0x00) + printf("\tNIC %d: Disabled\n", id); + else if (dev == 0xFF && bus == 0xFF) + printf("\tNIC %d: Not Installed\n", id); + else + { + printf("\tNIC %d: PCI device %02x:%02x.%x, " + "MAC address %02X:%02X:%02X:%02X:%02X:%02X\n", + id, bus, dev >> 3, dev & 7, + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); + } +} + static int dmi_decode_hp(const struct dmi_header *h) { u8 *data = h->data; @@ -98,6 +123,19 @@ static int dmi_decode_hp(const struct dmi_header *h) * * This prints the BIOS NIC number, * PCI bus/device/function, and MAC address + * + * Type 209: + * Offset | Name | Width | Description + * ------------------------------------- + * 0x00 | Type | BYTE | 0xD1, MAC Info + * 0x01 | Length | BYTE | Length of structure + * 0x02 | Handle | WORD | Unique handle + * 0x04 | Dev No | BYTE | PCI Device/Function No + * 0x05 | Bus No | BYTE | PCI Bus + * 0x06 | MAC | 6B | MAC addr + * 0x0C | NIC #2 | 8B | Repeat 0x04-0x0B + * + * Type 221: is deprecated in the latest docs */ printf(h->type == 221 ? "HP BIOS iSCSI NIC PCI and MAC Information\n" : @@ -106,25 +144,43 @@ static int dmi_decode_hp(const struct dmi_header *h) ptr = 4; while (h->length >= ptr + 8) { - if (data[ptr] == 0x00 && data[ptr + 1] == 0x00) - printf("\tNIC %d: Disabled\n", nic); - else if (data[ptr] == 0xFF && data[ptr + 1] == 0xFF) - printf("\tNIC %d: Not Installed\n", nic); - else - { - printf("\tNIC %d: PCI device %02x:%02x.%x, " - "MAC address %02X:%02X:%02X:%02X:%02X:%02X\n", - nic, data[ptr + 1], - data[ptr] >> 3, data[ptr] & 7, - data[ptr + 2], data[ptr + 3], - data[ptr + 4], data[ptr + 5], - data[ptr + 6], data[ptr + 7]); - } + dmi_print_hp_net_iface_rec(nic, + data[ptr + 0x01], + data[ptr], + &data[ptr + 0x02]); nic++; ptr += 8; } break; + case 233: + /* + * Vendor Specific: HP ProLiant NIC MAC Information + * + * This prints the BIOS NIC number, + * PCI bus/device/function, and MAC address + * + * Offset | Name | Width | Description + * ------------------------------------- + * 0x00 | Type | BYTE | 0xE9, NIC structure + * 0x01 | Length | BYTE | Length of structure + * 0x02 | Handle | WORD | Unique handle + * 0x04 | Grp No | WORD | 0 for single segment + * 0x06 | Bus No | BYTE | PCI Bus + * 0x07 | Dev No | BYTE | PCI Device/Function No + * 0x08 | MAC | 32B | MAC addr padded w/ 0s + * 0x28 | Port No| BYTE | Each NIC maps to a Port + */ + printf("HP BIOS PXE NIC PCI and MAC Information\n"); + if (h->length < 0x0E) break; + /* If the record isn't long enough, we don't have an ID + * use 0xFF to use the internal counter. + * */ + nic = h->length > 0x28 ? data[0x28] : 0xFF; + dmi_print_hp_net_iface_rec(nic, data[0x06], data[0x07], + &data[0x08]); + break; + case 212: /* * Vendor Specific: HP 64-bit CRU Information |