VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c@ 77662

Last change on this file since 77662 was 77662, checked in by vboxsync, 6 years ago

EFI: First step in UDK2018 merge. Does not build yet.

  • Property svn:eol-style set to native
File size: 6.5 KB
Line 
1/** @file
2This file contains the entry code to the HII database, which is defined by
3UEFI 2.1 specification.
4
5Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
6This program and the accompanying materials
7are licensed and made available under the terms and conditions of the BSD License
8which accompanies this distribution. The full text of the license may be found at
9http://opensource.org/licenses/bsd-license.php
10
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14**/
15
16
17#include "HiiDatabase.h"
18
19//
20// Global variables
21//
22EFI_EVENT gHiiKeyboardLayoutChanged;
23BOOLEAN gExportAfterReadyToBoot = FALSE;
24
25HII_DATABASE_PRIVATE_DATA mPrivate = {
26 HII_DATABASE_PRIVATE_DATA_SIGNATURE,
27 {
28 (LIST_ENTRY *) NULL,
29 (LIST_ENTRY *) NULL
30 },
31 {
32 (LIST_ENTRY *) NULL,
33 (LIST_ENTRY *) NULL
34 },
35 {
36 HiiStringToImage,
37 HiiStringIdToImage,
38 HiiGetGlyph,
39 HiiGetFontInfo
40 },
41 {
42 HiiNewImage,
43 HiiGetImage,
44 HiiSetImage,
45 HiiDrawImage,
46 HiiDrawImageId
47 },
48 {
49 HiiNewImageEx,
50 HiiGetImageEx,
51 HiiSetImageEx,
52 HiiDrawImageEx,
53 HiiDrawImageIdEx,
54 HiiGetImageInfo
55 },
56 {
57 HiiNewString,
58 HiiGetString,
59 HiiSetString,
60 HiiGetLanguages,
61 HiiGetSecondaryLanguages
62 },
63 {
64 HiiNewPackageList,
65 HiiRemovePackageList,
66 HiiUpdatePackageList,
67 HiiListPackageLists,
68 HiiExportPackageLists,
69 HiiRegisterPackageNotify,
70 HiiUnregisterPackageNotify,
71 HiiFindKeyboardLayouts,
72 HiiGetKeyboardLayout,
73 HiiSetKeyboardLayout,
74 HiiGetPackageListHandle
75 },
76 {
77 HiiConfigRoutingExtractConfig,
78 HiiConfigRoutingExportConfig,
79 HiiConfigRoutingRouteConfig,
80 HiiBlockToConfig,
81 HiiConfigToBlock,
82 HiiGetAltCfg
83 },
84 {
85 EfiConfigKeywordHandlerSetData,
86 EfiConfigKeywordHandlerGetData
87 },
88 {
89 (LIST_ENTRY *) NULL,
90 (LIST_ENTRY *) NULL
91 },
92 0,
93 {
94 (LIST_ENTRY *) NULL,
95 (LIST_ENTRY *) NULL
96 },
97 EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK),
98 {
99 0x00000000,
100 0x0000,
101 0x0000,
102 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
103 },
104 NULL
105};
106
107/**
108 The default event handler for gHiiKeyboardLayoutChanged
109 event group.
110
111 This is internal function.
112
113 @param Event The event that triggered this notification function.
114 @param Context Pointer to the notification functions context.
115
116**/
117VOID
118EFIAPI
119KeyboardLayoutChangeNullEvent (
120 IN EFI_EVENT Event,
121 IN VOID *Context
122 )
123{
124 return;
125}
126
127/**
128 On Ready To Boot Services Event notification handler.
129
130 To trigger the function that to export the Hii Configuration setting.
131
132 @param[in] Event Event whose notification function is being invoked
133 @param[in] Context Pointer to the notification function's context
134
135**/
136VOID
137EFIAPI
138OnReadyToBoot (
139 IN EFI_EVENT Event,
140 IN VOID *Context
141 )
142{
143 //
144 // When ready to boot, we begin to export the HiiDatabase date.
145 // And hook all the possible HiiDatabase change actions to export data.
146 //
147 HiiGetConfigurationSetting(&mPrivate.HiiDatabase);
148 gExportAfterReadyToBoot = TRUE;
149
150 gBS->CloseEvent (Event);
151}
152
153/**
154 Initialize HII Database.
155
156
157 @param ImageHandle The image handle.
158 @param SystemTable The system table.
159
160 @retval EFI_SUCCESS The Hii database is setup correctly.
161 @return Other value if failed to create the default event for
162 gHiiKeyboardLayoutChanged. Check gBS->CreateEventEx for
163 details. Or failed to install the protocols.
164 Check gBS->InstallMultipleProtocolInterfaces for details.
165 Or failed to create Ready To Boot Event.
166 Check EfiCreateEventReadyToBootEx for details.
167
168**/
169EFI_STATUS
170EFIAPI
171InitializeHiiDatabase (
172 IN EFI_HANDLE ImageHandle,
173 IN EFI_SYSTEM_TABLE *SystemTable
174 )
175{
176 EFI_STATUS Status;
177 EFI_HANDLE Handle;
178 EFI_EVENT ReadyToBootEvent;
179
180 //
181 // There will be only one HII Database in the system
182 // If there is another out there, someone is trying to install us
183 // again. Fail that scenario.
184 //
185 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiDatabaseProtocolGuid);
186 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiFontProtocolGuid);
187 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiImageProtocolGuid);
188 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiStringProtocolGuid);
189 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiConfigRoutingProtocolGuid);
190 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiConfigKeywordHandlerProtocolGuid);
191
192 InitializeListHead (&mPrivate.DatabaseList);
193 InitializeListHead (&mPrivate.DatabaseNotifyList);
194 InitializeListHead (&mPrivate.HiiHandleList);
195 InitializeListHead (&mPrivate.FontInfoList);
196
197 //
198 // Create a event with EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID group type.
199 //
200 Status = gBS->CreateEventEx (
201 EVT_NOTIFY_SIGNAL,
202 TPL_NOTIFY,
203 KeyboardLayoutChangeNullEvent,
204 NULL,
205 &gEfiHiiKeyBoardLayoutGuid,
206 &gHiiKeyboardLayoutChanged
207 );
208 if (EFI_ERROR (Status)) {
209 return Status;
210 }
211
212 Handle = NULL;
213 Status = gBS->InstallMultipleProtocolInterfaces (
214 &Handle,
215 &gEfiHiiFontProtocolGuid,
216 &mPrivate.HiiFont,
217 &gEfiHiiStringProtocolGuid,
218 &mPrivate.HiiString,
219 &gEfiHiiDatabaseProtocolGuid,
220 &mPrivate.HiiDatabase,
221 &gEfiHiiConfigRoutingProtocolGuid,
222 &mPrivate.ConfigRouting,
223 &gEfiConfigKeywordHandlerProtocolGuid,
224 &mPrivate.ConfigKeywordHandler,
225 NULL
226 );
227
228 if (EFI_ERROR (Status)) {
229 return Status;
230 }
231
232 if (FeaturePcdGet (PcdSupportHiiImageProtocol)) {
233 Status = gBS->InstallMultipleProtocolInterfaces (
234 &Handle,
235 &gEfiHiiImageProtocolGuid, &mPrivate.HiiImage,
236 &gEfiHiiImageExProtocolGuid, &mPrivate.HiiImageEx,
237 NULL
238 );
239
240 }
241
242 if (FeaturePcdGet(PcdHiiOsRuntimeSupport)) {
243 Status = EfiCreateEventReadyToBootEx (
244 TPL_CALLBACK,
245 OnReadyToBoot,
246 NULL,
247 &ReadyToBootEvent
248 );
249 if (EFI_ERROR (Status)) {
250 return Status;
251 }
252 }
253
254 return Status;
255}
256
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette