]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/Smbios.h
Update the copyright notice format
[mirror_edk2.git] / MdePkg / Include / Protocol / Smbios.h
1 /** @file
2 SMBIOS Protocol as defined in PI1.2 Specification VOLUME 5 Standard.
3
4 SMBIOS protocol allows consumers to log SMBIOS data records, and enables the producer
5 to create the SMBIOS tables for a platform.
6
7 This protocol provides an interface to add, remove or discover SMBIOS records. The driver which
8 produces this protocol is responsible for creating the SMBIOS data tables and installing the pointer
9 to the tables in the EFI System Configuration Table.
10 The caller is responsible for only adding SMBIOS records that are valid for the SMBIOS
11 MajorVersion and MinorVersion. When an enumerated SMBIOS field's values are
12 controlled by the DMTF, new values can be used as soon as they are defined by the DMTF without
13 requiring an update to MajorVersion and MinorVersion.
14 The SMBIOS protocol can only be called a TPL < TPL_NOTIFY.
15
16 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
17 This program and the accompanying materials
18 are licensed and made available under the terms and conditions of the BSD License
19 which accompanies this distribution. The full text of the license may be found at
20 http://opensource.org/licenses/bsd-license.php
21
22 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
23 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
24
25 **/
26
27 #ifndef __SMBIOS_PROTOCOL_H__
28 #define __SMBIOS_PROTOCOL_H__
29
30 #define EFI_SMBIOS_PROTOCOL_GUID \
31 { 0x3583ff6, 0xcb36, 0x4940, { 0x94, 0x7e, 0xb9, 0xb3, 0x9f, 0x4a, 0xfa, 0xf7 }}
32
33 //
34 // SMBIOS type macros which is according to SMBIOS specification.
35 //
36 #define EFI_SMBIOS_TYPE_BIOS_INFORMATION 0
37 #define EFI_SMBIOS_TYPE_SYSTEM_INFORMATION 1
38 #define EFI_SMBIOS_TYPE_BASEBOARD_INFORMATION 2
39 #define EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE 3
40 #define EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION 4
41 #define EFI_SMBIOS_TYPE_MEMORY_CONTROLLER_INFORMATION 5
42 #define EFI_SMBIOS_TYPE_MEMORY_MODULE_INFORMATON 6
43 #define EFI_SMBIOS_TYPE_CACHE_INFORMATION 7
44 #define EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION 8
45 #define EFI_SMBIOS_TYPE_SYSTEM_SLOTS 9
46 #define EFI_SMBIOS_TYPE_ONBOARD_DEVICE_INFORMATION 10
47 #define EFI_SMBIOS_TYPE_OEM_STRINGS 11
48 #define EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS 12
49 #define EFI_SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION 13
50 #define EFI_SMBIOS_TYPE_GROUP_ASSOCIATIONS 14
51 #define EFI_SMBIOS_TYPE_SYSTEM_EVENT_LOG 15
52 #define EFI_SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY 16
53 #define EFI_SMBIOS_TYPE_MEMORY_DEVICE 17
54 #define EFI_SMBIOS_TYPE_32BIT_MEMORY_ERROR_INFORMATION 18
55 #define EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS 19
56 #define EFI_SMBIOS_TYPE_MEMORY_DEVICE_MAPPED_ADDRESS 20
57 #define EFI_SMBIOS_TYPE_BUILT_IN_POINTING_DEVICE 21
58 #define EFI_SMBIOS_TYPE_PORTABLE_BATTERY 22
59 #define EFI_SMBIOS_TYPE_SYSTEM_RESET 23
60 #define EFI_SMBIOS_TYPE_HARDWARE_SECURITY 24
61 #define EFI_SMBIOS_TYPE_SYSTEM_POWER_CONTROLS 25
62 #define EFI_SMBIOS_TYPE_VOLTAGE_PROBE 26
63 #define EFI_SMBIOS_TYPE_COOLING_DEVICE 27
64 #define EFI_SMBIOS_TYPE_TEMPERATURE_PROBE 28
65 #define EFI_SMBIOS_TYPE_ELECTRICAL_CURRENT_PROBE 29
66 #define EFI_SMBIOS_TYPE_OUT_OF_BAND_REMOTE_ACCESS 30
67 #define EFI_SMBIOS_TYPE_BOOT_INTEGRITY_SERVICE 31
68 #define EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION 32
69 #define EFI_SMBIOS_TYPE_64BIT_MEMORY_ERROR_INFORMATION 33
70 #define EFI_SMBIOS_TYPE_MANAGEMENT_DEVICE 34
71 #define EFI_SMBIOS_TYPE_MANAGEMENT_DEVICE_COMPONENT 35
72 #define EFI_SMBIOS_TYPE_MANAGEMENT_DEVICE_THRESHOLD_DATA 36
73 #define EFI_SMBIOS_TYPE_MEMORY_CHANNEL 37
74 #define EFI_SMBIOS_TYPE_IPMI_DEVICE_INFORMATION 38
75 #define EFI_SMBIOS_TYPE_SYSTEM_POWER_SUPPLY 39
76 #define EFI_SMBIOS_TYPE_INACTIVE 126
77 #define EFI_SMBIOS_TYPE_END_OF_TABLE 127
78 #define EFI_SMBIOS_OEM_BEGIN 128
79 #define EFI_SMBIOS_OEM_END 255
80
81 ///
82 /// Text strings associated with a given SMBIOS structure are returned in the dmiStrucBuffer, appended directly after
83 /// the formatted portion of the structure. This method of returning string information eliminates the need for
84 /// application software to deal with pointers embedded in the SMBIOS structure. Each string is terminated with a null
85 /// (00h) BYTE and the set of strings is terminated with an additional null (00h) BYTE. When the formatted portion of
86 /// a SMBIOS structure references a string, it does so by specifying a non-zero string number within the structure's
87 /// string-set. For example, if a string field contains 02h, it references the second string following the formatted portion
88 /// of the SMBIOS structure. If a string field references no string, a null (0) is placed in that string field. If the
89 /// formatted portion of the structure contains string-reference fields and all the string fields are set to 0 (no string
90 /// references), the formatted section of the structure is followed by two null (00h) BYTES.
91 ///
92 typedef UINT8 EFI_SMBIOS_STRING;
93
94 ///
95 /// Types 0 through 127 (7Fh) are reserved for and defined by this
96 /// specification. Types 128 through 256 (80h to FFh) are available for system- and OEM-specific information.
97 ///
98 typedef UINT8 EFI_SMBIOS_TYPE;
99
100 ///
101 /// Specifies the structure's handle, a unique 16-bit number in the range 0 to 0FFFEh (for version
102 /// 2.0) or 0 to 0FEFFh (for version 2.1 and later). The handle can be used with the Get SMBIOS
103 /// Structure function to retrieve a specific structure; the handle numbers are not required to be
104 /// contiguous. For v2.1 and later, handle values in the range 0FF00h to 0FFFFh are reserved for
105 /// use by this specification.
106 /// If the system configuration changes, a previously assigned handle might no longer exist.
107 /// However once a handle has been assigned by the BIOS, the BIOS cannot re-assign that handle
108 /// number to another structure.
109 ///
110 typedef UINT16 EFI_SMBIOS_HANDLE;
111
112 typedef struct {
113 EFI_SMBIOS_TYPE Type;
114 UINT8 Length;
115 EFI_SMBIOS_HANDLE Handle;
116 } EFI_SMBIOS_TABLE_HEADER;
117
118 typedef struct _EFI_SMBIOS_PROTOCOL EFI_SMBIOS_PROTOCOL;
119
120 /**
121 Add an SMBIOS record.
122
123 This function allows any agent to add SMBIOS records. The caller is responsible for ensuring
124 Record is formatted in a way that matches the version of the SMBIOS specification as defined in
125 the MajorRevision and MinorRevision fields of the EFI_SMBIOS_PROTOCOL.
126 Record must follow the SMBIOS structure evolution and usage guidelines in the SMBIOS
127 specification. Record starts with the formatted area of the SMBIOS structure and the length is
128 defined by EFI_SMBIOS_TABLE_HEADER.Length. Each SMBIOS structure is terminated by a
129 double-null (0x0000), either directly following the formatted area (if no strings are present) or
130 directly following the last string. The number of optional strings is not defined by the formatted area,
131 but is fixed by the call to Add(). A string can be a place holder, but it must not be a NULL string as
132 two NULL strings look like the double-null that terminates the structure.
133
134 @param[in] This The EFI_SMBIOS_PROTOCOL instance.
135 @param[in] ProducerHandle The handle of the controller or driver associated with the SMBIOS information. NULL means no handle.
136 @param[in, out] SmbiosHandle On entry, if non-zero, the handle of the SMBIOS record. If zero, then a unique handle
137 will be assigned to the SMBIOS record. If the SMBIOS handle is already in use
138 EFI_ALREADY_STARTED is returned and the SMBIOS record is not updated.
139 @param[in] Record The data for the fixed portion of the SMBIOS record. The format of the record is
140 determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted
141 area is defined by EFI_SMBIOS_TABLE_HEADER.Length and either followed
142 by a double-null (0x0000) or a set of null terminated strings and a null.
143
144 @retval EFI_SUCCESS Record was added.
145 @retval EFI_OUT_OF_RESOURCES Record was not added.
146 @retval EFI_ALREADY_STARTED The SmbiosHandle passed in was already in use.
147 **/
148 typedef
149 EFI_STATUS
150 (EFIAPI *EFI_SMBIOS_ADD)(
151 IN CONST EFI_SMBIOS_PROTOCOL *This,
152 IN EFI_HANDLE ProducerHandle OPTIONAL,
153 IN OUT EFI_SMBIOS_HANDLE *SmbiosHandle,
154 IN EFI_SMBIOS_TABLE_HEADER *Record
155 );
156
157 /**
158 Update the string associated with an existing SMBIOS record.
159
160 This function allows the update of specific SMBIOS strings. The number of valid strings for any
161 SMBIOS record is defined by how many strings were present when Add() was called.
162
163 @param[in] This The EFI_SMBIOS_PROTOCOL instance.
164 @param[in] SmbiosHandle SMBIOS Handle of structure that will have its string updated.
165 @param[in] StringNumber The non-zero string number of the string to update.
166 @param[in] String Update the StringNumber string with String.
167
168 @retval EFI_SUCCESS SmbiosHandle had its StringNumber String updated.
169 @retval EFI_INVALID_PARAMETER SmbiosHandle does not exist.
170 @retval EFI_UNSUPPORTED String was not added since it's longer than 64 significant characters.
171 @retval EFI_NOT_FOUND The StringNumber.is not valid for this SMBIOS record.
172 **/
173 typedef
174 EFI_STATUS
175 (EFIAPI *EFI_SMBIOS_UPDATE_STRING)(
176 IN CONST EFI_SMBIOS_PROTOCOL *This,
177 IN EFI_SMBIOS_HANDLE *SmbiosHandle,
178 IN UINTN *StringNumber,
179 IN CHAR8 *String
180 );
181
182 /**
183 Remove an SMBIOS record.
184
185 This function removes an SMBIOS record using the handle specified by SmbiosHandle.
186
187 @param[in] This The EFI_SMBIOS_PROTOCOL instance.
188 @param[in] SmbiosHandle The handle of the SMBIOS record to remove.
189
190 @retval EFI_SUCCESS SMBIOS record was removed.
191 @retval EFI_INVALID_PARAMETER SmbiosHandle does not specify a valid SMBIOS record.
192 **/
193 typedef
194 EFI_STATUS
195 (EFIAPI *EFI_SMBIOS_REMOVE)(
196 IN CONST EFI_SMBIOS_PROTOCOL *This,
197 IN EFI_SMBIOS_HANDLE SmbiosHandle
198 );
199
200 /**
201 Allow the caller to discover all or some of the SMBIOS records.
202
203 This function allows all of the SMBIOS records to be discovered. It's possible to find
204 only the SMBIOS records that match the optional Type argument.
205
206 @param[in] This The EFI_SMBIOS_PROTOCOL instance.
207 @param[in, out] SmbiosHandle On entry, points to the previous handle of the SMBIOS record. On exit, points to the
208 next SMBIOS record handle. If it is zero on entry, then the first SMBIOS record
209 handle will be returned. If it returns zero on exit, then there are no more SMBIOS records.
210 @param[in] Type On entry, it points to the type of the next SMBIOS record to return. If NULL, it
211 indicates that the next record of any type will be returned. Type is not
212 modified by the this function.
213 @param[out] Record On exit, points to a pointer to the the SMBIOS Record consisting of the formatted area
214 followed by the unformatted area. The unformatted area optionally contains text strings.
215 @param[out] ProducerHandle On exit, points to the ProducerHandle registered by Add(). If no
216 ProducerHandle was passed into Add() NULL is returned. If a NULL pointer is
217 passed in no data will be returned.
218 @retval EFI_SUCCESS SMBIOS record information was successfully returned in Record.
219 SmbiosHandle is the handle of the current SMBIOS record
220 @retval EFI_NOT_FOUND The SMBIOS record with SmbiosHandle was the last available record.
221 **/
222 typedef
223 EFI_STATUS
224 (EFIAPI *EFI_SMBIOS_GET_NEXT)(
225 IN CONST EFI_SMBIOS_PROTOCOL *This,
226 IN OUT EFI_SMBIOS_HANDLE *SmbiosHandle,
227 IN EFI_SMBIOS_TYPE *Type OPTIONAL,
228 OUT EFI_SMBIOS_TABLE_HEADER **Record,
229 OUT EFI_HANDLE *ProducerHandle OPTIONAL
230 );
231
232 struct _EFI_SMBIOS_PROTOCOL {
233 EFI_SMBIOS_ADD Add;
234 EFI_SMBIOS_UPDATE_STRING UpdateString;
235 EFI_SMBIOS_REMOVE Remove;
236 EFI_SMBIOS_GET_NEXT GetNext;
237 UINT8 MajorVersion; ///< The major revision of the SMBIOS specification supported.
238 UINT8 MinorVersion; ///< The minor revision of the SMBIOS specification supported.
239 };
240
241 extern EFI_GUID gEfiSmbiosProtocolGuid;
242
243 #endif // __SMBIOS_PROTOCOL_H__