2 The file provides Database manager for HII-related data
5 Copyright (c) 2006 - 2008, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef __HII_DATABASE_H__
17 #define __HII_DATABASE_H__
19 #define EFI_HII_DATABASE_PROTOCOL_GUID \
20 { 0xef9fc172, 0xa1b2, 0x4693, { 0xb3, 0x27, 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42 } }
23 typedef struct _EFI_HII_DATABASE_PROTOCOL EFI_HII_DATABASE_PROTOCOL
;
27 // EFI_HII_DATABASE_NOTIFY_TYPE
29 typedef UINTN EFI_HII_DATABASE_NOTIFY_TYPE
;
30 #define EFI_HII_DATABASE_NOTIFY_NEW_PACK 0x00000001
31 #define EFI_HII_DATABASE_NOTIFY_REMOVE_PACK 0x00000002
32 #define EFI_HII_DATABASE_NOTIFY_EXPORT_PACK 0x00000004
33 #define EFI_HII_DATABASE_NOTIFY_ADD_PACK 0x00000008
36 Functions which are registered to receive notification of
37 database events have this prototype. The actual event is encoded
38 in NotifyType. The following table describes how PackageType,
39 PackageGuid, Handle, and Package are used for each of the
42 @param PackageType Package type of the notification.
44 @param PackageGuid If PackageType is
45 EFI_HII_PACKAGE_TYPE_GUID, then this is
46 the pointer to the GUID from the Guid
47 field of EFI_HII_PACKAGE_GUID_HEADER.
48 Otherwise, it must be NULL.
50 @param Package Points to the package referred to by the notification.
52 @param Handle The handle of the package
53 list which contains the specified package.
55 @param NotifyType The type of change concerning the
57 EFI_HII_DATABASE_NOTIFY_TYPE.
62 (EFIAPI
*EFI_HII_DATABASE_NOTIFY
)(
64 IN CONST EFI_GUID
*PackageGuid
,
65 IN CONST EFI_HII_PACKAGE_HEADER
*Package
,
66 IN EFI_HII_HANDLE Handle
,
67 IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType
72 This function adds the packages in the package list to the
73 database and returns a handle. If there is a
74 EFI_DEVICE_PATH_PROTOCOL associated with the DriverHandle, then
75 this function will create a package of type
76 EFI_PACKAGE_TYPE_DEVICE_PATH and add it to the package list. For
77 each package in the package list, registered functions with the
78 notification type NEW_PACK and having the same package type will
79 be called. For each call to NewPackageList(), there should be a
81 EFI_HII_DATABASE_PROTOCOL.RemovePackageList().
83 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
85 @param PackageList A pointer to an EFI_HII_PACKAGE_LIST_HEADER structure.
87 @param DriverHandle Associate the package list with this EFI handle.
89 @param Handle A pointer to the EFI_HII_HANDLE instance.
91 @retval EFI_SUCCESS The package list associated with the
92 Handle was added to the HII database.
94 @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary
95 resources for the new database
98 @retval EFI_INVALID_PARAMETER PackageList is NULL or Handle is NULL.
103 (EFIAPI
*EFI_HII_DATABASE_NEW_PACK
)(
104 IN CONST EFI_HII_DATABASE_PROTOCOL
*This
,
105 IN CONST EFI_HII_PACKAGE_LIST_HEADER
*PackageList
,
106 IN EFI_HANDLE DriverHandle
,
107 OUT EFI_HII_HANDLE
*Handle
113 This function removes the package list that is associated with a
114 handle Handle from the HII database. Before removing the
115 package, any registered functions with the notification type
116 REMOVE_PACK and the same package type will be called. For each
117 call to EFI_HII_DATABASE_PROTOCOL.NewPackageList(), there should
118 be a corresponding call to RemovePackageList.
120 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
122 @param Handle The handle that was registered to the data
123 that is requested for removal.
125 @retval EFI_SUCCESS The data associated with the Handle was
126 removed from the HII database.
127 @retval EFI_NOT_FOUND The specified Handle is not in database.
132 (EFIAPI
*EFI_HII_DATABASE_REMOVE_PACK
)(
133 IN CONST EFI_HII_DATABASE_PROTOCOL
*This
,
134 IN EFI_HII_HANDLE Handle
140 This function updates the existing package list (which has the
141 specified Handle) in the HII databases, using the new package
142 list specified by PackageList. The update process has the
143 following steps: Collect all the package types in the package
144 list specified by PackageList. A package type consists of the
145 Type field of EFI_HII_PACKAGE_HEADER and, if the Type is
146 EFI_HII_PACKAGE_TYPE_GUID, the Guid field, as defined in
147 EFI_HII_PACKAGE_GUID_HEADER. Iterate through the packages within
148 the existing package list in the HII database specified by
149 Handle. If a package??s type matches one of the types collected
150 in step 1, then perform the following steps:
151 - Call any functions registered with the notification type
153 - Remove the package from the package list and the HII
155 Add all of the packages within the new package list specified
156 by PackageList, using the following steps:
157 - Add the package to the package list and the HII database.
158 - Call any functions registered with the notification type
161 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
163 @param Handle The handle that was registered to the data
164 that is requested for removal.
166 @param PackageList A pointer to an EFI_HII_PACKAGE_LIST
169 @retval EFI_SUCCESS The HII database was successfully updated.
171 @retval EFI_OUT_OF_RESOURCES Unable to allocate enough memory
172 for the updated database.
174 @retval EFI_INVALID_PARAMETER PackageList was NULL.
175 @retval EFI_NOT_FOUND The specified Handle is not in database.
180 (EFIAPI
*EFI_HII_DATABASE_UPDATE_PACK
)(
181 IN CONST EFI_HII_DATABASE_PROTOCOL
*This
,
182 IN EFI_HII_HANDLE Handle
,
183 IN CONST EFI_HII_PACKAGE_LIST_HEADER
*PackageList
189 This function returns a list of the package handles of the
190 specified type that are currently active in the database. The
191 pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package
192 handles to be listed.
194 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
196 @param PackageType Specifies the package type of the packages
197 to list or EFI_HII_PACKAGE_TYPE_ALL for
198 all packages to be listed.
200 @param PackageGuid If PackageType is
201 EFI_HII_PACKAGE_TYPE_GUID, then this is
202 the pointer to the GUID which must match
204 EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it
207 @param HandleBufferLength On input, a pointer to the length
208 of the handle buffer. On output,
209 the length of the handle buffer
210 that is required for the handles found.
212 @param Handle An array of EFI_HII_HANDLE instances returned.
214 @retval EFI_SUCCESS The matching handles are outputed successfully.
215 HandleBufferLength is updated with the actual length.
216 @retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter
217 indicates that Handle is too
218 small to support the number of
219 handles. HandleBufferLength is
220 updated with a value that will
221 enable the data to fit.
222 @retval EFI_NOT_FOUND No matching handle could not be found in database.
223 @retval EFI_INVALID_PARAMETER Handle or HandleBufferLength was NULL.
224 @retval EFI_INVALID_PARAMETER PackageType is not a EFI_HII_PACKAGE_TYPE_GUID but
225 PackageGuid is not NULL, PackageType is a EFI_HII_
226 PACKAGE_TYPE_GUID but PackageGuid is NULL.
230 (EFIAPI
*EFI_HII_DATABASE_LIST_PACKS
)(
231 IN CONST EFI_HII_DATABASE_PROTOCOL
*This
,
232 IN UINT8 PackageType
,
233 IN CONST EFI_GUID
*PackageGuid
,
234 IN OUT UINTN
*HandleBufferLength
,
235 OUT EFI_HII_HANDLE
*Handle
240 This function will export one or all package lists in the
241 database to a buffer. For each package list exported, this
242 function will call functions registered with EXPORT_PACK and
243 then copy the package list to the buffer. The registered
244 functions may call EFI_HII_DATABASE_PROTOCOL.UpdatePackageList()
245 to modify the package list before it is copied to the buffer. If
246 the specified BufferSize is too small, then the status
247 EFI_OUT_OF_RESOURCES will be returned and the actual package
248 size will be returned in BufferSize.
250 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
253 @param Handle An EFI_HII_HANDLE that corresponds to the
254 desired package list in the HII database to
255 export or NULL to indicate all package lists
258 @param BufferSize On input, a pointer to the length of the
259 buffer. On output, the length of the
260 buffer that is required for the exported
263 @param Buffer A pointer to a buffer that will contain the
264 results of the export function.
267 @retval EFI_SUCCESS Package exported.
269 @retval EFI_OUT_OF_RESOURCES BufferSize is too small to hold the package.
274 (EFIAPI
*EFI_HII_DATABASE_EXPORT_PACKS
)(
275 IN CONST EFI_HII_DATABASE_PROTOCOL
*This
,
276 IN EFI_HII_HANDLE Handle
,
277 IN OUT UINTN
*BufferSize
,
278 OUT EFI_HII_PACKAGE_LIST_HEADER
*Buffer
285 This function registers a function which will be called when
286 specified actions related to packages of the specified type
287 occur in the HII database. By registering a function, other
288 HII-related drivers are notified when specific package types
289 are added, removed or updated in the HII database. Each driver
290 or application which registers a notification should use
291 EFI_HII_DATABASE_PROTOCOL.UnregisterPackageNotify() before
295 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
297 @param PackageType The package type. See
298 EFI_HII_PACKAGE_TYPE_x in EFI_HII_PACKAGE_HEADER.
300 @param PackageGuid If PackageType is
301 EFI_HII_PACKAGE_TYPE_GUID, then this is
302 the pointer to the GUID which must match
304 EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it
307 @param PackageNotifyFn Points to the function to be called
308 when the event specified by
309 NotificationType occurs. See
310 EFI_HII_DATABASE_NOTIFY.
312 @param NotifyType Describes the types of notification which
313 this function will be receiving. See
314 EFI_HII_DATABASE_NOTIFY_TYPE for more a
317 @param NotifyHandle Points to the unique handle assigned to
318 the registered notification. Can be used
319 in EFI_HII_DATABASE_PROTOCOL.UnregisterPack
320 to stop notifications.
323 @retval EFI_SUCCESS Notification registered successfully.
325 @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary
328 @retval EFI_INVALID_PARAMETER PackageGuid is not NULL when
330 EFI_HII_PACKAGE_TYPE_GUID.
335 (EFIAPI
*EFI_HII_DATABASE_REGISTER_NOTIFY
)(
336 IN CONST EFI_HII_DATABASE_PROTOCOL
*This
,
337 IN UINT8 PackageType
,
338 IN CONST EFI_GUID
*PackageGuid
,
339 IN EFI_HII_DATABASE_NOTIFY PackageNotifyFn
,
340 IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType
,
341 OUT EFI_HANDLE
*NotifyHandle
347 Removes the specified HII database package-related notification.
349 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
351 @param NotificationHandle The handle of the notification
352 function being unregistered.
354 @retval EFI_SUCCESS Unregister the notification Successsfully
356 @retval EFI_NOT_FOUND The incoming notification handle does not exist
357 in current hii database.
362 (EFIAPI
*EFI_HII_DATABASE_UNREGISTER_NOTIFY
)(
363 IN CONST EFI_HII_DATABASE_PROTOCOL
*This
,
364 IN EFI_HANDLE NotificationHandle
370 This routine retrieves an array of GUID values for each keyboard
371 layout that was previously registered in the system.
373 @param This A pointer to the EFI_HII_PROTOCOL instance.
375 @param KeyGuidBufferLength On input, a pointer to the length
376 of the keyboard GUID buffer. On
377 output, the length of the handle
378 buffer that is required for the
381 @param KeyGuidBuffer An array of keyboard layout GUID
384 @retval EFI_SUCCESS KeyGuidBuffer was updated successfully.
386 @retval EFI_BUFFER_TOO_SMALL The KeyGuidBufferLength
387 parameter indicates that
388 KeyGuidBuffer is too small to
389 support the number of GUIDs.
390 KeyGuidBufferLength is updated
391 with a value that will enable
397 (EFIAPI
*EFI_HII_FIND_KEYBOARD_LAYOUTS
)(
398 IN CONST EFI_HII_DATABASE_PROTOCOL
*This
,
399 IN OUT UINT16
*KeyGuidBufferLength
,
400 OUT EFI_GUID
*KeyGuidBuffer
406 This routine retrieves the requested keyboard layout. The layout
407 is a physical description of the keys on a keyboard and the
408 character(s) that are associated with a particular set of key
411 @param This A pointer to the EFI_HII_PROTOCOL instance.
413 @param KeyGuid A pointer to the unique ID associated with a
414 given keyboard layout. If KeyGuid is NULL then
415 the current layout will be retrieved.
417 @param KeyboardLayoutLength On input, a pointer to the length of the
418 KeyboardLayout buffer. On output, the length of
419 the data placed into KeyboardLayout.
421 @param KeyboardLayout A pointer to a buffer containing the
422 retrieved keyboard layout.
424 @retval EFI_SUCCESS The keyboard layout was retrieved
427 @retval EFI_NOT_FOUND The requested keyboard layout was not found.
432 (EFIAPI
*EFI_HII_GET_KEYBOARD_LAYOUT
)(
433 IN CONST EFI_HII_DATABASE_PROTOCOL
*This
,
434 IN CONST EFI_GUID
*KeyGuid
,
435 IN OUT UINT16
*KeyboardLayoutLength
,
436 OUT EFI_HII_KEYBOARD_LAYOUT
*KeyboardLayout
441 This routine sets the default keyboard layout to the one
442 referenced by KeyGuid. When this routine is called, an event
443 will be signaled of the EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID
444 group type. This is so that agents which are sensitive to the
445 current keyboard layout being changed can be notified of this
448 @param This A pointer to the EFI_HII_PROTOCOL instance.
450 @param KeyGuid A pointer to the unique ID associated with a
451 given keyboard layout.
453 @retval EFI_SUCCESS The current keyboard layout was successfully set.
455 @retval EFI_NOT_FOUND The referenced keyboard layout was not
456 found, so action was taken.
461 (EFIAPI
*EFI_HII_SET_KEYBOARD_LAYOUT
)(
462 IN CONST EFI_HII_DATABASE_PROTOCOL
*This
,
463 IN CONST EFI_GUID
*KeyGuid
468 Return the EFI handle associated with a package list.
470 @param This A pointer to the EFI_HII_PROTOCOL instance.
472 @param PackageListHandle An EFI_HII_HANDLE that corresponds
473 to the desired package list in the
476 @param DriverHandle On return, contains the EFI_HANDLE which
477 was registered with the package list in
480 @retval EFI_SUCCESS The DriverHandle was returned successfully.
482 @retval EFI_INVALID_PARAMETER The PackageListHandle was not valid.
487 (EFIAPI
*EFI_HII_DATABASE_GET_PACK_HANDLE
)(
488 IN CONST EFI_HII_DATABASE_PROTOCOL
*This
,
489 IN EFI_HII_HANDLE PackageListHandle
,
490 OUT EFI_HANDLE
*DriverHandle
494 @par Protocol Description:
495 Database manager for HII-related data structures.
497 @param NewPackageList Add a new package list to the HII database.
499 @param RemovePackageList Remove a package list from the HII
502 @param UpdatePackageList Update a package list in the HII
505 @param ListPackageLists List the handles of the package
506 lists within the HII database.
508 @param ExportPackageLists Export package lists from the HII
511 @param RegisterPackageNotify
512 Register notification when
513 packages of a certain type are
516 @param UnregisterPackageNotify
517 Unregister notification of packages.
519 @param FindKeyboardLayouts
520 Retrieves a list of the keyboard
521 layouts in the system.
523 @param GetKeyboardLayout Allows a program to extract the
524 current keyboard layout. See the
525 GetKeyboardLayout() function
528 @param SetKeyboardLayout Changes the current keyboard layout.
529 See the SetKeyboardLayout() function
533 struct _EFI_HII_DATABASE_PROTOCOL
{
534 EFI_HII_DATABASE_NEW_PACK NewPackageList
;
535 EFI_HII_DATABASE_REMOVE_PACK RemovePackageList
;
536 EFI_HII_DATABASE_UPDATE_PACK UpdatePackageList
;
537 EFI_HII_DATABASE_LIST_PACKS ListPackageLists
;
538 EFI_HII_DATABASE_EXPORT_PACKS ExportPackageLists
;
539 EFI_HII_DATABASE_REGISTER_NOTIFY RegisterPackageNotify
;
540 EFI_HII_DATABASE_UNREGISTER_NOTIFY UnregisterPackageNotify
;
541 EFI_HII_FIND_KEYBOARD_LAYOUTS FindKeyboardLayouts
;
542 EFI_HII_GET_KEYBOARD_LAYOUT GetKeyboardLayout
;
543 EFI_HII_SET_KEYBOARD_LAYOUT SetKeyboardLayout
;
544 EFI_HII_DATABASE_GET_PACK_HANDLE GetPackageListHandle
;
547 extern EFI_GUID gEfiHiiDatabaseProtocolGuid
;