Root/
Source at commit 779 created 13 years 2 months ago. By meklort, Fixup GDT so that modules execute properly | |
---|---|
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 | struct DMIHeader {␊ |
42 | ␉SMBByte␉␉␉type;␊ |
43 | ␉SMBByte␉␉␉length;␊ |
44 | ␉SMBWord␉␉␉handle;␊ |
45 | } __attribute__((packed));␊ |
46 | typedef struct DMIHeader DMIHeader;␊ |
47 | ␊ |
48 | struct DMIEntryPoint {␊ |
49 | ␉SMBByte␉␉␉anchor[5];␊ |
50 | ␉SMBByte␉␉␉checksum;␊ |
51 | ␉SMBWord␉␉␉tableLength;␊ |
52 | ␉SMBDWord␉␉tableAddress;␊ |
53 | ␉SMBWord␉␉␉structureCount;␊ |
54 | ␉SMBByte␉␉␉bcdRevision;␊ |
55 | } __attribute__((packed));␊ |
56 | typedef struct DMIEntryPoint DMIEntryPoint;␊ |
57 | ␊ |
58 | 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));␊ |
69 | typedef struct SMBEntryPoint SMBEntryPoint;␊ |
70 | ␊ |
71 | struct DMIMemoryControllerInfo {/* 3.3.6 Memory Controller Information (Type 5) */␊ |
72 | ␉struct DMIHeader␉dmiHeader;␊ |
73 | ␉SMBByte␉␉␉errorDetectingMethod;␊ |
74 | ␉SMBByte␉␉␉errorCorrectingCapability;␊ |
75 | ␉SMBByte␉␉␉supportedInterleave;␊ |
76 | ␉SMBByte␉␉␉currentInterleave;␊ |
77 | ␉SMBByte␉␉␉maxMemoryModuleSize;␊ |
78 | ␉SMBWord␉␉␉supportedSpeeds;␊ |
79 | ␉SMBWord␉␉␉supportedMemoryTypes;␊ |
80 | ␉SMBByte␉␉␉memoryModuleVoltage;␊ |
81 | ␉SMBByte␉␉␉numberOfMemorySlots;␊ |
82 | } __attribute__((packed));␊ |
83 | typedef struct DMIMemoryControllerInfo DMIMemoryControllerInfo;␊ |
84 | ␊ |
85 | struct DMIMemoryModuleInfo {␉/* 3.3.7 Memory Module Information (Type 6) */␊ |
86 | ␉struct DMIHeader␉dmiHeader;␊ |
87 | ␉SMBByte␉␉␉socketDesignation;␊ |
88 | ␉SMBByte␉␉␉bankConnections;␊ |
89 | ␉SMBByte␉␉␉currentSpeed;␊ |
90 | ␉SMBWord␉␉␉currentMemoryType;␊ |
91 | ␉SMBByte␉␉␉installedSize;␊ |
92 | ␉SMBByte␉␉␉enabledSize;␊ |
93 | ␉SMBByte␉␉␉errorStatus;␊ |
94 | } __attribute__((packed));␊ |
95 | typedef struct DMIMemoryModuleInfo DMIMemoryModuleInfo;␊ |
96 | ␊ |
97 | ␊ |
98 | struct DMIPhysicalMemoryArray {␉/* 3.3.17 Physical Memory Array (Type 16) */␊ |
99 | ␉struct DMIHeader␉dmiHeader;␊ |
100 | ␉SMBByte␉␉␉location;␊ |
101 | ␉SMBByte␉␉␉use;␊ |
102 | ␉SMBByte␉␉␉memoryCorrectionError;␊ |
103 | ␉SMBDWord␉␉maximumCapacity;␊ |
104 | ␉SMBWord␉␉␉memoryErrorInformationHandle;␊ |
105 | ␉SMBWord␉␉␉numberOfMemoryDevices;␊ |
106 | } __attribute__((packed));␊ |
107 | typedef struct DMIPhysicalMemoryArray DMIPhysicalMemoryArray;␊ |
108 | ␊ |
109 | struct DMIMemoryDevice {␉/* 3.3.18 Memory Device (Type 17) */␊ |
110 | ␉struct DMIHeader␉dmiHeader;␊ |
111 | ␉SMBWord␉␉␉physicalMemoryArrayHandle;␊ |
112 | ␉SMBWord␉␉␉memoryErrorInformationHandle;␊ |
113 | ␉SMBWord␉␉␉totalWidth;␊ |
114 | ␉SMBWord␉␉␉dataWidth;␊ |
115 | ␉SMBWord␉␉␉size;␊ |
116 | ␉SMBByte␉␉␉formFactor;␊ |
117 | ␉SMBByte␉␉␉deviceSet;␊ |
118 | ␉SMBByte␉␉␉deviceLocator;␊ |
119 | ␉SMBByte␉␉␉bankLocator;␊ |
120 | ␉SMBByte␉␉␉memoryType;␊ |
121 | ␉SMBWord␉␉␉typeDetail;␊ |
122 | SMBWord speed;␊ |
123 | } __attribute__((packed));␊ |
124 | typedef struct DMIMemoryDevice DMIMemoryDevice;␊ |
125 | ␊ |
126 | ␊ |
127 | struct SMBStructHeader {␊ |
128 | SMBByte type;␊ |
129 | SMBByte length;␊ |
130 | SMBWord handle;␊ |
131 | };␊ |
132 | ␊ |
133 | typedef struct SMBStructHeader SMBStructHeader;␊ |
134 | ␊ |
135 | #define SMB_STRUCT_HEADER SMBStructHeader header;␊ |
136 | ␊ |
137 | struct SMBSystemInformation {␊ |
138 | ␉// 2.0+ spec (8 bytes)␊ |
139 | ␉SMB_STRUCT_HEADER // Type 1␊ |
140 | ␉SMBString manufacturer;␊ |
141 | ␉SMBString productName;␊ |
142 | ␉SMBString version;␊ |
143 | ␉SMBString serialNumber;␊ |
144 | ␉// 2.1+ spec (25 bytes)␊ |
145 | ␉SMBByte uuid[16]; // can be all 0 or all 1's␊ |
146 | ␉SMBByte wakeupReason; // reason for system wakeup␊ |
147 | };␊ |
148 | typedef struct SMBSystemInformation SMBSystemInformation;␊ |
149 | ␊ |
150 | ␊ |
151 | #endif /* !_LIBSAIO_SMBIOS_H */␊ |
152 |