Reviewed-by: Hao A Wu <hao.a...@intel.com>

Best Regards,
Hao Wu

> -----Original Message-----
> From: Czajkowski, Maciej <maciej.czajkow...@intel.com>
> Sent: Saturday, September 10, 2022 2:11 AM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A <hao.a...@intel.com>; Ni, Ray <ray...@intel.com>
> Subject: [PATCH v1] 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...@intel.com>
> Cc: Ray Ni <ray...@intel.com>
> Signed-off-by: Maciej Czajkowski <maciej.czajkow...@intel.com>
> ---
>  MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c
> b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c
> index 98dd732a4023..47367f43f73a 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,12 +454,13 @@ 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;
> 
> --
> 2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#93690): https://edk2.groups.io/g/devel/message/93690
Mute This Topic: https://groups.io/mt/93579279/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to