Path: blob/main/sys/contrib/edk2/Include/Protocol/HiiDatabase.h
96339 views
/** @file1The file provides Database manager for HII-related data2structures.34Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>5SPDX-License-Identifier: BSD-2-Clause-Patent67@par Revision Reference:8This Protocol was introduced in UEFI Specification 2.1.910**/1112#ifndef __HII_DATABASE_H__13#define __HII_DATABASE_H__1415#define EFI_HII_DATABASE_PROTOCOL_GUID \16{ 0xef9fc172, 0xa1b2, 0x4693, { 0xb3, 0x27, 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42 } }1718typedef struct _EFI_HII_DATABASE_PROTOCOL EFI_HII_DATABASE_PROTOCOL;1920///21/// EFI_HII_DATABASE_NOTIFY_TYPE.22///23typedef UINTN EFI_HII_DATABASE_NOTIFY_TYPE;2425#define EFI_HII_DATABASE_NOTIFY_NEW_PACK 0x0000000126#define EFI_HII_DATABASE_NOTIFY_REMOVE_PACK 0x0000000227#define EFI_HII_DATABASE_NOTIFY_EXPORT_PACK 0x0000000428#define EFI_HII_DATABASE_NOTIFY_ADD_PACK 0x000000082930/**3132Functions which are registered to receive notification of33database events have this prototype. The actual event is encoded34in NotifyType. The following table describes how PackageType,35PackageGuid, Handle, and Package are used for each of the36notification types.3738@param PackageType Package type of the notification.3940@param PackageGuid If PackageType is41EFI_HII_PACKAGE_TYPE_GUID, then this is42the pointer to the GUID from the Guid43field of EFI_HII_PACKAGE_GUID_HEADER.44Otherwise, it must be NULL.4546@param Package Points to the package referred to by the notification.4748@param Handle The handle of the package49list which contains the specified package.5051@param NotifyType The type of change concerning the52database. See53EFI_HII_DATABASE_NOTIFY_TYPE.5455**/56typedef57EFI_STATUS58(EFIAPI *EFI_HII_DATABASE_NOTIFY)(59IN UINT8 PackageType,60IN CONST EFI_GUID *PackageGuid,61IN CONST EFI_HII_PACKAGE_HEADER *Package,62IN EFI_HII_HANDLE Handle,63IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType64);6566/**6768This function adds the packages in the package list to the69database and returns a handle. If there is a70EFI_DEVICE_PATH_PROTOCOL associated with the DriverHandle, then71this function will create a package of type72EFI_PACKAGE_TYPE_DEVICE_PATH and add it to the package list. For73each package in the package list, registered functions with the74notification type NEW_PACK and having the same package type will75be called. For each call to NewPackageList(), there should be a76corresponding call to77EFI_HII_DATABASE_PROTOCOL.RemovePackageList().7879@param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.8081@param PackageList A pointer to an EFI_HII_PACKAGE_LIST_HEADER structure.8283@param DriverHandle Associate the package list with this EFI handle.84If a NULL is specified, this data will not be associate85with any drivers and cannot have a callback induced.8687@param Handle A pointer to the EFI_HII_HANDLE instance.8889@retval EFI_SUCCESS The package list associated with the90Handle was added to the HII database.9192@retval EFI_OUT_OF_RESOURCES Unable to allocate necessary93resources for the new database94contents.9596@retval EFI_INVALID_PARAMETER PackageList is NULL, or Handle is NULL.9798**/99typedef100EFI_STATUS101(EFIAPI *EFI_HII_DATABASE_NEW_PACK)(102IN CONST EFI_HII_DATABASE_PROTOCOL *This,103IN CONST EFI_HII_PACKAGE_LIST_HEADER *PackageList,104IN EFI_HANDLE DriverHandle OPTIONAL,105OUT EFI_HII_HANDLE *Handle106);107108/**109110This function removes the package list that is associated with a111handle Handle from the HII database. Before removing the112package, any registered functions with the notification type113REMOVE_PACK and the same package type will be called. For each114call to EFI_HII_DATABASE_PROTOCOL.NewPackageList(), there should115be a corresponding call to RemovePackageList.116117@param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.118119@param Handle The handle that was registered to the data120that is requested for removal.121122@retval EFI_SUCCESS The data associated with the Handle was123removed from the HII database.124@retval EFI_NOT_FOUND The specified Handle is not in database.125126**/127typedef128EFI_STATUS129(EFIAPI *EFI_HII_DATABASE_REMOVE_PACK)(130IN CONST EFI_HII_DATABASE_PROTOCOL *This,131IN EFI_HII_HANDLE Handle132);133134/**135136This function updates the existing package list (which has the137specified Handle) in the HII databases, using the new package138list specified by PackageList. The update process has the139following steps: Collect all the package types in the package140list specified by PackageList. A package type consists of the141Type field of EFI_HII_PACKAGE_HEADER and, if the Type is142EFI_HII_PACKAGE_TYPE_GUID, the Guid field, as defined in143EFI_HII_PACKAGE_GUID_HEADER. Iterate through the packages within144the existing package list in the HII database specified by145Handle. If a package's type matches one of the collected types collected146in step 1, then perform the following steps:147- Call any functions registered with the notification type148REMOVE_PACK.149- Remove the package from the package list and the HII150database.151Add all of the packages within the new package list specified152by PackageList, using the following steps:153- Add the package to the package list and the HII database.154- Call any functions registered with the notification type155ADD_PACK.156157@param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.158159@param Handle The handle that was registered to the data160that is requested for removal.161162@param PackageList A pointer to an EFI_HII_PACKAGE_LIST163package.164165@retval EFI_SUCCESS The HII database was successfully updated.166167@retval EFI_OUT_OF_RESOURCES Unable to allocate enough memory168for the updated database.169170@retval EFI_INVALID_PARAMETER PackageList was NULL.171@retval EFI_NOT_FOUND The specified Handle is not in database.172173**/174typedef175EFI_STATUS176(EFIAPI *EFI_HII_DATABASE_UPDATE_PACK)(177IN CONST EFI_HII_DATABASE_PROTOCOL *This,178IN EFI_HII_HANDLE Handle,179IN CONST EFI_HII_PACKAGE_LIST_HEADER *PackageList180);181182/**183184This function returns a list of the package handles of the185specified type that are currently active in the database. The186pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package187handles to be listed.188189@param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.190191@param PackageType Specifies the package type of the packages192to list or EFI_HII_PACKAGE_TYPE_ALL for193all packages to be listed.194195@param PackageGuid If PackageType is196EFI_HII_PACKAGE_TYPE_GUID, then this is197the pointer to the GUID which must match198the Guid field of199EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it200must be NULL.201202@param HandleBufferLength On input, a pointer to the length203of the handle buffer. On output,204the length of the handle buffer205that is required for the handles found.206207@param Handle An array of EFI_HII_HANDLE instances returned.208209@retval EFI_SUCCESS The matching handles are outputted successfully.210HandleBufferLength is updated with the actual length.211@retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter212indicates that Handle is too213small to support the number of214handles. HandleBufferLength is215updated with a value that will216enable the data to fit.217@retval EFI_NOT_FOUND No matching handle could be found in database.218@retval EFI_INVALID_PARAMETER HandleBufferLength was NULL.219@retval EFI_INVALID_PARAMETER The value referenced by HandleBufferLength was not220zero and Handle was NULL.221@retval EFI_INVALID_PARAMETER PackageType is not a EFI_HII_PACKAGE_TYPE_GUID but222PackageGuid is not NULL, PackageType is a EFI_HII_223PACKAGE_TYPE_GUID but PackageGuid is NULL.224**/225typedef226EFI_STATUS227(EFIAPI *EFI_HII_DATABASE_LIST_PACKS)(228IN CONST EFI_HII_DATABASE_PROTOCOL *This,229IN UINT8 PackageType,230IN CONST EFI_GUID *PackageGuid,231IN OUT UINTN *HandleBufferLength,232OUT EFI_HII_HANDLE *Handle233);234235/**236237This function will export one or all package lists in the238database to a buffer. For each package list exported, this239function will call functions registered with EXPORT_PACK and240then copy the package list to the buffer. The registered241functions may call EFI_HII_DATABASE_PROTOCOL.UpdatePackageList()242to modify the package list before it is copied to the buffer. If243the specified BufferSize is too small, then the status244EFI_OUT_OF_RESOURCES will be returned and the actual package245size will be returned in BufferSize.246247@param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.248249250@param Handle An EFI_HII_HANDLE that corresponds to the251desired package list in the HII database to252export or NULL to indicate all package lists253should be exported.254255@param BufferSize On input, a pointer to the length of the256buffer. On output, the length of the257buffer that is required for the exported258data.259260@param Buffer A pointer to a buffer that will contain the261results of the export function.262263264@retval EFI_SUCCESS Package exported.265266@retval EFI_OUT_OF_RESOURCES BufferSize is too small to hold the package.267268@retval EFI_NOT_FOUND The specified Handle could not be found in the269current database.270271@retval EFI_INVALID_PARAMETER BufferSize was NULL.272273@retval EFI_INVALID_PARAMETER The value referenced by BufferSize was not zero274and Buffer was NULL.275**/276typedef277EFI_STATUS278(EFIAPI *EFI_HII_DATABASE_EXPORT_PACKS)(279IN CONST EFI_HII_DATABASE_PROTOCOL *This,280IN EFI_HII_HANDLE Handle,281IN OUT UINTN *BufferSize,282OUT EFI_HII_PACKAGE_LIST_HEADER *Buffer283);284285/**286287288This function registers a function which will be called when289specified actions related to packages of the specified type290occur in the HII database. By registering a function, other291HII-related drivers are notified when specific package types292are added, removed or updated in the HII database. Each driver293or application which registers a notification should use294EFI_HII_DATABASE_PROTOCOL.UnregisterPackageNotify() before295exiting.296297298@param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.299300@param PackageType The package type. See301EFI_HII_PACKAGE_TYPE_x in EFI_HII_PACKAGE_HEADER.302303@param PackageGuid If PackageType is304EFI_HII_PACKAGE_TYPE_GUID, then this is305the pointer to the GUID which must match306the Guid field of307EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it308must be NULL.309310@param PackageNotifyFn Points to the function to be called311when the event specified by312NotificationType occurs. See313EFI_HII_DATABASE_NOTIFY.314315@param NotifyType Describes the types of notification which316this function will be receiving. See317EFI_HII_DATABASE_NOTIFY_TYPE for a318list of types.319320@param NotifyHandle Points to the unique handle assigned to321the registered notification. Can be used322in EFI_HII_DATABASE_PROTOCOL.UnregisterPack323to stop notifications.324325326@retval EFI_SUCCESS Notification registered successfully.327328@retval EFI_OUT_OF_RESOURCES Unable to allocate necessary329data structures.330331@retval EFI_INVALID_PARAMETER PackageGuid is not NULL when332PackageType is not333EFI_HII_PACKAGE_TYPE_GUID.334335**/336typedef337EFI_STATUS338(EFIAPI *EFI_HII_DATABASE_REGISTER_NOTIFY)(339IN CONST EFI_HII_DATABASE_PROTOCOL *This,340IN UINT8 PackageType,341IN CONST EFI_GUID *PackageGuid,342IN EFI_HII_DATABASE_NOTIFY PackageNotifyFn,343IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType,344OUT EFI_HANDLE *NotifyHandle345);346347/**348349Removes the specified HII database package-related notification.350351@param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.352353@param NotificationHandle The handle of the notification354function being unregistered.355356@retval EFI_SUCCESS Successsfully unregistered the notification.357358@retval EFI_NOT_FOUND The incoming notification handle does not exist359in the current hii database.360361**/362typedef363EFI_STATUS364(EFIAPI *EFI_HII_DATABASE_UNREGISTER_NOTIFY)(365IN CONST EFI_HII_DATABASE_PROTOCOL *This,366IN EFI_HANDLE NotificationHandle367);368369/**370371This routine retrieves an array of GUID values for each keyboard372layout that was previously registered in the system.373374@param This A pointer to the EFI_HII_PROTOCOL instance.375376@param KeyGuidBufferLength On input, a pointer to the length377of the keyboard GUID buffer. On378output, the length of the handle379buffer that is required for the380handles found.381382@param KeyGuidBuffer An array of keyboard layout GUID383instances returned.384385@retval EFI_SUCCESS KeyGuidBuffer was updated successfully.386387@retval EFI_BUFFER_TOO_SMALL The KeyGuidBufferLength388parameter indicates that389KeyGuidBuffer is too small to390support the number of GUIDs.391KeyGuidBufferLength is updated392with a value that will enable393the data to fit.394@retval EFI_INVALID_PARAMETER The KeyGuidBufferLength is NULL.395@retval EFI_INVALID_PARAMETER The value referenced by396KeyGuidBufferLength is not397zero and KeyGuidBuffer is NULL.398@retval EFI_NOT_FOUND There was no keyboard layout.399400**/401typedef402EFI_STATUS403(EFIAPI *EFI_HII_FIND_KEYBOARD_LAYOUTS)(404IN CONST EFI_HII_DATABASE_PROTOCOL *This,405IN OUT UINT16 *KeyGuidBufferLength,406OUT EFI_GUID *KeyGuidBuffer407);408409/**410411This routine retrieves the requested keyboard layout. The layout412is a physical description of the keys on a keyboard, and the413character(s) that are associated with a particular set of key414strokes.415416@param This A pointer to the EFI_HII_PROTOCOL instance.417418@param KeyGuid A pointer to the unique ID associated with a419given keyboard layout. If KeyGuid is NULL then420the current layout will be retrieved.421422@param KeyboardLayoutLength On input, a pointer to the length of the423KeyboardLayout buffer. On output, the length of424the data placed into KeyboardLayout.425426@param KeyboardLayout A pointer to a buffer containing the427retrieved keyboard layout.428429@retval EFI_SUCCESS The keyboard layout was retrieved430successfully.431432@retval EFI_NOT_FOUND The requested keyboard layout was not found.433434**/435typedef436EFI_STATUS437(EFIAPI *EFI_HII_GET_KEYBOARD_LAYOUT)(438IN CONST EFI_HII_DATABASE_PROTOCOL *This,439IN CONST EFI_GUID *KeyGuid,440IN OUT UINT16 *KeyboardLayoutLength,441OUT EFI_HII_KEYBOARD_LAYOUT *KeyboardLayout442);443444/**445446This routine sets the default keyboard layout to the one447referenced by KeyGuid. When this routine is called, an event448will be signaled of the EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID449group type. This is so that agents which are sensitive to the450current keyboard layout being changed can be notified of this451change.452453@param This A pointer to the EFI_HII_PROTOCOL instance.454455@param KeyGuid A pointer to the unique ID associated with a456given keyboard layout.457458@retval EFI_SUCCESS The current keyboard layout was successfully set.459460@retval EFI_NOT_FOUND The referenced keyboard layout was not461found, so action was taken.462463**/464typedef465EFI_STATUS466(EFIAPI *EFI_HII_SET_KEYBOARD_LAYOUT)(467IN CONST EFI_HII_DATABASE_PROTOCOL *This,468IN CONST EFI_GUID *KeyGuid469);470471/**472473Return the EFI handle associated with a package list.474475@param This A pointer to the EFI_HII_PROTOCOL instance.476477@param PackageListHandle An EFI_HII_HANDLE that corresponds478to the desired package list in the479HIIdatabase.480481@param DriverHandle On return, contains the EFI_HANDLE which482was registered with the package list in483NewPackageList().484485@retval EFI_SUCCESS The DriverHandle was returned successfully.486487@retval EFI_INVALID_PARAMETER The PackageListHandle was not valid.488489**/490typedef491EFI_STATUS492(EFIAPI *EFI_HII_DATABASE_GET_PACK_HANDLE)(493IN CONST EFI_HII_DATABASE_PROTOCOL *This,494IN EFI_HII_HANDLE PackageListHandle,495OUT EFI_HANDLE *DriverHandle496);497498///499/// Database manager for HII-related data structures.500///501struct _EFI_HII_DATABASE_PROTOCOL {502EFI_HII_DATABASE_NEW_PACK NewPackageList;503EFI_HII_DATABASE_REMOVE_PACK RemovePackageList;504EFI_HII_DATABASE_UPDATE_PACK UpdatePackageList;505EFI_HII_DATABASE_LIST_PACKS ListPackageLists;506EFI_HII_DATABASE_EXPORT_PACKS ExportPackageLists;507EFI_HII_DATABASE_REGISTER_NOTIFY RegisterPackageNotify;508EFI_HII_DATABASE_UNREGISTER_NOTIFY UnregisterPackageNotify;509EFI_HII_FIND_KEYBOARD_LAYOUTS FindKeyboardLayouts;510EFI_HII_GET_KEYBOARD_LAYOUT GetKeyboardLayout;511EFI_HII_SET_KEYBOARD_LAYOUT SetKeyboardLayout;512EFI_HII_DATABASE_GET_PACK_HANDLE GetPackageListHandle;513};514515extern EFI_GUID gEfiHiiDatabaseProtocolGuid;516517#endif518519520