]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/AhciPei: Fix MMIO base assignment
authorCzajkowski, Maciej <maciej.czajkowski@intel.com>
Fri, 9 Sep 2022 18:10:55 +0000 (02:10 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 15 Sep 2022 04:17:07 +0000 (04:17 +0000)
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>
MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c

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