public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] OvmfPkg: RiscVVirt: Fix wrong checking Pci IO access
@ 2023-06-07  6:08 Tuan Phan
  0 siblings, 0 replies; only message in thread
From: Tuan Phan @ 2023-06-07  6:08 UTC (permalink / raw)
  To: devel; +Cc: andrei.warkentin, sunilvl, Tuan Phan

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-07  7:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-07  6:08 [PATCH] OvmfPkg: RiscVVirt: Fix wrong checking Pci IO access Tuan Phan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox