]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/HiiDatabase.h
Merged in the following trackers from EDK:
[mirror_edk2.git] / MdePkg / Include / Protocol / HiiDatabase.h
... / ...
CommitLineData
1/** @file\r
2 The file provides Database manager for HII-related data\r
3 structures.\r
4 \r
5 Copyright (c) 2006 - 2008, 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
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
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
62 IN UINT8 PackageType,\r
63 IN CONST EFI_GUID *PackageGuid,\r
64 IN CONST EFI_HII_PACKAGE_HEADER *Package,\r
65 IN EFI_HII_HANDLE Handle,\r
66 IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType\r
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
90 EFI_HII_HANDLE instance.\r
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
105(EFIAPI *EFI_HII_DATABASE_NEW_PACK) (\r
106 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
107 IN CONST EFI_HII_PACKAGE_LIST_HEADER *PackageList,\r
108 IN EFI_HANDLE DriverHandle,\r
109 OUT EFI_HII_HANDLE *Handle\r
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 @retval EFI_NOT_FOUND The specified Handle is not in database.\r
131\r
132**/\r
133typedef\r
134EFI_STATUS\r
135(EFIAPI *EFI_HII_DATABASE_REMOVE_PACK) (\r
136 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
137 IN EFI_HII_HANDLE Handle\r
138);\r
139\r
140\r
141/**\r
142 \r
143 This function updates the existing package list (which has the\r
144 specified Handle) in the HII databases, using the new package\r
145 list specified by PackageList. The update process has the\r
146 following steps: Collect all the package types in the package\r
147 list specified by PackageList. A package type consists of the\r
148 Type field of EFI_HII_PACKAGE_HEADER and, if the Type is\r
149 EFI_HII_PACKAGE_TYPE_GUID, the Guid field, as defined in\r
150 EFI_HII_PACKAGE_GUID_HEADER. Iterate through the packages within\r
151 the existing package list in the HII database specified by\r
152 Handle. If a package??s type matches one of the types collected\r
153 in step 1, then perform the following steps:\r
154 - Call any functions registered with the notification type\r
155 REMOVE_PACK.\r
156 - Remove the package from the package list and the HII\r
157 database.\r
158 Add all of the packages within the new package list specified\r
159 by PackageList, using the following steps:\r
160 - Add the package to the package list and the HII database.\r
161 - Call any functions registered with the notification type\r
162 ADD_PACK.\r
163\r
164 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL\r
165 instance.\r
166 \r
167 @param Handle The handle that was registered to the data\r
168 that is requested for removal.\r
169 \r
170 @param PackageList A pointer to an EFI_HII_PACKAGE_LIST\r
171 package.\r
172 \r
173 @retval EFI_SUCCESS The HII database was successfully\r
174 updated.\r
175 \r
176 @retval EFI_OUT_OF_RESOURCES Unable to allocate enough memory\r
177 for the updated database.\r
178 \r
179 @retval EFI_INVALID_PARAMETER PackageList was NULL.\r
180 @retval EFI_NOT_FOUND The specified Handle is not in database.\r
181\r
182**/\r
183typedef\r
184EFI_STATUS\r
185(EFIAPI *EFI_HII_DATABASE_UPDATE_PACK) (\r
186 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
187 IN EFI_HII_HANDLE Handle,\r
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
219 @param Handle An array of EFI_HII_HANDLE instances returned.\r
220\r
221\r
222 @retval EFI_SUCCESS The matching handles are outputed successfully.\r
223 HandleBufferLength is updated with the actual length.\r
224\r
225 @retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter\r
226 indicates that Handle is too\r
227 small to support the number of\r
228 handles. HandleBufferLength is\r
229 updated with a value that will\r
230 enable the data to fit.\r
231 @retval EFI_NOT_FOUND No matching handle could not be found in database.\r
232 @retval EFI_INVALID_PARAMETER Handle or HandleBufferLength was NULL.\r
233 @retval EFI_INVALID_PARAMETER PackageType is not a EFI_HII_PACKAGE_TYPE_GUID but\r
234 PackageGuid is not NULL, PackageType is a EFI_HII_\r
235 PACKAGE_TYPE_GUID but PackageGuid is NULL.\r
236\r
237\r
238**/\r
239typedef\r
240EFI_STATUS\r
241(EFIAPI *EFI_HII_DATABASE_LIST_PACKS) (\r
242 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
243 IN UINT8 PackageType,\r
244 IN CONST EFI_GUID *PackageGuid,\r
245 IN OUT UINTN *HandleBufferLength,\r
246 OUT EFI_HII_HANDLE *Handle\r
247);\r
248\r
249\r
250\r
251\r
252\r
253\r
254/**\r
255\r
256 This function will export one or all package lists in the\r
257 database to a buffer. For each package list exported, this\r
258 function will call functions registered with EXPORT_PACK and\r
259 then copy the package list to the buffer. The registered\r
260 functions may call EFI_HII_DATABASE_PROTOCOL.UpdatePackageList()\r
261 to modify the package list before it is copied to the buffer. If\r
262 the specified BufferSize is too small, then the status\r
263 EFI_OUT_OF_RESOURCES will be returned and the actual package\r
264 size will be returned in BufferSize.\r
265\r
266 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL\r
267 instance.\r
268\r
269 @param Handle An EFI_HII_HANDLE that corresponds to the\r
270 desired package list in the HII database to\r
271 export or NULL to indicate all package lists\r
272 should be exported. \r
273\r
274 @param BufferSize On input, a pointer to the length of the\r
275 buffer. On output, the length of the\r
276 buffer that is required for the exported\r
277 data.\r
278\r
279 @param Buffer A pointer to a buffer that will contain the\r
280 results of the export function.\r
281 \r
282 \r
283 @retval EFI_SUCCESS Package exported.\r
284 \r
285 @retval EFI_OUT_OF_RESOURCES BufferSize is too small to hold\r
286 the package.\r
287\r
288**/\r
289typedef\r
290EFI_STATUS\r
291(EFIAPI *EFI_HII_DATABASE_EXPORT_PACKS) (\r
292 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
293 IN EFI_HII_HANDLE Handle,\r
294 IN OUT UINTN *BufferSize,\r
295 OUT EFI_HII_PACKAGE_LIST_HEADER *Buffer\r
296);\r
297\r
298\r
299/**\r
300 \r
301 \r
302 This function registers a function which will be called when\r
303 specified actions related to packages of the specified type\r
304 occur in the HII database. By registering a function, other\r
305 HII-related drivers are notified when specific package types\r
306 are added, removed or updated in the HII database. Each driver\r
307 or application which registers a notification should use\r
308 EFI_HII_DATABASE_PROTOCOL.UnregisterPackageNotify() before\r
309 exiting.\r
310 \r
311 \r
312 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL\r
313 instance.\r
314\r
315 @param PackageType The package type. See\r
316 EFI_HII_PACKAGE_TYPE_x in EFI_HII_PACKAGE_HEADER. \r
317\r
318 @param PackageGuid If PackageType is\r
319 EFI_HII_PACKAGE_TYPE_GUID, then this is\r
320 the pointer to the GUID which must match\r
321 the Guid field of\r
322 EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it\r
323 must be NULL.\r
324\r
325 @param PackageNotifyFn Points to the function to be called\r
326 when the event specified by\r
327 NotificationType occurs. See\r
328 EFI_HII_DATABASE_NOTIFY.\r
329\r
330 @param NotifyType Describes the types of notification which\r
331 this function will be receiving. See\r
332 EFI_HII_DATABASE_NOTIFY_TYPE for more a\r
333 list of types.\r
334\r
335 @param NotifyHandle Points to the unique handle assigned to\r
336 the registered notification. Can be used\r
337 in\r
338 EFI_HII_DATABASE_PROTOCOL.UnregisterPack\r
339 to stop notifications.\r
340\r
341\r
342 @retval EFI_SUCCESS Notification registered successfully.\r
343\r
344 @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary\r
345 data structures.\r
346\r
347 @retval EFI_INVALID_PARAMETER PackageGuid is not NULL when\r
348 PackageType is not\r
349 EFI_HII_PACKAGE_TYPE_GUID.\r
350\r
351**/\r
352typedef\r
353EFI_STATUS\r
354(EFIAPI *EFI_HII_DATABASE_REGISTER_NOTIFY) (\r
355 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
356 IN UINT8 PackageType,\r
357 IN CONST EFI_GUID *PackageGuid,\r
358 IN EFI_HII_DATABASE_NOTIFY PackageNotifyFn,\r
359 IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType,\r
360 OUT EFI_HANDLE *NotifyHandle\r
361);\r
362\r
363\r
364/**\r
365 \r
366 Removes the specified HII database package-related notification.\r
367 \r
368 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL\r
369 instance.\r
370 \r
371 @param NotificationHandle The handle of the notification\r
372 function being unregistered.\r
373 \r
374 @retval EFI_SUCCESS Unregister the notification\r
375 Successsfully\r
376 \r
377 @retval EFI_NOT_FOUND The incoming notification handle does not exist \r
378 in current hii database.\r
379 \r
380**/\r
381typedef\r
382EFI_STATUS\r
383(EFIAPI *EFI_HII_DATABASE_UNREGISTER_NOTIFY) (\r
384 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
385 IN EFI_HANDLE NotificationHandle\r
386);\r
387\r
388\r
389/**\r
390 \r
391 This routine retrieves an array of GUID values for each keyboard\r
392 layout that was previously registered in the system.\r
393\r
394 @param This A pointer to the EFI_HII_PROTOCOL instance.\r
395\r
396 @param KeyGuidBufferLength On input, a pointer to the length\r
397 of the keyboard GUID buffer. On\r
398 output, the length of the handle\r
399 buffer that is required for the\r
400 handles found. KeyGuidBuffer An\r
401 array of keyboard layout GUID\r
402 instances returned.\r
403\r
404 @retval EFI_SUCCESS KeyGuidBuffer was updated successfully.\r
405 \r
406 @retval EFI_BUFFER_TOO_SMALL The KeyGuidBufferLength\r
407 parameter indicates that\r
408 KeyGuidBuffer is too small to\r
409 support the number of GUIDs.\r
410 KeyGuidBufferLength is updated\r
411 with a value that will enable\r
412 the data to fit.\r
413\r
414**/\r
415typedef\r
416EFI_STATUS\r
417(EFIAPI *EFI_HII_FIND_KEYBOARD_LAYOUTS) (\r
418 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
419 IN OUT UINT16 *KeyGuidBufferLength,\r
420 OUT EFI_GUID *KeyGuidBuffer\r
421);\r
422\r
423\r
424/**\r
425 \r
426 This routine retrieves the requested keyboard layout. The layout\r
427 is a physical description of the keys on a keyboard and the\r
428 character(s) that are associated with a particular set of key\r
429 strokes.\r
430\r
431 @param This A pointer to the EFI_HII_PROTOCOL instance.\r
432 \r
433 @param KeyGuid A pointer to the unique ID associated with a\r
434 given keyboard layout. If KeyGuid is NULL then\r
435 the current layout will be retrieved.\r
436 \r
437 @param KeyboardLayout A pointer to a buffer containing the\r
438 retrieved keyboard layout. below.\r
439 \r
440 @retval EFI_SUCCESS The keyboard layout was retrieved\r
441 successfully.\r
442 \r
443 @retval EFI_NOT_FOUND The requested keyboard layout was not\r
444 found.\r
445\r
446**/\r
447typedef\r
448EFI_STATUS\r
449(EFIAPI *EFI_HII_GET_KEYBOARD_LAYOUT) (\r
450 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
451 IN CONST EFI_GUID *KeyGuid,\r
452 IN OUT UINT16 *KeyboardLayoutLength,\r
453 OUT EFI_HII_KEYBOARD_LAYOUT *KeyboardLayout\r
454);\r
455\r
456/**\r
457 \r
458 This routine sets the default keyboard layout to the one\r
459 referenced by KeyGuid. When this routine is called, an event\r
460 will be signaled of the EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID\r
461 group type. This is so that agents which are sensitive to the\r
462 current keyboard layout being changed can be notified of this\r
463 change.\r
464\r
465 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL\r
466 instance.\r
467\r
468 @param KeyGuid A pointer to the unique ID associated with a\r
469 given keyboard layout.\r
470\r
471\r
472 @retval EFI_SUCCESS The current keyboard layout was\r
473 successfully set.\r
474 \r
475 @retval EFI_NOT_FOUND The referenced keyboard layout was not\r
476 found, so action was taken.\r
477\r
478**/\r
479typedef\r
480EFI_STATUS\r
481(EFIAPI *EFI_HII_SET_KEYBOARD_LAYOUT) (\r
482 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
483 IN CONST EFI_GUID *KeyGuid\r
484);\r
485\r
486/**\r
487 \r
488 Return the EFI handle associated with a package list.\r
489 \r
490 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL\r
491 instance.\r
492 \r
493 @param PackageListHandle An EFI_HII_HANDLE that corresponds\r
494 to the desired package list in the\r
495 HIIdatabase.\r
496 \r
497 @param DriverHandle On return, contains the EFI_HANDLE which\r
498 was registered with the package list in\r
499 NewPackageList().\r
500 \r
501 @retval EFI_SUCCESS The DriverHandle was returned\r
502 successfully.\r
503 \r
504 @retval EFI_INVALID_PARAMETER The PackageListHandle was not\r
505 valid.\r
506\r
507**/\r
508typedef\r
509EFI_STATUS\r
510(EFIAPI *EFI_HII_DATABASE_GET_PACK_HANDLE) (\r
511 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
512 IN EFI_HII_HANDLE PackageListHandle,\r
513 OUT EFI_HANDLE *DriverHandle\r
514);\r
515\r
516/**\r
517 \r
518 @param NewPackageList Add a new package list to the HII\r
519 database.\r
520\r
521 @param RemovePackageList Remove a package list from the HII\r
522 database.\r
523\r
524 @param UpdatePackageList Update a package list in the HII\r
525 database.\r
526\r
527 @param ListPackageLists List the handles of the package\r
528 lists within the HII database. \r
529\r
530 @param ExportPackageLists Export package lists from the HII\r
531 database.\r
532\r
533 @param RegisterPackageNotify Register notification when\r
534 packages of a certain type are\r
535 installed.\r
536\r
537 @param UnregisterPackageNotify Unregister notification of\r
538 packages.\r
539\r
540 @param FindKeyboardLayouts Retrieves a list of the keyboard\r
541 layouts in the system.\r
542\r
543 @param GetKeyboardLayout Allows a program to extract the\r
544 current keyboard layout. See the\r
545 GetKeyboardLayout() function\r
546 description.\r
547\r
548 @param SetKeyboardLayout Changes the current keyboard layout.\r
549 See the SetKeyboardLayout() function\r
550\r
551\r
552**/\r
553struct _EFI_HII_DATABASE_PROTOCOL {\r
554 EFI_HII_DATABASE_NEW_PACK NewPackageList;\r
555 EFI_HII_DATABASE_REMOVE_PACK RemovePackageList;\r
556 EFI_HII_DATABASE_UPDATE_PACK UpdatePackageList;\r
557 EFI_HII_DATABASE_LIST_PACKS ListPackageLists;\r
558 EFI_HII_DATABASE_EXPORT_PACKS ExportPackageLists;\r
559 EFI_HII_DATABASE_REGISTER_NOTIFY RegisterPackageNotify;\r
560 EFI_HII_DATABASE_UNREGISTER_NOTIFY UnregisterPackageNotify;\r
561 EFI_HII_FIND_KEYBOARD_LAYOUTS FindKeyboardLayouts;\r
562 EFI_HII_GET_KEYBOARD_LAYOUT GetKeyboardLayout;\r
563 EFI_HII_SET_KEYBOARD_LAYOUT SetKeyboardLayout;\r
564 EFI_HII_DATABASE_GET_PACK_HANDLE GetPackageListHandle;\r
565};\r
566\r
567extern EFI_GUID gEfiHiiDatabaseProtocolGuid;\r
568\r
569#endif\r
570\r
571\r