xref: /DragonStub/inc/libsmbios.h (revision e7db4418b1fe6ea0220974b77c3b10918ab9b7a0)
1 #ifndef _LIB_SMBIOS_H
2 #define _LIB_SMBIOS_H
3 /*++
4 
5 Copyright (c) 2000  Intel Corporation
6 
7 Module Name:
8 
9     LibSmbios.h
10 
11 Abstract:
12 
13     Lib include  for SMBIOS services. Used to get system serial number and GUID
14 
15 Revision History
16 
17 --*/
18 
19 //
20 // Define SMBIOS tables.
21 //
22 #pragma pack(1)
23 typedef struct {
24     UINT8   AnchorString[4];
25     UINT8   EntryPointStructureChecksum;
26     UINT8   EntryPointLength;
27     UINT8   MajorVersion;
28     UINT8   MinorVersion;
29     UINT16  MaxStructureSize;
30     UINT8   EntryPointRevision;
31     UINT8   FormattedArea[5];
32     UINT8   IntermediateAnchorString[5];
33     UINT8   IntermediateChecksum;
34     UINT16  TableLength;
35     UINT32  TableAddress;
36     UINT16  NumberOfSmbiosStructures;
37     UINT8   SmbiosBcdRevision;
38 } SMBIOS_STRUCTURE_TABLE;
39 
40 typedef struct {
41     UINT8   AnchorString[5];
42     UINT8   EntryPointStructureChecksum;
43     UINT8   EntryPointLength;
44     UINT8   MajorVersion;
45     UINT8   MinorVersion;
46     UINT8   DocRev;
47     UINT8   EntryPointRevision;
48     UINT8   Reserved;
49     UINT32  TableMaximumSize;
50     UINT64  TableAddress;
51 } SMBIOS3_STRUCTURE_TABLE;
52 
53 //
54 // Please note that SMBIOS structures can be odd byte aligned since the
55 //  unformated section of each record is a set of arbitrary size strings.
56 //
57 
58 typedef struct {
59     UINT8   Type;
60     UINT8   Length;
61     UINT8   Handle[2];
62 } SMBIOS_HEADER;
63 
64 typedef UINT8   SMBIOS_STRING;
65 
66 typedef struct {
67     SMBIOS_HEADER   Hdr;
68     SMBIOS_STRING   Vendor;
69     SMBIOS_STRING   BiosVersion;
70     UINT8           BiosSegment[2];
71     SMBIOS_STRING   BiosReleaseDate;
72     UINT8           BiosSize;
73     UINT8           BiosCharacteristics[8];
74 } SMBIOS_TYPE0;
75 
76 typedef struct {
77     SMBIOS_HEADER   Hdr;
78     SMBIOS_STRING   Manufacturer;
79     SMBIOS_STRING   ProductName;
80     SMBIOS_STRING   Version;
81     SMBIOS_STRING   SerialNumber;
82 
83     //
84     // always byte copy this data to prevent alignment faults!
85     //
86     EFI_GUID        Uuid;
87 
88     UINT8           WakeUpType;
89 } SMBIOS_TYPE1;
90 
91 typedef struct {
92     SMBIOS_HEADER   Hdr;
93     SMBIOS_STRING   Manufacturer;
94     SMBIOS_STRING   ProductName;
95     SMBIOS_STRING   Version;
96     SMBIOS_STRING   SerialNumber;
97 } SMBIOS_TYPE2;
98 
99 typedef struct {
100     SMBIOS_HEADER   Hdr;
101     SMBIOS_STRING   Manufacturer;
102     UINT8           Type;
103     SMBIOS_STRING   Version;
104     SMBIOS_STRING   SerialNumber;
105     SMBIOS_STRING   AssetTag;
106     UINT8           BootupState;
107     UINT8           PowerSupplyState;
108     UINT8           ThermalState;
109     UINT8           SecurityStatus;
110     UINT8           OemDefined[4];
111 } SMBIOS_TYPE3;
112 
113 typedef struct {
114     SMBIOS_HEADER   Hdr;
115     UINT8           Socket;
116     UINT8           ProcessorType;
117     UINT8           ProcessorFamily;
118     SMBIOS_STRING   ProcessorManufacture;
119     UINT8           ProcessorId[8];
120     SMBIOS_STRING   ProcessorVersion;
121     UINT8           Voltage;
122     UINT8           ExternalClock[2];
123     UINT8           MaxSpeed[2];
124     UINT8           CurrentSpeed[2];
125     UINT8           Status;
126     UINT8           ProcessorUpgrade;
127     UINT8           L1CacheHandle[2];
128     UINT8           L2CacheHandle[2];
129     UINT8           L3CacheHandle[2];
130 } SMBIOS_TYPE4;
131 
132 typedef union {
133     SMBIOS_HEADER   *Hdr;
134     SMBIOS_TYPE0    *Type0;
135     SMBIOS_TYPE1    *Type1;
136     SMBIOS_TYPE2    *Type2;
137     SMBIOS_TYPE3    *Type3;
138     SMBIOS_TYPE4    *Type4;
139     UINT8           *Raw;
140 } SMBIOS_STRUCTURE_POINTER;
141 #pragma pack()
142 
143 #endif
144