summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
Commit message (Collapse)AuthorAgeFilesLines
* MdeModulePkg/SdMmcPciHcDxe: Add V3 64b DMA SupportAshish Singhal2019-03-114-73/+161
| | | | | | | | | | | | | | Driver was supporting only 32b DMA support for V3 controllers. Add support for 64b DMA as well for completeness. For V4.0 64b support, driver was looking at incorrect capability register bit. Fix for that is present as well. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1583 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com> Tested-by: Eugene Cohen <eugene@hp.com> Reviewed-by: Hao Wu <hao.a.wu@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/DxeCore: Ensure FfsFileHeader 8 bytes alignedStar Zeng2019-02-281-51/+14
| | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=864 REF: CVE-2018-3630 To follow PI spec, ensure FfsFileHeader 8 bytes aligned. For the integrity of FV(especially non-MemoryMapped FV) layout, let CachedFv point to FV beginning, but not (FV + FV header). And current code only handles (FwVolHeader->ExtHeaderOffset != 0) path, update code to also handle (FwVolHeader->ExtHeaderOffset == 0) path. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Liming Gao <liming.gao@intel.com> 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>
* MdeModulePkg/PeiCore: Ensure FfsFileHeader 8 bytes alignedStar Zeng2019-02-281-2/+2
| | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=864 REF: CVE-2018-3630 To follow PI spec, ensure FfsFileHeader 8 bytes aligned. Current code only handles (FwVolHeader->ExtHeaderOffset != 0) path, update code to also handle (FwVolHeader->ExtHeaderOffset == 0) path. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Liming Gao <liming.gao@intel.com> 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>
* 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/UefiBootManagerLib: fix LoadImage/StartImage status code rep.Laszlo Ersek2019-02-252-18/+48
| | | | | | | | | | | | | | | | | | | | | | | | In the EFI_RETURN_STATUS_EXTENDED_DATA structure from PI-1.7, there may be padding between the DataHeader and ReturnStatus members. The REPORT_STATUS_CODE_EX() macro starts populating the structure immediately after DataHeader, therefore the source data must provide for the padding. Extract the BmReportLoadFailure() function from EfiBootManagerBoot(), prepare a zero padding (if any) in a temporary EFI_RETURN_STATUS_EXTENDED_DATA object, and fix the REPORT_STATUS_CODE_EX() macro invocation. Cc: Dandan Bi <dandan.bi@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Star Zeng <star.zeng@intel.com> Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=1539 Fixes: c2cf8720a5aad74230767a1f11bade2d86de3745 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* MdeModulePkg/UfsBlockIoPei: Correct use of 'DeviceIndex' in BlkIO PPIHao Wu2019-02-251-25/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1474 Within UfsBlockIoPei, the current implementation of the Block IO(2) services: UfsBlockIoPeimGetMediaInfo UfsBlockIoPeimReadBlocks UfsBlockIoPeimGetMediaInfo2 UfsBlockIoPeimReadBlocks2 does not handle the input parameter 'DeviceIndex' properly. According to both of the PI spec and the function description comments: > DeviceIndex Specifies the block device to which the function wants > to talk. ... This index is a number from one to > NumberBlockDevices. But current codes incorrectly treat the valid range of 'DeviceIndex' as 0 to (NumberBlockDevices - 1). This commit is to address this issue. Cc: Jian J Wang <jian.j.wang@intel.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: Rename confusion function nameChen A Chen2019-02-253-3/+5
| | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1536 To avoid the confusion caused by function name, rename EfiBootManagerGetNextFullDevicePath to EfiBootManagerGetNextLoadOptionDevicePath. As an API function should add EFIAPI prefix for this function. Cc: Ray Ni <ray.ni@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chen A Chen <chen.a.chen@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* MdeModulePkg: Add the runtime ResetSystemLib in MdeModulePkg.dscZhichao Gao2019-02-221-0/+1
| | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1461 Add the runtime library instance of ResetSystemLib in MdeModulePkg.dsc to make sure it can build pass. 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: Add a runtime library instance of ResetSystemLibZhichao Gao2019-02-223-0/+287
| | | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1461 Implement a runtime library instance of ResetSystemLib. It would use a internal point instead of gRT and convert it depend on gEfiEventVirtualAddressChangeGuid. 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: Ray Ni <ray.ni@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg: Add a new API ResetSystem for PEI ResetSystemLibZhichao Gao2019-02-221-1/+27
| | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1460 Add a new API ResetSystem for PEI ResetSystemLib to be in accord with DXE instance. 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: Add a new API ResetSystem for Null versionZhichao Gao2019-02-221-0/+27
| | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1460 Add a new API ResetSystem for BaseResetSystemLibNull to be in accord with other instances. 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: Add a new API ResetSystem for DXE ResetSystemLibZhichao Gao2019-02-221-1/+27
| | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1460 Add a new API ResetSystem for DXE ResetSystemLib. So the consumer of ResetSystemLib can use this API to reset system with additional reset data. 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: Add the new API ResetSystem in the head fileZhichao Gao2019-02-221-1/+27
| | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1460 Add the new API ResetSystem in the related head file so that the consumer can use it through the combination of library instance and head file. 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: 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/SmmLockBoxLib: Support LockBox enlarge in UpdateLockBox()Hao Wu2019-02-225-10/+86
| | | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1409 This commit will add the support to enlarge a LockBox when using the LockBoxLib API UpdateLockBox(). Please note that the new support will ONLY work for LockBox with attribute LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY set. The functional uni-test for the commit is available at: https://github.com/hwu25/edk2/tree/lockbox_unitest Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Ray Ni <ray.ni@intel.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> Acked-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/SmmLockBox(PEI): Remove an ASSERT in RestoreLockBox()Hao Wu2019-02-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is out of the scope for BZ-1409. It is a refinement for the PEI library instance within SmmLockBoxLib. For the below ASSERT statement within function RestoreLockBox(): Status = SmmCommunicationPpi->Communicate ( SmmCommunicationPpi, &CommBuffer[0], &CommSize ); if (Status == EFI_NOT_STARTED) { // // Pei SMM communication not ready yet, so we access SMRAM directly // DEBUG ((DEBUG_INFO, "SmmLockBoxPeiLib Communicate - (%r)\n", Status)); Status = InternalRestoreLockBoxFromSmram (Guid, Buffer, Length); LockBoxParameterRestore->Header.ReturnStatus = (UINT64)Status; if (Length != NULL) { LockBoxParameterRestore->Length = (UINT64)*Length; } } ASSERT_EFI_ERROR (Status); It is possible for previous codes to return an error status that is possible for happen. One example is that, when the 'if' statement 'if (Status == EFI_NOT_STARTED) {' is entered, function InternalRestoreLockBoxFromSmram() is possible to return 'BUFFER_TOO_SMALL' if the caller of RestoreLockBox() provides a buffer that is too small to hold the content of LockBox. Thus, this commit will remove the ASSERT here. Please note that the current implementation of RestoreLockBox() is handling the above-mentioned error case properly, so no additional error handling codes are needed here. Cc: Jian J Wang <jian.j.wang@intel.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> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/SmmLockBoxLib: Use 'DEBUG_' prefix instead of 'EFI_D_'Hao Wu2019-02-223-63/+63
| | | | | | | | | | | | | | | | This commit is out of the scope for BZ-1409. It is a coding style refinement for the SmmLockBoxLib. More specifically, the commit will remove all the debug message display level macros starting with 'EFI_D_' and replace them with macros starting with 'DEBUG_'. Cc: Jian J Wang <jian.j.wang@intel.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> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/AhciPei: Add AHCI mode ATA device support in PEIHao Wu2019-02-2214-0/+5184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1409 This commit will add the AHCI mode ATA device support in the PEI phase. More specifically, the newly add AhciPei driver will consume the ATA AHCI host controller PPI for ATA controllers working under AHCI code within the system. And then produces the below PPIs for each controller: EDKII PEI ATA PassThru PPI Storage Security Command PPI Also, the driver will consume the S3StorageDeviceInitList LockBox in S3 phase. The purpose is to perform an on-demand (partial) ATA device enumeration/initialization on each controller to benefit the S3 resume performance. The implementation of this driver is currently based on the below specifications: Serial ATA Revision 2.6 Serial ATA Advanced Host Controller Interface (AHCI) 1.3.1 AT Attachment with Packet Interface - 6 (ATA/ATAPI-6) Cc: Jian J Wang <jian.j.wang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* MdeModulePkg/NvmExpressPei: Consume S3StorageDeviceInitList LockBoxHao Wu2019-02-225-1/+236
| | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1409 For the NvmExpressPei driver, this commit will update the driver to consume the S3StorageDeviceInitList LockBox in S3 phase. The purpose is to perform an on-demand (partial) NVM Express device enumeration/initialization to benefit the S3 resume performance. Cc: Jian J Wang <jian.j.wang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* MdeModulePkg/NvmExpressPei: Add logic to produce SSC PPIHao Wu2019-02-228-89/+1075
| | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1409 For the NvmExpressPei driver, this commit will add codes to produce the Storage Security Command PPI if the underlying NVM Express controller supports the Security Send and Security Receive commands. Cc: Jian J Wang <jian.j.wang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* MdeModulePkg/NvmExpressPei: Avoid updating the module-level variableHao Wu2019-02-223-84/+92
| | | | | | | | | | | | | | | This commit is out of the scope for BZ-1409. The commit will remove the call of RegisterForShadow() at the entry point of the driver. By doing so, the driver is now possible to be executed without being re-loaded into permanent memory. Thus, this commit will update the NvmExpressPei driver to avoid updating the content of a global variable. Cc: Jian J Wang <jian.j.wang@intel.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: Add GUID for LockBox to save storage dev to init in S3Hao Wu2019-02-222-0/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1409 This commit will add the GUID definitions for LockBox which is used to save a list of storage devices that need to get initialized during the S3 resume. The content of the LockBox will be a DevicePath structure that contains zero or more DevicePath instances. Each instance denotes a storage device that needs to get initialized during the S3 resume. The producers of the content of this LockBox will be drivers like OpalPassword DXE driver. This kind of drivers requires some specific storage devices to be initialized during the PEI phase of in S3 resume. (For the OpalPassword case, it requires the managing devices to be automatically unlocked during the S3 resume). The attribute of the LockBox should be set to LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY. The consumers of the content of this LockBox will be PEI storage device controller/bus drivers (e.g. NvmExpressPei) during S3 resume. This kind of drivers can use the DevicePath instances stored in the LockBox to get a list of devices that need to get initialized. In such way, an on-demand (partial) device enumeration/initialization can be performed to benefit the S3 resume performance. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Eric Dong <eric.dong@intel.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> Reviewed-by: Eric Dong <eric.dong@intel.com>
* MdeModulePkg: Add definitions for Storage Security Command PPIHao Wu2019-02-222-0/+286
| | | | | | | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1409 This commit will add the definitions for Storage Security Command (SSC) PPI. This PPI will be be used to abstract mass storage devices to allow code running in the PEI phase to send security protocol commands to mass storage devices without specific knowledge of the type of device or controller that manages the device. More specifically, the PPI will provide services to: * Get the number of mass storage devices managed by a instance of the SSC PPI (by service 'GetNumberofDevices'); * Get the identification information (DevicePath) of a managing mass storage devices (by service 'GetDevicePath'); * Send security protocol commands to mass storage devices (by services 'ReceiveData' and 'SendData'). Cc: Jian J Wang <jian.j.wang@intel.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> Reviewed-by: Eric Dong <eric.dong@intel.com>
* MdeModulePkg: Add definitions for EDKII PEI ATA PassThru PPIHao Wu2019-02-222-0/+222
| | | | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1409 This commit will add the definitions for EDKII PEI ATA PassThru PPI. This PPI will provide services that allow ATA commands to be sent to ATA devices attached to an ATA controller in the PEI phase. More specifically, the PPI will provide services to: * Send ATA commands to an ATA device (by service 'PassThru'); * Get the list of the attached ATA device on a controller (by services 'GetNextPort' and 'GetNextDevice'); * Get the identification information (DevicePath) of the underlying ATA host controller (by service 'GetDevicePath'). Cc: Jian J Wang <jian.j.wang@intel.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> Reviewed-by: Eric Dong <eric.dong@intel.com>
* MdeModulePkg: Add definitions for ATA AHCI host controller PPIHao Wu2019-02-222-0/+92
| | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1409 This commit will add the definitions for ATA AHCI host controller PPI. The purpose of the PPI in to provide: * MMIO base address * Controller identification information (DevicePath) for ATA host controllers working under AHCI mode. Cc: Jian J Wang <jian.j.wang@intel.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> Reviewed-by: Eric Dong <eric.dong@intel.com>
* MdeModulePkg/SdMmcPciHcDxe: Use 16/32-bit IO widthsEdgar Handal2019-02-201-4/+21
| | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1537 Use 16-bit and 32-bit IO widths for SDMMC MMIO to prevent all register accesses from being split up into 8-bit accesses. The SDHCI specification states that the registers shall be accessible in byte, word, and double word accesses. (SD Host Controller Simplified Specification 4.20 Section 1.2) Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg/SdMmcPciHcDxe Fix eMMC HS400 switch sequenceAlbecki, Mateusz2019-02-201-16/+17
| | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1140 In eMMC HS400 switch sequence flow eMMC driver attempted to execute SEND_STATUS just after switching bus timing to high speed and before downgrading clock frequency to 52MHz. Since link was at that time in incorrect state SEND_STATUS was failing which made driver think switch to HS400 failed. This change makes driver always change clock frequency after switching bus timing and before executing SEND_STATUS. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Albecki Mateusz <mateusz.albecki@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg: Remove EmuVariableRuntimeDxeStar Zeng2019-02-197-2489/+1
| | | | | | | | | | | | | | | | | | | 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-195-311/+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/BmBoot: Report status when fail to load/start boot optionDandan Bi2019-02-191-6/+16
| | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1398 According to PI1.7 Spec, report extended data describing an EFI_STATUS return value along with EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR and EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED status code when fail to load or start boot option image. 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: Laszlo Ersek <lersek@redhat.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* MdeModulePkg/ReportStatusCodeLib: Avoid using AllocatePool if possibleMax Knutsen2019-02-192-28/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1114 V2: simplify the code logic. update if (!mHaveExitedBootServices && (StatusCodeData != (EFI_STATUS_CODE_DATA *) StatusCodeBuffer)) { gBS->FreePool (StatusCodeData); } to if (StatusCodeData != (EFI_STATUS_CODE_DATA *) StatusCodeBuffer) { gBS->FreePool (StatusCodeData); } V3: And the code below into the else condition (stack buffer is not enough) in /DxeReportStatusCodeLib/ReportStatusCodeLib.c if (gBS == NULL || gBS->AllocatePool == NULL || gBS->FreePool == NULL) { return EFI_UNSUPPORTED; } V4: Refine code logic. When report status code with ExtendedData data, and the extended data can fit in the local static buffer, there is no need to use AllocatePool to hold the ExtendedData data. This patch is just to do the enhancement to avoid using AllocatePool. Cc: Star Zeng <star.zeng@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Michael Turner <Michael.Turner@microsoft.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: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/PeiMain: Support EFI_PEI_CORE_FV_LOCATION_PPIChasel, Chiu2019-02-153-15/+44
| | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1524 When shadowing PeiCore the EFI_PEI_CORE_FV_LOCATION_PPI should be checked to see if PeiCore not in BFV, otherwise just shadowing PeiCore from BFV. Test: Verified on internal platform and booting successfully. 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> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chasel Chiu <chasel.chiu@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Ray Ni <ray.ni@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/PciBus: Fix a bug PPB MEM32 BAR isn't restored sometimesRay Ni2019-02-141-28/+23
| | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1505 When a device under PPB contains option ROM but doesn't require 32bit MMIO, ProgrameUpstreamBridgeForRom() cannot correctly restore the PPB MEM32 RANGE BAR. It causes the 32bit MMIO conflict which may cause system hangs in boot. The root cause is when ProgrameUpstreamBridgeForRom() calls ProgramPpbApperture() to restore the PPB MEM32 RANGE BAR, the ProgramPpbApperture() skips to program the BAR when the resource length is 0. This patch fixes this issue by not calling ProgramPpbApperture(). Instead, it directly programs the PPB MEM32 RANGE BAR. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com>
* MdeModulePkg/PciBus: Correct typosRay Ni2019-02-1420-156/+154
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg/PciBus: Change PCI_IO_DEVICE.RomSize to UINT32 typeRay Ni2019-02-145-13/+13
| | | | | | | | | Per PCI Spec, the option ROM BAR is 32bit so the maximum option ROM size can be hold by UINT32 type. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg/CapsuleApp: Fix memory leak issue.Chen A Chen2019-02-131-27/+60
| | | | | | | | | | | | | | This issue is caused by FileInfoBuffer variable. This is a pointer array and each elements also pointer to a memory buffer that is allocated and returned by AllocateCopyPool function. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Zhang Chao B <chao.b.zhang@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chen A Chen <chen.a.chen@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg/NvmExpressDxe: Report StatusCode for device init failureSean Brogan2019-02-133-3/+13
| | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1408 According to the information of the above BZ-1408 and other platform owners, NVM Express devices are becoming more likely to be a critical part during the boot process. This commit will add the calls to 'REPORT_STATUS_CODE' when there is a failure happens during the NVM Express controller/device initialization process. Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Bret Barkelew <brbarkel@microsoft.com> Cc: Jian J Wang <jian.j.wang@intel.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/CapsuleApp: Fix potential NULL pointer dereference issueChen A Chen2019-02-122-10/+18
| | | | | | | | | | | | | To avoid potential NULL pointer dereference issue. Initialize them at the beginning of the function. This patch is a supplement which was missed at e98212cb5d59fff8f385d9179ad7f1a3ce9cf215 commit. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chen A Chen <chen.a.chen@intel.com> Reviewed-by: Hao Wu <hao.a.wu@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 DxeCapsuleLibFmp: Update SupportCapsuleImage() for Fake CapsuleLiming Gao2019-02-111-0/+6
| | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1088 Per UEFI spec, the fake capsule image with the header only is a valid case in QueryCapsuleCpapbilities(). So, SupportCapsuleImage() is updated to support this case. 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> Reviewed-by: Jian J Wang <jian.j.wang@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/CapsuleApp: Fix potential NULL pointer dereference issueChen A Chen2019-02-023-10/+29
| | | | | | | | | | | To avoid potential NULL pointer dereference issue. Initialize them at the beginning of the function. 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: Chen A Chen <chen.a.chen@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/SdMmcPciHcDxe: Update comment for spec compliance statusHao Wu2019-02-014-8/+14
| | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1441 This commit will update the file-level comments within the SdMmcPciHcDxe to reflect the latest specification compliance status of the driver. Cc: Ray Ni <ray.ni@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/DxeHttpLib: Use BaseLib api AsciiCharToUpperShenglei Zhang2019-01-311-23/+2
| | | | | | | | | | | | | | | Substitute HttpIoCharToUpper with AsciiCharToUpper which is a public function with the same effect. And remove the implement of HttpIoCharToUpper. 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: 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>