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 | // http://dmtf.org/sites/default/files/standards/documents/DSP0134_2.8.0.pdf␊ |
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;␉␉Bungo: renamed to chassisType - convention␊ |
235 | ␉SMBByte chassisType;␉␉// System Enclosure Indicator␊ |
236 | ␉SMBString version;␉␉// Board Number?␊ |
237 | ␉SMBString serialNumber;␊ |
238 | ␉SMBString assetTagNumber;␊ |
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 | // ...␊ |
269 | kSMBchassisLunchBox = 0x10␊ |
270 | // fill up if needed ;-)␊ |
271 | };␊ |
272 | ␊ |
273 | /* ============================␊ |
274 | Processor Information (Type 4)␊ |
275 | ============================== */␊ |
276 | typedef struct SMBProcessorInformation␊ |
277 | {␊ |
278 | ␉// 2.0+ spec (26 bytes)␊ |
279 | ␉SMB_STRUCT_HEADER // Type 4␊ |
280 | ␉SMBString socketDesignation;␊ |
281 | ␉SMBByte processorType; // CPU = 3␊ |
282 | ␉SMBByte processorFamily; // processor family enum␊ |
283 | ␉SMBString manufacturer;␊ |
284 | ␉SMBQWord processorID; // based on CPUID␊ |
285 | ␉SMBString processorVersion;␊ |
286 | ␉SMBByte voltage; // bit7 cleared indicate legacy mode␊ |
287 | ␉SMBWord externalClock; // external clock in MHz␊ |
288 | ␉SMBWord maximumClock; // max internal clock in MHz␊ |
289 | ␉SMBWord currentClock; // current internal clock in MHz␊ |
290 | ␉SMBByte status;␊ |
291 | ␉SMBByte processorUpgrade; // processor upgrade enum␊ |
292 | ␉// 2.1+ spec (32 bytes)␊ |
293 | ␉SMBWord L1CacheHandle;␊ |
294 | ␉SMBWord L2CacheHandle;␊ |
295 | ␉SMBWord L3CacheHandle;␊ |
296 | ␉// 2.3+ spec (35 bytes)␊ |
297 | ␉SMBString serialNumber;␊ |
298 | ␉SMBString assetTag;␊ |
299 | ␉SMBString partNumber;␊ |
300 | ␉// 2.5+ spec␊ |
301 | //␉SMBByte coreCount;␊ |
302 | //␉SMBByte coreEnabled;␊ |
303 | //␉SMBByte threadCount;␊ |
304 | //␉SMBWord processorCharacteristics;␊ |
305 | ␉// 2.6+ spec␊ |
306 | //␉SMBWord processorFamily2;␊ |
307 | } __attribute__((packed)) SMBProcessorInformation;␊ |
308 | ␊ |
309 | #define kSMBProcessorInformationMinSize 26␊ |
310 | ␊ |
311 | /* =======================================================================␊ |
312 | Memory Controller Information (Type 5) Obsoleted since SMBIOS version 2.1␊ |
313 | ========================================================================= */␊ |
314 | ␊ |
315 | /* ===================================================================␊ |
316 | Memory Module Information (Type 6) Obsoleted since SMBIOS version 2.1␊ |
317 | ===================================================================== */␊ |
318 | typedef struct SMBMemoryModule␊ |
319 | {␊ |
320 | SMB_STRUCT_HEADER // Type 6␊ |
321 | SMBString socketDesignation;␊ |
322 | SMBByte bankConnections;␊ |
323 | SMBByte currentSpeed;␊ |
324 | SMBWord currentMemoryType;␊ |
325 | SMBByte installedSize;␊ |
326 | SMBByte enabledSize;␊ |
327 | SMBByte errorStatus;␊ |
328 | } __attribute__((packed)) SMBMemoryModule;␊ |
329 | ␊ |
330 | #define kSMBMemoryModuleSizeNotDeterminable 0x7D␊ |
331 | #define kSMBMemoryModuleSizeNotEnabled 0x7E␊ |
332 | #define kSMBMemoryModuleSizeNotInstalled 0x7F␊ |
333 | ␊ |
334 | /* ========================␊ |
335 | Cache Information (Type 7)␊ |
336 | ========================== */␊ |
337 | typedef struct SMBCacheInformation␊ |
338 | {␊ |
339 | SMB_STRUCT_HEADER // Type 7␊ |
340 | SMBString socketDesignation;␊ |
341 | SMBWord cacheConfiguration;␊ |
342 | SMBWord maximumCacheSize;␊ |
343 | SMBWord installedSize;␊ |
344 | SMBWord supportedSRAMType;␊ |
345 | SMBWord currentSRAMType;␊ |
346 | SMBByte cacheSpeed;␊ |
347 | SMBByte errorCorrectionType;␊ |
348 | SMBByte systemCacheType;␊ |
349 | SMBByte associativity;␊ |
350 | } __attribute__((packed)) SMBCacheInformation;␊ |
351 | ␊ |
352 | /* ===================␊ |
353 | System Slots (Type 9)␊ |
354 | ===================== */␊ |
355 | typedef struct SMBSystemSlot␊ |
356 | {␊ |
357 | // 2.0+ spec (12 bytes)␊ |
358 | ␉SMB_STRUCT_HEADER␊ |
359 | ␉SMBString slotDesignation;␊ |
360 | ␉SMBByte slotType;␊ |
361 | ␉SMBByte slotDataBusWidth;␊ |
362 | ␉SMBByte currentUsage;␊ |
363 | ␉SMBByte slotLength;␊ |
364 | ␉SMBWord slotID;␊ |
365 | ␉SMBByte slotCharacteristics1;␊ |
366 | ␉// 2.1+ spec (13 bytes)␊ |
367 | ␉SMBByte slotCharacteristics2;␊ |
368 | ␉// 2.6+ spec␊ |
369 | //␉SMBWord␉␉segmentGroupNumber;␊ |
370 | //␉SMBByte␉␉busNumber;␊ |
371 | //␉SMBByte␉␉devFuncNumber;␊ |
372 | } __attribute__((packed)) SMBSystemSlot;␊ |
373 | ␊ |
374 | /* ===================␊ |
375 | OEM Strings (Type 11)␊ |
376 | ===================== */␊ |
377 | //typedef struct SMBOEMStrings␊ |
378 | //{␊ |
379 | //␉SMB_STRUCT_HEADER // Type 11␊ |
380 | //␉SMBByte␉␉count;␉␉// number of strings␊ |
381 | //} __attribute__((packed)) SMBOEMStrings;␊ |
382 | ␊ |
383 | /* =============================␊ |
384 | Physical Memory Array (Type 16)␊ |
385 | =============================== */␊ |
386 | typedef struct SMBPhysicalMemoryArray␊ |
387 | {␊ |
388 | ␉// 2.1+ spec (15 bytes)␊ |
389 | ␉SMB_STRUCT_HEADER // Type 16␊ |
390 | ␉SMBByte physicalLocation; // physical location␊ |
391 | ␉SMBByte arrayUse; // the use for the memory array␊ |
392 | ␉SMBByte errorCorrection; // error correction/detection method␊ |
393 | ␉SMBDWord maximumCapacity; // maximum memory capacity in kilobytes␊ |
394 | ␉SMBWord errorHandle; // handle of a previously detected error␊ |
395 | ␉SMBWord numMemoryDevices; // number of memory slots or sockets␊ |
396 | ␉// 2.7+ spec␊ |
397 | //␉SMBQWord extMaximumCapacity;␉// maximum memory capacity in bytes␊ |
398 | } __attribute__((packed)) SMBPhysicalMemoryArray;␊ |
399 | ␊ |
400 | /* ================␊ |
401 | Memory Array - Use␊ |
402 | ================== */␊ |
403 | enum␊ |
404 | {␊ |
405 | kSMBMemoryArrayUseOther = 0x01,␊ |
406 | kSMBMemoryArrayUseUnknown = 0x02,␊ |
407 | kSMBMemoryArrayUseSystemMemory = 0x03,␊ |
408 | kSMBMemoryArrayUseVideoMemory = 0x04,␊ |
409 | kSMBMemoryArrayUseFlashMemory = 0x05,␊ |
410 | kSMBMemoryArrayUseNonVolatileMemory = 0x06,␊ |
411 | kSMBMemoryArrayUseCacheMemory = 0x07␊ |
412 | };␊ |
413 | ␊ |
414 | /* ===================================␊ |
415 | Memory Array - Error Correction Types␊ |
416 | ===================================== */␊ |
417 | enum␊ |
418 | {␊ |
419 | kSMBMemoryArrayErrorCorrectionTypeOther = 0x01,␊ |
420 | kSMBMemoryArrayErrorCorrectionTypeUnknown = 0x02,␊ |
421 | kSMBMemoryArrayErrorCorrectionTypeNone = 0x03,␊ |
422 | kSMBMemoryArrayErrorCorrectionTypeParity = 0x04,␊ |
423 | kSMBMemoryArrayErrorCorrectionTypeSingleBitECC = 0x05,␊ |
424 | kSMBMemoryArrayErrorCorrectionTypeMultiBitECC = 0x06,␊ |
425 | kSMBMemoryArrayErrorCorrectionTypeCRC = 0x07␊ |
426 | };␊ |
427 | ␊ |
428 | /* =====================␊ |
429 | Memory Device (Type 17)␊ |
430 | ======================= */␊ |
431 | typedef struct SMBMemoryDevice␊ |
432 | {␊ |
433 | ␉// 2.1+ spec (21 bytes)␊ |
434 | ␉SMB_STRUCT_HEADER // Type 17␊ |
435 | ␉SMBWord arrayHandle; // handle of the parent memory array␊ |
436 | ␉SMBWord errorHandle; // handle of a previously detected error␊ |
437 | ␉SMBWord totalWidth; // total width in bits; including ECC bits␊ |
438 | ␉SMBWord dataWidth; // data width in bits␊ |
439 | ␉SMBWord memorySize; // bit15 is scale, 0 = MB, 1 = KB␊ |
440 | ␉SMBByte formFactor; // memory device form factor␊ |
441 | ␉SMBByte deviceSet; // parent set of identical memory devices␊ |
442 | ␉SMBString deviceLocator; // labeled socket; e.g. "SIMM 3"␊ |
443 | ␉SMBString bankLocator; // labeled bank; e.g. "Bank 0" or "A"␊ |
444 | ␉SMBByte memoryType; // type of memory␊ |
445 | ␉SMBWord memoryTypeDetail; // additional detail on memory type␊ |
446 | ␉// 2.3+ spec (27 bytes)␊ |
447 | ␉SMBWord memorySpeed; // speed of device in MHz (0 for unknown)␊ |
448 | ␉SMBString manufacturer;␊ |
449 | ␉SMBString serialNumber;␊ |
450 | ␉SMBString assetTag;␊ |
451 | ␉SMBString partNumber;␊ |
452 | ␉// 2.6+ spec␊ |
453 | //␉SMBByte memoryAtributes;␊ |
454 | ␉// 2.7+ spec␊ |
455 | //␉SMBDWord memoryExtSize;␊ |
456 | //␉SMBWord confMemClkSpeed;␊ |
457 | ␉// 2.8+ spec␊ |
458 | //␉SMBWord minimumVolt;␊ |
459 | //␉SMBWord maximumVolt;␊ |
460 | //␉SMBWord configuredVolt;␊ |
461 | } __attribute__((packed)) SMBMemoryDevice;␊ |
462 | ␊ |
463 | /* ===================================␊ |
464 | Memory Array Mapped Address (Type 19)␊ |
465 | ===================================== */␊ |
466 | //typedef struct SMBMemoryArrayMappedAddress␊ |
467 | //{␊ |
468 | // 2.1+ spec␊ |
469 | //␉SMB_STRUCT_HEADER // Type 19␊ |
470 | //␉SMBDWord startingAddress;␊ |
471 | //␉SMBDWord endingAddress;␊ |
472 | //␉SMBWord arrayHandle;␊ |
473 | //␉SMBByte partitionWidth;␊ |
474 | ␉// 2.7+ spec␊ |
475 | //␉SMBQWord extStartAddress;␊ |
476 | //␉SMBQWord extEndAddress;␊ |
477 | //} __attribute__((packed)) SMBMemoryArrayMappedAddress;␊ |
478 | ␊ |
479 | /* ====================================␊ |
480 | Memory Device Mapped Address (Type 20)␊ |
481 | ====================================== */␊ |
482 | //typedef struct SMBMemoryDeviceMappedAddress␊ |
483 | //{␊ |
484 | ␉// 2.1+ spec␊ |
485 | //␉SMB_STRUCT_HEADER // Type 20␊ |
486 | //␉SMBDWord startingAddress;␊ |
487 | //␉SMBDWord endingAddress;␊ |
488 | //␉SMBWord arrayHandle;␊ |
489 | //␉SMBByte partitionRowPosition;␊ |
490 | //␉SMBByte interleavePosition;␊ |
491 | //␉SMBByte interleaveDataDepth;␊ |
492 | ␉// 2.7+ spec␊ |
493 | //␉SMBQWord extStartAddress;␊ |
494 | //␉SMBQWord extEndAddress;␊ |
495 | //} __attribute__((packed)) SMBMemoryDeviceMappedAddress;␊ |
496 | ␊ |
497 | /* =====================================================␊ |
498 | Firmware Volume Description (Apple Specific - Type 128)␊ |
499 | ======================================================= */␊ |
500 | enum␊ |
501 | {␊ |
502 | ␉FW_REGION_RESERVED = 0,␊ |
503 | ␉FW_REGION_RECOVERY = 1,␊ |
504 | ␉FW_REGION_MAIN = 2,␊ |
505 | ␉FW_REGION_NVRAM = 3,␊ |
506 | ␉FW_REGION_CONFIG = 4,␊ |
507 | ␉FW_REGION_DIAGVAULT = 5,␊ |
508 | ␊ |
509 | ␉NUM_FLASHMAP_ENTRIES = 8␊ |
510 | };␊ |
511 | ␊ |
512 | typedef struct FW_REGION_INFO␊ |
513 | {␊ |
514 | ␉SMBDWord StartAddress;␊ |
515 | ␉SMBDWord EndAddress;␊ |
516 | } __attribute__((packed)) FW_REGION_INFO;␊ |
517 | ␊ |
518 | /* ========␊ |
519 | (Type 128)␊ |
520 | ========== */␊ |
521 | typedef struct SMBFirmwareVolume␊ |
522 | {␊ |
523 | ␉SMB_STRUCT_HEADER␉␉␉// Type 128␊ |
524 | ␉SMBByte RegionCount;␊ |
525 | ␉SMBByte Reserved[3];␊ |
526 | ␉SMBDWord FirmwareFeatures;␊ |
527 | ␉SMBDWord FirmwareFeaturesMask;␊ |
528 | ␉SMBByte RegionType[ NUM_FLASHMAP_ENTRIES ];␊ |
529 | ␉FW_REGION_INFO FlashMap[ NUM_FLASHMAP_ENTRIES ];␊ |
530 | } __attribute__((packed)) SMBFirmwareVolume;␊ |
531 | ␊ |
532 | /* ===========================================␊ |
533 | Memory SPD Data (Apple Specific - Type 130)␊ |
534 | ============================================= */␊ |
535 | typedef struct SMBMemorySPD␊ |
536 | {␊ |
537 | ␉SMB_STRUCT_HEADER␉␉␉// Type 130␊ |
538 | ␉SMBWord Type17Handle;␊ |
539 | ␉SMBWord Offset;␊ |
540 | ␉SMBWord Size;␊ |
541 | ␉SMBWord Data[];␊ |
542 | } __attribute__((packed)) SMBMemorySPD;␊ |
543 | ␊ |
544 | /* ============================================␊ |
545 | OEM Processor Type (Apple Specific - Type 131)␊ |
546 | ============================================== */␊ |
547 | typedef struct SMBOemProcessorType␊ |
548 | {␊ |
549 | ␉SMB_STRUCT_HEADER␉␉␉// Type131␊ |
550 | ␉SMBWord ProcessorType;␊ |
551 | } __attribute__((packed)) SMBOemProcessorType;␊ |
552 | ␊ |
553 | /* =================================================␊ |
554 | OEM Processor Bus Speed (Apple Specific - Type 132)␊ |
555 | =================================================== */␊ |
556 | typedef struct SMBOemProcessorBusSpeed␊ |
557 | {␊ |
558 | ␉SMB_STRUCT_HEADER␉␉␉// Type 132␊ |
559 | ␉SMBWord ProcessorBusSpeed; // MT/s unit␊ |
560 | } __attribute__((packed)) SMBOemProcessorBusSpeed;␊ |
561 | ␊ |
562 | //----------------------------------------------------------------------------------------------------------␊ |
563 | ␊ |
564 | /* From Foundation/Efi/Guid/Smbios/SmBios.h */␊ |
565 | /* Modified to wrap Data4 array init with {} */␊ |
566 | #define EFI_SMBIOS_TABLE_GUID {0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d}}␊ |
567 | ␊ |
568 | #define SMBIOS_ORIGINAL␉␉0␊ |
569 | #define SMBIOS_PATCHED␉␉1␊ |
570 | ␊ |
571 | extern void *getSmbios(int which);␊ |
572 | extern void readSMBIOSInfo(SMBEntryPoint *eps);␊ |
573 | extern void setupSMBIOSTable(void);␊ |
574 | ␊ |
575 | extern void decodeSMBIOSTable(SMBEntryPoint *eps);␊ |
576 | ␊ |
577 | ␊ |
578 | #endif /* !__LIBSAIO_SMBIOS_H */␊ |
579 | |