tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

EFI system table mapping



Hello

In src/sys/arch/x86/x86/efi.c we have efi_getva() which is used to map
the EFI system table in virtual address space.

It does this (pa is EFI table physical address, va is its virtual
address):

#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);
(...)
       pmap_kenter_pa(va, pa, VM_PROT_READ, 0);
       pmap_update(pmap_kernel());

The code seems to work for native boot, but when working on multiboot 2
support for the kernel, I did hit a bug with the XXX section, which did
not correcty map the EFI system table.

I got it working by doing it the way we map the ACPI tables:

       rv = _x86_memio_map(x86_bus_space_mem, pa,     
           PAGE_SIZE, 0, (bus_space_handle_t *)&va); 

Is this new version right? The x86 prefix suggests the code is less
portable, andd the bus_space stuff suggests we highjack an unrelated
API. But at least it works.

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index