summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c
diff options
context:
space:
mode:
authorCzajkowski, Maciej <maciej.czajkowski@intel.com>2022-09-10 02:10:55 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-09-15 04:17:07 +0000
commit1dccbd1a382aa57719e4e0432b3bd6a03a888507 (patch)
tree66e10cdfb6a30f174205850cb7b69bab5b13c464 /MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c
parent838c730fe61578847823da1b815e4c9c5ee1bed4 (diff)
downloadedk2-1dccbd1a382aa57719e4e0432b3bd6a03a888507.tar.gz
edk2-1dccbd1a382aa57719e4e0432b3bd6a03a888507.tar.bz2
edk2-1dccbd1a382aa57719e4e0432b3bd6a03a888507.zip
MdeModulePkg/AhciPei: Fix MMIO base assignment
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4041 There is a mistake in getting MMIO base using PciDevicePpi that can lead to the data corruption. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Maciej Czajkowski <maciej.czajkowski@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Diffstat (limited to 'MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c')
-rw-r--r--MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c
index 98dd732a40..e33d863d2a 100644
--- a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c
+++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c
@@ -405,7 +405,7 @@ AtaAhciInitPrivateDataFromPciDevice (
{
EFI_STATUS Status;
PCI_TYPE00 PciData;
- UINTN MmioBase;
+ UINT32 MmioBase;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
UINTN DevicePathLength;
UINT64 EnabledPciAttributes;
@@ -454,13 +454,15 @@ AtaAhciInitPrivateDataFromPciDevice (
&PciDevice->PciIo,
EfiPciIoWidthUint32,
0x24,
- sizeof (UINTN),
+ 1,
&MmioBase
);
if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED;
}
+ MmioBase &= 0xFFFFFFF0;
+
DevicePathLength = GetDevicePathSize (PciDevice->DevicePath);
DevicePath = PciDevice->DevicePath;