3 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 MiscSubclassDriverEntryPoint.c
21 This driver parses the mMiscSubclassDataTable structure and reports
22 any generated data to the DataHub.
28 #include "CommonHeader.h"
30 #include "MiscSubclassDriver.h"
31 #include <Protocol/HiiString.h>
33 EFI_HII_HANDLE mHiiHandle
;
34 EFI_HII_STRING_PROTOCOL
*mHiiString
;
40 IN EFI_STRING_ID StringId
50 // Retrieve the size of the string in the string package for the BestLanguage
53 Status
= mHiiString
->GetString (
63 // If GetString() returns EFI_SUCCESS for a zero size,
64 // then there are no supported languages registered for HiiHandle. If GetString()
65 // returns an error other than EFI_BUFFER_TOO_SMALL, then HiiHandle is not present
66 // in the HII Database
68 if (Status
!= EFI_BUFFER_TOO_SMALL
) {
73 // Allocate a buffer for the return string
75 String
= AllocateZeroPool (StringSize
);
81 // Retrieve the string from the string package
83 Status
= mHiiString
->GetString (
92 if (EFI_ERROR (Status
)) {
94 // Free the buffer and return NULL if the supported languages can not be retrieved.
105 Standard EFI driver point. This driver parses the mMiscSubclassDataTable
106 structure and reports any generated data to the DataHub.
108 @param ImageHandle - Handle for the image of this driver
109 @param SystemTable - Pointer to the EFI System Table
111 @retval EFI_SUCCESS - The data was successfully reported to the Data Hub.
112 @retval EFI_DEVICE_ERROR - Can not locate any protocols
117 MiscSubclassDriverEntryPoint (
118 IN EFI_HANDLE ImageHandle
,
119 IN EFI_SYSTEM_TABLE
*SystemTable
123 EFI_STATUS EfiStatus
;
124 EFI_SMBIOS_PROTOCOL
*Smbios
;
127 // Retrieve the pointer to the UEFI HII String Protocol
129 EfiStatus
= gBS
->LocateProtocol (
130 &gEfiHiiStringProtocolGuid
,
132 (VOID
**) &mHiiString
134 ASSERT_EFI_ERROR (EfiStatus
);
136 EfiStatus
= gBS
->LocateProtocol(
137 &gEfiSmbiosProtocolGuid
,
142 if (EFI_ERROR(EfiStatus
)) {
143 DEBUG((EFI_D_ERROR
, "Could not locate SMBIOS protocol. %r\n", EfiStatus
));
147 mHiiHandle
= HiiAddPackages (
153 ASSERT (mHiiHandle
!= NULL
);
155 for (Index
= 0; Index
< mMiscSubclassDataTableEntries
; ++Index
) {
157 // If the entry have a function pointer, just log the data.
159 if (mMiscSubclassDataTable
[Index
].Function
!= NULL
) {
160 EfiStatus
= (*mMiscSubclassDataTable
[Index
].Function
)(
161 mMiscSubclassDataTable
[Index
].RecordData
,
165 if (EFI_ERROR(EfiStatus
)) {
166 DEBUG((EFI_D_ERROR
, "Misc smbios store error. Index=%d, ReturnStatus=%r\n", Index
, EfiStatus
));