diff options
author | Andrew Turner <andrew@FreeBSD.org> | 2022-04-09 11:43:08 +0000 |
---|---|---|
committer | Andrew Turner <andrew@FreeBSD.org> | 2022-04-10 08:41:54 +0000 |
commit | f3ef799f564515b58a24a328739a4c749a02b110 (patch) | |
tree | e9fe2754dd96e8bb1d7d0f2280272abfc64834cc | |
parent | 57e47ae514b6ab605298b4595e0219048f59ab7a (diff) | |
download | src-f3ef799f564515b58a24a328739a4c749a02b110.tar.gz src-f3ef799f564515b58a24a328739a4c749a02b110.zip |
Only return a mapped address from efi_phys_to_kva
On some hardware the EFI system table is not in memory mapped in the
DMAP section. Rather than panic the kernel check if it is mapped and
return a failure if not from efi_phys_to_kva.
Reported by: kevans
Differential Revision: https://reviews.freebsd.org/D34858
-rw-r--r-- | sys/arm64/arm64/efirt_machdep.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/arm64/arm64/efirt_machdep.c b/sys/arm64/arm64/efirt_machdep.c index 6e6541900efb..727c9c37f94d 100644 --- a/sys/arm64/arm64/efirt_machdep.c +++ b/sys/arm64/arm64/efirt_machdep.c @@ -150,10 +150,17 @@ efi_1t1_l3(vm_offset_t va) vm_offset_t efi_phys_to_kva(vm_paddr_t paddr) { + vm_offset_t vaddr; - if (!PHYS_IN_DMAP(paddr)) - return (0); - return (PHYS_TO_DMAP(paddr)); + if (PHYS_IN_DMAP(paddr)) { + vaddr = PHYS_TO_DMAP(paddr); + if (pmap_klookup(vaddr, NULL)) + return (vaddr); + } + + /* TODO: Map memory not in the DMAP */ + + return (0); } /* |