2 This file contains the entry code to the HII database, which is defined by
3 UEFI 2.1 specification.
5 Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include "HiiDatabase.h"
15 EFI_EVENT gHiiKeyboardLayoutChanged
;
16 BOOLEAN gExportAfterReadyToBoot
= FALSE
;
18 HII_DATABASE_PRIVATE_DATA mPrivate
= {
19 HII_DATABASE_PRIVATE_DATA_SIGNATURE
,
54 HiiGetSecondaryLanguages
61 HiiExportPackageLists
,
62 HiiRegisterPackageNotify
,
63 HiiUnregisterPackageNotify
,
64 HiiFindKeyboardLayouts
,
67 HiiGetPackageListHandle
70 HiiConfigRoutingExtractConfig
,
71 HiiConfigRoutingExportConfig
,
72 HiiConfigRoutingRouteConfig
,
78 EfiConfigKeywordHandlerSetData
,
79 EfiConfigKeywordHandlerGetData
90 EFI_TEXT_ATTR (EFI_LIGHTGRAY
, EFI_BLACK
),
95 { 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00 }
101 The default event handler for gHiiKeyboardLayoutChanged
104 This is internal function.
106 @param Event The event that triggered this notification function.
107 @param Context Pointer to the notification functions context.
112 KeyboardLayoutChangeNullEvent (
121 On Ready To Boot Services Event notification handler.
123 To trigger the function that to export the Hii Configuration setting.
125 @param[in] Event Event whose notification function is being invoked
126 @param[in] Context Pointer to the notification function's context
137 // When ready to boot, we begin to export the HiiDatabase date.
138 // And hook all the possible HiiDatabase change actions to export data.
140 HiiGetDatabaseInfo (&mPrivate
.HiiDatabase
);
141 HiiGetConfigRespInfo (&mPrivate
.HiiDatabase
);
142 gExportAfterReadyToBoot
= TRUE
;
144 gBS
->CloseEvent (Event
);
148 Initialize HII Database.
151 @param ImageHandle The image handle.
152 @param SystemTable The system table.
154 @retval EFI_SUCCESS The Hii database is setup correctly.
155 @return Other value if failed to create the default event for
156 gHiiKeyboardLayoutChanged. Check gBS->CreateEventEx for
157 details. Or failed to install the protocols.
158 Check gBS->InstallMultipleProtocolInterfaces for details.
159 Or failed to create Ready To Boot Event.
160 Check EfiCreateEventReadyToBootEx for details.
165 InitializeHiiDatabase (
166 IN EFI_HANDLE ImageHandle
,
167 IN EFI_SYSTEM_TABLE
*SystemTable
172 EFI_EVENT ReadyToBootEvent
;
175 // There will be only one HII Database in the system
176 // If there is another out there, someone is trying to install us
177 // again. Fail that scenario.
179 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiDatabaseProtocolGuid
);
180 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiFontProtocolGuid
);
181 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiImageProtocolGuid
);
182 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiStringProtocolGuid
);
183 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiConfigRoutingProtocolGuid
);
184 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiConfigKeywordHandlerProtocolGuid
);
186 InitializeListHead (&mPrivate
.DatabaseList
);
187 InitializeListHead (&mPrivate
.DatabaseNotifyList
);
188 InitializeListHead (&mPrivate
.HiiHandleList
);
189 InitializeListHead (&mPrivate
.FontInfoList
);
192 // Create a event with EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID group type.
194 Status
= gBS
->CreateEventEx (
197 KeyboardLayoutChangeNullEvent
,
199 &gEfiHiiKeyBoardLayoutGuid
,
200 &gHiiKeyboardLayoutChanged
202 if (EFI_ERROR (Status
)) {
207 Status
= gBS
->InstallMultipleProtocolInterfaces (
209 &gEfiHiiFontProtocolGuid
,
211 &gEfiHiiStringProtocolGuid
,
213 &gEfiHiiDatabaseProtocolGuid
,
214 &mPrivate
.HiiDatabase
,
215 &gEfiHiiConfigRoutingProtocolGuid
,
216 &mPrivate
.ConfigRouting
,
217 &gEfiConfigKeywordHandlerProtocolGuid
,
218 &mPrivate
.ConfigKeywordHandler
,
222 if (EFI_ERROR (Status
)) {
226 if (FeaturePcdGet (PcdSupportHiiImageProtocol
)) {
227 Status
= gBS
->InstallMultipleProtocolInterfaces (
229 &gEfiHiiImageProtocolGuid
,
231 &gEfiHiiImageExProtocolGuid
,
232 &mPrivate
.HiiImageEx
,
237 if (FeaturePcdGet (PcdHiiOsRuntimeSupport
)) {
238 Status
= EfiCreateEventReadyToBootEx (
244 if (EFI_ERROR (Status
)) {