From: Marvin Häuser <mhaeuser@posteo.de>
This patch substitutes the macros that were renamed in the first
patch with the new, shared alignment macros.
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/AhciPei.h | 3 +-
.../Ata/AtaAtapiPassThru/AtaAtapiPassThru.h | 2 --
MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h | 1 -
MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h | 2 --
.../Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h | 2 --
.../Bus/Ufs/UfsPassThruDxe/UfsPassThru.h | 2 --
MdeModulePkg/Universal/EbcDxe/EbcExecute.h | 3 +-
MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c | 2 +-
.../Bus/Ata/AhciPei/AhciPeiPassThru.c | 6 ++--
.../Ata/AtaAtapiPassThru/AtaAtapiPassThru.c | 12 +++----
.../Bus/Ata/AtaBusDxe/AtaPassThruExecute.c | 2 +-
MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 4 +--
.../Bus/Ufs/UfsPassThruDxe/UfsPassThru.c | 6 ++--
MdeModulePkg/Universal/EbcDxe/EbcExecute.c | 36 +++++++++----------
14 files changed, 36 insertions(+), 47 deletions(-)
diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
index 71d34c962ad1..e2e4ba43e7c4 100644
--- a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
+++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
@@ -146,8 +146,7 @@ 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)
+#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 7937886614e1..016fc6890ae9 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
@@ -148,8 +148,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 47346e911d47..6bc345f7e777 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 ed384ad52182..5a25b55c4952 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
+++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
@@ -38,8 +38,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 1adb382aa8c3..ed4776f548e0 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 0ec37e56652b..bc1139da6e3b 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 6dc6730ab095..f3768e79528e 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
diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c b/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c
index d93fa78c81f3..0f0198d3085b 100644
--- a/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c
+++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c
@@ -2126,7 +2126,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),
diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c b/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c
index 0c49059a00d5..cd55272c96cd 100644
--- a/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c
+++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c
@@ -194,15 +194,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 324abadd02dd..50406fe0270d 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
@@ -1299,15 +1299,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;
}
@@ -2039,15 +2039,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 18aa4f9bb666..a77852bae054 100644
--- a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
+++ b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
@@ -1040,7 +1040,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 faf4ae332e46..873581d817ce 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
+++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
@@ -2029,7 +2029,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;
@@ -2249,7 +2249,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 392a295caf04..880e7d85114e 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
@@ -171,15 +171,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 28f108c44873..3221f95a739f 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcExecute.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcExecute.c
@@ -2015,7 +2015,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,
@@ -2074,7 +2074,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,
@@ -2097,7 +2097,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,
@@ -3158,7 +3158,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,
@@ -4733,7 +4733,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 {
//
@@ -4795,7 +4795,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 {
//
@@ -4857,7 +4857,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 {
//
@@ -4922,7 +4922,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++) {
@@ -4985,7 +4985,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 {
//
@@ -5029,7 +5029,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);
}
@@ -5068,7 +5068,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);
}
@@ -5105,7 +5105,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 {
//
@@ -5147,7 +5147,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);
}
@@ -5184,7 +5184,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);
}
@@ -5247,7 +5247,7 @@ VmReadMem16 (
//
// Read direct if aligned
//
- if (ADDRESS_IS_ALIGNED_ (Addr, sizeof (UINT16))) {
+ if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT16))) {
return *(UINT16 *)Addr;
}
@@ -5281,7 +5281,7 @@ VmReadMem32 (
//
// Read direct if aligned
//
- if (ADDRESS_IS_ALIGNED_ (Addr, sizeof (UINT32))) {
+ if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT32))) {
return *(UINT32 *)Addr;
}
@@ -5319,7 +5319,7 @@ VmReadMem64 (
//
// Read direct if aligned
//
- if (ADDRESS_IS_ALIGNED_ (Addr, sizeof (UINT64))) {
+ if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT64))) {
return *(UINT64 *)Addr;
}
@@ -5388,7 +5388,7 @@ VmReadMemN (
//
// Read direct if aligned
//
- if (ADDRESS_IS_ALIGNED_ (Addr, sizeof (UINTN))) {
+ if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINTN))) {
return *(UINTN *)Addr;
}
--
2.39.2
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100666): https://edk2.groups.io/g/devel/message/100666
Mute This Topic: https://groups.io/mt/97357270/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Reviewed-by: Michael D Kinney >michael.d.kinney@intel.com>
> -----Original Message-----
> From: Gerd Hoffmann <kraxel@redhat.com>
> Sent: Thursday, March 2, 2023 10:51 PM
> To: devel@edk2.groups.io
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>; Gerd Hoffmann <kraxel@redhat.com>; Wang, Jian J <jian.j.wang@intel.com>; Yao,
> Jiewen <jiewen.yao@intel.com>; Marvin Häuser <mhaeuser@posteo.de>; James Bottomley <jejb@linux.ibm.com>; Michael Roth
> <michael.roth@amd.com>; Wu, Hao A <hao.a.wu@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Oliver Steffen
> <osteffen@redhat.com>; Xu, Min M <min.m.xu@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com>; Tom
> Lendacky <thomas.lendacky@amd.com>; Aktas, Erdem <erdemaktas@google.com>; Liu, Zhiguang <zhiguang.liu@intel.com>; Pawel Polawski
> <ppolawsk@redhat.com>; Justen, Jordan L <jordan.l.justen@intel.com>; Vitaly Cheptsov <vit9696@protonmail.com>
> Subject: [PATCH 4/5] MdeModulePkg: Consume new alignment-related macros
>
> From: Marvin Häuser <mhaeuser@posteo.de>
>
> This patch substitutes the macros that were renamed in the first
> patch with the new, shared alignment macros.
>
> 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/AhciPei.h | 3 +-
> .../Ata/AtaAtapiPassThru/AtaAtapiPassThru.h | 2 --
> MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h | 1 -
> MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h | 2 --
> .../Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h | 2 --
> .../Bus/Ufs/UfsPassThruDxe/UfsPassThru.h | 2 --
> MdeModulePkg/Universal/EbcDxe/EbcExecute.h | 3 +-
> MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c | 2 +-
> .../Bus/Ata/AhciPei/AhciPeiPassThru.c | 6 ++--
> .../Ata/AtaAtapiPassThru/AtaAtapiPassThru.c | 12 +++----
> .../Bus/Ata/AtaBusDxe/AtaPassThruExecute.c | 2 +-
> MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 4 +--
> .../Bus/Ufs/UfsPassThruDxe/UfsPassThru.c | 6 ++--
> MdeModulePkg/Universal/EbcDxe/EbcExecute.c | 36 +++++++++----------
> 14 files changed, 36 insertions(+), 47 deletions(-)
>
> diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
> index 71d34c962ad1..e2e4ba43e7c4 100644
> --- a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
> +++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
> @@ -146,8 +146,7 @@ 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)
> +#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 7937886614e1..016fc6890ae9 100644
> --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
> +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
> @@ -148,8 +148,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 47346e911d47..6bc345f7e777 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 ed384ad52182..5a25b55c4952 100644
> --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
> +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
> @@ -38,8 +38,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 1adb382aa8c3..ed4776f548e0 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 0ec37e56652b..bc1139da6e3b 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 6dc6730ab095..f3768e79528e 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
> diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c b/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c
> index d93fa78c81f3..0f0198d3085b 100644
> --- a/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c
> +++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c
> @@ -2126,7 +2126,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),
> diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c b/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c
> index 0c49059a00d5..cd55272c96cd 100644
> --- a/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c
> +++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c
> @@ -194,15 +194,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 324abadd02dd..50406fe0270d 100644
> --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
> +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
> @@ -1299,15 +1299,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;
> }
>
> @@ -2039,15 +2039,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 18aa4f9bb666..a77852bae054 100644
> --- a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
> +++ b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
> @@ -1040,7 +1040,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 faf4ae332e46..873581d817ce 100644
> --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
> +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
> @@ -2029,7 +2029,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;
> @@ -2249,7 +2249,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 392a295caf04..880e7d85114e 100644
> --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
> +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
> @@ -171,15 +171,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 28f108c44873..3221f95a739f 100644
> --- a/MdeModulePkg/Universal/EbcDxe/EbcExecute.c
> +++ b/MdeModulePkg/Universal/EbcDxe/EbcExecute.c
> @@ -2015,7 +2015,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,
> @@ -2074,7 +2074,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,
> @@ -2097,7 +2097,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,
> @@ -3158,7 +3158,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,
> @@ -4733,7 +4733,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 {
> //
> @@ -4795,7 +4795,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 {
> //
> @@ -4857,7 +4857,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 {
> //
> @@ -4922,7 +4922,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++) {
> @@ -4985,7 +4985,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 {
> //
> @@ -5029,7 +5029,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);
> }
>
> @@ -5068,7 +5068,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);
> }
>
> @@ -5105,7 +5105,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 {
> //
> @@ -5147,7 +5147,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);
> }
>
> @@ -5184,7 +5184,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);
> }
>
> @@ -5247,7 +5247,7 @@ VmReadMem16 (
> //
> // Read direct if aligned
> //
> - if (ADDRESS_IS_ALIGNED_ (Addr, sizeof (UINT16))) {
> + if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT16))) {
> return *(UINT16 *)Addr;
> }
>
> @@ -5281,7 +5281,7 @@ VmReadMem32 (
> //
> // Read direct if aligned
> //
> - if (ADDRESS_IS_ALIGNED_ (Addr, sizeof (UINT32))) {
> + if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT32))) {
> return *(UINT32 *)Addr;
> }
>
> @@ -5319,7 +5319,7 @@ VmReadMem64 (
> //
> // Read direct if aligned
> //
> - if (ADDRESS_IS_ALIGNED_ (Addr, sizeof (UINT64))) {
> + if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT64))) {
> return *(UINT64 *)Addr;
> }
>
> @@ -5388,7 +5388,7 @@ VmReadMemN (
> //
> // Read direct if aligned
> //
> - if (ADDRESS_IS_ALIGNED_ (Addr, sizeof (UINTN))) {
> + if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINTN))) {
> return *(UINTN *)Addr;
> }
>
> --
> 2.39.2
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101507): https://edk2.groups.io/g/devel/message/101507
Mute This Topic: https://groups.io/mt/97357270/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076/xyzzy [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Best Regards,
Hao Wu
> -----Original Message-----
> From: Gerd Hoffmann <kraxel@redhat.com>
> Sent: Friday, March 3, 2023 2:51 PM
> To: devel@edk2.groups.io
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>; Gerd Hoffmann
> <kraxel@redhat.com>; Wang, Jian J <jian.j.wang@intel.com>; Yao, Jiewen
> <jiewen.yao@intel.com>; Marvin Häuser <mhaeuser@posteo.de>; James
> Bottomley <jejb@linux.ibm.com>; Michael Roth <michael.roth@amd.com>;
> Wu, Hao A <hao.a.wu@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Oliver Steffen <osteffen@redhat.com>; Xu, Min
> M <min.m.xu@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Ni, Ray
> <ray.ni@intel.com>; Tom Lendacky <thomas.lendacky@amd.com>; Aktas,
> Erdem <erdemaktas@google.com>; Liu, Zhiguang <zhiguang.liu@intel.com>;
> Pawel Polawski <ppolawsk@redhat.com>; Justen, Jordan L
> <jordan.l.justen@intel.com>; Vitaly Cheptsov <vit9696@protonmail.com>
> Subject: [PATCH 4/5] MdeModulePkg: Consume new alignment-related macros
>
> From: Marvin Häuser <mhaeuser@posteo.de>
>
> This patch substitutes the macros that were renamed in the first
> patch with the new, shared alignment macros.
>
> 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/AhciPei.h | 3 +-
> .../Ata/AtaAtapiPassThru/AtaAtapiPassThru.h | 2 --
> MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h | 1 -
> MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h | 2 --
> .../Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h | 2 --
> .../Bus/Ufs/UfsPassThruDxe/UfsPassThru.h | 2 --
> MdeModulePkg/Universal/EbcDxe/EbcExecute.h | 3 +-
> MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c | 2 +-
> .../Bus/Ata/AhciPei/AhciPeiPassThru.c | 6 ++--
> .../Ata/AtaAtapiPassThru/AtaAtapiPassThru.c | 12 +++----
> .../Bus/Ata/AtaBusDxe/AtaPassThruExecute.c | 2 +-
> MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 4 +--
> .../Bus/Ufs/UfsPassThruDxe/UfsPassThru.c | 6 ++--
> MdeModulePkg/Universal/EbcDxe/EbcExecute.c | 36 +++++++++----------
> 14 files changed, 36 insertions(+), 47 deletions(-)
>
> diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
> b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
> index 71d34c962ad1..e2e4ba43e7c4 100644
> --- a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
> +++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
> @@ -146,8 +146,7 @@ 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)
> +#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 7937886614e1..016fc6890ae9 100644
> --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
> +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
> @@ -148,8 +148,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 47346e911d47..6bc345f7e777 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 ed384ad52182..5a25b55c4952 100644
> --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
> +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
> @@ -38,8 +38,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 1adb382aa8c3..ed4776f548e0 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 0ec37e56652b..bc1139da6e3b 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 6dc6730ab095..f3768e79528e 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
> diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c
> b/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c
> index d93fa78c81f3..0f0198d3085b 100644
> --- a/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c
> +++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c
> @@ -2126,7 +2126,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),
> diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c
> b/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c
> index 0c49059a00d5..cd55272c96cd 100644
> --- a/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c
> +++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c
> @@ -194,15 +194,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 324abadd02dd..50406fe0270d 100644
> --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
> +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
> @@ -1299,15 +1299,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;
> }
>
> @@ -2039,15 +2039,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 18aa4f9bb666..a77852bae054 100644
> --- a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
> +++ b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
> @@ -1040,7 +1040,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 faf4ae332e46..873581d817ce 100644
> --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
> +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
> @@ -2029,7 +2029,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;
> @@ -2249,7 +2249,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 392a295caf04..880e7d85114e 100644
> --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
> +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
> @@ -171,15 +171,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 28f108c44873..3221f95a739f 100644
> --- a/MdeModulePkg/Universal/EbcDxe/EbcExecute.c
> +++ b/MdeModulePkg/Universal/EbcDxe/EbcExecute.c
> @@ -2015,7 +2015,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,
> @@ -2074,7 +2074,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,
> @@ -2097,7 +2097,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,
> @@ -3158,7 +3158,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,
> @@ -4733,7 +4733,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 {
> //
> @@ -4795,7 +4795,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 {
> //
> @@ -4857,7 +4857,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 {
> //
> @@ -4922,7 +4922,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++) {
> @@ -4985,7 +4985,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 {
> //
> @@ -5029,7 +5029,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);
> }
>
> @@ -5068,7 +5068,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);
> }
>
> @@ -5105,7 +5105,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 {
> //
> @@ -5147,7 +5147,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);
> }
>
> @@ -5184,7 +5184,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);
> }
>
> @@ -5247,7 +5247,7 @@ VmReadMem16 (
> //
> // Read direct if aligned
> //
> - if (ADDRESS_IS_ALIGNED_ (Addr, sizeof (UINT16))) {
> + if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT16))) {
> return *(UINT16 *)Addr;
> }
>
> @@ -5281,7 +5281,7 @@ VmReadMem32 (
> //
> // Read direct if aligned
> //
> - if (ADDRESS_IS_ALIGNED_ (Addr, sizeof (UINT32))) {
> + if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT32))) {
> return *(UINT32 *)Addr;
> }
>
> @@ -5319,7 +5319,7 @@ VmReadMem64 (
> //
> // Read direct if aligned
> //
> - if (ADDRESS_IS_ALIGNED_ (Addr, sizeof (UINT64))) {
> + if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT64))) {
> return *(UINT64 *)Addr;
> }
>
> @@ -5388,7 +5388,7 @@ VmReadMemN (
> //
> // Read direct if aligned
> //
> - if (ADDRESS_IS_ALIGNED_ (Addr, sizeof (UINTN))) {
> + if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINTN))) {
> return *(UINTN *)Addr;
> }
>
> --
> 2.39.2
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101465): https://edk2.groups.io/g/devel/message/101465
Mute This Topic: https://groups.io/mt/97357270/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2026 Red Hat, Inc.