--- /dev/null
+/** @file\r
+ SMBIOS Protocol as defined in PI1.2 Specification VOLUME 5 Standard.\r
+\r
+ SMBIOS protocol allows consumers to log SMBIOS data records, and enables the producer \r
+ to create the SMBIOS tables for a platform.\r
+\r
+ This protocol provides an interface to add, remove or discover SMBIOS records. The driver which\r
+ produces this protocol is responsible for creating the SMBIOS data tables and installing the pointer\r
+ to the tables in the EFI System Configuration Table.\r
+ The caller is responsible for only adding SMBIOS records that are valid for the SMBIOS\r
+ MajorVersion and MinorVersion. When an enumerated SMBIOS field's values are\r
+ controlled by the DMTF, new values can be used as soon as they are defined by the DMTF without\r
+ requiring an update to MajorVersion and MinorVersion.\r
+ The SMBIOS protocol can only be called a TPL < TPL_NOTIFY.\r
+\r
+ Copyright (c) 2006 - 2008, Intel Corporation \r
+ All rights reserved. This program and the accompanying materials \r
+ are licensed and made available under the terms and conditions of the BSD License \r
+ which accompanies this distribution. The full text of the license may be found at \r
+ http://opensource.org/licenses/bsd-license.php \r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+**/\r
+\r
+#ifndef __SMBIOS_PROTOCOL_H__\r
+#define __SMBIOS_PROTOCOL_H__\r
+\r
+#define EFI_SMBIOS_PROTOCOL_GUID \\r
+ { 0x3583ff6, 0xcb36, 0x4940, { 0x94, 0x7e, 0xb9, 0xb3, 0x9f, 0x4a, 0xfa, 0xf7 }}\r
+ \r
+//\r
+// SMBIOS type macros which is according to SMBIOS specification.\r
+// \r
+#define EFI_SMBIOS_TYPE_BIOS_INFORMATION 0\r
+#define EFI_SMBIOS_TYPE_SYSTEM_INFORMATION 1\r
+#define EFI_SMBIOS_TYPE_BASEBOARD_INFORMATION 2\r
+#define EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE 3\r
+#define EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION 4\r
+#define EFI_SMBIOS_TYPE_MEMORY_CONTROLLER_INFORMATION 5\r
+#define EFI_SMBIOS_TYPE_MEMORY_MODULE_INFORMATON 6\r
+#define EFI_SMBIOS_TYPE_CACHE_INFORMATION 7\r
+#define EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION 8\r
+#define EFI_SMBIOS_TYPE_SYSTEM_SLOTS 9\r
+#define EFI_SMBIOS_TYPE_ONBOARD_DEVICE_INFORMATION 10\r
+#define EFI_SMBIOS_TYPE_OEM_STRINGS 11\r
+#define EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS 12\r
+#define EFI_SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION 13\r
+#define EFI_SMBIOS_TYPE_GROUP_ASSOCIATIONS 14\r
+#define EFI_SMBIOS_TYPE_SYSTEM_EVENT_LOG 15\r
+#define EFI_SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY 16\r
+#define EFI_SMBIOS_TYPE_MEMORY_DEVICE 17\r
+#define EFI_SMBIOS_TYPE_32BIT_MEMORY_ERROR_INFORMATION 18\r
+#define EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS 19\r
+#define EFI_SMBIOS_TYPE_MEMORY_DEVICE_MAPPED_ADDRESS 20\r
+#define EFI_SMBIOS_TYPE_BUILT_IN_POINTING_DEVICE 21\r
+#define EFI_SMBIOS_TYPE_PORTABLE_BATTERY 22\r
+#define EFI_SMBIOS_TYPE_SYSTEM_RESET 23\r
+#define EFI_SMBIOS_TYPE_HARDWARE_SECURITY 24\r
+#define EFI_SMBIOS_TYPE_SYSTEM_POWER_CONTROLS 25\r
+#define EFI_SMBIOS_TYPE_VOLTAGE_PROBE 26\r
+#define EFI_SMBIOS_TYPE_COOLING_DEVICE 27\r
+#define EFI_SMBIOS_TYPE_TEMPERATURE_PROBE 28\r
+#define EFI_SMBIOS_TYPE_ELECTRICAL_CURRENT_PROBE 29\r
+#define EFI_SMBIOS_TYPE_OUT_OF_BAND_REMOTE_ACCESS 30\r
+#define EFI_SMBIOS_TYPE_BOOT_INTEGRITY_SERVICE 31\r
+#define EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION 32\r
+#define EFI_SMBIOS_TYPE_64BIT_MEMORY_ERROR_INFORMATION 33\r
+#define EFI_SMBIOS_TYPE_MANAGEMENT_DEVICE 34\r
+#define EFI_SMBIOS_TYPE_MANAGEMENT_DEVICE_COMPONENT 35\r
+#define EFI_SMBIOS_TYPE_MANAGEMENT_DEVICE_THRESHOLD_DATA 36\r
+#define EFI_SMBIOS_TYPE_MEMORY_CHANNEL 37\r
+#define EFI_SMBIOS_TYPE_IPMI_DEVICE_INFORMATION 38\r
+#define EFI_SMBIOS_TYPE_SYSTEM_POWER_SUPPLY 39\r
+#define EFI_SMBIOS_TYPE_INACTIVE 126\r
+#define EFI_SMBIOS_TYPE_END_OF_TABLE 127\r
+#define EFI_SMBIOS_OEM_BEGIN 128\r
+#define EFI_SMBIOS_OEM_END 255\r
+\r
+///\r
+/// Text strings associated with a given SMBIOS structure are returned in the dmiStrucBuffer, appended directly after\r
+/// the formatted portion of the structure. This method of returning string information eliminates the need for\r
+/// application software to deal with pointers embedded in the SMBIOS structure. Each string is terminated with a null\r
+/// (00h) BYTE and the set of strings is terminated with an additional null (00h) BYTE. When the formatted portion of\r
+/// a SMBIOS structure references a string, it does so by specifying a non-zero string number within the structure’s\r
+/// string-set. For example, if a string field contains 02h, it references the second string following the formatted portion\r
+/// of the SMBIOS structure. If a string field references no string, a null (0) is placed in that string field. If the\r
+/// formatted portion of the structure contains string-reference fields and all the string fields are set to 0 (no string\r
+/// references), the formatted section of the structure is followed by two null (00h) BYTES.\r
+///\r
+typedef UINT8 EFI_SMBIOS_STRING; \r
+\r
+///\r
+/// Types 0 through 127 (7Fh) are reserved for and defined by this\r
+/// specification. Types 128 through 256 (80h to FFh) are available for system- and OEM-specific information. \r
+///\r
+typedef UINT8 EFI_SMBIOS_TYPE;\r
+\r
+///\r
+/// Specifies the structure’s handle, a unique 16-bit number in the range 0 to 0FFFEh (for version\r
+/// 2.0) or 0 to 0FEFFh (for version 2.1 and later). The handle can be used with the Get SMBIOS\r
+/// Structure function to retrieve a specific structure; the handle numbers are not required to be\r
+/// contiguous. For v2.1 and later, handle values in the range 0FF00h to 0FFFFh are reserved for\r
+/// use by this specification.\r
+/// If the system configuration changes, a previously assigned handle might no longer exist.\r
+/// However once a handle has been assigned by the BIOS, the BIOS cannot re-assign that handle\r
+/// number to another structure.\r
+///\r
+typedef UINT16 EFI_SMBIOS_HANDLE;\r
+ \r
+typedef struct {\r
+ EFI_SMBIOS_TYPE Type;\r
+ UINT8 Length;\r
+ EFI_SMBIOS_HANDLE Handle;\r
+} EFI_SMBIOS_TABLE_HEADER;\r
+ \r
+typedef struct _EFI_SMBIOS_PROTOCOL EFI_SMBIOS_PROTOCOL;\r
+\r
+/**\r
+ Add an SMBIOS record.\r
+ \r
+ This function allows any agent to add SMBIOS records. The caller is responsible for ensuring\r
+ Record is formatted in a way that matches the version of the SMBIOS specification as defined in\r
+ the MajorRevision and MinorRevision fields of the EFI_SMBIOS_PROTOCOL.\r
+ Record must follow the SMBIOS structure evolution and usage guidelines in the SMBIOS\r
+ specification. Record starts with the formatted area of the SMBIOS structure and the length is\r
+ defined by EFI_SMBIOS_TABLE_HEADER.Length. Each SMBIOS structure is terminated by a\r
+ double-null (0x0000), either directly following the formatted area (if no strings are present) or\r
+ directly following the last string. The number of optional strings is not defined by the formatted area,\r
+ but is fixed by the call to Add(). A string can be a place holder, but it must not be a NULL string as\r
+ two NULL strings look like the double-null that terminates the structure.\r
+ \r
+ @param[in] This The EFI_SMBIOS_PROTOCOL instance.\r
+ @param[in] ProducerHandle The handle of the controller or driver associated with the SMBIOS information. NULL means no handle.\r
+ @param[in, out] SmbiosHandle On entry, if non-zero, the handle of the SMBIOS record. If zero, then a unique handle\r
+ will be assigned to the SMBIOS record. If the SMBIOS handle is already in use\r
+ EFI_ALREADY_STARTED is returned and the SMBIOS record is not updated.\r
+ @param[in] Record The data for the fixed portion of the SMBIOS record. The format of the record is\r
+ determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted\r
+ area is defined by EFI_SMBIOS_TABLE_HEADER.Length and either followed\r
+ by a double-null (0x0000) or a set of null terminated strings and a null.\r
+ \r
+ @retval EFI_SUCCESS Record was added.\r
+ @retval EFI_OUT_OF_RESOURCES Record was not added.\r
+ @retval EFI_ALREADY_STARTED The SmbiosHandle passed in was already in use.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SMBIOS_ADD)(\r
+ IN CONST EFI_SMBIOS_PROTOCOL *This,\r
+ IN EFI_HANDLE ProducerHandle, OPTIONAL\r
+ IN OUT EFI_SMBIOS_HANDLE *SmbiosHandle,\r
+ IN EFI_SMBIOS_TABLE_HEADER *Record\r
+);\r
+\r
+/**\r
+ Update the string associated with an existing SMBIOS record.\r
+ \r
+ This function allows the update of specific SMBIOS strings. The number of valid strings for any\r
+ SMBIOS record is defined by how many strings were present when Add() was called.\r
+ \r
+ @param[in] This The EFI_SMBIOS_PROTOCOL instance.\r
+ @param[in] SmbiosHandle SMBIOS Handle of structure that will have its string updated.\r
+ @param[in] StringNumber The non-zero string number of the string to update.\r
+ @param[in] String Update the StringNumber string with String.\r
+ \r
+ @retval EFI_SUCCESS SmbiosHandle had its StringNumber String updated.\r
+ @retval EFI_INVALID_PARAMETER SmbiosHandle does not exist.\r
+ @retval EFI_UNSUPPORTED String was not added since it's longer than 64 significant characters.\r
+ @retval EFI_NOT_FOUND The StringNumber.is not valid for this SMBIOS record. \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SMBIOS_UPDATE_STRING)(\r
+ IN CONST EFI_SMBIOS_PROTOCOL *This,\r
+ IN EFI_SMBIOS_HANDLE *SmbiosHandle,\r
+ IN UINTN *StringNumber,\r
+ IN CHAR8 *String\r
+);\r
+\r
+/**\r
+ Remove an SMBIOS record.\r
+ \r
+ This function removes an SMBIOS record using the handle specified by SmbiosHandle.\r
+ \r
+ @param[in] This The EFI_SMBIOS_PROTOCOL instance.\r
+ @param[in] SmbiosHandle The handle of the SMBIOS record to remove.\r
+ \r
+ @retval EFI_SUCCESS SMBIOS record was removed.\r
+ @retval EFI_INVALID_PARAMETER SmbiosHandle does not specify a valid SMBIOS record.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SMBIOS_REMOVE)(\r
+ IN CONST EFI_SMBIOS_PROTOCOL *This,\r
+ IN EFI_SMBIOS_HANDLE SmbiosHandle\r
+);\r
+\r
+/**\r
+ Allow the caller to discover all or some of the SMBIOS records.\r
+ \r
+ This function allows all of the SMBIOS records to be discovered. It's possible to find\r
+ only the SMBIOS records that match the optional Type argument.\r
+ \r
+ @param[in] This The EFI_SMBIOS_PROTOCOL instance.\r
+ @param[in, out] SmbiosHandle On entry, points to the previous handle of the SMBIOS record. On exit, points to the\r
+ next SMBIOS record handle. If it is zero on entry, then the first SMBIOS record\r
+ handle will be returned. If it returns zero on exit, then there are no more SMBIOS records.\r
+ @param[in] Type On entry, it points to the type of the next SMBIOS record to return. If NULL, it\r
+ indicates that the next record of any type will be returned. Type is not\r
+ modified by the this function.\r
+ @param[out] Record On exit, points to a pointer to the the SMBIOS Record consisting of the formatted area\r
+ followed by the unformatted area. The unformatted area optionally contains text strings.\r
+ @param[out] ProducerHandle On exit, points to the ProducerHandle registered by Add(). If no\r
+ ProducerHandle was passed into Add() NULL is returned. If a NULL pointer is\r
+ passed in no data will be returned.\r
+ @retval EFI_SUCCESS SMBIOS record information was successfully returned in Record.\r
+ SmbiosHandle is the handle of the current SMBIOS record\r
+ @retval EFI_NOT_FOUND The SMBIOS record with SmbiosHandle was the last available record.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SMBIOS_GET_NEXT)(\r
+ IN CONST EFI_SMBIOS_PROTOCOL *This,\r
+ IN OUT EFI_SMBIOS_HANDLE *SmbiosHandle,\r
+ IN EFI_SMBIOS_TYPE *Type, OPTIONAL\r
+ OUT EFI_SMBIOS_TABLE_HEADER **Record,\r
+ OUT EFI_HANDLE *ProducerHandle OPTIONAL\r
+);\r
+\r
+struct _EFI_SMBIOS_PROTOCOL {\r
+ EFI_SMBIOS_ADD Add;\r
+ EFI_SMBIOS_UPDATE_STRING UpdateString;\r
+ EFI_SMBIOS_REMOVE Remove;\r
+ EFI_SMBIOS_GET_NEXT GetNext;\r
+ UINT8 MajorVersion; ///< The major revision of the SMBIOS specification supported.\r
+ UINT8 MinorVersion; ///< The minor revision of the SMBIOS specification supported.\r
+};\r
+ \r
+extern EFI_GUID gEfiSmbiosProtocolGuid;\r
+ \r
+#endif // __SMBIOS_PROTOCOL_H__\r