/** @file\r
+This file contains the entry code to the HII database, which is defined by\r
+UEFI 2.1 specification.\r
\r
-Copyright (c) 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
http://opensource.org/licenses/bsd-license.php\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module Name:\r
-\r
- HiiDatabaseEntry.c\r
-\r
-Abstract:\r
-\r
- This file contains the entry code to the HII database, which is defined by\r
- UEFI 2.1 specification.\r
-\r
-Revision History\r
-\r
-\r
**/\r
\r
\r
// Global variables\r
//\r
EFI_EVENT gHiiKeyboardLayoutChanged;\r
-STATIC EFI_GUID gHiiSetKbdLayoutEventGuid = EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID;\r
+BOOLEAN gExportAfterReadyToBoot = FALSE;\r
\r
-STATIC HII_DATABASE_PRIVATE_DATA mPrivate = {\r
+HII_DATABASE_PRIVATE_DATA mPrivate = {\r
HII_DATABASE_PRIVATE_DATA_SIGNATURE,\r
{\r
(LIST_ENTRY *) NULL,\r
HiiGetGlyph,\r
HiiGetFontInfo\r
},\r
-#ifndef DISABLE_UNUSED_HII_PROTOCOLS\r
{\r
HiiNewImage,\r
HiiGetImage,\r
HiiDrawImage,\r
HiiDrawImageId\r
},\r
-#endif\r
+ {\r
+ HiiNewImageEx,\r
+ HiiGetImageEx,\r
+ HiiSetImageEx,\r
+ HiiDrawImageEx,\r
+ HiiDrawImageIdEx,\r
+ HiiGetImageInfo\r
+ },\r
{\r
HiiNewString,\r
HiiGetString,\r
{\r
HiiConfigRoutingExtractConfig,\r
HiiConfigRoutingExportConfig,\r
- HiiConfigRoutingRoutConfig,\r
+ HiiConfigRoutingRouteConfig,\r
HiiBlockToConfig,\r
HiiConfigToBlock,\r
HiiGetAltCfg\r
},\r
+ {\r
+ EfiConfigKeywordHandlerSetData,\r
+ EfiConfigKeywordHandlerGetData\r
+ },\r
{\r
(LIST_ENTRY *) NULL,\r
(LIST_ENTRY *) NULL\r
NULL\r
};\r
\r
-EFI_STATUS\r
+/**\r
+ The default event handler for gHiiKeyboardLayoutChanged\r
+ event group.\r
+\r
+ This is internal function.\r
+\r
+ @param Event The event that triggered this notification function.\r
+ @param Context Pointer to the notification functions context.\r
+\r
+**/\r
+VOID\r
EFIAPI\r
-InitializeHiiDatabase (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
+KeyboardLayoutChangeNullEvent (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
)\r
-/*++\r
+{\r
+ return;\r
+}\r
\r
-Routine Description:\r
- Initialize HII Database\r
+/**\r
+ On Ready To Boot Services Event notification handler.\r
\r
-Arguments:\r
- (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)\r
+ To trigger the function that to export the Hii Configuration setting.\r
\r
-Returns:\r
- EFI_SUCCESS -\r
- other -\r
+ @param[in] Event Event whose notification function is being invoked\r
+ @param[in] Context Pointer to the notification function's context\r
\r
---*/\r
+**/\r
+VOID\r
+EFIAPI\r
+OnReadyToBoot (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+{\r
+ //\r
+ // When ready to boot, we begin to export the HiiDatabase date.\r
+ // And hook all the possible HiiDatabase change actions to export data.\r
+ //\r
+ HiiGetConfigurationSetting(&mPrivate.HiiDatabase);\r
+ gExportAfterReadyToBoot = TRUE;\r
+\r
+ gBS->CloseEvent (Event);\r
+}\r
+\r
+/**\r
+ Initialize HII Database.\r
+\r
+\r
+ @param ImageHandle The image handle.\r
+ @param SystemTable The system table.\r
+\r
+ @retval EFI_SUCCESS The Hii database is setup correctly.\r
+ @return Other value if failed to create the default event for\r
+ gHiiKeyboardLayoutChanged. Check gBS->CreateEventEx for\r
+ details. Or failed to install the protocols.\r
+ Check gBS->InstallMultipleProtocolInterfaces for details.\r
+ Or failed to create Ready To Boot Event.\r
+ Check EfiCreateEventReadyToBootEx for details.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InitializeHiiDatabase (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
{\r
EFI_STATUS Status;\r
EFI_HANDLE Handle;\r
- EFI_HANDLE *HandleBuffer;\r
- UINTN HandleCount;\r
+ EFI_EVENT ReadyToBootEvent;\r
\r
//\r
// There will be only one HII Database in the system\r
// If there is another out there, someone is trying to install us\r
// again. Fail that scenario.\r
//\r
- Status = gBS->LocateHandleBuffer (\r
- ByProtocol,\r
- &gEfiHiiDatabaseProtocolGuid,\r
- NULL,\r
- &HandleCount,\r
- &HandleBuffer\r
- );\r
-\r
- //\r
- // If there was no error, assume there is an installation and fail to load\r
- //\r
- if (!EFI_ERROR (Status)) {\r
- if (HandleBuffer != NULL) {\r
- gBS->FreePool (HandleBuffer);\r
- }\r
- return EFI_DEVICE_ERROR;\r
- }\r
-\r
+ ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiDatabaseProtocolGuid);\r
+ ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiFontProtocolGuid);\r
+ ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiImageProtocolGuid);\r
+ ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiStringProtocolGuid);\r
+ ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiConfigRoutingProtocolGuid);\r
+ ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiConfigKeywordHandlerProtocolGuid);\r
+ \r
InitializeListHead (&mPrivate.DatabaseList);\r
InitializeListHead (&mPrivate.DatabaseNotifyList);\r
InitializeListHead (&mPrivate.HiiHandleList);\r
// Create a event with EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID group type.\r
//\r
Status = gBS->CreateEventEx (\r
- 0,\r
- 0,\r
- NULL,\r
+ EVT_NOTIFY_SIGNAL,\r
+ TPL_NOTIFY,\r
+ KeyboardLayoutChangeNullEvent,\r
NULL,\r
- &gHiiSetKbdLayoutEventGuid,\r
+ &gEfiHiiKeyBoardLayoutGuid,\r
&gHiiKeyboardLayoutChanged\r
);\r
if (EFI_ERROR (Status)) {\r
}\r
\r
Handle = NULL;\r
- return gBS->InstallMultipleProtocolInterfaces (\r
- &Handle,\r
- &gEfiHiiFontProtocolGuid,\r
- &mPrivate.HiiFont,\r
-#ifndef DISABLE_UNUSED_HII_PROTOCOLS\r
- &gEfiHiiImageProtocolGuid,\r
- &mPrivate.HiiImage,\r
-#endif\r
- &gEfiHiiStringProtocolGuid,\r
- &mPrivate.HiiString,\r
- &gEfiHiiDatabaseProtocolGuid,\r
- &mPrivate.HiiDatabase,\r
- &gEfiHiiConfigRoutingProtocolGuid,\r
- &mPrivate.ConfigRouting,\r
- NULL\r
- );\r
+ Status = gBS->InstallMultipleProtocolInterfaces (\r
+ &Handle,\r
+ &gEfiHiiFontProtocolGuid,\r
+ &mPrivate.HiiFont,\r
+ &gEfiHiiStringProtocolGuid,\r
+ &mPrivate.HiiString,\r
+ &gEfiHiiDatabaseProtocolGuid,\r
+ &mPrivate.HiiDatabase,\r
+ &gEfiHiiConfigRoutingProtocolGuid,\r
+ &mPrivate.ConfigRouting,\r
+ &gEfiConfigKeywordHandlerProtocolGuid,\r
+ &mPrivate.ConfigKeywordHandler,\r
+ NULL\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ if (FeaturePcdGet (PcdSupportHiiImageProtocol)) {\r
+ Status = gBS->InstallMultipleProtocolInterfaces (\r
+ &Handle,\r
+ &gEfiHiiImageProtocolGuid, &mPrivate.HiiImage,\r
+ &gEfiHiiImageExProtocolGuid, &mPrivate.HiiImageEx,\r
+ NULL\r
+ );\r
+\r
+ }\r
+\r
+ if (FeaturePcdGet(PcdHiiOsRuntimeSupport)) {\r
+ Status = EfiCreateEventReadyToBootEx (\r
+ TPL_CALLBACK,\r
+ OnReadyToBoot,\r
+ NULL,\r
+ &ReadyToBootEvent\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ }\r
+\r
+ return Status;\r
}\r
\r