public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v1] MdeModulePkg/AhciPei: Fix MMIO base assignment
@ 2022-09-09 18:10 Maciej Czajkowski
  2022-09-13  4:36 ` Wu, Hao A
  0 siblings, 1 reply; 3+ messages in thread
From: Maciej Czajkowski @ 2022-09-09 18:10 UTC (permalink / raw)
  To: devel; +Cc: Hao A Wu, Ray Ni

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>
---
 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

---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.
Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] MdeModulePkg/AhciPei: Fix MMIO base assignment
  2022-09-09 18:10 [PATCH v1] MdeModulePkg/AhciPei: Fix MMIO base assignment Maciej Czajkowski
@ 2022-09-13  4:36 ` Wu, Hao A
  2022-09-15  4:18   ` [edk2-devel] " Wu, Hao A
  0 siblings, 1 reply; 3+ messages in thread
From: Wu, Hao A @ 2022-09-13  4:36 UTC (permalink / raw)
  To: Czajkowski, Maciej, devel@edk2.groups.io; +Cc: Ni, Ray

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

Best Regards,
Hao Wu

> -----Original Message-----
> From: Czajkowski, Maciej <maciej.czajkowski@intel.com>
> Sent: Saturday, September 10, 2022 2:11 AM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray <ray.ni@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.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Signed-off-by: Maciej Czajkowski <maciej.czajkowski@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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [PATCH v1] MdeModulePkg/AhciPei: Fix MMIO base assignment
  2022-09-13  4:36 ` Wu, Hao A
@ 2022-09-15  4:18   ` Wu, Hao A
  0 siblings, 0 replies; 3+ messages in thread
From: Wu, Hao A @ 2022-09-15  4:18 UTC (permalink / raw)
  To: devel@edk2.groups.io, Wu, Hao A, Czajkowski, Maciej; +Cc: Ni, Ray

Pushed via:
PR - https://github.com/tianocore/edk2/pull/3338
Commit - https://github.com/tianocore/edk2/commit/1dccbd1a382aa57719e4e0432b3bd6a03a888507

Best Regards,
Hao Wu

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Wu, Hao
> A
> Sent: Tuesday, September 13, 2022 12:36 PM
> To: Czajkowski, Maciej <maciej.czajkowski@intel.com>;
> devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>
> Subject: Re: [edk2-devel] [PATCH v1] MdeModulePkg/AhciPei: Fix MMIO
> base assignment
> 
> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
> 
> Best Regards,
> Hao Wu
> 
> > -----Original Message-----
> > From: Czajkowski, Maciej <maciej.czajkowski@intel.com>
> > Sent: Saturday, September 10, 2022 2:11 AM
> > To: devel@edk2.groups.io
> > Cc: Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray <ray.ni@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.wu@intel.com>
> > Cc: Ray Ni <ray.ni@intel.com>
> > Signed-off-by: Maciej Czajkowski <maciej.czajkowski@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
> 
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-15  4:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-09 18:10 [PATCH v1] MdeModulePkg/AhciPei: Fix MMIO base assignment Maciej Czajkowski
2022-09-13  4:36 ` Wu, Hao A
2022-09-15  4:18   ` [edk2-devel] " Wu, Hao A

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox