]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/HiiDatabase.h
Update the copyright notice format
[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
5Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
6This program and the accompanying materials are licensed and made available under \r
7the terms and conditions of the BSD License that accompanies this distribution. \r
8The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php. \r
10 \r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
12WITHOUT 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\r
31#define EFI_HII_DATABASE_NOTIFY_NEW_PACK 0x00000001\r
32#define EFI_HII_DATABASE_NOTIFY_REMOVE_PACK 0x00000002\r
33#define EFI_HII_DATABASE_NOTIFY_EXPORT_PACK 0x00000004\r
34#define EFI_HII_DATABASE_NOTIFY_ADD_PACK 0x00000008\r
35/**\r
36 \r
37 Functions which are registered to receive notification of\r
38 database events have this prototype. The actual event is encoded\r
39 in NotifyType. The following table describes how PackageType,\r
40 PackageGuid, Handle, and Package are used for each of the\r
41 notification types.\r
42\r
43 @param PackageType Package type of the notification.\r
44\r
45 @param PackageGuid If PackageType is\r
46 EFI_HII_PACKAGE_TYPE_GUID, then this is\r
47 the pointer to the GUID from the Guid\r
48 field of EFI_HII_PACKAGE_GUID_HEADER.\r
49 Otherwise, it must be NULL.\r
50\r
51 @param Package Points to the package referred to by the notification. \r
52 \r
53 @param Handle The handle of the package\r
54 list which contains the specified package.\r
55\r
56 @param NotifyType The type of change concerning the\r
57 database. See\r
58 EFI_HII_DATABASE_NOTIFY_TYPE.\r
59\r
60**/\r
61typedef\r
62EFI_STATUS\r
63(EFIAPI *EFI_HII_DATABASE_NOTIFY)(\r
64 IN UINT8 PackageType,\r
65 IN CONST EFI_GUID *PackageGuid,\r
66 IN CONST EFI_HII_PACKAGE_HEADER *Package,\r
67 IN EFI_HII_HANDLE Handle,\r
68 IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType\r
69);\r
70\r
71/**\r
72\r
73 This function adds the packages in the package list to the\r
74 database and returns a handle. If there is a\r
75 EFI_DEVICE_PATH_PROTOCOL associated with the DriverHandle, then\r
76 this function will create a package of type\r
77 EFI_PACKAGE_TYPE_DEVICE_PATH and add it to the package list. For\r
78 each package in the package list, registered functions with the\r
79 notification type NEW_PACK and having the same package type will\r
80 be called. For each call to NewPackageList(), there should be a\r
81 corresponding call to\r
82 EFI_HII_DATABASE_PROTOCOL.RemovePackageList().\r
83 \r
84 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.\r
85\r
86 @param PackageList A pointer to an EFI_HII_PACKAGE_LIST_HEADER structure.\r
87\r
88 @param DriverHandle Associate the package list with this EFI handle.\r
89 If a NULL is specified, this data will not be associate\r
90 with any drivers and cannot have a callback induced.\r
91 \r
92 @param Handle A pointer to the EFI_HII_HANDLE instance.\r
93\r
94 @retval EFI_SUCCESS The package list associated with the\r
95 Handle was added to the HII database.\r
96\r
97 @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary\r
98 resources for the new database\r
99 contents.\r
100\r
101 @retval EFI_INVALID_PARAMETER PackageList is NULL, or Handle is NULL.\r
102\r
103**/\r
104typedef\r
105EFI_STATUS\r
106(EFIAPI *EFI_HII_DATABASE_NEW_PACK)(\r
107 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
108 IN CONST EFI_HII_PACKAGE_LIST_HEADER *PackageList,\r
109 IN EFI_HANDLE DriverHandle, OPTIONAL\r
110 OUT EFI_HII_HANDLE *Handle\r
111);\r
112\r
113\r
114/**\r
115\r
116 This function removes the package list that is associated with a\r
117 handle Handle from the HII database. Before removing the\r
118 package, any registered functions with the notification type\r
119 REMOVE_PACK and the same package type will be called. For each\r
120 call to EFI_HII_DATABASE_PROTOCOL.NewPackageList(), there should\r
121 be a corresponding call to RemovePackageList.\r
122\r
123 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL 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 collected 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 instance.\r
165 \r
166 @param Handle The handle that was registered to the data\r
167 that is requested for removal.\r
168 \r
169 @param PackageList A pointer to an EFI_HII_PACKAGE_LIST\r
170 package.\r
171 \r
172 @retval EFI_SUCCESS The HII database was successfully updated.\r
173 \r
174 @retval EFI_OUT_OF_RESOURCES Unable to allocate enough memory\r
175 for the updated database.\r
176 \r
177 @retval EFI_INVALID_PARAMETER PackageList was NULL.\r
178 @retval EFI_NOT_FOUND The specified Handle is not in database.\r
179\r
180**/\r
181typedef\r
182EFI_STATUS\r
183(EFIAPI *EFI_HII_DATABASE_UPDATE_PACK)(\r
184 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
185 IN EFI_HII_HANDLE Handle,\r
186 IN CONST EFI_HII_PACKAGE_LIST_HEADER *PackageList\r
187);\r
188\r
189\r
190/**\r
191 \r
192 This function returns a list of the package handles of the \r
193 specified type that are currently active in the database. The \r
194 pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package \r
195 handles to be listed.\r
196 \r
197 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.\r
198 \r
199 @param PackageType Specifies the package type of the packages\r
200 to list or EFI_HII_PACKAGE_TYPE_ALL for\r
201 all packages to be listed.\r
202 \r
203 @param PackageGuid If PackageType is\r
204 EFI_HII_PACKAGE_TYPE_GUID, then this is\r
205 the pointer to the GUID which must match\r
206 the Guid field of\r
207 EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it\r
208 must be NULL.\r
209 \r
210 @param HandleBufferLength On input, a pointer to the length\r
211 of the handle buffer. On output,\r
212 the length of the handle buffer\r
213 that is required for the handles found.\r
214\r
215 @param Handle An array of EFI_HII_HANDLE instances returned.\r
216\r
217 @retval EFI_SUCCESS The matching handles are outputed successfully.\r
218 HandleBufferLength is updated with the actual length.\r
219 @retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter\r
220 indicates that Handle is too\r
221 small to support the number of\r
222 handles. HandleBufferLength is\r
223 updated with a value that will\r
224 enable the data to fit.\r
225 @retval EFI_NOT_FOUND No matching handle could be found in database.\r
226 @retval EFI_INVALID_PARAMETER Handle or HandleBufferLength was NULL.\r
227 @retval EFI_INVALID_PARAMETER PackageType is not a EFI_HII_PACKAGE_TYPE_GUID but\r
228 PackageGuid is not NULL, PackageType is a EFI_HII_\r
229 PACKAGE_TYPE_GUID but PackageGuid is NULL.\r
230**/\r
231typedef\r
232EFI_STATUS\r
233(EFIAPI *EFI_HII_DATABASE_LIST_PACKS)(\r
234 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
235 IN UINT8 PackageType,\r
236 IN CONST EFI_GUID *PackageGuid,\r
237 IN OUT UINTN *HandleBufferLength,\r
238 OUT EFI_HII_HANDLE *Handle\r
239);\r
240\r
241/**\r
242\r
243 This function will export one or all package lists in the\r
244 database to a buffer. For each package list exported, this\r
245 function will call functions registered with EXPORT_PACK and\r
246 then copy the package list to the buffer. The registered\r
247 functions may call EFI_HII_DATABASE_PROTOCOL.UpdatePackageList()\r
248 to modify the package list before it is copied to the buffer. If\r
249 the specified BufferSize is too small, then the status\r
250 EFI_OUT_OF_RESOURCES will be returned and the actual package\r
251 size will be returned in BufferSize.\r
252\r
253 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.\r
254\r
255\r
256 @param Handle An EFI_HII_HANDLE that corresponds to the\r
257 desired package list in the HII database to\r
258 export or NULL to indicate all package lists\r
259 should be exported. \r
260\r
261 @param BufferSize On input, a pointer to the length of the\r
262 buffer. On output, the length of the\r
263 buffer that is required for the exported\r
264 data.\r
265\r
266 @param Buffer A pointer to a buffer that will contain the\r
267 results of the export function.\r
268 \r
269 \r
270 @retval EFI_SUCCESS Package exported.\r
271 \r
272 @retval EFI_OUT_OF_RESOURCES BufferSize is too small to hold the package.\r
273\r
274**/\r
275typedef\r
276EFI_STATUS\r
277(EFIAPI *EFI_HII_DATABASE_EXPORT_PACKS)(\r
278 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
279 IN EFI_HII_HANDLE Handle,\r
280 IN OUT UINTN *BufferSize,\r
281 OUT EFI_HII_PACKAGE_LIST_HEADER *Buffer\r
282);\r
283\r
284\r
285/**\r
286 \r
287 \r
288 This function registers a function which will be called when\r
289 specified actions related to packages of the specified type\r
290 occur in the HII database. By registering a function, other\r
291 HII-related drivers are notified when specific package types\r
292 are added, removed or updated in the HII database. Each driver\r
293 or application which registers a notification should use\r
294 EFI_HII_DATABASE_PROTOCOL.UnregisterPackageNotify() before\r
295 exiting.\r
296 \r
297 \r
298 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.\r
299\r
300 @param PackageType The package type. See\r
301 EFI_HII_PACKAGE_TYPE_x in EFI_HII_PACKAGE_HEADER. \r
302\r
303 @param PackageGuid If PackageType is\r
304 EFI_HII_PACKAGE_TYPE_GUID, then this is\r
305 the pointer to the GUID which must match\r
306 the Guid field of\r
307 EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it\r
308 must be NULL.\r
309\r
310 @param PackageNotifyFn Points to the function to be called\r
311 when the event specified by\r
312 NotificationType occurs. See\r
313 EFI_HII_DATABASE_NOTIFY.\r
314\r
315 @param NotifyType Describes the types of notification which\r
316 this function will be receiving. See\r
317 EFI_HII_DATABASE_NOTIFY_TYPE for a\r
318 list of types.\r
319\r
320 @param NotifyHandle Points to the unique handle assigned to\r
321 the registered notification. Can be used\r
322 in EFI_HII_DATABASE_PROTOCOL.UnregisterPack\r
323 to stop notifications.\r
324\r
325\r
326 @retval EFI_SUCCESS Notification registered successfully.\r
327\r
328 @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary\r
329 data structures.\r
330\r
331 @retval EFI_INVALID_PARAMETER PackageGuid is not NULL when\r
332 PackageType is not\r
333 EFI_HII_PACKAGE_TYPE_GUID.\r
334\r
335**/\r
336typedef\r
337EFI_STATUS\r
338(EFIAPI *EFI_HII_DATABASE_REGISTER_NOTIFY)(\r
339 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
340 IN UINT8 PackageType,\r
341 IN CONST EFI_GUID *PackageGuid,\r
342 IN EFI_HII_DATABASE_NOTIFY PackageNotifyFn,\r
343 IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType,\r
344 OUT EFI_HANDLE *NotifyHandle\r
345);\r
346\r
347\r
348/**\r
349 \r
350 Removes the specified HII database package-related notification.\r
351 \r
352 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.\r
353\r
354 @param NotificationHandle The handle of the notification\r
355 function being unregistered.\r
356 \r
357 @retval EFI_SUCCESS Successsfully unregistered the notification. \r
358 \r
359 @retval EFI_NOT_FOUND The incoming notification handle does not exist \r
360 in the current hii database.\r
361 \r
362**/\r
363typedef\r
364EFI_STATUS\r
365(EFIAPI *EFI_HII_DATABASE_UNREGISTER_NOTIFY)(\r
366 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
367 IN EFI_HANDLE NotificationHandle\r
368);\r
369\r
370\r
371/**\r
372 \r
373 This routine retrieves an array of GUID values for each keyboard\r
374 layout that was previously registered in the system.\r
375\r
376 @param This A pointer to the EFI_HII_PROTOCOL instance.\r
377\r
378 @param KeyGuidBufferLength On input, a pointer to the length\r
379 of the keyboard GUID buffer. On\r
380 output, the length of the handle\r
381 buffer that is required for the\r
382 handles found. \r
383 \r
384 @param KeyGuidBuffer An array of keyboard layout GUID\r
385 instances returned.\r
386\r
387 @retval EFI_SUCCESS KeyGuidBuffer was updated successfully.\r
388 \r
389 @retval EFI_BUFFER_TOO_SMALL The KeyGuidBufferLength\r
390 parameter indicates that\r
391 KeyGuidBuffer is too small to\r
392 support the number of GUIDs.\r
393 KeyGuidBufferLength is updated\r
394 with a value that will enable\r
395 the data to fit.\r
396\r
397**/\r
398typedef\r
399EFI_STATUS\r
400(EFIAPI *EFI_HII_FIND_KEYBOARD_LAYOUTS)(\r
401 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
402 IN OUT UINT16 *KeyGuidBufferLength,\r
403 OUT EFI_GUID *KeyGuidBuffer\r
404);\r
405\r
406\r
407/**\r
408 \r
409 This routine retrieves the requested keyboard layout. The layout\r
410 is a physical description of the keys on a keyboard, and the\r
411 character(s) that are associated with a particular set of key\r
412 strokes.\r
413\r
414 @param This A pointer to the EFI_HII_PROTOCOL instance.\r
415 \r
416 @param KeyGuid A pointer to the unique ID associated with a\r
417 given keyboard layout. If KeyGuid is NULL then\r
418 the current layout will be retrieved.\r
419\r
420 @param KeyboardLayoutLength On input, a pointer to the length of the\r
421 KeyboardLayout buffer. On output, the length of\r
422 the data placed into KeyboardLayout.\r
423 \r
424 @param KeyboardLayout A pointer to a buffer containing the\r
425 retrieved keyboard layout.\r
426 \r
427 @retval EFI_SUCCESS The keyboard layout was retrieved\r
428 successfully.\r
429 \r
430 @retval EFI_NOT_FOUND The requested keyboard layout was not found.\r
431\r
432**/\r
433typedef\r
434EFI_STATUS\r
435(EFIAPI *EFI_HII_GET_KEYBOARD_LAYOUT)(\r
436 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
437 IN CONST EFI_GUID *KeyGuid,\r
438 IN OUT UINT16 *KeyboardLayoutLength,\r
439 OUT EFI_HII_KEYBOARD_LAYOUT *KeyboardLayout\r
440);\r
441\r
442/**\r
443 \r
444 This routine sets the default keyboard layout to the one\r
445 referenced by KeyGuid. When this routine is called, an event\r
446 will be signaled of the EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID\r
447 group type. This is so that agents which are sensitive to the\r
448 current keyboard layout being changed can be notified of this\r
449 change.\r
450\r
451 @param This A pointer to the EFI_HII_PROTOCOL instance.\r
452\r
453 @param KeyGuid A pointer to the unique ID associated with a\r
454 given keyboard layout.\r
455\r
456 @retval EFI_SUCCESS The current keyboard layout was successfully set.\r
457\r
458 @retval EFI_NOT_FOUND The referenced keyboard layout was not\r
459 found, so action was taken.\r
460\r
461**/\r
462typedef\r
463EFI_STATUS\r
464(EFIAPI *EFI_HII_SET_KEYBOARD_LAYOUT)(\r
465 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
466 IN CONST EFI_GUID *KeyGuid\r
467);\r
468\r
469/**\r
470 \r
471 Return the EFI handle associated with a package list.\r
472 \r
473 @param This A pointer to the EFI_HII_PROTOCOL instance.\r
474 \r
475 @param PackageListHandle An EFI_HII_HANDLE that corresponds\r
476 to the desired package list in the\r
477 HIIdatabase.\r
478 \r
479 @param DriverHandle On return, contains the EFI_HANDLE which\r
480 was registered with the package list in\r
481 NewPackageList().\r
482 \r
483 @retval EFI_SUCCESS The DriverHandle was returned successfully.\r
484 \r
485 @retval EFI_INVALID_PARAMETER The PackageListHandle was not valid.\r
486\r
487**/\r
488typedef\r
489EFI_STATUS\r
490(EFIAPI *EFI_HII_DATABASE_GET_PACK_HANDLE)(\r
491 IN CONST EFI_HII_DATABASE_PROTOCOL *This,\r
492 IN EFI_HII_HANDLE PackageListHandle,\r
493 OUT EFI_HANDLE *DriverHandle\r
494);\r
495\r
496///\r
497/// Database manager for HII-related data structures.\r
498///\r
499struct _EFI_HII_DATABASE_PROTOCOL {\r
500 EFI_HII_DATABASE_NEW_PACK NewPackageList;\r
501 EFI_HII_DATABASE_REMOVE_PACK RemovePackageList;\r
502 EFI_HII_DATABASE_UPDATE_PACK UpdatePackageList;\r
503 EFI_HII_DATABASE_LIST_PACKS ListPackageLists;\r
504 EFI_HII_DATABASE_EXPORT_PACKS ExportPackageLists;\r
505 EFI_HII_DATABASE_REGISTER_NOTIFY RegisterPackageNotify;\r
506 EFI_HII_DATABASE_UNREGISTER_NOTIFY UnregisterPackageNotify;\r
507 EFI_HII_FIND_KEYBOARD_LAYOUTS FindKeyboardLayouts;\r
508 EFI_HII_GET_KEYBOARD_LAYOUT GetKeyboardLayout;\r
509 EFI_HII_SET_KEYBOARD_LAYOUT SetKeyboardLayout;\r
510 EFI_HII_DATABASE_GET_PACK_HANDLE GetPackageListHandle;\r
511};\r
512\r
513extern EFI_GUID gEfiHiiDatabaseProtocolGuid;\r
514\r
515#endif\r
516\r
517\r