public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ming Huang" <huangming@linux.alibaba.com>
To: devel@edk2.groups.io, gaoliming@byosoft.com.cn,
	michael.d.kinney@intel.com, zhiguang.liu@intel.com
Cc: ming.huang-@outlook.com, Ming Huang <huangming@linux.alibaba.com>
Subject: [edk2-devel] [PATCH v2 1/1] MdePkg: Add error output for IoLib.c
Date: Fri, 16 Aug 2024 17:21:27 +0800	[thread overview]
Message-ID: <20240816092127.118875-1-huangming@linux.alibaba.com> (raw)

It is better to output error address information When Address is
invalid before ASSERT.

PR:
https://github.com/tianocore/edk2/pull/6078

Signed-off-by: Ming Huang <huangming@linux.alibaba.com>
---
 MdePkg/Library/BaseIoLibIntrinsic/IoLib.c            | 36 +++++++++
 MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c     | 36 +++++++++
 MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c         | 24 ++++++
 MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c | 42 ++++++++++
 MdePkg/Library/BaseIoLibIntrinsic/IoLibMmioBuffer.c  | 83 ++++++++++++++++++++
 MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c         | 24 ++++++
 MdePkg/Library/BaseIoLibIntrinsic/IoLibNoIo.c        | 36 +++++++++
 7 files changed, 281 insertions(+)

diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c
index 5bd02b56a1..a5353d4c61 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c
@@ -174,6 +174,12 @@ MmioRead16 (
   UINT16   Value;
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Address & 1) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", __func__, Address));
+    }
+    );
+
   ASSERT ((Address & 1) == 0);
   Flag = FilterBeforeMmIoRead (FilterWidth16, Address, &Value);
   if (Flag) {
@@ -220,6 +226,12 @@ MmioWrite16 (
 {
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Address & 1) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", __func__, Address));
+    }
+    );
+
   ASSERT ((Address & 1) == 0);
 
   Flag = FilterBeforeMmIoWrite (FilterWidth16, Address, &Value);
@@ -266,6 +278,12 @@ MmioRead32 (
   UINT32   Value;
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Address & 3) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", __func__, Address));
+    }
+    );
+
   ASSERT ((Address & 3) == 0);
 
   Flag = FilterBeforeMmIoRead (FilterWidth32, Address, &Value);
@@ -313,6 +331,12 @@ MmioWrite32 (
 {
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Address & 3) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", __func__, Address));
+    }
+    );
+
   ASSERT ((Address & 3) == 0);
 
   Flag = FilterBeforeMmIoWrite (FilterWidth32, Address, &Value);
@@ -359,6 +383,12 @@ MmioRead64 (
   UINT64   Value;
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Address & 7) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", __func__, Address));
+    }
+    );
+
   ASSERT ((Address & 7) == 0);
 
   Flag = FilterBeforeMmIoRead (FilterWidth64, Address, &Value);
@@ -404,6 +434,12 @@ MmioWrite64 (
 {
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Address & 7) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", __func__, Address));
+    }
+    );
+
   ASSERT ((Address & 7) == 0);
 
   Flag = FilterBeforeMmIoWrite (FilterWidth64, Address, &Value);
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c
index 6360586929..761f051a6e 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c
@@ -614,6 +614,12 @@ MmioRead16 (
   BOOLEAN  Flag;
   UINT16   Value;
 
+  DEBUG_CODE (
+    if ((Address & 1) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", __func__, Address));
+    }
+    );
+
   ASSERT ((Address & 1) == 0);
 
   Flag = FilterBeforeMmIoRead (FilterWidth16, Address, &Value);
@@ -648,6 +654,12 @@ MmioWrite16 (
 {
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Address & 1) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", __func__, Address));
+    }
+    );
+
   ASSERT ((Address & 1) == 0);
 
   Flag = FilterBeforeMmIoWrite (FilterWidth16, Address, &Value);
@@ -683,6 +695,12 @@ MmioRead32 (
   BOOLEAN  Flag;
   UINT32   Value;
 
+  DEBUG_CODE (
+    if ((Address & 3) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", __func__, Address));
+    }
+    );
+
   ASSERT ((Address & 3) == 0);
 
   Flag = FilterBeforeMmIoRead (FilterWidth32, Address, &Value);
@@ -717,6 +735,12 @@ MmioWrite32 (
 {
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Address & 3) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", __func__, Address));
+    }
+    );
+
   ASSERT ((Address & 3) == 0);
 
   Flag = FilterBeforeMmIoWrite (FilterWidth32, Address, &Value);
