2 * Decoding of OEM-specific entries
3 * This file is part of the dmidecode project.
5 * Copyright (C) 2007-2008 Jean Delvare <khali@linux-fr.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include "dmidecode.h"
30 * Globals for vendor-specific decodes
33 enum DMI_VENDORS { VENDOR_UNKNOWN, VENDOR_HP };
35 static enum DMI_VENDORS dmi_vendor = VENDOR_UNKNOWN;
38 * Remember the system vendor for later use. We only actually store the
39 * value if we know how to decode at least one specific entry type for
42 void dmi_set_vendor(const char *s)
44 if (strcmp(s, "HP") == 0 || strcmp(s, "Hewlett-Packard") == 0)
45 dmi_vendor = VENDOR_HP;
49 * HP-specific data structures are decoded here.
51 * Code contributed by John Cagle.
54 static int dmi_decode_hp(const struct dmi_header *h)
63 * Vendor Specific: HP ProLiant System/Rack Locator
65 printf("HP ProLiant System/Rack Locator\n");
66 if (h->length < 0x0B) break;
67 printf("\tRack Name: %s\n", dmi_string(h, data[0x04]));
68 printf("\tEnclosure Name: %s\n", dmi_string(h, data[0x05]));
69 printf("\tEnclosure Model: %s\n", dmi_string(h, data[0x06]));
70 printf("\tEnclosure Serial: %s\n", dmi_string(h, data[0x0A]));
71 printf("\tEnclosure Bays: %d\n", data[0x08]);
72 printf("\tServer Bay: %s\n", dmi_string(h, data[0x07]));
73 printf("\tBays Filled: %d\n", data[0x09]);
79 * Vendor Specific: HP ProLiant NIC MAC Information
81 * This prints the BIOS NIC number,
82 * PCI bus/device/function, and MAC address
84 printf(h->type == 221 ?
85 "HP BIOS iSCSI NIC PCI and MAC Information\n" :
86 "HP BIOS NIC PCI and MAC Information\n");
89 while (h->length >= ptr + 8)
91 if (data[ptr] == 0x00 && data[ptr + 1] == 0x00)
92 printf("\tNIC %d: Disabled\n", nic);
93 else if (data[ptr] == 0xFF && data[ptr + 1] == 0xFF)
94 printf("\tNIC %d: Not Installed\n", nic);
97 printf("\tNIC %d: PCI device %02x:%02x.%x, "
98 "MAC address %02X:%02X:%02X:%02X:%02X:%02X\n",
100 data[ptr] >> 3, data[ptr] & 7,
101 data[ptr + 2], data[ptr + 3],
102 data[ptr + 4], data[ptr + 5],
103 data[ptr + 6], data[ptr + 7]);
117 * Dispatch vendor-specific entries decoding
118 * Return 1 if decoding was successful, 0 otherwise
120 int dmi_decode_oem(const struct dmi_header *h)
125 return dmi_decode_hp(h);