riscv: eliminate physmap global
Since physical memory management is now handled by subr_physmem.c, the need to keep this global array has diminished. It is not referenced outside of early boot-time, and is populated by physmem_avail() in pmap_bootstrap(). Just allocate the array on the stack for the duration of its lifetime. The check against physmap[0] in initriscv() can be dropped altogether, as there is no consequence for excluding a memory range twice. Reviewed by: markj MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34778
This commit is contained in:
parent
748f7c8db7
commit
8a0339e679
@ -46,9 +46,6 @@ struct riscv_bootparams {
|
||||
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_ */
|
||||
|
@ -111,9 +111,6 @@ int cold = 1;
|
||||
|
||||
#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 @@ initriscv(struct riscv_bootparams *rvbp)
|
||||
|
||||
#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();
|
||||
|
||||
|
@ -620,12 +620,14 @@ pmap_bootstrap_l3(vm_offset_t l1pt, vm_offset_t va, vm_offset_t l3_start)
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user