+++ /dev/null
-/** @file\r
-\r
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
- \r\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
- \r\r
-\r
-\r
-Module Name:\r
-\r
- MiscSubclassDriverEntryPoint.c\r
-\r
-Abstract:\r
-\r
- This driver parses the mMiscSubclassDataTable structure and reports\r
- any generated data to the DataHub.\r
-\r
-\r
-**/\r
-\r
-\r
-#include "CommonHeader.h"\r
-#include "MiscSubclassDriver.h"\r
-#include <Protocol/HiiString.h>\r
-#include <Guid/PlatformInfo.h>\r
-\r
-\r
-EFI_HII_HANDLE mHiiHandle;\r
-EFI_HII_STRING_PROTOCOL *mHiiString;\r
-EFI_PLATFORM_INFO_HOB *mPlatformInfo=NULL;\r
-\r
-EFI_STRING\r
-EFIAPI\r
-SmbiosMiscGetString (\r
- IN EFI_STRING_ID StringId\r
- ){\r
-\r
- EFI_STATUS Status;\r
- UINTN StringSize;\r
- CHAR16 TempString;\r
- EFI_STRING String;\r
- String = NULL;\r
-\r
- //\r
- // Retrieve the size of the string in the string package for the BestLanguage\r
- //\r
- StringSize = 0;\r
- Status = mHiiString->GetString (\r
- mHiiString,\r
- "en-US",\r
- mHiiHandle,\r
- StringId,\r
- &TempString,\r
- &StringSize,\r
- NULL\r
- );\r
- //\r
- // If GetString() returns EFI_SUCCESS for a zero size,\r
- // then there are no supported languages registered for HiiHandle. If GetString()\r
- // returns an error other than EFI_BUFFER_TOO_SMALL, then HiiHandle is not present\r
- // in the HII Database\r
- //\r
- if (Status != EFI_BUFFER_TOO_SMALL) {\r
- goto Error;\r
- }\r
-\r
- //\r
- // Allocate a buffer for the return string\r
- //\r
- String = AllocateZeroPool (StringSize);\r
- if (String == NULL) {\r
- goto Error;\r
- }\r
-\r
- //\r
- // Retrieve the string from the string package\r
- //\r
- Status = mHiiString->GetString (\r
- mHiiString,\r
- "en-US",\r
- mHiiHandle,\r
- StringId,\r
- String,\r
- &StringSize,\r
- NULL\r
- );\r
- if (EFI_ERROR (Status)) {\r
- //\r
- // Free the buffer and return NULL if the supported languages can not be retrieved.\r
- //\r
- FreePool (String);\r
- String = NULL;\r
- }\r
-Error:\r
-\r
- return String;\r
-}\r
-\r
-/**\r
- Standard EFI driver point. This driver parses the mMiscSubclassDataTable\r
- structure and reports any generated data to the DataHub.\r
-\r
- @param ImageHandle - Handle for the image of this driver\r
- @param SystemTable - Pointer to the EFI System Table\r
-\r
- @retval EFI_SUCCESS - The data was successfully reported to the Data Hub.\r
- @retval EFI_DEVICE_ERROR - Can not locate any protocols\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-MiscSubclassDriverEntryPoint (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
- )\r
-{\r
- UINTN Index;\r
- EFI_STATUS EfiStatus;\r
- EFI_SMBIOS_PROTOCOL *Smbios;\r
- EFI_PEI_HOB_POINTERS GuidHob;\r
-\r
-\r
-\r
- GuidHob.Raw = GetHobList ();\r
- if (GuidHob.Raw != NULL) {\r
- if ((GuidHob.Raw = GetNextGuidHob (&gEfiPlatformInfoGuid, GuidHob.Raw)) != NULL) {\r
- mPlatformInfo = GET_GUID_HOB_DATA (GuidHob.Guid);\r
- }\r
- }\r
- \r
- DEBUG ((EFI_D_ERROR, "PlatformInfoHob->BoardId [0x%x]\n", mPlatformInfo->BoardId));\r
- \r
- //\r
- // Retrieve the pointer to the UEFI HII String Protocol\r
- //\r
- EfiStatus = gBS->LocateProtocol (\r
- &gEfiHiiStringProtocolGuid,\r
- NULL,\r
- (VOID **) &mHiiString\r
- );\r
- ASSERT_EFI_ERROR (EfiStatus);\r
-\r
- EfiStatus = gBS->LocateProtocol(\r
- &gEfiSmbiosProtocolGuid,\r
- NULL,\r
- (VOID**)&Smbios\r
- );\r
-\r
- if (EFI_ERROR(EfiStatus)) {\r
- DEBUG((EFI_D_ERROR, "Could not locate SMBIOS protocol. %r\n", EfiStatus));\r
- return EfiStatus;\r
- }\r
-\r
- mHiiHandle = HiiAddPackages (\r
- &gEfiCallerIdGuid,\r
- NULL,\r
- MiscSubclassStrings,\r
- NULL\r
- );\r
- ASSERT (mHiiHandle != NULL);\r
-\r
- for (Index = 0; Index < mMiscSubclassDataTableEntries; ++Index) {\r
- //\r
- // If the entry have a function pointer, just log the data.\r
- //\r
- if (mMiscSubclassDataTable[Index].Function != NULL) {\r
- EfiStatus = (*mMiscSubclassDataTable[Index].Function)(\r
- mMiscSubclassDataTable[Index].RecordData,\r
- Smbios\r
- );\r
-\r
- if (EFI_ERROR(EfiStatus)) {\r
- DEBUG((EFI_D_ERROR, "Misc smbios store error. Index=%d, ReturnStatus=%r\n", Index, EfiStatus));\r
- return EfiStatus;\r
- }\r
- }\r
- }\r
-\r
- return EfiStatus;\r
-}\r
-\r