3 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
12 MiscSubclassDriverEntryPoint.c
16 This driver parses the mMiscSubclassDataTable structure and reports
17 any generated data to the DataHub.
23 #include "CommonHeader.h"
24 #include "MiscSubclassDriver.h"
25 #include <Protocol/HiiString.h>
26 #include <Guid/PlatformInfo.h>
29 EFI_HII_HANDLE mHiiHandle
;
30 EFI_HII_STRING_PROTOCOL
*mHiiString
;
31 EFI_PLATFORM_INFO_HOB
*mPlatformInfo
=NULL
;
36 IN EFI_STRING_ID StringId
46 // Retrieve the size of the string in the string package for the BestLanguage
49 Status
= mHiiString
->GetString (
59 // If GetString() returns EFI_SUCCESS for a zero size,
60 // then there are no supported languages registered for HiiHandle. If GetString()
61 // returns an error other than EFI_BUFFER_TOO_SMALL, then HiiHandle is not present
62 // in the HII Database
64 if (Status
!= EFI_BUFFER_TOO_SMALL
) {
69 // Allocate a buffer for the return string
71 String
= AllocateZeroPool (StringSize
);
77 // Retrieve the string from the string package
79 Status
= mHiiString
->GetString (
88 if (EFI_ERROR (Status
)) {
90 // Free the buffer and return NULL if the supported languages can not be retrieved.
101 Standard EFI driver point. This driver parses the mMiscSubclassDataTable
102 structure and reports any generated data to the DataHub.
104 @param ImageHandle - Handle for the image of this driver
105 @param SystemTable - Pointer to the EFI System Table
107 @retval EFI_SUCCESS - The data was successfully reported to the Data Hub.
108 @retval EFI_DEVICE_ERROR - Can not locate any protocols
113 MiscSubclassDriverEntryPoint (
114 IN EFI_HANDLE ImageHandle
,
115 IN EFI_SYSTEM_TABLE
*SystemTable
119 EFI_STATUS EfiStatus
;
120 EFI_SMBIOS_PROTOCOL
*Smbios
;
121 EFI_PEI_HOB_POINTERS GuidHob
;
125 GuidHob
.Raw
= GetHobList ();
126 if (GuidHob
.Raw
!= NULL
) {
127 if ((GuidHob
.Raw
= GetNextGuidHob (&gEfiPlatformInfoGuid
, GuidHob
.Raw
)) != NULL
) {
128 mPlatformInfo
= GET_GUID_HOB_DATA (GuidHob
.Guid
);
132 DEBUG ((EFI_D_ERROR
, "PlatformInfoHob->BoardId [0x%x]\n", mPlatformInfo
->BoardId
));
135 // Retrieve the pointer to the UEFI HII String Protocol
137 EfiStatus
= gBS
->LocateProtocol (
138 &gEfiHiiStringProtocolGuid
,
140 (VOID
**) &mHiiString
142 ASSERT_EFI_ERROR (EfiStatus
);
144 EfiStatus
= gBS
->LocateProtocol(
145 &gEfiSmbiosProtocolGuid
,
150 if (EFI_ERROR(EfiStatus
)) {
151 DEBUG((EFI_D_ERROR
, "Could not locate SMBIOS protocol. %r\n", EfiStatus
));
155 mHiiHandle
= HiiAddPackages (
161 ASSERT (mHiiHandle
!= NULL
);
163 for (Index
= 0; Index
< mMiscSubclassDataTableEntries
; ++Index
) {
165 // If the entry have a function pointer, just log the data.
167 if (mMiscSubclassDataTable
[Index
].Function
!= NULL
) {
168 EfiStatus
= (*mMiscSubclassDataTable
[Index
].Function
)(
169 mMiscSubclassDataTable
[Index
].RecordData
,
173 if (EFI_ERROR(EfiStatus
)) {
174 DEBUG((EFI_D_ERROR
, "Misc smbios store error. Index=%d, ReturnStatus=%r\n", Index
, EfiStatus
));