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 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
,
61 HiiGetSecondaryLanguages
68 HiiExportPackageLists
,
69 HiiRegisterPackageNotify
,
70 HiiUnregisterPackageNotify
,
71 HiiFindKeyboardLayouts
,
74 HiiGetPackageListHandle
77 HiiConfigRoutingExtractConfig
,
78 HiiConfigRoutingExportConfig
,
79 HiiConfigRoutingRouteConfig
,
85 EfiConfigKeywordHandlerSetData
,
86 EfiConfigKeywordHandlerGetData
97 EFI_TEXT_ATTR (EFI_LIGHTGRAY
, EFI_BLACK
),
102 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
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 HiiGetDatabaseInfo (&mPrivate
.HiiDatabase
);
148 HiiGetConfigRespInfo (&mPrivate
.HiiDatabase
);
149 gExportAfterReadyToBoot
= TRUE
;
151 gBS
->CloseEvent (Event
);
155 Initialize HII Database.
158 @param ImageHandle The image handle.
159 @param SystemTable The system table.
161 @retval EFI_SUCCESS The Hii database is setup correctly.
162 @return Other value if failed to create the default event for
163 gHiiKeyboardLayoutChanged. Check gBS->CreateEventEx for
164 details. Or failed to install the protocols.
165 Check gBS->InstallMultipleProtocolInterfaces for details.
166 Or failed to create Ready To Boot Event.
167 Check EfiCreateEventReadyToBootEx for details.
172 InitializeHiiDatabase (
173 IN EFI_HANDLE ImageHandle
,
174 IN EFI_SYSTEM_TABLE
*SystemTable
179 EFI_EVENT ReadyToBootEvent
;
182 // There will be only one HII Database in the system
183 // If there is another out there, someone is trying to install us
184 // again. Fail that scenario.
186 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiDatabaseProtocolGuid
);
187 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiFontProtocolGuid
);
188 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiImageProtocolGuid
);
189 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiStringProtocolGuid
);
190 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiConfigRoutingProtocolGuid
);
191 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiConfigKeywordHandlerProtocolGuid
);
193 InitializeListHead (&mPrivate
.DatabaseList
);
194 InitializeListHead (&mPrivate
.DatabaseNotifyList
);
195 InitializeListHead (&mPrivate
.HiiHandleList
);
196 InitializeListHead (&mPrivate
.FontInfoList
);
199 // Create a event with EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID group type.
201 Status
= gBS
->CreateEventEx (
204 KeyboardLayoutChangeNullEvent
,
206 &gEfiHiiKeyBoardLayoutGuid
,
207 &gHiiKeyboardLayoutChanged
209 if (EFI_ERROR (Status
)) {
214 Status
= gBS
->InstallMultipleProtocolInterfaces (
216 &gEfiHiiFontProtocolGuid
,
218 &gEfiHiiStringProtocolGuid
,
220 &gEfiHiiDatabaseProtocolGuid
,
221 &mPrivate
.HiiDatabase
,
222 &gEfiHiiConfigRoutingProtocolGuid
,
223 &mPrivate
.ConfigRouting
,
224 &gEfiConfigKeywordHandlerProtocolGuid
,
225 &mPrivate
.ConfigKeywordHandler
,
229 if (EFI_ERROR (Status
)) {
233 if (FeaturePcdGet (PcdSupportHiiImageProtocol
)) {
234 Status
= gBS
->InstallMultipleProtocolInterfaces (
236 &gEfiHiiImageProtocolGuid
, &mPrivate
.HiiImage
,
237 &gEfiHiiImageExProtocolGuid
, &mPrivate
.HiiImageEx
,
243 if (FeaturePcdGet(PcdHiiOsRuntimeSupport
)) {
244 Status
= EfiCreateEventReadyToBootEx (
250 if (EFI_ERROR (Status
)) {