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
11 #include "HiiDatabase.h"
16 EFI_EVENT gHiiKeyboardLayoutChanged
;
17 BOOLEAN gExportAfterReadyToBoot
= FALSE
;
19 HII_DATABASE_PRIVATE_DATA mPrivate
= {
20 HII_DATABASE_PRIVATE_DATA_SIGNATURE
,
55 HiiGetSecondaryLanguages
62 HiiExportPackageLists
,
63 HiiRegisterPackageNotify
,
64 HiiUnregisterPackageNotify
,
65 HiiFindKeyboardLayouts
,
68 HiiGetPackageListHandle
71 HiiConfigRoutingExtractConfig
,
72 HiiConfigRoutingExportConfig
,
73 HiiConfigRoutingRouteConfig
,
79 EfiConfigKeywordHandlerSetData
,
80 EfiConfigKeywordHandlerGetData
91 EFI_TEXT_ATTR (EFI_LIGHTGRAY
, EFI_BLACK
),
96 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
102 The default event handler for gHiiKeyboardLayoutChanged
105 This is internal function.
107 @param Event The event that triggered this notification function.
108 @param Context Pointer to the notification functions context.
113 KeyboardLayoutChangeNullEvent (
122 On Ready To Boot Services Event notification handler.
124 To trigger the function that to export the Hii Configuration setting.
126 @param[in] Event Event whose notification function is being invoked
127 @param[in] Context Pointer to the notification function's context
138 // When ready to boot, we begin to export the HiiDatabase date.
139 // And hook all the possible HiiDatabase change actions to export data.
141 HiiGetDatabaseInfo (&mPrivate
.HiiDatabase
);
142 HiiGetConfigRespInfo (&mPrivate
.HiiDatabase
);
143 gExportAfterReadyToBoot
= TRUE
;
145 gBS
->CloseEvent (Event
);
149 Initialize HII Database.
152 @param ImageHandle The image handle.
153 @param SystemTable The system table.
155 @retval EFI_SUCCESS The Hii database is setup correctly.
156 @return Other value if failed to create the default event for
157 gHiiKeyboardLayoutChanged. Check gBS->CreateEventEx for
158 details. Or failed to install the protocols.
159 Check gBS->InstallMultipleProtocolInterfaces for details.
160 Or failed to create Ready To Boot Event.
161 Check EfiCreateEventReadyToBootEx for details.
166 InitializeHiiDatabase (
167 IN EFI_HANDLE ImageHandle
,
168 IN EFI_SYSTEM_TABLE
*SystemTable
173 EFI_EVENT ReadyToBootEvent
;
176 // There will be only one HII Database in the system
177 // If there is another out there, someone is trying to install us
178 // again. Fail that scenario.
180 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiDatabaseProtocolGuid
);
181 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiFontProtocolGuid
);
182 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiImageProtocolGuid
);
183 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiStringProtocolGuid
);
184 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiConfigRoutingProtocolGuid
);
185 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiConfigKeywordHandlerProtocolGuid
);
187 InitializeListHead (&mPrivate
.DatabaseList
);
188 InitializeListHead (&mPrivate
.DatabaseNotifyList
);
189 InitializeListHead (&mPrivate
.HiiHandleList
);
190 InitializeListHead (&mPrivate
.FontInfoList
);
193 // Create a event with EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID group type.
195 Status
= gBS
->CreateEventEx (
198 KeyboardLayoutChangeNullEvent
,
200 &gEfiHiiKeyBoardLayoutGuid
,
201 &gHiiKeyboardLayoutChanged
203 if (EFI_ERROR (Status
)) {
208 Status
= gBS
->InstallMultipleProtocolInterfaces (
210 &gEfiHiiFontProtocolGuid
,
212 &gEfiHiiStringProtocolGuid
,
214 &gEfiHiiDatabaseProtocolGuid
,
215 &mPrivate
.HiiDatabase
,
216 &gEfiHiiConfigRoutingProtocolGuid
,
217 &mPrivate
.ConfigRouting
,
218 &gEfiConfigKeywordHandlerProtocolGuid
,
219 &mPrivate
.ConfigKeywordHandler
,
223 if (EFI_ERROR (Status
)) {
227 if (FeaturePcdGet (PcdSupportHiiImageProtocol
)) {
228 Status
= gBS
->InstallMultipleProtocolInterfaces (
230 &gEfiHiiImageProtocolGuid
, &mPrivate
.HiiImage
,
231 &gEfiHiiImageExProtocolGuid
, &mPrivate
.HiiImageEx
,
237 if (FeaturePcdGet(PcdHiiOsRuntimeSupport
)) {
238 Status
= EfiCreateEventReadyToBootEx (
244 if (EFI_ERROR (Status
)) {