diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c index 8decc76102..d7ae310573 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c @@ -25,19 +25,20 @@ Revision History #include "HiiDatabase.h" -#ifndef DISABLE_UNUSED_HII_PROTOCOLS +#ifndef _DISABLE_UNUSED_HII_PROTOCOLS_ /** Calculate the number of Unicode characters of the incoming Configuration string, not including NULL terminator. + This is a internal function. + @param String String in or format. @return The number of Unicode characters. **/ -STATIC UINTN CalculateConfigStringLen ( IN EFI_STRING String @@ -71,6 +72,8 @@ CalculateConfigStringLen ( Convert the hex UNICODE %02x encoding of a UEFI device path to binary from of . + This is a internal function. + @param String UEFI configuration string @param DevicePath binary of a UEFI device path. @@ -80,7 +83,6 @@ CalculateConfigStringLen ( binary format. **/ -STATIC EFI_STATUS GetDevicePath ( IN EFI_STRING String, @@ -143,6 +145,8 @@ GetDevicePath ( /** Extract Storage from all Form Packages in current hii database. + This is a internal function. + @param HiiDatabase EFI_HII_DATABASE_PROTOCOL instance. @param StorageListHead Storage link List head. @@ -151,7 +155,6 @@ GetDevicePath ( @retval EFI_SUCCESS All existing storage is exported. **/ -STATIC EFI_STATUS ExportAllStorage ( IN EFI_HII_DATABASE_PROTOCOL *HiiDatabase, @@ -316,6 +319,8 @@ ExportAllStorage ( /** 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 generated string, e.g. GUID= @param BufferLen The length of the Buffer in bytes. @@ -329,7 +334,6 @@ ExportAllStorage ( **/ -STATIC VOID GenerateSubStr ( IN CONST EFI_STRING String, @@ -390,6 +394,8 @@ GenerateSubStr ( /** Retrieve the from String then output it. + This is a internal function. + @param String A sub string of a configuration string in format. @param ConfigBody Points to the output string. It's caller's @@ -400,7 +406,6 @@ GenerateSubStr ( @retval EFI_SUCCESS All existing storage is exported. **/ -STATIC EFI_STATUS OutputConfigBody ( IN EFI_STRING String, @@ -444,36 +449,33 @@ OutputConfigBody ( #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 * ReallocatePool ( IN VOID *OldPool, IN UINTN OldSize, 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; NewPool = NULL; - if (NewSize) { + if (NewSize != 0) { NewPool = AllocateZeroPool (NewSize); } - if (OldPool) { - if (NewPool) { + if (OldPool != NULL) { + if (NewPool != NULL) { CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize); } @@ -487,6 +489,8 @@ Returns: /** Append a string to a multi-string format. + This is a internal function. + @param MultiString String in , , or . On input, the buffer length of this string is @@ -498,7 +502,6 @@ Returns: @retval EFI_SUCCESS AppendString is append to the end of MultiString **/ -STATIC EFI_STATUS AppendToMultiString ( IN OUT EFI_STRING *MultiString, @@ -541,6 +544,8 @@ AppendToMultiString ( or WIDTH or VALUE. ::= 'OFFSET='&'WIDTH='&'VALUE'= + This is a internal function. + @param StringPtr String in format and points to the first character of . @param Number The output value. Caller takes the responsibility @@ -553,7 +558,6 @@ AppendToMultiString ( successfully. **/ -STATIC EFI_STATUS GetValueOfNumber ( IN EFI_STRING StringPtr, @@ -656,7 +660,7 @@ HiiConfigRoutingExtractConfig ( OUT EFI_STRING *Results ) { -#ifndef DISABLE_UNUSED_HII_PROTOCOLS +#ifndef _DISABLE_UNUSED_HII_PROTOCOLS_ HII_DATABASE_PRIVATE_DATA *Private; EFI_STRING StringPtr; @@ -858,7 +862,7 @@ HiiConfigRoutingExportConfig ( OUT EFI_STRING *Results ) { -#ifndef DISABLE_UNUSED_HII_PROTOCOLS +#ifndef _DISABLE_UNUSED_HII_PROTOCOLS_ EFI_STATUS Status; HII_DATABASE_PRIVATE_DATA *Private; @@ -1085,7 +1089,7 @@ HiiConfigRoutingRouteConfig ( OUT EFI_STRING *Progress ) { -#ifndef DISABLE_UNUSED_HII_PROTOCOLS +#ifndef _DISABLE_UNUSED_HII_PROTOCOLS_ HII_DATABASE_PRIVATE_DATA *Private; EFI_STRING StringPtr; @@ -1757,22 +1761,33 @@ HiiGetAltCfg ( OUT EFI_STRING *AltCfgResp ) { -#ifndef DISABLE_UNUSED_HII_PROTOCOLS +#ifndef _DISABLE_UNUSED_HII_PROTOCOLS_ EFI_STATUS Status; EFI_STRING StringPtr; - EFI_STRING HdrStart = NULL; - EFI_STRING HdrEnd = NULL; + EFI_STRING HdrStart; + EFI_STRING HdrEnd; EFI_STRING TmpPtr; UINTN Length; - EFI_STRING GuidStr = NULL; - EFI_STRING NameStr = NULL; - EFI_STRING PathStr = NULL; - EFI_STRING AltIdStr = NULL; - EFI_STRING Result = NULL; - BOOLEAN GuidFlag = FALSE; - BOOLEAN NameFlag = FALSE; - BOOLEAN PathFlag = FALSE; + EFI_STRING GuidStr; + EFI_STRING NameStr; + EFI_STRING PathStr; + EFI_STRING AltIdStr; + EFI_STRING Result; + BOOLEAN GuidFlag; + BOOLEAN NameFlag; + 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) { return EFI_INVALID_PARAMETER; diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c index b5a5c43b43..dcb56504dc 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c @@ -1,4 +1,6 @@ /** @file +Implementation for EFI_HII_DATABASE_PROTOCOL. + Copyright (c) 2007 - 2008, Intel Corporation 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, 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 is a internal function. @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 @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. **/ -STATIC EFI_STATUS GenerateHiiDatabaseRecord ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -118,6 +109,7 @@ GenerateHiiDatabaseRecord ( /** 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 @@ -148,6 +140,7 @@ IsHiiHandleValid ( /** This function invokes the matching registered function. + This is a internal function. @param Private HII Database driver private structure. @param NotifyType The type of change concerning the database. @@ -162,7 +155,6 @@ IsHiiHandleValid ( @retval EFI_INVALID_PARAMETER Any input parameter is not valid. **/ -STATIC EFI_STATUS InvokeRegisteredFunction ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -357,6 +349,7 @@ InvokeRegisteredFunction ( /** 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 information. @@ -371,7 +364,6 @@ InvokeRegisteredFunction ( @retval EFI_INVALID_PARAMETER PackageHdr is NULL or PackageList is NULL. **/ -STATIC EFI_STATUS InsertGuidPackage ( IN VOID *PackageHdr, @@ -417,6 +409,7 @@ InsertGuidPackage ( /** This function exports GUID packages to a buffer. + This is a internal function. @param Private Hii database private structure. @param Handle Identification of a package list. @@ -431,7 +424,6 @@ InsertGuidPackage ( @retval EFI_INVALID_PARAMETER Any input parameter is invalid. **/ -STATIC EFI_STATUS ExportGuidPackages ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -485,6 +477,7 @@ ExportGuidPackages ( /** This function deletes all GUID packages from a package list node. + This is a internal function. @param Private Hii database private data. @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. **/ -STATIC EFI_STATUS RemoveGuidPackages ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -542,6 +534,7 @@ RemoveGuidPackages ( /** 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 information. @@ -556,7 +549,6 @@ RemoveGuidPackages ( @retval EFI_INVALID_PARAMETER PackageHdr is NULL or PackageList is NULL. **/ -STATIC EFI_STATUS InsertFormPackage ( IN VOID *PackageHdr, @@ -618,6 +610,7 @@ InsertFormPackage ( /** This function exports Form packages to a buffer. + This is a internal function. @param Private Hii database private structure. @param Handle Identification of a package list. @@ -632,7 +625,6 @@ InsertFormPackage ( @retval EFI_INVALID_PARAMETER Any input parameter is invalid. **/ -STATIC EFI_STATUS ExportFormPackages ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -701,6 +693,7 @@ ExportFormPackages ( /** This function deletes all Form packages from a package list node. + This is a internal function. @param Private Hii database private data. @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. **/ -STATIC EFI_STATUS RemoveFormPackages ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -758,6 +750,7 @@ RemoveFormPackages ( /** This function insert a String package to a package list node. + This is a internal function. @param Private Hii database private structure. @param PackageHdr Pointer to a buffer stored with String package @@ -775,7 +768,6 @@ RemoveFormPackages ( exists in current package list. **/ -STATIC EFI_STATUS InsertStringPackage ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -894,6 +886,7 @@ Error: /** This function exports String packages to a buffer. + This is a internal function. @param Private Hii database private structure. @param Handle Identification of a package list. @@ -908,7 +901,6 @@ Error: @retval EFI_INVALID_PARAMETER Any input parameter is invalid. **/ -STATIC EFI_STATUS ExportStringPackages ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -976,6 +968,7 @@ ExportStringPackages ( /** This function deletes all String packages from a package list node. + This is a internal function. @param Private Hii database private data. @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. **/ -STATIC EFI_STATUS RemoveStringPackages ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -1047,6 +1039,7 @@ RemoveStringPackages ( /** This function insert a Font package to a package list node. + This is a internal function. @param Private Hii database private structure. @param PackageHdr Pointer to a buffer stored with Font package @@ -1064,7 +1057,6 @@ RemoveStringPackages ( exists in current hii database. **/ -STATIC EFI_STATUS InsertFontPackage ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -1190,6 +1182,7 @@ Error: /** This function exports Font packages to a buffer. + This is a internal function. @param Private Hii database private structure. @param Handle Identification of a package list. @@ -1204,7 +1197,6 @@ Error: @retval EFI_INVALID_PARAMETER Any input parameter is invalid. **/ -STATIC EFI_STATUS ExportFontPackages ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -1273,6 +1265,7 @@ ExportFontPackages ( /** This function deletes all Font packages from a package list node. + This is a internal function. @param Private Hii database private data. @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. **/ -STATIC EFI_STATUS RemoveFontPackages ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -1359,6 +1351,7 @@ RemoveFontPackages ( /** 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 information. @@ -1373,7 +1366,6 @@ RemoveFontPackages ( @retval EFI_INVALID_PARAMETER PackageHdr is NULL or PackageList is NULL. **/ -STATIC EFI_STATUS InsertImagePackage ( IN VOID *PackageHdr, @@ -1484,6 +1476,7 @@ InsertImagePackage ( /** This function exports Image packages to a buffer. + This is a internal function. @param Private Hii database private structure. @param Handle Identification of a package list. @@ -1498,7 +1491,6 @@ InsertImagePackage ( @retval EFI_INVALID_PARAMETER Any input parameter is invalid. **/ -STATIC EFI_STATUS ExportImagePackages ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -1575,6 +1567,7 @@ ExportImagePackages ( /** This function deletes Image package from a package list node. + This is a internal function. @param Private Hii database private data. @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. **/ -STATIC EFI_STATUS RemoveImagePackages ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -1631,6 +1623,7 @@ RemoveImagePackages ( /** 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 package information. @@ -1645,7 +1638,6 @@ RemoveImagePackages ( @retval EFI_INVALID_PARAMETER PackageHdr is NULL or PackageList is NULL. **/ -STATIC EFI_STATUS InsertSimpleFontPackage ( IN VOID *PackageHdr, @@ -1707,6 +1699,7 @@ Error: /** This function exports SimpleFont packages to a buffer. + This is a internal function. @param Private Hii database private structure. @param Handle Identification of a package list. @@ -1721,7 +1714,6 @@ Error: @retval EFI_INVALID_PARAMETER Any input parameter is invalid. **/ -STATIC EFI_STATUS ExportSimpleFontPackages ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -1780,6 +1772,7 @@ ExportSimpleFontPackages ( /** This function deletes all Simple Font packages from a package list node. + This is a internal function. @param Private Hii database private data. @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. **/ -STATIC EFI_STATUS RemoveSimpleFontPackages ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -1835,6 +1827,7 @@ RemoveSimpleFontPackages ( /** 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 instance @@ -1848,7 +1841,6 @@ RemoveSimpleFontPackages ( @retval EFI_INVALID_PARAMETER DevicePath is NULL or PackageList is NULL. **/ -STATIC EFI_STATUS InsertDevicePathPackage ( IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, @@ -1895,6 +1887,7 @@ InsertDevicePathPackage ( /** This function exports device path package to a buffer. + This is a internal function. @param Private Hii database private structure. @param Handle Identification of a package list. @@ -1909,7 +1902,6 @@ InsertDevicePathPackage ( @retval EFI_INVALID_PARAMETER Any input parameter is invalid. **/ -STATIC EFI_STATUS ExportDevicePathPackage ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -1966,6 +1958,7 @@ ExportDevicePathPackage ( /** This function deletes Device Path package from a package list node. + This is a internal function. @param Private Hii database private data. @param Handle Handle of the package list. @@ -1976,7 +1969,6 @@ ExportDevicePathPackage ( @retval EFI_INVALID_PARAMETER Any input parameter is not valid. **/ -STATIC EFI_STATUS RemoveDevicePathPackage ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -2022,6 +2014,7 @@ RemoveDevicePathPackage ( /** This function will insert a device path package to package list firstly then invoke notification functions if any. + This is a internal function. @param Private Hii database private structure. @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. **/ -STATIC EFI_STATUS AddDevicePathPackage ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -2078,6 +2070,7 @@ AddDevicePathPackage ( /** 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 package information. @@ -2092,7 +2085,6 @@ AddDevicePathPackage ( @retval EFI_INVALID_PARAMETER PackageHdr is NULL or PackageList is NULL. **/ -STATIC EFI_STATUS InsertKeyboardLayoutPackage ( IN VOID *PackageHdr, @@ -2149,6 +2141,7 @@ Error: /** This function exports Keyboard Layout packages to a buffer. + This is a internal function. @param Private Hii database private structure. @param Handle Identification of a package list. @@ -2164,7 +2157,6 @@ Error: @retval EFI_INVALID_PARAMETER Any input parameter is invalid. **/ -STATIC EFI_STATUS ExportKeyboardLayoutPackages ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -2225,6 +2217,7 @@ ExportKeyboardLayoutPackages ( /** This function deletes all Keyboard Layout packages from a package list node. + This is a internal function. @param Private Hii database private data. @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. **/ -STATIC EFI_STATUS RemoveKeyboardLayoutPackages ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -2286,6 +2278,8 @@ RemoveKeyboardLayoutPackages ( invoke notification functions if any. It is the worker function of HiiNewPackageList and HiiUpdatePackageList. + This is a internal function. + @param Private Hii database private structure. @param NotifyType The type of change concerning the database. @param PackageList Pointer to a package list. @@ -2299,7 +2293,6 @@ RemoveKeyboardLayoutPackages ( @retval EFI_INVALID_PARAMETER Any input parameter is invalid. **/ -STATIC EFI_STATUS AddPackages ( 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 of HiiExportPackageList. + This is a internal function. + @param Private Hii database private structure. @param Handle Identification of a package list. @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. **/ -STATIC EFI_STATUS ExportPackageList ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -3336,7 +3330,7 @@ HiiRegisterPackageNotify ( @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance. - @param NotifyHandle The handle of the notification function being + @param NotificationHandle The handle of the notification function being unregistered. @retval EFI_SUCCESS Notification is unregistered successfully. diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c index 9e99a12012..9c68ac89b6 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c @@ -1,4 +1,6 @@ /** @file +Implementation for EFI_HII_FONT_PROTOCOL. + Copyright (c) 2007 - 2008, Intel Corporation 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, 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" -static EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = { +STATIC EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = { // // 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. + This is a internal function. + @param CharValue Unicode character value, which identifies a glyph block. @param GlyphInfoList HII_GLYPH_INFO list head. @@ -61,7 +54,6 @@ static EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = { task. **/ -STATIC EFI_STATUS NewCell ( IN CHAR16 CharValue, @@ -94,6 +86,8 @@ NewCell ( /** 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 block. @param GlyphInfoList HII_GLYPH_INFO list head. @@ -105,7 +99,6 @@ NewCell ( not exist. **/ -STATIC EFI_STATUS GetCell ( IN CHAR16 CharValue, @@ -143,6 +136,8 @@ GetCell ( /** Convert the glyph for a single character into a bitmap. + This is a internal function. + @param Private HII database driver private data. @param Char Character to retrieve. @param StringInfo Points to the string font and color information @@ -158,7 +153,6 @@ GetCell ( @retval EFI_INVALID_PARAMETER Any input parameter is invalid. **/ -STATIC EFI_STATUS GetGlyphBuffer ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -266,7 +260,28 @@ GetGlyphBuffer ( 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 NarrowGlyphToBlt ( IN UINT8 *GlyphBuffer, @@ -278,8 +293,8 @@ NarrowGlyphToBlt ( IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **Origin ) { - UINT8 X; - UINT8 Y; + UINT8 Xpos; + UINT8 Ypos; UINT8 Height; UINT8 Width; EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Buffer; @@ -293,13 +308,13 @@ NarrowGlyphToBlt ( Buffer = *Origin; - for (Y = 0; Y < Height; Y++) { - for (X = 0; X < Width; X++) { - if ((GlyphBuffer[Y] & (1 << X)) != 0) { - Buffer[Y * ImageWidth + (Width - X - 1)] = Foreground; + for (Ypos = 0; Ypos < Height; Ypos++) { + for (Xpos = 0; Xpos < Width; Xpos++) { + if ((GlyphBuffer[Ypos] & (1 << Xpos)) != 0) { + Buffer[Ypos * ImageWidth + (Width - Xpos - 1)] = Foreground; } else { 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. + 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 Width Width of the character or character cell, in + @param ImageWidth Width of the character or character cell, in pixels. - @param Height Height of the character or character cell, in + @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 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 GlyphToBlt ( IN UINT8 *GlyphBuffer, @@ -342,8 +362,8 @@ GlyphToBlt ( IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **Origin ) { - UINT8 X; - UINT8 Y; + UINT8 Xpos; + UINT8 Ypos; UINT8 Data; UINT8 Index; UINTN OffsetY; @@ -366,20 +386,20 @@ GlyphToBlt ( // The glyph's upper left hand corner pixel is the most significant bit of the // first bitmap byte. // - for (Y = 0; Y < Cell->Height; Y++) { - OffsetY = BITMAP_LEN_1_BIT (Cell->Width, Y); + for (Ypos = 0; Ypos < Cell->Height; Ypos++) { + OffsetY = BITMAP_LEN_1_BIT (Cell->Width, Ypos); // // All bits in these bytes are meaningful. // - for (X = 0; X < Cell->Width / 8; X++) { - Data = *(GlyphBuffer + OffsetY + X); + for (Xpos = 0; Xpos < Cell->Width / 8; Xpos++) { + Data = *(GlyphBuffer + OffsetY + Xpos); for (Index = 0; Index < 8; Index++) { if ((Data & (1 << Index)) != 0) { - BltBuffer[Y * ImageWidth + X * 8 + (8 - Index - 1)] = Foreground; + BltBuffer[Ypos * ImageWidth + Xpos * 8 + (8 - Index - 1)] = Foreground; } else { 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. // - Data = *(GlyphBuffer + OffsetY + X); + Data = *(GlyphBuffer + OffsetY + Xpos); for (Index = 0; Index < Cell->Width % 8; Index++) { if ((Data & (1 << (8 - Index - 1))) != 0) { - BltBuffer[Y * ImageWidth + X * 8 + Index] = Foreground; + BltBuffer[Ypos * ImageWidth + Xpos * 8 + Index] = Foreground; } else { if (!Transparent) { - BltBuffer[Y * ImageWidth + X * 8 + Index] = Background; + BltBuffer[Ypos * ImageWidth + Xpos * 8 + Index] = Background; } } } } // end of if (Width % 8...) - } // end of for (Y=0...) + } // end of for (Ypos=0...) *Origin = BltBuffer + Cell->Width; } @@ -410,14 +430,16 @@ GlyphToBlt ( /** 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 Width Width of the character or character cell, in + @param ImageWidth Width of the character or character cell, in pixels. - @param Height Height of the character or character cell, in + @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 @@ -431,7 +453,6 @@ GlyphToBlt ( @return Points to the address of next origin node in BltBuffer. **/ -STATIC VOID GlyphToImage ( IN UINT8 *GlyphBuffer, @@ -531,6 +552,8 @@ GlyphToImage ( /** Write the output parameters of FindGlyphBlock(). + This is a internal function. + @param BufferIn Buffer which stores the bitmap data of the found block. @param BufferLen Length of BufferIn. @@ -548,7 +571,6 @@ GlyphToImage ( task. **/ -STATIC EFI_STATUS WriteOutputParam ( IN UINT8 *BufferIn, @@ -817,6 +839,8 @@ FindGlyphBlock ( /** Copy a Font Name to a new created EFI_FONT_INFO structure. + This is a internal function. + @param FontName NULL-terminated string. @param FontInfo a new EFI_FONT_INFO which stores the FontName. It's caller's responsibility to free this buffer. @@ -826,7 +850,6 @@ FindGlyphBlock ( task. **/ -STATIC EFI_STATUS SaveFontName ( IN EFI_STRING FontName, @@ -908,6 +931,8 @@ GetSystemFont ( Check whether EFI_FONT_DISPLAY_INFO points to system default font and color or returns the system default according to the optional inputs. + This is a internal function. + @param Private HII database driver private data. @param StringInfo Points to the string output information, including the color and font. @@ -920,7 +945,6 @@ GetSystemFont ( @retval FALSE No. **/ -STATIC BOOLEAN IsSystemFontInfo ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -1318,6 +1342,8 @@ IsFontInfoExisted ( /** Check whether the unicode represents a line break or not. + This is a internal function. + @param Char Unicode character @retval 0 Yes, it is a line break. @@ -1328,7 +1354,6 @@ IsFontInfoExisted ( @retval -1 No, it is not a link break. **/ -STATIC INT8 IsLineBreak ( IN CHAR16 Char @@ -1413,7 +1438,10 @@ IsLineBreak ( will be allocated to hold the generated image and the pointer updated on exit. It is the caller's 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 image. @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 the pointer updated on exit. It is the caller's 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 image. @param RowInfoArray If this is non-NULL on entry, then on exit, this diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h index bbd366edec..ac88b86d07 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h @@ -1,4 +1,5 @@ /** @file +Private structures definitions in HiiDatabase. Copyright (c) 2007 - 2008, Intel Corporation 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, 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__ @@ -251,7 +241,7 @@ typedef struct _HII_DATABASE_PRIVATE_DATA { LIST_ENTRY DatabaseList; LIST_ENTRY DatabaseNotifyList; EFI_HII_FONT_PROTOCOL HiiFont; -#ifndef DISABLE_UNUSED_HII_PROTOCOLS +#ifndef _DISABLE_UNUSED_HII_PROTOCOLS_ EFI_HII_IMAGE_PROTOCOL HiiImage; #endif 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 @@ -470,7 +460,10 @@ FindGlyphBlock ( will be allocated to hold the generated image and the pointer updated on exit. It is the caller's 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 image. @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 the pointer updated on exit. It is the caller's 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 image. @param RowInfoArray If this is non-NULL on entry, then on exit, this @@ -622,7 +618,7 @@ EFIAPI HiiGetGlyph ( IN CONST EFI_HII_FONT_PROTOCOL *This, IN CHAR16 Char, - IN CONST EFI_FONT_DISPLAY_INFO *StringInfo, OPTIONAL + IN CONST EFI_FONT_DISPLAY_INFO *StringInfo, OUT EFI_IMAGE_OUTPUT **Blt, OUT UINTN *Baseline OPTIONAL ) @@ -663,7 +659,7 @@ EFIAPI HiiGetFontInfo ( IN CONST EFI_HII_FONT_PROTOCOL *This, 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, IN CONST EFI_STRING String OPTIONAL ) @@ -778,6 +774,9 @@ HiiSetImage ( a buffer will be allocated to hold the generated image and the pointer updated on exit. It is the 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 of the output image of the first pixel in the image. @@ -821,6 +820,9 @@ HiiDrawImage ( allocated to hold the generated image and the pointer updated on exit. It is the 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 of the output image of the first pixel in the image. @@ -1025,7 +1027,7 @@ HiiGetLanguages ( FirstLanguage. If there are no secondary languages, the function returns successfully, 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 return, points to the length of SecondLanguages in bytes. @@ -1048,8 +1050,8 @@ HiiGetSecondaryLanguages ( 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 CHAR8 *SecondaryLanguages, + IN OUT UINTN *SecondaryLanguagesSize ) ; @@ -1278,7 +1280,7 @@ HiiRegisterPackageNotify ( @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance. - @param NotifyHandle The handle of the notification function being + @param NotificationHandle The handle of the notification function being unregistered. @retval EFI_SUCCESS Notification is unregistered successfully. diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c index 4bba8af1b1..c7ffdfe77c 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c @@ -48,7 +48,7 @@ STATIC HII_DATABASE_PRIVATE_DATA mPrivate = { HiiGetGlyph, HiiGetFontInfo }, -#ifndef DISABLE_UNUSED_HII_PROTOCOLS +#ifndef _DISABLE_UNUSED_HII_PROTOCOLS_ { HiiNewImage, HiiGetImage, @@ -104,7 +104,16 @@ STATIC HII_DATABASE_PRIVATE_DATA mPrivate = { 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 EFIAPI KeyboardLayoutChangeNullEvent ( @@ -115,54 +124,41 @@ KeyboardLayoutChangeNullEvent ( 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 EFIAPI InitializeHiiDatabase ( IN EFI_HANDLE ImageHandle, 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_HANDLE Handle; - EFI_HANDLE *HandleBuffer; - UINTN HandleCount; // // There will be only one HII Database in the system // If there is another out there, someone is trying to install us // again. Fail that scenario. // - Status = gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiHiiDatabaseProtocolGuid, - NULL, - &HandleCount, - &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; - } - + ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiDatabaseProtocolGuid); + ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiFontProtocolGuid); + ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiImageProtocolGuid); + ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiStringProtocolGuid); + ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiConfigRoutingProtocolGuid); + InitializeListHead (&mPrivate.DatabaseList); InitializeListHead (&mPrivate.DatabaseNotifyList); InitializeListHead (&mPrivate.HiiHandleList); @@ -188,7 +184,7 @@ Returns: &Handle, &gEfiHiiFontProtocolGuid, &mPrivate.HiiFont, -#ifndef DISABLE_UNUSED_HII_PROTOCOLS +#ifndef _DISABLE_UNUSED_HII_PROTOCOLS_ &gEfiHiiImageProtocolGuid, &mPrivate.HiiImage, #endif diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c index 6b6a72002d..8bba0fc21f 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c @@ -1,4 +1,6 @@ /** @file +Implementation for EFI_HII_IMAGE_PROTOCOL. + Copyright (c) 2007 - 2008, Intel Corporation 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, 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" -#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* GetImageIdOrAddress ( IN UINT8 *ImageBlock, 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; UINT8 *ImageBlockHdr; @@ -199,13 +187,15 @@ GetImageIdOrAddress ( /** 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 BitMapIn Pixels in EFI_GRAPHICS_OUTPUT_BLT_PIXEL format. @param PixelNum The number of pixels to be converted. **/ -STATIC VOID CopyGopToRgbPixel ( 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. + This is a internal function. + + @param BitMapOut Pixels in EFI_GRAPHICS_OUTPUT_BLT_PIXEL format. @param BitMapIn Pixels in EFI_HII_RGB_PIXEL format. @param PixelNum The number of pixels to be converted. **/ -STATIC VOID CopyRgbToGopPixel ( OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapOut, @@ -253,6 +245,9 @@ CopyRgbToGopPixel ( /** 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 Data Stores the value of output pixels, 0 or 1. @param PaletteInfo PaletteInfo which stores the color of the output @@ -261,7 +256,6 @@ CopyRgbToGopPixel ( **/ -STATIC VOID Output1bitPixel ( IN OUT EFI_IMAGE_INPUT *Image, @@ -269,8 +263,8 @@ Output1bitPixel ( IN EFI_HII_IMAGE_PALETTE_INFO *PaletteInfo ) { - UINT16 X; - UINT16 Y; + UINT16 Xpos; + UINT16 Ypos; UINTN OffsetY; UINT8 Index; EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapPtr; @@ -300,18 +294,18 @@ Output1bitPixel ( // // Convert the pixel from one bit to corresponding color. // - for (Y = 0; Y < Image->Height; Y++) { - OffsetY = BITMAP_LEN_1_BIT (Image->Width, Y); + for (Ypos = 0; Ypos < Image->Height; Ypos++) { + OffsetY = BITMAP_LEN_1_BIT (Image->Width, Ypos); // // All bits in these bytes are meaningful // - for (X = 0; X < Image->Width / 8; X++) { - Byte = *(Data + OffsetY + X); + for (Xpos = 0; Xpos < Image->Width / 8; Xpos++) { + Byte = *(Data + OffsetY + Xpos); for (Index = 0; Index < 8; Index++) { 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 { - 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. // - Byte = *(Data + OffsetY + X); + Byte = *(Data + OffsetY + Xpos); for (Index = 0; Index < Image->Width % 8; Index++) { 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 { - 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. + This is a internal function. + + @param Image Points to the image which will store the pixels. @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 [0, 15]. **/ -STATIC VOID Output4bitPixel ( IN OUT EFI_IMAGE_INPUT *Image, @@ -352,8 +348,8 @@ Output4bitPixel ( IN EFI_HII_IMAGE_PALETTE_INFO *PaletteInfo ) { - UINT16 X; - UINT16 Y; + UINT16 Xpos; + UINT16 Ypos; UINTN OffsetY; EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapPtr; EFI_GRAPHICS_OUTPUT_BLT_PIXEL PaletteValue[16]; @@ -383,23 +379,23 @@ Output4bitPixel ( // // Convert the pixel from 4 bit to corresponding color. // - for (Y = 0; Y < Image->Height; Y++) { - OffsetY = BITMAP_LEN_4_BIT (Image->Width, Y); + for (Ypos = 0; Ypos < Image->Height; Ypos++) { + OffsetY = BITMAP_LEN_4_BIT (Image->Width, Ypos); // // All bits in these bytes are meaningful // - for (X = 0; X < Image->Width / 2; X++) { - Byte = *(Data + OffsetY + X); - BitMapPtr[Y * Image->Width + X * 2] = PaletteValue[Byte >> 4]; - BitMapPtr[Y * Image->Width + X * 2 + 1] = PaletteValue[Byte & 0x0F]; + for (Xpos = 0; Xpos < Image->Width / 2; Xpos++) { + Byte = *(Data + OffsetY + Xpos); + BitMapPtr[Ypos * Image->Width + Xpos * 2] = PaletteValue[Byte >> 4]; + BitMapPtr[Ypos * Image->Width + Xpos * 2 + 1] = PaletteValue[Byte & 0x0F]; } if (Image->Width % 2 != 0) { // // Padding bits in this byte should be ignored. // - Byte = *(Data + OffsetY + X); - BitMapPtr[Y * Image->Width + X * 2] = PaletteValue[Byte >> 4]; + Byte = *(Data + OffsetY + Xpos); + 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. + This is a internal function. + + @param Image Points to the image which will store the pixels. @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 [0, 255]. **/ -STATIC VOID Output8bitPixel ( IN OUT EFI_IMAGE_INPUT *Image, @@ -424,8 +422,8 @@ Output8bitPixel ( IN EFI_HII_IMAGE_PALETTE_INFO *PaletteInfo ) { - UINT16 X; - UINT16 Y; + UINT16 Xpos; + UINT16 Ypos; UINTN OffsetY; EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapPtr; EFI_GRAPHICS_OUTPUT_BLT_PIXEL PaletteValue[256]; @@ -454,14 +452,14 @@ Output8bitPixel ( // // Convert the pixel from 8 bits to corresponding color. // - for (Y = 0; Y < Image->Height; Y++) { - OffsetY = BITMAP_LEN_8_BIT (Image->Width, Y); + for (Ypos = 0; Ypos < Image->Height; Ypos++) { + OffsetY = BITMAP_LEN_8_BIT (Image->Width, Ypos); // // All bits are meaningful since the bitmap is 8 bits per pixel. // - for (X = 0; X < Image->Width; X++) { - Byte = *(Data + OffsetY + X); - BitMapPtr[OffsetY + X] = PaletteValue[Byte]; + for (Xpos = 0; Xpos < Image->Width; Xpos++) { + Byte = *(Data + OffsetY + Xpos); + BitMapPtr[OffsetY + Xpos] = PaletteValue[Byte]; } } @@ -471,20 +469,22 @@ Output8bitPixel ( /** 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 Data Stores the color of output pixels, allowing 16.8 millions colors. **/ -STATIC VOID Output24bitPixel ( IN OUT EFI_IMAGE_INPUT *Image, IN EFI_HII_RGB_PIXEL *Data ) { - UINT16 Y; + UINT16 Ypos; UINTN OffsetY; EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapPtr; @@ -492,8 +492,8 @@ Output24bitPixel ( BitMapPtr = Image->Bitmap; - for (Y = 0; Y < Image->Height; Y++) { - OffsetY = BITMAP_LEN_8_BIT (Image->Width, Y); + for (Ypos = 0; Ypos < Image->Height; Ypos++) { + OffsetY = BITMAP_LEN_8_BIT (Image->Width, Ypos); CopyRgbToGopPixel (&BitMapPtr[OffsetY], &Data[OffsetY], Image->Width); } @@ -503,7 +503,12 @@ Output24bitPixel ( /** 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 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 the output image of the first pixel in the image. @param Width Width of the incoming image, in pixels. @@ -517,7 +522,6 @@ Output24bitPixel ( @retval EFI_INVALID_PARAMETER Any incoming parameter is invalid. **/ -STATIC EFI_STATUS ImageToBlt ( IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, @@ -530,8 +534,8 @@ ImageToBlt ( ) { EFI_IMAGE_OUTPUT *ImageOut; - UINTN X; - UINTN Y; + UINTN Xpos; + UINTN Ypos; UINTN OffsetY1; // src buffer UINTN OffsetY2; // dest buffer EFI_GRAPHICS_OUTPUT_BLT_PIXEL SrcPixel; @@ -552,17 +556,17 @@ ImageToBlt ( ZeroMem (&ZeroPixel, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)); - for (Y = 0; Y < Height; Y++) { - OffsetY1 = Width * Y; - OffsetY2 = ImageOut->Width * (BltY + Y); - for (X = 0; X < Width; X++) { - SrcPixel = BltBuffer[OffsetY1 + X]; + for (Ypos = 0; Ypos < Height; Ypos++) { + OffsetY1 = Width * Ypos; + OffsetY2 = ImageOut->Width * (BltY + Ypos); + for (Xpos = 0; Xpos < Width; Xpos++) { + SrcPixel = BltBuffer[OffsetY1 + Xpos]; if (Transparent) { if (CompareMem (&SrcPixel, &ZeroPixel, 3) != 0) { - ImageOut->Image.Bitmap[OffsetY2 + BltX + X] = SrcPixel; + ImageOut->Image.Bitmap[OffsetY2 + BltX + Xpos] = SrcPixel; } } 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 PackageList. @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_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 the pointer updated on exit. It is the 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 of the output image of the first pixel in the image. @@ -1226,8 +1229,8 @@ HiiDrawImage ( UINTN BufferLen; UINTN Width; UINTN Height; - UINTN X; - UINTN Y; + UINTN Xpos; + UINTN Ypos; UINTN OffsetY1; UINTN OffsetY2; EFI_FONT_DISPLAY_INFO *FontInfo; @@ -1309,11 +1312,11 @@ HiiDrawImage ( if (Width == ImageIn->Width && Height == ImageIn->Height) { CopyMem (BltBuffer, ImageIn->Bitmap, BufferLen); } else { - for (Y = 0; Y < Height; Y++) { - OffsetY1 = ImageIn->Width * Y; - OffsetY2 = Width * Y; - for (X = 0; X < Width; X++) { - BltBuffer[OffsetY2 + X] = ImageIn->Bitmap[OffsetY1 + X]; + for (Ypos = 0; Ypos < Height; Ypos++) { + OffsetY1 = ImageIn->Width * Ypos; + OffsetY2 = Width * Ypos; + for (Xpos = 0; Xpos < Width; Xpos++) { + BltBuffer[OffsetY2 + Xpos] = ImageIn->Bitmap[OffsetY1 + Xpos]; } } } @@ -1442,6 +1445,8 @@ HiiDrawImage ( allocated to hold the generated image and the pointer updated on exit. It is the 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 of the output image of the first pixel in the image. diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/R8Lib.c b/MdeModulePkg/Universal/HiiDatabaseDxe/R8Lib.c index 007be630da..7c3e9b8b35 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/R8Lib.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/R8Lib.c @@ -1,4 +1,6 @@ -/**@file +/** @file +Implement a utility function named R8_EfiLibCompareLanguage. + Copyright (c) 2007 - 2008, Intel Corporation All rights reserved. This program and the accompanying materials diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/R8Lib.h b/MdeModulePkg/Universal/HiiDatabaseDxe/R8Lib.h index 9ca8d15482..9a4f966a46 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/R8Lib.h +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/R8Lib.h @@ -1,4 +1,6 @@ -/**@file +/** @file +Implement a utility function named R8_EfiLibCompareLanguage. + Copyright (c) 2007 - 2008, Intel Corporation All rights reserved. This program and the accompanying materials diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c index f6a4cdf02d..9850cba8e0 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c @@ -1,4 +1,6 @@ /** @file +Implementation for EFI_HII_STRING_PROTOCOL. + Copyright (c) 2007, Intel Corporation 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, 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 a HII_FONT_INFO to refer it locally. + This is a internal function. + + @param Private Hii database private structure. @param StringPackage HII string package instance. @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. **/ -STATIC BOOLEAN ReferFontInfoLocally ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -104,8 +97,12 @@ ReferFontInfoLocally ( /** Convert Ascii string text to unicode string test. - @param StringSrc Points to current null-terminated Ascii string. - @param StringDest Buffer to store the converted string text. + 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 BufferSize Length of the buffer. @retval EFI_SUCCESS The string text was outputed successfully. @@ -114,7 +111,6 @@ ReferFontInfoLocally ( size. **/ -STATIC EFI_STATUS ConvertToUnicodeText ( OUT EFI_STRING StringDest, @@ -146,8 +142,11 @@ ConvertToUnicodeText ( Calculate the size of StringSrc and output it. If StringDest is not NULL, 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 StringDest Buffer to store the string text. @param BufferSize Length of the buffer. @retval EFI_SUCCESS The string text was outputed successfully. @@ -156,7 +155,6 @@ ConvertToUnicodeText ( size. **/ -STATIC EFI_STATUS GetUnicodeStringTextOrSize ( OUT EFI_STRING StringDest, OPTIONAL @@ -194,6 +192,8 @@ GetUnicodeStringTextOrSize ( /** Copy string font info to a buffer. + This is a internal function. + @param StringPackage Hii string package instance. @param FontId Font identifier which is unique in a string package. @@ -204,7 +204,6 @@ GetUnicodeStringTextOrSize ( @retval EFI_NOT_FOUND The specified font id does not exist. **/ -STATIC EFI_STATUS GetStringFontInfo ( IN HII_STRING_PACKAGE_INSTANCE *StringPackage, @@ -567,6 +566,8 @@ FindStringBlock ( /** Parse all string blocks to get a string specified by StringId. + This is a internal function. + @param Private Hii database private structure. @param StringPackage Hii string package instance. @param StringId The string's id, which is unique within @@ -587,7 +588,6 @@ FindStringBlock ( hold the string. **/ -STATIC EFI_STATUS GetStringWorker ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -676,6 +676,8 @@ GetStringWorker ( /** Parse all string blocks to set a String specified by StringId. + This is a internal function. + @param Private HII database driver private structure. @param StringPackage HII string package instance. @param StringId The string's id, which is unique within @@ -693,7 +695,6 @@ GetStringWorker ( task. **/ -STATIC EFI_STATUS SetStringWorker ( IN HII_DATABASE_PRIVATE_DATA *Private, @@ -1557,14 +1558,14 @@ HiiGetLanguages ( FirstLanguage. If there are no secondary languages, the function returns successfully, but this is set to NULL. - @param SecondaryLanguageSize On entry, points to the size of the buffer pointed - to by SecondLanguages, in bytes. On return, - points to the length of SecondLanguages in bytes. + @param SecondaryLanguagesSize On entry, points to the size of the buffer pointed + to by SecondaryLanguages, in bytes. On return, + points to the length of SecondaryLanguages in bytes. @retval EFI_SUCCESS Secondary languages were correctly returned. - @retval EFI_INVALID_PARAMETER FirstLanguage or SecondLanguages or - SecondLanguagesSize was NULL. - @retval EFI_BUFFER_TOO_SMALL The buffer specified by SecondLanguagesSize is + @retval EFI_INVALID_PARAMETER FirstLanguage or SecondaryLanguages or + SecondaryLanguagesSize was NULL. + @retval EFI_BUFFER_TOO_SMALL The buffer specified by SecondaryLanguagesSize is too small to hold the returned information. SecondLanguageSize is updated to hold the size of the buffer required. @@ -1579,8 +1580,8 @@ HiiGetSecondaryLanguages ( 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 CHAR8 *SecondaryLanguages, + IN OUT UINTN *SecondaryLanguagesSize ) { LIST_ENTRY *Link; @@ -1595,7 +1596,7 @@ HiiGetSecondaryLanguages ( if (This == NULL || PackageList == NULL || FirstLanguage == NULL) { return EFI_INVALID_PARAMETER; } - if (SecondLanguages == NULL || SecondLanguagesSize == NULL) { + if (SecondaryLanguages == NULL || SecondaryLanguagesSize == NULL) { return EFI_INVALID_PARAMETER; } if (!IsHiiHandleValid (PackageList)) { @@ -1637,10 +1638,10 @@ HiiGetSecondaryLanguages ( Languages++; ResultSize = AsciiStrSize (Languages); - if (ResultSize <= *SecondLanguagesSize) { - AsciiStrCpy (SecondLanguages, Languages); + if (ResultSize <= *SecondaryLanguagesSize) { + AsciiStrCpy (SecondaryLanguages, Languages); } else { - *SecondLanguagesSize = ResultSize; + *SecondaryLanguagesSize = ResultSize; return EFI_BUFFER_TOO_SMALL; }