3 Copyright (c) 2007 - 2008, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 This file contains the entry code to the HII database, which is defined by
19 UEFI 2.1 specification.
27 #include "HiiDatabase.h"
32 EFI_EVENT gHiiKeyboardLayoutChanged
;
33 EFI_GUID gHiiSetKbdLayoutEventGuid
= EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID
;
35 HII_DATABASE_PRIVATE_DATA mPrivate
= {
36 HII_DATABASE_PRIVATE_DATA_SIGNATURE
,
63 HiiGetSecondaryLanguages
70 HiiExportPackageLists
,
71 HiiRegisterPackageNotify
,
72 HiiUnregisterPackageNotify
,
73 HiiFindKeyboardLayouts
,
76 HiiGetPackageListHandle
79 HiiConfigRoutingExtractConfig
,
80 HiiConfigRoutingExportConfig
,
81 HiiConfigRoutingRouteConfig
,
95 EFI_TEXT_ATTR (EFI_LIGHTGRAY
, EFI_BLACK
),
100 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
105 GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_HII_IMAGE_PROTOCOL mImageProtocol
= {
114 The default event handler for gHiiKeyboardLayoutChanged
117 This is internal function.
119 @param Event The event that triggered this notification function.
120 @param Context Pointer to the notification functions context.
125 KeyboardLayoutChangeNullEvent (
134 Initialize HII Database.
137 @param ImageHandle The image handle.
138 @param SystemTable The system table.
140 @retval EFI_SUCCESS The Hii database is setup correctly.
141 @return Other value if failed to create the default event for
142 gHiiKeyboardLayoutChanged. Check gBS->CreateEventEx for
143 details. Or failed to insatll the protocols.
144 Check gBS->InstallMultipleProtocolInterfaces for details.
149 InitializeHiiDatabase (
150 IN EFI_HANDLE ImageHandle
,
151 IN EFI_SYSTEM_TABLE
*SystemTable
158 // There will be only one HII Database in the system
159 // If there is another out there, someone is trying to install us
160 // again. Fail that scenario.
162 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiDatabaseProtocolGuid
);
163 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiFontProtocolGuid
);
164 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiImageProtocolGuid
);
165 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiStringProtocolGuid
);
166 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiHiiConfigRoutingProtocolGuid
);
168 InitializeListHead (&mPrivate
.DatabaseList
);
169 InitializeListHead (&mPrivate
.DatabaseNotifyList
);
170 InitializeListHead (&mPrivate
.HiiHandleList
);
171 InitializeListHead (&mPrivate
.FontInfoList
);
174 // Create a event with EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID group type.
176 Status
= gBS
->CreateEventEx (
179 KeyboardLayoutChangeNullEvent
,
181 &gHiiSetKbdLayoutEventGuid
,
182 &gHiiKeyboardLayoutChanged
184 if (EFI_ERROR (Status
)) {
189 Status
= gBS
->InstallMultipleProtocolInterfaces (
191 &gEfiHiiFontProtocolGuid
,
193 &gEfiHiiStringProtocolGuid
,
195 &gEfiHiiDatabaseProtocolGuid
,
196 &mPrivate
.HiiDatabase
,
197 &gEfiHiiConfigRoutingProtocolGuid
,
198 &mPrivate
.ConfigRouting
,
202 if (EFI_ERROR (Status
)) {
206 if (FeaturePcdGet (PcdSupportHiiImageProtocol
)) {
207 CopyMem (&mPrivate
.HiiImage
, &mImageProtocol
, sizeof (mImageProtocol
));
209 Status
= gBS
->InstallMultipleProtocolInterfaces (
211 &gEfiHiiImageProtocolGuid
,