Clean up HiiDatabase for Doxygen comments requirement.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5467 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12
2008-07-15 06:29:27 +00:00
parent 3afce7336e
commit e90b081afa
9 changed files with 356 additions and 308 deletions

View File

@ -25,19 +25,20 @@ Revision History
#include "HiiDatabase.h" #include "HiiDatabase.h"
#ifndef DISABLE_UNUSED_HII_PROTOCOLS #ifndef _DISABLE_UNUSED_HII_PROTOCOLS_
/** /**
Calculate the number of Unicode characters of the incoming Configuration string, Calculate the number of Unicode characters of the incoming Configuration string,
not including NULL terminator. not including NULL terminator.
This is a internal function.
@param String String in <MultiConfigRequest> or @param String String in <MultiConfigRequest> or
<MultiConfigResp> format. <MultiConfigResp> format.
@return The number of Unicode characters. @return The number of Unicode characters.
**/ **/
STATIC
UINTN UINTN
CalculateConfigStringLen ( CalculateConfigStringLen (
IN EFI_STRING String IN EFI_STRING String
@ -71,6 +72,8 @@ CalculateConfigStringLen (
Convert the hex UNICODE %02x encoding of a UEFI device path to binary Convert the hex UNICODE %02x encoding of a UEFI device path to binary
from <PathHdr> of <ConfigHdr>. from <PathHdr> of <ConfigHdr>.
This is a internal function.
@param String UEFI configuration string @param String UEFI configuration string
@param DevicePath binary of a UEFI device path. @param DevicePath binary of a UEFI device path.
@ -80,7 +83,6 @@ CalculateConfigStringLen (
binary format. binary format.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
GetDevicePath ( GetDevicePath (
IN EFI_STRING String, IN EFI_STRING String,
@ -143,6 +145,8 @@ GetDevicePath (
/** /**
Extract Storage from all Form Packages in current hii database. Extract Storage from all Form Packages in current hii database.
This is a internal function.
@param HiiDatabase EFI_HII_DATABASE_PROTOCOL instance. @param HiiDatabase EFI_HII_DATABASE_PROTOCOL instance.
@param StorageListHead Storage link List head. @param StorageListHead Storage link List head.
@ -151,7 +155,6 @@ GetDevicePath (
@retval EFI_SUCCESS All existing storage is exported. @retval EFI_SUCCESS All existing storage is exported.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
ExportAllStorage ( ExportAllStorage (
IN EFI_HII_DATABASE_PROTOCOL *HiiDatabase, IN EFI_HII_DATABASE_PROTOCOL *HiiDatabase,
@ -316,6 +319,8 @@ ExportAllStorage (
/** /**
Generate a sub string then output it. Generate a sub string then output it.
This is a internal function.
@param String A constant string which is the prefix of the to be @param String A constant string which is the prefix of the to be
generated string, e.g. GUID= generated string, e.g. GUID=
@param BufferLen The length of the Buffer in bytes. @param BufferLen The length of the Buffer in bytes.
@ -329,7 +334,6 @@ ExportAllStorage (
**/ **/
STATIC
VOID VOID
GenerateSubStr ( GenerateSubStr (
IN CONST EFI_STRING String, IN CONST EFI_STRING String,
@ -390,6 +394,8 @@ GenerateSubStr (
/** /**
Retrieve the <ConfigBody> from String then output it. Retrieve the <ConfigBody> from String then output it.
This is a internal function.
@param String A sub string of a configuration string in @param String A sub string of a configuration string in
<MultiConfigAltResp> format. <MultiConfigAltResp> format.
@param ConfigBody Points to the output string. It's caller's @param ConfigBody Points to the output string. It's caller's
@ -400,7 +406,6 @@ GenerateSubStr (
@retval EFI_SUCCESS All existing storage is exported. @retval EFI_SUCCESS All existing storage is exported.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
OutputConfigBody ( OutputConfigBody (
IN EFI_STRING String, IN EFI_STRING String,
@ -444,36 +449,33 @@ OutputConfigBody (
#endif #endif
/**
Adjusts the size of a previously allocated buffer.
@param OldPool A pointer to the buffer whose size is being adjusted.
@param OldSize The size of the current buffer.
@param NewSize The size of the new buffer.
@return The new buffer allocated.
**/
VOID * VOID *
ReallocatePool ( ReallocatePool (
IN VOID *OldPool, IN VOID *OldPool,
IN UINTN OldSize, IN UINTN OldSize,
IN UINTN NewSize IN UINTN NewSize
) )
/*++
Routine Description:
Adjusts the size of a previously allocated buffer.
Arguments:
OldPool - A pointer to the buffer whose size is being adjusted.
OldSize - The size of the current buffer.
NewSize - The size of the new buffer.
Returns:
Points to the new buffer
--*/
{ {
VOID *NewPool; VOID *NewPool;
NewPool = NULL; NewPool = NULL;
if (NewSize) { if (NewSize != 0) {
NewPool = AllocateZeroPool (NewSize); NewPool = AllocateZeroPool (NewSize);
} }
if (OldPool) { if (OldPool != NULL) {
if (NewPool) { if (NewPool != NULL) {
CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize); CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);
} }
@ -487,6 +489,8 @@ Returns:
/** /**
Append a string to a multi-string format. Append a string to a multi-string format.
This is a internal function.
@param MultiString String in <MultiConfigRequest>, @param MultiString String in <MultiConfigRequest>,
<MultiConfigAltResp>, or <MultiConfigResp>. On <MultiConfigAltResp>, or <MultiConfigResp>. On
input, the buffer length of this string is input, the buffer length of this string is
@ -498,7 +502,6 @@ Returns:
@retval EFI_SUCCESS AppendString is append to the end of MultiString @retval EFI_SUCCESS AppendString is append to the end of MultiString
**/ **/
STATIC
EFI_STATUS EFI_STATUS
AppendToMultiString ( AppendToMultiString (
IN OUT EFI_STRING *MultiString, IN OUT EFI_STRING *MultiString,
@ -541,6 +544,8 @@ AppendToMultiString (
or WIDTH or VALUE. or WIDTH or VALUE.
<BlockConfig> ::= 'OFFSET='<Number>&'WIDTH='<Number>&'VALUE'=<Number> <BlockConfig> ::= 'OFFSET='<Number>&'WIDTH='<Number>&'VALUE'=<Number>
This is a internal function.
@param StringPtr String in <BlockConfig> format and points to the @param StringPtr String in <BlockConfig> format and points to the
first character of <Number>. first character of <Number>.
@param Number The output value. Caller takes the responsibility @param Number The output value. Caller takes the responsibility
@ -553,7 +558,6 @@ AppendToMultiString (
successfully. successfully.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
GetValueOfNumber ( GetValueOfNumber (
IN EFI_STRING StringPtr, IN EFI_STRING StringPtr,
@ -656,7 +660,7 @@ HiiConfigRoutingExtractConfig (
OUT EFI_STRING *Results OUT EFI_STRING *Results
) )
{ {
#ifndef DISABLE_UNUSED_HII_PROTOCOLS #ifndef _DISABLE_UNUSED_HII_PROTOCOLS_
HII_DATABASE_PRIVATE_DATA *Private; HII_DATABASE_PRIVATE_DATA *Private;
EFI_STRING StringPtr; EFI_STRING StringPtr;
@ -858,7 +862,7 @@ HiiConfigRoutingExportConfig (
OUT EFI_STRING *Results OUT EFI_STRING *Results
) )
{ {
#ifndef DISABLE_UNUSED_HII_PROTOCOLS #ifndef _DISABLE_UNUSED_HII_PROTOCOLS_
EFI_STATUS Status; EFI_STATUS Status;
HII_DATABASE_PRIVATE_DATA *Private; HII_DATABASE_PRIVATE_DATA *Private;
@ -1085,7 +1089,7 @@ HiiConfigRoutingRouteConfig (
OUT EFI_STRING *Progress OUT EFI_STRING *Progress
) )
{ {
#ifndef DISABLE_UNUSED_HII_PROTOCOLS #ifndef _DISABLE_UNUSED_HII_PROTOCOLS_
HII_DATABASE_PRIVATE_DATA *Private; HII_DATABASE_PRIVATE_DATA *Private;
EFI_STRING StringPtr; EFI_STRING StringPtr;
@ -1757,22 +1761,33 @@ HiiGetAltCfg (
OUT EFI_STRING *AltCfgResp OUT EFI_STRING *AltCfgResp
) )
{ {
#ifndef DISABLE_UNUSED_HII_PROTOCOLS #ifndef _DISABLE_UNUSED_HII_PROTOCOLS_
EFI_STATUS Status; EFI_STATUS Status;
EFI_STRING StringPtr; EFI_STRING StringPtr;
EFI_STRING HdrStart = NULL; EFI_STRING HdrStart;
EFI_STRING HdrEnd = NULL; EFI_STRING HdrEnd;
EFI_STRING TmpPtr; EFI_STRING TmpPtr;
UINTN Length; UINTN Length;
EFI_STRING GuidStr = NULL; EFI_STRING GuidStr;
EFI_STRING NameStr = NULL; EFI_STRING NameStr;
EFI_STRING PathStr = NULL; EFI_STRING PathStr;
EFI_STRING AltIdStr = NULL; EFI_STRING AltIdStr;
EFI_STRING Result = NULL; EFI_STRING Result;
BOOLEAN GuidFlag = FALSE; BOOLEAN GuidFlag;
BOOLEAN NameFlag = FALSE; BOOLEAN NameFlag;
BOOLEAN PathFlag = FALSE; BOOLEAN PathFlag;
HdrStart = NULL;
HdrEnd = NULL;
GuidStr = NULL;
NameStr = NULL;
PathStr = NULL;
AltIdStr = NULL;
Result = NULL;
GuidFlag = FALSE;
NameFlag = FALSE;
PathFlag = FALSE;
if (This == NULL || Configuration == NULL || AltCfgResp == NULL) { if (This == NULL || Configuration == NULL || AltCfgResp == NULL) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;

View File

@ -1,4 +1,6 @@
/** @file /** @file
Implementation for EFI_HII_DATABASE_PROTOCOL.
Copyright (c) 2007 - 2008, Intel Corporation Copyright (c) 2007 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
@ -9,17 +11,6 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Database.c
Abstract:
Implementation for EFI_HII_DATABASE_PROTOCOL.
Revision History
**/ **/
@ -33,9 +24,10 @@ STATIC EFI_GUID mHiiDatabaseNotifyGuid = HII_DATABASE_NOTIFY_GUID;
/** /**
This function generates a HII_DATABASE_RECORD node and adds into hii database. This function generates a HII_DATABASE_RECORD node and adds into hii database.
This is a internal function.
@param Private hii database private structure @param Private hii database private structure
@param DatabaseRecord HII_DATABASE_RECORD node which is used to store a @param DatabaseNode HII_DATABASE_RECORD node which is used to store a
package list package list
@retval EFI_SUCCESS A database record is generated successfully. @retval EFI_SUCCESS A database record is generated successfully.
@ -44,7 +36,6 @@ STATIC EFI_GUID mHiiDatabaseNotifyGuid = HII_DATABASE_NOTIFY_GUID;
@retval EFI_INVALID_PARAMETER Private is NULL or DatabaseRecord is NULL. @retval EFI_INVALID_PARAMETER Private is NULL or DatabaseRecord is NULL.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
GenerateHiiDatabaseRecord ( GenerateHiiDatabaseRecord (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -118,6 +109,7 @@ GenerateHiiDatabaseRecord (
/** /**
This function checks whether a handle is a valid EFI_HII_HANDLE This function checks whether a handle is a valid EFI_HII_HANDLE
This is a internal function.
@param Handle Pointer to a EFI_HII_HANDLE @param Handle Pointer to a EFI_HII_HANDLE
@ -148,6 +140,7 @@ IsHiiHandleValid (
/** /**
This function invokes the matching registered function. This function invokes the matching registered function.
This is a internal function.
@param Private HII Database driver private structure. @param Private HII Database driver private structure.
@param NotifyType The type of change concerning the database. @param NotifyType The type of change concerning the database.
@ -162,7 +155,6 @@ IsHiiHandleValid (
@retval EFI_INVALID_PARAMETER Any input parameter is not valid. @retval EFI_INVALID_PARAMETER Any input parameter is not valid.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
InvokeRegisteredFunction ( InvokeRegisteredFunction (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -357,6 +349,7 @@ InvokeRegisteredFunction (
/** /**
This function insert a GUID package to a package list node. This function insert a GUID package to a package list node.
This is a internal function.
@param PackageHdr Pointer to a buffer stored with GUID package @param PackageHdr Pointer to a buffer stored with GUID package
information. information.
@ -371,7 +364,6 @@ InvokeRegisteredFunction (
@retval EFI_INVALID_PARAMETER PackageHdr is NULL or PackageList is NULL. @retval EFI_INVALID_PARAMETER PackageHdr is NULL or PackageList is NULL.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
InsertGuidPackage ( InsertGuidPackage (
IN VOID *PackageHdr, IN VOID *PackageHdr,
@ -417,6 +409,7 @@ InsertGuidPackage (
/** /**
This function exports GUID packages to a buffer. This function exports GUID packages to a buffer.
This is a internal function.
@param Private Hii database private structure. @param Private Hii database private structure.
@param Handle Identification of a package list. @param Handle Identification of a package list.
@ -431,7 +424,6 @@ InsertGuidPackage (
@retval EFI_INVALID_PARAMETER Any input parameter is invalid. @retval EFI_INVALID_PARAMETER Any input parameter is invalid.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
ExportGuidPackages ( ExportGuidPackages (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -485,6 +477,7 @@ ExportGuidPackages (
/** /**
This function deletes all GUID packages from a package list node. This function deletes all GUID packages from a package list node.
This is a internal function.
@param Private Hii database private data. @param Private Hii database private data.
@param Handle Handle of the package list which contains the to @param Handle Handle of the package list which contains the to
@ -496,7 +489,6 @@ ExportGuidPackages (
@retval EFI_INVALID_PARAMETER Any input parameter is not valid. @retval EFI_INVALID_PARAMETER Any input parameter is not valid.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
RemoveGuidPackages ( RemoveGuidPackages (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -542,6 +534,7 @@ RemoveGuidPackages (
/** /**
This function insert a Form package to a package list node. This function insert a Form package to a package list node.
This is a internal function.
@param PackageHdr Pointer to a buffer stored with Form package @param PackageHdr Pointer to a buffer stored with Form package
information. information.
@ -556,7 +549,6 @@ RemoveGuidPackages (
@retval EFI_INVALID_PARAMETER PackageHdr is NULL or PackageList is NULL. @retval EFI_INVALID_PARAMETER PackageHdr is NULL or PackageList is NULL.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
InsertFormPackage ( InsertFormPackage (
IN VOID *PackageHdr, IN VOID *PackageHdr,
@ -618,6 +610,7 @@ InsertFormPackage (
/** /**
This function exports Form packages to a buffer. This function exports Form packages to a buffer.
This is a internal function.
@param Private Hii database private structure. @param Private Hii database private structure.
@param Handle Identification of a package list. @param Handle Identification of a package list.
@ -632,7 +625,6 @@ InsertFormPackage (
@retval EFI_INVALID_PARAMETER Any input parameter is invalid. @retval EFI_INVALID_PARAMETER Any input parameter is invalid.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
ExportFormPackages ( ExportFormPackages (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -701,6 +693,7 @@ ExportFormPackages (
/** /**
This function deletes all Form packages from a package list node. This function deletes all Form packages from a package list node.
This is a internal function.
@param Private Hii database private data. @param Private Hii database private data.
@param Handle Handle of the package list which contains the to @param Handle Handle of the package list which contains the to
@ -712,7 +705,6 @@ ExportFormPackages (
@retval EFI_INVALID_PARAMETER Any input parameter is not valid. @retval EFI_INVALID_PARAMETER Any input parameter is not valid.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
RemoveFormPackages ( RemoveFormPackages (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -758,6 +750,7 @@ RemoveFormPackages (
/** /**
This function insert a String package to a package list node. This function insert a String package to a package list node.
This is a internal function.
@param Private Hii database private structure. @param Private Hii database private structure.
@param PackageHdr Pointer to a buffer stored with String package @param PackageHdr Pointer to a buffer stored with String package
@ -775,7 +768,6 @@ RemoveFormPackages (
exists in current package list. exists in current package list.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
InsertStringPackage ( InsertStringPackage (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -894,6 +886,7 @@ Error:
/** /**
This function exports String packages to a buffer. This function exports String packages to a buffer.
This is a internal function.
@param Private Hii database private structure. @param Private Hii database private structure.
@param Handle Identification of a package list. @param Handle Identification of a package list.
@ -908,7 +901,6 @@ Error:
@retval EFI_INVALID_PARAMETER Any input parameter is invalid. @retval EFI_INVALID_PARAMETER Any input parameter is invalid.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
ExportStringPackages ( ExportStringPackages (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -976,6 +968,7 @@ ExportStringPackages (
/** /**
This function deletes all String packages from a package list node. This function deletes all String packages from a package list node.
This is a internal function.
@param Private Hii database private data. @param Private Hii database private data.
@param Handle Handle of the package list which contains the to @param Handle Handle of the package list which contains the to
@ -987,7 +980,6 @@ ExportStringPackages (
@retval EFI_INVALID_PARAMETER Any input parameter is not valid. @retval EFI_INVALID_PARAMETER Any input parameter is not valid.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
RemoveStringPackages ( RemoveStringPackages (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -1047,6 +1039,7 @@ RemoveStringPackages (
/** /**
This function insert a Font package to a package list node. This function insert a Font package to a package list node.
This is a internal function.
@param Private Hii database private structure. @param Private Hii database private structure.
@param PackageHdr Pointer to a buffer stored with Font package @param PackageHdr Pointer to a buffer stored with Font package
@ -1064,7 +1057,6 @@ RemoveStringPackages (
exists in current hii database. exists in current hii database.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
InsertFontPackage ( InsertFontPackage (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -1190,6 +1182,7 @@ Error:
/** /**
This function exports Font packages to a buffer. This function exports Font packages to a buffer.
This is a internal function.
@param Private Hii database private structure. @param Private Hii database private structure.
@param Handle Identification of a package list. @param Handle Identification of a package list.
@ -1204,7 +1197,6 @@ Error:
@retval EFI_INVALID_PARAMETER Any input parameter is invalid. @retval EFI_INVALID_PARAMETER Any input parameter is invalid.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
ExportFontPackages ( ExportFontPackages (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -1273,6 +1265,7 @@ ExportFontPackages (
/** /**
This function deletes all Font packages from a package list node. This function deletes all Font packages from a package list node.
This is a internal function.
@param Private Hii database private data. @param Private Hii database private data.
@param Handle Handle of the package list which contains the to @param Handle Handle of the package list which contains the to
@ -1284,7 +1277,6 @@ ExportFontPackages (
@retval EFI_INVALID_PARAMETER Any input parameter is not valid. @retval EFI_INVALID_PARAMETER Any input parameter is not valid.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
RemoveFontPackages ( RemoveFontPackages (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -1359,6 +1351,7 @@ RemoveFontPackages (
/** /**
This function insert a Image package to a package list node. This function insert a Image package to a package list node.
This is a internal function.
@param PackageHdr Pointer to a buffer stored with Image package @param PackageHdr Pointer to a buffer stored with Image package
information. information.
@ -1373,7 +1366,6 @@ RemoveFontPackages (
@retval EFI_INVALID_PARAMETER PackageHdr is NULL or PackageList is NULL. @retval EFI_INVALID_PARAMETER PackageHdr is NULL or PackageList is NULL.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
InsertImagePackage ( InsertImagePackage (
IN VOID *PackageHdr, IN VOID *PackageHdr,
@ -1484,6 +1476,7 @@ InsertImagePackage (
/** /**
This function exports Image packages to a buffer. This function exports Image packages to a buffer.
This is a internal function.
@param Private Hii database private structure. @param Private Hii database private structure.
@param Handle Identification of a package list. @param Handle Identification of a package list.
@ -1498,7 +1491,6 @@ InsertImagePackage (
@retval EFI_INVALID_PARAMETER Any input parameter is invalid. @retval EFI_INVALID_PARAMETER Any input parameter is invalid.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
ExportImagePackages ( ExportImagePackages (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -1575,6 +1567,7 @@ ExportImagePackages (
/** /**
This function deletes Image package from a package list node. This function deletes Image package from a package list node.
This is a internal function.
@param Private Hii database private data. @param Private Hii database private data.
@param Handle Handle of the package list which contains the to @param Handle Handle of the package list which contains the to
@ -1586,7 +1579,6 @@ ExportImagePackages (
@retval EFI_INVALID_PARAMETER Any input parameter is not valid. @retval EFI_INVALID_PARAMETER Any input parameter is not valid.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
RemoveImagePackages ( RemoveImagePackages (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -1631,6 +1623,7 @@ RemoveImagePackages (
/** /**
This function insert a Simple Font package to a package list node. This function insert a Simple Font package to a package list node.
This is a internal function.
@param PackageHdr Pointer to a buffer stored with Simple Font @param PackageHdr Pointer to a buffer stored with Simple Font
package information. package information.
@ -1645,7 +1638,6 @@ RemoveImagePackages (
@retval EFI_INVALID_PARAMETER PackageHdr is NULL or PackageList is NULL. @retval EFI_INVALID_PARAMETER PackageHdr is NULL or PackageList is NULL.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
InsertSimpleFontPackage ( InsertSimpleFontPackage (
IN VOID *PackageHdr, IN VOID *PackageHdr,
@ -1707,6 +1699,7 @@ Error:
/** /**
This function exports SimpleFont packages to a buffer. This function exports SimpleFont packages to a buffer.
This is a internal function.
@param Private Hii database private structure. @param Private Hii database private structure.
@param Handle Identification of a package list. @param Handle Identification of a package list.
@ -1721,7 +1714,6 @@ Error:
@retval EFI_INVALID_PARAMETER Any input parameter is invalid. @retval EFI_INVALID_PARAMETER Any input parameter is invalid.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
ExportSimpleFontPackages ( ExportSimpleFontPackages (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -1780,6 +1772,7 @@ ExportSimpleFontPackages (
/** /**
This function deletes all Simple Font packages from a package list node. This function deletes all Simple Font packages from a package list node.
This is a internal function.
@param Private Hii database private data. @param Private Hii database private data.
@param Handle Handle of the package list which contains the to @param Handle Handle of the package list which contains the to
@ -1791,7 +1784,6 @@ ExportSimpleFontPackages (
@retval EFI_INVALID_PARAMETER Any input parameter is not valid. @retval EFI_INVALID_PARAMETER Any input parameter is not valid.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
RemoveSimpleFontPackages ( RemoveSimpleFontPackages (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -1835,6 +1827,7 @@ RemoveSimpleFontPackages (
/** /**
This function insert a Device path package to a package list node. This function insert a Device path package to a package list node.
This is a internal function.
@param DevicePath Pointer to a EFI_DEVICE_PATH_PROTOCOL protocol @param DevicePath Pointer to a EFI_DEVICE_PATH_PROTOCOL protocol
instance instance
@ -1848,7 +1841,6 @@ RemoveSimpleFontPackages (
@retval EFI_INVALID_PARAMETER DevicePath is NULL or PackageList is NULL. @retval EFI_INVALID_PARAMETER DevicePath is NULL or PackageList is NULL.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
InsertDevicePathPackage ( InsertDevicePathPackage (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
@ -1895,6 +1887,7 @@ InsertDevicePathPackage (
/** /**
This function exports device path package to a buffer. This function exports device path package to a buffer.
This is a internal function.
@param Private Hii database private structure. @param Private Hii database private structure.
@param Handle Identification of a package list. @param Handle Identification of a package list.
@ -1909,7 +1902,6 @@ InsertDevicePathPackage (
@retval EFI_INVALID_PARAMETER Any input parameter is invalid. @retval EFI_INVALID_PARAMETER Any input parameter is invalid.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
ExportDevicePathPackage ( ExportDevicePathPackage (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -1966,6 +1958,7 @@ ExportDevicePathPackage (
/** /**
This function deletes Device Path package from a package list node. This function deletes Device Path package from a package list node.
This is a internal function.
@param Private Hii database private data. @param Private Hii database private data.
@param Handle Handle of the package list. @param Handle Handle of the package list.
@ -1976,7 +1969,6 @@ ExportDevicePathPackage (
@retval EFI_INVALID_PARAMETER Any input parameter is not valid. @retval EFI_INVALID_PARAMETER Any input parameter is not valid.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
RemoveDevicePathPackage ( RemoveDevicePathPackage (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -2022,6 +2014,7 @@ RemoveDevicePathPackage (
/** /**
This function will insert a device path package to package list firstly then This function will insert a device path package to package list firstly then
invoke notification functions if any. invoke notification functions if any.
This is a internal function.
@param Private Hii database private structure. @param Private Hii database private structure.
@param NotifyType The type of change concerning the database. @param NotifyType The type of change concerning the database.
@ -2036,7 +2029,6 @@ RemoveDevicePathPackage (
@retval EFI_INVALID_PARAMETER DevicePath is NULL or PackageList is NULL. @retval EFI_INVALID_PARAMETER DevicePath is NULL or PackageList is NULL.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
AddDevicePathPackage ( AddDevicePathPackage (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -2078,6 +2070,7 @@ AddDevicePathPackage (
/** /**
This function insert a Keyboard Layout package to a package list node. This function insert a Keyboard Layout package to a package list node.
This is a internal function.
@param PackageHdr Pointer to a buffer stored with Keyboard Layout @param PackageHdr Pointer to a buffer stored with Keyboard Layout
package information. package information.
@ -2092,7 +2085,6 @@ AddDevicePathPackage (
@retval EFI_INVALID_PARAMETER PackageHdr is NULL or PackageList is NULL. @retval EFI_INVALID_PARAMETER PackageHdr is NULL or PackageList is NULL.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
InsertKeyboardLayoutPackage ( InsertKeyboardLayoutPackage (
IN VOID *PackageHdr, IN VOID *PackageHdr,
@ -2149,6 +2141,7 @@ Error:
/** /**
This function exports Keyboard Layout packages to a buffer. This function exports Keyboard Layout packages to a buffer.
This is a internal function.
@param Private Hii database private structure. @param Private Hii database private structure.
@param Handle Identification of a package list. @param Handle Identification of a package list.
@ -2164,7 +2157,6 @@ Error:
@retval EFI_INVALID_PARAMETER Any input parameter is invalid. @retval EFI_INVALID_PARAMETER Any input parameter is invalid.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
ExportKeyboardLayoutPackages ( ExportKeyboardLayoutPackages (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -2225,6 +2217,7 @@ ExportKeyboardLayoutPackages (
/** /**
This function deletes all Keyboard Layout packages from a package list node. This function deletes all Keyboard Layout packages from a package list node.
This is a internal function.
@param Private Hii database private data. @param Private Hii database private data.
@param Handle Handle of the package list which contains the to @param Handle Handle of the package list which contains the to
@ -2237,7 +2230,6 @@ ExportKeyboardLayoutPackages (
@retval EFI_INVALID_PARAMETER Any input parameter is not valid. @retval EFI_INVALID_PARAMETER Any input parameter is not valid.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
RemoveKeyboardLayoutPackages ( RemoveKeyboardLayoutPackages (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -2286,6 +2278,8 @@ RemoveKeyboardLayoutPackages (
invoke notification functions if any. It is the worker function of invoke notification functions if any. It is the worker function of
HiiNewPackageList and HiiUpdatePackageList. HiiNewPackageList and HiiUpdatePackageList.
This is a internal function.
@param Private Hii database private structure. @param Private Hii database private structure.
@param NotifyType The type of change concerning the database. @param NotifyType The type of change concerning the database.
@param PackageList Pointer to a package list. @param PackageList Pointer to a package list.
@ -2299,7 +2293,6 @@ RemoveKeyboardLayoutPackages (
@retval EFI_INVALID_PARAMETER Any input parameter is invalid. @retval EFI_INVALID_PARAMETER Any input parameter is invalid.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
AddPackages ( AddPackages (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -2503,6 +2496,8 @@ AddPackages (
This function exports a package list to a buffer. It is the worker function This function exports a package list to a buffer. It is the worker function
of HiiExportPackageList. of HiiExportPackageList.
This is a internal function.
@param Private Hii database private structure. @param Private Hii database private structure.
@param Handle Identification of a package list. @param Handle Identification of a package list.
@param PackageList Pointer to a package list which will be exported. @param PackageList Pointer to a package list which will be exported.
@ -2516,7 +2511,6 @@ AddPackages (
@retval EFI_INVALID_PARAMETER Any input parameter is invalid. @retval EFI_INVALID_PARAMETER Any input parameter is invalid.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
ExportPackageList ( ExportPackageList (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -3336,7 +3330,7 @@ HiiRegisterPackageNotify (
@param This A pointer to the EFI_HII_DATABASE_PROTOCOL @param This A pointer to the EFI_HII_DATABASE_PROTOCOL
instance. instance.
@param NotifyHandle The handle of the notification function being @param NotificationHandle The handle of the notification function being
unregistered. unregistered.
@retval EFI_SUCCESS Notification is unregistered successfully. @retval EFI_SUCCESS Notification is unregistered successfully.

View File

@ -1,4 +1,6 @@
/** @file /** @file
Implementation for EFI_HII_FONT_PROTOCOL.
Copyright (c) 2007 - 2008, Intel Corporation Copyright (c) 2007 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
@ -9,23 +11,12 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Font.c
Abstract:
Implementation for EFI_HII_FONT_PROTOCOL.
Revision History
**/ **/
#include "HiiDatabase.h" #include "HiiDatabase.h"
static EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = { STATIC EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
// //
// B G R // B G R
// //
@ -51,6 +42,8 @@ static EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
/** /**
Insert a character cell information to the list specified by GlyphInfoList. Insert a character cell information to the list specified by GlyphInfoList.
This is a internal function.
@param CharValue Unicode character value, which identifies a glyph @param CharValue Unicode character value, which identifies a glyph
block. block.
@param GlyphInfoList HII_GLYPH_INFO list head. @param GlyphInfoList HII_GLYPH_INFO list head.
@ -61,7 +54,6 @@ static EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
task. task.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
NewCell ( NewCell (
IN CHAR16 CharValue, IN CHAR16 CharValue,
@ -94,6 +86,8 @@ NewCell (
/** /**
Get a character cell information from the list specified by GlyphInfoList. Get a character cell information from the list specified by GlyphInfoList.
This is a internal function.
@param CharValue Unicode character value, which identifies a glyph @param CharValue Unicode character value, which identifies a glyph
block. block.
@param GlyphInfoList HII_GLYPH_INFO list head. @param GlyphInfoList HII_GLYPH_INFO list head.
@ -105,7 +99,6 @@ NewCell (
not exist. not exist.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
GetCell ( GetCell (
IN CHAR16 CharValue, IN CHAR16 CharValue,
@ -143,6 +136,8 @@ GetCell (
/** /**
Convert the glyph for a single character into a bitmap. Convert the glyph for a single character into a bitmap.
This is a internal function.
@param Private HII database driver private data. @param Private HII database driver private data.
@param Char Character to retrieve. @param Char Character to retrieve.
@param StringInfo Points to the string font and color information @param StringInfo Points to the string font and color information
@ -158,7 +153,6 @@ GetCell (
@retval EFI_INVALID_PARAMETER Any input parameter is invalid. @retval EFI_INVALID_PARAMETER Any input parameter is invalid.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
GetGlyphBuffer ( GetGlyphBuffer (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -266,7 +260,28 @@ GetGlyphBuffer (
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
STATIC /**
Convert bitmap data of the glyph to blt structure.
This is a internal function.
@param GlyphBuffer Buffer points to bitmap data of glyph.
@param Foreground The color of the "on" pixels in the glyph in the
bitmap.
@param Background The color of the "off" pixels in the glyph in the
bitmap.
@param ImageWidth Width of the character or character cell, in
pixels.
@param ImageHeight Height of the character or character cell, in
pixels.
@param Transparent If TRUE, the Background color is ignored and all
"off" pixels in the character's drawn wil use the
pixel value from BltBuffer.
@param Origin On input, points to the origin of the to be
displayed character, on output, points to the
next glyph's origin.
**/
VOID VOID
NarrowGlyphToBlt ( NarrowGlyphToBlt (
IN UINT8 *GlyphBuffer, IN UINT8 *GlyphBuffer,
@ -278,8 +293,8 @@ NarrowGlyphToBlt (
IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **Origin IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **Origin
) )
{ {
UINT8 X; UINT8 Xpos;
UINT8 Y; UINT8 Ypos;
UINT8 Height; UINT8 Height;
UINT8 Width; UINT8 Width;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Buffer; EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Buffer;
@ -293,13 +308,13 @@ NarrowGlyphToBlt (
Buffer = *Origin; Buffer = *Origin;
for (Y = 0; Y < Height; Y++) { for (Ypos = 0; Ypos < Height; Ypos++) {
for (X = 0; X < Width; X++) { for (Xpos = 0; Xpos < Width; Xpos++) {
if ((GlyphBuffer[Y] & (1 << X)) != 0) { if ((GlyphBuffer[Ypos] & (1 << Xpos)) != 0) {
Buffer[Y * ImageWidth + (Width - X - 1)] = Foreground; Buffer[Ypos * ImageWidth + (Width - Xpos - 1)] = Foreground;
} else { } else {
if (!Transparent) { if (!Transparent) {
Buffer[Y * ImageWidth + (Width - X - 1)] = Background; Buffer[Ypos * ImageWidth + (Width - Xpos - 1)] = Background;
} }
} }
} }
@ -312,23 +327,28 @@ NarrowGlyphToBlt (
/** /**
Convert bitmap data of the glyph to blt structure. Convert bitmap data of the glyph to blt structure.
This is a internal function.
@param GlyphBuffer Buffer points to bitmap data of glyph. @param GlyphBuffer Buffer points to bitmap data of glyph.
@param Foreground The color of the "on" pixels in the glyph in the @param Foreground The color of the "on" pixels in the glyph in the
bitmap. bitmap.
@param Background The color of the "off" pixels in the glyph in the @param Background The color of the "off" pixels in the glyph in the
bitmap. bitmap.
@param Width Width of the character or character cell, in @param ImageWidth Width of the character or character cell, in
pixels. pixels.
@param Height Height of the character or character cell, in @param ImageHeight Height of the character or character cell, in
pixels. pixels.
@param Transparent If TRUE, the Background color is ignored and all @param Transparent If TRUE, the Background color is ignored and all
"off" pixels in the character's drawn wil use the "off" pixels in the character's drawn wil use the
pixel value from BltBuffer. pixel value from BltBuffer.
@param BltBuffer Points to the blt buffer. @param Cell Points to EFI_HII_GLYPH_INFO structure.
@param Attributes The attribute of incoming glyph in GlyphBuffer.
@param Origin On input, points to the origin of the to be
displayed character, on output, points to the
next glyph's origin.
**/ **/
STATIC
VOID VOID
GlyphToBlt ( GlyphToBlt (
IN UINT8 *GlyphBuffer, IN UINT8 *GlyphBuffer,
@ -342,8 +362,8 @@ GlyphToBlt (
IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **Origin IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **Origin
) )
{ {
UINT8 X; UINT8 Xpos;
UINT8 Y; UINT8 Ypos;
UINT8 Data; UINT8 Data;
UINT8 Index; UINT8 Index;
UINTN OffsetY; UINTN OffsetY;
@ -366,20 +386,20 @@ GlyphToBlt (
// The glyph's upper left hand corner pixel is the most significant bit of the // The glyph's upper left hand corner pixel is the most significant bit of the
// first bitmap byte. // first bitmap byte.
// //
for (Y = 0; Y < Cell->Height; Y++) { for (Ypos = 0; Ypos < Cell->Height; Ypos++) {
OffsetY = BITMAP_LEN_1_BIT (Cell->Width, Y); OffsetY = BITMAP_LEN_1_BIT (Cell->Width, Ypos);
// //
// All bits in these bytes are meaningful. // All bits in these bytes are meaningful.
// //
for (X = 0; X < Cell->Width / 8; X++) { for (Xpos = 0; Xpos < Cell->Width / 8; Xpos++) {
Data = *(GlyphBuffer + OffsetY + X); Data = *(GlyphBuffer + OffsetY + Xpos);
for (Index = 0; Index < 8; Index++) { for (Index = 0; Index < 8; Index++) {
if ((Data & (1 << Index)) != 0) { if ((Data & (1 << Index)) != 0) {
BltBuffer[Y * ImageWidth + X * 8 + (8 - Index - 1)] = Foreground; BltBuffer[Ypos * ImageWidth + Xpos * 8 + (8 - Index - 1)] = Foreground;
} else { } else {
if (!Transparent) { if (!Transparent) {
BltBuffer[Y * ImageWidth + X * 8 + (8 - Index - 1)] = Background; BltBuffer[Ypos * ImageWidth + Xpos * 8 + (8 - Index - 1)] = Background;
} }
} }
} }
@ -389,19 +409,19 @@ GlyphToBlt (
// //
// There are some padding bits in this byte. Ignore them. // There are some padding bits in this byte. Ignore them.
// //
Data = *(GlyphBuffer + OffsetY + X); Data = *(GlyphBuffer + OffsetY + Xpos);
for (Index = 0; Index < Cell->Width % 8; Index++) { for (Index = 0; Index < Cell->Width % 8; Index++) {
if ((Data & (1 << (8 - Index - 1))) != 0) { if ((Data & (1 << (8 - Index - 1))) != 0) {
BltBuffer[Y * ImageWidth + X * 8 + Index] = Foreground; BltBuffer[Ypos * ImageWidth + Xpos * 8 + Index] = Foreground;
} else { } else {
if (!Transparent) { if (!Transparent) {
BltBuffer[Y * ImageWidth + X * 8 + Index] = Background; BltBuffer[Ypos * ImageWidth + Xpos * 8 + Index] = Background;
} }
} }
} }
} // end of if (Width % 8...) } // end of if (Width % 8...)
} // end of for (Y=0...) } // end of for (Ypos=0...)
*Origin = BltBuffer + Cell->Width; *Origin = BltBuffer + Cell->Width;
} }
@ -410,14 +430,16 @@ GlyphToBlt (
/** /**
Convert bitmap data of the glyph to blt structure. Convert bitmap data of the glyph to blt structure.
This is a internal function.
@param GlyphBuffer Buffer points to bitmap data of glyph. @param GlyphBuffer Buffer points to bitmap data of glyph.
@param Foreground The color of the "on" pixels in the glyph in the @param Foreground The color of the "on" pixels in the glyph in the
bitmap. bitmap.
@param Background The color of the "off" pixels in the glyph in the @param Background The color of the "off" pixels in the glyph in the
bitmap. bitmap.
@param Width Width of the character or character cell, in @param ImageWidth Width of the character or character cell, in
pixels. pixels.
@param Height Height of the character or character cell, in @param ImageHeight Height of the character or character cell, in
pixels. pixels.
@param Transparent If TRUE, the Background color is ignored and all @param Transparent If TRUE, the Background color is ignored and all
"off" pixels in the character's drawn wil use the "off" pixels in the character's drawn wil use the
@ -431,7 +453,6 @@ GlyphToBlt (
@return Points to the address of next origin node in BltBuffer. @return Points to the address of next origin node in BltBuffer.
**/ **/
STATIC
VOID VOID
GlyphToImage ( GlyphToImage (
IN UINT8 *GlyphBuffer, IN UINT8 *GlyphBuffer,
@ -531,6 +552,8 @@ GlyphToImage (
/** /**
Write the output parameters of FindGlyphBlock(). Write the output parameters of FindGlyphBlock().
This is a internal function.
@param BufferIn Buffer which stores the bitmap data of the found @param BufferIn Buffer which stores the bitmap data of the found
block. block.
@param BufferLen Length of BufferIn. @param BufferLen Length of BufferIn.
@ -548,7 +571,6 @@ GlyphToImage (
task. task.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
WriteOutputParam ( WriteOutputParam (
IN UINT8 *BufferIn, IN UINT8 *BufferIn,
@ -817,6 +839,8 @@ FindGlyphBlock (
/** /**
Copy a Font Name to a new created EFI_FONT_INFO structure. Copy a Font Name to a new created EFI_FONT_INFO structure.
This is a internal function.
@param FontName NULL-terminated string. @param FontName NULL-terminated string.
@param FontInfo a new EFI_FONT_INFO which stores the FontName. @param FontInfo a new EFI_FONT_INFO which stores the FontName.
It's caller's responsibility to free this buffer. It's caller's responsibility to free this buffer.
@ -826,7 +850,6 @@ FindGlyphBlock (
task. task.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
SaveFontName ( SaveFontName (
IN EFI_STRING FontName, IN EFI_STRING FontName,
@ -908,6 +931,8 @@ GetSystemFont (
Check whether EFI_FONT_DISPLAY_INFO points to system default font and color or Check whether EFI_FONT_DISPLAY_INFO points to system default font and color or
returns the system default according to the optional inputs. returns the system default according to the optional inputs.
This is a internal function.
@param Private HII database driver private data. @param Private HII database driver private data.
@param StringInfo Points to the string output information, @param StringInfo Points to the string output information,
including the color and font. including the color and font.
@ -920,7 +945,6 @@ GetSystemFont (
@retval FALSE No. @retval FALSE No.
**/ **/
STATIC
BOOLEAN BOOLEAN
IsSystemFontInfo ( IsSystemFontInfo (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -1318,6 +1342,8 @@ IsFontInfoExisted (
/** /**
Check whether the unicode represents a line break or not. Check whether the unicode represents a line break or not.
This is a internal function.
@param Char Unicode character @param Char Unicode character
@retval 0 Yes, it is a line break. @retval 0 Yes, it is a line break.
@ -1328,7 +1354,6 @@ IsFontInfoExisted (
@retval -1 No, it is not a link break. @retval -1 No, it is not a link break.
**/ **/
STATIC
INT8 INT8
IsLineBreak ( IsLineBreak (
IN CHAR16 Char IN CHAR16 Char
@ -1413,7 +1438,10 @@ IsLineBreak (
will be allocated to hold the generated image and will be allocated to hold the generated image and
the pointer updated on exit. It is the caller's the pointer updated on exit. It is the caller's
responsibility to free this buffer. responsibility to free this buffer.
@param BltX,BLTY Specifies the offset from the left and top edge @param BltX Specifies the offset from the left and top edge
of the image of the first character cell in the
image.
@param BltY Specifies the offset from the left and top edge
of the image of the first character cell in the of the image of the first character cell in the
image. image.
@param RowInfoArray If this is non-NULL on entry, then on exit, this @param RowInfoArray If this is non-NULL on entry, then on exit, this
@ -1983,7 +2011,10 @@ Exit:
will be allocated to hold the generated image and will be allocated to hold the generated image and
the pointer updated on exit. It is the caller's the pointer updated on exit. It is the caller's
responsibility to free this buffer. responsibility to free this buffer.
@param BltX,BLTY Specifies the offset from the left and top edge @param BltX Specifies the offset from the left and top edge
of the image of the first character cell in the
image.
@param BltY Specifies the offset from the left and top edge
of the image of the first character cell in the of the image of the first character cell in the
image. image.
@param RowInfoArray If this is non-NULL on entry, then on exit, this @param RowInfoArray If this is non-NULL on entry, then on exit, this

View File

@ -1,4 +1,5 @@
/** @file /** @file
Private structures definitions in HiiDatabase.
Copyright (c) 2007 - 2008, Intel Corporation Copyright (c) 2007 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
@ -9,17 +10,6 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
HiiDatabase.h
Abstract:
Private structures definitions in HiiDatabase.
Revision History
**/ **/
#ifndef __HII_DATABASE_PRIVATE_H__ #ifndef __HII_DATABASE_PRIVATE_H__
@ -251,7 +241,7 @@ typedef struct _HII_DATABASE_PRIVATE_DATA {
LIST_ENTRY DatabaseList; LIST_ENTRY DatabaseList;
LIST_ENTRY DatabaseNotifyList; LIST_ENTRY DatabaseNotifyList;
EFI_HII_FONT_PROTOCOL HiiFont; EFI_HII_FONT_PROTOCOL HiiFont;
#ifndef DISABLE_UNUSED_HII_PROTOCOLS #ifndef _DISABLE_UNUSED_HII_PROTOCOLS_
EFI_HII_IMAGE_PROTOCOL HiiImage; EFI_HII_IMAGE_PROTOCOL HiiImage;
#endif #endif
EFI_HII_STRING_PROTOCOL HiiString; EFI_HII_STRING_PROTOCOL HiiString;
@ -305,7 +295,7 @@ typedef struct _HII_DATABASE_PRIVATE_DATA {
// //
/** /**
This function checks whether a handle is a valid EFI_HII_HANDLE This function checks whether a handle is a valid EFI_HII_HANDLE.
@param Handle Pointer to a EFI_HII_HANDLE @param Handle Pointer to a EFI_HII_HANDLE
@ -470,7 +460,10 @@ FindGlyphBlock (
will be allocated to hold the generated image and will be allocated to hold the generated image and
the pointer updated on exit. It is the caller's the pointer updated on exit. It is the caller's
responsibility to free this buffer. responsibility to free this buffer.
@param BltX,BLTY Specifies the offset from the left and top edge @param BltX Together with BltX, Specifies the offset from the left and top edge
of the image of the first character cell in the
image.
@param BltY Together with BltY, Specifies the offset from the left and top edge
of the image of the first character cell in the of the image of the first character cell in the
image. image.
@param RowInfoArray If this is non-NULL on entry, then on exit, this @param RowInfoArray If this is non-NULL on entry, then on exit, this
@ -543,7 +536,10 @@ HiiStringToImage (
will be allocated to hold the generated image and will be allocated to hold the generated image and
the pointer updated on exit. It is the caller's the pointer updated on exit. It is the caller's
responsibility to free this buffer. responsibility to free this buffer.
@param BltX,BLTY Specifies the offset from the left and top edge @param BltX Together with BltX, Specifies the offset from the left and top edge
of the image of the first character cell in the
image.
@param BltY Together with BltY, Specifies the offset from the left and top edge
of the image of the first character cell in the of the image of the first character cell in the
image. image.
@param RowInfoArray If this is non-NULL on entry, then on exit, this @param RowInfoArray If this is non-NULL on entry, then on exit, this
@ -622,7 +618,7 @@ EFIAPI
HiiGetGlyph ( HiiGetGlyph (
IN CONST EFI_HII_FONT_PROTOCOL *This, IN CONST EFI_HII_FONT_PROTOCOL *This,
IN CHAR16 Char, IN CHAR16 Char,
IN CONST EFI_FONT_DISPLAY_INFO *StringInfo, OPTIONAL IN CONST EFI_FONT_DISPLAY_INFO *StringInfo,
OUT EFI_IMAGE_OUTPUT **Blt, OUT EFI_IMAGE_OUTPUT **Blt,
OUT UINTN *Baseline OPTIONAL OUT UINTN *Baseline OPTIONAL
) )
@ -663,7 +659,7 @@ EFIAPI
HiiGetFontInfo ( HiiGetFontInfo (
IN CONST EFI_HII_FONT_PROTOCOL *This, IN CONST EFI_HII_FONT_PROTOCOL *This,
IN OUT EFI_FONT_HANDLE *FontHandle, IN OUT EFI_FONT_HANDLE *FontHandle,
IN CONST EFI_FONT_DISPLAY_INFO *StringInfoIn, IN CONST EFI_FONT_DISPLAY_INFO *StringInfoIn, OPTIONAL
OUT EFI_FONT_DISPLAY_INFO **StringInfoOut, OUT EFI_FONT_DISPLAY_INFO **StringInfoOut,
IN CONST EFI_STRING String OPTIONAL IN CONST EFI_STRING String OPTIONAL
) )
@ -778,6 +774,9 @@ HiiSetImage (
a buffer will be allocated to hold the generated a buffer will be allocated to hold the generated
image and the pointer updated on exit. It is the image and the pointer updated on exit. It is the
caller's responsibility to free this buffer. caller's responsibility to free this buffer.
@param BltX Specifies the offset from the left and top edge
of the output image of the first pixel in the
image.
@param BltY Specifies the offset from the left and top edge @param BltY Specifies the offset from the left and top edge
of the output image of the first pixel in the of the output image of the first pixel in the
image. image.
@ -821,6 +820,9 @@ HiiDrawImage (
allocated to hold the generated image and the allocated to hold the generated image and the
pointer updated on exit. It is the caller's pointer updated on exit. It is the caller's
responsibility to free this buffer. responsibility to free this buffer.
@param BltX Specifies the offset from the left and top edge
of the output image of the first pixel in the
image.
@param BltY Specifies the offset from the left and top edge @param BltY Specifies the offset from the left and top edge
of the output image of the first pixel in the of the output image of the first pixel in the
image. image.
@ -1025,7 +1027,7 @@ HiiGetLanguages (
FirstLanguage. If there are no secondary FirstLanguage. If there are no secondary
languages, the function returns successfully, languages, the function returns successfully,
but this is set to NULL. but this is set to NULL.
@param SecondaryLanguageSize On entry, points to the size of the buffer @param SecondaryLanguagesSize On entry, points to the size of the buffer
pointed to by SecondLanguages, in bytes. On pointed to by SecondLanguages, in bytes. On
return, points to the length of SecondLanguages return, points to the length of SecondLanguages
in bytes. in bytes.
@ -1048,8 +1050,8 @@ HiiGetSecondaryLanguages (
IN CONST EFI_HII_STRING_PROTOCOL *This, IN CONST EFI_HII_STRING_PROTOCOL *This,
IN EFI_HII_HANDLE PackageList, IN EFI_HII_HANDLE PackageList,
IN CONST CHAR8 *FirstLanguage, IN CONST CHAR8 *FirstLanguage,
IN OUT CHAR8 *SecondLanguages, IN OUT CHAR8 *SecondaryLanguages,
IN OUT UINTN *SecondLanguagesSize IN OUT UINTN *SecondaryLanguagesSize
) )
; ;
@ -1278,7 +1280,7 @@ HiiRegisterPackageNotify (
@param This A pointer to the EFI_HII_DATABASE_PROTOCOL @param This A pointer to the EFI_HII_DATABASE_PROTOCOL
instance. instance.
@param NotifyHandle The handle of the notification function being @param NotificationHandle The handle of the notification function being
unregistered. unregistered.
@retval EFI_SUCCESS Notification is unregistered successfully. @retval EFI_SUCCESS Notification is unregistered successfully.

View File

@ -48,7 +48,7 @@ STATIC HII_DATABASE_PRIVATE_DATA mPrivate = {
HiiGetGlyph, HiiGetGlyph,
HiiGetFontInfo HiiGetFontInfo
}, },
#ifndef DISABLE_UNUSED_HII_PROTOCOLS #ifndef _DISABLE_UNUSED_HII_PROTOCOLS_
{ {
HiiNewImage, HiiNewImage,
HiiGetImage, HiiGetImage,
@ -104,7 +104,16 @@ STATIC HII_DATABASE_PRIVATE_DATA mPrivate = {
NULL NULL
}; };
STATIC /**
The default event handler for gHiiKeyboardLayoutChanged
event group.
This is internal function.
@param Event The event that triggered this notification function.
@param Context Pointer to the notification functions context.
**/
VOID VOID
EFIAPI EFIAPI
KeyboardLayoutChangeNullEvent ( KeyboardLayoutChangeNullEvent (
@ -115,53 +124,40 @@ KeyboardLayoutChangeNullEvent (
return; return;
} }
/**
Initialize HII Database.
@param ImageHandle The image handle.
@param SystemTable The system table.
@retval EFI_SUCCESS The Hii database is setup correctly.
@return Other value if failed to create the default event for
gHiiKeyboardLayoutChanged. Check gBS->CreateEventEx for
details. Or failed to insatll the protocols.
Check gBS->InstallMultipleProtocolInterfaces for details.
**/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
InitializeHiiDatabase ( InitializeHiiDatabase (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
/*++
Routine Description:
Initialize HII Database
Arguments:
(Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
Returns:
EFI_SUCCESS -
other -
--*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_HANDLE Handle; EFI_HANDLE Handle;
EFI_HANDLE *HandleBuffer;
UINTN HandleCount;
// //
// There will be only one HII Database in the system // There will be only one HII Database in the system
// If there is another out there, someone is trying to install us // If there is another out there, someone is trying to install us
// again. Fail that scenario. // again. Fail that scenario.
// //
Status = gBS->LocateHandleBuffer ( ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiDatabaseProtocolGuid);
ByProtocol, ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiFontProtocolGuid);
&gEfiHiiDatabaseProtocolGuid, ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiImageProtocolGuid);
NULL, ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiStringProtocolGuid);
&HandleCount, ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiConfigRoutingProtocolGuid);
&HandleBuffer
);
//
// If there was no error, assume there is an installation and fail to load
//
if (!EFI_ERROR (Status)) {
if (HandleBuffer != NULL) {
gBS->FreePool (HandleBuffer);
}
return EFI_DEVICE_ERROR;
}
InitializeListHead (&mPrivate.DatabaseList); InitializeListHead (&mPrivate.DatabaseList);
InitializeListHead (&mPrivate.DatabaseNotifyList); InitializeListHead (&mPrivate.DatabaseNotifyList);
@ -188,7 +184,7 @@ Returns:
&Handle, &Handle,
&gEfiHiiFontProtocolGuid, &gEfiHiiFontProtocolGuid,
&mPrivate.HiiFont, &mPrivate.HiiFont,
#ifndef DISABLE_UNUSED_HII_PROTOCOLS #ifndef _DISABLE_UNUSED_HII_PROTOCOLS_
&gEfiHiiImageProtocolGuid, &gEfiHiiImageProtocolGuid,
&mPrivate.HiiImage, &mPrivate.HiiImage,
#endif #endif

View File

@ -1,4 +1,6 @@
/** @file /** @file
Implementation for EFI_HII_IMAGE_PROTOCOL.
Copyright (c) 2007 - 2008, Intel Corporation Copyright (c) 2007 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
@ -9,46 +11,32 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Image.c
Abstract:
Implementation for EFI_HII_IMAGE_PROTOCOL.
Revision History
**/ **/
#include "HiiDatabase.h" #include "HiiDatabase.h"
#ifndef DISABLE_UNUSED_HII_PROTOCOLS #ifndef _DISABLE_UNUSED_HII_PROTOCOLS_
STATIC /**
Get the imageid of last image block: EFI_HII_IIBT_END_BLOCK when input
ImageId is zero, otherwise return the address of the
corresponding image block with identifier specified by ImageId.
This is a internal function.
@param ImageBlock Points to the beginning of a series of image blocks stored in order.
@param ImageId If input ImageId is 0, output the image id of the EFI_HII_IIBT_END_BLOCK;
else use this id to find its corresponding image block address.
@return The image block address when input ImageId is not zero; otherwise return NULL.
**/
UINT8* UINT8*
GetImageIdOrAddress ( GetImageIdOrAddress (
IN UINT8 *ImageBlock, IN UINT8 *ImageBlock,
IN OUT EFI_IMAGE_ID *ImageId IN OUT EFI_IMAGE_ID *ImageId
) )
/*++
Routine Description:
Get the imageid of last image block: EFI_HII_IIBT_END_BLOCK when input
ImageId is zero, otherwise return the address of the
corresponding image block with identifier specified by ImageId.
Arguments:
ImageBlock - Points to the beginning of a series of image blocks stored in order.
ImageId - If input ImageId is 0, output the image id of the EFI_HII_IIBT_END_BLOCK;
else use this id to find its corresponding image block address.
Returns:
The image block address when input ImageId is not zero; otherwise return NULL.
--*/
{ {
EFI_IMAGE_ID ImageIdCurrent; EFI_IMAGE_ID ImageIdCurrent;
UINT8 *ImageBlockHdr; UINT8 *ImageBlockHdr;
@ -199,13 +187,15 @@ GetImageIdOrAddress (
/** /**
Convert pixels from EFI_GRAPHICS_OUTPUT_BLT_PIXEL to EFI_HII_RGB_PIXEL style. Convert pixels from EFI_GRAPHICS_OUTPUT_BLT_PIXEL to EFI_HII_RGB_PIXEL style.
This is a internal function.
@param BitMapOut Pixels in EFI_HII_RGB_PIXEL format. @param BitMapOut Pixels in EFI_HII_RGB_PIXEL format.
@param BitMapIn Pixels in EFI_GRAPHICS_OUTPUT_BLT_PIXEL format. @param BitMapIn Pixels in EFI_GRAPHICS_OUTPUT_BLT_PIXEL format.
@param PixelNum The number of pixels to be converted. @param PixelNum The number of pixels to be converted.
**/ **/
STATIC
VOID VOID
CopyGopToRgbPixel ( CopyGopToRgbPixel (
OUT EFI_HII_RGB_PIXEL *BitMapOut, OUT EFI_HII_RGB_PIXEL *BitMapOut,
@ -226,13 +216,15 @@ CopyGopToRgbPixel (
/** /**
Convert pixels from EFI_HII_RGB_PIXEL to EFI_GRAPHICS_OUTPUT_BLT_PIXEL style. Convert pixels from EFI_HII_RGB_PIXEL to EFI_GRAPHICS_OUTPUT_BLT_PIXEL style.
This is a internal function.
@param BitMapOut Pixels in EFI_GRAPHICS_OUTPUT_BLT_PIXEL format. @param BitMapOut Pixels in EFI_GRAPHICS_OUTPUT_BLT_PIXEL format.
@param BitMapIn Pixels in EFI_HII_RGB_PIXEL format. @param BitMapIn Pixels in EFI_HII_RGB_PIXEL format.
@param PixelNum The number of pixels to be converted. @param PixelNum The number of pixels to be converted.
**/ **/
STATIC
VOID VOID
CopyRgbToGopPixel ( CopyRgbToGopPixel (
OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapOut, OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapOut,
@ -253,6 +245,9 @@ CopyRgbToGopPixel (
/** /**
Output pixels in "1 bit per pixel" format to an image. Output pixels in "1 bit per pixel" format to an image.
This is a internal function.
@param Image Points to the image which will store the pixels. @param Image Points to the image which will store the pixels.
@param Data Stores the value of output pixels, 0 or 1. @param Data Stores the value of output pixels, 0 or 1.
@param PaletteInfo PaletteInfo which stores the color of the output @param PaletteInfo PaletteInfo which stores the color of the output
@ -261,7 +256,6 @@ CopyRgbToGopPixel (
**/ **/
STATIC
VOID VOID
Output1bitPixel ( Output1bitPixel (
IN OUT EFI_IMAGE_INPUT *Image, IN OUT EFI_IMAGE_INPUT *Image,
@ -269,8 +263,8 @@ Output1bitPixel (
IN EFI_HII_IMAGE_PALETTE_INFO *PaletteInfo IN EFI_HII_IMAGE_PALETTE_INFO *PaletteInfo
) )
{ {
UINT16 X; UINT16 Xpos;
UINT16 Y; UINT16 Ypos;
UINTN OffsetY; UINTN OffsetY;
UINT8 Index; UINT8 Index;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapPtr; EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapPtr;
@ -300,18 +294,18 @@ Output1bitPixel (
// //
// Convert the pixel from one bit to corresponding color. // Convert the pixel from one bit to corresponding color.
// //
for (Y = 0; Y < Image->Height; Y++) { for (Ypos = 0; Ypos < Image->Height; Ypos++) {
OffsetY = BITMAP_LEN_1_BIT (Image->Width, Y); OffsetY = BITMAP_LEN_1_BIT (Image->Width, Ypos);
// //
// All bits in these bytes are meaningful // All bits in these bytes are meaningful
// //
for (X = 0; X < Image->Width / 8; X++) { for (Xpos = 0; Xpos < Image->Width / 8; Xpos++) {
Byte = *(Data + OffsetY + X); Byte = *(Data + OffsetY + Xpos);
for (Index = 0; Index < 8; Index++) { for (Index = 0; Index < 8; Index++) {
if ((Byte & (1 << Index)) != 0) { if ((Byte & (1 << Index)) != 0) {
BitMapPtr[Y * Image->Width + X * 8 + (8 - Index - 1)] = PaletteValue[1]; BitMapPtr[Ypos * Image->Width + Xpos * 8 + (8 - Index - 1)] = PaletteValue[1];
} else { } else {
BitMapPtr[Y * Image->Width + X * 8 + (8 - Index - 1)] = PaletteValue[0]; BitMapPtr[Ypos * Image->Width + Xpos * 8 + (8 - Index - 1)] = PaletteValue[0];
} }
} }
} }
@ -320,12 +314,12 @@ Output1bitPixel (
// //
// Padding bits in this byte should be ignored. // Padding bits in this byte should be ignored.
// //
Byte = *(Data + OffsetY + X); Byte = *(Data + OffsetY + Xpos);
for (Index = 0; Index < Image->Width % 8; Index++) { for (Index = 0; Index < Image->Width % 8; Index++) {
if ((Byte & (1 << (8 - Index - 1))) != 0) { if ((Byte & (1 << (8 - Index - 1))) != 0) {
BitMapPtr[Y * Image->Width + X * 8 + Index] = PaletteValue[1]; BitMapPtr[Ypos * Image->Width + Xpos * 8 + Index] = PaletteValue[1];
} else { } else {
BitMapPtr[Y * Image->Width + X * 8 + Index] = PaletteValue[0]; BitMapPtr[Ypos * Image->Width + Xpos * 8 + Index] = PaletteValue[0];
} }
} }
} }
@ -336,15 +330,17 @@ Output1bitPixel (
/** /**
Output pixels in "4 bit per pixel" format to an image. Output pixels in "4 bit per pixel" format to an image.
This is a internal function.
@param Image Points to the image which will store the pixels. @param Image Points to the image which will store the pixels.
@param Data Stores the value of output pixels, 0 ~ 15. @param Data Stores the value of output pixels, 0 ~ 15.
@param PaletteInfo PaletteInfo which stores the color of the output @param[in] PaletteInfo PaletteInfo which stores the color of the output
pixels. Each entry corresponds to a color within pixels. Each entry corresponds to a color within
[0, 15]. [0, 15].
**/ **/
STATIC
VOID VOID
Output4bitPixel ( Output4bitPixel (
IN OUT EFI_IMAGE_INPUT *Image, IN OUT EFI_IMAGE_INPUT *Image,
@ -352,8 +348,8 @@ Output4bitPixel (
IN EFI_HII_IMAGE_PALETTE_INFO *PaletteInfo IN EFI_HII_IMAGE_PALETTE_INFO *PaletteInfo
) )
{ {
UINT16 X; UINT16 Xpos;
UINT16 Y; UINT16 Ypos;
UINTN OffsetY; UINTN OffsetY;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapPtr; EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapPtr;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL PaletteValue[16]; EFI_GRAPHICS_OUTPUT_BLT_PIXEL PaletteValue[16];
@ -383,23 +379,23 @@ Output4bitPixel (
// //
// Convert the pixel from 4 bit to corresponding color. // Convert the pixel from 4 bit to corresponding color.
// //
for (Y = 0; Y < Image->Height; Y++) { for (Ypos = 0; Ypos < Image->Height; Ypos++) {
OffsetY = BITMAP_LEN_4_BIT (Image->Width, Y); OffsetY = BITMAP_LEN_4_BIT (Image->Width, Ypos);
// //
// All bits in these bytes are meaningful // All bits in these bytes are meaningful
// //
for (X = 0; X < Image->Width / 2; X++) { for (Xpos = 0; Xpos < Image->Width / 2; Xpos++) {
Byte = *(Data + OffsetY + X); Byte = *(Data + OffsetY + Xpos);
BitMapPtr[Y * Image->Width + X * 2] = PaletteValue[Byte >> 4]; BitMapPtr[Ypos * Image->Width + Xpos * 2] = PaletteValue[Byte >> 4];
BitMapPtr[Y * Image->Width + X * 2 + 1] = PaletteValue[Byte & 0x0F]; BitMapPtr[Ypos * Image->Width + Xpos * 2 + 1] = PaletteValue[Byte & 0x0F];
} }
if (Image->Width % 2 != 0) { if (Image->Width % 2 != 0) {
// //
// Padding bits in this byte should be ignored. // Padding bits in this byte should be ignored.
// //
Byte = *(Data + OffsetY + X); Byte = *(Data + OffsetY + Xpos);
BitMapPtr[Y * Image->Width + X * 2] = PaletteValue[Byte >> 4]; BitMapPtr[Ypos * Image->Width + Xpos * 2] = PaletteValue[Byte >> 4];
} }
} }
} }
@ -408,15 +404,17 @@ Output4bitPixel (
/** /**
Output pixels in "8 bit per pixel" format to an image. Output pixels in "8 bit per pixel" format to an image.
This is a internal function.
@param Image Points to the image which will store the pixels. @param Image Points to the image which will store the pixels.
@param Data Stores the value of output pixels, 0 ~ 255. @param Data Stores the value of output pixels, 0 ~ 255.
@param PaletteInfo PaletteInfo which stores the color of the output @param[in] PaletteInfo PaletteInfo which stores the color of the output
pixels. Each entry corresponds to a color within pixels. Each entry corresponds to a color within
[0, 255]. [0, 255].
**/ **/
STATIC
VOID VOID
Output8bitPixel ( Output8bitPixel (
IN OUT EFI_IMAGE_INPUT *Image, IN OUT EFI_IMAGE_INPUT *Image,
@ -424,8 +422,8 @@ Output8bitPixel (
IN EFI_HII_IMAGE_PALETTE_INFO *PaletteInfo IN EFI_HII_IMAGE_PALETTE_INFO *PaletteInfo
) )
{ {
UINT16 X; UINT16 Xpos;
UINT16 Y; UINT16 Ypos;
UINTN OffsetY; UINTN OffsetY;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapPtr; EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapPtr;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL PaletteValue[256]; EFI_GRAPHICS_OUTPUT_BLT_PIXEL PaletteValue[256];
@ -454,14 +452,14 @@ Output8bitPixel (
// //
// Convert the pixel from 8 bits to corresponding color. // Convert the pixel from 8 bits to corresponding color.
// //
for (Y = 0; Y < Image->Height; Y++) { for (Ypos = 0; Ypos < Image->Height; Ypos++) {
OffsetY = BITMAP_LEN_8_BIT (Image->Width, Y); OffsetY = BITMAP_LEN_8_BIT (Image->Width, Ypos);
// //
// All bits are meaningful since the bitmap is 8 bits per pixel. // All bits are meaningful since the bitmap is 8 bits per pixel.
// //
for (X = 0; X < Image->Width; X++) { for (Xpos = 0; Xpos < Image->Width; Xpos++) {
Byte = *(Data + OffsetY + X); Byte = *(Data + OffsetY + Xpos);
BitMapPtr[OffsetY + X] = PaletteValue[Byte]; BitMapPtr[OffsetY + Xpos] = PaletteValue[Byte];
} }
} }
@ -471,20 +469,22 @@ Output8bitPixel (
/** /**
Output pixels in "24 bit per pixel" format to an image. Output pixels in "24 bit per pixel" format to an image.
This is a internal function.
@param Image Points to the image which will store the pixels. @param Image Points to the image which will store the pixels.
@param Data Stores the color of output pixels, allowing 16.8 @param Data Stores the color of output pixels, allowing 16.8
millions colors. millions colors.
**/ **/
STATIC
VOID VOID
Output24bitPixel ( Output24bitPixel (
IN OUT EFI_IMAGE_INPUT *Image, IN OUT EFI_IMAGE_INPUT *Image,
IN EFI_HII_RGB_PIXEL *Data IN EFI_HII_RGB_PIXEL *Data
) )
{ {
UINT16 Y; UINT16 Ypos;
UINTN OffsetY; UINTN OffsetY;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapPtr; EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapPtr;
@ -492,8 +492,8 @@ Output24bitPixel (
BitMapPtr = Image->Bitmap; BitMapPtr = Image->Bitmap;
for (Y = 0; Y < Image->Height; Y++) { for (Ypos = 0; Ypos < Image->Height; Ypos++) {
OffsetY = BITMAP_LEN_8_BIT (Image->Width, Y); OffsetY = BITMAP_LEN_8_BIT (Image->Width, Ypos);
CopyRgbToGopPixel (&BitMapPtr[OffsetY], &Data[OffsetY], Image->Width); CopyRgbToGopPixel (&BitMapPtr[OffsetY], &Data[OffsetY], Image->Width);
} }
@ -503,7 +503,12 @@ Output24bitPixel (
/** /**
Convert the image from EFI_IMAGE_INPUT to EFI_IMAGE_OUTPUT format. Convert the image from EFI_IMAGE_INPUT to EFI_IMAGE_OUTPUT format.
This is a internal function.
@param BltBuffer Buffer points to bitmap data of incoming image. @param BltBuffer Buffer points to bitmap data of incoming image.
@param BltX Specifies the offset from the left and top edge of
the output image of the first pixel in the image.
@param BltY Specifies the offset from the left and top edge of @param BltY Specifies the offset from the left and top edge of
the output image of the first pixel in the image. the output image of the first pixel in the image.
@param Width Width of the incoming image, in pixels. @param Width Width of the incoming image, in pixels.
@ -517,7 +522,6 @@ Output24bitPixel (
@retval EFI_INVALID_PARAMETER Any incoming parameter is invalid. @retval EFI_INVALID_PARAMETER Any incoming parameter is invalid.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
ImageToBlt ( ImageToBlt (
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer,
@ -530,8 +534,8 @@ ImageToBlt (
) )
{ {
EFI_IMAGE_OUTPUT *ImageOut; EFI_IMAGE_OUTPUT *ImageOut;
UINTN X; UINTN Xpos;
UINTN Y; UINTN Ypos;
UINTN OffsetY1; // src buffer UINTN OffsetY1; // src buffer
UINTN OffsetY2; // dest buffer UINTN OffsetY2; // dest buffer
EFI_GRAPHICS_OUTPUT_BLT_PIXEL SrcPixel; EFI_GRAPHICS_OUTPUT_BLT_PIXEL SrcPixel;
@ -552,17 +556,17 @@ ImageToBlt (
ZeroMem (&ZeroPixel, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)); ZeroMem (&ZeroPixel, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
for (Y = 0; Y < Height; Y++) { for (Ypos = 0; Ypos < Height; Ypos++) {
OffsetY1 = Width * Y; OffsetY1 = Width * Ypos;
OffsetY2 = ImageOut->Width * (BltY + Y); OffsetY2 = ImageOut->Width * (BltY + Ypos);
for (X = 0; X < Width; X++) { for (Xpos = 0; Xpos < Width; Xpos++) {
SrcPixel = BltBuffer[OffsetY1 + X]; SrcPixel = BltBuffer[OffsetY1 + Xpos];
if (Transparent) { if (Transparent) {
if (CompareMem (&SrcPixel, &ZeroPixel, 3) != 0) { if (CompareMem (&SrcPixel, &ZeroPixel, 3) != 0) {
ImageOut->Image.Bitmap[OffsetY2 + BltX + X] = SrcPixel; ImageOut->Image.Bitmap[OffsetY2 + BltX + Xpos] = SrcPixel;
} }
} else { } else {
ImageOut->Image.Bitmap[OffsetY2 + BltX + X] = SrcPixel; ImageOut->Image.Bitmap[OffsetY2 + BltX + Xpos] = SrcPixel;
} }
} }
} }
@ -793,9 +797,6 @@ HiiNewImage (
@param ImageId The image's id,, which is unique within @param ImageId The image's id,, which is unique within
PackageList. PackageList.
@param Image Points to the image. @param Image Points to the image.
@param ImageSize On entry, points to the size of the buffer pointed
to by Image, in bytes. On return, points to the
length of the image, in bytes.
@retval EFI_SUCCESS The new image was returned successfully. @retval EFI_SUCCESS The new image was returned successfully.
@retval EFI_NOT_FOUND The image specified by ImageId is not in the @retval EFI_NOT_FOUND The image specified by ImageId is not in the
@ -1197,6 +1198,8 @@ HiiSetImage (
will be allocated to hold the generated image and will be allocated to hold the generated image and
the pointer updated on exit. It is the caller's the pointer updated on exit. It is the caller's
responsibility to free this buffer. responsibility to free this buffer.
@param BltX Specifies the offset from the left and top edge of
the output image of the first pixel in the image.
@param BltY Specifies the offset from the left and top edge of @param BltY Specifies the offset from the left and top edge of
the output image of the first pixel in the image. the output image of the first pixel in the image.
@ -1226,8 +1229,8 @@ HiiDrawImage (
UINTN BufferLen; UINTN BufferLen;
UINTN Width; UINTN Width;
UINTN Height; UINTN Height;
UINTN X; UINTN Xpos;
UINTN Y; UINTN Ypos;
UINTN OffsetY1; UINTN OffsetY1;
UINTN OffsetY2; UINTN OffsetY2;
EFI_FONT_DISPLAY_INFO *FontInfo; EFI_FONT_DISPLAY_INFO *FontInfo;
@ -1309,11 +1312,11 @@ HiiDrawImage (
if (Width == ImageIn->Width && Height == ImageIn->Height) { if (Width == ImageIn->Width && Height == ImageIn->Height) {
CopyMem (BltBuffer, ImageIn->Bitmap, BufferLen); CopyMem (BltBuffer, ImageIn->Bitmap, BufferLen);
} else { } else {
for (Y = 0; Y < Height; Y++) { for (Ypos = 0; Ypos < Height; Ypos++) {
OffsetY1 = ImageIn->Width * Y; OffsetY1 = ImageIn->Width * Ypos;
OffsetY2 = Width * Y; OffsetY2 = Width * Ypos;
for (X = 0; X < Width; X++) { for (Xpos = 0; Xpos < Width; Xpos++) {
BltBuffer[OffsetY2 + X] = ImageIn->Bitmap[OffsetY1 + X]; BltBuffer[OffsetY2 + Xpos] = ImageIn->Bitmap[OffsetY1 + Xpos];
} }
} }
} }
@ -1442,6 +1445,8 @@ HiiDrawImage (
allocated to hold the generated image and the allocated to hold the generated image and the
pointer updated on exit. It is the caller's pointer updated on exit. It is the caller's
responsibility to free this buffer. responsibility to free this buffer.
@param BltX Specifies the offset from the left and top edge of
the output image of the first pixel in the image.
@param BltY Specifies the offset from the left and top edge of @param BltY Specifies the offset from the left and top edge of
the output image of the first pixel in the image. the output image of the first pixel in the image.

View File

@ -1,4 +1,6 @@
/**@file /** @file
Implement a utility function named R8_EfiLibCompareLanguage.
Copyright (c) 2007 - 2008, Intel Corporation Copyright (c) 2007 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials

View File

@ -1,4 +1,6 @@
/**@file /** @file
Implement a utility function named R8_EfiLibCompareLanguage.
Copyright (c) 2007 - 2008, Intel Corporation Copyright (c) 2007 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials

View File

@ -1,4 +1,6 @@
/** @file /** @file
Implementation for EFI_HII_STRING_PROTOCOL.
Copyright (c) 2007, Intel Corporation Copyright (c) 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
@ -9,17 +11,6 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
String.c
Abstract:
Implementation for EFI_HII_STRING_PROTOCOL.
Revision History
**/ **/
@ -38,6 +29,9 @@ CHAR16 mLanguageWindow[16] = {
font info list or not. (i.e. HII_FONT_INFO is generated.) If not, create font info list or not. (i.e. HII_FONT_INFO is generated.) If not, create
a HII_FONT_INFO to refer it locally. a HII_FONT_INFO to refer it locally.
This is a internal function.
@param Private Hii database private structure. @param Private Hii database private structure.
@param StringPackage HII string package instance. @param StringPackage HII string package instance.
@param FontId Font identifer, which must be unique within the string package. @param FontId Font identifer, which must be unique within the string package.
@ -53,7 +47,6 @@ CHAR16 mLanguageWindow[16] = {
@retval FALSE Not referred before calling this function. @retval FALSE Not referred before calling this function.
**/ **/
STATIC
BOOLEAN BOOLEAN
ReferFontInfoLocally ( ReferFontInfoLocally (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -104,8 +97,12 @@ ReferFontInfoLocally (
/** /**
Convert Ascii string text to unicode string test. Convert Ascii string text to unicode string test.
@param StringSrc Points to current null-terminated Ascii string. This is a internal function.
@param StringDest Buffer to store the converted string text.
@param StringDest Buffer to store the string text. If it is NULL,
only the size will be returned.
@param StringSrc Points to current null-terminated string.
@param BufferSize Length of the buffer. @param BufferSize Length of the buffer.
@retval EFI_SUCCESS The string text was outputed successfully. @retval EFI_SUCCESS The string text was outputed successfully.
@ -114,7 +111,6 @@ ReferFontInfoLocally (
size. size.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
ConvertToUnicodeText ( ConvertToUnicodeText (
OUT EFI_STRING StringDest, OUT EFI_STRING StringDest,
@ -146,8 +142,11 @@ ConvertToUnicodeText (
Calculate the size of StringSrc and output it. If StringDest is not NULL, Calculate the size of StringSrc and output it. If StringDest is not NULL,
copy string text from src to dest. copy string text from src to dest.
This is a internal function.
@param StringDest Buffer to store the string text. If it is NULL,
only the size will be returned.
@param StringSrc Points to current null-terminated string. @param StringSrc Points to current null-terminated string.
@param StringDest Buffer to store the string text.
@param BufferSize Length of the buffer. @param BufferSize Length of the buffer.
@retval EFI_SUCCESS The string text was outputed successfully. @retval EFI_SUCCESS The string text was outputed successfully.
@ -156,7 +155,6 @@ ConvertToUnicodeText (
size. size.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
GetUnicodeStringTextOrSize ( GetUnicodeStringTextOrSize (
OUT EFI_STRING StringDest, OPTIONAL OUT EFI_STRING StringDest, OPTIONAL
@ -194,6 +192,8 @@ GetUnicodeStringTextOrSize (
/** /**
Copy string font info to a buffer. Copy string font info to a buffer.
This is a internal function.
@param StringPackage Hii string package instance. @param StringPackage Hii string package instance.
@param FontId Font identifier which is unique in a string @param FontId Font identifier which is unique in a string
package. package.
@ -204,7 +204,6 @@ GetUnicodeStringTextOrSize (
@retval EFI_NOT_FOUND The specified font id does not exist. @retval EFI_NOT_FOUND The specified font id does not exist.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
GetStringFontInfo ( GetStringFontInfo (
IN HII_STRING_PACKAGE_INSTANCE *StringPackage, IN HII_STRING_PACKAGE_INSTANCE *StringPackage,
@ -567,6 +566,8 @@ FindStringBlock (
/** /**
Parse all string blocks to get a string specified by StringId. Parse all string blocks to get a string specified by StringId.
This is a internal function.
@param Private Hii database private structure. @param Private Hii database private structure.
@param StringPackage Hii string package instance. @param StringPackage Hii string package instance.
@param StringId The string's id, which is unique within @param StringId The string's id, which is unique within
@ -587,7 +588,6 @@ FindStringBlock (
hold the string. hold the string.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
GetStringWorker ( GetStringWorker (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -676,6 +676,8 @@ GetStringWorker (
/** /**
Parse all string blocks to set a String specified by StringId. Parse all string blocks to set a String specified by StringId.
This is a internal function.
@param Private HII database driver private structure. @param Private HII database driver private structure.
@param StringPackage HII string package instance. @param StringPackage HII string package instance.
@param StringId The string's id, which is unique within @param StringId The string's id, which is unique within
@ -693,7 +695,6 @@ GetStringWorker (
task. task.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
SetStringWorker ( SetStringWorker (
IN HII_DATABASE_PRIVATE_DATA *Private, IN HII_DATABASE_PRIVATE_DATA *Private,
@ -1557,14 +1558,14 @@ HiiGetLanguages (
FirstLanguage. If there are no secondary FirstLanguage. If there are no secondary
languages, the function returns successfully, but languages, the function returns successfully, but
this is set to NULL. this is set to NULL.
@param SecondaryLanguageSize On entry, points to the size of the buffer pointed @param SecondaryLanguagesSize On entry, points to the size of the buffer pointed
to by SecondLanguages, in bytes. On return, to by SecondaryLanguages, in bytes. On return,
points to the length of SecondLanguages in bytes. points to the length of SecondaryLanguages in bytes.
@retval EFI_SUCCESS Secondary languages were correctly returned. @retval EFI_SUCCESS Secondary languages were correctly returned.
@retval EFI_INVALID_PARAMETER FirstLanguage or SecondLanguages or @retval EFI_INVALID_PARAMETER FirstLanguage or SecondaryLanguages or
SecondLanguagesSize was NULL. SecondaryLanguagesSize was NULL.
@retval EFI_BUFFER_TOO_SMALL The buffer specified by SecondLanguagesSize is @retval EFI_BUFFER_TOO_SMALL The buffer specified by SecondaryLanguagesSize is
too small to hold the returned information. too small to hold the returned information.
SecondLanguageSize is updated to hold the size of SecondLanguageSize is updated to hold the size of
the buffer required. the buffer required.
@ -1579,8 +1580,8 @@ HiiGetSecondaryLanguages (
IN CONST EFI_HII_STRING_PROTOCOL *This, IN CONST EFI_HII_STRING_PROTOCOL *This,
IN EFI_HII_HANDLE PackageList, IN EFI_HII_HANDLE PackageList,
IN CONST CHAR8 *FirstLanguage, IN CONST CHAR8 *FirstLanguage,
IN OUT CHAR8 *SecondLanguages, IN OUT CHAR8 *SecondaryLanguages,
IN OUT UINTN *SecondLanguagesSize IN OUT UINTN *SecondaryLanguagesSize
) )
{ {
LIST_ENTRY *Link; LIST_ENTRY *Link;
@ -1595,7 +1596,7 @@ HiiGetSecondaryLanguages (
if (This == NULL || PackageList == NULL || FirstLanguage == NULL) { if (This == NULL || PackageList == NULL || FirstLanguage == NULL) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (SecondLanguages == NULL || SecondLanguagesSize == NULL) { if (SecondaryLanguages == NULL || SecondaryLanguagesSize == NULL) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (!IsHiiHandleValid (PackageList)) { if (!IsHiiHandleValid (PackageList)) {
@ -1637,10 +1638,10 @@ HiiGetSecondaryLanguages (
Languages++; Languages++;
ResultSize = AsciiStrSize (Languages); ResultSize = AsciiStrSize (Languages);
if (ResultSize <= *SecondLanguagesSize) { if (ResultSize <= *SecondaryLanguagesSize) {
AsciiStrCpy (SecondLanguages, Languages); AsciiStrCpy (SecondaryLanguages, Languages);
} else { } else {
*SecondLanguagesSize = ResultSize; *SecondaryLanguagesSize = ResultSize;
return EFI_BUFFER_TOO_SMALL; return EFI_BUFFER_TOO_SMALL;
} }