public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wu, Hao A" <hao.a.wu@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"mhaeuser@posteo.de" <mhaeuser@posteo.de>
Cc: "Wang, Jian J" <jian.j.wang@intel.com>,
	"Ni, Ray" <ray.ni@intel.com>,
	Vitaly Cheptsov <vit9696@protonmail.com>
Subject: Re: [edk2-devel] [PATCH V2 3/3] MdeModulePkg: Consume new alignment-related macros
Date: Fri, 20 Aug 2021 05:21:34 +0000	[thread overview]
Message-ID: <BN8PR11MB3666C74706F259A71C3F0B41CAC19@BN8PR11MB3666.namprd11.prod.outlook.com> (raw)
In-Reply-To: <3c77c5a606245ef427e2d84b7699257dd0f69f97.1629057790.git.mhaeuser@posteo.de>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Marvin
> H?user
> Sent: Monday, August 16, 2021 4:12 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>;
> Ni, Ray <ray.ni@intel.com>; Vitaly Cheptsov <vit9696@protonmail.com>
> Subject: [edk2-devel] [PATCH V2 3/3] MdeModulePkg: Consume new
> alignment-related macros
> 
> This patch substitutes the macros that were renamed in the first patch with
> the new, shared alignment macros.


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

Best Regards,
Hao Wu


