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.4 */␊ |
28 | // http://dmtf.org/standards/smbios␊ |
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 | //kSMBTypeOemPlatformFeature␉␉= 133 // Platform Feature (Type 133)␊ |
143 | };␊ |
144 | ␊ |
145 | /* =======================␊ |
146 | BIOS Information (Type 0)␊ |
147 | ========================= */␊ |
148 | typedef struct SMBBIOSInformation␊ |
149 | {␊ |
150 | SMB_STRUCT_HEADER␊ |
151 | SMBString vendor; // BIOS vendor name␊ |
152 | SMBString version; // BIOS version␊ |
153 | SMBWord startSegment; // BIOS segment start␊ |
154 | SMBString releaseDate; // BIOS release date␊ |
155 | SMBByte romSize; // BIOS ROM Size (n); 64K * (n+1) bytes␊ |
156 | SMBQWord characteristics; // supported BIOS functions␊ |
157 | // Bungo␊ |
158 | SMBByte characteristicsExt1; // BIOS characteristics extension byte 1␊ |
159 | SMBByte characteristicsExt2; // BIOS characteristics extension byte 2␊ |
160 | SMBByte releaseMajor; // BIOS release (major)␊ |
161 | SMBByte releaseMinor; // BIOS release (minor)␊ |
162 | SMBByte ECreleaseMajor; // Embedded Controller firmware release (major)␊ |
163 | SMBByte ECreleaseMinor; // Embedded Controller firmware release (minor)␊ |
164 | } __attribute__((packed)) SMBBIOSInformation;␊ |
165 | ␊ |
166 | /* =========================␊ |
167 | System Information (Type 1)␊ |
168 | =========================== */␊ |
169 | typedef struct SMBSystemInformation␊ |
170 | {␊ |
171 | // 2.0+ spec (8 bytes)␊ |
172 | SMB_STRUCT_HEADER␊ |
173 | SMBString manufacturer;␊ |
174 | SMBString productName;␊ |
175 | SMBString version;␊ |
176 | SMBString serialNumber;␊ |
177 | // 2.1+ spec (25 bytes)␊ |
178 | SMBByte uuid[16]; // can be all 0 or all 1's␊ |
179 | SMBByte wakeupReason; // reason for system wakeup␊ |
180 | // 2.4+ spec (27 bytes)␊ |
181 | SMBString skuNumber;␊ |
182 | SMBString family;␊ |
183 | } __attribute__((packed)) SMBSystemInformation;␊ |
184 | ␊ |
185 | /* =========================================␊ |
186 | Base Board (or Module) Information (Type 2)␊ |
187 | =========================================== */␊ |
188 | typedef struct SMBBaseBoard␊ |
189 | {␊ |
190 | ␉SMB_STRUCT_HEADER // Type 2␊ |
191 | ␉SMBString␉manufacturer;␊ |
192 | ␉SMBString␉product;␊ |
193 | ␉SMBString␉version;␊ |
194 | ␉SMBString␉serialNumber;␊ |
195 | ␉SMBString␉assetTag;␉␉␉// Bungo: renamed from assetTagNumber folowing convention␊ |
196 | ␉SMBByte featureFlags;␉␉␉// Collection of flag that identify features of this baseboard␊ |
197 | ␉SMBString␉locationInChassis;␊ |
198 | ␉SMBWord chassisHandle;␊ |
199 | ␉SMBByte boardType;␉␉␉␉// Type of board␊ |
200 | ␉SMBByte numberOfContainedHandles;␊ |
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 | SMBByte containedObjectHandles;␊ |
206 | } __attribute__((packed)) SMBBaseBoard;␊ |
207 | ␊ |
208 | /* ====================================␊ |
209 | Values for boardType in Type 2 records␊ |
210 | ====================================== */␊ |
211 | enum␊ |
212 | {␊ |
213 | kSMBBaseBoardUnknown = 0x01,␉// Unknow␊ |
214 | kSMBBaseBoardOther = 0x02,␉// Other␊ |
215 | kSMBBaseBoardServerBlade = 0x03,␉// Server Blade␊ |
216 | kSMBBaseBoardConnectivitySwitch = 0x04,␉// Connectivity Switch␊ |
217 | kSMBBaseBoardSystemMgmtModule = 0x05,␉// System Management Module␊ |
218 | kSMBBaseBoardProcessorModule = 0x06,␉// Processor Module␊ |
219 | kSMBBaseBoardIOModule = 0x07,␉// I/O Module␊ |
220 | kSMBBaseBoardMemoryModule = 0x08,␉// Memory Module␊ |
221 | kSMBBaseBoardDaughter = 0x09,␉// Daughter Board␊ |
222 | kSMBBaseBoardMotherboard = 0x0A,␉// Motherboard (includes processor, memory, and I/O)␊ |
223 | kSMBBaseBoardProcessorMemoryModule = 0x0B,␉// Processor/Memory Module␊ |
224 | kSMBBaseBoardProcessorIOModule = 0x0C,␉// Processor/IO Module␊ |
225 | kSMBBaseBoardInterconnect = 0x0D␉// Interconnect board␊ |
226 | };␊ |
227 | ␊ |
228 | /* =======================␊ |
229 | System Enclosure (Type 3)␊ |
230 | ========================= */␊ |
231 | typedef struct SMBSystemEnclosure␊ |
232 | {␊ |
233 | ␉SMB_STRUCT_HEADER // Type 3␊ |
234 | ␉SMBString manufacturer;␊ |
235 | ␉SMBByte chassisType;␉␉// System Enclosure Indicator␊ |
236 | ␉SMBString version;␉␉// Board Number?␊ |
237 | ␉SMBString serialNumber;␊ |
238 | ␉SMBString assetTag;␉␉// Bungo: renamed from assetTagNumber folowing convention␊ |
239 | ␉SMBByte bootupState;␉␉// State of enclosure when when it was last booted␊ |
240 | ␉SMBByte powerSupplyState;␉// State of enclosure's power supply when last booted␊ |
241 | ␉SMBByte thermalState;␉// Thermal state of the enclosure when last booted␊ |
242 | ␉SMBByte securityStatus;␉// Physical security status of the enclosure when last booted␊ |
243 | ␉SMBDWord oemDefined;␉␉// OEM- or BIOS vendor-specific information␊ |
244 | SMBByte height;␉␉// Height of the enclosure, in 'U's␊ |
245 | SMBByte numberOfPowerCords;␉// Number of power cords associated with the enclosure or chassis␊ |
246 | SMBByte containedElementCount;␉// Number of Contained Element record that follow, in the range 0 to 255␊ |
247 | SMBByte containedElementRecord;␉// Byte leght of each Contained Element record that follow, in the range 0 to 255␊ |
248 | // SMBByte containedElements;␉// Elements, possibly defined by other SMBIOS structures present in chassis␊ |
249 | // SMBString skuNumber;␉␉// Number of null-terminated string describing the chassis or enclosure SKU number (2.7+)␊ |
250 | } __attribute__((packed)) SMBSystemEnclosure;␊ |
251 | ␊ |
252 | // Bungo: values for SMBSystemEnclosure.chassisType␊ |
253 | enum {␊ |
254 | kSMBchassisOther = 0x01,␊ |
255 | kSMBchassisUnknown = 0x02,␊ |
256 | kSMBchassisDesktop = 0x03,␊ |
257 | kSMBchassisLPDesktop = 0x04,␊ |
258 | kSMBchassisPizzaBox = 0x05,␊ |
259 | kSMBchassisMiniTower = 0x06,␊ |
260 | kSMBchassisTower = 0x07,␊ |
261 | kSMBchassisPortable = 0x08,␊ |
262 | kSMBchassisLaptop = 0x09,␊ |
263 | kSMBchassisNotebook = 0x0A,␊ |
264 | kSMBchassisHandHeld = 0x0B,␊ |
265 | kSMBchassisDockingStation = 0x0C,␊ |
266 | kSMBchassisAllInOne = 0x0D,␊ |
267 | kSMBchassisSubNotebook = 0x0E,␊ |
268 | // ... fill up if needed ;-)␊ |
269 | kSMBchassisLunchBox = 0x10,␊ |
270 | // ... fill up if needed ;-)␊ |
271 | kSMBchassisBladeEnclosing = 0x1D␊ |
272 | };␊ |
273 | ␊ |
274 | /* ============================␊ |
275 | Processor Information (Type 4)␊ |
276 | ============================== */␊ |
277 | typedef struct SMBProcessorInformation␊ |
278 | {␊ |
279 | ␉// 2.0+ spec (26 bytes)␊ |
280 | ␉SMB_STRUCT_HEADER // Type 4␊ |
281 | ␉SMBString socketDesignation;␊ |
282 | ␉SMBByte processorType; // CPU = 3␊ |
283 | ␉SMBByte processorFamily; // processor family enum␊ |
284 | ␉SMBString manufacturer;␊ |
285 | ␉SMBQWord processorID; // based on CPUID␊ |
286 | ␉SMBString processorVersion;␊ |
287 | ␉SMBByte voltage; // bit7 cleared indicate legacy mode␊ |
288 | ␉SMBWord externalClock; // external clock in MHz␊ |
289 | ␉SMBWord maximumClock; // max internal clock in MHz␊ |
290 | ␉SMBWord currentClock; // current internal clock in MHz␊ |
291 | ␉SMBByte status;␊ |
292 | ␉SMBByte processorUpgrade; // processor upgrade enum␊ |
293 | ␉// 2.1+ spec (32 bytes)␊ |
294 | ␉SMBWord L1CacheHandle;␊ |
295 | ␉SMBWord L2CacheHandle;␊ |
296 | ␉SMBWord L3CacheHandle;␊ |
297 | ␉// 2.3+ spec (35 bytes)␊ |
298 | ␉SMBString serialNumber;␊ |
299 | ␉SMBString assetTag;␊ |
300 | ␉SMBString partNumber;␊ |
301 | ␉// 2.5+ spec (40 bytes)␊ |
302 | //␉SMBByte coreCount;␊ |
303 | //␉SMBByte coreEnabled;␊ |
304 | //␉SMBByte threadCount;␊ |
305 | //␉SMBWord processorFuncSupport;␊ |
306 | ␉// 2.6+ spec (42 bytes)␊ |
307 | //␉SMBWord processorFamily2;␊ |
308 | } __attribute__((packed)) SMBProcessorInformation;␊ |
309 | ␊ |
310 | #define kSMBProcessorInformationMinSize 26␊ |
311 | ␊ |
312 | /* ========================================␊ |
313 | Values for processorType in Type 4 records␊ |
314 | ======================================== */␊ |
315 | enum␊ |
316 | {␊ |
317 | kSMBprocessorTypeOther = 0x01,␊ |
318 | kSMBprocessorTypeUnknown = 0x02,␊ |
319 | kSMBprocessorTypeCPU = 0x03,␊ |
320 | kSMBprocessorTypeMPU = 0x04,␊ |
321 | kSMBprocessorTypeDSP = 0x05,␊ |
322 | kSMBprocessorTypeGPU = 0x06␊ |
323 | };␊ |
324 | ␊ |
325 | /* =======================================================================␊ |
326 | Memory Controller Information (Type 5) Obsolete since SMBIOS version 2.1␊ |
327 | ========================================================================= */␊ |
328 | ␊ |
329 | /* ===================================================================␊ |
330 | Memory Module Information (Type 6) Obsolete since SMBIOS version 2.1␊ |
331 | ===================================================================== */␊ |
332 | ␊ |
333 | /* ========================␊ |
334 | Cache Information (Type 7)␊ |
335 | ========================== */␊ |
336 | typedef struct SMBCacheInformation␊ |
337 | {␊ |
338 | SMB_STRUCT_HEADER // Type 7␊ |
339 | SMBString socketDesignation;␊ |
340 | SMBWord cacheConfiguration;␊ |
341 | SMBWord maximumCacheSize;␊ |
342 | SMBWord installedSize;␊ |
343 | SMBWord supportedSRAMType;␊ |
344 | SMBWord currentSRAMType;␊ |
345 | SMBByte cacheSpeed;␊ |
346 | SMBByte errorCorrectionType;␊ |
347 | SMBByte systemCacheType;␊ |
348 | SMBByte associativity;␊ |
349 | } __attribute__((packed)) SMBCacheInformation;␊ |
350 | ␊ |
351 | /* ===================␊ |
352 | System Slots (Type 9)␊ |
353 | ===================== */␊ |
354 | typedef struct SMBSystemSlot␊ |
355 | {␊ |
356 | // 2.0+ spec (12 bytes)␊ |
357 | ␉SMB_STRUCT_HEADER␊ |
358 | ␉SMBString slotDesignation;␊ |
359 | ␉SMBByte slotType;␊ |
360 | ␉SMBByte slotDataBusWidth;␊ |
361 | ␉SMBByte currentUsage;␊ |
362 | ␉SMBByte slotLength;␊ |
363 | ␉SMBWord slotID;␊ |
364 | ␉SMBByte slotCharacteristics1;␊ |
365 | ␉// 2.1+ spec (13 bytes)␊ |
366 | ␉SMBByte slotCharacteristics2;␊ |
367 | ␉// 2.6+ spec (17 bytes)␊ |
368 | //␉SMBWord␉␉segmentGroupNumber;␊ |
369 | //␉SMBByte␉␉busNumber;␊ |
370 | //␉SMBByte␉␉deviceFunctionNumber;␊ |
371 | } __attribute__((packed)) SMBSystemSlot;␊ |
372 | ␊ |
373 | /* ===================␊ |
374 | OEM Strings (Type 11)␊ |
375 | ===================== */␊ |
376 | typedef struct SMBOEMStrings␊ |
377 | {␊ |
378 | SMB_STRUCT_HEADER // Type 11␊ |
379 | SMBByte␉␉count; // number of strings␊ |
380 | } __attribute__((packed)) SMBOEMStrings;␊ |
381 | ␊ |
382 | /* =============================␊ |
383 | Physical Memory Array (Type 16)␊ |
384 | =============================== */␊ |
385 | typedef struct SMBPhysicalMemoryArray␊ |
386 | {␊ |
387 | ␉// 2.1+ spec (15 bytes)␊ |
388 | ␉SMB_STRUCT_HEADER // Type 16␊ |
389 | ␉SMBByte physicalLocation; // physical location␊ |
390 | ␉SMBByte arrayUse; // the use for the memory array␊ |
391 | ␉SMBByte errorCorrection; // error correction/detection method␊ |
392 | ␉SMBDWord maximumCapacity; // maximum memory capacity in kilobytes␊ |
393 | ␉SMBWord errorHandle; // handle of a previously detected error␊ |
394 | ␉SMBWord numMemoryDevices; // number of memory slots or sockets␊ |
395 | ␉// 2.7+ spec␊ |
396 | //␉SMBQWord extMaximumCapacity;␉// maximum memory capacity in bytes␊ |
397 | } __attribute__((packed)) SMBPhysicalMemoryArray;␊ |
398 | ␊ |
399 | /* ================␊ |
400 | Memory Array - Use␊ |
401 | ================== */␊ |
402 | enum␊ |
403 | {␊ |
404 | kSMBMemoryArrayUseOther = 0x01,␊ |
405 | kSMBMemoryArrayUseUnknown = 0x02,␊ |
406 | kSMBMemoryArrayUseSystemMemory = 0x03,␊ |
407 | kSMBMemoryArrayUseVideoMemory = 0x04,␊ |
408 | kSMBMemoryArrayUseFlashMemory = 0x05,␊ |
409 | kSMBMemoryArrayUseNonVolatileMemory = 0x06,␊ |
410 | kSMBMemoryArrayUseCacheMemory = 0x07␊ |
411 | };␊ |
412 | ␊ |
413 | /* ===================================␊ |
414 | Memory Array - Error Correction Types␊ |
415 | ===================================== */␊ |
416 | enum␊ |
417 | {␊ |
418 | kSMBMemoryArrayErrorCorrectionTypeOther = 0x01,␊ |
419 | kSMBMemoryArrayErrorCorrectionTypeUnknown = 0x02,␊ |
420 | kSMBMemoryArrayErrorCorrectionTypeNone = 0x03,␊ |
421 | kSMBMemoryArrayErrorCorrectionTypeParity = 0x04,␊ |
422 | kSMBMemoryArrayErrorCorrectionTypeSingleBitECC = 0x05,␊ |
423 | kSMBMemoryArrayErrorCorrectionTypeMultiBitECC = 0x06,␊ |
424 | kSMBMemoryArrayErrorCorrectionTypeCRC = 0x07␊ |
425 | };␊ |
426 | ␊ |
427 | /* =====================␊ |
428 | Memory Device (Type 17)␊ |
429 | ======================= */␊ |
430 | typedef struct SMBMemoryDevice␊ |
431 | {␊ |
432 | ␉// 2.1+ spec (21 bytes)␊ |
433 | ␉SMB_STRUCT_HEADER // Type 17␊ |
434 | ␉SMBWord arrayHandle; // handle of the parent memory array␊ |
435 | ␉SMBWord errorHandle; // handle of a previously detected error␊ |
436 | ␉SMBWord totalWidth; // total width in bits; including ECC bits␊ |
437 | ␉SMBWord dataWidth; // data width in bits␊ |
438 | ␉SMBWord memorySize; // bit15 is scale, 0 = MB, 1 = KB␊ |
439 | ␉SMBByte formFactor; // memory device form factor␊ |
440 | ␉SMBByte deviceSet; // parent set of identical memory devices␊ |
441 | ␉SMBString deviceLocator; // labeled socket; e.g. "SIMM 3"␊ |
442 | ␉SMBString bankLocator; // labeled bank; e.g. "Bank 0" or "A"␊ |
443 | ␉SMBByte memoryType; // type of memory␊ |
444 | ␉SMBWord memoryTypeDetail; // additional detail on memory type␊ |
445 | ␉// 2.3+ spec (27 bytes)␊ |
446 | ␉SMBWord memorySpeed; // speed of device in MHz (0 for unknown)␊ |
447 | ␉SMBString manufacturer;␊ |
448 | ␉SMBString serialNumber;␊ |
449 | ␉SMBString assetTag;␊ |
450 | ␉SMBString partNumber;␊ |
451 | ␉// 2.6+ spec (28 bytes)␊ |
452 | //␉SMBByte attributes;␊ |
453 | ␉// 2.7+ spec␊ |
454 | //␉SMBDWord memoryExtSize;␊ |
455 | //␉SMBWord confMemClkSpeed;␊ |
456 | ␉// 2.8+ spec␊ |
457 | //␉SMBWord minimumVolt;␊ |
458 | //␉SMBWord maximumVolt;␊ |
459 | //␉SMBWord configuredVolt;␊ |
460 | } __attribute__((packed)) SMBMemoryDevice;␊ |
461 | ␊ |
462 | /* ===================================␊ |
463 | Memory Array Mapped Address (Type 19)␊ |
464 | ===================================== */␊ |
465 | //typedef struct SMBMemoryArrayMappedAddress␊ |
466 | //{␊ |
467 | // 2.1+ spec␊ |
468 | //␉SMB_STRUCT_HEADER // Type 19␊ |
469 | //␉SMBDWord startingAddress;␊ |
470 | //␉SMBDWord endingAddress;␊ |
471 | //␉SMBWord arrayHandle;␊ |
472 | //␉SMBByte partitionWidth;␊ |
473 | ␉// 2.7+ spec␊ |
474 | //␉SMBQWord extStartAddress;␊ |
475 | //␉SMBQWord extEndAddress;␊ |
476 | //} __attribute__((packed)) SMBMemoryArrayMappedAddress;␊ |
477 | ␊ |
478 | /* ====================================␊ |
479 | Memory Device Mapped Address (Type 20)␊ |
480 | ====================================== */␊ |
481 | //typedef struct SMBMemoryDeviceMappedAddress␊ |
482 | //{␊ |
483 | ␉// 2.1+ spec␊ |
484 | //␉SMB_STRUCT_HEADER // Type 20␊ |
485 | //␉SMBDWord startingAddress;␊ |
486 | //␉SMBDWord endingAddress;␊ |
487 | //␉SMBWord arrayHandle;␊ |
488 | //␉SMBByte partitionRowPosition;␊ |
489 | //␉SMBByte interleavePosition;␊ |
490 | //␉SMBByte interleaveDataDepth;␊ |
491 | ␉// 2.7+ spec␊ |
492 | //␉SMBQWord extStartAddress;␊ |
493 | //␉SMBQWord extEndAddress;␊ |
494 | //} __attribute__((packed)) SMBMemoryDeviceMappedAddress;␊ |
495 | ␊ |
496 | /* =====================================================␊ |
497 | Firmware Volume Description (Apple Specific - Type 128)␊ |
498 | ======================================================= */␊ |
499 | enum␊ |
500 | {␊ |
501 | ␉FW_REGION_RESERVED = 0,␊ |
502 | ␉FW_REGION_RECOVERY = 1,␊ |
503 | ␉FW_REGION_MAIN = 2,␊ |
504 | ␉FW_REGION_NVRAM = 3,␊ |
505 | ␉FW_REGION_CONFIG = 4,␊ |
506 | ␉FW_REGION_DIAGVAULT = 5,␊ |
507 | ␊ |
508 | ␉NUM_FLASHMAP_ENTRIES = 8␊ |
509 | };␊ |
510 | ␊ |
511 | typedef struct FW_REGION_INFO␊ |
512 | {␊ |
513 | ␉SMBDWord StartAddress;␊ |
514 | ␉SMBDWord EndAddress;␊ |
515 | } __attribute__((packed)) FW_REGION_INFO;␊ |
516 | ␊ |
517 | /* ========␊ |
518 | (Type 128)␊ |
519 | ========== */␊ |
520 | typedef struct SMBFirmwareVolume␊ |
521 | {␊ |
522 | ␉SMB_STRUCT_HEADER␉␉␉// Type 128␊ |
523 | ␉SMBByte RegionCount;␊ |
524 | ␉SMBByte Reserved[3];␊ |
525 | ␉SMBDWord FirmwareFeatures;␊ |
526 | ␉SMBDWord FirmwareFeaturesMask;␊ |
527 | ␉SMBByte RegionType[ NUM_FLASHMAP_ENTRIES ];␊ |
528 | ␉FW_REGION_INFO FlashMap[ NUM_FLASHMAP_ENTRIES ];␊ |
529 | } __attribute__((packed)) SMBFirmwareVolume;␊ |
530 | ␊ |
531 | /* ===========================================␊ |
532 | Memory SPD Data (Apple Specific - Type 130)␊ |
533 | ============================================= */␊ |
534 | typedef struct SMBMemorySPD␊ |
535 | {␊ |
536 | ␉SMB_STRUCT_HEADER␉␉␉// Type 130␊ |
537 | ␉SMBWord Type17Handle;␊ |
538 | ␉SMBWord Offset;␊ |
539 | ␉SMBWord Size;␊ |
540 | ␉SMBWord Data[];␊ |
541 | } __attribute__((packed)) SMBMemorySPD;␊ |
542 | ␊ |
543 | /* ============================================␊ |
544 | OEM Processor Type (Apple Specific - Type 131)␊ |
545 | ============================================== */␊ |
546 | typedef struct SMBOemProcessorType␊ |
547 | {␊ |
548 | ␉SMB_STRUCT_HEADER␉␉␉// Type131␊ |
549 | ␉SMBWord ProcessorType;␊ |
550 | } __attribute__((packed)) SMBOemProcessorType;␊ |
551 | ␊ |
552 | /* =================================================␊ |
553 | OEM Processor Bus Speed (Apple Specific - Type 132)␊ |
554 | =================================================== */␊ |
555 | typedef struct SMBOemProcessorBusSpeed␊ |
556 | {␊ |
557 | ␉SMB_STRUCT_HEADER␉␉␉// Type 132␊ |
558 | ␉SMBWord ProcessorBusSpeed; // MT/s unit␊ |
559 | } __attribute__((packed)) SMBOemProcessorBusSpeed;␊ |
560 | ␊ |
561 | /* ==============================================␊ |
562 | OEM Platform Feature (Apple Specific - Type 133)␊ |
563 | ================================================ */␊ |
564 | struct SMBOemPlatformFeature␊ |
565 | {␊ |
566 | ␉SMB_STRUCT_HEADER // Type 133␊ |
567 | ␉SMBWord PlatformFeature;␊ |
568 | } __attribute__((packed)) SMBOemPlatformFeature;␊ |
569 | ␊ |
570 | //----------------------------------------------------------------------------------------------------------␊ |
571 | ␊ |
572 | /* From Foundation/Efi/Guid/Smbios/SmBios.h */␊ |
573 | /* Modified to wrap Data4 array init with {} */␊ |
574 | #define EFI_SMBIOS_TABLE_GUID {0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d}}␊ |
575 | ␊ |
576 | #define SMBIOS_ORIGINAL␉␉0␊ |
577 | #define SMBIOS_PATCHED␉␉1␊ |
578 | ␊ |
579 | extern void *getSmbios(int which);␊ |
580 | extern void readSMBIOSInfo(SMBEntryPoint *eps);␊ |
581 | extern void setupSMBIOSTable(void);␊ |
582 | ␊ |
583 | extern void decodeSMBIOSTable(SMBEntryPoint *eps);␊ |
584 | ␊ |
585 | ␊ |
586 | #endif /* !__LIBSAIO_SMBIOS_H */␊ |
587 | |