@@ -752,6 +776,12 @@ MmioRead64 (
   BOOLEAN  Flag;
   UINT64   Value;
 
+  DEBUG_CODE (
+    if ((Address & 7) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", __func__, Address));
+    }
+    );
+
   ASSERT ((Address & 7) == 0);
 
   Flag = FilterBeforeMmIoRead (FilterWidth64, Address, &Value);
@@ -786,6 +816,12 @@ MmioWrite64 (
 {
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Address & 7) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", __func__, Address));
+    }
+    );
+
   ASSERT ((Address & 7) == 0);
 
   Flag = FilterBeforeMmIoWrite (FilterWidth64, Address, &Value);
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c
index 05a7390859..399a8f710f 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c
@@ -123,6 +123,12 @@ IoRead16 (
   UINT16   Data;
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Port & 1) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid port: %lx\n", __func__, Port));
+    }
+    );
+
   ASSERT ((Port & 1) == 0);
 
   Flag = FilterBeforeIoRead (FilterWidth16, Port, &Data);
@@ -166,6 +172,12 @@ IoWrite16 (
 {
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Port & 1) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid port: %lx\n", __func__, Port));
+    }
+    );
+
   ASSERT ((Port & 1) == 0);
 
   Flag = FilterBeforeIoWrite (FilterWidth16, Port, &Value);
@@ -208,6 +220,12 @@ IoRead32 (
   UINT32   Data;
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Port & 3) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid port: %lx\n", __func__, Port));
+    }
+    );
+
   ASSERT ((Port & 3) == 0);
 
   Flag = FilterBeforeIoRead (FilterWidth32, Port, &Data);
