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>
This commit is contained in:
Czajkowski, Maciej 2022-09-10 02:10:55 +08:00 committed by mergify[bot]
parent 838c730fe6
commit 1dccbd1a38
1 changed files with 4 additions and 2 deletions

View File

@ -405,7 +405,7 @@ AtaAhciInitPrivateDataFromPciDevice (
{ {
EFI_STATUS Status; EFI_STATUS Status;
PCI_TYPE00 PciData; PCI_TYPE00 PciData;
UINTN MmioBase; UINT32 MmioBase;
EFI_DEVICE_PATH_PROTOCOL *DevicePath; EFI_DEVICE_PATH_PROTOCOL *DevicePath;
UINTN DevicePathLength; UINTN DevicePathLength;
UINT64 EnabledPciAttributes; UINT64 EnabledPciAttributes;
@ -454,13 +454,15 @@ AtaAhciInitPrivateDataFromPciDevice (
&PciDevice->PciIo, &PciDevice->PciIo,
EfiPciIoWidthUint32, EfiPciIoWidthUint32,
0x24, 0x24,
sizeof (UINTN), 1,
&MmioBase &MmioBase
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
MmioBase &= 0xFFFFFFF0;
DevicePathLength = GetDevicePathSize (PciDevice->DevicePath); DevicePathLength = GetDevicePathSize (PciDevice->DevicePath);
DevicePath = PciDevice->DevicePath; DevicePath = PciDevice->DevicePath;