1 | /*␊ |
2 | * Copyright (c) 1998-2006 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 | /* This file is a stripped-down version of the one found in the AppleSMBIOS project.␊ |
24 | * Changes:␊ |
25 | * - Don't use pragma pack but instead use GCC's packed attribute␊ |
26 | */␊ |
27 | ␊ |
28 | #ifndef _LIBSAIO_SMBIOS_H␊ |
29 | #define _LIBSAIO_SMBIOS_H␊ |
30 | ␊ |
31 | /*␊ |
32 | * Based on System Management BIOS Reference Specification v2.5␊ |
33 | */␊ |
34 | ␊ |
35 | typedef uint8_t␉␉SMBString;␊ |
36 | typedef uint8_t␉␉SMBByte;␊ |
37 | typedef uint16_t␉SMBWord;␊ |
38 | typedef uint32_t␉SMBDWord;␊ |
39 | typedef uint64_t␉SMBQWord;␊ |
40 | ␊ |
41 | typedef struct DMIHeader {␊ |
42 | ␉SMBByte␉␉␉type;␊ |
43 | ␉SMBByte␉␉␉length;␊ |
44 | ␉SMBWord␉␉␉handle;␊ |
45 | } __attribute__((packed)) DMIHeader;␊ |
46 | ␊ |
47 | #define DMI_STRUCT_HEADER DMIHeader dmiHeader;␊ |
48 | ␊ |
49 | typedef struct DMIEntryPoint {␊ |
50 | ␉SMBByte␉␉␉anchor[5];␊ |
51 | ␉SMBByte␉␉␉checksum;␊ |
52 | ␉SMBWord␉␉␉tableLength;␊ |
53 | ␉SMBDWord␉␉tableAddress;␊ |
54 | ␉SMBWord␉␉␉structureCount;␊ |
55 | ␉SMBByte␉␉␉bcdRevision;␊ |
56 | } __attribute__((packed)) DMIEntryPoint;␊ |
57 | ␊ |
58 | typedef struct SMBEntryPoint {␊ |
59 | ␉SMBByte␉␉␉anchor[4];␊ |
60 | ␉SMBByte␉␉␉checksum;␊ |
61 | ␉SMBByte␉␉␉entryPointLength;␊ |
62 | ␉SMBByte␉␉␉majorVersion;␊ |
63 | ␉SMBByte␉␉␉minorVersion;␊ |
64 | ␉SMBWord␉␉␉maxStructureSize;␊ |
65 | ␉SMBByte␉␉␉entryPointRevision;␊ |
66 | ␉SMBByte␉␉␉formattedArea[5];␊ |
67 | ␉struct DMIEntryPoint␉dmi;␊ |
68 | } __attribute__((packed)) SMBEntryPoint;␊ |
69 | ␊ |
70 | typedef struct DMIMemoryControllerInfo {/* 3.3.6 Memory Controller Information (Type 5) */␊ |
71 | ␉DMI_STRUCT_HEADER␊ |
72 | ␉SMBByte␉␉␉errorDetectingMethod;␊ |
73 | ␉SMBByte␉␉␉errorCorrectingCapability;␊ |
74 | ␉SMBByte␉␉␉supportedInterleave;␊ |
75 | ␉SMBByte␉␉␉currentInterleave;␊ |
76 | ␉SMBByte␉␉␉maxMemoryModuleSize;␊ |
77 | ␉SMBWord␉␉␉supportedSpeeds;␊ |
78 | ␉SMBWord␉␉␉supportedMemoryTypes;␊ |
79 | ␉SMBByte␉␉␉memoryModuleVoltage;␊ |
80 | ␉SMBByte␉␉␉numberOfMemorySlots;␊ |
81 | } __attribute__((packed)) DMIMemoryControllerInfo;␊ |
82 | ␊ |
83 | typedef struct DMIMemoryModuleInfo {␉/* 3.3.7 Memory Module Information (Type 6) */␊ |
84 | ␉DMI_STRUCT_HEADER␊ |
85 | ␉SMBByte␉␉␉socketDesignation;␊ |
86 | ␉SMBByte␉␉␉bankConnections;␊ |
87 | ␉SMBByte␉␉␉currentSpeed;␊ |
88 | ␉SMBWord␉␉␉currentMemoryType;␊ |
89 | ␉SMBByte␉␉␉installedSize;␊ |
90 | ␉SMBByte␉␉␉enabledSize;␊ |
91 | ␉SMBByte␉␉␉errorStatus;␊ |
92 | } __attribute__((packed)) DMIMemoryModuleInfo;␊ |
93 | ␊ |
94 | typedef struct DMIPhysicalMemoryArray {␉/* 3.3.17 Physical Memory Array (Type 16) */␊ |
95 | ␉DMI_STRUCT_HEADER␊ |
96 | ␉SMBByte␉␉␉location;␊ |
97 | ␉SMBByte␉␉␉use;␊ |
98 | ␉SMBByte␉␉␉memoryCorrectionError;␊ |
99 | ␉SMBDWord␉␉maximumCapacity;␊ |
100 | ␉SMBWord␉␉␉memoryErrorInformationHandle;␊ |
101 | ␉SMBWord␉␉␉numberOfMemoryDevices;␊ |
102 | } __attribute__((packed)) DMIPhysicalMemoryArray;␊ |
103 | ␊ |
104 | typedef struct DMIMemoryDevice {␉/* 3.3.18 Memory Device (Type 17) */␊ |
105 | ␉DMI_STRUCT_HEADER␊ |
106 | ␉SMBWord␉␉␉physicalMemoryArrayHandle;␊ |
107 | ␉SMBWord␉␉␉memoryErrorInformationHandle;␊ |
108 | ␉SMBWord␉␉␉totalWidth;␊ |
109 | ␉SMBWord␉␉␉dataWidth;␊ |
110 | ␉SMBWord␉␉␉size;␊ |
111 | ␉SMBByte␉␉␉formFactor;␊ |
112 | ␉SMBByte␉␉␉deviceSet;␊ |
113 | ␉SMBByte␉␉␉deviceLocator;␊ |
114 | ␉SMBByte␉␉␉bankLocator;␊ |
115 | ␉SMBByte␉␉␉memoryType;␊ |
116 | ␉SMBWord␉␉␉typeDetail;␊ |
117 | SMBWord speed;␊ |
118 | } __attribute__((packed)) DMIMemoryDevice;␊ |
119 | ␊ |
120 | typedef struct SMBStructHeader {␊ |
121 | SMBByte type;␊ |
122 | SMBByte length;␊ |
123 | SMBWord handle;␊ |
124 | }__attribute__((packed)) SMBStructHeader;␊ |
125 | ␊ |
126 | #define SMB_STRUCT_HEADER SMBStructHeader header;␊ |
127 | ␊ |
128 | typedef struct SMBSystemInformation {␊ |
129 | ␉// 2.0+ spec (8 bytes)␊ |
130 | ␉SMB_STRUCT_HEADER // Type 1␊ |
131 | ␉SMBString manufacturer;␊ |
132 | ␉SMBString productName;␊ |
133 | ␉SMBString version;␊ |
134 | ␉SMBString serialNumber;␊ |
135 | ␉// 2.1+ spec (25 bytes)␊ |
136 | ␉SMBByte uuid[16]; // can be all 0 or all 1's␊ |
137 | ␉SMBByte wakeupReason; // reason for system wakeup␊ |
138 | ␉// 2.4+ spec (27 bytes)␊ |
139 | SMBString skuNumber;␊ |
140 | SMBString family;␊ |
141 | }__attribute__((packed)) SMBSystemInformation;␊ |
142 | ␊ |
143 | #endif /* !_LIBSAIO_SMBIOS_H */␊ |
144 | |