@@ -251,6 +269,12 @@ IoWrite32 (
 {
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Port & 3) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid port: %lx\n", __func__, Port));
+    }
+    );
+
   ASSERT ((Port & 3) == 0);
 
   Flag = FilterBeforeIoWrite (FilterWidth32, Port, &Value);
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c
index 1acc3b3d96..e147aa6c65 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c
@@ -85,6 +85,12 @@ TdIoRead16 (
   UINT64  Status;
   UINT64  Val;
 
+  DEBUG_CODE (
+    if ((Port & 1) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid port: %lx\n", __func__, Port));
+    }
+    );
+
   ASSERT ((Port & 1) == 0);
 
   Status = TdVmCall (TDVMCALL_IO, TDVMCALL_ACCESS_SIZE_2, TDVMCALL_ACCESS_READ, Port, 0, &Val);
@@ -114,6 +120,12 @@ TdIoRead32 (
   UINT64  Status;
   UINT64  Val;
 
+  DEBUG_CODE (
+    if ((Port & 3) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid port: %lx\n", __func__, Port));
+    }
+    );
+
   ASSERT ((Port & 3) == 0);
 
   Status = TdVmCall (TDVMCALL_IO, TDVMCALL_ACCESS_SIZE_4, TDVMCALL_ACCESS_READ, Port, 0, &Val);
@@ -175,6 +187,12 @@ TdIoWrite16 (
   UINT64  Status;
   UINT64  Val;
 
+  DEBUG_CODE (
+    if ((Port & 1) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid port: %lx\n", __func__, Port));
+    }
+    );
+
   ASSERT ((Port & 1) == 0);
   Val    = Value;
   Status = TdVmCall (TDVMCALL_IO, TDVMCALL_ACCESS_SIZE_2, TDVMCALL_ACCESS_WRITE, Port, Val, 0);
@@ -206,6 +224,12 @@ TdIoWrite32 (
   UINT64  Status;
   UINT64  Val;
 
+  DEBUG_CODE (
+    if ((Port & 3) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid port: %lx\n", __func__, Port));
+    }
+    );
+
   ASSERT ((Port & 3) == 0);
   Val    = Value;
   Status = TdVmCall (TDVMCALL_IO, TDVMCALL_ACCESS_SIZE_4, TDVMCALL_ACCESS_WRITE, Port, Val, 0);
@@ -321,6 +345,12 @@ TdMmioWrite16 (
   UINT64  Val;
   UINT64  Status;
 
+  DEBUG_CODE (
+    if ((Address & 1) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", __func__, Address));
+    }
+    );
+
   ASSERT ((Address & 1) == 0);
 
   Val    = Value;
@@ -380,6 +410,12 @@ TdMmioWrite32 (
   UINT64  Val;
   UINT64  Status;
 
+  DEBUG_CODE (
+    if ((Address & 3) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", __func__, Address));
+    }
+    );
+
   ASSERT ((Address & 3) == 0);
 
   Val    = Value;
@@ -437,6 +473,12 @@ TdMmioWrite64 (
   UINT64  Status;
   UINT64  Val;
 
+  DEBUG_CODE (
+    if ((Address & 7) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", __func__, Address));
+    }
+    );
+
   ASSERT ((Address & 7) == 0);
 
   Val    = Value;
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibMmioBuffer.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibMmioBuffer.c
index ecee7f2bde..0ecce971fd 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibMmioBuffer.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibMmioBuffer.c
@@ -8,6 +8,41 @@
 
 #include "BaseIoLibIntrinsicInternal.h"
 
+STATIC
+VOID
+PrintErrorInfo (
+  IN       UINTN  Address,
+  IN       UINTN  Length,
+  IN CONST VOID   *Buffer,
+  IN       UINT16 AlignSize,
+  IN CONST CHAR8  *Prompt
+  )
+{
+  if ((Address & (AlignSize - 1)) != 0) {
+    DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", Prompt, Address));
+  }
+
+  if ((Length - 1) > (MAX_ADDRESS - Address)) {
+    DEBUG ((DEBUG_ERROR, "%a: invalid param, address: %lx len: %lx\n",
+      Prompt, Address, Length));
+  }
+
+  if ((Length - 1) > (MAX_ADDRESS - (UINTN)Buffer)) {
+    DEBUG ((DEBUG_ERROR, "%a: invalid param, buffer: %lx len: %lx\n",
+      Prompt, (UINTN)Buffer, Length));
+  }
+
+  if ((Length & (AlignSize - 1)) != 0) {
+    DEBUG ((DEBUG_ERROR, "%a: invalid len: %lx\n", Prompt, Length));
+  }
+
+  if (((UINTN)Buffer & (AlignSize - 1)) != 0) {
+    DEBUG ((DEBUG_ERROR, "%a: invalid buffer: %lx\n", Prompt, (UINTN)Buffer));
+  }
+
+  return;
+}
+
 /**
   Copy data from the MMIO region to system memory by using 8-bit access.
 
@@ -36,6 +71,18 @@ MmioReadBuffer8 (
 {
   UINT8  *ReturnBuffer;
 
+  DEBUG_CODE (
+    if ((Length - 1) > (MAX_ADDRESS - StartAddress)) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid param, address: %lx len: %lx\n",
+        __func__, StartAddress, Length));
+    }
+
+    if ((Length - 1) > (MAX_ADDRESS - (UINTN)Buffer)) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid param, buffer: %lx len: %lx\n",
+        __func__, (UINTN)Buffer, Length));
+    }
+    );
+
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN)Buffer));
 
@@ -80,6 +127,10 @@ MmioReadBuffer16 (
 {
   UINT16  *ReturnBuffer;
 
+  DEBUG_CODE (
+    PrintErrorInfo (StartAddress, Length, Buffer, sizeof (UINT16), __func__);
+    );
+
   ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);
 
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));
@@ -131,6 +182,10 @@ MmioReadBuffer32 (
 {
   UINT32  *ReturnBuffer;
 
+  DEBUG_CODE (
+    PrintErrorInfo (StartAddress, Length, Buffer, sizeof (UINT32), __func__);
+    );
+
   ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
 
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));
@@ -182,6 +237,10 @@ MmioReadBuffer64 (
 {
   UINT64  *ReturnBuffer;
 
+  DEBUG_CODE (
+    PrintErrorInfo (StartAddress, Length, Buffer, sizeof (UINT64), __func__);
+    );
+
   ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);
 
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));
@@ -229,6 +288,18 @@ MmioWriteBuffer8 (
 {
   VOID  *ReturnBuffer;
 
+  DEBUG_CODE (
+    if ((Length - 1) > (MAX_ADDRESS - StartAddress)) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid param, address: %lx len: %lx\n",
+        __func__, StartAddress, Length));
+    }
+
+    if ((Length - 1) > (MAX_ADDRESS - (UINTN)Buffer)) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid param, buffer: %lx len: %lx\n",
+        __func__, (UINTN)Buffer, Length));
+    }
+    );
+
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN)Buffer));
 
@@ -274,6 +345,10 @@ MmioWriteBuffer16 (
 {
   UINT16  *ReturnBuffer;
 
+  DEBUG_CODE (
+    PrintErrorInfo (StartAddress, Length, Buffer, sizeof (UINT16), __func__);
+    );
+
   ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);
 
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));
@@ -327,6 +402,10 @@ MmioWriteBuffer32 (
 {
   UINT32  *ReturnBuffer;
 
+  DEBUG_CODE (
+    PrintErrorInfo (StartAddress, Length, Buffer, sizeof (UINT32), __func__);
+    );
+
   ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
 
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));
@@ -380,6 +459,10 @@ MmioWriteBuffer64 (
 {
   UINT64  *ReturnBuffer;
 
+  DEBUG_CODE (
+    PrintErrorInfo (StartAddress, Length, Buffer, sizeof (UINT64), __func__);
+    );
+
   ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);
 
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c
index f1b7d51a72..cb973dac49 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c
@@ -183,6 +183,12 @@ IoRead16 (
   UINT16   Value;
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Port & 1) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid port: %lx\n", __func__, Port));
+    }
+    );
+
   ASSERT ((Port & 1) == 0);
 
   Flag = FilterBeforeIoRead (FilterWidth16, Port, &Value);
@@ -228,6 +234,12 @@ IoWrite16 (
 {
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Port & 1) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid port: %lx\n", __func__, Port));
+    }
+    );
+
   ASSERT ((Port & 1) == 0);
 
   Flag = FilterBeforeIoWrite (FilterWidth16, Port, &Value);
@@ -272,6 +284,12 @@ IoRead32 (
   UINT32   Value;
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Port & 3) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid port: %lx\n", __func__, Port));
+    }
+    );
+
   ASSERT ((Port & 3) == 0);
 
   Flag = FilterBeforeIoRead (FilterWidth32, Port, &Value);
@@ -317,6 +335,12 @@ IoWrite32 (
 {
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Port & 3) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid port: %lx\n", __func__, Port));
+    }
+    );
+
   ASSERT ((Port & 3) == 0);
 
   Flag = FilterBeforeIoWrite (FilterWidth32, Port, &Value);
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibNoIo.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibNoIo.c
index c51e5da39b..7155812d1f 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibNoIo.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibNoIo.c
@@ -475,6 +475,12 @@ MmioRead16 (
   UINT16   Value;
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Address & 1) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", __func__, Address));
+    }
+    );
+
   ASSERT ((Address & 1) == 0);
 
   Flag = FilterBeforeMmIoRead (FilterWidth16, Address, &Value);
@@ -509,6 +515,12 @@ MmioWrite16 (
 {
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Address & 1) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", __func__, Address));
+    }
+    );
+
   ASSERT ((Address & 1) == 0);
 
   Flag = FilterBeforeMmIoWrite (FilterWidth16, Address, &Value);
@@ -544,6 +556,12 @@ MmioRead32 (
   UINT32   Value;
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Address & 3) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", __func__, Address));
+    }
+    );
+
   ASSERT ((Address & 3) == 0);
 
   Flag = FilterBeforeMmIoRead (FilterWidth32, Address, &Value);
@@ -578,6 +596,12 @@ MmioWrite32 (
 {
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Address & 3) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", __func__, Address));
+    }
+    );
+
   ASSERT ((Address & 3) == 0);
 
   Flag = FilterBeforeMmIoWrite (FilterWidth32, Address, &Value);
@@ -613,6 +637,12 @@ MmioRead64 (
   UINT64   Value;
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Address & 7) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", __func__, Address));
+    }
+    );
+
   ASSERT ((Address & 7) == 0);
 
   Flag = FilterBeforeMmIoRead (FilterWidth64, Address, &Value);
@@ -647,6 +677,12 @@ MmioWrite64 (
 {
   BOOLEAN  Flag;
 
+  DEBUG_CODE (
+    if ((Address & 7) != 0) {
+      DEBUG ((DEBUG_ERROR, "%a: invalid address: %lx\n", __func__, Address));
+    }
+    );
+
   ASSERT ((Address & 7) == 0);
 
   Flag = FilterBeforeMmIoWrite (FilterWidth64, Address, &Value);
-- 
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#120357): https://edk2.groups.io/g/devel/message/120357
Mute This Topic: https://groups.io/mt/107928903/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



                 reply	other threads:[~2024-08-16  9:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240816092127.118875-1-huangming@linux.alibaba.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