From: "Tuan Phan" <tphan@ventanamicro.com>
To: devel@edk2.groups.io
Cc: andrei.warkentin@intel.com, sunilvl@ventanamicro.com,
Tuan Phan <tphan@ventanamicro.com>
Subject: [PATCH] OvmfPkg: RiscVVirt: Fix wrong checking Pci IO access
Date: Tue, 6 Jun 2023 23:08:29 -0700 [thread overview]
Message-ID: <20230607060829.4442-1-tphan@ventanamicro.com> (raw)
RiscV uses memory access for IO and MMIO resources, the address limit
is MAX_ADDRESS for both of them.
Signed-off-by: Tuan Phan <tphan@ventanamicro.com>
---
OvmfPkg/RiscVVirt/PciCpuIo2Dxe/PciCpuIo2Dxe.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/OvmfPkg/RiscVVirt/PciCpuIo2Dxe/PciCpuIo2Dxe.c b/OvmfPkg/RiscVVirt/PciCpuIo2Dxe/PciCpuIo2Dxe.c
index f3bf07e63141..75389235d897 100644
--- a/OvmfPkg/RiscVVirt/PciCpuIo2Dxe/PciCpuIo2Dxe.c
+++ b/OvmfPkg/RiscVVirt/PciCpuIo2Dxe/PciCpuIo2Dxe.c
@@ -19,8 +19,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/PcdLib.h>
#include <Library/UefiBootServicesTableLib.h>
-#define MAX_IO_PORT_ADDRESS 0xFFFF
-
//
// Handle for the CPU I/O 2 Protocol
//
@@ -143,16 +141,16 @@ CpuIoCheckParameter (
// Address + Size * Count. If the following condition is met, then the transfer
// is not supported.
//
- // Address + Size * Count > (MmioOperation ? MAX_ADDRESS : MAX_IO_PORT_ADDRESS) + 1
+ // Address + Size * Count > MAX_ADDRESS + 1
//
// Since MAX_ADDRESS can be the maximum integer value supported by the CPU and Count
// can also be the maximum integer value supported by the CPU, this range
// check must be adjusted to avoid all overflow conditions.
//
// The following form of the range check is equivalent but assumes that
- // MAX_ADDRESS and MAX_IO_PORT_ADDRESS are of the form (2^n - 1).
+ // MAX_ADDRESS is of the form (2^n - 1).
//
- Limit = (MmioOperation ? MAX_ADDRESS : MAX_IO_PORT_ADDRESS);
+ Limit = MAX_ADDRESS;
if (Count == 0) {
if (Address > Limit) {
return EFI_UNSUPPORTED;
--
2.25.1
reply other threads:[~2023-06-07 7:00 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=20230607060829.4442-1-tphan@ventanamicro.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