summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2008-11-13 08:41:24 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2008-11-13 08:41:24 +0000
commit4c76e9cc9a0f8b49f1779d345941ce168fbaf562 (patch)
treebf394e08f64a328d535c7085530d9f5fc6f6b529
parentc5550186706169f66e7af86abbee5e3ff06ed7eb (diff)
downloadedk2-platforms-4c76e9cc9a0f8b49f1779d345941ce168fbaf562.tar.xz
Add FvbServiceLib, HiiLib & IfrSupportLib.h
They originate from MdePkg. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6502 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Include/Library/FvbServiceLib.h311
-rw-r--r--MdeModulePkg/Include/Library/HiiLib.h500
-rw-r--r--MdeModulePkg/Include/Library/IfrSupportLib.h765
3 files changed, 1576 insertions, 0 deletions
diff --git a/MdeModulePkg/Include/Library/FvbServiceLib.h b/MdeModulePkg/Include/Library/FvbServiceLib.h
new file mode 100644
index 0000000000..a87750a7b4
--- /dev/null
+++ b/MdeModulePkg/Include/Library/FvbServiceLib.h
@@ -0,0 +1,311 @@
+/** @file
+ Firmeware Volume BLock Service Library
+
+ Copyright (c) 2006 - 2007, Intel Corporation.<BR>
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __FVB_SERVICE_LIB_H__
+#define __FVB_SERVICE_LIB_H__
+
+/**
+ Reads specified number of bytes into a buffer from the specified block.
+
+ The EfiFvbReadBlock() function reads the requested number of bytes from
+ the requested block in the specified firmware volume and stores them in
+ the provided buffer. Implementations should be mindful that the firmware
+ volume might be in the ReadDisabled state. If it is in this state, the
+ EfiFvbReadBlock() function must return the status code EFI_ACCESS_DENIED
+ without modifying the contents of the buffer.
+
+ The EfiFvbReadBlock() function must also prevent spanning block boundaries.
+ If a read is requested that would span a block boundary, the read must read
+ up to the boundary but not beyond. The output parameter NumBytes must be
+ set to correctly indicate the number of bytes actually read.
+ The caller must be aware that a read may be partially completed.
+
+ If NumBytes is NULL, then ASSERT().
+
+ If Buffer is NULL, then ASSERT().
+
+ @param[in] Instance The FV instance to be read from.
+ @param[in] Lba The logical block address to be read from
+ @param[in] Offset The offset relative to the block, at which to begin reading.
+ @param[in, out] NumBytes Pointer to a UINTN. On input, *NumBytes contains the total
+ size of the buffer. On output, it contains the actual number
+ of bytes read.
+ @param[out] Buffer Pointer to a caller allocated buffer that will be
+ used to hold the data read.
+
+ @retval EFI_SUCCESS The firmware volume was read successfully and contents are in Buffer.
+ @retval EFI_BAD_BUFFER_SIZE Read attempted across an LBA boundary. On output, NumBytes contains
+ the total number of bytes returned in Buffer.
+ @retval EFI_ACCESS_DENIED The firmware volume is in the ReadDisabled state.
+ @retval EFI_DEVICE_ERROR The block device is not functioning correctly and could not be read.
+ @retval EFI_INVALID_PARAMETER Invalid parameter, Instance is larger than the max FVB number. Lba index
+ is larger than the last block of the firmware volume. Offset is larger
+ than the block size.
+
+**/
+EFI_STATUS
+EFIAPI
+EfiFvbReadBlock (
+ IN UINTN Instance,
+ IN EFI_LBA Lba,
+ IN UINTN Offset,
+ IN OUT UINTN *NumBytes,
+ OUT UINT8 *Buffer
+ );
+
+
+/**
+ Writes specified number of bytes from the input buffer to the block
+
+ The EfiFvbWriteBlock() function writes the specified number of bytes
+ from the provided buffer to the specified block and offset in the
+ requested firmware volume.
+
+ If the firmware volume is sticky write, the caller must ensure that
+ all the bits of the specified range to write are in the EFI_FVB_ERASE_POLARITY
+ state before calling the EfiFvbWriteBlock() function, or else the
+ result will be unpredictable. This unpredictability arises because,
+ for a sticky-write firmware volume, a write may negate a bit in the
+ EFI_FVB_ERASE_POLARITY state but it cannot flip it back again. In
+ general, before calling the EfiFvbWriteBlock() function, the caller
+ should call the EfiFvbEraseBlock() function first to erase the specified
+ block to write. A block erase cycle will transition bits from the
+ (NOT)EFI_FVB_ERASE_POLARITY state back to the EFI_FVB_ERASE_POLARITY state.
+ Implementations should be mindful that the firmware volume might be
+ in the WriteDisabled state. If it is in this state, the EfiFvbWriteBlock()
+ function must return the status code EFI_ACCESS_DENIED without modifying
+ the contents of the firmware volume.
+
+ The EfiFvbWriteBlock() function must also prevent spanning block boundaries.
+ If a write is requested that spans a block boundary, the write must store
+ up to the boundary but not beyond. The output parameter NumBytes must be
+ set to correctly indicate the number of bytes actually written. The caller
+ must be aware that a write may be partially completed.
+ All writes, partial or otherwise, must be fully flushed to the hardware
+ before the EfiFvbWriteBlock() function returns.
+
+ If NumBytes is NULL, then ASSERT().
+
+ @param Instance The FV instance to be written to
+ @param Lba The starting logical block index to write to
+ @param Offset The offset relative to the block, at which to begin writting.
+ @param NumBytes Pointer to a UINTN. On input, *NumBytes contains
+ the total size of the buffer. On output, it contains
+ the actual number of bytes written.
+ @param Buffer Pointer to a caller allocated buffer that contains
+ the source for the write
+
+ @retval EFI_SUCCESS The firmware volume was written successfully.
+ @retval EFI_BAD_BUFFER_SIZE The write was attempted across an LBA boundary.
+ On output, NumBytes contains the total number of bytes actually written.
+ @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled state.
+ @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not be written.
+ @retval EFI_INVALID_PARAMETER Invalid parameter, Instance is larger than the max FVB number.
+ Lba index is larger than the last block of the firmware volume.
+ Offset is larger than the block size.
+**/
+EFI_STATUS
+EFIAPI
+EfiFvbWriteBlock (
+ IN UINTN Instance,
+ IN EFI_LBA Lba,
+ IN UINTN Offset,
+ IN OUT UINTN *NumBytes,
+ IN UINT8 *Buffer
+ );
+
+
+/**
+ Erases and initializes a firmware volume block.
+
+ The EfiFvbEraseBlock() function erases one block specified by Lba.
+ Implementations should be mindful that the firmware volume might
+ be in the WriteDisabled state. If it is in this state, the EfiFvbEraseBlock()
+ function must return the status code EFI_ACCESS_DENIED without
+ modifying the contents of the firmware volume. If Instance is
+ larger than the max FVB number, or Lba index is larger than the
+ last block of the firmware volume, this function return the status
+ code EFI_INVALID_PARAMETER.
+
+ All calls to EfiFvbEraseBlock() must be fully flushed to the
+ hardware before this function returns.
+
+ @param[in] Instance The FV instance to be erased.
+ @param[in] Lba The logical block index to be erased from.
+
+ @retval EFI_SUCCESS The erase request was successfully completed.
+ @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled state.
+ @retval EFI_DEVICE_ERROR The block device is not functioning correctly and
+ could not be written. The firmware device may
+ have been partially erased.
+ @retval EFI_INVALID_PARAMETER Invalid parameter. Instance is larger than the max
+ FVB number. Lba index is larger than the last block
+ of the firmware volume.
+
+**/
+EFI_STATUS
+EFIAPI
+EfiFvbEraseBlock (
+ IN UINTN Instance,
+ IN EFI_LBA Lba
+ );
+
+
+/**
+ Retrieves the attributes and current settings of the specified block,
+ returns resulting attributes in output parameter.
+
+ The EfiFvbGetAttributes() function retrieves the attributes and current
+ settings of the block specified by Instance. If Instance is larger than
+ the max FVB number, this function returns the status code EFI_INVALID_PARAMETER.
+
+ If Attributes is NULL, then ASSERT().
+
+ @param[in] Instance The FV instance to be operated.
+ @param[out] Attributes Pointer to EFI_FVB_ATTRIBUTES_2 in which the
+ attributes and current settings are returned.
+
+ @retval EFI_EFI_SUCCESS The firmware volume attributes were returned.
+ @retval EFI_INVALID_PARAMETER Invalid parameter. Instance is larger than the max FVB number.
+**/
+EFI_STATUS
+EFIAPI
+EfiFvbGetVolumeAttributes (
+ IN UINTN Instance,
+ OUT EFI_FVB_ATTRIBUTES_2 *Attributes
+ );
+
+
+/**
+ Modify the attributes and current settings of the specified block
+ according to the input parameter.
+
+ The EfiFvbSetAttributes() function sets configurable firmware volume
+ attributes and returns the new settings of the firmware volume specified
+ by Instance. If Instance is larger than the max FVB number, this function
+ returns the status code EFI_INVALID_PARAMETER.
+
+ If Attributes is NULL, then ASSERT().
+
+ @param[in] Instance The FV instance to be operated.
+ @param[in, out]Attributes On input, Attributes is a pointer to EFI_FVB_ATTRIBUTES_2
+ that contains the desired firmware volume settings.
+ On successful return, it contains the new settings of the firmware volume.
+
+ @retval EFI_EFI_SUCCESS The firmware volume attributes were modified successfully.
+ @retval EFI_INVALID_PARAMETER Invalid parameter. Instance is larger than the max FVB number.
+
+**/
+EFI_STATUS
+EFIAPI
+EfiFvbSetVolumeAttributes (
+ IN UINTN Instance,
+ IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes
+ );
+
+
+/**
+ Retrieves the physical address of the specified memory mapped FV.
+
+ Retrieve the base address of a memory-mapped firmware volume specified by Instance.
+ If Instance is larger than the max FVB number, this function returns the status
+ code EFI_INVALID_PARAMETER.
+
+ If BaseAddress is NULL, then ASSERT().
+
+ @param[in] Instance The FV instance to be operated.
+ @param[out] BaseAddress Pointer to a caller allocated EFI_PHYSICAL_ADDRESS
+ that on successful return, contains the base address
+ of the firmware volume.
+
+ @retval EFI_EFI_SUCCESS The firmware volume base address is returned.
+ @retval EFI_INVALID_PARAMETER Invalid parameter. Instance is larger than the max FVB number.
+
+**/
+EFI_STATUS
+EFIAPI
+EfiFvbGetPhysicalAddress (
+ IN UINTN Instance,
+ OUT EFI_PHYSICAL_ADDRESS *BaseAddress
+ );
+
+
+/**
+ Retrieve the block size of the specified fv.
+
+ The EfiFvbGetBlockSize() function retrieves the size of the requested block.
+ It also returns the number of additional blocks with the identical size.
+ If Instance is larger than the max FVB number, or Lba index is larger than
+ the last block of the firmware volume, this function return the status code
+ EFI_INVALID_PARAMETER.
+
+ If BlockSize is NULL, then ASSERT().
+
+ If NumOfBlocks is NULL, then ASSERT().
+
+ @param[in] Instance The FV instance to be operated.
+ @param[in] Lba Indicates which block to return the size for.
+ @param[out] BlockSize Pointer to a caller-allocated UINTN in which the
+ size of the block is returned.
+ @param[out] NumOfBlocks Pointer to a caller-allocated UINTN in which the
+ number of consecutive blocks, starting with Lba,
+ is returned. All blocks in this range have a size of BlockSize.
+
+ @retval EFI_EFI_SUCCESS The firmware volume base address is returned.
+ @retval EFI_INVALID_PARAMETER Invalid parameter. Instance is larger than the max FVB number.
+ Lba index is larger than the last block of the firmware volume.
+
+**/
+EFI_STATUS
+EFIAPI
+EfiFvbGetBlockSize (
+ IN UINTN Instance,
+ IN EFI_LBA Lba,
+ OUT UINTN *BlockSize,
+ OUT UINTN *NumOfBlocks
+ );
+
+
+/**
+ Erases and initializes a specified range of a firmware volume.
+
+ The EfiFvbEraseCustomBlockRange() function erases the specified range in the firmware
+ volume index by Instance. If Instance is larger than the max FVB number, StartLba or
+ LastLba index is larger than the last block of the firmware volume, StartLba > LastLba
+ or StartLba equal to LastLba but OffsetStartLba > OffsetLastLba, this function return
+ the status code EFI_INVALID_PARAMETER.
+
+ @param[in] Instance The FV instance to be operated.
+ @param[in] StartLba The starting logical block index to be erased.
+ @param[in] OffsetStartLba Offset into the starting block at which to
+ begin erasing.
+ @param[in] LastLba The last logical block index to be erased.
+ @param[in] OffsetLastLba Offset into the last block at which to end erasing.
+
+ @retval EFI_EFI_SUCCESS Successfully erase custom block range
+ @retval EFI_INVALID_PARAMETER Invalid parameter. Instance is larger than the max FVB number.
+ @retval EFI_UNSUPPORTED Firmware volume block device has no this capability.
+
+**/
+EFI_STATUS
+EFIAPI
+EfiFvbEraseCustomBlockRange (
+ IN UINTN Instance,
+ IN EFI_LBA StartLba,
+ IN UINTN OffsetStartLba,
+ IN EFI_LBA LastLba,
+ IN UINTN OffsetLastLba
+ );
+
+#endif
diff --git a/MdeModulePkg/Include/Library/HiiLib.h b/MdeModulePkg/Include/Library/HiiLib.h
new file mode 100644
index 0000000000..a92431ab4d
--- /dev/null
+++ b/MdeModulePkg/Include/Library/HiiLib.h
@@ -0,0 +1,500 @@
+/** @file
+ Public include file for the HII Library
+
+ Copyright (c) 2007 - 2008, Intel Corporation
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __HII_LIB_H__
+#define __HII_LIB_H__
+
+
+/**
+ Assemble EFI_HII_PACKAGE_LIST according to the passed in packages.
+
+ If GuidId is NULL, then ASSERT.
+ If not enough resource to complete the operation, then ASSERT.
+
+ @param NumberOfPackages Number of packages.
+ @param GuidId Package GUID.
+ @param ... Variable argument list for packages to be assembled.
+
+ @return Pointer of EFI_HII_PACKAGE_LIST_HEADER.
+
+**/
+EFI_HII_PACKAGE_LIST_HEADER *
+EFIAPI
+HiiLibPreparePackageList (
+ IN UINTN NumberOfPackages,
+ IN CONST EFI_GUID *GuidId,
+ ...
+ );
+
+/**
+ This function allocates pool for an EFI_HII_PACKAGE_LIST structure
+ with additional space that is big enough to host all packages described by the variable
+ argument list of package pointers. The allocated structure is initialized using NumberOfPackages,
+ GuidId, and the variable length argument list of package pointers.
+
+ Then, EFI_HII_PACKAGE_LIST will be register to the default System HII Database. The
+ Handle to the newly registered Package List is returned throught HiiHandle.
+
+ If HiiHandle is NULL, then ASSERT.
+
+ @param NumberOfPackages The number of HII packages to register.
+ @param GuidId Package List GUID ID.
+ @param DriverHandle Optional. If not NULL, the DriverHandle on which an instance of DEVICE_PATH_PROTOCOL is installed.
+ This DriverHandle uniquely defines the device that the added packages are associated with.
+ @param HiiHandle On output, the HiiHandle is update with the handle which can be used to retrieve the Package
+ List later. If the functions failed to add the package to the default HII database, this value will
+ be set to NULL.
+ @param ... The variable argument list describing all HII Package.
+
+ @return EFI_SUCCESS If the packages are successfully added to the default HII database.
+ @return EFI_OUT_OF_RESOURCE Not enough resource to complete the operation.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiLibAddPackages (
+ IN UINTN NumberOfPackages,
+ IN CONST EFI_GUID *GuidId,
+ IN EFI_HANDLE DriverHandle, OPTIONAL
+ OUT EFI_HII_HANDLE *HiiHandle,
+ ...
+ );
+
+/**
+ Removes a package list from the default HII database.
+
+ If HiiHandle is NULL, then ASSERT.
+ If HiiHandle is not a valid EFI_HII_HANDLE in the default HII database, then ASSERT.
+
+ @param HiiHandle The handle that was previously registered to the data base that is requested for removal.
+ List later.
+
+**/
+VOID
+EFIAPI
+HiiLibRemovePackages (
+ IN EFI_HII_HANDLE HiiHandle
+ );
+
+/**
+ This function adds the string into String Package of each language
+ supported by the package list.
+
+ If String is NULL, then ASSERT.
+ If StringId is NULL, the ASSERT.
+ If PackageList could not be found in the default HII database, then ASSERT.
+
+ @param PackageList Handle of the package list where this string will
+ be added.
+ @param StringId On return, contains the new strings id, which is
+ unique within PackageList.
+ @param String Points to the new null-terminated string.
+
+ @retval EFI_SUCCESS The new string was added successfully.
+ @retval EFI_OUT_OF_RESOURCES Could not add the string due to lack of resources.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiLibNewString (
+ IN EFI_HII_HANDLE PackageList,
+ OUT EFI_STRING_ID *StringId,
+ IN CONST EFI_STRING String
+ );
+
+/**
+ This function update the specified string in String Package of each language
+ supported by the package list.
+
+ If String is NULL, then ASSERT.
+ If PackageList could not be found in the default HII database, then ASSERT.
+ If StringId is not found in PackageList, then ASSERT.
+
+ @param PackageList Handle of the package list where this string will
+ be added.
+ @param StringId Ths String Id to be updated.
+ @param String Points to the new null-terminated string.
+
+ @retval EFI_SUCCESS The new string was added successfully.
+ @retval EFI_OUT_OF_RESOURCES Could not add the string due to lack of resources.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiLibSetString (
+ IN EFI_HII_HANDLE PackageList,
+ IN EFI_STRING_ID StringId,
+ IN CONST EFI_STRING String
+ );
+
+/**
+ This function try to retrieve string from String package of current language.
+ If fails, it try to retrieve string from String package of first language it support.
+
+ If StringSize is NULL, then ASSERT.
+ If String is NULL and *StringSize is not 0, then ASSERT.
+ If PackageList could not be found in the default HII database, then ASSERT.
+ If StringId is not found in PackageList, then ASSERT.
+
+ @param PackageList The package list in the HII database to search for
+ the specified string.
+ @param StringId The string's id, which is unique within
+ PackageList.
+ @param String Points to the new null-terminated string.
+ @param StringSize On entry, points to the size of the buffer pointed
+ to by String, in bytes. On return, points to the
+ length of the string, in bytes.
+
+ @retval EFI_SUCCESS The string was returned successfully.
+ @retval EFI_NOT_FOUND The string specified by StringId is not available.
+ @retval EFI_BUFFER_TOO_SMALL The buffer specified by StringLength is too small
+ to hold the string.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiLibGetString (
+ IN EFI_HII_HANDLE PackageList,
+ IN EFI_STRING_ID StringId,
+ OUT EFI_STRING String,
+ IN OUT UINTN *StringSize
+ );
+
+/**
+ Get string specified by StringId form the HiiHandle. The caller
+ is responsible to free the *String.
+
+ If String is NULL, then ASSERT.
+ If HiiHandle could not be found in the default HII database, then ASSERT.
+ If StringId is not found in PackageList, then ASSERT.
+
+ @param HiiHandle The HII handle of package list.
+ @param StringId The String ID.
+ @param String The output string.
+
+ @retval EFI_NOT_FOUND String is not found.
+ @retval EFI_SUCCESS Operation is successful.
+ @retval EFI_OUT_OF_RESOURCES There is not enought memory in the system.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiLibGetStringFromHandle (
+ IN EFI_HII_HANDLE HiiHandle,
+ IN EFI_STRING_ID StringId,
+ OUT EFI_STRING *String
+ );
+
+/**
+ Get the string given the StringId and String package Producer's Guid. The caller
+ is responsible to free the *String.
+
+ If PackageList with the matching ProducerGuid is not found, then ASSERT.
+ If PackageList with the matching ProducerGuid is found but no String is
+ specified by StringId is found, then ASSERT.
+
+ @param ProducerGuid The Guid of String package list.
+ @param StringId The String ID.
+ @param String The output string.
+
+ @retval EFI_SUCCESS Operation is successful.
+ @retval EFI_OUT_OF_RESOURCES There is not enought memory in the system.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiLibGetStringFromToken (
+ IN EFI_GUID *ProducerGuid,
+ IN EFI_STRING_ID StringId,
+ OUT EFI_STRING *String
+ );
+
+/**
+ Determines the handles that are currently active in the database.
+ It's the caller's responsibility to free handle buffer.
+
+ If HandleBufferLength is NULL, then ASSERT.
+ If HiiHandleBuffer is NULL, then ASSERT.
+
+ @param HandleBufferLength On input, a pointer to the length of the handle
+ buffer. On output, the length of the handle buffer
+ that is required for the handles found.
+ @param HiiHandleBuffer Pointer to an array of Hii Handles returned.
+
+ @retval EFI_SUCCESS Get an array of Hii Handles successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiLibGetHiiHandles (
+ IN OUT UINTN *HandleBufferLength,
+ OUT EFI_HII_HANDLE **HiiHandleBuffer
+ );
+
+/**
+ Extract Hii package list GUID for given HII handle.
+
+ If HiiHandle could not be found in the default HII database, then ASSERT.
+ If Guid is NULL, then ASSERT.
+
+ @param Handle Hii handle
+ @param Guid Package list GUID
+
+ @retval EFI_SUCCESS Successfully extract GUID from Hii database.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiLibExtractGuidFromHiiHandle (
+ IN EFI_HII_HANDLE Handle,
+ OUT EFI_GUID *Guid
+ );
+
+/**
+ Find HII Handle in the default HII database associated with given Device Path.
+
+ If DevicePath is NULL, then ASSERT.
+
+ @param DevicePath Device Path associated with the HII package list
+ handle.
+
+ @retval Handle HII package list Handle associated with the Device
+ Path.
+ @retval NULL Hii Package list handle is not found.
+
+**/
+EFI_HII_HANDLE
+EFIAPI
+HiiLibDevicePathToHiiHandle (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ );
+
+
+/**
+ Get next language from language code list (with separator ';').
+
+ If LangCode is NULL, then ASSERT.
+ If Lang is NULL, then ASSERT.
+
+ @param LangCode On input: point to first language in the list. On
+ output: point to next language in the list, or
+ NULL if no more language in the list.
+ @param Lang The first language in the list.
+
+**/
+VOID
+EFIAPI
+HiiLibGetNextLanguage (
+ IN OUT CHAR8 **LangCode,
+ OUT CHAR8 *Lang
+ );
+
+/**
+ This function returns the list of supported languages, in the format specified
+ in UEFI specification Appendix M.
+
+ If HiiHandle is not a valid Handle in the default HII database, then ASSERT.
+
+ @param HiiHandle The HII package list handle.
+
+ @retval !NULL The supported languages.
+ @retval NULL If Supported Languages can not be retrived.
+
+**/
+CHAR8 *
+EFIAPI
+HiiLibGetSupportedLanguages (
+ IN EFI_HII_HANDLE HiiHandle
+ );
+
+/**
+ This function returns the list of supported 2nd languages, in the format specified
+ in UEFI specification Appendix M.
+
+ If HiiHandle is not a valid Handle in the default HII database, then ASSERT.
+ If not enough resource to complete the operation, then ASSERT.
+
+ @param HiiHandle The HII package list handle.
+ @param FirstLanguage Pointer to language name buffer.
+
+ @return The supported languages.
+
+**/
+CHAR8 *
+EFIAPI
+HiiLibGetSupportedSecondaryLanguages (
+ IN EFI_HII_HANDLE HiiHandle,
+ IN CONST CHAR8 *FirstLanguage
+ );
+
+
+/**
+ This function returns the number of supported languages on HiiHandle.
+
+ If HiiHandle is not a valid Handle in the default HII database, then ASSERT.
+ If not enough resource to complete the operation, then ASSERT.
+
+ @param HiiHandle The HII package list handle.
+
+ @return The number of supported languages.
+
+**/
+UINT16
+EFIAPI
+HiiLibGetSupportedLanguageNumber (
+ IN EFI_HII_HANDLE HiiHandle
+ );
+
+/**
+ Exports the contents of one or all package lists in the HII database into a buffer.
+
+ If Handle is not NULL and not a valid EFI_HII_HANDLE registered in the database,
+ then ASSERT.
+ If PackageListHeader is NULL, then ASSERT.
+ If PackageListSize is NULL, then ASSERT.
+
+ @param Handle The HII Handle.
+ @param PackageListHeader A pointer to a buffer that will contain the results of
+ the export function.
+ @param PackageListSize On output, the length of the buffer that is required for the exported data.
+
+ @retval EFI_SUCCESS Package exported.
+
+ @retval EFI_OUT_OF_RESOURCES Not enought memory to complete the operations.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiLibExportPackageLists (
+ IN EFI_HII_HANDLE Handle,
+ OUT EFI_HII_PACKAGE_LIST_HEADER **PackageListHeader,
+ OUT UINTN *PackageListSize
+ );
+
+/**
+
+ This function returns a list of the package handles of the
+ specified type that are currently active in the HII database. The
+ pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package
+ handles to be listed.
+
+ If HandleBufferLength is NULL, then ASSERT.
+ If HandleBuffer is NULL, the ASSERT.
+ If PackageType is EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is
+ NULL, then ASSERT.
+ If PackageType is not EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is not
+ NULL, then ASSERT.
+
+
+ @param PackageType Specifies the package type of the packages
+ to list or EFI_HII_PACKAGE_TYPE_ALL for
+ all packages to be listed.
+
+ @param PackageGuid If PackageType is
+ EFI_HII_PACKAGE_TYPE_GUID, then this is
+ the pointer to the GUID which must match
+ the Guid field of
+ EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it
+ must be NULL.
+
+ @param HandleBufferLength On output, the length of the handle buffer
+ that is required for the handles found.
+
+ @param HandleBuffer On output, an array of EFI_HII_HANDLE instances returned.
+ The caller is responcible to free this pointer allocated.
+
+ @retval EFI_SUCCESS The matching handles are outputed successfully.
+ HandleBufferLength is updated with the actual length.
+ @retval EFI_OUT_OF_RESOURCES Not enough resource to complete the operation.
+ @retval EFI_NOT_FOUND No matching handle could not be found in database.
+**/
+EFI_STATUS
+EFIAPI
+HiiLibListPackageLists (
+ IN UINT8 PackageType,
+ IN CONST EFI_GUID *PackageGuid,
+ IN OUT UINTN *HandleBufferLength,
+ OUT EFI_HII_HANDLE **Handle
+ );
+
+/**
+ Convert language code from RFC3066 to ISO639-2.
+
+ LanguageRfc3066 contain a single RFC 3066 code such as
+ "en-US" or "fr-FR".
+
+ The LanguageRfc3066 must be a buffer large enough
+ for ISO_639_2_ENTRY_SIZE characters.
+
+ If LanguageRfc3066 is NULL, then ASSERT.
+ If LanguageIso639 is NULL, then ASSERT.
+
+ @param LanguageRfc3066 RFC3066 language code.
+ @param LanguageIso639 ISO639-2 language code.
+
+ @retval EFI_SUCCESS Language code converted.
+ @retval EFI_NOT_FOUND Language code not found.
+
+**/
+EFI_STATUS
+EFIAPI
+ConvertRfc3066LanguageToIso639Language (
+ IN CHAR8 *LanguageRfc3066,
+ OUT CHAR8 *LanguageIso639
+ );
+
+/**
+ Convert language code from ISO639-2 to RFC3066.
+
+ LanguageIso639 contain a single ISO639-2 code such as
+ "eng" or "fra".
+
+ The LanguageRfc3066 must be a buffer large enough
+ for RFC_3066_ENTRY_SIZE characters.
+
+ If LanguageIso639 is NULL, then ASSERT.
+ If LanguageRfc3066 is NULL, then ASSERT.
+
+ @param LanguageIso639 ISO639-2 language code.
+ @param LanguageRfc3066 RFC3066 language code.
+
+ @retval EFI_SUCCESS Language code converted.
+ @retval EFI_NOT_FOUND Language code not found.
+
+**/
+EFI_STATUS
+EFIAPI
+ConvertIso639LanguageToRfc3066Language (
+ IN CONST CHAR8 *LanguageIso639,
+ OUT CHAR8 *LanguageRfc3066
+ );
+
+/**
+ Convert language code list from RFC3066 to ISO639-2, e.g. "en-US;fr-FR" will
+ be converted to "engfra".
+
+ If SupportedLanguages is NULL, then ASSERT.
+
+ @param SupportedLanguages The RFC3066 language list.
+
+ @return The ISO639-2 language list.
+
+**/
+CHAR8 *
+EFIAPI
+Rfc3066ToIso639 (
+ CHAR8 *SupportedLanguages
+ );
+
+#endif
diff --git a/MdeModulePkg/Include/Library/IfrSupportLib.h b/MdeModulePkg/Include/Library/IfrSupportLib.h
new file mode 100644
index 0000000000..3f686bd49c
--- /dev/null
+++ b/MdeModulePkg/Include/Library/IfrSupportLib.h
@@ -0,0 +1,765 @@
+/** @file
+ This library contains functions to do IFR opcode creation and utility functions
+ to help module to interact with a UEFI Form Browser.
+
+ Copyright (c) 2007 - 2008, Intel Corporation
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _IFR_SUPPORT_LIBRARY_H_
+#define _IFR_SUPPORT_LIBRARY_H_
+
+
+#include <Protocol/HiiFont.h>
+#include <Protocol/HiiImage.h>
+#include <Protocol/HiiString.h>
+#include <Protocol/HiiDatabase.h>
+#include <Protocol/HiiConfigRouting.h>
+#include <Protocol/HiiConfigAccess.h>
+#include <Protocol/FormBrowser2.h>
+#include <Protocol/SimpleTextOut.h>
+
+#include <Guid/GlobalVariable.h>
+
+//
+// The architectural variable "Lang" and "LangCodes" are deprecated in UEFI
+// specification. While, UEFI specification also states that these deprecated
+// variables may be provided for backwards compatibility.
+
+#define EFI_LANGUAGE_VARIABLE L"Lang"
+#define EFI_LANGUAGE_CODES_VARIABLE L"LangCodes"
+
+#define UEFI_LANGUAGE_VARIABLE L"PlatformLang"
+#define UEFI_LANGUAGE_CODES_VARIABLE L"PlatformLangCodes"
+
+#define INVALID_VARSTORE_ID 0
+
+#define QUESTION_FLAGS (EFI_IFR_FLAG_READ_ONLY | EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED | EFI_IFR_FLAG_OPTIONS_ONLY)
+#define QUESTION_FLAGS_MASK (~QUESTION_FLAGS)
+
+#pragma pack(1)
+typedef struct {
+ EFI_STRING_ID StringToken;
+ EFI_IFR_TYPE_VALUE Value;
+ UINT8 Flags;
+} IFR_OPTION;
+#pragma pack()
+
+typedef struct {
+ ///
+ /// Buffer size allocated for Data.
+ ///
+ UINT32 BufferSize;
+
+ ///
+ /// Offset in Data to append the newly created opcode binary.
+ /// It will be adjusted automatically in Create***OpCode(), and should be
+ /// initialized to 0 before invocation of a serial of Create***OpCode()
+ ///
+ UINT32 Offset;
+
+ ///
+ /// The destination buffer for created op-codes
+ ///
+ UINT8 *Data;
+} EFI_HII_UPDATE_DATA;
+
+
+/**
+ Create EFI_IFR_END_OP opcode.
+
+ If Data is NULL or Data->Data is NULL, then ASSERT.
+
+ @param Data Destination for the created opcode binary
+
+ @retval EFI_SUCCESS Opcode is created successfully.
+ @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+
+**/
+EFI_STATUS
+EFIAPI
+CreateEndOpCode (
+ IN OUT EFI_HII_UPDATE_DATA *Data
+ )
+;
+
+/**
+ Create EFI_IFR_DEFAULT_OP opcode.
+
+ If Data is NULL or Data->Data is NULL, then ASSERT.
+
+ @param Value Value for the default
+ @param Type Type for the default
+ @param Data Destination for the created opcode binary
+
+ @retval EFI_SUCCESS Opcode is created successfully.
+ @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+ @retval EFI_INVALID_PARAMETER The type is not valid.
+
+**/
+EFI_STATUS
+EFIAPI
+CreateDefaultOpCode (
+ IN EFI_IFR_TYPE_VALUE *Value,
+ IN UINT8 Type,
+ IN OUT EFI_HII_UPDATE_DATA *Data
+ )
+;
+
+/**
+ Create EFI_IFR_ACTION_OP opcode.
+
+ If Data is NULL or Data->Data is NULL, then ASSERT.
+
+ @param QuestionId Question ID
+ @param Prompt String ID for Prompt
+ @param Help String ID for Help
+ @param QuestionFlags Flags in Question Header
+ @param QuestionConfig String ID for configuration
+ @param Data Destination for the created opcode binary
+
+ @retval EFI_SUCCESS Opcode is created successfully.
+ @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+ @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.
+
+**/
+EFI_STATUS
+EFIAPI
+CreateActionOpCode (
+ IN EFI_QUESTION_ID QuestionId,
+ IN EFI_STRING_ID Prompt,
+ IN EFI_STRING_ID Help,
+ IN UINT8 QuestionFlags,
+ IN EFI_STRING_ID QuestionConfig,
+ IN OUT EFI_HII_UPDATE_DATA *Data
+ )
+;
+
+/**
+ Create EFI_IFR_SUBTITLE_OP opcode.
+
+ If Data is NULL or Data->Data is NULL, then ASSERT.
+
+ @param Prompt String ID for Prompt
+ @param Help String ID for Help
+ @param Flags Subtitle opcode flags
+ @param Scope Subtitle Scope bit
+ @param Data Destination for the created opcode binary
+
+ @retval EFI_SUCCESS Opcode is created successfully.
+ @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+
+**/
+EFI_STATUS
+EFIAPI
+CreateSubTitleOpCode (
+ IN EFI_STRING_ID Prompt,
+ IN EFI_STRING_ID Help,
+ IN UINT8 Flags,
+ IN UINT8 Scope,
+ IN OUT EFI_HII_UPDATE_DATA *Data
+ )
+;
+
+/**
+ Create EFI_IFR_TEXT_OP opcode.
+
+ If Data is NULL or Data->Data is NULL, then ASSERT.
+
+ @param Prompt String ID for Prompt
+ @param Help String ID for Help
+ @param TextTwo String ID for text two
+ @param Data Destination for the created opcode binary
+
+ @retval EFI_SUCCESS Opcode is created successfully.
+ @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+
+**/
+EFI_STATUS
+EFIAPI
+CreateTextOpCode (
+ IN EFI_STRING_ID Prompt,
+ IN EFI_STRING_ID Help,
+ IN EFI_STRING_ID TextTwo,
+ IN OUT EFI_HII_UPDATE_DATA *Data
+ )
+;
+
+/**
+ Create EFI_IFR_REF_OP opcode.
+
+ If Data is NULL or Data->Data is NULL, then ASSERT.
+
+ @param FormId Destination Form ID
+ @param Prompt String ID for Prompt
+ @param Help String ID for Help
+ @param QuestionFlags Flags in Question Header
+ @param QuestionId Question ID
+ @param Data Destination for the created opcode binary
+
+ @retval EFI_SUCCESS Opcode is created successfully.
+ @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+ @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.
+
+**/
+EFI_STATUS
+EFIAPI
+CreateGotoOpCode (
+ IN EFI_FORM_ID FormId,
+ IN EFI_STRING_ID Prompt,
+ IN EFI_STRING_ID Help,
+ IN UINT8 QuestionFlags,
+ IN EFI_QUESTION_ID QuestionId,
+ IN OUT EFI_HII_UPDATE_DATA *Data
+ )
+;
+
+/**
+ Create EFI_IFR_ONE_OF_OPTION_OP opcode.
+
+ If Data is NULL or Data->Data is NULL, then ASSERT.
+
+ @param OptionCount The number of options.
+ @param OptionsList The list of Options.
+ @param Type The data type.
+ @param Data Destination for the created opcode binary
+
+ @retval EFI_SUCCESS Opcode is created successfully.
+ @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+ @retval EFI_INVALID_PARAMETER If OptionCount is not zero but OptionsList is NULL.
+
+**/
+EFI_STATUS
+EFIAPI
+CreateOneOfOptionOpCode (
+ IN UINTN OptionCount,
+ IN IFR_OPTION *OptionsList,
+ IN UINT8 Type,
+ IN OUT EFI_HII_UPDATE_DATA *Data
+ )
+;
+
+/**
+ Create EFI_IFR_ONE_OF_OP opcode.
+
+ If Data is NULL or Data->Data is NULL, then ASSERT.
+
+ @param QuestionId Question ID
+ @param VarStoreId Storage ID
+ @param VarOffset Offset in Storage
+ @param Prompt String ID for Prompt
+ @param Help String ID for Help
+ @param QuestionFlags Flags in Question Header
+ @param OneOfFlags Flags for oneof opcode
+ @param OptionsList List of options
+ @param OptionCount Number of options in option list
+ @param Data Destination for the created opcode binary
+
+ @retval EFI_SUCCESS Opcode is created successfully.
+ @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+ @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.
+
+**/
+EFI_STATUS
+EFIAPI
+CreateOneOfOpCode (
+ IN EFI_QUESTION_ID QuestionId,
+ IN EFI_VARSTORE_ID VarStoreId,
+ IN UINT16 VarOffset,
+ IN EFI_STRING_ID Prompt,
+ IN EFI_STRING_ID Help,
+ IN UINT8 QuestionFlags,
+ IN UINT8 OneOfFlags,
+ IN IFR_OPTION *OptionsList,
+ IN UINTN OptionCount,
+ IN OUT EFI_HII_UPDATE_DATA *Data
+ )
+;
+
+/**
+ Create EFI_IFR_ORDERED_LIST_OP opcode.
+
+ If Data is NULL or Data->Data is NULL, then ASSERT.
+
+ @param QuestionId Question ID
+ @param VarStoreId Storage ID
+ @param VarOffset Offset in Storage
+ @param Prompt String ID for Prompt
+ @param Help String ID for Help
+ @param QuestionFlags Flags in Question Header
+ @param OrderedListFlags Flags for ordered list opcode
+ @param DataType Type for option value
+ @param MaxContainers Maximum count for options in this ordered list
+ @param OptionsList List of options
+ @param OptionCount Number of options in option list
+ @param Data Destination for the created opcode binary
+
+ @retval EFI_SUCCESS Opcode is created successfully.
+ @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+ @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.
+
+**/
+EFI_STATUS
+EFIAPI
+CreateOrderedListOpCode (
+ IN EFI_QUESTION_ID QuestionId,
+ IN EFI_VARSTORE_ID VarStoreId,
+ IN UINT16 VarOffset,
+ IN EFI_STRING_ID Prompt,
+ IN EFI_STRING_ID Help,
+ IN UINT8 QuestionFlags,
+ IN UINT8 OrderedListFlags,
+ IN UINT8 DataType,
+ IN UINT8 MaxContainers,
+ IN IFR_OPTION *OptionsList,
+ IN UINTN OptionCount,
+ IN OUT EFI_HII_UPDATE_DATA *Data
+ )
+;
+
+/**
+ Create EFI_IFR_CHECKBOX_OP opcode.
+
+ If Data is NULL or Data->Data is NULL, then ASSERT.
+
+ @param QuestionId Question ID
+ @param VarStoreId Storage ID
+ @param VarOffset Offset in Storage
+ @param Prompt String ID for Prompt
+ @param Help String ID for Help
+ @param QuestionFlags Flags in Question Header
+ @param CheckBoxFlags Flags for checkbox opcode
+ @param Data Destination for the created opcode binary
+
+ @retval EFI_SUCCESS Opcode is created successfully.
+ @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+ @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.
+
+**/
+EFI_STATUS
+EFIAPI
+CreateCheckBoxOpCode (
+ IN EFI_QUESTION_ID QuestionId,
+ IN EFI_VARSTORE_ID VarStoreId,
+ IN UINT16 VarOffset,
+ IN EFI_STRING_ID Prompt,
+ IN EFI_STRING_ID Help,
+ IN UINT8 QuestionFlags,
+ IN UINT8 CheckBoxFlags,
+ IN OUT EFI_HII_UPDATE_DATA *Data
+ )
+;
+
+/**
+ Create EFI_IFR_NUMERIC_OP opcode.
+
+ If Data is NULL or Data->Data is NULL, then ASSERT.
+
+ @param QuestionId Question ID
+ @param VarStoreId Storage ID
+ @param VarOffset Offset in Storage
+ @param Prompt String ID for Prompt
+ @param Help String ID for Help
+ @param QuestionFlags Flags in Question Header
+ @param NumericFlags Flags for numeric opcode
+ @param Minimum Numeric minimum value
+ @param Maximum Numeric maximum value
+ @param Step Numeric step for edit
+ @param Default Numeric default value
+ @param Data Destination for the created opcode binary
+
+ @retval EFI_SUCCESS Opcode is created successfully.
+ @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+ @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.
+
+**/
+EFI_STATUS
+EFIAPI
+CreateNumericOpCode (
+ IN EFI_QUESTION_ID QuestionId,
+ IN EFI_VARSTORE_ID VarStoreId,
+ IN UINT16 VarOffset,
+ IN EFI_STRING_ID Prompt,
+ IN EFI_STRING_ID Help,
+ IN UINT8 QuestionFlags,
+ IN UINT8 NumericFlags,
+ IN UINT64 Minimum,
+ IN UINT64 Maximum,
+ IN UINT64 Step,
+ IN UINT64 Default,
+ IN OUT EFI_HII_UPDATE_DATA *Data
+ )
+;
+
+/**
+ Create EFI_IFR_STRING_OP opcode.
+
+ If Data is NULL or Data->Data is NULL, then ASSERT.
+
+ @param QuestionId Question ID
+ @param VarStoreId Storage ID
+ @param VarOffset Offset in Storage
+ @param Prompt String ID for Prompt
+ @param Help String ID for Help
+ @param QuestionFlags Flags in Question Header
+ @param StringFlags Flags for string opcode
+ @param MinSize String minimum length
+ @param MaxSize String maximum length
+ @param Data Destination for the created opcode binary
+
+ @retval EFI_SUCCESS Opcode is created successfully.
+ @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+ @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.
+
+**/
+EFI_STATUS
+EFIAPI
+CreateStringOpCode (
+ IN EFI_QUESTION_ID QuestionId,
+ IN EFI_VARSTORE_ID VarStoreId,
+ IN UINT16 VarOffset,
+ IN EFI_STRING_ID Prompt,
+ IN EFI_STRING_ID Help,
+ IN UINT8 QuestionFlags,
+ IN UINT8 StringFlags,
+ IN UINT8 MinSize,
+ IN UINT8 MaxSize,
+ IN OUT EFI_HII_UPDATE_DATA *Data
+ )
+;
+/**
+ Construct <ConfigAltResp> for a buffer storage.
+
+ @param ConfigRequest The Config request string. If set to NULL, all the
+ configurable elements will be extracted from BlockNameArray.
+ @param ConfigAltResp The returned <ConfigAltResp>.
+ @param Progress On return, points to a character in the Request.
+ @param Guid GUID of the buffer storage.
+ @param Name Name of the buffer storage.
+ @param DriverHandle The DriverHandle which is used to invoke HiiDatabase
+ protocol interface NewPackageList().
+ @param BufferStorage Content of the buffer storage.
+ @param BufferStorageSize Length in bytes of the buffer storage.
+ @param BlockNameArray Array generated by VFR compiler.
+ @param NumberAltCfg Number of Default value array generated by VFR compiler.
+ The sequential input parameters will be number of
+ AltCfgId and DefaultValueArray pairs. When set to 0,
+ there will be no <AltResp>.
+
+ retval EFI_OUT_OF_RESOURCES Run out of memory resource.
+ retval EFI_INVALID_PARAMETER ConfigAltResp is NULL.
+ retval EFI_SUCCESS Operation successful.
+
+**/
+EFI_STATUS
+ConstructConfigAltResp (
+ IN EFI_STRING ConfigRequest, OPTIONAL
+ OUT EFI_STRING *Progress,
+ OUT EFI_STRING *ConfigAltResp,
+ IN EFI_GUID *Guid,
+ IN CHAR16 *Name,
+ IN EFI_HANDLE *DriverHandle,
+ IN VOID *BufferStorage,
+ IN UINTN BufferStorageSize,
+ IN VOID *BlockNameArray, OPTIONAL
+ IN UINTN NumberAltCfg,
+ ...
+//IN UINT16 AltCfgId,
+//IN VOID *DefaultValueArray,
+ )
+;
+
+/**
+ Converts the unicode character of the string from uppercase to lowercase.
+
+ @param Str String to be converted
+
+
+**/
+VOID
+EFIAPI
+ToLower (
+ IN OUT CHAR16 *Str
+ )
+;
+
+/**
+ Converts binary buffer to a Unicode string. The byte buffer is in a reversed byte order
+ compared with the byte order defined in BufToHexString().
+
+ @param Str String for output
+ @param Buffer Binary buffer.
+ @param BufferSize Size of the buffer in bytes.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_OUT_OF_RESOURCES There is no enough available memory space.
+
+**/
+EFI_STATUS
+EFIAPI
+BufInReverseOrderToHexString (
+ IN OUT CHAR16 *Str,
+ IN UINT8 *Buffer,
+ IN UINTN BufferSize
+ )
+;
+
+/**
+ Converts Hex String to binary buffer in reversed byte order to HexStringToBuf().
+
+ @param Buffer Pointer to buffer that receives the data.
+ @param BufferSize Length in bytes of the buffer to hold converted
+ data. If routine return with EFI_SUCCESS,
+ containing length of converted data. If routine
+ return with EFI_BUFFER_TOO_SMALL, containg length
+ of buffer desired.
+ @param Str String to be converted from.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval RETURN_BUFFER_TOO_SMALL The input BufferSize is too small to hold the output. BufferSize
+ will be updated to the size required for the converstion.
+
+**/
+EFI_STATUS
+EFIAPI
+HexStringToBufInReverseOrder (
+ IN OUT UINT8 *Buffer,
+ IN OUT UINTN *BufferSize,
+ IN CHAR16 *Str
+ )
+;
+
+/**
+ Convert binary representation Config string (e.g. "0041004200430044") to the
+ original string (e.g. "ABCD"). Config string appears in <ConfigHdr> (i.e.
+ "&NAME=<string>"), or Name/Value pair in <ConfigBody> (i.e. "label=<string>").
+
+ @param UnicodeString Original Unicode string.
+ @param StrBufferLen On input: Length in bytes of buffer to hold the Unicode string.
+ Includes tailing '\0' character.
+ On output:
+ containing length of Unicode string buffer when returning EFI_SUCCESS;
+ containg length of string buffer desired when returning EFI_BUFFER_TOO_SMALL.
+ @param ConfigString Binary representation of Unicode String, <string> := (<HexCh>4)+
+
+ @retval EFI_SUCCESS Operation completes successfully.
+ @retval EFI_BUFFER_TOO_SMALL The string buffer is too small.
+
+**/
+EFI_STATUS
+EFIAPI
+ConfigStringToUnicode (
+ IN OUT CHAR16 *UnicodeString,
+ IN OUT UINTN *StrBufferLen,
+ IN CHAR16 *ConfigString
+ )
+;
+
+/**
+ Convert Unicode string to binary representation Config string, e.g.
+ "ABCD" => "0041004200430044". Config string appears in <ConfigHdr> (i.e.
+ "&NAME=<string>"), or Name/Value pair in <ConfigBody> (i.e. "label=<string>").
+
+ @param ConfigString Binary representation of Unicode String, <string> := (<HexCh>4)+
+ @param StrBufferLen On input: Length in bytes of buffer to hold the Unicode string.
+ Includes tailing '\0' character.
+ On output:
+ If return EFI_SUCCESS, containing length of Unicode string buffer.
+ If return EFI_BUFFER_TOO_SMALL, containg length of string buffer desired.
+ @param UnicodeString Original Unicode string.
+
+ @retval EFI_SUCCESS Operation completes successfully.
+ @retval EFI_BUFFER_TOO_SMALL The string buffer is too small.
+
+**/
+EFI_STATUS
+EFIAPI
+UnicodeToConfigString (
+ IN OUT CHAR16 *ConfigString,
+ IN OUT UINTN *StrBufferLen,
+ IN CHAR16 *UnicodeString
+ )
+;
+
+/**
+ Construct <ConfigHdr> using routing information GUID/NAME/PATH.
+
+ @param ConfigHdr Pointer to the ConfigHdr string.
+ @param StrBufferLen On input: Length in bytes of buffer to hold the
+ ConfigHdr string. Includes tailing '\0' character.
+ On output: If return EFI_SUCCESS, containing
+ length of ConfigHdr string buffer. If return
+ EFI_BUFFER_TOO_SMALL, containg length of string
+ buffer desired.
+ @param Guid Routing information: GUID.
+ @param Name Routing information: NAME.
+ @param DriverHandle Driver handle which contains the routing
+ information: PATH.
+
+ @retval EFI_SUCCESS Operation completes successfully.
+ @retval EFI_BUFFER_TOO_SMALL The ConfigHdr string buffer is too small.
+
+**/
+EFI_STATUS
+EFIAPI
+ConstructConfigHdr (
+ IN OUT CHAR16 *ConfigHdr,
+ IN OUT UINTN *StrBufferLen,
+ IN CONST EFI_GUID *Guid,
+ IN CHAR16 *Name, OPTIONAL
+ IN EFI_HANDLE *DriverHandle
+ )
+
+;
+
+/**
+ Determines if the Routing data (Guid and Name) is correct in <ConfigHdr>.
+
+ @param ConfigString Either <ConfigRequest> or <ConfigResp>.
+ @param StorageGuid GUID of the storage.
+ @param StorageName Name of the stoarge.
+
+ @retval TRUE Routing information is correct in ConfigString.
+ @retval FALSE Routing information is incorrect in ConfigString.
+
+**/
+BOOLEAN
+IsConfigHdrMatch (
+ IN EFI_STRING ConfigString,
+ IN EFI_GUID *StorageGuid, OPTIONAL
+ IN CHAR16 *StorageName OPTIONAL
+ )
+;
+
+/**
+ Search BlockName "&OFFSET=Offset&WIDTH=Width" in a string.
+
+ @param String The string to be searched in.
+ @param Offset Offset in BlockName.
+ @param Width Width in BlockName.
+
+ @retval TRUE Block name found.
+ @retval FALSE Block name not found.
+
+**/
+BOOLEAN
+EFIAPI
+FindBlockName (
+ IN OUT CHAR16 *String,
+ IN UINTN Offset,
+ IN UINTN Width
+ )
+;
+
+/**
+ This routine is invoked by ConfigAccess.Callback() to retrived uncommitted data from Form Browser.
+
+ @param VariableGuid An optional field to indicate the target variable
+ GUID name to use.
+ @param VariableName An optional field to indicate the target
+ human-readable variable name.
+ @param BufferSize On input: Length in bytes of buffer to hold
+ retrived data. On output: If return
+ EFI_BUFFER_TOO_SMALL, containg length of buffer
+ desired.
+ @param Buffer Buffer to hold retrived data.
+
+ @retval EFI_SUCCESS Operation completes successfully.
+ @retval EFI_BUFFER_TOO_SMALL The intput buffer is too small.
+
+**/
+EFI_STATUS
+EFIAPI
+GetBrowserData (
+ IN CONST EFI_GUID *VariableGuid, OPTIONAL
+ IN CONST CHAR16 *VariableName, OPTIONAL
+ IN OUT UINTN *BufferSize,
+ IN OUT UINT8 *Buffer
+ )
+;
+
+/**
+ This routine is invoked by ConfigAccess.Callback() to update uncommitted data of Form Browser.
+
+ @param VariableGuid An optional field to indicate the target variable
+ GUID name to use.
+ @param VariableName An optional field to indicate the target
+ human-readable variable name.
+ @param BufferSize Length in bytes of buffer to hold retrived data.
+ @param Buffer Buffer to hold retrived data.
+ @param RequestElement An optional field to specify which part of the
+ buffer data will be send back to Browser. If NULL,
+ the whole buffer of data will be committed to
+ Browser. <RequestElement> ::=
+ &OFFSET=<Number>&WIDTH=<Number>*
+
+ @retval EFI_SUCCESS Operation completes successfully.
+ @retval Other Updating Browser uncommitted data failed.
+
+**/
+EFI_STATUS
+EFIAPI
+SetBrowserData (
+ IN CONST EFI_GUID *VariableGuid, OPTIONAL
+ IN CONST CHAR16 *VariableName, OPTIONAL
+ IN UINTN BufferSize,
+ IN CONST UINT8 *Buffer,
+ IN CONST CHAR16 *RequestElement OPTIONAL
+ )
+;
+
+/**
+ Draw a dialog and return the selected key.
+
+ @param NumberOfLines The number of lines for the dialog box
+ @param KeyValue The EFI_KEY value returned if HotKey is TRUE..
+ @param String Pointer to the first string in the list
+ @param ... A series of (quantity == NumberOfLines - 1) text
+ strings which will be used to construct the dialog
+ box
+
+ @retval EFI_SUCCESS Displayed dialog and received user interaction
+ @retval EFI_INVALID_PARAMETER One of the parameters was invalid.
+
+**/
+EFI_STATUS
+EFIAPI
+IfrLibCreatePopUp (
+ IN UINTN NumberOfLines,
+ OUT EFI_INPUT_KEY *KeyValue,
+ IN CHAR16 *String,
+ ...
+ )
+;
+
+/**
+ Draw a dialog and return the selected key using Variable Argument List.
+
+ @param NumberOfLines The number of lines for the dialog box
+ @param KeyValue The EFI_KEY value returned if HotKey is TRUE..
+ @param Args VA_LIST marker for the variable argument list.
+ A series of (quantity == NumberOfLines - 1) text
+ strings which will be used to construct the dialog
+ box
+
+ @retval EFI_SUCCESS Displayed dialog and received user interaction
+ @retval EFI_INVALID_PARAMETER One of the parameters was invalid.
+
+**/
+EFI_STATUS
+EFIAPI
+IfrLibCreatePopUp2 (
+ IN UINTN NumberOfLines,
+ OUT EFI_INPUT_KEY *KeyValue,
+ IN VA_LIST Args
+ )
+;
+
+#endif