summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal/HiiDatabaseDxe
Commit message (Collapse)AuthorAgeFilesLines
* MdeModulePkg/HiiDatabase: Do not modify CONST stringJeff Brasen2020-10-071-5/+7
| | | | | | | | Update function behavior to not modify the incoming string that is marked as CONST in the prototype. Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
* MdeModulePkg/String.c: Zero memory before free (CVE-2019-14558)Dandan Bi2020-02-141-1/+8
| | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1611 Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg/HiiDB: Remove configuration table when it's freed (CVE-2019-14586)Dandan Bi2020-02-141-1/+9
| | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1995 Fix the corner case issue that the original configuration runtime memory is freed, but it is still exposed to the OS runtime. So this patch is to remove the configuration table to avoid being used in OS runtime when the configuration runtime memory is freed. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg/HiiDatabaseDxe: ASSERT StringPtrShenglei Zhang2019-11-061-0/+1
| | | | | | | | | | | The caller of CompareAndMergeDefaultString has checked that AltCfgResp must contain AltConfigHdr. So we add ASSERT to assume StringPtr is not NULL. Cc: Dandan Bi <dandan.bi@intel.com> Cc: Eric Dong <eric.dong@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
* MdeModulePkg/HiiDatabaseDxe: ASSERT "Private->Attribute >> 4"Shenglei Zhang2019-11-041-0/+1
| | | | | | | | | | | | | Foreground and background color are saved in a single byte. Bits 0..3 are the foreground color and bits 4..6 are the background color. If the Private->Attribute defined correctly, (Private->Attribute >> 4) must be less than 8. This commit uses ASSERT to assume "Attribute >> 4" is less than 8. Cc: Dandan Bi <dandan.bi@intel.com> Cc: Eric Dong <eric.dong@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
* MdeModulePkg/HiiDB: Minimize memory allocation times after ReadyToBootDandan Bi2019-04-281-7/+17
| | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1597 Currently RTData are allocated at/after ReadyToBoot to store the contents in HiiDatabase and the HII configurations for OS runtime utilization. Some platforms may meet S4 resume issue since the allocation after ReadyToBoot cause memory map change. Now this patch is to do some overallocation to minimize the number of memory allocations after ReadyToBoot and also add warning message when do allocation after ReadyToBoot. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
* MdeModulePkg/HiiDatabaseDxe: Release lock on all error return pathDandan Bi2019-04-241-1/+6
| | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1652 Commit ffe5f7a6b4e9 "MdeModulePkg/HiiDatabase: Fix potential integer overflow " added some new error paths, but it missed releasing the mHiiDatabaseLock lock on those paths. This patch releases mHiiDatabaseLock on those paths. Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> (cherry picked from commit 927c516f9557f2f36319fe5d2508af29e3375fb8)
* MdeModulePkg: Replace BSD License with BSD+Patent LicenseMichael D Kinney2019-04-0912-84/+12
| | | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=1373 Replace BSD 2-Clause License with BSD+Patent License. This change is based on the following emails: https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html RFCs with detailed process for the license change: V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg/HiiImage: Fix stack overflow when corrupted BMP is parsed ↵edk2-stable201903Ray Ni2019-03-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | (CVE-2018-12181) REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1135 For 4bit BMP, there are only 2^4 = 16 colors in the palette. But when a corrupted BMP contains more than 16 colors in the palette, today's implementation wrongly copies all colors to the local PaletteValue[16] array which causes stack overflow. The similar issue also exists in the logic to handle 8bit BMP. The patch fixes the issue by only copies the first 16 or 256 colors in the palette depending on the BMP type. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ray Ni <ray.ni@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg/HiiDatabase: Fix potential integer overflow (CVE-2018-12181)Ray Ni2019-03-081-23/+103
| | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1135 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ray Ni <ray.ni@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg/HiiDB: Make sure database update behaviors are atomicDandan Bi2018-10-264-1/+75
| | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1235 When update contents in HiiDatabase, like: 1. Add/update/remove package list 2. Add/update string 3. Add/update image We should make these operations atomic to prevent the potential issue that the one update operation with higher TPL may interrupt another. This commit is to make the HiiDatabase update behaviors atomic by adding EfiAcquireLock/EfiReleaseLock function. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/HiiDB: Reorganize codes of exporting HII settingsDandan Bi2018-10-263-47/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1235 Function "HiiGetConfigurationSetting" may be called when HiiDatabase contents have been updated. And it is just to call function "HiiGetDatabaseInfo" to get the contents in HiiDatabase and call function "HiiGetConfigRespInfo" and get the configuration response string form HII drivers. So here we can remove function "HiiGetConfigurationSetting" and make caller to call "HiiGetDatabaseInfo" and "HiiGetConfigRespInfo" directly. And thus it also can distinguish which code blocks are to operate HiiDatabase contents and which code blocks are not. Then it's easy to know which code blocks should be atomic when updating HiiDatabase contents. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/HiiDB: Fix incorrect structure convention for checkboxDandan Bi2018-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1224 When covert IFR binary to EFI_IFR_CHECKBOX structure, Current code has following incorrect code logic: IfrCheckBox = (EFI_IFR_CHECKBOX *) (IfrOpHdr + 1); The correct one should be: IfrCheckBox = (EFI_IFR_CHECKBOX *) IfrOpHdr; 1. The bug is in function "UpdateDefaultSettingInFormPackage()" which is to update the default setting of some HII Questions in the IFR binary data. So it only has impact when platform overrides default setting in HII VarStore through DynamicHii PCD setting in Platform DSC file. If platform doesn't override default setting, it has no impact. 2. The implementation updates the "Flags" filed in the EFI_IFR_CHECKBOX structure to update the default setting of checkbox. If using "IfrCheckBox = (EFI_IFR_CHECKBOX *) (IfrOpHdr + 1);" when wants to update the " Flags" filed in checkbox, but in fact it will update the opcode binary data(opcode binary length) behind checkbox binary. And then it will cause Browser can't parse the IFR binary data correctly. And then the possible symptom is that some HII Question and forms may be not parsed and then cannot be shown. This patch is to fix this bug. Cc: Liming Gao <liming.gao@intel.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg: Removing ipf which is no longer supported from edk2.Chen A Chen2018-09-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removing rules for Ipf sources file: * Remove the source file which path with "ipf" and also listed in [Sources.IPF] section of INF file. * Remove the source file which listed in [Components.IPF] section of DSC file and not listed in any other [Components] section. * Remove the embedded Ipf code for MDE_CPU_IPF. Removing rules for Inf file: * Remove IPF from VALID_ARCHITECTURES comments. * Remove DXE_SAL_DRIVER from LIBRARY_CLASS in [Defines] section. * Remove the INF which only listed in [Components.IPF] section in DSC. * Remove statements from [BuildOptions] that provide IPF specific flags. * Remove any IPF sepcific sections. Removing rules for Dec file: * Remove [Includes.IPF] section from Dec. Removing rules for Dsc file: * Remove IPF from SUPPORTED_ARCHITECTURES in [Defines] section of DSC. * Remove any IPF specific sections. * Remove statements from [BuildOptions] that provide IPF specific flags. Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chen A Chen <chen.a.chen@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg HiiDatabaseDxe: Remove a redundant functionshenglei2018-08-211-47/+0
| | | | | | | | | | | | | | The function GetStorageWidth that is never called has been removed. https://bugzilla.tianocore.org/show_bug.cgi?id=1062 Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: shenglei <shenglei.zhang@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
* MdeModulePkg: Clean up source filesLiming Gao2018-06-2811-458/+458
| | | | | | | | | | 1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg HiiDataBase: Fix the potential NULL pointer accessLiming Gao2017-12-281-3/+8
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg HiiDataBase: Fix the potential NULL pointer referenceLiming Gao2017-12-271-4/+6
| | | | | | | | | | This change is the additional fix of commit 14b351e2ed8586f144dd3cd2e0a25082c1a32837. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Star Zeng <star.zeng@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg HiiDataBaseDxe: Add the check for the memory allocation returnLiming Gao2017-12-261-0/+9
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Star Zeng <star.zeng@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg HiiDataBaseDxe: Initialize the local variable before referenceLiming Gao2017-12-251-0/+3
| | | | | | | | Make VS2012x86 and GCC48 pass build Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
* MdeModulePkg HiiDataBase: Enable Firmware to retrieve the default settingLiming Gao2017-12-253-2/+523
| | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=611 Update HiiDataBase to retrieve the default setting and patch IFR data Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg: Fix misuses of AllocateCopyPoolJian J Wang2017-11-081-3/+6
| | | | | | | | | | | | | | | | | | AllocateCopyPool(AllocationSize, *Buffer) will copy "AllocationSize" bytes of memory from old "Buffer" to new allocated one. If "AllocationSize" is bigger than size of "Buffer", heap memory overflow occurs during copy. One solution is to allocate pool first then copy the necessary bytes to new memory. Another is using ReallocatePool instead if old buffer will be freed on spot. Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Bi Dandan <dandan.bi@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Bi Dandan <dandan.bi@intel.com>
* MdeModulePkg/HiiDatabase: Handle questions with Bit VarStoreDandan Bi2017-09-213-36/+319
| | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=545 For oneof/numeric/checkbox, their storage may be bit field. When generating <ConfigAltResp> string to get default value for these questions, we need to parse the Ifr data to get the bit Varstore info,and then generating the correct <ConfigAltResp> string. Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/HiiDB: Avoid incorrect results of multiplicationDandan Bi2017-04-181-12/+12
| | | | | | | | | | | | | | | | | | | | | | | An example: The codes in function Output8bitPixel in Image.c: OffsetY = BITMAP_LEN_8_BIT ((UINT32) Image->Width, Ypos); Both Image->Width and Ypos are of type UINT16. They will be promoted to int (signed) first, and then perform the multiplication defined by macro BITMAP_LEN_8_BIT. If the result of multiplication between Image->Width and Ypos exceeds the range of type int, a potential incorrect results will be assigned to OffsetY. This commit adds explicit UINT32 type cast for 'Image->Width' to avoid possible overflow in the int range. And also fix similar issues in HiiDatabase. Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg: Refine casting expression result to bigger sizeHao Wu2017-03-061-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are cases that the operands of an expression are all with rank less than UINT64/INT64 and the result of the expression is explicitly cast to UINT64/INT64 to fit the target size. An example will be: UINT32 a,b; // a and b can be any unsigned int type with rank less than UINT64, like // UINT8, UINT16, etc. UINT64 c; c = (UINT64) (a + b); Some static code checkers may warn that the expression result might overflow within the rank of "int" (integer promotions) and the result is then cast to a bigger size. The commit refines codes by the following rules: 1). When the expression is possible to overflow the range of unsigned int/ int: c = (UINT64)a + b; 2). When the expression will not overflow within the rank of "int", remove the explicit type casts: c = a + b; 3). When the expression will be cast to pointer of possible greater size: UINT32 a,b; VOID *c; c = (VOID *)(UINTN)(a + b); --> c = (VOID *)((UINTN)a + b); 4). When one side of a comparison expression contains only operands with rank less than UINT32: UINT8 a; UINT16 b; UINTN c; if ((UINTN)(a + b) > c) {...} --> if (((UINT32)a + b) > c) {...} For rule 4), if we remove the 'UINTN' type cast like: if (a + b > c) {...} The VS compiler will complain with warning C4018 (signed/unsigned mismatch, level 3 warning) due to promoting 'a + b' to type 'int'. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com>
* MdeModulePkg: Refine type cast for pointer subtractionHao Wu2017-03-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For pointer subtraction, the result is of type "ptrdiff_t". According to the C11 standard (Committee Draft - April 12, 2011): "When two pointers are subtracted, both shall point to elements of the same array object, or one past the last element of the array object; the result is the difference of the subscripts of the two array elements. The size of the result is implementation-defined, and its type (a signed integer type) is ptrdiff_t defined in the <stddef.h> header. If the result is not representable in an object of that type, the behavior is undefined." In our codes, there are cases that the pointer subtraction is not performed by pointers to elements of the same array object. This might lead to potential issues, since the behavior is undefined according to C11 standard. Also, since the size of type "ptrdiff_t" is implementation-defined. Some static code checkers may warn that the pointer subtraction might underflow first and then being cast to a bigger size. For example: UINT8 *Ptr1, *Ptr2; UINTN PtrDiff; ... PtrDiff = (UINTN) (Ptr1 - Ptr2); The commit will refine the pointer subtraction expressions by casting each pointer to UINTN first and then perform the subtraction: PtrDiff = (UINTN) Ptr1 - (UINTN) Ptr2; Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Feng Tian <feng.tian@intel.com>
* MdeModulePkg: Replace [Ascii|Unicode]ValueToStringHao Wu2017-03-022-9/+65
| | | | | | | | | | It is the follow up of commits 51f0ceb..9e32e97 to replace AsciiValueToString/UnicodeValueToString with AsciiValueToStringS/UnicodeValueToStringS. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/HiiDatabase: clean the value before setting default stringDandan Bi2017-02-211-2/+15
| | | | | | | | | | | | | | For string op-code, the default string may not reach the maximum size, so when generating <AltResp> string, we should clean the value before setting the default string. https://bugzilla.tianocore.org/show_bug.cgi?id=375 Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
* MdeModulePkg HiiDatabase: Remove extra memory initialization.Eric Dong2016-11-171-1/+1
| | | | | | | | | | | | The memory will be set to background color after success allocate the data, so not need to call AllocateZeroPool. Related bugz: https://bugzilla.tianocore.org/show_bug.cgi?id=223 Cc: Dandan Bi <dandan.bi@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/Universal: Fix typos in commentsGary Lin2016-10-272-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - stardard -> standard - doule -> double - defalut -> default - Pacakge -> Package - globa -> global - responsiblity -> responsibility - outputed -> outputted - specifiecd -> specified - Resuts -> Results - the a -> a - suported -> supported - assocated -> associated - TURE -> TRUE - successfull -> successfully - excute -> execute - reseting -> resetting - Retrive -> Retrieve - funciton -> function - paramter -> parameter - dependecy -> dependency - boundry -> boundary - permenantly -> permanently Cc: Feng Tian <feng.tian@intel.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gary Lin <glin@suse.com> Reviewed-by: Feng Tian <feng.tian@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/HiiDatabaseDxe.inf: Correct the GUID usagesRuiyu Ni2016-10-251-2/+2
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
* MdeModulePkg/HiiDataBase: Fix NULL deference bug in HiiGetImageInfoRuiyu Ni2016-10-091-0/+4
| | | | | | | | | | The return value of GetImageIdOrAddress() could be NULL if the ImageId is invalid. The patch fixes the bug to return EFI_NOT_FOUND when GetImageIdOrAddress() returns NULL. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/HiiDataBase: Fix incorrect local variable typeDandan Bi2016-10-081-1/+1
| | | | | | | | | | | The type of variable "SmallestIdFromFlag" should be BOOLEAN, this patch fix the incorrect type. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/HiiDatabase: Add HiiImageEx implementation.Ruiyu Ni2016-09-285-53/+822
| | | | | | | | | | | | | | | According to UEFI spec, NewImageEx()/SetImageEx()/DrawImageEx() implicitly call the non-Ex version interface of HiiImage protocol. GetImageEx()/DrawImageIdEx() are the enhanced version of GetImage()/DrawImageId(), which can support decoding JPEG/PNG through the help of HiiImageDecoder protocol. Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
* MdeModulePkg/HiiDatabase: Update HiiImage to support PNG/JPEGRuiyu Ni2016-09-281-7/+14
| | | | | | | | | | | | | | | 1. Update GetImageIdOrAddress() to recognize PNG/JPEG image block. A offset calculation bug was fixed. 2. Update HiiGetImage() comments to say PNG/JPEG support is provided by HiiImageEx 3. Update HiiSetImage() to support replacing a PNG/JPEG image block with a new image Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
* MdemodulePkg/HiiDatabase: Correct typo in comments.Ruiyu Ni2016-09-285-75/+75
| | | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
* MdeModulePkg/HiiDatabase: Refine HiiDrawImage()Ruiyu Ni2016-09-281-14/+12
| | | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
* MdeModulePkg/HiiDatabase: Refine HiiSetImage()Ruiyu Ni2016-09-281-70/+46
| | | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
* MdeModulePkg/HiiDatabase: Refine HiiGetImage()Ruiyu Ni2016-09-281-35/+20
| | | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
* MdeModulePkg/HiiDatabase: Refine HiiNewImage()Ruiyu Ni2016-09-281-56/+27
| | | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
* MdeModulePkg/HiiDatabase: Move common code to LocatePackageList()Ruiyu Ni2016-09-281-54/+34
| | | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
* MdeModulePkg/HiiDatabase: Refine GetImageIdOrAddressRuiyu Ni2016-09-283-76/+63
| | | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
* MdeModulePkg/HiiDB: Handle the "&READONLY" tag in <KeywordResp> correctlyDandan Bi2016-09-121-4/+13
| | | | | | | | | | | | | | | | | This patch is to fix the incorrect logic when handling the "&READONLY" tag in <KeywordResp>. 1. In UEFI spec, the "&READONLY" tag is in upper case, but using the lower case in current codes by mistake. 2. The logic in checking the ReadOnly flag is not correct. Whether having "&READONLY" tag must be consistent with the result of "ExtractReadOnlyFromOpCode" function. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/HiiDB: Share default if some default value are not specifiedDandan Bi2016-08-112-16/+109
| | | | | | | | | | | | | | | | Add a new implementation policy of getting default value in HiiDatabase. The new policy is only for the situation that a question has default value but doesn't have default value for all supported default type. In this case, we will choose the smallest default id from the existing defaults, and share its value to other default id which has no default value. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/HiiDB: Record fail info if fail to save data for EfiVarStoreDandan Bi2016-07-071-0/+3
| | | | | | | | | | | | | | | | | HiiConfigRoutingRouteConfig function returns 'Progress' to indicate the failure info in the ConfigResp string. But when fail to route the ConfigResp for EfiVarStore, it doesn't return the correct failure info. Now this patch is to fix this issue and add debug info let user know the reason of failure. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Chao Zhang <chao.b.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
* MdeModulePkg/HiiDatabaseDxe: Add ASSERT before using the pointer 'String'Dandan Bi2016-06-281-4/+4
| | | | | | | | | | | | | | The 'Sting' is returned by the function GetUnicodeStringTextAndSize. If it is NULL, function GetUnicodeStringTextAndSize will return EFI_OUT_OF_RESOURCES, and error handling codes will cover it. So the pointer 'Sting' can not be NULL when using it. So we can add the ASSERT codes. Cc: Eric Dong <eric.dong@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg: Replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStrStar Zeng2016-06-212-32/+56
| | | | | | | | | | | | | | | It is the follow up of 3ab41b7a325ca11a12b42f5ad1661c4b6791cb49 to replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr with UnicodeStrToAsciiStrS/AsciiStrToUnicodeStrS. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* MdeModulePkg/Database: Fix incorrect calculation of baseline in FontPackageDandan Bi2016-06-151-0/+16
| | | | | | | | | | | | | | | | When adding font package, there exists the case that only have the EFI_HII_GIBT_GLYPH_DEFAULT or EFI_HII_GIBT_GLYPHS_DEFAULT glyph block and use the default cell info in font package fixed header. In this case, we can't get the correct baseline now. This patch is to fix this issue by recalculating the baseline when the glyph block type is EFI_HII_GIBT_GLYPH_DEFAULT or EFI_HII_GIBT_GLYPHS_DEFAULT. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/HiiDatabase: Remove the incorrect calculation of font baselineDandan Bi2016-06-061-4/+0
| | | | | | | | | | | | | | | | When add Font Package, the cell in EFI_HII_FONT_PACKAGE_HDR contains the measurement of the widest and tallest characters in the font. The measurement may be not absolutely correct, so when use this cell information to calculate the baseline may cause incorrect result. Besides this calculation is not necessary. So remove it now. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/HiiDatabase: Preinit background when render string to screenDandan Bi2016-06-061-0/+6
| | | | | | | | | | | | | | When render string to screen, for proportional fonts, the background color may not set to the whole BltBuffer. And this will cause incorrect display. Now initialize the background color to fix this issue. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>