]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c
Clean up HiiDatabase for Doxygen comments requirement.
[mirror_edk2.git] / MdeModulePkg / Universal / HiiDatabaseDxe / HiiDatabaseEntry.c
1 /** @file
2
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
8
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.
11
12 Module Name:
13
14 HiiDatabaseEntry.c
15
16 Abstract:
17
18 This file contains the entry code to the HII database, which is defined by
19 UEFI 2.1 specification.
20
21 Revision History
22
23
24 **/
25
26
27 #include "HiiDatabase.h"
28
29 //
30 // Global variables
31 //
32 EFI_EVENT gHiiKeyboardLayoutChanged;
33 STATIC EFI_GUID gHiiSetKbdLayoutEventGuid = EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID;
34
35 STATIC HII_DATABASE_PRIVATE_DATA mPrivate = {
36 HII_DATABASE_PRIVATE_DATA_SIGNATURE,
37 {
38 (LIST_ENTRY *) NULL,
39 (LIST_ENTRY *) NULL
40 },
41 {
42 (LIST_ENTRY *) NULL,
43 (LIST_ENTRY *) NULL
44 },
45 {
46 HiiStringToImage,
47 HiiStringIdToImage,
48 HiiGetGlyph,
49 HiiGetFontInfo
50 },
51 #ifndef _DISABLE_UNUSED_HII_PROTOCOLS_
52 {
53 HiiNewImage,
54 HiiGetImage,
55 HiiSetImage,
56 HiiDrawImage,
57 HiiDrawImageId
58 },
59 #endif
60 {
61 HiiNewString,
62 HiiGetString,
63 HiiSetString,
64 HiiGetLanguages,
65 HiiGetSecondaryLanguages
66 },
67 {
68 HiiNewPackageList,
69 HiiRemovePackageList,
70 HiiUpdatePackageList,
71 HiiListPackageLists,
72 HiiExportPackageLists,
73 HiiRegisterPackageNotify,
74 HiiUnregisterPackageNotify,
75 HiiFindKeyboardLayouts,
76 HiiGetKeyboardLayout,
77 HiiSetKeyboardLayout,
78 HiiGetPackageListHandle
79 },
80 {
81 HiiConfigRoutingExtractConfig,
82 HiiConfigRoutingExportConfig,
83 HiiConfigRoutingRouteConfig,
84 HiiBlockToConfig,
85 HiiConfigToBlock,
86 HiiGetAltCfg
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 **/
117 VOID
118 EFIAPI
119 KeyboardLayoutChangeNullEvent (
120 IN EFI_EVENT Event,
121 IN VOID *Context
122 )
123 {
124 return;
125 }
126
127 /**
128 Initialize HII Database.
129
130
131 @param ImageHandle The image handle.
132 @param SystemTable The system table.
133
134 @retval EFI_SUCCESS The Hii database is setup correctly.
135 @return Other value if failed to create the default event for
136 gHiiKeyboardLayoutChanged. Check gBS->CreateEventEx for
137 details. Or failed to insatll the protocols.
138 Check gBS->InstallMultipleProtocolInterfaces for details.
139
140 **/
141 EFI_STATUS
142 EFIAPI
143 InitializeHiiDatabase (
144 IN EFI_HANDLE ImageHandle,
145 IN EFI_SYSTEM_TABLE *SystemTable
146 )
147 {
148 EFI_STATUS Status;
149 EFI_HANDLE Handle;
150
151 //
152 // There will be only one HII Database in the system
153 // If there is another out there, someone is trying to install us
154 // again. Fail that scenario.
155 //
156 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiDatabaseProtocolGuid);
157 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiFontProtocolGuid);
158 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiImageProtocolGuid);
159 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiStringProtocolGuid);
160 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiConfigRoutingProtocolGuid);
161
162 InitializeListHead (&mPrivate.DatabaseList);
163 InitializeListHead (&mPrivate.DatabaseNotifyList);
164 InitializeListHead (&mPrivate.HiiHandleList);
165 InitializeListHead (&mPrivate.FontInfoList);
166
167 //
168 // Create a event with EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID group type.
169 //
170 Status = gBS->CreateEventEx (
171 EFI_EVENT_NOTIFY_SIGNAL,
172 TPL_NOTIFY,
173 KeyboardLayoutChangeNullEvent,
174 NULL,
175 &gHiiSetKbdLayoutEventGuid,
176 &gHiiKeyboardLayoutChanged
177 );
178 if (EFI_ERROR (Status)) {
179 return Status;
180 }
181
182 Handle = NULL;
183 return gBS->InstallMultipleProtocolInterfaces (
184 &Handle,
185 &gEfiHiiFontProtocolGuid,
186 &mPrivate.HiiFont,
187 #ifndef _DISABLE_UNUSED_HII_PROTOCOLS_
188 &gEfiHiiImageProtocolGuid,
189 &mPrivate.HiiImage,
190 #endif
191 &gEfiHiiStringProtocolGuid,
192 &mPrivate.HiiString,
193 &gEfiHiiDatabaseProtocolGuid,
194 &mPrivate.HiiDatabase,
195 &gEfiHiiConfigRoutingProtocolGuid,
196 &mPrivate.ConfigRouting,
197 NULL
198 );
199 }
200