Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86/x86 Fix EFI system table mapping in virtual space
details: https://anonhg.NetBSD.org/src/rev/2fd349a3b04b
branches: trunk
changeset: 455474:2fd349a3b04b
user: manu <manu%NetBSD.org@localhost>
date: Fri Oct 18 00:56:25 2019 +0000
description:
Fix EFI system table mapping in virtual space
Previous version was annoted as untested, and indeed it did not work.
New version uses the same approach as for ACPI table mapping.
diffstat:
sys/arch/x86/x86/efi.c | 22 ++++++++++------------
1 files changed, 10 insertions(+), 12 deletions(-)
diffs (66 lines):
diff -r 5549e5edeaae -r 2fd349a3b04b sys/arch/x86/x86/efi.c
--- a/sys/arch/x86/x86/efi.c Fri Oct 18 00:54:48 2019 +0000
+++ b/sys/arch/x86/x86/efi.c Fri Oct 18 00:56:25 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: efi.c,v 1.19 2018/12/03 19:46:43 cherry Exp $ */
+/* $NetBSD: efi.c,v 1.20 2019/10/18 00:56:25 manu Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.19 2018/12/03 19:46:43 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.20 2019/10/18 00:56:25 manu Exp $");
#include <sys/kmem.h>
#include <sys/param.h>
@@ -37,6 +37,8 @@
#include <uvm/uvm_extern.h>
#include <machine/bootinfo.h>
+#include <x86/bus_defs.h>
+#include <x86/bus_funcs.h>
#include <x86/efi.h>
#include <dev/mm.h>
@@ -73,21 +75,19 @@
efi_getva(paddr_t pa)
{
vaddr_t va;
+ int rv;
#ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
if (mm_md_direct_mapped_phys(pa, &va))
return va;
#endif
- /* XXX This code path is not tested. */
- va = uvm_km_alloc(kernel_map, PAGE_SIZE, 0,
- UVM_KMF_VAONLY | UVM_KMF_WAITVA);
- if (va == 0) {
+ rv = _x86_memio_map(x86_bus_space_mem, pa,
+ PAGE_SIZE, 0, (bus_space_handle_t *)&va);
+ if (rv != 0) {
aprint_debug("efi: unable to allocate va\n");
return 0;
}
- pmap_kenter_pa(va, pa, VM_PROT_READ, 0);
- pmap_update(pmap_kernel());
return va;
}
@@ -107,10 +107,8 @@
}
#endif
- /* XXX This code path is not tested. */
- pmap_kremove(va, PAGE_SIZE);
- pmap_update(pmap_kernel());
- uvm_km_free(kernel_map, va, PAGE_SIZE, UVM_KMF_VAONLY);
+ (void)_x86_memio_unmap(x86_bus_space_mem, (bus_space_handle_t)va,
+ PAGE_SIZE, NULL);
}
/*
Home |
Main Index |
Thread Index |
Old Index