diff options
author | Mitchell Horne <mhorne@FreeBSD.org> | 2020-04-19 00:12:30 +0000 |
---|---|---|
committer | Mitchell Horne <mhorne@FreeBSD.org> | 2020-04-19 00:12:30 +0000 |
commit | 49439183ce09e28e9f80dafcc0ff5f2bde79c476 (patch) | |
tree | fd4b243cad898b394cd03aac8a451a6038766d31 /sys/arm64 | |
parent | 3c49a19fc9a90c899d28dcb396a81715b8736068 (diff) | |
download | src-49439183ce09e28e9f80dafcc0ff5f2bde79c476.tar.gz src-49439183ce09e28e9f80dafcc0ff5f2bde79c476.zip |
Convert arm's physmem interface to MI code
The arm_physmem interface found in arm's MD code provides a convenient
set of routines for adding/excluding physical memory regions and
initializing important kernel globals such as Maxmem, realmem,
phys_avail[], and dump_avail[]. It is especially convenient for FDT
systems, since we can use FDT parsing functions and pass the result
directly to one of these physmem routines. This interface is already in
use on arm and arm64, and can be used to simplify this early
initialization on RISC-V as well.
This requires only a couple trivial changes:
- Move arm_physmem_kernel_addr to arm/machdep.c. It is unused on arm64,
and manipulated entirely in arm MD code.
- Convert arm32_btop/arm64_btop to atop. This is equivalently defined
on all architectures.
- Drop the "arm" prefix.
Reviewed by: manu, emaste ("looks reasonable")
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24153
Notes
Notes:
svn path=/head/; revision=360082
Diffstat (limited to 'sys/arm64')
-rw-r--r-- | sys/arm64/arm64/machdep.c | 17 | ||||
-rw-r--r-- | sys/arm64/arm64/pmap.c | 7 |
2 files changed, 11 insertions, 13 deletions
diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 04665c3cc465..f5950eae1aab 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include <sys/linker.h> #include <sys/msgbuf.h> #include <sys/pcpu.h> +#include <sys/physmem.h> #include <sys/proc.h> #include <sys/ptrace.h> #include <sys/reboot.h> @@ -82,8 +83,6 @@ __FBSDID("$FreeBSD$"); #include <machine/undefined.h> #include <machine/vmparam.h> -#include <arm/include/physmem.h> - #ifdef VFP #include <machine/vfp.h> #endif @@ -855,7 +854,7 @@ exclude_efi_map_entry(struct efi_md *p) */ break; default: - arm_physmem_exclude_region(p->md_phys, p->md_pages * PAGE_SIZE, + physmem_exclude_region(p->md_phys, p->md_pages * PAGE_SIZE, EXFLAG_NOALLOC); } } @@ -886,7 +885,7 @@ add_efi_map_entry(struct efi_md *p) /* * We're allowed to use any entry with these types. */ - arm_physmem_hardware_region(p->md_phys, + physmem_hardware_region(p->md_phys, p->md_pages * PAGE_SIZE); break; } @@ -1113,10 +1112,10 @@ initarm(struct arm64_bootparams *abp) if (fdt_get_mem_regions(mem_regions, &mem_regions_sz, NULL) != 0) panic("Cannot get physical memory regions"); - arm_physmem_hardware_regions(mem_regions, mem_regions_sz); + physmem_hardware_regions(mem_regions, mem_regions_sz); } if (fdt_get_reserved_mem(mem_regions, &mem_regions_sz) == 0) - arm_physmem_exclude_regions(mem_regions, mem_regions_sz, + physmem_exclude_regions(mem_regions, mem_regions_sz, EXFLAG_NODUMP | EXFLAG_NOALLOC); #endif @@ -1124,7 +1123,7 @@ initarm(struct arm64_bootparams *abp) efifb = (struct efi_fb *)preload_search_info(kmdp, MODINFO_METADATA | MODINFOMD_EFI_FB); if (efifb != NULL) - arm_physmem_exclude_region(efifb->fb_addr, efifb->fb_size, + physmem_exclude_region(efifb->fb_addr, efifb->fb_size, EXFLAG_NOALLOC); /* Set the pcpu data, this is needed by pmap_bootstrap */ @@ -1153,7 +1152,7 @@ initarm(struct arm64_bootparams *abp) /* Exclude entries neexed in teh DMAP region, but not phys_avail */ if (efihdr != NULL) exclude_efi_map_entries(efihdr); - arm_physmem_init_kernel_globals(); + physmem_init_kernel_globals(); devmap_bootstrap(0, NULL); @@ -1182,7 +1181,7 @@ initarm(struct arm64_bootparams *abp) if (boothowto & RB_VERBOSE) { print_efi_map_entries(efihdr); - arm_physmem_print_tables(); + physmem_print_tables(); } early_boot = 0; diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index f0e0fede06d5..109fbe41f1b1 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -119,6 +119,7 @@ __FBSDID("$FreeBSD$"); #include <sys/mman.h> #include <sys/msgbuf.h> #include <sys/mutex.h> +#include <sys/physmem.h> #include <sys/proc.h> #include <sys/rwlock.h> #include <sys/sbuf.h> @@ -148,8 +149,6 @@ __FBSDID("$FreeBSD$"); #include <machine/md_var.h> #include <machine/pcb.h> -#include <arm/include/physmem.h> - #define PMAP_ASSERT_STAGE1(pmap) MPASS((pmap)->pm_stage == PM_STAGE1) #define NL0PG (PAGE_SIZE/(sizeof (pd_entry_t))) @@ -861,7 +860,7 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_paddr_t kernstart, /* Assume the address we were loaded to is a valid physical address */ min_pa = KERNBASE - kern_delta; - physmap_idx = arm_physmem_avail(physmap, nitems(physmap)); + physmap_idx = physmem_avail(physmap, nitems(physmap)); physmap_idx /= 2; /* @@ -942,7 +941,7 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_paddr_t kernstart, pa = pmap_early_vtophys(l1pt, freemempos); - arm_physmem_exclude_region(start_pa, pa - start_pa, EXFLAG_NOALLOC); + physmem_exclude_region(start_pa, pa - start_pa, EXFLAG_NOALLOC); cpu_tlb_flushID(); } |