From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 87FB5740035 for ; Fri, 16 Aug 2024 09:21:49 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=dJCXh+eNKfCzRW3XO6ZIoMx6dbeG3Ym67I6nN+7Fs2c=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe; s=20240206; t=1723800109; v=1; b=CuDzBHFYYGQzfIyGrYYIJrRcKULJ0PLv/9m6VWqAo4FB60abj06DAkrs2Pvwtp1w3I9mOJ95 STazXAXLx9If00fHqsTWPI3eMk2sTBlu9M1qKAaMq+KaptWkwV3856gFV1xNGQmF+puH/8geCdw IAcCNLqLJNKM432UQzjMuaHreGAAHP6BMuuCsxZ9mXI2bZLUeR6llM/4YCKo4Dd5UmfM1dS52rh 8hG/Xl41Sq3uvxneWzI/xJSgT5uJQjr/JEo4mM7Dgr+tArZtO9/UUtUUHknJcF9DE4v8g1YHzbi dzFAhfhhX5ckaYvhL5bQ/Czvj7uG7xNahgXdvDlcGOQpQ== X-Received: by 127.0.0.2 with SMTP id fgoMYY7687511xankqu9R3dK; Fri, 16 Aug 2024 02:21:47 -0700 X-Received: from out30-100.freemail.mail.aliyun.com (out30-100.freemail.mail.aliyun.com [115.124.30.100]) by mx.groups.io with SMTP id smtpd.web10.144201.1723800106340096142 for ; Fri, 16 Aug 2024 02:21:47 -0700 X-Received: from 842effaa37a8.tbsite.net(mailfrom:huangming@linux.alibaba.com fp:SMTPD_---0WCzwzE4_1723800088) by smtp.aliyun-inc.com; Fri, 16 Aug 2024 17:21:42 +0800 From: "Ming Huang" 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 Subject: [edk2-devel] [PATCH v2 1/1] MdePkg: Add error output for IoLib.c Date: Fri, 16 Aug 2024 17:21:27 +0800 Message-Id: <20240816092127.118875-1-huangming@linux.alibaba.com> Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Fri, 16 Aug 2024 02:21:47 -0700 Resent-From: huangming@linux.alibaba.com Reply-To: devel@edk2.groups.io,huangming@linux.alibaba.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: FvkfRPbKu64c0iL2FZU0d1eVx7686176AA= X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=CuDzBHFY; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=linux.alibaba.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io 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 --- 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] -=-=-=-=-=-=-=-=-=-=-=-