1 /**@file 2 3 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR> 4 Copyright (c) 2015, Hisilicon Limited. All rights reserved.<BR> 5 Copyright (c) 2015, Linaro Limited. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 http://opensource.org/licenses/bsd-license.php 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 14 Module Name: 15 16 SmbiosMisc.h 17 18 Abstract: 19 20 Header file for the SmbiosMisc Driver. 21 22 Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ 23 **/ 24 25 #ifndef _SMBIOS_MISC_DRIVER_H 26 #define _SMBIOS_MISC_DRIVER_H 27 28 #include <FrameworkDxe.h> 29 #include <Protocol/Smbios.h> 30 #include <IndustryStandard/SmBios.h> 31 #include <Library/HiiLib.h> 32 #include <Library/PcdLib.h> 33 #include <Library/DebugLib.h> 34 #include <Library/MemoryAllocationLib.h> 35 #include <Library/BaseMemoryLib.h> 36 #include <Library/UefiBootServicesTableLib.h> 37 #include <Library/BaseLib.h> 38 #include <Library/UefiLib.h> 39 #include <Library/UefiRuntimeServicesTableLib.h> 40 #include <Guid/DebugMask.h> 41 42 #include <Library/PrintLib.h> 43 44 // 45 // Data table entry update function. 46 // 47 typedef EFI_STATUS (EFIAPI EFI_MISC_SMBIOS_DATA_FUNCTION) ( 48 IN VOID *RecordData, 49 IN EFI_SMBIOS_PROTOCOL *Smbios 50 ); 51 52 53 // 54 // Data table entry definition. 55 // 56 typedef struct { 57 // 58 // intermediat input data for SMBIOS record 59 // 60 VOID *RecordData; 61 EFI_MISC_SMBIOS_DATA_FUNCTION *Function; 62 } EFI_MISC_SMBIOS_DATA_TABLE; 63 64 65 // 66 // Data Table extern definitions. 67 // 68 #define MISC_SMBIOS_TABLE_EXTERNS(NAME1, NAME2, NAME3) \ 69 extern NAME1 NAME2 ## Data; \ 70 extern EFI_MISC_SMBIOS_DATA_FUNCTION NAME3 ## Function; 71 72 73 // 74 // Data Table entries 75 // 76 77 #define MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(NAME1, NAME2) \ 78 { \ 79 & NAME1 ## Data, \ 80 NAME2 ## Function \ 81 } 82 83 84 // 85 // Global definition macros. 86 // 87 #define MISC_SMBIOS_TABLE_DATA(NAME1, NAME2) \ 88 NAME1 NAME2 ## Data 89 90 #define MISC_SMBIOS_TABLE_FUNCTION(NAME2) \ 91 EFI_STATUS EFIAPI NAME2 ## Function( \ 92 IN VOID *RecordData, \ 93 IN EFI_SMBIOS_PROTOCOL *Smbios \ 94 ) 95 96 // 97 // Data Table Array Entries 98 // 99 extern EFI_HII_HANDLE mHiiHandle; 100 101 typedef struct _EFI_TYPE11_OEM_STRING{ 102 UINT8 Offset; 103 EFI_STRING_ID RefOemDefineString; 104 } EFI_TYPE11_OEM_STRING; 105 106 typedef struct _EFI_TYPE12_SYSTEM_CONFIGURATION_OPTIONS_STRING{ 107 UINT8 Offset; 108 EFI_STRING_ID RefType12SystemConfigurationOptionsString; 109 } EFI_TYPE12_SYSTEM_CONFIGURATION_OPTIONS_STRING; 110 111 typedef struct _EFI_TYPE13_BIOS_LANGUAGE_INFORMATION_STRING{ 112 UINT8 *LanguageSignature; 113 EFI_STRING_ID InstallableLanguageLongString; 114 EFI_STRING_ID InstallableLanguageAbbreviateString; 115 } EFI_TYPE13_BIOS_LANGUAGE_INFORMATION_STRING; 116 117 typedef struct _EFI_TYPE40_ADDITIONAL_INFORMATION_ENTRY{ 118 UINT8 RefType; 119 UINT8 RefOffset; 120 EFI_STRING_ID RefString; 121 UINT8 Value; 122 } EFI_TYPE40_ADDITIONAL_INFORMATION_ENTRY; 123 124 typedef enum { 125 STRING, 126 DATA, 127 } OEM_DEFINE_TYPE; 128 129 typedef struct { 130 OEM_DEFINE_TYPE Type; 131 UINTN Token; 132 UINTN DataSize; 133 } OEM_DEFINE_INFO_STRING; 134 135 typedef struct { 136 OEM_DEFINE_TYPE Type; 137 UINTN DataAddress; 138 UINTN DataSize; 139 } OEM_DEFINE_INFO_DATA; 140 141 typedef union { 142 OEM_DEFINE_INFO_STRING DefineString; 143 OEM_DEFINE_INFO_DATA DefineData; 144 } EFI_OEM_DEFINE_ARRAY; 145 146 typedef struct _DMI_STRING_STRUCTURE { 147 UINT8 Type; 148 UINT8 Offset; 149 UINT8 Valid; 150 UINT16 Length; 151 UINT8 String[1]; // Variable length field 152 } DMI_STRING_STRUCTURE; 153 154 typedef struct { 155 UINT8 Type; // The SMBIOS structure type 156 UINT8 FixedOffset; // The offset of the string reference 157 // within the structure's fixed data. 158 } DMI_UPDATABLE_STRING; 159 160 EFI_STATUS 161 FindString ( 162 IN UINT8 Type, 163 IN UINT8 Offset, 164 IN EFI_STRING_ID TokenToUpdate 165 ); 166 167 EFI_STATUS 168 FindUuid ( 169 EFI_GUID *Uuid 170 ); 171 172 EFI_STATUS 173 StringToBiosVeriosn ( 174 IN EFI_STRING_ID BiosVersionToken, 175 OUT UINT8 *MajorVersion, 176 OUT UINT8 *MinorVersion 177 ); 178 179 180 /** 181 Logs SMBIOS record. 182 183 @param [in] Buffer Pointer to the data buffer. 184 @param [in] SmbiosHandle Pointer for retrieve handle. 185 186 **/ 187 EFI_STATUS 188 LogSmbiosData ( 189 IN UINT8 *Buffer, 190 IN OUT EFI_SMBIOS_HANDLE *SmbiosHandle 191 ); 192 193 /** 194 Get Link Type Handle. 195 196 @param [in] SmbiosType Get this Type from SMBIOS table 197 @param [out] HandleArray Pointer to Hadndler array with has been free by caller 198 @param [out] HandleCount Pointer to Hadndler Counter 199 200 **/ 201 VOID 202 GetLinkTypeHandle( 203 IN UINT8 SmbiosType, 204 OUT UINT16 **HandleArray, 205 OUT UINTN *HandleCount 206 ); 207 208 typedef enum { 209 ProductNameType01, 210 SerialNumType01, 211 UuidType01, 212 SystemManufacturerType01, 213 AssertTagType02, 214 SrNumType02, 215 BoardManufacturerType02, 216 AssetTagType03, 217 SrNumType03, 218 VersionType03, 219 ChassisTypeType03 , 220 ManufacturerType03, 221 } GET_INFO_BMC_OFFSET; 222 223 VOID UpdateSmbiosInfo (IN EFI_HII_HANDLE mHiiHandle, IN EFI_STRING_ID TokenToUpdate, IN UINT8 Offset); 224 EFI_STATUS GetUuidType1 (IN OUT EFI_GUID *Uuid); 225 EFI_STATUS IpmiGetChassisType (IN OUT UINT8 *Type); 226 #endif 227