> 
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Vitaly Cheptsov <vit9696@protonmail.com>
> Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
> ---
>  MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c                  |  2 +-
>  MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c           |  6 ++--
>  MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c | 12 +++----
>  MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c      |  2 +-
>  MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c             |  4 +--
>  MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c        |  6 ++--
>  MdeModulePkg/Universal/EbcDxe/EbcExecute.c               | 36 ++++++++++---
> -------
>  MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h                   |  1 -
>  MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h |  2 --
>  MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h                  |  1 -
>  MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h             |  2 --
>  MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h       |  2 --
>  MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h        |  2 --
>  MdeModulePkg/Universal/EbcDxe/EbcExecute.h               |  3 +-
>  14 files changed, 35 insertions(+), 46 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c
> b/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c
> index cc32b5de4f98..520197aee752 100644
> --- a/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c
> +++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c
> @@ -2099,7 +2099,7 @@ TrustTransferAtaDevice (
>      // ATA PassThru PPI.
> 
>      //
> 
>      if ((AtaPassThru->Mode->IoAlign > 1) &&
> 
> -        !ADDRESS_IS_ALIGNED_ (Buffer, AtaPassThru->Mode->IoAlign)) {
> 
> +        !ADDRESS_IS_ALIGNED (Buffer, AtaPassThru->Mode->IoAlign)) {
> 
>        NewBuffer = AllocateAlignedPages (
> 
>                      EFI_SIZE_TO_PAGES (TransferLength),
> 
>                      AtaPassThru->Mode->IoAlign
> 
> diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c
> b/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c
> index 31ded8a31048..057ad42d596b 100644
> --- a/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c
> +++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c
> @@ -193,15 +193,15 @@ AhciAtaPassThruPassThru (
>    }
> 
> 
> 
>    IoAlign = This->Mode->IoAlign;
> 
> -  if ((IoAlign > 1) && !ADDRESS_IS_ALIGNED_ (Packet->InDataBuffer,
> IoAlign)) {
> 
> +  if ((IoAlign > 1) && !ADDRESS_IS_ALIGNED (Packet->InDataBuffer,
> + IoAlign)) {
> 
>      return EFI_INVALID_PARAMETER;
> 
>    }
> 
> 
> 
> -  if ((IoAlign > 1) && !ADDRESS_IS_ALIGNED_ (Packet->OutDataBuffer,
> IoAlign)) {
> 
> +  if ((IoAlign > 1) && !ADDRESS_IS_ALIGNED (Packet->OutDataBuffer,
> + IoAlign)) {
> 
>      return EFI_INVALID_PARAMETER;
> 
>    }
> 
> 
> 
> -  if ((IoAlign > 1) && !ADDRESS_IS_ALIGNED_ (Packet->Asb, IoAlign)) {
> 
> +  if ((IoAlign > 1) && !ADDRESS_IS_ALIGNED (Packet->Asb, IoAlign)) {
> 
>      return EFI_INVALID_PARAMETER;
> 
>    }
> 
> 
> 
> diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
> b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
> index cf98fcdaf344..c7b3cfce1340 100644
> --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
> +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
> @@ -1281,15 +1281,15 @@ AtaPassThruPassThru (
> 
> 
>    Instance = ATA_PASS_THRU_PRIVATE_DATA_FROM_THIS (This);
> 
> 
> 
> -  if ((This->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED_(Packet-
> >InDataBuffer, This->Mode->IoAlign)) {
> 
> +  if ((This->Mode->IoAlign > 1) &&
> + !ADDRESS_IS_ALIGNED(Packet->InDataBuffer, This->Mode->IoAlign)) {
> 
>      return EFI_INVALID_PARAMETER;
> 
>    }
> 
> 
> 
> -  if ((This->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED_(Packet-
> >OutDataBuffer, This->Mode->IoAlign)) {
> 
> +  if ((This->Mode->IoAlign > 1) &&
> + !ADDRESS_IS_ALIGNED(Packet->OutDataBuffer, This->Mode->IoAlign)) {
> 
>      return EFI_INVALID_PARAMETER;
> 
>    }
> 
> 
> 
> -  if ((This->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED_(Packet->Asb,
> This->Mode->IoAlign)) {
> 
> +  if ((This->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED(Packet->Asb,
> + This->Mode->IoAlign)) {
> 
>      return EFI_INVALID_PARAMETER;
> 
>    }
> 
> 
> 
> @@ -2012,15 +2012,15 @@ ExtScsiPassThruPassThru (
>      return EFI_INVALID_PARAMETER;
> 
>    }
> 
> 
> 
> -  if ((This->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED_(Packet-
> >InDataBuffer, This->Mode->IoAlign)) {
> 
> +  if ((This->Mode->IoAlign > 1) &&
> + !ADDRESS_IS_ALIGNED(Packet->InDataBuffer, This->Mode->IoAlign)) {
> 
>      return EFI_INVALID_PARAMETER;
> 
>    }
> 
> 
> 
> -  if ((This->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED_(Packet-
> >OutDataBuffer, This->Mode->IoAlign)) {
> 
> +  if ((This->Mode->IoAlign > 1) &&
> + !ADDRESS_IS_ALIGNED(Packet->OutDataBuffer, This->Mode->IoAlign)) {
> 
>      return EFI_INVALID_PARAMETER;
> 
>    }
> 
> 
> 
> -  if ((This->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED_(Packet-
> >SenseData, This->Mode->IoAlign)) {
> 
> +  if ((This->Mode->IoAlign > 1) &&
> + !ADDRESS_IS_ALIGNED(Packet->SenseData, This->Mode->IoAlign)) {
> 
>      return EFI_INVALID_PARAMETER;
> 
>    }
> 
> 
> 
> diff --git a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
> b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
> index 471fb6a7f440..eabab8ac5bc5 100644
> --- a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
> +++ b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
> @@ -1036,7 +1036,7 @@ TrustTransferAtaDevice (
>      // Check the alignment of the incoming buffer prior to invoking underlying
> ATA PassThru
> 
>      //
> 
>      AtaPassThru = AtaDevice->AtaBusDriverData->AtaPassThru;
> 
> -    if ((AtaPassThru->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED_ (Buffer,
> AtaPassThru->Mode->IoAlign)) {
> 
> +    if ((AtaPassThru->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED
> + (Buffer, AtaPassThru->Mode->IoAlign)) {
> 
>        NewBuffer = AllocateAlignedBuffer (AtaDevice, TransferLength);
> 
>        if (NewBuffer == NULL) {
> 
>          return EFI_OUT_OF_RESOURCES;
> 
> diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
> b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
> index 81c0fa217a0b..81db2efd0599 100644
> --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
> +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
> @@ -1956,7 +1956,7 @@ ScsiDiskReceiveData (
>        goto Done;
> 
>      }
> 
> 
> 
> -    if ((ScsiDiskDevice->ScsiIo->IoAlign > 1) && !ADDRESS_IS_ALIGNED_
> (PayloadBuffer, ScsiDiskDevice->ScsiIo->IoAlign)) {
> 
> +    if ((ScsiDiskDevice->ScsiIo->IoAlign > 1) && !ADDRESS_IS_ALIGNED
> + (PayloadBuffer, ScsiDiskDevice->ScsiIo->IoAlign)) {
> 
>        AlignedBuffer = AllocateAlignedBuffer (ScsiDiskDevice,
> PayloadBufferSize);
> 
>        if (AlignedBuffer == NULL) {
> 
>          Status = EFI_OUT_OF_RESOURCES;
> 
> @@ -2171,7 +2171,7 @@ ScsiDiskSendData (
>        goto Done;
> 
>      }
> 
> 
> 
> -    if ((ScsiDiskDevice->ScsiIo->IoAlign > 1) && !ADDRESS_IS_ALIGNED_
> (PayloadBuffer, ScsiDiskDevice->ScsiIo->IoAlign)) {
> 
> +    if ((ScsiDiskDevice->ScsiIo->IoAlign > 1) && !ADDRESS_IS_ALIGNED
> + (PayloadBuffer, ScsiDiskDevice->ScsiIo->IoAlign)) {
> 
>        AlignedBuffer = AllocateAlignedBuffer (ScsiDiskDevice,
> PayloadBufferSize);
> 
>        if (AlignedBuffer == NULL) {
> 
>          Status = EFI_OUT_OF_RESOURCES;
> 
> diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
> b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
> index abfb422d1ea3..c4d01a20fcbe 100644
> --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
> +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
> @@ -170,15 +170,15 @@ UfsPassThruPassThru (
>      return EFI_INVALID_PARAMETER;
> 
>    }
> 
> 
> 
> -  if ((This->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED_(Packet-
> >InDataBuffer, This->Mode->IoAlign)) {
> 
> +  if ((This->Mode->IoAlign > 1) &&
> + !ADDRESS_IS_ALIGNED(Packet->InDataBuffer, This->Mode->IoAlign)) {
> 
>      return EFI_INVALID_PARAMETER;
> 
>    }
> 
> 
> 
> -  if ((This->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED_(Packet-
> >OutDataBuffer, This->Mode->IoAlign)) {
> 
> +  if ((This->Mode->IoAlign > 1) &&
> + !ADDRESS_IS_ALIGNED(Packet->OutDataBuffer, This->Mode->IoAlign)) {
> 
>      return EFI_INVALID_PARAMETER;
> 
>    }
> 
> 
> 
> -  if ((This->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED_(Packet-
> >SenseData, This->Mode->IoAlign)) {
> 
> +  if ((This->Mode->IoAlign > 1) &&
> + !ADDRESS_IS_ALIGNED(Packet->SenseData, This->Mode->IoAlign)) {
> 
>      return EFI_INVALID_PARAMETER;
> 
>    }
> 
> 
> 
> diff --git a/MdeModulePkg/Universal/EbcDxe/EbcExecute.c
> b/MdeModulePkg/Universal/EbcDxe/EbcExecute.c
> index 35f60cabdeb4..ba66f441bcea 100644
> --- a/MdeModulePkg/Universal/EbcDxe/EbcExecute.c
> +++ b/MdeModulePkg/Universal/EbcDxe/EbcExecute.c
> @@ -2004,7 +2004,7 @@ ExecuteJMP (
>      // check for alignment, and jump absolute.
> 
>      //
> 
>      Data64 = (UINT64) VmReadImmed64 (VmPtr, 2);
> 
> -    if (!ADDRESS_IS_ALIGNED_ ((UINTN) Data64, sizeof (UINT16))) {
> 
> +    if (!ADDRESS_IS_ALIGNED ((UINTN) Data64, sizeof (UINT16))) {
> 
>        EbcDebugSignalException (
> 
>          EXCEPT_EBC_ALIGNMENT_CHECK,
> 
>          EXCEPTION_FLAG_FATAL,
> 
> @@ -2059,7 +2059,7 @@ ExecuteJMP (
>      // Form: JMP32 @Rx {Index32}
> 
>      //
> 
>      Addr = VmReadMemN (VmPtr, (UINTN) Data64 + Index32);
> 
> -    if (!ADDRESS_IS_ALIGNED_ ((UINTN) Addr, sizeof (UINT16))) {
> 
> +    if (!ADDRESS_IS_ALIGNED ((UINTN) Addr, sizeof (UINT16))) {
> 
>        EbcDebugSignalException (
> 
>          EXCEPT_EBC_ALIGNMENT_CHECK,
> 
>          EXCEPTION_FLAG_FATAL,
> 
> @@ -2082,7 +2082,7 @@ ExecuteJMP (
>      // Form: JMP32 Rx {Immed32}
> 
>      //
> 
>      Addr = (UINTN) (Data64 + Index32);
> 
> -    if (!ADDRESS_IS_ALIGNED_ ((UINTN) Addr, sizeof (UINT16))) {
> 
> +    if (!ADDRESS_IS_ALIGNED ((UINTN) Addr, sizeof (UINT16))) {
> 
>        EbcDebugSignalException (
> 
>          EXCEPT_EBC_ALIGNMENT_CHECK,
> 
>          EXCEPTION_FLAG_FATAL,
> 
> @@ -3128,7 +3128,7 @@ ExecuteRET (
>      // Pull the return address off the VM app's stack and set the IP
> 
>      // to it
> 
>      //
> 
> -    if (!ADDRESS_IS_ALIGNED_ ((UINTN) VmPtr->Gpr[0], sizeof (UINT16))) {
> 
> +    if (!ADDRESS_IS_ALIGNED ((UINTN) VmPtr->Gpr[0], sizeof (UINT16))) {
> 
>        EbcDebugSignalException (
> 
>          EXCEPT_EBC_ALIGNMENT_CHECK,
> 
>          EXCEPTION_FLAG_FATAL,
> 
> @@ -4693,7 +4693,7 @@ VmWriteMem16 (
>    //
> 
>    // Do a simple write if aligned
> 
>    //
> 
> -  if (ADDRESS_IS_ALIGNED_ (Addr, sizeof (UINT16))) {
> 
> +  if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT16))) {
> 
>      *(UINT16 *) Addr = Data;
> 
>    } else {
> 
>      //
> 
> @@ -4756,7 +4756,7 @@ VmWriteMem32 (
>    //
> 
>    // Do a simple write if aligned
> 
>    //
> 
> -  if (ADDRESS_IS_ALIGNED_ (Addr, sizeof (UINT32))) {
> 
> +  if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT32))) {
> 
>      *(UINT32 *) Addr = Data;
> 
>    } else {
> 
>      //
> 
> @@ -4819,7 +4819,7 @@ VmWriteMem64 (
>    //
> 
>    // Do a simple write if aligned
> 
>    //
> 
> -  if (ADDRESS_IS_ALIGNED_ (Addr, sizeof (UINT64))) {
> 
> +  if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT64))) {
> 
>      *(UINT64 *) Addr = Data;
> 
>    } else {
> 
>      //
> 
> @@ -4885,7 +4885,7 @@ VmWriteMemN (
>    //
> 
>    // Do a simple write if aligned
> 
>    //
> 
> -  if (ADDRESS_IS_ALIGNED_ (Addr, sizeof (UINTN))) {
> 
> +  if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINTN))) {
> 
>      *(UINTN *) Addr = Data;
> 
>    } else {
> 
>      for (Index = 0; Index < sizeof (UINTN) / sizeof (UINT32); Index++) {
> 
> @@ -4949,7 +4949,7 @@ VmReadImmed16 (
>    //
> 
>    // Read direct if aligned
> 
>    //
> 
> -  if (ADDRESS_IS_ALIGNED_ ((UINTN) VmPtr->Ip + Offset, sizeof (INT16))) {
> 
> +  if (ADDRESS_IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (INT16)))
> + {
> 
>      return * (INT16 *) (VmPtr->Ip + Offset);
> 
>    } else {
> 
>      //
> 
> @@ -4993,7 +4993,7 @@ VmReadImmed32 (
>    //
> 
>    // Read direct if aligned
> 
>    //
> 
> -  if (ADDRESS_IS_ALIGNED_ ((UINTN) VmPtr->Ip + Offset, sizeof (UINT32)))
> {
> 
> +  if (ADDRESS_IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (UINT32)))
> + {
> 
>      return * (INT32 *) (VmPtr->Ip + Offset);
> 
>    }
> 
>    //
> 
> @@ -5032,7 +5032,7 @@ VmReadImmed64 (
>    //
> 
>    // Read direct if aligned
> 
>    //
> 
> -  if (ADDRESS_IS_ALIGNED_ ((UINTN) VmPtr->Ip + Offset, sizeof (UINT64)))
> {
> 
> +  if (ADDRESS_IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (UINT64)))
> + {
> 
>      return * (UINT64 *) (VmPtr->Ip + Offset);
> 
>    }
> 
>    //
> 
> @@ -5069,7 +5069,7 @@ VmReadCode16 (
>    //
> 
>    // Read direct if aligned
> 
>    //
> 
> -  if (ADDRESS_IS_ALIGNED_ ((UINTN) VmPtr->Ip + Offset, sizeof (UINT16)))
> {
> 
> +  if (ADDRESS_IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (UINT16)))
> + {
> 
>      return * (UINT16 *) (VmPtr->Ip + Offset);
> 
>    } else {
> 
>      //
> 
> @@ -5110,7 +5110,7 @@ VmReadCode32 (
>    //
> 
>    // Read direct if aligned
> 
>    //
> 
> -  if (ADDRESS_IS_ALIGNED_ ((UINTN) VmPtr->Ip + Offset, sizeof (UINT32)))
> {
> 
> +  if (ADDRESS_IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (UINT32)))
> + {
> 
>      return * (UINT32 *) (VmPtr->Ip + Offset);
> 
>    }
> 
>    //
> 
> @@ -5147,7 +5147,7 @@ VmReadCode64 (
>    //
> 
>    // Read direct if aligned
> 
>    //
> 
> -  if (ADDRESS_IS_ALIGNED_ ((UINTN) VmPtr->Ip + Offset, sizeof (UINT64)))
> {
> 
> +  if (ADDRESS_IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (UINT64)))
> + {
> 
>      return * (UINT64 *) (VmPtr->Ip + Offset);
> 
>    }
> 
>    //
> 
> @@ -5210,7 +5210,7 @@ VmReadMem16 (
>    //
> 
>    // Read direct if aligned
> 
>    //
> 
> -  if (ADDRESS_IS_ALIGNED_ (Addr, sizeof (UINT16))) {
> 
> +  if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT16))) {
> 
>      return * (UINT16 *) Addr;
> 
>    }
> 
>    //
> 
> @@ -5243,7 +5243,7 @@ VmReadMem32 (
>    //
> 
>    // Read direct if aligned
> 
>    //
> 
> -  if (ADDRESS_IS_ALIGNED_ (Addr, sizeof (UINT32))) {
> 
> +  if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT32))) {
> 
>      return * (UINT32 *) Addr;
> 
>    }
> 
>    //
> 
> @@ -5280,7 +5280,7 @@ VmReadMem64 (
>    //
> 
>    // Read direct if aligned
> 
>    //
> 
> -  if (ADDRESS_IS_ALIGNED_ (Addr, sizeof (UINT64))) {
> 
> +  if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT64))) {
> 
>      return * (UINT64 *) Addr;
> 
>    }
> 
>    //
> 
> @@ -5349,7 +5349,7 @@ VmReadMemN (
>    //
> 
>    // Read direct if aligned
> 
>    //
> 
> -  if (ADDRESS_IS_ALIGNED_ (Addr, sizeof (UINTN))) {
> 
> +  if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINTN))) {
> 
>      return * (UINTN *) Addr;
> 
>    }
> 
>    //
> 
> diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
> b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
> index 2a74c9984791..59bb9e5d0bca 100644
> --- a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
> +++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
> @@ -145,7 +145,6 @@ typedef union {
>  #define AHCI_PORT_SERR                         0x0030
> 
>  #define AHCI_PORT_CI                           0x0038
> 
> 
> 
> -#define ADDRESS_IS_ALIGNED_(addr, size)                 (((UINTN) (addr) & (size
> - 1)) == 0)
> 
>  #define TIMER_PERIOD_SECONDS(Seconds)
> MultU64x32((UINT64)(Seconds), 10000000)
> 
> 
> 
>  #pragma pack(1)
> 
> diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
> b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
> index aa3472a71677..99bbf7d14a17 100644
> --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
> +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
> @@ -147,8 +147,6 @@ struct _ATA_NONBLOCK_TASK {
>  #define ATA_ATAPI_TIMEOUT           EFI_TIMER_PERIOD_SECONDS(3)
> 
>  #define ATA_SPINUP_TIMEOUT          EFI_TIMER_PERIOD_SECONDS(10)
> 
> 
> 
> -#define ADDRESS_IS_ALIGNED_(addr, size)      (((UINTN) (addr) & (size - 1))
> == 0)
> 
> -
> 
>  #define ATA_PASS_THRU_PRIVATE_DATA_FROM_THIS(a) \
> 
>    CR (a, \
> 
>        ATA_ATAPI_PASS_THRU_INSTANCE, \
> 
> diff --git a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h
> b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h
> index 13767a8a13c8..172d2d61ea6c 100644
> --- a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h
> +++ b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h
> @@ -76,7 +76,6 @@
>  #define ATA_TASK_SIGNATURE                SIGNATURE_32 ('A', 'T', 'S', 'K')
> 
>  #define ATA_DEVICE_SIGNATURE              SIGNATURE_32 ('A', 'B', 'I', 'D')
> 
>  #define ATA_SUB_TASK_SIGNATURE            SIGNATURE_32 ('A', 'S', 'T', 'S')
> 
> -#define ADDRESS_IS_ALIGNED_(addr, size)            (((UINTN) (addr) & (size -
> 1)) == 0)
> 
> 
> 
>  //
> 
>  // ATA bus data structure for ATA controller
> 
> diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
> b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
> index abe1d06a98da..36fac258f3e6 100644
> --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
> +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
> @@ -39,8 +39,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> 
>  #define IS_DEVICE_FIXED(a)        (a)->FixedDevice ? 1 : 0
> 
> 
> 
> -#define ADDRESS_IS_ALIGNED_(addr, size)    (((UINTN) (addr) & (size - 1))
> == 0)
> 
> -
> 
>  #define UFS_WLUN_RPMB 0xC4
> 
> 
> 
>  typedef struct {
> 
> diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h
> b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h
> index 4802fdc0ab9b..7306106a4454 100644
> --- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h
> +++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h
> @@ -133,8 +133,6 @@ typedef struct _UFS_PEIM_HC_PRIVATE_DATA {
> 
> 
>  #define ROUNDUP8(x) (((x) % 8 == 0) ? (x) : ((x) / 8 + 1) * 8)
> 
> 
> 
> -#define ADDRESS_IS_ALIGNED_(addr, size)      (((UINTN) (addr) & (size - 1))
> == 0)
> 
> -
> 
>  #define GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS(a) CR (a,
> UFS_PEIM_HC_PRIVATE_DATA, BlkIoPpi, UFS_PEIM_HC_SIG)
> 
>  #define GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS2(a) CR (a,
> UFS_PEIM_HC_PRIVATE_DATA, BlkIo2Ppi, UFS_PEIM_HC_SIG)
> 
>  #define GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS_NOTIFY(a) CR (a,
> UFS_PEIM_HC_PRIVATE_DATA, EndOfPeiNotifyList, UFS_PEIM_HC_SIG)
> 
> diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
> b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
> index da3bf78bf9bc..11b5b197b67a 100644
> --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
> +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
> @@ -105,8 +105,6 @@ typedef struct {
> 
> 
>  #define ROUNDUP8(x) (((x) % 8 == 0) ? (x) : ((x) / 8 + 1) * 8)
> 
> 
> 
> -#define ADDRESS_IS_ALIGNED_(addr, size)        (((UINTN) (addr) & (size - 1))
> == 0)
> 
> -
> 
>  #define UFS_PASS_THRU_PRIVATE_DATA_FROM_THIS(a) \
> 
>    CR (a, \
> 
>        UFS_PASS_THRU_PRIVATE_DATA, \
> 
> diff --git a/MdeModulePkg/Universal/EbcDxe/EbcExecute.h
> b/MdeModulePkg/Universal/EbcDxe/EbcExecute.h
> index f21c757a75b4..dcbdc66637e9 100644
> --- a/MdeModulePkg/Universal/EbcDxe/EbcExecute.h
> +++ b/MdeModulePkg/Universal/EbcDxe/EbcExecute.h
> @@ -14,8 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent  //
> 
>  // Macros to check and set alignment
> 
>  //
> 
> -#define ASSERT_ALIGNED(addr, size)  ASSERT (!((UINT32) (addr) & (size - 1)))
> 
> -#define ADDRESS_IS_ALIGNED_(addr, size)      !((UINT32) (addr) & (size - 1))
> 
> +#define ASSERT_ALIGNED(addr, size)  ASSERT (ADDRESS_IS_ALIGNED (addr,
> +size))
> 
> 
> 
>  //
> 
>  // Debug macro
> 
> --
> 2.31.1
> 
> 
> 
> 
> 


  reply	other threads:[~2021-08-20  5:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-15 20:11 [PATCH V2 1/3] MdeModulePkg: Rename IS_ALIGNED macros to avoid name collisions Marvin Häuser
2021-08-15 20:11 ` [PATCH V2 2/3] MdePkg/Base.h: Introduce various alignment-related macros Marvin Häuser
2021-08-16  9:42   ` [edk2-devel] " Ni, Ray
2021-08-16 13:10     ` Marvin Häuser
2021-08-17  1:17       ` Ni, Ray
2021-11-23 10:12       ` Marvin Häuser
2021-12-08  9:10         ` mjsbeaton
2021-12-08 10:36           ` Marvin Häuser
2022-03-22 19:06         ` Marvin Häuser
2021-08-15 20:11 ` [PATCH V2 3/3] MdeModulePkg: Consume new " Marvin Häuser
2021-08-20  5:21   ` Wu, Hao A [this message]
2021-08-20  5:21 ` [PATCH V2 1/3] MdeModulePkg: Rename IS_ALIGNED macros to avoid name collisions Wu, Hao A

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BN8PR11MB3666C74706F259A71C3F0B41CAC19@BN8PR11MB3666.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox