Skip to content

Commit 7460700

Browse files
author
Tyler Bell
committed
Decoded HP-specific DMI type 233, and refactored 209 and 221 to use a common function. Also documented specs for these types
1 parent d7749b2 commit 7460700

File tree

3 files changed

+78
-15
lines changed

3 files changed

+78
-15
lines changed

AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Jens Elkner <[email protected]>
1818
Jarod Wilson <[email protected]>
1919
Anton Arapov <[email protected]>
2020
Roy Franz <[email protected]>
21+
Tyler Bell <[email protected]>
2122

2223
MANY THANKS TO (IN CHRONOLOGICAL ORDER)
2324
Werner Heuser

CHANGELOG

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2015-08-04 Tyler Bell <[email protected]>
2+
3+
* dmioem.c: Decode HP-specific DMI type 233
4+
* dmioem.c: Refactored HP-specific types 209 and 221 to use common code
5+
* dmioem.c: Documented spec for HP-specific types 209, 221 and 233
6+
17
2015-05-21 Jean Delvare <[email protected]>
28

39
* dmidecode.c: Fix up invalid DMI type 34 structure length.

dmioem.c

+71-15
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,34 @@ void dmi_set_vendor(const char *s)
6565
/*
6666
* HP-specific data structures are decoded here.
6767
*
68-
* Code contributed by John Cagle.
68+
* Code contributed by John Cagle and Tyler Bell.
6969
*/
7070

71+
static void dmi_print_hp_net_iface_rec(u8 id, u8 bus, u8 dev, const u8 *mac)
72+
{
73+
/* Some systems do not provide an id. nic_ctr provides an artificial
74+
* id, and assumes the records will be provided "in order". Also,
75+
* using 0xFF marker is not future proof. 256 NICs is a lot, but
76+
* 640K ought to be enough for anybody(said no one, ever).
77+
* */
78+
static u8 nic_ctr;
79+
80+
if (id == 0xFF)
81+
id = ++nic_ctr;
82+
83+
if (dev == 0x00 && bus == 0x00)
84+
printf("\tNIC %d: Disabled\n", id);
85+
else if (dev == 0xFF && bus == 0xFF)
86+
printf("\tNIC %d: Not Installed\n", id);
87+
else
88+
{
89+
printf("\tNIC %d: PCI device %02x:%02x.%x, "
90+
"MAC address %02X:%02X:%02X:%02X:%02X:%02X\n",
91+
id, bus, dev >> 3, dev & 7,
92+
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
93+
}
94+
}
95+
7196
static int dmi_decode_hp(const struct dmi_header *h)
7297
{
7398
u8 *data = h->data;
@@ -98,6 +123,19 @@ static int dmi_decode_hp(const struct dmi_header *h)
98123
*
99124
* This prints the BIOS NIC number,
100125
* PCI bus/device/function, and MAC address
126+
*
127+
* Type 209:
128+
* Offset | Name | Width | Description
129+
* -------------------------------------
130+
* 0x00 | Type | BYTE | 0xD1, MAC Info
131+
* 0x01 | Length | BYTE | Length of structure
132+
* 0x02 | Handle | WORD | Unique handle
133+
* 0x04 | Dev No | BYTE | PCI Device/Function No
134+
* 0x05 | Bus No | BYTE | PCI Bus
135+
* 0x06 | MAC | 6B | MAC addr
136+
* 0x0C | NIC #2 | 8B | Repeat 0x04-0x0B
137+
*
138+
* Type 221: is deprecated in the latest docs
101139
*/
102140
printf(h->type == 221 ?
103141
"HP BIOS iSCSI NIC PCI and MAC Information\n" :
@@ -106,25 +144,43 @@ static int dmi_decode_hp(const struct dmi_header *h)
106144
ptr = 4;
107145
while (h->length >= ptr + 8)
108146
{
109-
if (data[ptr] == 0x00 && data[ptr + 1] == 0x00)
110-
printf("\tNIC %d: Disabled\n", nic);
111-
else if (data[ptr] == 0xFF && data[ptr + 1] == 0xFF)
112-
printf("\tNIC %d: Not Installed\n", nic);
113-
else
114-
{
115-
printf("\tNIC %d: PCI device %02x:%02x.%x, "
116-
"MAC address %02X:%02X:%02X:%02X:%02X:%02X\n",
117-
nic, data[ptr + 1],
118-
data[ptr] >> 3, data[ptr] & 7,
119-
data[ptr + 2], data[ptr + 3],
120-
data[ptr + 4], data[ptr + 5],
121-
data[ptr + 6], data[ptr + 7]);
122-
}
147+
dmi_print_hp_net_iface_rec(nic,
148+
data[ptr + 0x01],
149+
data[ptr],
150+
&data[ptr + 0x02]);
123151
nic++;
124152
ptr += 8;
125153
}
126154
break;
127155

156+
case 233:
157+
/*
158+
* Vendor Specific: HP ProLiant NIC MAC Information
159+
*
160+
* This prints the BIOS NIC number,
161+
* PCI bus/device/function, and MAC address
162+
*
163+
* Offset | Name | Width | Description
164+
* -------------------------------------
165+
* 0x00 | Type | BYTE | 0xE9, NIC structure
166+
* 0x01 | Length | BYTE | Length of structure
167+
* 0x02 | Handle | WORD | Unique handle
168+
* 0x04 | Grp No | WORD | 0 for single segment
169+
* 0x06 | Bus No | BYTE | PCI Bus
170+
* 0x07 | Dev No | BYTE | PCI Device/Function No
171+
* 0x08 | MAC | 32B | MAC addr padded w/ 0s
172+
* 0x28 | Port No| BYTE | Each NIC maps to a Port
173+
*/
174+
printf("HP BIOS PXE NIC PCI and MAC Information\n");
175+
if (h->length < 0x0E) break;
176+
/* If the record isn't long enough, we don't have an ID
177+
* use 0xFF to use the internal counter.
178+
* */
179+
nic = h->length > 0x28 ? data[0x28] : 0xFF;
180+
dmi_print_hp_net_iface_rec(nic, data[0x06], data[0x07],
181+
&data[0x08]);
182+
break;
183+
128184
case 212:
129185
/*
130186
* Vendor Specific: HP 64-bit CRU Information

0 commit comments

Comments
 (0)