UEFI HII: Merge UEFI HII support changes from branch.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4600 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12 2008-01-21 14:41:31 +00:00
parent 93e3992d1e
commit 7d582d6b49
21 changed files with 3518 additions and 3273 deletions

View File

@ -22,18 +22,18 @@
Return the graphics image file named FileNameGuid into Image and return it's
size in ImageSize. All Firmware Volumes (FV) in the system are searched for the
file name.
@param[in] FileNameGuid File Name of graphics file in the FV(s).
@param[in] FileNameGuid File Name of graphics file in the FV(s).
@param[out] Image Pointer to pointer to return graphics image. If NULL, a
buffer will be allocated.
buffer will be allocated.
@param[out] ImageSize Size of the graphics Image in bytes. Zero if no image found.
@retval EFI_INVALID_PARAMETER invalid parameter
@retval EFI_INVALID_PARAMETER invalid parameter
@retval EFI_UNSUPPORTED Range can not be erased
@retval EFI_SUCCESS Image and ImageSize are valid.
@retval EFI_BUFFER_TOO_SMALL Image not big enough. ImageSize has required size
@retval EFI_NOT_FOUND FileNameGuid not found
**/
EFI_STATUS
GetGraphicsBitMapFromFV (
@ -42,23 +42,50 @@ GetGraphicsBitMapFromFV (
OUT UINTN *ImageSize
);
/**
Return the graphics image file named FileNameGuid into Image and return it's
size in ImageSize. All Firmware Volumes (FV) in the system are searched for the
file name.
@param[in] ImageHandle The driver image handle of the caller. The parameter is used to
optimize the loading of the image file so that the FV from which
the driver image is loaded will be tried first.
@param[in] FileNameGuid File Name of graphics file in the FV(s).
@param[out] Image Pointer to pointer to return graphics image. If NULL, a
buffer will be allocated.
@param[out] ImageSize Size of the graphics Image in bytes. Zero if no image found.
@retval EFI_INVALID_PARAMETER invalid parameter
@retval EFI_UNSUPPORTED Range can not be erased
@retval EFI_SUCCESS Image and ImageSize are valid.
@retval EFI_BUFFER_TOO_SMALL Image not big enough. ImageSize has required size
@retval EFI_NOT_FOUND FileNameGuid not found
**/
EFI_STATUS
GetGraphicsBitMapFromFVEx (
IN EFI_HANDLE ImageHandle,
IN EFI_GUID *FileNameGuid,
OUT VOID **Image,
OUT UINTN *ImageSize
);
/**
Convert a *.BMP graphics image to a UGA blt buffer. If a NULL UgaBlt buffer
is passed in a UgaBlt buffer will be allocated by this routine. If a UgaBlt
buffer is passed in it will be used if it is big enough.
@param[in] BmpImage Pointer to BMP file
@param[in] BmpImageSize Number of bytes in BmpImage
@param[in,out] UgaBlt Buffer containing UGA version of BmpImage.
@param[in,out] UgaBltSize Size of UgaBlt in bytes.
@param[out] PixelHeight Height of UgaBlt/BmpImage in pixels
@param[out] PixelWidth Width of UgaBlt/BmpImage in pixels
@param[in] BmpImage Pointer to BMP file
@param[in] BmpImageSize Number of bytes in BmpImage
@param[in,out] UgaBlt Buffer containing UGA version of BmpImage.
@param[in,out] UgaBltSize Size of UgaBlt in bytes.
@param[out] PixelHeight Height of UgaBlt/BmpImage in pixels
@param[out] PixelWidth Width of UgaBlt/BmpImage in pixels
@retval EFI_SUCCESS UgaBlt and UgaBltSize are returned.
@retval EFI_UNSUPPORTED BmpImage is not a valid *.BMP image
@retval EFI_BUFFER_TOO_SMALL The passed in UgaBlt buffer is not big enough.
UgaBltSize will contain the required size.
UgaBltSize will contain the required size.
**/
EFI_STATUS
ConvertBmpToUgaBlt (
@ -74,9 +101,9 @@ ConvertBmpToUgaBlt (
/**
Use Console Control to turn off UGA based Simple Text Out consoles from going
to the UGA device. Put up LogoFile on every UGA device that is a console
@param[in] LogoFile File name of logo to display on the center of the screen.
@param[in] LogoFile File name of logo to display on the center of the screen.
@retval EFI_SUCCESS ConsoleControl has been flipped to graphics and logo displayed.
@retval EFI_UNSUPPORTED Logo not found
@ -86,11 +113,30 @@ EnableQuietBoot (
IN EFI_GUID *LogoFile
);
/**
Use Console Control to turn off GOP/UGA based Simple Text Out consoles from going
to the UGA device. Put up LogoFile on every UGA device that is a console
@param LogoFile File name of logo to display on the center of the screen.
@param ImageHandle The driver image handle of the caller. The parameter is used to
optimize the loading of the logo file so that the FV from which
the driver image is loaded will be tried first.
@retval EFI_SUCCESS ConsoleControl has been flipped to graphics and logo displayed.
@retval EFI_UNSUPPORTED Logo not found
**/
EFI_STATUS
EnableQuietBootEx (
IN EFI_GUID *LogoFile,
IN EFI_HANDLE ImageHandle
);
/**
Use Console Control to turn on UGA based Simple Text Out consoles. The UGA
Simple Text Out screens will now be synced up with all non UGA output devices
@retval EFI_SUCCESS UGA devices are back in text mode and synced up.
**/
@ -105,9 +151,9 @@ DisableQuietBoot (
This is the ConInHandle and ConIn handle in the EFI system table. All key
presses will be ignored until the Password is typed in. The only way to
disable the password is to type it in to a ConIn device.
@param[in] Password Password used to lock ConIn device.
@param[in] Password Password used to lock ConIn device.
@retval EFI_SUCCESS ConsoleControl has been flipped to graphics and logo
displayed.
@retval EFI_UNSUPPORTED Password not found
@ -120,16 +166,16 @@ LockKeyboards (
/**
Print to graphics screen at the given X,Y coordinates of the graphics screen.
see definition of Print to find rules for constructing Fmt.
@param[in] X Row to start printing at
@param[in] Y Column to start printing at
@param[in] Foreground Foreground color
@param[in] Background background color
@param[in] Fmt Print format sting. See definition of Print
@param[in] ... Argumnet stream defined by Fmt string
Print to graphics screen at the given X,Y coordinates of the graphics screen.
see definition of Print to find rules for constructing Fmt.
@param[in] X Row to start printing at
@param[in] Y Column to start printing at
@param[in] Foreground Foreground color
@param[in] Background background color
@param[in] Fmt Print format sting. See definition of Print
@param[in] ... Argumnet stream defined by Fmt string
@retval UINTN Number of Characters printed
**/

View File

@ -15,29 +15,165 @@
#ifndef __HII_LIB_H__
#define __HII_LIB_H__
#error "UEFI 2.1 HII is not fully implemented for now, Please don't include this file now."
//#include <PiDxe.h>
#include <Protocol/HiiDatabase.h>
//
// Limited buffer size recommended by RFC4646 (4.3. Length Considerations)
// (42 characters plus a NULL terminator)
//
#define RFC_3066_ENTRY_SIZE (42 + 1)
/**
This function allocates pool for an EFI_HII_PACKAGES structure
with enough space for the variable argument list of package pointers.
The allocated structure is initialized using NumberOfPackages, Guid,
and the variable length argument list of package pointers.
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.
@param NumberOfPackages The number of HII packages to prepare.
@param Guid Package GUID.
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.
@param NumberOfPackages The number of HII packages to register.
@param GuidId Package List GUID ID.
@param HiiHandle The ID used to retrieve the Package List later.
@param ... The variable argument list describing all HII Package.
@return
The allocated and initialized packages.
**/
EFI_HII_PACKAGE_LIST_HEADER *
EFI_STATUS
EFIAPI
PreparePackages (
IN CONST UINTN NumberOfPackages,
IN CONST EFI_GUID *Guid OPTIONAL,
HiiLibAddPackagesToHiiDatabase (
IN UINTN NumberOfPackages,
IN CONST EFI_GUID *GuidId,
IN EFI_HANDLE DriverHandle, OPTIONAL
OUT EFI_HII_HANDLE *HiiHandle, OPTIONAL
...
);
)
;
EFI_STATUS
EFIAPI
HiiLibAddFontPackageToHiiDatabase (
IN UINTN FontSize,
IN CONST UINT8 *FontBinary,
IN CONST EFI_GUID *GuidId,
OUT EFI_HII_HANDLE *HiiHandle OPTIONAL
)
;
EFI_STATUS
EFIAPI
HiiLibRemovePackagesFromHiiDatabase (
IN EFI_HII_HANDLE HiiHandle
)
;
/**
This function adds the string into String Package of each language.
@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_NOT_FOUND The specified PackageList could not be found in
database.
@retval EFI_OUT_OF_RESOURCES Could not add the string due to lack of resources.
@retval EFI_INVALID_PARAMETER String is NULL or StringId is NULL is NULL.
**/
EFI_STATUS
EFIAPI
HiiLibCreateString (
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.
@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_NOT_FOUND The specified PackageList could not be found in
database.
@retval EFI_OUT_OF_RESOURCES Could not add the string due to lack of resources.
@retval EFI_INVALID_PARAMETER String is NULL or StringId is NULL is NULL.
**/
EFI_STATUS
EFIAPI
HiiLibUpdateString (
IN EFI_HII_HANDLE PackageList,
IN EFI_STRING_ID StringId,
IN CONST EFI_STRING String
)
;
//
// Just use the UEFI prototype
//
EFI_STATUS
EFIAPI
HiiLibGetStringFromGuidId (
IN EFI_GUID *ProducerGuid,
IN EFI_STRING_ID StringId,
OUT EFI_STRING *String
)
;
//
// This function is Implementation Specifc. HII_VENDOR_DEVICE_PATH
// This should be moved to MdeModulepkg.
//
EFI_STATUS
EFIAPI
HiiLibCreateHiiDriverHandle (
OUT EFI_HANDLE *DriverHandle
)
;
EFI_STATUS
EFIAPI
HiiLibDestroyHiiDriverHandle (
IN EFI_HANDLE DriverHandle
)
;
EFI_STATUS
HiiLibExtractClassFromHiiHandle (
IN EFI_HII_HANDLE Handle,
OUT UINT16 *Class,
OUT EFI_STRING_ID *FormSetTitle,
OUT EFI_STRING_ID *FormSetHelp
)
/*++
Routine Description:
Extract formset class for given HII handle.
Arguments:
HiiHandle - Hii handle
Class - Class of the formset
FormSetTitle - Formset title string
FormSetHelp - Formset help string
Returns:
EFI_SUCCESS - Successfully extract Class for specified Hii handle.
--*/
;
#endif

File diff suppressed because it is too large Load Diff

View File

@ -617,4 +617,10 @@ FreeAlignedPool (
IN VOID *Buffer
);
VOID
EFIAPI
SafeFreePool (
IN VOID *Buffer
);
#endif

View File

@ -207,9 +207,9 @@ typedef struct {
#define MSG_SATA_DP 0x12
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT16 HbaPortNumber;
UINT16 PortMultiplierPort;
UINT16 LogicalUnitNumber;
UINT16 HBAPortNumber;
UINT16 PortMultiplierPortNumber;
UINT16 Lun;
} SATA_DEVICE_PATH;
#define MSG_I2O_DP 0x06

View File

@ -17,11 +17,8 @@
#ifndef __EFI_FORM_BROWSER_H__
#define __EFI_FORM_BROWSER_H__
#error "UEFI 2.1 HII is not fully implemented for now, Please don't include this file now."
#define EFI_FORM_BROWSER2_PROTOCOL_GUID \
{ 0xe5a1333e, 0xe1b4, 0x4e55, { 0xce, 0xeb, 0x35, 0xc3, 0xef, 0x13, 0x34, 0x43 } }
{0xb9d4c360, 0xbcfb, 0x4f9b, {0x92, 0x98, 0x53, 0xc1, 0x36, 0x98, 0x22, 0x58 }}
typedef struct _EFI_FORM_BROWSER2_PROTOCOL EFI_FORM_BROWSER2_PROTOCOL;
@ -54,10 +51,10 @@ typedef struct {
typedef UINTN EFI_BROWSER_ACTION_REQUEST;
#define EFI_BROWSER_ACTION_NONE 0
#define EFI_BROWSER_ACTION_RESET 1
#define EFI_BROWSER_ACTION_SUMBIT 2
#define EFI_BROWSER_ACTION_EXIT 3
#define EFI_BROWSER_ACTION_REQUEST_NONE 0
#define EFI_BROWSER_ACTION_REQUEST_RESET 1
#define EFI_BROWSER_ACTION_REQUEST_SUBMIT 2
#define EFI_BROWSER_ACTION_REQUEST_EXIT 3
/**
@ -67,7 +64,7 @@ typedef UINTN EFI_BROWSER_ACTION_REQUEST;
the browser to use a variety of passed-in information or
primarily use the HII database as the source of information.
@param This A pointer to the EFI_FORM_BROWSER_PROTOCOL
@param This A pointer to the EFI_FORM_BROWSER2_PROTOCOL
instance.
@param Handle A pointer to an array of HII handles to
@ -121,12 +118,12 @@ typedef UINTN EFI_BROWSER_ACTION_REQUEST;
typedef
EFI_STATUS
(EFIAPI *EFI_SEND_FORM2) (
IN CONST EFI_FORM_BROWSER_PROTOCOL *This,
IN CONST EFI_HII_HANDLE *Handle,
IN CONST UINTN HandleCount,
IN CONST BOOLEAN SingleUse,
IN CONST EFI_FORM_BROWSER2_PROTOCOL *This,
IN EFI_HII_HANDLE *Handle,
IN UINTN HandleCount,
IN EFI_GUID *FormSetGuid, OPTIONAL
IN EFI_FORM_ID FormId, OPTIONAL
IN CONST EFI_SCREEN_DESCRIPTOR *ScreenDimensions, OPTIONAL
OUT BOOLEAN *ResetRequired OPTIONAL
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest OPTIONAL
);
@ -137,7 +134,7 @@ EFI_STATUS
browser. This routine called this service in the browser to
retrieve or set certain uncommitted state information.
@param This A pointer to the EFI_FORM_BROWSER_PROTOCOL
@param This A pointer to the EFI_FORM_BROWSER2_PROTOCOL
instance.
@param ResultsDataSize A pointer to the size of the buffer
@ -172,7 +169,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_BROWSER_CALLBACK2 ) (
IN CONST EFI_FORM_BROWSER_PROTOCOL *This,
IN CONST EFI_FORM_BROWSER2_PROTOCOL *This,
IN OUT UINTN *ResultsDataSize,
IN OUT EFI_STRING ResultsData,
IN CONST BOOLEAN RetrieveData,
@ -213,4 +210,3 @@ extern EFI_GUID gEfiFormBrowser2ProtocolGuid;
#endif

View File

@ -19,13 +19,18 @@
#ifndef __EFI_HII_CONFIG_ACCESS_H__
#define __EFI_HII_CONFIG_ACCESS_H__
#error "UEFI 2.1 HII is not fully implemented for now, Please don't include this file now."
#include <Protocol/FormBrowser2.h>
#define EFI_HII_CONFIG_ACCESS_PROTOCOL_GUID \
{ 0x330d4706, 0xf2a0, 0x4e4f, { 0xa3, 0x69, 0xb6, 0x6f, 0xa8, 0xd5, 0x43, 0x85 } }
typedef struct _EFI_HII_CONFIG_ACCESS_PROTOCOL EFI_HII_CONFIG_ACCESS_PROTOCOL;
typedef UINTN EFI_BROWSER_ACTION;
#define EFI_BROWSER_ACTION_CHANGING 0
#define EFI_BROWSER_ACTION_CHANGED 1
/**
This function allows the caller to request the current
@ -235,3 +240,4 @@ extern EFI_GUID gEfiHiiConfigAccessProtocolGuid;
#endif

View File

@ -19,8 +19,6 @@
#ifndef __HII_CONFIG_ROUTING_H__
#define __HII_CONFIG_ROUTING_H__
#error "UEFI 2.1 HII is not fully implemented for now, Please don't include this file now."
#define EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID \
{ 0x587e72d7, 0xcc50, 0x4f79, { 0x82, 0x09, 0xca, 0x29, 0x1f, 0xc1, 0xa1, 0x0f } }
@ -112,7 +110,7 @@ typedef
EFI_STATUS
(EFIAPI * EFI_HII_ROUTING_EXTRACT_CONFIG ) (
IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
IN CONST EFI_STRING *Request,
IN CONST EFI_STRING Request,
OUT EFI_STRING *Progress,
OUT EFI_STRING *Results
);
@ -278,7 +276,7 @@ EFI_STATUS
IN CONST EFI_STRING ConfigRequest,
IN CONST UINT8 *Block,
IN CONST UINTN BlockSize,
OUT EFI_STRING **Config,
OUT EFI_STRING *Config,
OUT EFI_STRING *Progress
);
@ -334,12 +332,62 @@ typedef
EFI_STATUS
(EFIAPI * EFI_HII_ROUTING_CONFIG_TO_BLOCK ) (
IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
IN CONST EFI_STRING *ConfigResp,
IN CONST UINT8 *Block,
IN CONST EFI_STRING ConfigResp,
IN OUT UINT8 *Block,
IN OUT UINTN *BlockSize,
OUT EFI_STRING *Progress
);
typedef
EFI_STATUS
(EFIAPI * EFI_HII_GET_ALT_CFG) (
IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
IN CONST EFI_STRING Configuration,
IN CONST EFI_GUID *Guid,
IN CONST EFI_STRING Name,
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN CONST UINT16 *AltCfgId,
OUT EFI_STRING *AltCfgResp
)
/*++
Routine Description:
This helper function is to be called by drivers to extract portions of
a larger configuration string.
Arguments:
This - A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.
Configuration - A null-terminated Unicode string in <MultiConfigAltResp> format.
Guid - A pointer to the GUID value to search for in the
routing portion of the ConfigResp string when retrieving
the requested data. If Guid is NULL, then all GUID
values will be searched for.
Name - A pointer to the NAME value to search for in the
routing portion of the ConfigResp string when retrieving
the requested data. If Name is NULL, then all Name
values will be searched for.
DevicePath - A pointer to the PATH value to search for in the
routing portion of the ConfigResp string when retrieving
the requested data. If DevicePath is NULL, then all
DevicePath values will be searched for.
AltCfgId - A pointer to the ALTCFG value to search for in the
routing portion of the ConfigResp string when retrieving
the requested data. If this parameter is NULL,
then the current setting will be retrieved.
AltCfgResp - A pointer to a buffer which will be allocated by the
function which contains the retrieved string as requested.
This buffer is only allocated if the call was successful.
Returns:
EFI_SUCCESS - The request succeeded. The requested data was extracted
and placed in the newly allocated AltCfgResp buffer.
EFI_OUT_OF_RESOURCES - Not enough memory to allocate AltCfgResp.
EFI_INVALID_PARAMETER - Any parameter is invalid.
EFI_NOT_FOUND - Target for the specified routing data was not found.
--*/
;
/**
@ -354,6 +402,7 @@ struct _EFI_HII_CONFIG_ROUTING_PROTOCOL {
EFI_HII_ROUTING_ROUTE_CONFIG RouteConfig;
EFI_HII_ROUTING_BLOCK_TO_CONFIG BlockToConfig;
EFI_HII_ROUTING_CONFIG_TO_BLOCK ConfigToBlock;
EFI_HII_GET_ALT_CFG GetAltConfig;
};
extern EFI_GUID gEfiHiiConfigRoutingProtocolGuid;

File diff suppressed because it is too large Load Diff

View File

@ -18,8 +18,6 @@
#include <Protocol/GraphicsOutput.h>
#include <Protocol/HiiImage.h>
#error "UEFI 2.1 HII is not fully implemented for now, Please don't include this file now."
#define EFI_HII_FONT_PROTOCOL_GUID \
{ 0xe9ca4775, 0x8657, 0x47fc, { 0x97, 0xe7, 0x7e, 0xd6, 0x5a, 0x8, 0x43, 0x24 } }
@ -264,12 +262,12 @@ typedef
EFI_STATUS
(EFIAPI *EFI_HII_STRING_TO_IMAGE) (
IN CONST EFI_HII_FONT_PROTOCOL *This,
IN CONST EFI_HII_OUT_FLAGS Flags,
IN EFI_HII_OUT_FLAGS Flags,
IN CONST EFI_STRING String,
IN CONST EFI_FONT_DISPLAY_INFO *StringInfo,
IN OUT EFI_IMAGE_OUTPUT **Blt,
IN CONST UINTN BltX,
IN CONST UINTN BltY,
IN UINTN BltX,
IN UINTN BltY,
OUT EFI_HII_ROW_INFO **RowInfoArray OPTIONAL,
OUT UINTN *RowInfoArraySize OPTIONAL,
OUT UINTN *ColumnInfoArray OPTIONAL
@ -396,14 +394,14 @@ typedef
EFI_STATUS
(EFIAPI *EFI_HII_STRING_ID_TO_IMAGE) (
IN CONST EFI_HII_FONT_PROTOCOL *This,
IN CONST EFI_HII_OUT_FLAGS Flags,
IN CONST EFI_HII_HANDLE PackageList,
IN CONST EFI_STRING_ID StringId,
IN EFI_HII_OUT_FLAGS Flags,
IN EFI_HII_HANDLE PackageList,
IN EFI_STRING_ID StringId,
IN CONST CHAR8 *Language,
IN CONST EFI_FONT_DISPLAY_INFO *StringInfo OPTIONAL,
IN OUT EFI_IMAGE_OUTPUT **Blt,
IN CONST UINTN BltX,
IN CONST UINTN BltY,
IN UINTN BltX,
IN UINTN BltY,
OUT EFI_HII_ROW_INFO **RowInfoArray OPTIONAL,
OUT UINTN *RowInfoArraySize OPTIONAL,
OUT UINTN *ColumnInfoArray OPTIONAL

View File

@ -15,8 +15,6 @@
#ifndef __HII_IMAGE_H__
#define __HII_IMAGE_H__
#error "UEFI 2.1 HII is not fully implemented for now, Please don't include this file now."
#define EFI_HII_IMAGE_PROTOCOL_GUID \
{ 0x31a6406a, 0x6bdf, 0x4e46, { 0xb2, 0xa2, 0xeb, 0xaa, 0x89, 0xc4, 0x9, 0x20 } }
@ -47,10 +45,10 @@ typedef struct _EFI_HII_IMAGE_PROTOCOL EFI_HII_IMAGE_PROTOCOL;
**/
typedef struct _EFI_IMAGE_INPUT {
UINT32 Flags;
UINT16 Width;
UINT16 Height;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Bitmap;
UINT32 Flags;
UINT16 Width;
UINT16 Height;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Bitmap[1];
} EFI_IMAGE_INPUT;
@ -83,7 +81,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_HII_NEW_IMAGE) (
IN CONST EFI_HII_IMAGE_PROTOCOL *This,
IN CONST EFI_HII_HANDLE PackageList,
IN EFI_HII_HANDLE PackageList,
OUT EFI_IMAGE_ID *ImageId,
IN CONST EFI_IMAGE_INPUT *Image
);
@ -133,8 +131,8 @@ typedef
EFI_STATUS
(EFIAPI *EFI_HII_GET_IMAGE) (
IN CONST EFI_HII_IMAGE_PROTOCOL *This,
IN CONST EFI_HII_HANDLE PackageList,
IN CONST EFI_IMAGE_ID ImageId,
IN EFI_HII_HANDLE PackageList,
IN EFI_IMAGE_ID ImageId,
OUT EFI_IMAGE_INPUT *Image,
OUT UINTN *ImageSize
);
@ -168,9 +166,9 @@ typedef
EFI_STATUS
(EFIAPI *EFI_HII_SET_IMAGE) (
IN CONST EFI_HII_IMAGE_PROTOCOL *This,
IN CONST EFI_HII_HANDLE PackageList,
IN CONST EFI_IMAGE_ID ImageId,
IN CONST EFI_IMAGE_INPUT Image
IN EFI_HII_HANDLE PackageList,
IN EFI_IMAGE_ID ImageId,
IN CONST EFI_IMAGE_INPUT *Image
);
@ -264,11 +262,11 @@ typedef
EFI_STATUS
(EFIAPI *EFI_HII_DRAW_IMAGE) (
IN CONST EFI_HII_IMAGE_PROTOCOL *This,
IN CONST EFI_HII_DRAW_FLAGS Flags,
IN CONST EFI_IMAGE_INPUT Image,
IN EFI_HII_DRAW_FLAGS Flags,
IN CONST EFI_IMAGE_INPUT *Image,
IN OUT EFI_IMAGE_OUTPUT **Blt,
IN CONST UINTN BltX,
IN CONST UINTN BltY
IN UINTN BltX,
IN UINTN BltY
);
/**
@ -342,12 +340,12 @@ typedef
EFI_STATUS
(EFIAPI *EFI_HII_DRAW_IMAGE_ID) (
IN CONST EFI_HII_IMAGE_PROTOCOL *This,
IN CONST EFI_HII_DRAW_FLAGS Flags,
IN CONST EFI_HII_HANDLE PackageList,
IN CONST EFI_IMAGE_ID ImageId,
IN EFI_HII_DRAW_FLAGS Flags,
IN EFI_HII_HANDLE PackageList,
IN EFI_IMAGE_ID ImageId,
IN OUT EFI_IMAGE_OUTPUT **Blt,
IN CONST UINTN BltX,
IN CONST UINTN BltY
IN UINTN BltX,
IN UINTN BltY
);
@ -379,3 +377,4 @@ extern EFI_GUID gEfiHiiImageProtocolGuid;
#endif

View File

@ -15,11 +15,12 @@
#ifndef __HII_STRING_H__
#define __HII_STRING_H__
#error "UEFI 2.1 HII is not fully implemented for now, Please don't include this file now."
#define EFI_HII_STRING_PROTOCOL_GUID \
{ 0xfd96974, 0x23aa, 0x4cdc, { 0xb9, 0xcb, 0x98, 0xd1, 0x77, 0x50, 0x32, 0x2a } }
#include <Protocol/HiiDatabase.h>
#include <Protocol/HiiFont.h>
typedef struct _EFI_HII_STRING_PROTOCOL EFI_HII_STRING_PROTOCOL;
@ -59,11 +60,12 @@ typedef
EFI_STATUS
(EFIAPI *EFI_HII_NEW_STRING) (
IN CONST EFI_HII_STRING_PROTOCOL *This,
IN CONST EFI_HII_HANDLE PackageList,
OUT EFI_STRING_ID *StringId
IN EFI_HII_HANDLE PackageList,
OUT EFI_STRING_ID *StringId,
IN CONST CHAR8 *Language,
IN CONST CHAR16 *LanguageName, OPTIONAL
IN CONST EFI_STRING String,
IN CONST EFI_FONT_INFO *StringFontInfo OPTIONAL,
IN CONST EFI_FONT_INFO *StringFontInfo OPTIONAL
);
@ -124,11 +126,11 @@ EFI_STATUS
(EFIAPI *EFI_HII_GET_STRING) (
IN CONST EFI_HII_STRING_PROTOCOL *This,
IN CONST CHAR8 *Language,
IN CONST EFI_HII_HANDLE PackageList,
IN CONST EFI_STRING_ID StringId,
IN EFI_HII_HANDLE PackageList,
IN EFI_STRING_ID StringId,
OUT EFI_STRING String,
IN OUT UINTN StringSize,
OUT EFI_FONT_INFO *StringFontInfo OPTIONAL
IN OUT UINTN *StringSize,
OUT EFI_FONT_INFO **StringFontInfo OPTIONAL
);
/**
@ -168,10 +170,10 @@ typedef
EFI_STATUS
(EFIAPI *EFI_HII_SET_STRING) (
IN CONST EFI_HII_STRING_PROTOCOL *This,
IN CONST EFI_HII_HANDLE PackageList,
IN CONST EFI_STRING_ID StringId,
IN EFI_HII_HANDLE PackageList,
IN EFI_STRING_ID StringId,
IN CONST CHAR8 *Language,
IN CONST EFI_STRING String,
IN EFI_STRING String,
IN CONST EFI_FONT_INFO *StringFontInfo OPTIONAL
);
@ -208,10 +210,10 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_HII_GET_LANGUAGES) (
IN CONST EFI_HII_DATABASE_PROTOCOL *This,
IN CONST EFI_HII_HANDLE PackageList,
IN CONST EFI_HII_STRING_PROTOCOL *This,
IN EFI_HII_HANDLE PackageList,
IN OUT CHAR8 *Languages,
IN OUT UINTN LanguagesSize
IN OUT UINTN *LanguagesSize
);
@ -263,12 +265,12 @@ EFI_STATUS
**/
typedef
EFI_STATUS
(EFIAPI *EFI_GET_2ND_LANGUAGES) (
IN CONST EFI_HII_DATABASE_PROTOCOL *This,
IN CONST EFI_HII_HANDLE PackageList,
IN CONST CHAR8 *FirstLanguage;
(EFIAPI *EFI_HII_GET_2ND_LANGUAGES) (
IN CONST EFI_HII_STRING_PROTOCOL *This,
IN EFI_HII_HANDLE PackageList,
IN CONST CHAR8 *FirstLanguage,
IN OUT CHAR8 *SecondLanguages,
IN OUT UINTN SecondLanguagesSize
IN OUT UINTN *SecondLanguagesSize
);
@ -301,3 +303,4 @@ extern EFI_GUID gEfiHiiStringProtocolGuid;
#endif

View File

@ -34,7 +34,6 @@ typedef UINTN EFI_TPL;
typedef UINT64 EFI_LBA;
typedef UINT16 EFI_HII_HANDLE;
typedef UINT16 STRING_REF;
typedef UINT64 EFI_PHYSICAL_ADDRESS;

File diff suppressed because it is too large Load Diff

View File

@ -1077,3 +1077,17 @@ FreeAlignedPool (
Status = gBS->FreePool (RawAddress);
ASSERT_EFI_ERROR (Status);
}
VOID
EFIAPI
SafeFreePool (
IN VOID *Buffer
)
{
if (Buffer != NULL) {
FreePool (Buffer);
Buffer = NULL;
}
}

View File

@ -15,33 +15,785 @@
#include <PiDxe.h>
#include <Protocol/HiiDatabase.h>
#include <Protocol/HiiString.h>
#include <Protocol/DevicePath.h>
#include <Guid/GlobalVariable.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/HiiLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/PcdLib.h>
/**
This function allocates pool for an EFI_HII_PACKAGES structure
with enough space for the variable argument list of package pointers.
The allocated structure is initialized using NumberOfPackages, Guid,
and the variable length argument list of package pointers.
#include <MdeModuleHii.h>
@param NumberOfPackages The number of HII packages to prepare.
@param Guid Package GUID.
#include "InternalHiiLib.h"
@return The allocated and initialized packages.
**/
EFI_HII_DATABASE_PROTOCOL *mHiiDatabaseProt;
EFI_HII_STRING_PROTOCOL *mHiiStringProt;
//
// Hii vendor device path template
//
HII_VENDOR_DEVICE_PATH mHiiVendorDevicePathTemplate = {
{
{
{
HARDWARE_DEVICE_PATH,
HW_VENDOR_DP,
{
(UINT8) (sizeof (HII_VENDOR_DEVICE_PATH_NODE)),
(UINT8) ((sizeof (HII_VENDOR_DEVICE_PATH_NODE)) >> 8)
}
},
EFI_IFR_TIANO_GUID
},
0
},
{
END_DEVICE_PATH_TYPE,
END_ENTIRE_DEVICE_PATH_SUBTYPE,
{
END_DEVICE_PATH_LENGTH
}
}
};
EFI_STATUS
EFIAPI
UefiHiiLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
Status = gBS->LocateProtocol (
&gEfiHiiDatabaseProtocolGuid,
NULL,
(VOID **) &mHiiDatabaseProt
);
ASSERT_EFI_ERROR (Status);
ASSERT (mHiiDatabaseProt != NULL);
Status = gBS->LocateProtocol (
&gEfiHiiStringProtocolGuid,
NULL,
(VOID **) &mHiiStringProt
);
ASSERT_EFI_ERROR (Status);
ASSERT (mHiiStringProt != NULL);
return EFI_SUCCESS;
}
EFI_STATUS
HiiLibGetCurrentLanguage (
OUT CHAR8 *Lang
)
/*++
Routine Description:
Determine what is the current language setting
Arguments:
Lang - Pointer of system language
Returns:
Status code
--*/
{
EFI_STATUS Status;
UINTN Size;
//
// Get current language setting
//
Size = RFC_3066_ENTRY_SIZE;
Status = gRT->GetVariable (
L"PlatformLang",
&gEfiGlobalVariableGuid,
NULL,
&Size,
Lang
);
if (EFI_ERROR (Status)) {
AsciiStrCpy (Lang, (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLang));
}
return Status;
}
VOID
HiiLibGetNextLanguage (
IN OUT CHAR8 **LangCode,
OUT CHAR8 *Lang
)
/*++
Routine Description:
Get next language from language code list (with separator ';').
Arguments:
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.
Lang - The first language in the list.
Returns:
None.
--*/
{
UINTN Index;
CHAR8 *StringPtr;
if (LangCode == NULL || *LangCode == NULL) {
*Lang = 0;
return;
}
Index = 0;
StringPtr = *LangCode;
while (StringPtr[Index] != 0 && StringPtr[Index] != ';') {
Index++;
}
CopyMem (Lang, StringPtr, Index);
Lang[Index] = 0;
if (StringPtr[Index] == ';') {
Index++;
}
*LangCode = StringPtr + Index;
}
CHAR8 *
HiiLibGetSupportedLanguages (
IN EFI_HII_HANDLE HiiHandle
)
/*++
Routine Description:
This function returns the list of supported languages, in the format specified
in UEFI specification Appendix M.
Arguments:
HiiHandle - The HII package list handle.
Returns:
The supported languages.
--*/
{
EFI_STATUS Status;
UINTN BufferSize;
CHAR8 *LanguageString;
//
// Collect current supported Languages for given HII handle
//
BufferSize = 0x1000;
LanguageString = AllocatePool (BufferSize);
Status = mHiiStringProt->GetLanguages (mHiiStringProt, HiiHandle, LanguageString, &BufferSize);
if (Status == EFI_BUFFER_TOO_SMALL) {
gBS->FreePool (LanguageString);
LanguageString = AllocatePool (BufferSize);
Status = mHiiStringProt->GetLanguages (mHiiStringProt, HiiHandle, LanguageString, &BufferSize);
}
if (EFI_ERROR (Status)) {
LanguageString = NULL;
}
return LanguageString;
}
UINT16
HiiLibGetSupportedLanguageNumber (
IN EFI_HII_HANDLE HiiHandle
)
/*++
Routine Description:
This function returns the number of supported languages
Arguments:
HiiHandle - The HII package list handle.
Returns:
The number of supported languages.
--*/
{
CHAR8 *Languages;
CHAR8 *LanguageString;
UINT16 LangNumber;
CHAR8 Lang[RFC_3066_ENTRY_SIZE];
Languages = HiiLibGetSupportedLanguages (HiiHandle);
if (Languages == NULL) {
return 0;
}
LangNumber = 0;
LanguageString = Languages;
while (*LanguageString != 0) {
HiiLibGetNextLanguage (&LanguageString, Lang);
LangNumber++;
}
gBS->FreePool (Languages);
return LangNumber;
}
EFI_HII_PACKAGE_LIST_HEADER *
InternalHiiLibPreparePackages (
IN UINTN NumberOfPackages,
IN CONST EFI_GUID *GuidId, OPTIONAL
VA_LIST Marker
)
{
EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
UINT8 *PackageListData;
UINT32 PackageListLength;
UINT32 PackageLength;
EFI_HII_PACKAGE_HEADER PackageHeader;
UINT8 *PackageArray;
UINTN Index;
VA_LIST MarkerBackup;
PackageListLength = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
MarkerBackup = Marker;
for (Index = 0; Index < NumberOfPackages; Index++) {
CopyMem (&PackageLength, VA_ARG (Marker, VOID *), sizeof (UINT32));
PackageListLength += (PackageLength - sizeof (UINT32));
}
//
// Include the lenght of EFI_HII_PACKAGE_END
//
PackageListLength += sizeof (EFI_HII_PACKAGE_HEADER);
PackageListHeader = AllocateZeroPool (PackageListLength);
ASSERT (PackageListHeader != NULL);
CopyMem (&PackageListHeader->PackageListGuid, GuidId, sizeof (EFI_GUID));
PackageListHeader->PackageLength = PackageListLength;
PackageListData = ((UINT8 *) PackageListHeader) + sizeof (EFI_HII_PACKAGE_LIST_HEADER);
Marker = MarkerBackup;
for (Index = 0; Index < NumberOfPackages; Index++) {
PackageArray = (UINT8 *) VA_ARG (Marker, VOID *);
CopyMem (&PackageLength, PackageArray, sizeof (UINT32));
PackageLength -= sizeof (UINT32);
PackageArray += sizeof (UINT32);
CopyMem (PackageListData, PackageArray, PackageLength);
PackageListData += PackageLength;
}
//
// Append EFI_HII_PACKAGE_END
//
PackageHeader.Type = EFI_HII_PACKAGE_END;
PackageHeader.Length = sizeof (EFI_HII_PACKAGE_HEADER);
CopyMem (PackageListData, &PackageHeader, PackageHeader.Length);
return PackageListHeader;
}
EFI_HII_PACKAGE_LIST_HEADER *
EFIAPI
PreparePackages (
IN CONST UINTN NumberOfPackages,
IN CONST EFI_GUID *Guid OPTIONAL,
HiiLibPreparePackageList (
IN UINTN NumberOfPackages,
IN CONST EFI_GUID *GuidId,
...
)
/*++
Routine Description:
Assemble EFI_HII_PACKAGE_LIST according to the passed in packages.
Arguments:
NumberOfPackages - Number of packages.
GuidId - Package GUID.
Returns:
Pointer of EFI_HII_PACKAGE_LIST_HEADER.
--*/
{
EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
VA_LIST Marker;
VA_START (Marker, GuidId);
PackageListHeader = InternalHiiLibPreparePackages (NumberOfPackages, GuidId, Marker);
VA_END (Marker);
return PackageListHeader;
}
/**
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.
@param NumberOfPackages The number of HII packages to register.
@param GuidId Package List GUID ID.
@param HiiHandle The ID used to retrieve the Package List later.
@param ... The variable argument list describing all HII Package.
@return
The allocated and initialized packages.
**/
EFI_STATUS
EFIAPI
HiiLibAddPackagesToHiiDatabase (
IN UINTN NumberOfPackages,
IN CONST EFI_GUID *GuidId,
IN EFI_HANDLE DriverHandle, OPTIONAL
OUT EFI_HII_HANDLE *HiiHandle, OPTIONAL
...
)
{
//
// BugBug: Need more detail on UEFI spec.
//
ASSERT (FALSE);
return NULL;
VA_LIST Args;
EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
EFI_STATUS Status;
VA_START (Args, HiiHandle);
PackageListHeader = InternalHiiLibPreparePackages (NumberOfPackages, GuidId, Args);
Status = mHiiDatabaseProt->NewPackageList (mHiiDatabaseProt, PackageListHeader, DriverHandle, HiiHandle);
if (HiiHandle != NULL) {
if (EFI_ERROR (Status)) {
*HiiHandle = NULL;
}
}
FreePool (PackageListHeader);
VA_END (Args);
return Status;
}
EFI_STATUS
EFIAPI
HiiLibAddFontPackageToHiiDatabase (
IN UINTN FontSize,
IN CONST UINT8 *FontBinary,
IN CONST EFI_GUID *GuidId,
OUT EFI_HII_HANDLE *HiiHandle OPTIONAL
)
{
EFI_STATUS Status;
UINT8 *Location;
EFI_HII_SIMPLE_FONT_PACKAGE_HDR *SimplifiedFont;
UINTN PackageLength;
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
UINT8 *Package;
//
// Add 4 bytes to the header for entire length for PreparePackageList use only.
// Looks ugly. Might be updated when font tool is ready.
//
PackageLength = sizeof (EFI_HII_SIMPLE_FONT_PACKAGE_HDR) + FontSize + 4;
Package = AllocateZeroPool (PackageLength);
if (Package == NULL) {
return EFI_OUT_OF_RESOURCES;
}
CopyMem (Package, &PackageLength, 4);
SimplifiedFont = (EFI_HII_SIMPLE_FONT_PACKAGE_HDR*) (Package + 4);
SimplifiedFont->Header.Length = (UINT32) (PackageLength - 4);
SimplifiedFont->Header.Type = EFI_HII_PACKAGE_SIMPLE_FONTS;
SimplifiedFont->NumberOfNarrowGlyphs = (UINT16) (FontSize / sizeof (EFI_NARROW_GLYPH));
Location = (UINT8 *) (&SimplifiedFont->NumberOfWideGlyphs + 1);
CopyMem (Location, FontBinary, FontSize);
//
// Add this simplified font package to a package list then install it.
//
PackageList = HiiLibPreparePackageList (1, GuidId, Package);
Status = mHiiDatabaseProt->NewPackageList (mHiiDatabaseProt, PackageList, NULL, HiiHandle);
ASSERT_EFI_ERROR (Status);
SafeFreePool (PackageList);
SafeFreePool (Package);
return EFI_SUCCESS;
}
EFI_STATUS
EFIAPI
HiiLibRemovePackagesFromHiiDatabase (
IN EFI_HII_HANDLE HiiHandle
)
{
return mHiiDatabaseProt->RemovePackageList (mHiiDatabaseProt, HiiHandle);
}
EFI_STATUS
EFIAPI
HiiLibCreateString (
IN EFI_HII_HANDLE PackageList,
OUT EFI_STRING_ID *StringId,
IN CONST EFI_STRING String
)
{
EFI_STATUS Status;
CHAR8 *Languages;
CHAR8 *LangStrings;
CHAR8 Lang[RFC_3066_ENTRY_SIZE];
Status = EFI_SUCCESS;
Languages = HiiLibGetSupportedLanguages (PackageList);
LangStrings = Languages;
while (*LangStrings != 0) {
HiiLibGetNextLanguage (&LangStrings, Lang);
Status = mHiiStringProt->NewString (
mHiiStringProt,
PackageList,
StringId,
Lang,
NULL,
String,
NULL
);
if (EFI_ERROR (Status)) {
break;
}
}
FreePool (Languages);
return Status;
}
EFI_STATUS
EFIAPI
HiiLibUpdateString (
IN EFI_HII_HANDLE PackageList,
IN EFI_STRING_ID StringId,
IN CONST EFI_STRING String
)
{
EFI_STATUS Status;
CHAR8 *Languages;
CHAR8 *LangStrings;
CHAR8 Lang[RFC_3066_ENTRY_SIZE];
Status = EFI_SUCCESS;
Languages = HiiLibGetSupportedLanguages (PackageList);
LangStrings = Languages;
while (*LangStrings != 0) {
HiiLibGetNextLanguage (&LangStrings, Lang);
Status = mHiiStringProt->SetString (
mHiiStringProt,
PackageList,
StringId,
Lang,
String,
NULL
);
if (EFI_ERROR (Status)) {
break;
}
}
FreePool (Languages);
return Status;
}
// //
// //////////////////////////////////////////////////
// //
//
// This function is Implementation Specifc. HII_VENDOR_DEVICE_PATH
// This should be moved to MdeModulepkg.
//
EFI_STATUS
EFIAPI
HiiLibCreateHiiDriverHandle (
OUT EFI_HANDLE *DriverHandle
)
{
EFI_STATUS Status;
HII_VENDOR_DEVICE_PATH_NODE *VendorDevicePath;
UINT64 MonotonicCount;
VendorDevicePath = AllocateCopyPool (sizeof (HII_VENDOR_DEVICE_PATH), &mHiiVendorDevicePathTemplate);
if (VendorDevicePath == NULL) {
return EFI_OUT_OF_RESOURCES;
}
gBS->GetNextMonotonicCount (&MonotonicCount);
VendorDevicePath->MonotonicCount = (UINT32) MonotonicCount;
*DriverHandle = NULL;
Status = gBS->InstallProtocolInterface (
DriverHandle,
&gEfiDevicePathProtocolGuid,
EFI_NATIVE_INTERFACE,
VendorDevicePath
);
if (EFI_ERROR (Status)) {
return Status;
}
return EFI_SUCCESS;
}
EFI_STATUS
EFIAPI
HiiLibDestroyHiiDriverHandle (
IN EFI_HANDLE DriverHandle
)
{
EFI_STATUS Status;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
Status = gBS->HandleProtocol (
DriverHandle,
&gEfiDevicePathProtocolGuid,
(VOID **) &DevicePath
);
if (EFI_ERROR (Status)) {
return Status;
}
Status = gBS->UninstallProtocolInterface (
DriverHandle,
&gEfiDevicePathProtocolGuid,
DevicePath
);
return Status;
}
EFI_STATUS
HiiLibExtractDefault(
IN VOID *Buffer,
IN UINTN *BufferSize,
UINTN Number,
...
)
/*++
Routine Description:
Configure the buffer accrording to ConfigBody strings.
Arguments:
DefaultId - the ID of default.
Buffer - the start address of buffer.
BufferSize - the size of buffer.
Number - the number of the strings.
Returns:
EFI_BUFFER_TOO_SMALL - the BufferSize is too small to operate.
EFI_INVALID_PARAMETER - Buffer is NULL or BufferSize is 0.
EFI_SUCCESS - Operation successful.
--*/
{
VA_LIST Args;
UINTN Index;
UINT32 TotalLen;
UINT8 *BufCfgArray;
UINT8 *BufferPos;
UINT16 Offset;
UINT16 Width;
UINT8 *Value;
if ((Buffer == NULL) || (BufferSize == NULL)) {
return EFI_INVALID_PARAMETER;
}
Offset = 0;
Width = 0;
Value = NULL;
VA_START (Args, Number);
for (Index = 0; Index < Number; Index++) {
BufCfgArray = (UINT8 *) VA_ARG (Args, VOID *);
CopyMem (&TotalLen, BufCfgArray, sizeof (UINT32));
BufferPos = BufCfgArray + sizeof (UINT32);
while ((UINT32)(BufferPos - BufCfgArray) < TotalLen) {
CopyMem (&Offset, BufferPos, sizeof (UINT16));
BufferPos += sizeof (UINT16);
CopyMem (&Width, BufferPos, sizeof (UINT16));
BufferPos += sizeof (UINT16);
Value = BufferPos;
BufferPos += Width;
if ((UINTN)(Offset + Width) > *BufferSize) {
return EFI_BUFFER_TOO_SMALL;
}
CopyMem ((UINT8 *)Buffer + Offset, Value, Width);
}
}
VA_END (Args);
*BufferSize = (UINTN)Offset;
return EFI_SUCCESS;
}
STATIC EFI_GUID mIfrVendorGuid = EFI_IFR_TIANO_GUID;
EFI_STATUS
HiiLibExtractClassFromHiiHandle (
IN EFI_HII_HANDLE Handle,
OUT UINT16 *Class,
OUT EFI_STRING_ID *FormSetTitle,
OUT EFI_STRING_ID *FormSetHelp
)
/*++
Routine Description:
Extract formset class for given HII handle.
Arguments:
HiiHandle - Hii handle
Class - Class of the formset
FormSetTitle - Formset title string
FormSetHelp - Formset help string
Returns:
EFI_SUCCESS - Successfully extract Class for specified Hii handle.
--*/
{
EFI_STATUS Status;
UINTN BufferSize;
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;
UINT8 *Package;
UINT8 *OpCodeData;
UINT32 Offset;
UINT32 Offset2;
UINT32 PackageListLength;
EFI_HII_PACKAGE_HEADER PackageHeader;
*Class = EFI_NON_DEVICE_CLASS;
*FormSetTitle = 0;
*FormSetHelp = 0;
//
// Locate HII Database protocol
//
Status = gBS->LocateProtocol (
&gEfiHiiDatabaseProtocolGuid,
NULL,
(VOID **) &HiiDatabase
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Get HII PackageList
//
BufferSize = 0;
HiiPackageList = NULL;
Status = HiiDatabase->ExportPackageLists (HiiDatabase, Handle, &BufferSize, HiiPackageList);
if (Status == EFI_BUFFER_TOO_SMALL) {
HiiPackageList = AllocatePool (BufferSize);
ASSERT (HiiPackageList != NULL);
Status = HiiDatabase->ExportPackageLists (HiiDatabase, Handle, &BufferSize, HiiPackageList);
}
if (EFI_ERROR (Status)) {
return Status;
}
//
// Get Form package from this HII package List
//
Offset = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
Offset2 = 0;
CopyMem (&PackageListLength, &HiiPackageList->PackageLength, sizeof (UINT32));
while (Offset < PackageListLength) {
Package = ((UINT8 *) HiiPackageList) + Offset;
CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));
if (PackageHeader.Type == EFI_HII_PACKAGE_FORM) {
//
// Search Class Opcode in this Form Package
//
Offset2 = sizeof (EFI_HII_PACKAGE_HEADER);
while (Offset2 < PackageHeader.Length) {
OpCodeData = Package + Offset2;
if (((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode == EFI_IFR_FORM_SET_OP) {
//
// Find FormSet OpCode
//
CopyMem (FormSetTitle, &((EFI_IFR_FORM_SET *) OpCodeData)->FormSetTitle, sizeof (EFI_STRING_ID));
CopyMem (FormSetHelp, &((EFI_IFR_FORM_SET *) OpCodeData)->Help, sizeof (EFI_STRING_ID));
}
if ((((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode == EFI_IFR_GUID_OP) &&
CompareGuid (&mIfrVendorGuid, (EFI_GUID *)(OpCodeData + sizeof (EFI_IFR_OP_HEADER))) &&
(((EFI_IFR_GUID_CLASS *) OpCodeData)->ExtendOpCode == EFI_IFR_EXTEND_OP_CLASS)
) {
//
// Find GUIDed Class OpCode
//
CopyMem (Class, &((EFI_IFR_GUID_CLASS *) OpCodeData)->Class, sizeof (UINT16));
//
// Till now, we ought to have found the formset Opcode
//
break;
}
Offset2 += ((EFI_IFR_OP_HEADER *) OpCodeData)->Length;
}
if (Offset2 < PackageHeader.Length) {
//
// Target formset found
//
break;
}
}
Offset += PackageHeader.Length;
}
gBS->FreePool (HiiPackageList);
return EFI_SUCCESS;
}

View File

@ -22,8 +22,9 @@
VERSION_STRING = 1.0
LIBRARY_CLASS = HiiLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x0002000A
CONSTRUCTOR = UefiHiiLibConstructor
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
@ -35,9 +36,27 @@
[Packages]
MdePkg/MdePkg.dec
#BugBug: This package dependency will be re-evaluated when the code become functional and stable.
# : HiiLibCreateHiiDriverHandle depends on HII_VENDOR_DEVICE_PATH which is defined by this
# : specification only.
MdeModulePkg/MdeModulePkg.dec
[LibraryClasses]
MemoryAllocationLib
DebugLib
PcdLib
UefiRuntimeServicesTableLib
[Protocols]
gEfiHiiDatabaseProtocolGuid # ALWAYS_CONSUMED
gEfiHiiStringProtocolGuid # ALWAYS_CONSUMED
gEfiDevicePathProtocolGuid
[Guids]
gEfiGlobalVariableGuid
[Depex]
gEfiHiiDatabaseProtocolGuid AND gEfiHiiStringProtocolGuid
[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang

View File

@ -0,0 +1,20 @@
/** @file
Internal include file for the HII Library instance.
Copyright (c) 2007, 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 __INTERNAL_HII_LIB_H__
#define __INTERNAL_HII_LIB_H__
#endif

View File

@ -1075,3 +1075,16 @@ FreeAlignedPool (
// PEI phase does not support to free pool, so leave it as NOP.
//
}
VOID
EFIAPI
SafeFreePool (
IN VOID *Buffer
)
{
//
// PEI phase does not support to free pool, so leave it as NOP.
//
}

View File

@ -83,7 +83,8 @@
BasePeCoffLib|Include/Library/PeCoffLib.h
GraphicsLib|Include/Library/GraphicsLib.h
ExtractGuidedSectionLib|Include/Library/ExtractGuidedSectionLib.h
IfrSupportLib|Include/Library/IfrSupportLib.h
[LibraryClasses.IPF]
SalLib|Include/Library/SalLib.h
PalCallLib|Include/Library/PalCallLib.h
@ -271,9 +272,14 @@
gPcdProtocolGuid = { 0x11B34006, 0xD85B, 0x4D0A, { 0xA2, 0x90, 0xD5, 0xA5, 0x71, 0x31, 0x0E, 0xF7 }}
gEfiTcgProtocolGuid = { 0xf541796d, 0xa62e, 0x4954, { 0xa7, 0x75, 0x95, 0x84, 0xf6, 0x1b, 0x9c, 0xdd }}
## BugBug: HII related protocols should be defined.
gEfiFormBrowser2ProtocolGuid = { 0xE5A1333E, 0xE1B4, 0x4D55, { 0xCE, 0xEB, 0x35, 0xC3, 0xEF, 0x13, 0x34, 0x43 }}
gEfiFormBrowserProtocolGuid = {0xE5A1333E, 0xE1B4, 0x4D55, {0xCE, 0xEB, 0x35, 0xC3, 0xEF, 0x13, 0x34, 0x43}}
gEfiFormBrowser2ProtocolGuid = {0xb9d4c360, 0xbcfb, 0x4f9b, {0x92, 0x98, 0x53, 0xc1, 0x36, 0x98, 0x22, 0x58}}
gEfiHiiStringProtocolGuid = {0x0fd96974, 0x23aa, 0x4cdc, {0xb9, 0xcb, 0x98, 0xd1, 0x77, 0x50, 0x32, 0x2a}}
gEfiHiiImageProtocolGuid = {0x31a6406a, 0x6bdf, 0x4e46, {0xb2, 0xa2, 0xeb, 0xaa, 0x89, 0xc4, 0x09, 0x20}}
gEfiHiiConfigRoutingProtocolGuid = {0x587e72d7, 0xcc50, 0x4f79, {0x82, 0x09, 0xca, 0x29, 0x1f, 0xc1, 0xa1, 0x0f}}
gEfiHiiDatabaseProtocolGuid = {0xef9fc172, 0xa1b2, 0x4693, {0xb3, 0x27, 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42}}
gEfiHiiFontProtocolGuid = {0xe9ca4775, 0x8657, 0x47fc, {0x97, 0xe7, 0x7e, 0xd6, 0x5a, 0x08, 0x43, 0x24}}
gEfiHiiConfigAccessProtocolGuid = {0x330d4706, 0xf2a0, 0x4e4f, {0xa3, 0x69, 0xb6, 0x6f, 0xa8, 0xd5, 0x43, 0x85}}
[PcdsFeatureFlag.common]
gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|FALSE|BOOLEAN|0x0000000d
@ -321,8 +327,8 @@
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultTimeout|0x0008|UINT16|0x0000001b
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangCodes|"engfra"|VOID*|0x0000001c
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLang|"eng"|VOID*|0x0000001d
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLangCodes|"en;fr"|VOID*|0x0000001e
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang|"en"|VOID*|0x0000001f
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLangCodes|"en-US;fr-FR"|VOID*|0x0000001e
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang|"en-US"|VOID*|0x0000001f
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200|UINT64|0x00000020
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits|8|UINT8|0x00000021
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity|1|UINT8|0x00000022
@ -359,8 +365,8 @@
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultTimeout|0x0008|UINT16|0x0000001b
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangCodes|"engfra"|VOID*|0x0000001c
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLang|"eng"|VOID*|0x0000001d
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLangCodes|"en;fr"|VOID*|0x0000001e
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang|"en"|VOID*|0x0000001f
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLangCodes|"en-US;fr-FR"|VOID*|0x0000001e
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang|"en-US"|VOID*|0x0000001f
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200|UINT64|0x00000020
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits|8|UINT8|0x00000021
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity|1|UINT8|0x00000022
@ -371,8 +377,8 @@
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultTimeout|0x0008|UINT16|0x0000001b
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangCodes|"engfra"|VOID*|0x0000001c
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLang|"eng"|VOID*|0x0000001d
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLangCodes|"en;fr"|VOID*|0x0000001e
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang|"en"|VOID*|0x0000001f
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLangCodes|"en-US;fr-FR"|VOID*|0x0000001e
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang|"en-US"|VOID*|0x0000001f
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200|UINT64|0x00000020
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits|8|UINT8|0x00000021
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity|1|UINT8|0x00000022

View File

@ -23,7 +23,6 @@
BUILD_TARGETS = DEBUG|RELEASE
SKUID_IDENTIFIER = DEFAULT
[PcdsFeatureFlag.common]
gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|FALSE
gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable|FALSE
@ -77,6 +76,7 @@
MdePkg/Library/DxePiLib/DxePiLib.inf
MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
MdePkg/Library/DxeSmbusLib/DxeSmbusLib.inf
MdePkg/Library/HiiLib/HiiLib.inf
MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.inf
MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
@ -105,6 +105,7 @@
MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf
MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
[Components.IA32]
MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf