[PATCH v2 1/3] lib: sbi: Simplified mmio match checking
Xiang W
wxjstz at 126.com
Wed Nov 23 19:16:03 PST 2022
Signed-off-by: Xiang W <wxjstz at 126.com>
---
lib/sbi/sbi_domain.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c
index f24a8e5..fec9074 100644
--- a/lib/sbi/sbi_domain.c
+++ b/lib/sbi/sbi_domain.c
@@ -105,7 +105,7 @@ bool sbi_domain_check_addr(const struct sbi_domain *dom,
unsigned long addr, unsigned long mode,
unsigned long access_flags)
{
- bool mmio = FALSE;
+ bool rmmio, mmio = FALSE;
struct sbi_domain_memregion *reg;
unsigned long rstart, rend, rflags, rwx = 0;
@@ -130,8 +130,8 @@ bool sbi_domain_check_addr(const struct sbi_domain *dom,
rend = (reg->order < __riscv_xlen) ?
rstart + ((1UL << reg->order) - 1) : -1UL;
if (rstart <= addr && addr <= rend) {
- if ((mmio && !(rflags & SBI_DOMAIN_MEMREGION_MMIO)) ||
- (!mmio && (rflags & SBI_DOMAIN_MEMREGION_MMIO)))
+ rmmio = (rflags & SBI_DOMAIN_MEMREGION_MMIO) ? TRUE : FALSE;
+ if (mmio != rmmio)
return FALSE;
return ((rflags & rwx) == rwx) ? TRUE : FALSE;
}
--
2.30.2
More information about the opensbi
mailing list