]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/HiiDatabase.h
UEFI HII: Merge UEFI HII support changes from branch.
[mirror_edk2.git] / MdePkg / Include / Protocol / HiiDatabase.h
CommitLineData
d1f95000 1/** @file\r
2 The file provides Database manager for HII-related data\r
3 structures.\r
4 \r
5 Copyright (c) 2006 - 2007, Intel Corporation\r
6 All rights reserved. This program and the accompanying materials \r
7 are licensed and made available under the terms and conditions of the BSD License \r
8 which accompanies this distribution. The full text of the license may be found at \r
9 http://opensource.org/licenses/bsd-license.php \r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
13\r
d1f95000 14**/\r
15\r
16#ifndef __HII_DATABASE_H__\r
17#define __HII_DATABASE_H__\r
18\r
19#define EFI_HII_DATABASE_PROTOCOL_GUID \\r
20 { 0xef9fc172, 0xa1b2, 0x4693, { 0xb3, 0x27, 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42 } }\r
21\r
22\r
23typedef struct _EFI_HII_DATABASE_PROTOCOL EFI_HII_DATABASE_PROTOCOL;\r
24\r
d1f95000 25\r
26//\r
27// EFI_HII_DATABASE_NOTIFY_TYPE\r
28// \r
29typedef UINTN EFI_HII_DATABASE_NOTIFY_TYPE;\r
30#define EFI_HII_DATABASE_NOTIFY_NEW_PACK 0x00000001\r
31#define EFI_HII_DATABASE_NOTIFY_REMOVE_PACK 0x00000002\r
32#define EFI_HII_DATABASE_NOTIFY_EXPORT_PACK 0x00000004\r
33#define EFI_HII_DATABASE_NOTIFY_ADD_PACK 0x00000008\r
34/**\r
35 \r
36 Functions which are registered to receive notification of\r
37 database events have this prototype. The actual event is encoded\r
38 in NotifyType. The following table describes how PackageType,\r
39 PackageGuid, Handle, and Package are used for each of the\r
40 notification types.\r
41\r
42 @param PackageType Package type of the notification.\r
43\r
44 @param PackageGuid If PackageType is\r
45 EFI_HII_PACKAGE_TYPE_GUID, then this is\r
46 the pointer to the GUID from the Guid\r
47 field of EFI_HII_PACKAGE_GUID_HEADER.\r
48 Otherwise, it must be NULL.\r
49\r
50 @param Package Points to the package referred to by the\r
51 notification Handle The handle of the package\r
52 list which contains the specified package.\r
53\r
54 @param NotifyType The type of change concerning the\r
55 database. See\r
56 EFI_HII_DATABASE_NOTIFY_TYPE.\r
57\r
58**/\r
59typedef\r
60EFI_STATUS\r
61(EFIAPI *EFI_HII_DATABASE_NOTIFY) (\r
7d582d6b 62 IN UINT8 PackageType,\r
d1f95000 63 IN CONST EFI_GUID *PackageGuid,\r
64 IN CONST EFI_HII_PACKAGE_HEADER *Package,\r
7d582d6b 65 IN EFI_HII_HANDLE Handle,\r
66 IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType\r
d1f95000 67);\r
68\r
69/**\r
70\r
71 This function adds the packages in the package list to the\r
72 database and returns a handle. If there is a\r
73 EFI_DEVICE_PATH_PROTOCOL associated with the DriverHandle, then\r
74 this function will create a package of type\r
75 EFI_PACKAGE_TYPE_DEVICE_PATH and add it to the package list. For\r
76 each package in the package list, registered functions with the\r
77 notification type NEW_PACK and having the same package type will\r
78 be called. For each call to NewPackageList(), there should be a\r
79 corresponding call to\r
80 EFI_HII_DATABASE_PROTOCOL.RemovePackageList().\r
81\r
82 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL\r
83 instance.\r
84\r
85 @param PackageList A pointer to an\r
86 EFI_HII_PACKAGE_LIST_HEADER structure.\r
87\r
88 @param DriverHandle Associate the package list with this EFI\r
89 handle Handle A pointer to the\r
7d582d6b 90 EFI_HII_HANDLE instance.\r
d1f95000 91\r
92 @retval EFI_SUCCESS The package list associated with the\r
93 Handle was added to the HII database.\r
94\r
95 @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary\r
96 resources for the new database\r
97 contents.\r
98\r
99 @retval EFI_INVALID_PARAMETER PackageList is NULL or Handle\r
100 is NULL.\r
101\r
102**/\r
103typedef\r
104EFI_STATUS\r
7d582d6b 105(EFIAPI *EFI_HII_DATABASE_NEW_PACK) (\r
d1f95000 106 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
107 IN CONST EFI_HII_PACKAGE_LIST_HEADER *PackageList,\r
7d582d6b 108 IN EFI_HANDLE DriverHandle,\r
109 OUT EFI_HII_HANDLE *Handle\r
d1f95000 110);\r
111\r
112\r
113/**\r
114\r
115 This function removes the package list that is associated with a\r
116 handle Handle from the HII database. Before removing the\r
117 package, any registered functions with the notification type\r
118 REMOVE_PACK and the same package type will be called. For each\r
119 call to EFI_HII_DATABASE_PROTOCOL.NewPackageList(), there should\r
120 be a corresponding call to RemovePackageList.\r
121\r
122 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL\r
123 instance.\r
124 \r
125 @param Handle The handle that was registered to the data\r
126 that is requested for removal.\r
127 \r
128 @retval EFI_SUCCESS The data associated with the Handle was\r
129 removed from the HII database.\r
130 \r
131 @retval EFI_INVALID_PARAMETER The Handle was not valid.\r
132\r
133**/\r
134typedef\r
135EFI_STATUS\r
7d582d6b 136(EFIAPI *EFI_HII_DATABASE_REMOVE_PACK) (\r
d1f95000 137 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
7d582d6b 138 IN EFI_HII_HANDLE Handle\r
d1f95000 139);\r
140\r
141\r
142/**\r
143 \r
144 This function updates the existing package list (which has the\r
145 specified Handle) in the HII databases, using the new package\r
146 list specified by PackageList. The update process has the\r
147 following steps: Collect all the package types in the package\r
148 list specified by PackageList. A package type consists of the\r
149 Type field of EFI_HII_PACKAGE_HEADER and, if the Type is\r
150 EFI_HII_PACKAGE_TYPE_GUID, the Guid field, as defined in\r
151 EFI_HII_PACKAGE_GUID_HEADER. Iterate through the packages within\r
152 the existing package list in the HII database specified by\r
153 Handle. If a package??s type matches one of the types collected\r
154 in step 1, then perform the following steps:\r
155 - Call any functions registered with the notification type\r
156 REMOVE_PACK.\r
157 - Remove the package from the package list and the HII\r
158 database.\r
159 Add all of the packages within the new package list specified\r
160 by PackageList, using the following steps:\r
161 - Add the package to the package list and the HII database.\r
162 - Call any functions registered with the notification type\r
163 ADD_PACK.\r
164\r
165 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL\r
166 instance.\r
167 \r
168 @param Handle The handle that was registered to the data\r
169 that is requested for removal.\r
170 \r
171 @param PackageList A pointer to an EFI_HII_PACKAGE_LIST\r
172 package.\r
173 \r
174 @retval EFI_SUCCESS The HII database was successfully\r
175 updated.\r
176 \r
177 @retval EFI_OUT_OF_RESOURCES Unable to allocate enough memory\r
178 for the updated database.\r
179 \r
180 @retval EFI_INVALID_PARAMETER The Handle was not valid.\r
181\r
182**/\r
183typedef\r
184EFI_STATUS\r
7d582d6b 185(EFIAPI *EFI_HII_DATABASE_UPDATE_PACK) (\r
d1f95000 186 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
7d582d6b 187 IN EFI_HII_HANDLE Handle,\r
d1f95000 188 IN CONST EFI_HII_PACKAGE_LIST_HEADER *PackageList\r
189);\r
190\r
191\r
192/**\r
193 \r
194 This function returns a list of the package handles of the \r
195 specified type that are currently active in the database. The \r
196 pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package \r
197 handles to be listed.\r
198 \r
199 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL\r
200 instance.\r
201 \r
202 @param PackageType Specifies the package type of the packages\r
203 to list or EFI_HII_PACKAGE_TYPE_ALL for\r
204 all packages to be listed.\r
205 \r
206 @param PackageGuid If PackageType is\r
207 EFI_HII_PACKAGE_TYPE_GUID, then this is\r
208 the pointer to the GUID which must match\r
209 the Guid field of\r
210 EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it\r
211 must be NULL.\r
212 \r
213 @param HandleBufferLength On input, a pointer to the length\r
214 of the handle buffer. On output,\r
215 the length of the handle buffer\r
216 that is required for the handles\r
217 found.\r
218\r
7d582d6b 219 @param Handle An array of EFI_HII_HANDLE instances returned.\r
d1f95000 220\r
221\r
222 @retval EFI_SUCCESS Handle was updated successfully.\r
223\r
224 @retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter\r
225 indicates that Handle is too\r
226 small to support the number of\r
227 handles. HandleBufferLength is\r
228 updated with a value that will\r
229 enable the data to fit.\r
230\r
231\r
232**/\r
233typedef\r
234EFI_STATUS\r
7d582d6b 235(EFIAPI *EFI_HII_DATABASE_LIST_PACKS) (\r
d1f95000 236 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
7d582d6b 237 IN UINT8 PackageType,\r
d1f95000 238 IN CONST EFI_GUID *PackageGuid,\r
239 IN OUT UINTN *HandleBufferLength,\r
7d582d6b 240 OUT EFI_HII_HANDLE *Handle\r
d1f95000 241);\r
242\r
243\r
244\r
245\r
246\r
247\r
248/**\r
249\r
250 This function will export one or all package lists in the\r
251 database to a buffer. For each package list exported, this\r
252 function will call functions registered with EXPORT_PACK and\r
253 then copy the package list to the buffer. The registered\r
254 functions may call EFI_HII_DATABASE_PROTOCOL.UpdatePackageList()\r
255 to modify the package list before it is copied to the buffer. If\r
256 the specified BufferSize is too small, then the status\r
257 EFI_OUT_OF_RESOURCES will be returned and the actual package\r
258 size will be returned in BufferSize.\r
259\r
260 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL\r
261 instance.\r
262\r
7d582d6b 263 @param Handle An EFI_HII_HANDLE that corresponds to the\r
d1f95000 264 desired package list in the HII database to\r
265 export or NULL to indicate all package lists\r
266 should be exported. \r
267\r
268 @param BufferSize On input, a pointer to the length of the\r
269 buffer. On output, the length of the\r
270 buffer that is required for the exported\r
271 data.\r
272\r
273 @param Buffer A pointer to a buffer that will contain the\r
274 results of the export function.\r
275 \r
276 \r
277 @retval EFI_SUCCESS Package exported.\r
278 \r
279 @retval EFI_OUT_OF_RESOURCES BufferSize is too small to hold\r
280 the package.\r
281\r
282**/\r
283typedef\r
284EFI_STATUS\r
7d582d6b 285(EFIAPI *EFI_HII_DATABASE_EXPORT_PACKS) (\r
286 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
287 IN EFI_HII_HANDLE Handle,\r
288 IN OUT UINTN *BufferSize,\r
289 OUT EFI_HII_PACKAGE_LIST_HEADER *Buffer\r
d1f95000 290);\r
291\r
292\r
293/**\r
294 \r
295 \r
296 This function registers a function which will be called when\r
297 specified actions related to packages of the specified type\r
298 occur in the HII database. By registering a function, other\r
299 HII-related drivers are notified when specific package types\r
300 are added, removed or updated in the HII database. Each driver\r
301 or application which registers a notification should use\r
302 EFI_HII_DATABASE_PROTOCOL.UnregisterPackageNotify() before\r
303 exiting.\r
304 \r
305 \r
306 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL\r
307 instance.\r
308\r
309 @param PackageType The package type. See\r
310 EFI_HII_PACKAGE_TYPE_x in EFI_HII_PACKAGE_HEADER. \r
311\r
312 @param PackageGuid If PackageType is\r
313 EFI_HII_PACKAGE_TYPE_GUID, then this is\r
314 the pointer to the GUID which must match\r
315 the Guid field of\r
316 EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it\r
317 must be NULL.\r
318\r
319 @param PackageNotifyFn Points to the function to be called\r
320 when the event specified by\r
321 NotificationType occurs. See\r
322 EFI_HII_DATABASE_NOTIFY.\r
323\r
324 @param NotifyType Describes the types of notification which\r
325 this function will be receiving. See\r
326 EFI_HII_DATABASE_NOTIFY_TYPE for more a\r
327 list of types.\r
328\r
329 @param NotifyHandle Points to the unique handle assigned to\r
330 the registered notification. Can be used\r
331 in\r
332 EFI_HII_DATABASE_PROTOCOL.UnregisterPack\r
333 to stop notifications.\r
334\r
335\r
336 @retval EFI_SUCCESS Notification registered successfully.\r
337\r
338 @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary\r
339 data structures.\r
340\r
341 @retval EFI_INVALID_PARAMETER PackageGuid is not NULL when\r
342 PackageType is not\r
343 EFI_HII_PACKAGE_TYPE_GUID.\r
344\r
345**/\r
346typedef\r
347EFI_STATUS\r
7d582d6b 348(EFIAPI *EFI_HII_DATABASE_REGISTER_NOTIFY) (\r
d1f95000 349 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
7d582d6b 350 IN UINT8 PackageType,\r
d1f95000 351 IN CONST EFI_GUID *PackageGuid,\r
7d582d6b 352 IN EFI_HII_DATABASE_NOTIFY PackageNotifyFn,\r
353 IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType,\r
d1f95000 354 OUT EFI_HANDLE *NotifyHandle\r
355);\r
356\r
357\r
358/**\r
359 \r
360 Removes the specified HII database package-related notification.\r
361 \r
362 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL\r
363 instance.\r
364 \r
365 @param NotificationHandle The handle of the notification\r
366 function being unregistered.\r
367 \r
368 @retval EFI_SUCCESS Unregister the notification\r
369 Successsfully\r
370 \r
371 @retval EFI_INVALID_PARAMETER The Handle is invalid.\r
372\r
373**/\r
374typedef\r
375EFI_STATUS\r
7d582d6b 376(EFIAPI *EFI_HII_DATABASE_UNREGISTER_NOTIFY) (\r
d1f95000 377 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
7d582d6b 378 IN EFI_HANDLE NotificationHandle\r
d1f95000 379);\r
380\r
381\r
d1f95000 382/**\r
383 \r
384 This routine retrieves an array of GUID values for each keyboard\r
385 layout that was previously registered in the system.\r
386\r
387 @param This A pointer to the EFI_HII_PROTOCOL instance.\r
388\r
389 @param KeyGuidBufferLength On input, a pointer to the length\r
390 of the keyboard GUID buffer. On\r
391 output, the length of the handle\r
392 buffer that is required for the\r
393 handles found. KeyGuidBuffer An\r
394 array of keyboard layout GUID\r
395 instances returned.\r
396\r
397 @retval EFI_SUCCESS KeyGuidBuffer was updated successfully.\r
398 \r
399 @retval EFI_BUFFER_TOO_SMALL The KeyGuidBufferLength\r
400 parameter indicates that\r
401 KeyGuidBuffer is too small to\r
402 support the number of GUIDs.\r
403 KeyGuidBufferLength is updated\r
404 with a value that will enable\r
405 the data to fit.\r
406\r
407**/\r
408typedef\r
409EFI_STATUS\r
410(EFIAPI *EFI_HII_FIND_KEYBOARD_LAYOUTS) (\r
411 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
412 IN OUT UINT16 *KeyGuidBufferLength,\r
413 OUT EFI_GUID *KeyGuidBuffer\r
414);\r
415\r
416\r
417/**\r
418 \r
419 This routine retrieves the requested keyboard layout. The layout\r
420 is a physical description of the keys on a keyboard and the\r
421 character(s) that are associated with a particular set of key\r
422 strokes.\r
423\r
424 @param This A pointer to the EFI_HII_PROTOCOL instance.\r
425 \r
426 @param KeyGuid A pointer to the unique ID associated with a\r
427 given keyboard layout. If KeyGuid is NULL then\r
428 the current layout will be retrieved.\r
429 \r
430 @param KeyboardLayout A pointer to a buffer containing the\r
431 retrieved keyboard layout. below.\r
432 \r
433 @retval EFI_SUCCESS The keyboard layout was retrieved\r
434 successfully.\r
435 \r
436 @retval EFI_NOT_FOUND The requested keyboard layout was not\r
437 found.\r
438\r
439**/\r
440typedef\r
441EFI_STATUS\r
442(EFIAPI *EFI_HII_GET_KEYBOARD_LAYOUT) (\r
443 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
444 IN CONST EFI_GUID *KeyGuid,\r
7d582d6b 445 IN OUT UINT16 *KeyboardLayoutLength,\r
d1f95000 446 OUT EFI_HII_KEYBOARD_LAYOUT *KeyboardLayout\r
447);\r
448\r
449/**\r
450 \r
451 This routine sets the default keyboard layout to the one\r
452 referenced by KeyGuid. When this routine is called, an event\r
453 will be signaled of the EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID\r
454 group type. This is so that agents which are sensitive to the\r
455 current keyboard layout being changed can be notified of this\r
456 change.\r
457\r
458 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL\r
459 instance.\r
460\r
461 @param KeyGuid A pointer to the unique ID associated with a\r
462 given keyboard layout.\r
463\r
464\r
465 @retval EFI_SUCCESS The current keyboard layout was\r
466 successfully set.\r
467 \r
468 @retval EFI_NOT_FOUND The referenced keyboard layout was not\r
469 found, so action was taken.\r
470\r
471**/\r
472typedef\r
473EFI_STATUS\r
474(EFIAPI *EFI_HII_SET_KEYBOARD_LAYOUT) (\r
475 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
476 IN CONST EFI_GUID *KeyGuid\r
477);\r
478\r
479/**\r
480 \r
481 Return the EFI handle associated with a package list.\r
482 \r
483 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL\r
484 instance.\r
485 \r
7d582d6b 486 @param PackageListHandle An EFI_HII_HANDLE that corresponds\r
d1f95000 487 to the desired package list in the\r
488 HIIdatabase.\r
489 \r
490 @param DriverHandle On return, contains the EFI_HANDLE which\r
491 was registered with the package list in\r
492 NewPackageList().\r
493 \r
494 @retval EFI_SUCCESS The DriverHandle was returned\r
495 successfully.\r
496 \r
497 @retval EFI_INVALID_PARAMETER The PackageListHandle was not\r
498 valid.\r
499\r
500**/\r
501typedef\r
502EFI_STATUS\r
7d582d6b 503(EFIAPI *EFI_HII_DATABASE_GET_PACK_HANDLE) (\r
d1f95000 504 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
7d582d6b 505 IN EFI_HII_HANDLE PackageListHandle,\r
d1f95000 506 OUT EFI_HANDLE *DriverHandle\r
507);\r
508\r
509/**\r
510 \r
511 @param NewPackageList Add a new package list to the HII\r
512 database.\r
513\r
514 @param RemovePackageList Remove a package list from the HII\r
515 database.\r
516\r
517 @param UpdatePackageList Update a package list in the HII\r
518 database.\r
519\r
520 @param ListPackageLists List the handles of the package\r
521 lists within the HII database. \r
522\r
523 @param ExportPackageLists Export package lists from the HII\r
524 database.\r
525\r
526 @param RegisterPackageNotify Register notification when\r
527 packages of a certain type are\r
528 installed.\r
529\r
530 @param UnregisterPackageNotify Unregister notification of\r
531 packages.\r
532\r
533 @param FindKeyboardLayouts Retrieves a list of the keyboard\r
534 layouts in the system.\r
535\r
536 @param GetKeyboardLayout Allows a program to extract the\r
537 current keyboard layout. See the\r
538 GetKeyboardLayout() function\r
539 description.\r
540\r
541 @param SetKeyboardLayout Changes the current keyboard layout.\r
542 See the SetKeyboardLayout() function\r
543\r
544\r
545**/\r
546struct _EFI_HII_DATABASE_PROTOCOL {\r
7d582d6b 547 EFI_HII_DATABASE_NEW_PACK NewPackageList;\r
548 EFI_HII_DATABASE_REMOVE_PACK RemovePackageList;\r
549 EFI_HII_DATABASE_UPDATE_PACK UpdatePackageList;\r
550 EFI_HII_DATABASE_LIST_PACKS ListPackageLists;\r
551 EFI_HII_DATABASE_EXPORT_PACKS ExportPackageLists;\r
552 EFI_HII_DATABASE_REGISTER_NOTIFY RegisterPackageNotify;\r
553 EFI_HII_DATABASE_UNREGISTER_NOTIFY UnregisterPackageNotify;\r
554 EFI_HII_FIND_KEYBOARD_LAYOUTS FindKeyboardLayouts;\r
555 EFI_HII_GET_KEYBOARD_LAYOUT GetKeyboardLayout;\r
556 EFI_HII_SET_KEYBOARD_LAYOUT SetKeyboardLayout;\r
557 EFI_HII_DATABASE_GET_PACK_HANDLE GetPackageListHandle;\r
d1f95000 558};\r
559\r
560extern EFI_GUID gEfiHiiDatabaseProtocolGuid;\r
561\r
562#endif\r
563\r
7d582d6b 564\r