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