summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal
Commit message (Collapse)AuthorAgeFilesLines
* MdeModulePkg: Add a PEIM to install Debug PPIZhichao Gao2019-04-024-0/+227
| | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1549 Add a PEIM to install Debug PPI so that PEI debug library instance can locate gEdkiiDebugPpiGuid to implement the debug functions. Using this PPI can reduce the size of PEIMs which consume the debug library. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael Turner <Michael.Turner@microsoft.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/ResetSystemRuntimeDxe: Remove DoS3 in warm resetBret Barkelew2019-04-021-38/+0
| | | | | | | | | | | | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1462 Original logic is that checking the CapsuleUpdate variable and do the EnterS3WithImmediateWake if the system require a capsule update. The EnterS3WithImmediateWake is usually implemented in Platform ResetSystemLib instance and it may do some operation for capsule update. For now, thess preparations of capsule are platform reset notify functions' duty. Most platforms need flush cache to memory before warm reset during capsule update and this operation is added to capsule flow. So it is safe to remove it and do not affect the capsule update function. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/CapsuleRuntimeDxe: Add cache flush for IA32 and X64Zhichao Gao2019-04-025-57/+115
| | | | | | | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1462 The IA32 and X64 ARCH need cache flush function during capsule update. And the cache flush is already implemented in arm ARCH, so add this function CapsuleCacheWriteBack() to IA32 and X64 ARCH. And add a null version for EBC. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@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/RamDiskDxe: Restrict on RAM disk size (CVE-2018-12180)Hao Wu2019-02-283-11/+20
| | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1134 Originally, the block size of created Ram disks is hard-coded to 512 bytes. However, if the total size of the Ram disk is not a multiple of 512 bytes, there will be potential memory access issues when dealing with the last block of the Ram disk. This commit will adjust the block size of the Ram disks to ensure that the total size is a multiple of the block size. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* MdeModulePkg/PartitionDxe: Ensure blocksize holds MBR (CVE-2018-12180)Hao Wu2019-02-282-2/+16
| | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1134 The commit adds checks for detecting GPT and MBR partitions. These checks will ensure that the device block size is big enough to hold an MBR (512 bytes). Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* MdeModulePkg: change the function name ResetSystemZhichao Gao2019-02-222-6/+6
| | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1460 Change the function name form ResetSystem to RuntimeServiceResetSystem. Because ResetSystem and EfiResetSystem would be used in ResetSystemLib and RuntimeLib. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg: Remove EmuVariableRuntimeDxeStar Zeng2019-02-196-2485/+0
| | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1323 Merge EmuVariable and Real variable driver. The real variable driver has been updated to support emulated variable NV mode. This patch removes EmuVariableRuntimeDxe after platforms are migrated to use the merged variable driver. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Tested-by: Julien Grall <julien.grall@arm.com> Acked-by: Julien Grall <julien.grall@arm.com>
* MdeModulePkg/PropertiesTableAttributesDxe: Remove this driverShenglei Zhang2019-02-194-310/+0
| | | | | | | | | | | | | | | This functionality of this driver has been deprecated and no platform employs this driver. It can be removed completely. https://bugzilla.tianocore.org/show_bug.cgi?id=1475 Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg/SmmS3SaveStateDxe: Change function parameter typesShenglei Zhang2019-02-142-4/+4
| | | | | | | | | | | | | | Change parameter Opcode from UINT16 to UINTN in BootScriptWrite and BootScriptInsert. https://bugzilla.tianocore.org/show_bug.cgi?id=1517 Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/S3SaveStateDxe: Change function parameter typesShenglei Zhang2019-02-142-4/+4
| | | | | | | | | | | | | | Change parameter Opcode from UINT16 to UINTN in BootScriptWrite and BootScriptInsert. https://bugzilla.tianocore.org/show_bug.cgi?id=1517 Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/Ip4Dxe: Uninstall protocols when error happen in Driver Binding ↵Jiaxin Wu2019-02-121-3/+6
| | | | | | | | | | | | | | | | | Start. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1447 This patch is to uninstall Ip4ServiceBindingProtocol and Ip4Config2Protocol when error happen in Driver Binding Start. Cc: Michael Turner <Michael.Turner@microsoft.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Signed-off-by: Michael Turner <Michael.Turner@microsoft.com> Reviewed-By: Ye Ting <ting.ye@intel.com>
* MdeModulePkg: Fix coding style issuesDandan Bi2019-02-026-11/+11
| | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1479 Fix issues that reported by Edk2 coding style check tool(ECC) that: Comment description should end with period '.' Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@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> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* MdeModulePkg/EbcDebugger: Use AsciiCharToUpper and CharToUpperShenglei Zhang2019-01-311-35/+4
| | | | | | | | | | | | | | | | InternalUnicodeToUpper and InternalAsciiToUpper are internal functions, so they are substituted by public functions AsciiCharToUpper and CharToUpper. And their implements are removed. https://bugzilla.tianocore.org/show_bug.cgi?id=1369 Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* MdeModulePkg/EbcDebugger: Change function namesShenglei Zhang2019-01-311-7/+7
| | | | | | | | | | | | | | | | | | | Change UnicodeToUpper to InternalUnicodeToUpper. Change AsciiToUpper to InternalAsciiToUpper. These changes are committed for bisectability, or build failure will occur when 2/7 is applied. Because the introduced function names in 2/7 are the same as ones in EdbSupporting.c. https://bugzilla.tianocore.org/show_bug.cgi?id=1369 Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* MdeModulePkg VariableStandaloneMm: Add PcdEmuVariableNvModeEnable in infStar Zeng2019-01-251-1/+3
| | | | | | | | | | | | | | | It was missed in 7cd69959463ac9c761163ed8e8a93907b68e70da when rebasing the patches after 688b2cad7b712493f2cf8b6948ab795545e13961 added VariableStandaloneMm. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Dandan Bi <dandan.bi@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
* MdeModulePkg VariablePei: Don't check BOOT_IN_RECOVERY_MODEStar Zeng2019-01-242-4/+7
| | | | | | | | | | | | | | Don't check BOOT_IN_RECOVERY_MODE, but check PcdEmuVariableNvModeEnable which platform can configure flexibly. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Tested-by: Julien Grall <julien.grall@arm.com> Acked-by: Julien Grall <julien.grall@arm.com>
* MdeModulePkg Variable: Add emulated variable NV mode supportStar Zeng2019-01-246-120/+281
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1323 Merge EmuVariable and Real variable driver. Add emulated variable NV mode support in real variable driver. Platform can configure PcdEmuVariableNvModeEnable statically (build time) or dynamically (boot time) to support emulated variable NV mode. If PcdEmuVariableNvModeEnable is configured to dynamic, its value should be set before Variable driver starts to work, otherwise default value will take effect. Then EmuVariableRuntimeDxe could be removed, the removal of EmuVariableRuntimeDxe will be done after platforms are migrated to use the merged variable driver. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Tested-by: Julien Grall <julien.grall@arm.com> Acked-by: Julien Grall <julien.grall@arm.com>
* MdeModulePkg Variable: type case VolatileBase to UINTN directlyStar Zeng2019-01-241-1/+1
| | | | | | | | | | | | | | | | | | | | | Simplify ((UINTN) ((UINT8 *) VolatileBase + VolatileBase->Size)) to ((UINTN) VolatileBase + VolatileBase->Size) This patch prepares for adding emulated variable NV mode support in VariableRuntimeDxe. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Julien Grall <julien.grall@arm.com> Acked-by: Julien Grall <julien.grall@arm.com>
* MdeModulePkg Variable: Remove CacheOffset in UpdateVariable()Star Zeng2019-01-241-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1323 Merge EmuVariable and Real variable driver. CacheOffset could be removed in UpdateVariable() after // // update the memory copy of Flash region. // CopyMem ( (UINT8 *)mNvVariableCache + CacheOffset, (UINT8 *)NextVariable, VarSize ); is moved to be before mVariableModuleGlobal->NonVolatileLastVariableOffset value is updated, like right before mVariableModuleGlobal->NonVolatileLastVariableOffset += HEADER_ALIGN (VarSize); Except for the movement above, the patch also capitalizes the first character of "update the memory copy of Flash region". This patch prepares for adding emulated variable NV mode support in VariableRuntimeDxe. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Julien Grall <julien.grall@arm.com> Acked-by: Julien Grall <julien.grall@arm.com>
* MdeModulePkg Variable: Abstract VariableWriteServiceInitializeDxe/SmmStar Zeng2019-01-242-26/+60
| | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1323 Merge EmuVariable and Real variable driver. Abstract VariableWriteServiceInitializeDxe/Smm from FtwNotificationEvent/SmmFtwNotificationEvent, then VariableWriteServiceInitializeDxe/Smm could be not aware the NV storage is real or emulated. This patch prepares for adding emulated variable NV mode support in VariableRuntimeDxe. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Tested-by: Julien Grall <julien.grall@arm.com> Acked-by: Julien Grall <julien.grall@arm.com>
* MdeModulePkg Variable: Not get NV PCD in VariableWriteServiceInitializeStar Zeng2019-01-244-30/+27
| | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1323 Merge EmuVariable and Real variable driver. Add macro NV_STORAGE_VARIABLE_BASE. Not get NV PCD in VariableWriteServiceInitialize, but in FtwNotificationEvent/SmmFtwNotificationEvent, then VariableWriteServiceInitialize could be not aware the NV storage is real or emulated. This patch prepares for adding emulated variable NV mode support in VariableRuntimeDxe. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Tested-by: Julien Grall <julien.grall@arm.com> Acked-by: Julien Grall <julien.grall@arm.com>
* MdeModulePkg Variable: Move "extern XXX" to Variable.hStar Zeng2019-01-243-10/+8
| | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1323 Merge EmuVariable and Real variable driver. Move "extern XXX" to Variable.h from VariableDxe.c/VariableSmm.c. This patch prepares for adding emulated variable NV mode support in VariableRuntimeDxe. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Tested-by: Julien Grall <julien.grall@arm.com> Acked-by: Julien Grall <julien.grall@arm.com>
* MdeModulePkg Variable: Abstract InitRealNonVolatileVariableStoreStar Zeng2019-01-241-28/+58
| | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1323 Merge EmuVariable and Real variable driver. Abstract InitRealNonVolatileVariableStore from InitNonVolatileVariableStore. This patch prepares for adding emulated variable NV mode support in VariableRuntimeDxe. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Tested-by: Julien Grall <julien.grall@arm.com> Acked-by: Julien Grall <julien.grall@arm.com>
* MdeModulePkg Variable: Add some missing changes for 9b18845Star Zeng2019-01-242-10/+8
| | | | | | | | | | | | | | | | | | | | | | To improve performance 9b18845a4b4cd1d2cf004cbc1cadf8a93ccb37ea changed the code which read from physical MMIO address to read from memory cache, but it missed some places that could be updated the same away for performance optimization. The patch updates these places as supplementary. I found them when updating code for https://bugzilla.tianocore.org/show_bug.cgi?id=1323 Merge EmuVariable and Real variable driver. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Tested-by: Julien Grall <julien.grall@arm.com> Acked-by: Julien Grall <julien.grall@arm.com>
* MdeModulePkg/Dhcp4Dxe: Remove unnecessary NULL pointer check.Jiaxin Wu2019-01-231-7/+4
| | | | | | | | | | | | | | | | | | | | | v3: Add the instance token check. v2: The DHCP Instance might be destroyed in PxeDhcpDone. So, we need safe-delete. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1469 Since the value of Instance is retrieved from the list Entry, it can't be the NULL pointer, so just remove the unnecessary check. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Wu Hao A <hao.a.wu@intel.com> Cc: Gao Liming <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Wu Hao A <hao.a.wu@intel.com>
* MdeModulePkg/VariableRuntimeDxe: implement standalone MM versionArd Biesheuvel2019-01-162-0/+231
| | | | | | | | | | | Reuse most of the existing code to implement a variable runtime driver that will be able to execute in the context of standalone MM. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/VariableRuntimeDxe: factor out boot service accessesArd Biesheuvel2019-01-165-56/+222
| | | | | | | | | | | | | | In preparation of providing a standalone MM based variable runtime driver, move the existing SMM driver to the new MM services table, and factor out some pieces that are specific to the traditional driver, mainly related to the use of UEFI boot services, which are not accessible to standalone MM drivers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Regression-tested-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/FaultTolerantWriteDxe: implement standalone MM versionArd Biesheuvel2019-01-162-0/+186
| | | | | | | | | | Implement a new version of the fault tolerant write driver that can be used in the context of a standalone MM implementation. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/FaultTolerantWriteDxe: factor out boot service accessesArd Biesheuvel2019-01-167-48/+233
| | | | | | | | | | | | | | In preparation of providing a standalone MM based FTW driver, move the existing SMM driver to the new MM services table, and factor out some pieces that are specific to the traditional driver, mainly related to the use of UEFI boot services, which are not accessible to standalone MM drivers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Regression-tested-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/BootScriptExecuteorDxe: check 64BIT_WAKE_F in FACS.OSPMFlagsEric Dong2019-01-152-4/+4
| | | | | | | | | | | | | | | | | | ((Facs->Flags & EFI_ACPI_4_0_OSPM_64BIT_WAKE__F) != 0)) In above code, Facs->OspmFlags should be used instead. EFI_ACPI_4_0_OSPM_64BIT_WAKE__F is a bit in OSPM Enabled Firmware Control Structure Flags field, not in Firmware Control Structure Feature Flags. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1430 Cc: Aleksiy <oleksiyy@ami.com> Cc: Jian Wang <jian.j.wang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
* MdeModulePkg/Variable: Update to consume SpeculationBarrierHao Wu2018-12-257-32/+38
| | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1417 Since BaseLib API AsmLfence() is a x86 arch specific API and should be avoided using in generic codes, this commit replaces the usage of AsmLfence() with arch-generic API SpeculationBarrier(). Please note that speculation execution barriers are intended to be asserted for SMM codes, hence, this commit still preserve an empty implementation of the speculation execution barrier for the DXE codes. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg/SmmLockBox: Update to consume SpeculationBarrierHao Wu2018-12-251-6/+6
| | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1417 Since BaseLib API AsmLfence() is a x86 arch specific API and should be avoided using in generic codes, this commit replaces the usage of AsmLfence() with arch-generic API SpeculationBarrier(). Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg/FaultTolerantWrite: Update to consume SpeculationBarrierHao Wu2018-12-251-4/+4
| | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1417 Since BaseLib API AsmLfence() is a x86 arch specific API and should be avoided using in generic codes, this commit replaces the usage of AsmLfence() with arch-generic API SpeculationBarrier(). Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg: Delete UefiPxeBcDxe in MdeModulePkg.Siyuan Fu2018-12-2414-7904/+0
| | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1278 This patch is to delete the UefiPxeBcDxe driver in MdeModulePkg. The driver will not be maintained and can't co-work with the dual-stack UefiPxeBcDxe in NetworkPkg. People should use below NetworkPkg drivers instead: NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf Which is actively maintained with more bug fixes and new feature support. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Siyuan Fu <siyuan.fu@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg: Delete IScsiDxe in MdeModulePkg.Siyuan Fu2018-12-2432-11845/+0
| | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1278 This patch is to delete the IScsiDxe driver in MdeModulePkg. The driver will not be maintained and can't co-work with the dual-stack IScsiDxe in NetworkPkg. People should use below NetworkPkg drivers instead: NetworkPkg/IScsiDxe/IScsiDxe.inf Which is actively maintained with more bug fixes and new feature support. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Siyuan Fu <siyuan.fu@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* MdeModulePkg: Delete Tcp4Dxe in MdeModulePkg.Siyuan Fu2018-12-2422-12846/+0
| | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1278 This patch is to delete the Tcp4Dxe driver in MdeModulePkg. The driver will not be maintained and can't co-work with the dual-stack TcpDxe in NetworkPkg. People should use below NetworkPkg drivers instead: NetworkPkg/TcpDxe/TcpDxe.inf Which is actively maintained with more bug fixes and new feature support. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Siyuan Fu <siyuan.fu@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg PCD: Add DynamicEx PcdVpdBaseAddress64 for non SPI platformLiming Gao2018-11-276-4/+38
| | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=1356 Current PcdVpdBaseAddress is 32bit static Pcd. NON SPI platform needs to configure it as Dynamic PCD. Emulator platform (such as NT32) may set its value to 64bit address. To meet with this usage, 64bit DynamicEx PcdVpdBaseAddress64 is introduced. If its value is not zero, it will be used. If its value is zero, static PcdVpdBaseAddress will be used. When NON SPI platform enables VPD PCD, they need to set PcdVpdBaseAddress64. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Dandan Bi <dandan.bi@intel.com>
* MdeModulePkg/Variable: add debug logs in VariableServiceSetVariableVijayenthiran Subramaniam2018-11-231-0/+30
| | | | | | | | | | | | | | Print debug messages if size of the VariableName plus DataSize exceeds Max(Auth|Voltaile)VariableSize bytes. The messages will be useful if any platform specific value of Max(Auth|Voltaile)VariableSize PCDs have to be changed. Cc: Star Zeng <star.zeng@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/DisplayEngine: Remove useless NULL ptr check for NewPosDandan Bi2018-11-211-1/+2
| | | | | | | | | | | | | | | | | | | In function UiDisplayMenu, the NewPos ptr which used to point to the highlight menu entry. It will always point to the menu entry which need to be highlighted or the gMenuOption menu if the highlight menu is not found. So we can remove the NULL ptr check for NewPos in this function. And add the ASSERT code to avoid if any false positive reports of NULL pointer dereference issue raised from static analysis. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* Revert "MdeModulePkg/DisplayEngine: Remove useless NULL ptr check for NewPos"Liming Gao2018-11-111-2/+1
| | | | | | | | | | | | This reverts commit 8cd4e734ccdfbc961c72aeaa8dbd3f5154171f9b. It is not a real bug fix. It should not be pushed after Hard Feature Freeze for edk2-stable201811 tag. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Bi Dandan <dandan.bi@intel.com>
* MdeModulePkg/DisplayEngine: Remove useless NULL ptr check for NewPosDandan Bi2018-11-081-1/+2
| | | | | | | | | | | | | | | | | | | In function UiDisplayMenu, the NewPos ptr which used to point to the highlight menu entry. It will always point to the menu entry which need to be highlighted or the gMenuOption menu if the highlight menu is not found. So we can remove the NULL ptr check for NewPos in this function. And add the ASSERT code to avoid if any false positive reports of NULL pointer dereference issue raised from static analysis. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/Mtftp4Dxe: Fix invalid configuration of MTFTP local port.Jiaxin Wu2018-11-061-1/+1
| | | | | | | | | | | | This patch is to fix the invalid setting of MTFTP local port. The issue can be reproduced by tftp shell command by using [-l port] option. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* MdeModulePkg: Remove the trailing space in three source files.Liming Gao2018-11-022-2/+2
| | | | | | | | | | The recent changes in these three source files introduce the trailing space. This patch removes them to follow edk2 coding style. 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/UdfDxe: Memory free/use after free in ResolveSymlink()Hao Wu2018-10-311-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1279 For function ResolveSymlink(), the below codes: if (CompareMem ((VOID *)&PreviousFile, (VOID *)Parent, sizeof (UDF_FILE_INFO)) != 0) { CleanupFileInformation (&PreviousFile); } CopyMem ((VOID *)&PreviousFile, (VOID *)File, sizeof (UDF_FILE_INFO)); If the contents in 'PreviousFile' and 'File' are the same, call to "CleanupFileInformation (&PreviousFile);" will free the buffers in 'File' as well. This will lead to potential memory double free/use after free issues. This commit will add additional check to address the above issue. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Paulo Alcantara <palcantara@suse.de> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
* MdeModulePkg/UdfDxe: Content check for 'File' in ResolveSymlink()Hao Wu2018-10-311-0/+17
| | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1279 The content within 'File' is the output data for ResolveSymlink(). This commit will add checks to ensure the content in 'File' is valid. Otherwise, possible null pointer dereference issue will occur during the subsequent usage of the data returned by ResolveSymlink(). Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Paulo Alcantara <palcantara@suse.de> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
* MdeModulePkg/UdfDxe: Check 'Component Type' within a Path ComponentHao Wu2018-10-311-0/+7
| | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1279 According to the ECMA-167 standard (3rd Edition - June 1997), Section 14.16.1.1, valid values are 1 to 5. All other values will be treated as a corrupted volume. This commit will add such check within function ResolveSymlink(). Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Paulo Alcantara <palcantara@suse.de> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
* MdeModulePke/Mtftp4Dxe: Correct the total received and saved block number.Jiaxin Wu2018-10-295-17/+27
| | | | | | | | | | | | | The block returned from Mtftp4RemoveBlockNum is not the total received and saved block number if it works in passive (Slave) mode. The issue was exposed by the EMS test. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
* MdeModulePkg RegularExpressionDxe: Remove unknown build option for XCODELiming Gao2018-10-261-0/+4
| | | | | | | | | This patch makes RegularExpressionDxe pass XCODE5 build. 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>