1 | /*␊ |
2 | * Copyright (c) 1998-2009 Apple Computer, Inc. All rights reserved.␊ |
3 | *␊ |
4 | * @APPLE_LICENSE_HEADER_START@␊ |
5 | * ␊ |
6 | * The contents of this file constitute Original Code as defined in and␊ |
7 | * are subject to the Apple Public Source License Version 1.1 (the␊ |
8 | * "License"). You may not use this file except in compliance with the␊ |
9 | * License. Please obtain a copy of the License at␊ |
10 | * http://www.apple.com/publicsource and read it before using this file.␊ |
11 | * ␊ |
12 | * This Original Code and all software distributed under the License are␊ |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the␊ |
17 | * License for the specific language governing rights and limitations␊ |
18 | * under the License.␊ |
19 | * ␊ |
20 | * @APPLE_LICENSE_HEADER_END@␊ |
21 | */␊ |
22 | ␊ |
23 | #ifndef __LIBSAIO_SMBIOS_H␊ |
24 | #define __LIBSAIO_SMBIOS_H␊ |
25 | ␊ |
26 | //␊ |
27 | // Based on System Management BIOS Reference Specification v2.5␊ |
28 | //␊ |
29 | ␊ |
30 | typedef uint8_t SMBString;␊ |
31 | typedef uint8_t SMBByte;␊ |
32 | typedef uint16_t SMBWord;␊ |
33 | typedef uint32_t SMBDWord;␊ |
34 | typedef uint64_t SMBQWord;␊ |
35 | ␊ |
36 | ␊ |
37 | typedef struct DMIEntryPoint␊ |
38 | {␊ |
39 | SMBByte anchor[5];␊ |
40 | SMBByte checksum;␊ |
41 | SMBWord tableLength;␊ |
42 | SMBDWord tableAddress;␊ |
43 | SMBWord structureCount;␊ |
44 | SMBByte bcdRevision;␊ |
45 | } __attribute__((packed)) DMIEntryPoint;␊ |
46 | ␊ |
47 | typedef struct SMBEntryPoint␊ |
48 | {␊ |
49 | SMBByte anchor[4];␊ |
50 | SMBByte checksum;␊ |
51 | SMBByte entryPointLength;␊ |
52 | SMBByte majorVersion;␊ |
53 | SMBByte minorVersion;␊ |
54 | SMBWord maxStructureSize;␊ |
55 | SMBByte entryPointRevision;␊ |
56 | SMBByte formattedArea[5];␊ |
57 | DMIEntryPoint dmi;␊ |
58 | } __attribute__((packed)) SMBEntryPoint;␊ |
59 | ␊ |
60 | /* Header common to all SMBIOS structures */␊ |
61 | typedef struct SMBStructHeader␊ |
62 | {␊ |
63 | ␉SMBByte␉type;␊ |
64 | ␉SMBByte␉length;␊ |
65 | ␉SMBWord␉handle;␊ |
66 | //␉SMBByte␉*data;␊ |
67 | } __attribute__((packed)) SMBStructHeader;␊ |
68 | ␊ |
69 | #define SMB_STRUCT_HEADER SMBStructHeader header;␊ |
70 | ␊ |
71 | typedef struct SMBAnchor␊ |
72 | {␊ |
73 | ␉const SMBStructHeader *␉header;␊ |
74 | ␉const uint8_t *␉␉␉next;␊ |
75 | ␉const uint8_t *␉␉␉end;␊ |
76 | } SMBAnchor;␊ |
77 | ␊ |
78 | #define SMB_ANCHOR_IS_VALID(x)␉\␊ |
79 | ␉((x) && ((x)->header) && ((x)->next) && ((x)->end))␊ |
80 | ␊ |
81 | #define SMB_ANCHOR_RESET(x)␉␉\␊ |
82 | ␉bzero(x, sizeof(typedef struct SMBAnchor));␊ |
83 | ␊ |
84 | /*␊ |
85 | =======================␊ |
86 | SMBIOS structure types.␊ |
87 | =======================*/␊ |
88 | enum␊ |
89 | {␊ |
90 | ␉kSMBTypeBIOSInformation␉␉␉= 0, // BIOS information (Type 0)␊ |
91 | ␉kSMBTypeSystemInformation␉␉= 1, // System Information (Type 1)␊ |
92 | ␉kSMBTypeBaseBoard␉␉␉= 2, // BaseBoard Information (Type 2)␊ |
93 | ␉kSMBTypeSystemEnclosure␉␉␉= 3, // System Chassis Information (Type 3)␊ |
94 | ␉kSMBTypeProcessorInformation␉␉= 4, // Processor Information (Type 4)␊ |
95 | ␉// Memory Controller Information (Type 5) Obsolete␊ |
96 | ␉kSMBTypeMemoryModule␉␉␉= 6, // Memory Module Information (Type 6) Obsolete␊ |
97 | ␉kSMBTypeCacheInformation␉␉= 7, // Cache Information (Type 7)␊ |
98 | ␉// Port Connector Information (Type 8)␊ |
99 | ␉kSMBTypeSystemSlot␉␉␉= 9, // System Slots (Type 9)␊ |
100 | ␉// On Board Devices Information (Type 10) Obsolete␊ |
101 | ␉// kSMBOEMStrings␉␉␉= 11 ,// OEM Strings (Type 11)␊ |
102 | ␉// System Configuration Options (Type 12)␊ |
103 | ␉// BIOS Language Information (Type 13)␊ |
104 | ␉// Group Associations (Type 14)␊ |
105 | ␉// System Event Log (Type 15)␊ |
106 | ␉kSMBTypePhysicalMemoryArray␉␉= 16, // Physical Memory Array (Type 16)␊ |
107 | ␉kSMBTypeMemoryDevice␉␉␉= 17, // Memory Device (Type 17)␊ |
108 | ␉kSMBType32BitMemoryErrorInfo␉␉= 18, // 32-Bit Memory Error Information (Type 18)␊ |
109 | ␉// Memory Array Mapped Address (Type 19)␊ |
110 | ␉// Memory Device Mapped Address (Type 20)␊ |
111 | ␉// Built-in Pointing Device (Type 21)␊ |
112 | ␉// Portable Battery (Type 22)␊ |
113 | ␉// System Reset (Type 23)␊ |
114 | ␉// Hardware Security (Type 24)␊ |
115 | ␉// System Power Controls (Type 25)␊ |
116 | ␉// Voltage Probe (Type 26)␊ |
117 | ␉// Cooling Device (Type 27)␊ |
118 | ␉// Temperature Probe (Type 28)␊ |
119 | ␉// Electrical Current Probe (Type 29)␊ |
120 | ␉// Out-of-Band Remote Access (Type 30)␊ |
121 | ␉// Boot Integrity Service (BIS) Entry Point (Type 31)␊ |
122 | ␉// System Boot Information (Type 32)␊ |
123 | ␉kSMBType64BitMemoryErrorInfo␉␉= 33, // 64-Bit Memory Error Information (Type 33)␊ |
124 | ␉// Managment Device (Type 34)␊ |
125 | ␉// Managment Device Component (Type 35)␊ |
126 | ␉// Management Device Threshold Data (Type 36)␊ |
127 | ␉// Memory Channel (Type 37)␊ |
128 | ␉// IPMI Device Information (Type 38)␊ |
129 | ␉// System Power Supply (Type 39)␊ |
130 | ␉// Additional Information (Type 40)␊ |
131 | ␉// Onboard Devices Extended Information (Type 41)␊ |
132 | ␉// Management Controlle Host Interface (Type 42)␊ |
133 | ␊ |
134 | ␉// Inactive (Type 126)␊ |
135 | ␉kSMBTypeEndOfTable␉␉␉= 127, // End-of-Table (Type 127)␊ |
136 | ␊ |
137 | ␉/* Apple Specific Structures */␊ |
138 | ␉kSMBTypeFirmwareVolume␉␉␉= 128, // FirmwareVolume (TYPE 128)␊ |
139 | ␉kSMBTypeMemorySPD␉␉␉= 130, // MemorySPD (TYPE 130)␊ |
140 | ␉kSMBTypeOemProcessorType␉␉= 131, // Processor Type (Type 131)␊ |
141 | ␉kSMBTypeOemProcessorBusSpeed␉␉= 132 //Processor Bus Speed (Type 132)␊ |
142 | };␊ |
143 | ␊ |
144 | /* =======================␊ |
145 | BIOS Information (Type 0)␊ |
146 | ========================= */␊ |
147 | typedef struct SMBBIOSInformation␊ |
148 | {␊ |
149 | SMB_STRUCT_HEADER␊ |
150 | SMBString vendor; // BIOS vendor name␊ |
151 | SMBString version; // BIOS version␊ |
152 | SMBWord startSegment; // BIOS segment start␊ |
153 | SMBString releaseDate; // BIOS release date␊ |
154 | SMBByte romSize; // BIOS ROM Size (n); 64K * (n+1) bytes␊ |
155 | SMBQWord characteristics; // supported BIOS functions␊ |
156 | // Bungo␊ |
157 | SMBByte characteristicsExt1; // BIOS characteristics extension byte 1␊ |
158 | SMBByte characteristicsExt2; // BIOS characteristics extension byte 2␊ |
159 | SMBByte releaseMajor; // BIOS release (major)␊ |
160 | SMBByte releaseMinor; // BIOS release (minor)␊ |
161 | SMBByte ECreleaseMajor; // Embedded Controller firmware release (major)␊ |
162 | SMBByte ECreleaseMinor; // Embedded Controller firmware release (minor)␊ |
163 | } __attribute__((packed)) SMBBIOSInformation;␊ |
164 | ␊ |
165 | /* =========================␊ |
166 | System Information (Type 1)␊ |
167 | =========================== */␊ |
168 | typedef struct SMBSystemInformation␊ |
169 | {␊ |
170 | // 2.0+ spec (8 bytes)␊ |
171 | SMB_STRUCT_HEADER␊ |
172 | SMBString manufacturer;␊ |
173 | SMBString productName;␊ |
174 | SMBString version;␊ |
175 | SMBString serialNumber;␊ |
176 | // 2.1+ spec (25 bytes)␊ |
177 | SMBByte uuid[16]; // can be all 0 or all 1's␊ |
178 | SMBByte wakeupReason; // reason for system wakeup␊ |
179 | // 2.4+ spec (27 bytes)␊ |
180 | SMBString skuNumber;␊ |
181 | SMBString family;␊ |
182 | } __attribute__((packed)) SMBSystemInformation;␊ |
183 | ␊ |
184 | /* =========================================␊ |
185 | Base Board (or Module) Information (Type 2)␊ |
186 | =========================================== */␊ |
187 | typedef struct SMBBaseBoard␊ |
188 | {␊ |
189 | ␉SMB_STRUCT_HEADER // Type 2␊ |
190 | ␉SMBString␉manufacturer;␊ |
191 | ␉SMBString␉product;␊ |
192 | ␉SMBString␉version;␊ |
193 | ␉SMBString␉serialNumber;␊ |
194 | ␉SMBString␉assetTagNumber;␊ |
195 | ␉SMBByte featureFlags;␉␉␉// Collection of flag that identify features of this baseboard␊ |
196 | ␉SMBString␉locationInChassis;␊ |
197 | ␉SMBWord chassisHandle;␊ |
198 | ␉SMBByte boardType;␉␉␉␉// Type of board␊ |
199 | ␉SMBByte numberOfContainedHandles;␊ |
200 | //␉SMBWord containedObjectHandles[1];␊ |
201 | ␉// 0 - 255 contained handles go here but we do not include␊ |
202 | ␉// them in our structure. Be careful to use numberOfContainedHandles␊ |
203 | ␉// times sizeof(SMBWord) when computing the actual record size,␊ |
204 | ␉// if you need it.␊ |
205 | } __attribute__((packed)) SMBBaseBoard;␊ |
206 | ␊ |
207 | /* ====================================␊ |
208 | Values for boardType in Type 2 records␊ |
209 | ====================================== */␊ |
210 | enum␊ |
211 | {␊ |
212 | kSMBBaseBoardUnknown = 0x01,␉// Unknow␊ |
213 | kSMBBaseBoardOther = 0x02,␉// Other␊ |
214 | kSMBBaseBoardServerBlade = 0x03,␉// Server Blade␊ |
215 | kSMBBaseBoardConnectivitySwitch = 0x04,␉// Connectivity Switch␊ |
216 | kSMBBaseBoardSystemMgmtModule = 0x05,␉// System Management Module␊ |
217 | kSMBBaseBoardProcessorModule = 0x06,␉// Processor Module␊ |
218 | kSMBBaseBoardIOModule = 0x07,␉// I/O Module␊ |
219 | kSMBBaseBoardMemoryModule = 0x08,␉// Memory Module␊ |
220 | kSMBBaseBoardDaughter = 0x09,␉// Daughter Board␊ |
221 | kSMBBaseBoardMotherboard = 0x0A,␉// Motherboard (includes processor, memory, and I/O)␊ |
222 | kSMBBaseBoardProcessorMemoryModule = 0x0B,␉// Processor/Memory Module␊ |
223 | kSMBBaseBoardProcessorIOModule = 0x0C,␉// Processor/IO Module␊ |
224 | kSMBBaseBoardInterconnect = 0x0D␉// Interconnect board␊ |
225 | };␊ |
226 | ␊ |
227 | /* =======================␊ |
228 | System Enclosure (Type 3)␊ |
229 | ========================= */␊ |
230 | typedef struct SMBSystemEnclosure␊ |
231 | {␊ |
232 | ␉SMB_STRUCT_HEADER // Type 3␊ |
233 | ␉SMBString manufacturer;␊ |
234 | ␉SMBByte type;␉␉// System Enclosure Indicator␊ |
235 | ␉SMBString version;␉␉// Board Number?␊ |
236 | ␉SMBString serialNumber;␊ |
237 | ␉SMBString assetTagNumber;␊ |
238 | ␉SMBByte bootupState;␉␉// State of enclosure when when it was last booted␊ |
239 | ␉SMBByte powerSupplyState;␉// State of enclosure's power supply when last booted␊ |
240 | ␉SMBByte thermalState;␉// Thermal state of the enclosure when last booted␊ |
241 | ␉SMBByte securityStatus;␉// Physical security status of the enclosure when last booted␊ |
242 | ␉SMBDWord oemDefined;␉␉// OEM- or BIOS vendor-specific information␊ |
243 | //␉SMBByte height;␉␉// Height of the enclosure, in 'U's␊ |
244 | //␉SMBByte numberOfPowerCords;␉// Number of power cords associated with the enclosure or chassis␊ |
245 | //␉SMBByte containedElementCount;␉// Number of Contained Element record that follow, in the range 0 to 255␊ |
246 | //␉SMBByte containedElementRecord;␉// Byte leght of each Contained Element record that follow, in the range 0 to 255␊ |
247 | //␉SMBByte␉containedElements;␉// Elements, possibly defined by other SMBIOS structures present in chassis␊ |
248 | //␉SMBString skuNumber;␉␉// Number of null-terminated string describing the chassis or enclosure SKU number (2.7+)␊ |
249 | } __attribute__((packed)) SMBSystemEnclosure;␊ |
250 | ␊ |
251 | /* ============================␊ |
252 | Processor Information (Type 4)␊ |
253 | ============================== */␊ |
254 | typedef struct SMBProcessorInformation␊ |
255 | {␊ |
256 | ␉// 2.0+ spec (26 bytes)␊ |
257 | ␉SMB_STRUCT_HEADER // Type 4␊ |
258 | ␉SMBString socketDesignation;␊ |
259 | ␉SMBByte processorType; // CPU = 3␊ |
260 | ␉SMBByte processorFamily; // processor family enum␊ |
261 | ␉SMBString manufacturer;␊ |
262 | ␉SMBQWord processorID; // based on CPUID␊ |
263 | ␉SMBString processorVersion;␊ |
264 | ␉SMBByte voltage; // bit7 cleared indicate legacy mode␊ |
265 | ␉SMBWord externalClock; // external clock in MHz␊ |
266 | ␉SMBWord maximumClock; // max internal clock in MHz␊ |
267 | ␉SMBWord currentClock; // current internal clock in MHz␊ |
268 | ␉SMBByte status;␊ |
269 | ␉SMBByte processorUpgrade; // processor upgrade enum␊ |
270 | ␉// 2.1+ spec (32 bytes)␊ |
271 | ␉SMBWord L1CacheHandle;␊ |
272 | ␉SMBWord L2CacheHandle;␊ |
273 | ␉SMBWord L3CacheHandle;␊ |
274 | ␉// 2.3+ spec (35 bytes)␊ |
275 | ␉SMBString serialNumber;␊ |
276 | ␉SMBString assetTag;␊ |
277 | ␉SMBString partNumber;␊ |
278 | ␉// 2.5+ spec␊ |
279 | //␉SMBByte coreCount;␊ |
280 | //␉SMBByte coreEnabled;␊ |
281 | //␉SMBByte threadCount;␊ |
282 | //␉SMBWord processorCharacteristics;␊ |
283 | ␉// 2.6+ spec␊ |
284 | //␉SMBWord processorFamily2;␊ |
285 | } __attribute__((packed)) SMBProcessorInformation;␊ |
286 | ␊ |
287 | #define kSMBProcessorInformationMinSize 26␊ |
288 | ␊ |
289 | /* =======================================================================␊ |
290 | Memory Controller Information (Type 5) Obsoleted since SMBIOS version 2.1␊ |
291 | ========================================================================= */␊ |
292 | ␊ |
293 | /* ===================================================================␊ |
294 | Memory Module Information (Type 6) Obsoleted since SMBIOS version 2.1␊ |
295 | ===================================================================== */␊ |
296 | typedef struct SMBMemoryModule␊ |
297 | {␊ |
298 | SMB_STRUCT_HEADER // Type 6␊ |
299 | SMBString socketDesignation;␊ |
300 | SMBByte bankConnections;␊ |
301 | SMBByte currentSpeed;␊ |
302 | SMBWord currentMemoryType;␊ |
303 | SMBByte installedSize;␊ |
304 | SMBByte enabledSize;␊ |
305 | SMBByte errorStatus;␊ |
306 | } __attribute__((packed)) SMBMemoryModule;␊ |
307 | ␊ |
308 | #define kSMBMemoryModuleSizeNotDeterminable 0x7D␊ |
309 | #define kSMBMemoryModuleSizeNotEnabled 0x7E␊ |
310 | #define kSMBMemoryModuleSizeNotInstalled 0x7F␊ |
311 | ␊ |
312 | /* ========================␊ |
313 | Cache Information (Type 7)␊ |
314 | ========================== */␊ |
315 | typedef struct SMBCacheInformation␊ |
316 | {␊ |
317 | SMB_STRUCT_HEADER // Type 7␊ |
318 | SMBString socketDesignation;␊ |
319 | SMBWord cacheConfiguration;␊ |
320 | SMBWord maximumCacheSize;␊ |
321 | SMBWord installedSize;␊ |
322 | SMBWord supportedSRAMType;␊ |
323 | SMBWord currentSRAMType;␊ |
324 | SMBByte cacheSpeed;␊ |
325 | SMBByte errorCorrectionType;␊ |
326 | SMBByte systemCacheType;␊ |
327 | SMBByte associativity;␊ |
328 | } __attribute__((packed)) SMBCacheInformation;␊ |
329 | ␊ |
330 | /* ===================␊ |
331 | System Slots (Type 9)␊ |
332 | ===================== */␊ |
333 | typedef struct SMBSystemSlot␊ |
334 | {␊ |
335 | // 2.0+ spec (12 bytes)␊ |
336 | ␉SMB_STRUCT_HEADER␊ |
337 | ␉SMBString slotDesignation;␊ |
338 | ␉SMBByte slotType;␊ |
339 | ␉SMBByte slotDataBusWidth;␊ |
340 | ␉SMBByte currentUsage;␊ |
341 | ␉SMBByte slotLength;␊ |
342 | ␉SMBWord slotID;␊ |
343 | ␉SMBByte slotCharacteristics1;␊ |
344 | ␉// 2.1+ spec (13 bytes)␊ |
345 | ␉SMBByte slotCharacteristics2;␊ |
346 | ␉// 2.6+ spec␊ |
347 | //␉SMBWord␉␉segmentGroupNumber;␊ |
348 | //␉SMBByte␉␉busNumber;␊ |
349 | //␉SMBByte␉␉devFuncNumber;␊ |
350 | } __attribute__((packed)) SMBSystemSlot;␊ |
351 | ␊ |
352 | /* ===================␊ |
353 | OEM Strings (Type 11)␊ |
354 | ===================== */␊ |
355 | //typedef struct SMBOEMStrings␊ |
356 | //{␊ |
357 | //␉SMB_STRUCT_HEADER // Type 11␊ |
358 | //␉SMBByte␉␉count;␉␉// number of strings␊ |
359 | //} __attribute__((packed)) SMBOEMStrings;␊ |
360 | ␊ |
361 | /* =============================␊ |
362 | Physical Memory Array (Type 16)␊ |
363 | =============================== */␊ |
364 | typedef struct SMBPhysicalMemoryArray␊ |
365 | {␊ |
366 | ␉// 2.1+ spec (15 bytes)␊ |
367 | ␉SMB_STRUCT_HEADER // Type 16␊ |
368 | ␉SMBByte physicalLocation; // physical location␊ |
369 | ␉SMBByte arrayUse; // the use for the memory array␊ |
370 | ␉SMBByte errorCorrection; // error correction/detection method␊ |
371 | ␉SMBDWord maximumCapacity; // maximum memory capacity in kilobytes␊ |
372 | ␉SMBWord errorHandle; // handle of a previously detected error␊ |
373 | ␉SMBWord numMemoryDevices; // number of memory slots or sockets␊ |
374 | ␉// 2.7+ spec␊ |
375 | //␉SMBQWord extMaximumCapacity;␉// maximum memory capacity in bytes␊ |
376 | } __attribute__((packed)) SMBPhysicalMemoryArray;␊ |
377 | ␊ |
378 | /* ================␊ |
379 | Memory Array - Use␊ |
380 | ================== */␊ |
381 | enum␊ |
382 | {␊ |
383 | kSMBMemoryArrayUseOther = 0x01,␊ |
384 | kSMBMemoryArrayUseUnknown = 0x02,␊ |
385 | kSMBMemoryArrayUseSystemMemory = 0x03,␊ |
386 | kSMBMemoryArrayUseVideoMemory = 0x04,␊ |
387 | kSMBMemoryArrayUseFlashMemory = 0x05,␊ |
388 | kSMBMemoryArrayUseNonVolatileMemory = 0x06,␊ |
389 | kSMBMemoryArrayUseCacheMemory = 0x07␊ |
390 | };␊ |
391 | ␊ |
392 | /* ===================================␊ |
393 | Memory Array - Error Correction Types␊ |
394 | ===================================== */␊ |
395 | enum␊ |
396 | {␊ |
397 | kSMBMemoryArrayErrorCorrectionTypeOther = 0x01,␊ |
398 | kSMBMemoryArrayErrorCorrectionTypeUnknown = 0x02,␊ |
399 | kSMBMemoryArrayErrorCorrectionTypeNone = 0x03,␊ |
400 | kSMBMemoryArrayErrorCorrectionTypeParity = 0x04,␊ |
401 | kSMBMemoryArrayErrorCorrectionTypeSingleBitECC = 0x05,␊ |
402 | kSMBMemoryArrayErrorCorrectionTypeMultiBitECC = 0x06,␊ |
403 | kSMBMemoryArrayErrorCorrectionTypeCRC = 0x07␊ |
404 | };␊ |
405 | ␊ |
406 | /* =====================␊ |
407 | Memory Device (Type 17)␊ |
408 | ======================= */␊ |
409 | typedef struct SMBMemoryDevice␊ |
410 | {␊ |
411 | ␉// 2.1+ spec (21 bytes)␊ |
412 | ␉SMB_STRUCT_HEADER // Type 17␊ |
413 | ␉SMBWord arrayHandle; // handle of the parent memory array␊ |
414 | ␉SMBWord errorHandle; // handle of a previously detected error␊ |
415 | ␉SMBWord totalWidth; // total width in bits; including ECC bits␊ |
416 | ␉SMBWord dataWidth; // data width in bits␊ |
417 | ␉SMBWord memorySize; // bit15 is scale, 0 = MB, 1 = KB␊ |
418 | ␉SMBByte formFactor; // memory device form factor␊ |
419 | ␉SMBByte deviceSet; // parent set of identical memory devices␊ |
420 | ␉SMBString deviceLocator; // labeled socket; e.g. "SIMM 3"␊ |
421 | ␉SMBString bankLocator; // labeled bank; e.g. "Bank 0" or "A"␊ |
422 | ␉SMBByte memoryType; // type of memory␊ |
423 | ␉SMBWord memoryTypeDetail; // additional detail on memory type␊ |
424 | ␉// 2.3+ spec (27 bytes)␊ |
425 | ␉SMBWord memorySpeed; // speed of device in MHz (0 for unknown)␊ |
426 | ␉SMBString manufacturer;␊ |
427 | ␉SMBString serialNumber;␊ |
428 | ␉SMBString assetTag;␊ |
429 | ␉SMBString partNumber;␊ |
430 | ␉// 2.6+ spec␊ |
431 | //␉SMBByte memoryAtributes;␊ |
432 | ␉// 2.7+ spec␊ |
433 | //␉SMBDWord memoryExtSize;␊ |
434 | //␉SMBWord confMemClkSpeed;␊ |
435 | ␉// 2.8+ spec␊ |
436 | //␉SMBWord minimumVolt;␊ |
437 | //␉SMBWord maximumVolt;␊ |
438 | //␉SMBWord configuredVolt;␊ |
439 | } __attribute__((packed)) SMBMemoryDevice;␊ |
440 | ␊ |
441 | /* ===================================␊ |
442 | Memory Array Mapped Address (Type 19)␊ |
443 | ===================================== */␊ |
444 | //typedef struct SMBMemoryArrayMappedAddress␊ |
445 | //{␊ |
446 | // 2.1+ spec␊ |
447 | //␉SMB_STRUCT_HEADER // Type 19␊ |
448 | //␉SMBDWord startingAddress;␊ |
449 | //␉SMBDWord endingAddress;␊ |
450 | //␉SMBWord arrayHandle;␊ |
451 | //␉SMBByte partitionWidth;␊ |
452 | ␉// 2.7+ spec␊ |
453 | //␉SMBQWord extStartAddress;␊ |
454 | //␉SMBQWord extEndAddress;␊ |
455 | //} __attribute__((packed)) SMBMemoryArrayMappedAddress;␊ |
456 | ␊ |
457 | /* ====================================␊ |
458 | Memory Device Mapped Address (Type 20)␊ |
459 | ====================================== */␊ |
460 | //typedef struct SMBMemoryDeviceMappedAddress␊ |
461 | //{␊ |
462 | ␉// 2.1+ spec␊ |
463 | //␉SMB_STRUCT_HEADER // Type 20␊ |
464 | //␉SMBDWord startingAddress;␊ |
465 | //␉SMBDWord endingAddress;␊ |
466 | //␉SMBWord arrayHandle;␊ |
467 | //␉SMBByte partitionRowPosition;␊ |
468 | //␉SMBByte interleavePosition;␊ |
469 | //␉SMBByte interleaveDataDepth;␊ |
470 | ␉// 2.7+ spec␊ |
471 | //␉SMBQWord extStartAddress;␊ |
472 | //␉SMBQWord extEndAddress;␊ |
473 | //} __attribute__((packed)) SMBMemoryDeviceMappedAddress;␊ |
474 | ␊ |
475 | /* =====================================================␊ |
476 | Firmware Volume Description (Apple Specific - Type 128)␊ |
477 | ======================================================= */␊ |
478 | enum␊ |
479 | {␊ |
480 | ␉FW_REGION_RESERVED = 0,␊ |
481 | ␉FW_REGION_RECOVERY = 1,␊ |
482 | ␉FW_REGION_MAIN = 2,␊ |
483 | ␉FW_REGION_NVRAM = 3,␊ |
484 | ␉FW_REGION_CONFIG = 4,␊ |
485 | ␉FW_REGION_DIAGVAULT = 5,␊ |
486 | ␊ |
487 | ␉NUM_FLASHMAP_ENTRIES = 8␊ |
488 | };␊ |
489 | ␊ |
490 | typedef struct FW_REGION_INFO␊ |
491 | {␊ |
492 | ␉SMBDWord StartAddress;␊ |
493 | ␉SMBDWord EndAddress;␊ |
494 | } __attribute__((packed)) FW_REGION_INFO;␊ |
495 | ␊ |
496 | /* ========␊ |
497 | (Type 128)␊ |
498 | ========== */␊ |
499 | typedef struct SMBFirmwareVolume␊ |
500 | {␊ |
501 | ␉SMB_STRUCT_HEADER␉␉␉// Type 128␊ |
502 | ␉SMBByte RegionCount;␊ |
503 | ␉SMBByte Reserved[3];␊ |
504 | ␉SMBDWord FirmwareFeatures;␊ |
505 | ␉SMBDWord FirmwareFeaturesMask;␊ |
506 | ␉SMBByte RegionType[ NUM_FLASHMAP_ENTRIES ];␊ |
507 | ␉FW_REGION_INFO FlashMap[ NUM_FLASHMAP_ENTRIES ];␊ |
508 | } __attribute__((packed)) SMBFirmwareVolume;␊ |
509 | ␊ |
510 | /* ===========================================␊ |
511 | Memory SPD Data (Apple Specific - Type 130)␊ |
512 | ============================================= */␊ |
513 | typedef struct SMBMemorySPD␊ |
514 | {␊ |
515 | ␉SMB_STRUCT_HEADER␉␉␉// Type 130␊ |
516 | ␉SMBWord Type17Handle;␊ |
517 | ␉SMBWord Offset;␊ |
518 | ␉SMBWord Size;␊ |
519 | ␉SMBWord Data[];␊ |
520 | } __attribute__((packed)) SMBMemorySPD;␊ |
521 | ␊ |
522 | /* ============================================␊ |
523 | OEM Processor Type (Apple Specific - Type 131)␊ |
524 | ============================================== */␊ |
525 | typedef struct SMBOemProcessorType␊ |
526 | {␊ |
527 | ␉SMB_STRUCT_HEADER␉␉␉// Type131␊ |
528 | ␉SMBWord ProcessorType;␊ |
529 | } __attribute__((packed)) SMBOemProcessorType;␊ |
530 | ␊ |
531 | /* =================================================␊ |
532 | OEM Processor Bus Speed (Apple Specific - Type 132)␊ |
533 | =================================================== */␊ |
534 | typedef struct SMBOemProcessorBusSpeed␊ |
535 | {␊ |
536 | ␉SMB_STRUCT_HEADER␉␉␉// Type 132␊ |
537 | ␉SMBWord ProcessorBusSpeed; // MT/s unit␊ |
538 | } __attribute__((packed)) SMBOemProcessorBusSpeed;␊ |
539 | ␊ |
540 | //----------------------------------------------------------------------------------------------------------␊ |
541 | ␊ |
542 | /* From Foundation/Efi/Guid/Smbios/SmBios.h */␊ |
543 | /* Modified to wrap Data4 array init with {} */␊ |
544 | #define EFI_SMBIOS_TABLE_GUID {0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d}}␊ |
545 | ␊ |
546 | #define SMBIOS_ORIGINAL␉␉0␊ |
547 | #define SMBIOS_PATCHED␉␉1␊ |
548 | ␊ |
549 | extern void *getSmbios(int which);␊ |
550 | extern void readSMBIOSInfo(SMBEntryPoint *eps);␊ |
551 | extern void setupSMBIOSTable(void);␊ |
552 | ␊ |
553 | extern void decodeSMBIOSTable(SMBEntryPoint *eps);␊ |
554 | ␊ |
555 | ␊ |
556 | #endif /* !__LIBSAIO_SMBIOS_H */␊ |
557 | |