2 This file contains the entry code to the HII database, which is defined by
3 UEFI 2.1 specification.
5 Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include "HiiDatabase.h"
22 EFI_EVENT gHiiKeyboardLayoutChanged
;
23 BOOLEAN gExportAfterReadyToBoot
= FALSE
;
25 HII_DATABASE_PRIVATE_DATA mPrivate
= {
26 HII_DATABASE_PRIVATE_DATA_SIGNATURE
,
53 HiiGetSecondaryLanguages
60 HiiExportPackageLists
,
61 HiiRegisterPackageNotify
,
62 HiiUnregisterPackageNotify
,
63 HiiFindKeyboardLayouts
,
66 HiiGetPackageListHandle
69 HiiConfigRoutingExtractConfig
,
70 HiiConfigRoutingExportConfig
,
71 HiiConfigRoutingRouteConfig
,
77 EfiConfigKeywordHandlerSetData
,
78 EfiConfigKeywordHandlerGetData
89 EFI_TEXT_ATTR (EFI_LIGHTGRAY
, EFI_BLACK
),
94 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
99 GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_HII_IMAGE_PROTOCOL mImageProtocol
= {
108 The default event handler for gHiiKeyboardLayoutChanged
111 This is internal function.
113 @param Event The event that triggered this notification function.
114 @param Context Pointer to the notification functions context.
119 KeyboardLayoutChangeNullEvent (
128 On Ready To Boot Services Event notification handler.
130 To trigger the function that to export the Hii Configuration setting.
132 @param[in] Event Event whose notification function is being invoked
133 @param[in] Context Pointer to the notification function's context
144 // When ready to boot, we begin to export the HiiDatabase date.
145 // And hook all the possible HiiDatabase change actions to export data.
147 HiiGetConfigurationSetting(&mPrivate
.HiiDatabase
);
148 gExportAfterReadyToBoot
= TRUE
;
152 Initialize HII Database.
155 @param ImageHandle The image handle.
156 @param SystemTable The system table.
158 @retval EFI_SUCCESS The Hii database is setup correctly.
159 @return Other value if failed to create the default event for
160 gHiiKeyboardLayoutChanged. Check gBS->CreateEventEx for
161 details. Or failed to insatll the protocols.
162 Check gBS->InstallMultipleProtocolInterfaces for details.
163 Or failed to create Ready To Boot Event.
164 Check EfiCreateEventReadyToBootEx for details.
169 InitializeHiiDatabase (
170 IN EFI_HANDLE ImageHandle
,
171 IN EFI_SYSTEM_TABLE
*SystemTable
176 EFI_EVENT ReadyToBootEvent
;
179 // There will be only one HII Database in the system
180 // If there is another out there, someone is trying to install us
181 // again. Fail that scenario.
183 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiDatabaseProtocolGuid
);
184 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiFontProtocolGuid
);
185 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiImageProtocolGuid
);
186 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiStringProtocolGuid
);
187 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiConfigRoutingProtocolGuid
);
188 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiConfigKeywordHandlerProtocolGuid
);
190 InitializeListHead (&mPrivate
.DatabaseList
);
191 InitializeListHead (&mPrivate
.DatabaseNotifyList
);
192 InitializeListHead (&mPrivate
.HiiHandleList
);
193 InitializeListHead (&mPrivate
.FontInfoList
);
196 // Create a event with EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID group type.
198 Status
= gBS
->CreateEventEx (
201 KeyboardLayoutChangeNullEvent
,
203 &gEfiHiiKeyBoardLayoutGuid
,
204 &gHiiKeyboardLayoutChanged
206 if (EFI_ERROR (Status
)) {
211 Status
= gBS
->InstallMultipleProtocolInterfaces (
213 &gEfiHiiFontProtocolGuid
,
215 &gEfiHiiStringProtocolGuid
,
217 &gEfiHiiDatabaseProtocolGuid
,
218 &mPrivate
.HiiDatabase
,
219 &gEfiHiiConfigRoutingProtocolGuid
,
220 &mPrivate
.ConfigRouting
,
221 &gEfiConfigKeywordHandlerProtocolGuid
,
222 &mPrivate
.ConfigKeywordHandler
,
226 if (EFI_ERROR (Status
)) {
230 if (FeaturePcdGet (PcdSupportHiiImageProtocol
)) {
231 CopyMem (&mPrivate
.HiiImage
, &mImageProtocol
, sizeof (mImageProtocol
));
233 Status
= gBS
->InstallMultipleProtocolInterfaces (
235 &gEfiHiiImageProtocolGuid
,
242 if (FeaturePcdGet(PcdHiiOsRuntimeSupport
)) {
243 Status
= EfiCreateEventReadyToBootEx (
249 if (EFI_ERROR (Status
)) {