diff --git a/sys/riscv/include/machdep.h b/sys/riscv/include/machdep.h --- a/sys/riscv/include/machdep.h +++ b/sys/riscv/include/machdep.h @@ -46,9 +46,6 @@ vm_offset_t modulep; /* loader(8) metadata */ }; -extern vm_paddr_t physmap[PHYS_AVAIL_ENTRIES]; -extern u_int physmap_idx; - void initriscv(struct riscv_bootparams *); #endif /* _MACHINE_MACHDEP_H_ */ diff --git a/sys/riscv/riscv/machdep.c b/sys/riscv/riscv/machdep.c --- a/sys/riscv/riscv/machdep.c +++ b/sys/riscv/riscv/machdep.c @@ -111,9 +111,6 @@ #define DTB_SIZE_MAX (1024 * 1024) -vm_paddr_t physmap[PHYS_AVAIL_ENTRIES]; -u_int physmap_idx; - struct kva_md_info kmi; int64_t dcache_line_size; /* The minimum D cache line size */ @@ -553,18 +550,15 @@ #ifdef FDT /* - * XXX: Exclude the lowest 2MB of physical memory, if it hasn't been - * already, as this area is assumed to contain the SBI firmware. This - * is a little fragile, but it is consistent with the platforms we - * support so far. + * XXX: Unconditionally exclude the lowest 2MB of physical memory, as + * this area is assumed to contain the SBI firmware. This is a little + * fragile, but it is consistent with the platforms we support so far. * * TODO: remove this when the all regular booting methods properly * report their reserved memory in the device tree. */ - if (mem_regions[0].mr_start == physmap[0]) { - physmem_exclude_region(mem_regions[0].mr_start, L2_SIZE, - EXFLAG_NODUMP | EXFLAG_NOALLOC); - } + physmem_exclude_region(mem_regions[0].mr_start, L2_SIZE, + EXFLAG_NODUMP | EXFLAG_NOALLOC); #endif physmem_init_kernel_globals(); diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -620,12 +620,14 @@ void pmap_bootstrap(vm_offset_t l1pt, vm_paddr_t kernstart, vm_size_t kernlen) { + vm_paddr_t physmap[PHYS_AVAIL_ENTRIES]; uint64_t satp; vm_offset_t dpcpu, freemempos, l0pv, msgbufpv; vm_paddr_t l0pa, l1pa, max_pa, min_pa, pa; pd_entry_t *l0p; pt_entry_t *l2p; u_int l1_slot, l2_slot; + u_int physmap_idx; int i, mode; printf("pmap_bootstrap %lx %lx %lx\n", l1pt, kernstart, kernlen);