diff options
author | br <br@FreeBSD.org> | 2016-04-26 11:53:37 +0000 |
---|---|---|
committer | br <br@FreeBSD.org> | 2016-04-26 11:53:37 +0000 |
commit | 778cc5a8110efa54481c3c539aab11ad44e1efad (patch) | |
tree | 97a3c2543ae513e2b876f0ecd1746036805b5285 | |
parent | 392b4907a4ffb8e699201d053a85e4a32b845a6a (diff) | |
download | FreeBSD-src-778cc5a8110efa54481c3c539aab11ad44e1efad.zip FreeBSD-src-778cc5a8110efa54481c3c539aab11ad44e1efad.tar.gz |
Move arm's devmap to some generic place, so it can be used
by other architectures.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D6091
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5
46 files changed, 188 insertions, 341 deletions
diff --git a/sys/arm/allwinner/allwinner_machdep.c b/sys/arm/allwinner/allwinner_machdep.c index 7159acd..b916580 100644 --- a/sys/arm/allwinner/allwinner_machdep.c +++ b/sys/arm/allwinner/allwinner_machdep.c @@ -39,12 +39,12 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <vm/pmap.h> #include <machine/bus.h> -#include <machine/devmap.h> #include <machine/machdep.h> #include <machine/platformvar.h> @@ -98,7 +98,7 @@ static vm_offset_t allwinner_lastaddr(platform_t plat) { - return (arm_devmap_lastaddr()); + return (devmap_lastaddr()); } /* @@ -115,7 +115,7 @@ static int allwinner_devmap_init(platform_t plat) { - arm_devmap_add_entry(0x01C00000, 0x00400000); /* 4MB */ + devmap_add_entry(0x01C00000, 0x00400000); /* 4MB */ return (0); } diff --git a/sys/arm/altera/socfpga/socfpga_machdep.c b/sys/arm/altera/socfpga/socfpga_machdep.c index 988e5ad..9ae868a 100644 --- a/sys/arm/altera/socfpga/socfpga_machdep.c +++ b/sys/arm/altera/socfpga/socfpga_machdep.c @@ -38,12 +38,12 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <machine/armreg.h> #include <machine/bus.h> -#include <machine/devmap.h> #include <machine/machdep.h> #include <machine/platform.h> @@ -51,7 +51,7 @@ vm_offset_t platform_lastaddr(void) { - return (arm_devmap_lastaddr()); + return (devmap_lastaddr()); } void @@ -77,7 +77,7 @@ platform_devmap_init(void) { /* UART */ - arm_devmap_add_entry(0xffc00000, 0x100000); + devmap_add_entry(0xffc00000, 0x100000); /* * USB OTG @@ -87,16 +87,16 @@ platform_devmap_init(void) * It might be caused due to some power save options being turned * on or something else. */ - arm_devmap_add_entry(0xffb00000, 0x100000); + devmap_add_entry(0xffb00000, 0x100000); /* dwmmc */ - arm_devmap_add_entry(0xff700000, 0x100000); + devmap_add_entry(0xff700000, 0x100000); /* scu */ - arm_devmap_add_entry(0xfff00000, 0x100000); + devmap_add_entry(0xfff00000, 0x100000); /* FPGA memory window, 256MB */ - arm_devmap_add_entry(0xd0000000, 0x10000000); + devmap_add_entry(0xd0000000, 0x10000000); return (0); } diff --git a/sys/arm/amlogic/aml8726/aml8726_machdep.c b/sys/arm/amlogic/aml8726/aml8726_machdep.c index 5037180..58cf9b2 100644 --- a/sys/arm/amlogic/aml8726/aml8726_machdep.c +++ b/sys/arm/amlogic/aml8726/aml8726_machdep.c @@ -35,13 +35,13 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <vm/pmap.h> #include <machine/bus.h> #include <machine/cpufunc.h> -#include <machine/devmap.h> #include <machine/intr.h> #include <machine/machdep.h> #include <machine/platform.h> @@ -85,7 +85,7 @@ vm_offset_t platform_lastaddr(void) { - return (arm_devmap_lastaddr()); + return (devmap_lastaddr()); } void @@ -108,7 +108,7 @@ platform_gpio_init(void) * and platform_gpio_init during which printf can't be used. */ aml8726_aobus_kva_base = - (vm_offset_t)arm_devmap_ptov(0xc8100000, 0x100000); + (vm_offset_t)devmap_ptov(0xc8100000, 0x100000); /* * The hardware mux used by clkmsr is unique to the SoC (though @@ -154,14 +154,14 @@ int platform_devmap_init(void) { - arm_devmap_add_entry(0xc1100000, 0x200000); /* cbus */ - arm_devmap_add_entry(0xc4200000, 0x100000); /* pl310 */ - arm_devmap_add_entry(0xc4300000, 0x100000); /* periph */ - arm_devmap_add_entry(0xc8000000, 0x100000); /* apbbus */ - arm_devmap_add_entry(0xc8100000, 0x100000); /* aobus */ - arm_devmap_add_entry(0xc9000000, 0x800000); /* ahbbus */ - arm_devmap_add_entry(0xd9000000, 0x100000); /* ahb */ - arm_devmap_add_entry(0xda000000, 0x100000); /* secbus */ + devmap_add_entry(0xc1100000, 0x200000); /* cbus */ + devmap_add_entry(0xc4200000, 0x100000); /* pl310 */ + devmap_add_entry(0xc4300000, 0x100000); /* periph */ + devmap_add_entry(0xc8000000, 0x100000); /* apbbus */ + devmap_add_entry(0xc8100000, 0x100000); /* aobus */ + devmap_add_entry(0xc9000000, 0x800000); /* ahbbus */ + devmap_add_entry(0xd9000000, 0x100000); /* ahb */ + devmap_add_entry(0xda000000, 0x100000); /* secbus */ return (0); } diff --git a/sys/arm/annapurna/alpine/alpine_machdep.c b/sys/arm/annapurna/alpine/alpine_machdep.c index 54e26bf..acb9ba2 100644 --- a/sys/arm/annapurna/alpine/alpine_machdep.c +++ b/sys/arm/annapurna/alpine/alpine_machdep.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include <sys/bus.h> #include <sys/lock.h> #include <sys/mutex.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <vm/pmap.h> @@ -42,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include <machine/bus.h> #include <machine/frame.h> /* For trapframe_t, used in <machine/machdep.h> */ #include <machine/machdep.h> -#include <machine/devmap.h> #include <machine/platform.h> #include <machine/fdt.h> @@ -128,7 +128,7 @@ int platform_devmap_init(void) { alpine_get_devmap_base(&al_devmap_pa, &al_devmap_size); - arm_devmap_add_entry(al_devmap_pa, al_devmap_size); + devmap_add_entry(al_devmap_pa, al_devmap_size); return (0); } diff --git a/sys/arm/arm/bus_space_generic.c b/sys/arm/arm/bus_space_generic.c index 8fdac8c..65885a0 100644 --- a/sys/arm/arm/bus_space_generic.c +++ b/sys/arm/arm/bus_space_generic.c @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include <sys/bus.h> #include <sys/kernel.h> #include <sys/malloc.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <vm/pmap.h> @@ -51,7 +52,6 @@ __FBSDID("$FreeBSD$"); #include <machine/bus.h> #include <machine/cpufunc.h> -#include <machine/devmap.h> void generic_bs_unimplemented(void) diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c index ad0e699..a147dc3 100644 --- a/sys/arm/arm/machdep.c +++ b/sys/arm/arm/machdep.c @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include <sys/cons.h> #include <sys/cpu.h> #include <sys/ctype.h> +#include <sys/devmap.h> #include <sys/efi.h> #include <sys/exec.h> #include <sys/imgact.h> @@ -100,7 +101,6 @@ __FBSDID("$FreeBSD$"); #include <machine/cpuinfo.h> #include <machine/debug_monitor.h> #include <machine/db_machdep.h> -#include <machine/devmap.h> #include <machine/frame.h> #include <machine/intr.h> #include <machine/machdep.h> @@ -455,7 +455,7 @@ cpu_startup(void *dummy) (uintmax_t)arm32_ptob(vm_cnt.v_free_count) / mbyte); if (bootverbose) { arm_physmem_print_tables(); - arm_devmap_print_table(); + devmap_print_table(); } bufinit(); @@ -1692,7 +1692,7 @@ initarm(struct arm_boot_params *abp) /* Establish static device mappings. */ err_devmap = platform_devmap_init(); - arm_devmap_bootstrap(l1pagetable, NULL); + devmap_bootstrap(l1pagetable, NULL); vm_max_kernel_address = platform_lastaddr(); cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL * 2)) | DOMAIN_CLIENT); @@ -1913,7 +1913,7 @@ initarm(struct arm_boot_params *abp) /* Establish static device mappings. */ err_devmap = platform_devmap_init(); - arm_devmap_bootstrap(0, NULL); + devmap_bootstrap(0, NULL); vm_max_kernel_address = platform_lastaddr(); /* diff --git a/sys/arm/at91/at91.c b/sys/arm/at91/at91.c index 34c19d7..75b40b2 100644 --- a/sys/arm/at91/at91.c +++ b/sys/arm/at91/at91.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include <sys/kernel.h> #include <sys/malloc.h> #include <sys/module.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <vm/vm_kern.h> @@ -45,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include <machine/armreg.h> #define _ARM32_BUS_DMA_PRIVATE #include <machine/bus.h> -#include <machine/devmap.h> #include <machine/intr.h> #include <arm/at91/at91var.h> diff --git a/sys/arm/at91/at91_common.c b/sys/arm/at91/at91_common.c index 37f94d7..49ad065 100644 --- a/sys/arm/at91/at91_common.c +++ b/sys/arm/at91/at91_common.c @@ -30,10 +30,10 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> +#include <sys/devmap.h> #include <vm/vm.h> -#include <machine/devmap.h> #include <machine/intr.h> #include <machine/machdep.h> #include <machine/platform.h> @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); #include <machine/fdt.h> -extern const struct arm_devmap_entry at91_devmap[]; +extern const struct devmap_entry at91_devmap[]; struct fdt_fixup_entry fdt_fixup_table[] = { { NULL, NULL } @@ -91,7 +91,7 @@ vm_offset_t platform_lastaddr(void) { - return (arm_devmap_lastaddr()); + return (devmap_lastaddr()); } void @@ -106,9 +106,9 @@ int platform_devmap_init(void) { -// arm_devmap_add_entry(0xfff00000, 0x00100000); /* 1MB - uart, aic and timers*/ +// devmap_add_entry(0xfff00000, 0x00100000); /* 1MB - uart, aic and timers*/ - arm_devmap_register_table(at91_devmap); + devmap_register_table(at91_devmap); return (0); } diff --git a/sys/arm/at91/at91_machdep.c b/sys/arm/at91/at91_machdep.c index 7e65409..b6ff9ca 100644 --- a/sys/arm/at91/at91_machdep.c +++ b/sys/arm/at91/at91_machdep.c @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #include <sys/exec.h> #include <sys/kdb.h> #include <sys/msgbuf.h> +#include <sys/devmap.h> #include <machine/physmem.h> #include <machine/reg.h> #include <machine/cpu.h> @@ -81,7 +82,6 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_object.h> #include <vm/vm_page.h> #include <vm/vm_map.h> -#include <machine/devmap.h> #include <machine/vmparam.h> #include <machine/pcb.h> #include <machine/undefined.h> @@ -117,7 +117,7 @@ __FBSDID("$FreeBSD$"); struct pv_addr kernel_pt_table[NUM_KERNEL_PTS]; /* Static device mappings. */ -const struct arm_devmap_entry at91_devmap[] = { +const struct devmap_entry at91_devmap[] = { /* * Map the critical on-board devices. The interrupt vector at * 0xffff0000 makes it impossible to map them PA == VA, so we map all @@ -552,7 +552,7 @@ initarm(struct arm_boot_params *abp) VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE); } - arm_devmap_bootstrap(l1pagetable, at91_devmap); + devmap_bootstrap(l1pagetable, at91_devmap); cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL * 2)) | DOMAIN_CLIENT); cpu_setttb(kernel_l1pt.pv_pa); cpu_tlb_flushID(); diff --git a/sys/arm/broadcom/bcm2835/bcm2835_machdep.c b/sys/arm/broadcom/bcm2835/bcm2835_machdep.c index 17c0ac5..70d078a 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_machdep.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_machdep.c @@ -46,12 +46,12 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <vm/pmap.h> #include <machine/bus.h> -#include <machine/devmap.h> #include <machine/machdep.h> #include <machine/platform.h> #include <machine/platformvar.h> @@ -66,7 +66,7 @@ static vm_offset_t bcm2835_lastaddr(platform_t plat) { - return (arm_devmap_lastaddr()); + return (devmap_lastaddr()); } static void @@ -98,7 +98,7 @@ static int bcm2835_devmap_init(platform_t plat) { - arm_devmap_add_entry(0x20000000, 0x01000000); + devmap_add_entry(0x20000000, 0x01000000); return (0); } #endif @@ -108,7 +108,7 @@ static int bcm2836_devmap_init(platform_t plat) { - arm_devmap_add_entry(0x3f000000, 0x01000000); + devmap_add_entry(0x3f000000, 0x01000000); return (0); } #endif diff --git a/sys/arm/cavium/cns11xx/econa_machdep.c b/sys/arm/cavium/cns11xx/econa_machdep.c index aa5ec11..124f248 100644 --- a/sys/arm/cavium/cns11xx/econa_machdep.c +++ b/sys/arm/cavium/cns11xx/econa_machdep.c @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include <sys/exec.h> #include <sys/kdb.h> #include <sys/msgbuf.h> +#include <sys/devmap.h> #include <machine/physmem.h> #include <machine/reg.h> #include <machine/cpu.h> @@ -71,7 +72,6 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_object.h> #include <vm/vm_page.h> #include <vm/vm_map.h> -#include <machine/devmap.h> #include <machine/vmparam.h> #include <machine/pcb.h> #include <machine/undefined.h> @@ -105,7 +105,7 @@ struct pv_addr abtstack; struct pv_addr kernelstack; /* Static device mappings. */ -static const struct arm_devmap_entry econa_devmap[] = { +static const struct devmap_entry econa_devmap[] = { { /* * This maps DDR SDRAM @@ -263,7 +263,7 @@ initarm(struct arm_boot_params *abp) VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE); } - arm_devmap_bootstrap(l1pagetable, econa_devmap); + devmap_bootstrap(l1pagetable, econa_devmap); cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT); cpu_setttb(kernel_l1pt.pv_pa); cpu_tlb_flushID(); diff --git a/sys/arm/freescale/fsl_ocotp.c b/sys/arm/freescale/fsl_ocotp.c index d3fb35b..09210c5 100644 --- a/sys/arm/freescale/fsl_ocotp.c +++ b/sys/arm/freescale/fsl_ocotp.c @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); #include <vm/vm.h> #include <vm/pmap.h> #include <dev/fdt/fdt_common.h> -#include <machine/devmap.h> +#include <sys/devmap.h> static uint32_t *ocotp_regs; static vm_size_t ocotp_size; diff --git a/sys/arm/freescale/imx/imx51_machdep.c b/sys/arm/freescale/imx/imx51_machdep.c index 5d8f380..c498bff 100644 --- a/sys/arm/freescale/imx/imx51_machdep.c +++ b/sys/arm/freescale/imx/imx51_machdep.c @@ -33,11 +33,11 @@ __FBSDID("$FreeBSD$"); #include <sys/systm.h> #include <sys/bus.h> #include <sys/reboot.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <machine/bus.h> -#include <machine/devmap.h> #include <machine/machdep.h> #include <machine/platformvar.h> @@ -49,7 +49,7 @@ static vm_offset_t imx51_lastaddr(platform_t plat) { - return (arm_devmap_lastaddr()); + return (devmap_lastaddr()); } static int @@ -74,9 +74,9 @@ static int imx51_devmap_init(platform_t plat) { - arm_devmap_add_entry(0x70000000, 0x00100000); - arm_devmap_add_entry(0x73f00000, 0x00100000); - arm_devmap_add_entry(0x83f00000, 0x00100000); + devmap_add_entry(0x70000000, 0x00100000); + devmap_add_entry(0x73f00000, 0x00100000); + devmap_add_entry(0x83f00000, 0x00100000); return (0); } diff --git a/sys/arm/freescale/imx/imx53_machdep.c b/sys/arm/freescale/imx/imx53_machdep.c index 92b59e4..63dd949 100644 --- a/sys/arm/freescale/imx/imx53_machdep.c +++ b/sys/arm/freescale/imx/imx53_machdep.c @@ -33,11 +33,11 @@ __FBSDID("$FreeBSD$"); #include <sys/systm.h> #include <sys/bus.h> #include <sys/reboot.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <machine/bus.h> -#include <machine/devmap.h> #include <machine/machdep.h> #include <machine/platformvar.h> @@ -49,7 +49,7 @@ static vm_offset_t imx53_lastaddr(platform_t plat) { - return (arm_devmap_lastaddr()); + return (devmap_lastaddr()); } static int @@ -74,9 +74,9 @@ static int imx53_devmap_init(platform_t plat) { - arm_devmap_add_entry(0x50000000, 0x00100000); - arm_devmap_add_entry(0x53f00000, 0x00100000); - arm_devmap_add_entry(0x63f00000, 0x00100000); + devmap_add_entry(0x50000000, 0x00100000); + devmap_add_entry(0x53f00000, 0x00100000); + devmap_add_entry(0x63f00000, 0x00100000); return (0); } diff --git a/sys/arm/freescale/imx/imx6_machdep.c b/sys/arm/freescale/imx/imx6_machdep.c index d5417c2..8c767e1 100644 --- a/sys/arm/freescale/imx/imx6_machdep.c +++ b/sys/arm/freescale/imx/imx6_machdep.c @@ -33,11 +33,11 @@ __FBSDID("$FreeBSD$"); #include <sys/systm.h> #include <sys/bus.h> #include <sys/reboot.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <machine/bus.h> -#include <machine/devmap.h> #include <machine/intr.h> #include <machine/machdep.h> #include <machine/platformvar.h> @@ -166,7 +166,7 @@ static vm_offset_t imx6_lastaddr(platform_t plat) { - return (arm_devmap_lastaddr()); + return (devmap_lastaddr()); } static int @@ -220,9 +220,9 @@ imx6_devmap_init(platform_t plat) const uint32_t IMX6_AIPS2_PHYS = 0x02100000; const uint32_t IMX6_AIPS2_SIZE = 0x00100000; - arm_devmap_add_entry(IMX6_ARMMP_PHYS, IMX6_ARMMP_SIZE); - arm_devmap_add_entry(IMX6_AIPS1_PHYS, IMX6_AIPS1_SIZE); - arm_devmap_add_entry(IMX6_AIPS2_PHYS, IMX6_AIPS2_SIZE); + devmap_add_entry(IMX6_ARMMP_PHYS, IMX6_ARMMP_SIZE); + devmap_add_entry(IMX6_AIPS1_PHYS, IMX6_AIPS1_SIZE); + devmap_add_entry(IMX6_AIPS2_PHYS, IMX6_AIPS2_SIZE); return (0); } @@ -287,7 +287,7 @@ u_int imx_soc_type() IMX6_ANALOG_DIGPROG_SOCTYPE_SHIFT; /*printf("digprog = 0x%08x\n", digprog);*/ if (hwsoc == HWSOC_MX6DL) { - pcr = arm_devmap_ptov(SCU_CONFIG_PHYSADDR, 4); + pcr = devmap_ptov(SCU_CONFIG_PHYSADDR, 4); if (pcr != NULL) { /*printf("scu config = 0x%08x\n", *pcr);*/ if ((*pcr & 0x03) == 0) { diff --git a/sys/arm/freescale/imx/imx_machdep.c b/sys/arm/freescale/imx/imx_machdep.c index 002651a..6ef44a4 100644 --- a/sys/arm/freescale/imx/imx_machdep.c +++ b/sys/arm/freescale/imx/imx_machdep.c @@ -33,13 +33,13 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> #include <sys/reboot.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <vm/pmap.h> #include <machine/armreg.h> #include <machine/bus.h> -#include <machine/devmap.h> #include <machine/machdep.h> #include <arm/freescale/imx/imx_machdep.h> @@ -85,7 +85,7 @@ imx_wdog_cpu_reset(vm_offset_t wdcr_physaddr) * control register. The reset happens on the next cycle of the wdog * 32KHz clock, so hang out in a spin loop until the reset takes effect. */ - if ((pcr = arm_devmap_ptov(wdcr_physaddr, sizeof(*pcr))) == NULL) { + if ((pcr = devmap_ptov(wdcr_physaddr, sizeof(*pcr))) == NULL) { printf("cpu_reset() can't find its control register... locking up now."); } else { *pcr &= ~WDOG_CR_SRS; @@ -99,7 +99,7 @@ imx_wdog_init_last_reset(vm_offset_t wdsr_phys) { volatile uint16_t * psr; - if ((psr = arm_devmap_ptov(wdsr_phys, sizeof(*psr))) == NULL) + if ((psr = devmap_ptov(wdsr_phys, sizeof(*psr))) == NULL) return; last_reset_status = *psr; if (last_reset_status & WDOG_RSR_SFTW) { diff --git a/sys/arm/freescale/vybrid/vf_machdep.c b/sys/arm/freescale/vybrid/vf_machdep.c index 76018dd..d32ba0d 100644 --- a/sys/arm/freescale/vybrid/vf_machdep.c +++ b/sys/arm/freescale/vybrid/vf_machdep.c @@ -34,12 +34,12 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <machine/armreg.h> #include <machine/bus.h> -#include <machine/devmap.h> #include <machine/machdep.h> #include <machine/platform.h> @@ -49,7 +49,7 @@ vm_offset_t platform_lastaddr(void) { - return (arm_devmap_lastaddr()); + return (devmap_lastaddr()); } void @@ -74,7 +74,7 @@ int platform_devmap_init(void) { - arm_devmap_add_entry(0x40000000, 0x100000); + devmap_add_entry(0x40000000, 0x100000); return (0); } diff --git a/sys/arm/include/vmparam.h b/sys/arm/include/vmparam.h index 36f19a3..c28b28e 100644 --- a/sys/arm/include/vmparam.h +++ b/sys/arm/include/vmparam.h @@ -172,4 +172,6 @@ extern vm_offset_t vm_max_kernel_address; #define SFBUF #define SFBUF_MAP +#define DEVMAP_MAX_VADDR ARM_VECTORS_HIGH + #endif /* _MACHINE_VMPARAM_H_ */ diff --git a/sys/arm/lpc/lpc_machdep.c b/sys/arm/lpc/lpc_machdep.c index ecef7db..d193ac9 100644 --- a/sys/arm/lpc/lpc_machdep.c +++ b/sys/arm/lpc/lpc_machdep.c @@ -45,13 +45,13 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <vm/pmap.h> #include <machine/bus.h> #include <machine/fdt.h> -#include <machine/devmap.h> #include <machine/machdep.h> #include <machine/platform.h> @@ -64,7 +64,7 @@ vm_offset_t platform_lastaddr(void) { - return (arm_devmap_lastaddr()); + return (devmap_lastaddr()); } void @@ -90,13 +90,13 @@ platform_late_init(void) /* * Add a single static device mapping. * The values used were taken from the ranges property of the SoC node in the - * dts file when this code was converted to arm_devmap_add_entry(). + * dts file when this code was converted to devmap_add_entry(). */ int platform_devmap_init(void) { - arm_devmap_add_entry(LPC_DEV_PHYS_BASE, LPC_DEV_SIZE); + devmap_add_entry(LPC_DEV_PHYS_BASE, LPC_DEV_SIZE); return (0); } diff --git a/sys/arm/mv/mv_common.c b/sys/arm/mv/mv_common.c index 9466956..2bd13f6 100644 --- a/sys/arm/mv/mv_common.c +++ b/sys/arm/mv/mv_common.c @@ -381,7 +381,7 @@ soc_id(uint32_t *dev, uint32_t *rev) * Notice: system identifiers are available in the registers range of * PCIE controller, so using this function is only allowed (and * possible) after the internal registers range has been mapped in via - * arm_devmap_bootstrap(). + * devmap_bootstrap(). */ *dev = bus_space_read_4(fdtbus_bs_tag, MV_PCIE_BASE, 0) >> 16; *rev = bus_space_read_4(fdtbus_bs_tag, MV_PCIE_BASE, 8) & 0xff; diff --git a/sys/arm/mv/mv_localbus.c b/sys/arm/mv/mv_localbus.c index fabb694..1bee2a1 100644 --- a/sys/arm/mv/mv_localbus.c +++ b/sys/arm/mv/mv_localbus.c @@ -36,10 +36,10 @@ __FBSDID("$FreeBSD$"); #include <sys/bus.h> #include <sys/rman.h> #include <sys/malloc.h> +#include <sys/devmap.h> #include <vm/vm.h> -#include <machine/devmap.h> #include <machine/fdt.h> #include <dev/ofw/ofw_bus.h> @@ -384,7 +384,7 @@ localbus_get_devinfo(device_t bus, device_t child) } int -fdt_localbus_devmap(phandle_t dt_node, struct arm_devmap_entry *fdt_devmap, +fdt_localbus_devmap(phandle_t dt_node, struct devmap_entry *fdt_devmap, int banks_max_num, int *banks_added) { pcell_t ranges[MV_LOCALBUS_MAX_BANKS * MV_LOCALBUS_MAX_BANK_CELLS]; diff --git a/sys/arm/mv/mv_machdep.c b/sys/arm/mv/mv_machdep.c index e7ddc87..69fa8f5 100644 --- a/sys/arm/mv/mv_machdep.c +++ b/sys/arm/mv/mv_machdep.c @@ -45,12 +45,12 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <vm/pmap.h> #include <machine/bus.h> -#include <machine/devmap.h> #include <machine/fdt.h> #include <machine/machdep.h> #include <machine/platform.h> @@ -270,12 +270,12 @@ platform_late_init(void) } #define FDT_DEVMAP_MAX (MV_WIN_CPU_MAX + 2) -static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = { +static struct devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = { { 0, 0, 0, } }; static int -platform_sram_devmap(struct arm_devmap_entry *map) +platform_sram_devmap(struct devmap_entry *map) { #if !defined(SOC_MV_ARMADAXP) phandle_t child, root; @@ -318,10 +318,10 @@ out: * real implementation of this function in arm/mv/mv_pci.c overrides the weak * alias defined here. */ -int mv_default_fdt_pci_devmap(phandle_t node, struct arm_devmap_entry *devmap, +int mv_default_fdt_pci_devmap(phandle_t node, struct devmap_entry *devmap, vm_offset_t io_va, vm_offset_t mem_va); int -mv_default_fdt_pci_devmap(phandle_t node, struct arm_devmap_entry *devmap, +mv_default_fdt_pci_devmap(phandle_t node, struct devmap_entry *devmap, vm_offset_t io_va, vm_offset_t mem_va) { @@ -345,7 +345,7 @@ platform_devmap_init(void) int i, num_mapped; i = 0; - arm_devmap_register_table(&fdt_devmap[0]); + devmap_register_table(&fdt_devmap[0]); #ifdef SOC_MV_ARMADAXP vm_paddr_t cur_immr_pa; diff --git a/sys/arm/mv/mv_pci.c b/sys/arm/mv/mv_pci.c index 2ef6604..55d3f15 100644 --- a/sys/arm/mv/mv_pci.c +++ b/sys/arm/mv/mv_pci.c @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include <sys/bus.h> #include <sys/rman.h> #include <sys/endian.h> +#include <sys/devmap.h> #include <machine/fdt.h> #include <machine/intr.h> @@ -70,7 +71,6 @@ __FBSDID("$FreeBSD$"); #include "ofw_bus_if.h" #include "pcib_if.h" -#include <machine/devmap.h> #include <machine/resource.h> #include <machine/bus.h> @@ -221,7 +221,7 @@ mv_pci_ranges(phandle_t node, struct mv_pci_range *io_space, } int -mv_pci_devmap(phandle_t node, struct arm_devmap_entry *devmap, vm_offset_t io_va, +mv_pci_devmap(phandle_t node, struct devmap_entry *devmap, vm_offset_t io_va, vm_offset_t mem_va) { struct mv_pci_range io_space, mem_space; diff --git a/sys/arm/mv/mvvar.h b/sys/arm/mv/mvvar.h index 898b74e..c08064f 100644 --- a/sys/arm/mv/mvvar.h +++ b/sys/arm/mv/mvvar.h @@ -135,10 +135,10 @@ uint32_t mv_drbl_get_msg(int mnr, int dir, int unit); int mv_msi_data(int irq, uint64_t *addr, uint32_t *data); -struct arm_devmap_entry; +struct devmap_entry; -int mv_pci_devmap(phandle_t, struct arm_devmap_entry *, vm_offset_t, +int mv_pci_devmap(phandle_t, struct devmap_entry *, vm_offset_t, vm_offset_t); -int fdt_localbus_devmap(phandle_t, struct arm_devmap_entry *, int, int *); +int fdt_localbus_devmap(phandle_t, struct devmap_entry *, int, int *); #endif /* _MVVAR_H_ */ diff --git a/sys/arm/mv/orion/db88f5xxx.c b/sys/arm/mv/orion/db88f5xxx.c index a5c189e..95983e5 100644 --- a/sys/arm/mv/orion/db88f5xxx.c +++ b/sys/arm/mv/orion/db88f5xxx.c @@ -73,7 +73,7 @@ __FBSDID("$FreeBSD$"); int platform_pci_get_irq(u_int bus, u_int slot, u_int func, u_int pin); /* Static device mappings. */ -const struct arm_devmap_entry db88f5xxx_devmap[] = { +const struct devmap_entry db88f5xxx_devmap[] = { /* * Map the on-board devices VA == PA so that we can access them * with the MMU on or off. diff --git a/sys/arm/nvidia/tegra124/tegra124_machdep.c b/sys/arm/nvidia/tegra124/tegra124_machdep.c index e74a05b..9dbce99 100644 --- a/sys/arm/nvidia/tegra124/tegra124_machdep.c +++ b/sys/arm/nvidia/tegra124/tegra124_machdep.c @@ -34,11 +34,11 @@ __FBSDID("$FreeBSD$"); #include <sys/systm.h> #include <sys/bus.h> #include <sys/reboot.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <machine/bus.h> -#include <machine/devmap.h> #include <machine/fdt.h> #include <machine/intr.h> #include <machine/machdep.h> @@ -84,7 +84,7 @@ static vm_offset_t tegra124_lastaddr(platform_t plat) { - return (arm_devmap_lastaddr()); + return (devmap_lastaddr()); } static int @@ -108,7 +108,7 @@ static int tegra124_devmap_init(platform_t plat) { - arm_devmap_add_entry(0x70000000, 0x01000000); + devmap_add_entry(0x70000000, 0x01000000); return (0); } diff --git a/sys/arm/nvidia/tegra_pcie.c b/sys/arm/nvidia/tegra_pcie.c index e63ea47..ac38eb2 100644 --- a/sys/arm/nvidia/tegra_pcie.c +++ b/sys/arm/nvidia/tegra_pcie.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include <sys/bus.h> #include <sys/rman.h> #include <sys/endian.h> +#include <sys/devmap.h> #include <machine/intr.h> @@ -60,7 +61,6 @@ __FBSDID("$FreeBSD$"); #include <dev/pci/pcireg.h> #include <dev/pci/pcib_private.h> -#include <machine/devmap.h> #include <machine/resource.h> #include <machine/bus.h> @@ -1688,4 +1688,4 @@ static driver_t tegra_pcib_driver = { devclass_t pcib_devclass; -DRIVER_MODULE(pcib, simplebus, tegra_pcib_driver, pcib_devclass, 0, 0);
\ No newline at end of file +DRIVER_MODULE(pcib, simplebus, tegra_pcib_driver, pcib_devclass, 0, 0); diff --git a/sys/arm/qemu/virt_machdep.c b/sys/arm/qemu/virt_machdep.c index d0514fe..ddbfd64 100644 --- a/sys/arm/qemu/virt_machdep.c +++ b/sys/arm/qemu/virt_machdep.c @@ -33,11 +33,11 @@ __FBSDID("$FreeBSD$"); #define _ARM32_BUS_DMA_PRIVATE #include <sys/param.h> #include <sys/systm.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <machine/bus.h> -#include <machine/devmap.h> #include <machine/platform.h> #include <machine/platformvar.h> @@ -70,7 +70,7 @@ static vm_offset_t virt_lastaddr(platform_t plat) { - return (arm_devmap_lastaddr()); + return (devmap_lastaddr()); } /* @@ -80,7 +80,7 @@ static int virt_devmap_init(platform_t plat) { - arm_devmap_add_entry(0x09000000, 0x100000); /* Uart */ + devmap_add_entry(0x09000000, 0x100000); /* Uart */ return (0); } diff --git a/sys/arm/rockchip/rk30xx_machdep.c b/sys/arm/rockchip/rk30xx_machdep.c index 8a21883..db34d33 100644 --- a/sys/arm/rockchip/rk30xx_machdep.c +++ b/sys/arm/rockchip/rk30xx_machdep.c @@ -38,13 +38,13 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <vm/pmap.h> #include <machine/armreg.h> #include <machine/bus.h> -#include <machine/devmap.h> #include <machine/machdep.h> #include <machine/platform.h> @@ -56,7 +56,7 @@ vm_offset_t platform_lastaddr(void) { - return (arm_devmap_lastaddr()); + return (devmap_lastaddr()); } void @@ -86,8 +86,8 @@ int platform_devmap_init(void) { - arm_devmap_add_entry(0x10000000, 0x00200000); - arm_devmap_add_entry(0x20000000, 0x00100000); + devmap_add_entry(0x10000000, 0x00200000); + devmap_add_entry(0x20000000, 0x00100000); return (0); } diff --git a/sys/arm/samsung/exynos/exynos5_machdep.c b/sys/arm/samsung/exynos/exynos5_machdep.c index c5cf44e..6483a7a 100644 --- a/sys/arm/samsung/exynos/exynos5_machdep.c +++ b/sys/arm/samsung/exynos/exynos5_machdep.c @@ -34,12 +34,12 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <machine/armreg.h> #include <machine/bus.h> -#include <machine/devmap.h> #include <machine/machdep.h> #include <machine/platform.h> @@ -47,7 +47,7 @@ vm_offset_t platform_lastaddr(void) { - return (arm_devmap_lastaddr()); + return (devmap_lastaddr()); } void @@ -73,13 +73,13 @@ platform_devmap_init(void) { /* CHIP ID */ - arm_devmap_add_entry(0x10000000, 0x100000); + devmap_add_entry(0x10000000, 0x100000); /* UART */ - arm_devmap_add_entry(0x12C00000, 0x100000); + devmap_add_entry(0x12C00000, 0x100000); /* DWMMC */ - arm_devmap_add_entry(0x12200000, 0x100000); + devmap_add_entry(0x12200000, 0x100000); return (0); } diff --git a/sys/arm/ti/ti_machdep.c b/sys/arm/ti/ti_machdep.c index 0f32ae1..696bf61 100644 --- a/sys/arm/ti/ti_machdep.c +++ b/sys/arm/ti/ti_machdep.c @@ -44,12 +44,12 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <vm/pmap.h> #include <machine/bus.h> -#include <machine/devmap.h> #include <machine/machdep.h> #include <machine/platformvar.h> @@ -63,7 +63,7 @@ static vm_offset_t ti_lastaddr(platform_t plat) { - return (arm_devmap_lastaddr()); + return (devmap_lastaddr()); } /* @@ -74,8 +74,8 @@ ti_lastaddr(platform_t plat) static int ti_omap4_devmap_init(platform_t plat) { - arm_devmap_add_entry(0x48000000, 0x01000000); /*16mb L4_PER devices */ - arm_devmap_add_entry(0x4A000000, 0x01000000); /*16mb L4_CFG devices */ + devmap_add_entry(0x48000000, 0x01000000); /*16mb L4_PER devices */ + devmap_add_entry(0x4A000000, 0x01000000); /*16mb L4_CFG devices */ return (0); } #endif @@ -85,13 +85,13 @@ static int ti_am335x_devmap_init(platform_t plat) { - arm_devmap_add_entry(0x44C00000, 0x00400000); /* 4mb L4_WKUP devices*/ - arm_devmap_add_entry(0x47400000, 0x00100000); /* 1mb USB */ - arm_devmap_add_entry(0x47800000, 0x00100000); /* 1mb mmchs2 */ - arm_devmap_add_entry(0x48000000, 0x01000000); /*16mb L4_PER devices */ - arm_devmap_add_entry(0x49000000, 0x00100000); /* 1mb edma3 */ - arm_devmap_add_entry(0x49800000, 0x00300000); /* 3mb edma3 */ - arm_devmap_add_entry(0x4A000000, 0x01000000); /*16mb L4_FAST devices*/ + devmap_add_entry(0x44C00000, 0x00400000); /* 4mb L4_WKUP devices*/ + devmap_add_entry(0x47400000, 0x00100000); /* 1mb USB */ + devmap_add_entry(0x47800000, 0x00100000); /* 1mb mmchs2 */ + devmap_add_entry(0x48000000, 0x01000000); /*16mb L4_PER devices */ + devmap_add_entry(0x49000000, 0x00100000); /* 1mb edma3 */ + devmap_add_entry(0x49800000, 0x00300000); /* 3mb edma3 */ + devmap_add_entry(0x4A000000, 0x01000000); /*16mb L4_FAST devices*/ return (0); } #endif diff --git a/sys/arm/versatile/versatile_machdep.c b/sys/arm/versatile/versatile_machdep.c index abc1ebc..adaff7a 100644 --- a/sys/arm/versatile/versatile_machdep.c +++ b/sys/arm/versatile/versatile_machdep.c @@ -43,12 +43,12 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <vm/pmap.h> #include <machine/bus.h> -#include <machine/devmap.h> #include <machine/machdep.h> #include <machine/platform.h> @@ -81,7 +81,7 @@ platform_late_init(void) } #define FDT_DEVMAP_MAX (2) /* FIXME */ -static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = { +static struct devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = { { 0, 0, 0, }, { 0, 0, 0, } }; @@ -98,7 +98,7 @@ platform_devmap_init(void) fdt_devmap[i].pd_pa = 0x10100000; fdt_devmap[i].pd_size = 0x01000000; /* 1 MB */ - arm_devmap_register_table(&fdt_devmap[0]); + devmap_register_table(&fdt_devmap[0]); return (0); } diff --git a/sys/arm/xilinx/zy7_machdep.c b/sys/arm/xilinx/zy7_machdep.c index dd179b7..4776878 100644 --- a/sys/arm/xilinx/zy7_machdep.c +++ b/sys/arm/xilinx/zy7_machdep.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <vm/pmap.h> @@ -47,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include <dev/fdt/fdt_common.h> #include <machine/bus.h> -#include <machine/devmap.h> #include <machine/machdep.h> #include <machine/platform.h> @@ -59,7 +59,7 @@ vm_offset_t platform_lastaddr(void) { - return (arm_devmap_lastaddr()); + return (devmap_lastaddr()); } void @@ -87,8 +87,8 @@ int platform_devmap_init(void) { - arm_devmap_add_entry(ZYNQ7_PSIO_HWBASE, ZYNQ7_PSIO_SIZE); - arm_devmap_add_entry(ZYNQ7_PSCTL_HWBASE, ZYNQ7_PSCTL_SIZE); + devmap_add_entry(ZYNQ7_PSIO_HWBASE, ZYNQ7_PSIO_SIZE); + devmap_add_entry(ZYNQ7_PSCTL_HWBASE, ZYNQ7_PSCTL_SIZE); return (0); } diff --git a/sys/arm/xscale/i8134x/crb_machdep.c b/sys/arm/xscale/i8134x/crb_machdep.c index 3ee31b5..5268ca9 100644 --- a/sys/arm/xscale/i8134x/crb_machdep.c +++ b/sys/arm/xscale/i8134x/crb_machdep.c @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); #include <sys/exec.h> #include <sys/kdb.h> #include <sys/msgbuf.h> +#include <sys/devmap.h> #include <machine/reg.h> #include <machine/cpu.h> @@ -80,7 +81,6 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_object.h> #include <vm/vm_page.h> #include <vm/vm_map.h> -#include <machine/devmap.h> #include <machine/vmparam.h> #include <machine/pcb.h> #include <machine/undefined.h> @@ -120,7 +120,7 @@ struct pv_addr abtstack; struct pv_addr kernelstack; /* Static device mappings. */ -static const struct arm_devmap_entry iq81342_devmap[] = { +static const struct devmap_entry iq81342_devmap[] = { { IOP34X_VADDR, IOP34X_HWADDR, @@ -249,7 +249,7 @@ initarm(struct arm_boot_params *abp) /* Map the vector page. */ pmap_map_entry(l1pagetable, ARM_VECTORS_HIGH, systempage.pv_pa, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); - arm_devmap_bootstrap(l1pagetable, iq81342_devmap); + devmap_bootstrap(l1pagetable, iq81342_devmap); /* * Give the XScale global cache clean code an appropriately * sized chunk of unmapped VA space starting at 0xff000000 diff --git a/sys/arm/xscale/ixp425/avila_machdep.c b/sys/arm/xscale/ixp425/avila_machdep.c index 272b1a6..46e4b10 100644 --- a/sys/arm/xscale/ixp425/avila_machdep.c +++ b/sys/arm/xscale/ixp425/avila_machdep.c @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); #include <sys/exec.h> #include <sys/kdb.h> #include <sys/msgbuf.h> +#include <sys/devmap.h> #include <machine/physmem.h> #include <machine/reg.h> #include <machine/cpu.h> @@ -81,7 +82,6 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_object.h> #include <vm/vm_page.h> #include <vm/vm_map.h> -#include <machine/devmap.h> #include <machine/vmparam.h> #include <machine/pcb.h> #include <machine/undefined.h> @@ -117,7 +117,7 @@ struct pv_addr kernelstack; struct pv_addr minidataclean; /* Static device mappings. */ -static const struct arm_devmap_entry ixp425_devmap[] = { +static const struct devmap_entry ixp425_devmap[] = { /* Physical/Virtual address for I/O space */ { IXP425_IO_VBASE, IXP425_IO_HWBASE, IXP425_IO_SIZE, }, @@ -144,7 +144,7 @@ static const struct arm_devmap_entry ixp425_devmap[] = { }; /* Static device mappings. */ -static const struct arm_devmap_entry ixp435_devmap[] = { +static const struct devmap_entry ixp435_devmap[] = { /* Physical/Virtual address for I/O space */ { IXP425_IO_VBASE, IXP425_IO_HWBASE, IXP425_IO_SIZE, }, @@ -326,9 +326,9 @@ initarm(struct arm_boot_params *abp) pmap_map_entry(l1pagetable, ARM_VECTORS_HIGH, systempage.pv_pa, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); if (cpu_is_ixp43x()) - arm_devmap_bootstrap(l1pagetable, ixp435_devmap); + devmap_bootstrap(l1pagetable, ixp435_devmap); else - arm_devmap_bootstrap(l1pagetable, ixp425_devmap); + devmap_bootstrap(l1pagetable, ixp425_devmap); /* * Give the XScale global cache clean code an appropriately * sized chunk of unmapped VA space starting at 0xff000000 diff --git a/sys/arm/xscale/pxa/pxa_machdep.c b/sys/arm/xscale/pxa/pxa_machdep.c index d80da1f..32cbcd8 100644 --- a/sys/arm/xscale/pxa/pxa_machdep.c +++ b/sys/arm/xscale/pxa/pxa_machdep.c @@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$"); #include <sys/exec.h> #include <sys/kdb.h> #include <sys/msgbuf.h> +#include <sys/devmap.h> #include <machine/reg.h> #include <machine/cpu.h> @@ -81,7 +82,6 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_object.h> #include <vm/vm_page.h> #include <vm/vm_map.h> -#include <machine/devmap.h> #include <machine/vmparam.h> #include <machine/pcb.h> #include <machine/undefined.h> @@ -120,7 +120,7 @@ static void pxa_probe_sdram(bus_space_tag_t, bus_space_handle_t, uint32_t *, uint32_t *); /* Static device mappings. */ -static const struct arm_devmap_entry pxa_devmap[] = { +static const struct devmap_entry pxa_devmap[] = { /* * Map the on-board devices up into the KVA region so we don't muck * up user-space. @@ -254,7 +254,7 @@ initarm(struct arm_boot_params *abp) /* Map the vector page. */ pmap_map_entry(l1pagetable, ARM_VECTORS_HIGH, systempage.pv_pa, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); - arm_devmap_bootstrap(l1pagetable, pxa_devmap); + devmap_bootstrap(l1pagetable, pxa_devmap); /* * Give the XScale global cache clean code an appropriately diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 2bf108f..9d4cfb1 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include <sys/bus.h> #include <sys/cons.h> #include <sys/cpu.h> +#include <sys/devmap.h> #include <sys/efi.h> #include <sys/exec.h> #include <sys/imgact.h> @@ -70,7 +71,6 @@ __FBSDID("$FreeBSD$"); #include <machine/cpu.h> #include <machine/debug_monitor.h> #include <machine/kdb.h> -#include <machine/devmap.h> #include <machine/machdep.h> #include <machine/metadata.h> #include <machine/md_var.h> @@ -912,7 +912,7 @@ initarm(struct arm64_bootparams *abp) pmap_bootstrap(abp->kern_l0pt, abp->kern_l1pt, KERNBASE - abp->kern_delta, lastaddr - KERNBASE); - arm_devmap_bootstrap(0, NULL); + devmap_bootstrap(0, NULL); cninit(); diff --git a/sys/arm64/include/devmap.h b/sys/arm64/include/devmap.h deleted file mode 100644 index 4184f8b..0000000 --- a/sys/arm64/include/devmap.h +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * Copyright (c) 2013 Ian Lepore <ian@freebsd.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_DEVMAP_H_ -#define _MACHINE_DEVMAP_H_ - -/* - * This structure is used by MD code to describe static mappings of devices - * which are established as part of bringing up the MMU early in the boot. - */ -struct arm_devmap_entry { - vm_offset_t pd_va; /* virtual address */ - vm_paddr_t pd_pa; /* physical address */ - vm_size_t pd_size; /* size of region */ -}; - -/* - * Return the lowest KVA address used in any entry in the registered devmap - * table. This works with whatever table is registered, including the internal - * table used by arm_devmap_add_entry() if that routine was used. Platforms can - * implement initarm_lastaddr() by calling this if static device mappings are - * their only use of high KVA space. - */ -vm_offset_t arm_devmap_lastaddr(void); - -/* - * Automatically allocate KVA (from the top of the address space downwards) and - * make static device mapping entries in an internal table. The internal table - * is automatically registered on the first call to this. - */ -void arm_devmap_add_entry(vm_paddr_t pa, vm_size_t sz); - -/* - * Register a platform-local table to be bootstrapped by the generic - * initarm() in arm/machdep.c. This is used by newer code that allocates and - * fills in its own local table but does not have its own initarm() routine. - */ -void arm_devmap_register_table(const struct arm_devmap_entry * _table); - -/* - * Establish mappings for all the entries in the table. This is called - * automatically from the common initarm() in arm/machdep.c, and also from the - * custom initarm() routines in older code. If the table pointer is NULL, this - * will use the table installed previously by arm_devmap_register_table(). - */ -void arm_devmap_bootstrap(vm_offset_t _l1pt, - const struct arm_devmap_entry *_table); - -/* - * Translate between virtual and physical addresses within a region that is - * static-mapped by the devmap code. If the given address range isn't - * static-mapped, then ptov returns NULL and vtop returns DEVMAP_PADDR_NOTFOUND. - * The latter implies that you can't vtop just the last byte of physical address - * space. This is not as limiting as it might sound, because even if a device - * occupies the end of the physical address space, you're only prevented from - * doing vtop for that single byte. If you vtop a size bigger than 1 it works. - */ -#define DEVMAP_PADDR_NOTFOUND ((vm_paddr_t)(-1)) - -void * arm_devmap_ptov(vm_paddr_t _pa, vm_size_t _sz); -vm_paddr_t arm_devmap_vtop(void * _va, vm_size_t _sz); - -/* Print the static mapping table; used for bootverbose output. */ -void arm_devmap_print_table(void); - -#endif diff --git a/sys/arm64/include/vmparam.h b/sys/arm64/include/vmparam.h index 3d46ece..6dccf51 100644 --- a/sys/arm64/include/vmparam.h +++ b/sys/arm64/include/vmparam.h @@ -247,4 +247,6 @@ extern vm_offset_t init_pt_va; #define ZERO_REGION_SIZE (64 * 1024) /* 64KB */ +#define DEVMAP_MAX_VADDR VM_MAX_KERNEL_ADDRESS + #endif /* !_MACHINE_VMPARAM_H_ */ diff --git a/sys/conf/files.arm b/sys/conf/files.arm index b77d1fc..8a27888 100644 --- a/sys/conf/files.arm +++ b/sys/conf/files.arm @@ -29,7 +29,6 @@ arm/arm/db_disasm.c optional ddb arm/arm/db_interface.c optional ddb arm/arm/db_trace.c optional ddb arm/arm/debug_monitor.c optional ddb armv6 -arm/arm/devmap.c standard arm/arm/disassem.c optional ddb arm/arm/dump_machdep.c standard arm/arm/elf_machdep.c standard @@ -117,6 +116,7 @@ font.h optional sc \ clean "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8" kern/pic_if.m optional intrng kern/subr_busdma_bufalloc.c standard +kern/subr_devmap.c standard kern/subr_sfbuf.c standard libkern/arm/aeabi_unwind.c standard libkern/arm/divsi3.S standard diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 7bbe458..b398ff2 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -1,5 +1,4 @@ # $FreeBSD$ -arm/arm/devmap.c standard arm/arm/generic_timer.c standard arm/arm/pmu.c standard arm64/acpica/acpi_machdep.c optional acpi @@ -84,6 +83,7 @@ dev/vnic/thunder_mdio_fdt.c optional vnic fdt dev/vnic/thunder_mdio.c optional vnic dev/vnic/lmac_if.m optional vnic kern/kern_clocksource.c standard +kern/subr_devmap.c standard libkern/bcmp.c standard libkern/ffs.c standard libkern/ffsl.c standard diff --git a/sys/conf/files.riscv b/sys/conf/files.riscv index 7b1a040..83bea75 100644 --- a/sys/conf/files.riscv +++ b/sys/conf/files.riscv @@ -3,6 +3,7 @@ crypto/blowfish/bf_enc.c optional crypto | ipsec crypto/des/des_enc.c optional crypto | ipsec | netsmb dev/ofw/ofw_cpu.c optional fdt kern/kern_clocksource.c standard +kern/subr_devmap.c standard kern/subr_dummy_vdso_tc.c standard libkern/bcmp.c standard libkern/ffs.c standard @@ -26,7 +27,6 @@ riscv/riscv/cpufunc_asm.S standard riscv/riscv/db_disasm.c optional ddb riscv/riscv/db_interface.c optional ddb riscv/riscv/db_trace.c optional ddb -riscv/riscv/devmap.c standard riscv/riscv/dump_machdep.c standard riscv/riscv/elf_machdep.c standard riscv/riscv/intr_machdep.c standard diff --git a/sys/arm/arm/devmap.c b/sys/kern/subr_devmap.c index b5b315d..4849f40 100644 --- a/sys/arm/arm/devmap.c +++ b/sys/kern/subr_devmap.c @@ -27,45 +27,34 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -/* - * Routines for mapping device memory. - * - * This is used on both arm and arm64. - */ +/* Routines for mapping device memory. */ #include "opt_ddb.h" #include <sys/param.h> #include <sys/systm.h> +#include <sys/devmap.h> #include <vm/vm.h> #include <vm/vm_extern.h> #include <vm/pmap.h> #ifdef __arm__ #include <machine/acle-compat.h> #endif -#include <machine/armreg.h> -#include <machine/devmap.h> #include <machine/vmparam.h> -static const struct arm_devmap_entry *devmap_table; +static const struct devmap_entry *devmap_table; static boolean_t devmap_bootstrap_done = false; -#if defined(__aarch64__) -#define MAX_VADDR VM_MAX_KERNEL_ADDRESS -#elif defined(__arm__) -#define MAX_VADDR ARM_VECTORS_HIGH -#endif - /* * The allocated-kva (akva) devmap table and metadata. Platforms can call - * arm_devmap_add_entry() to add static device mappings to this table using + * devmap_add_entry() to add static device mappings to this table using * automatically allocated virtual addresses carved out of the top of kva space. * Allocation begins immediately below the ARM_VECTORS_HIGH address. */ #define AKVA_DEVMAP_MAX_ENTRIES 32 -static struct arm_devmap_entry akva_devmap_entries[AKVA_DEVMAP_MAX_ENTRIES]; +static struct devmap_entry akva_devmap_entries[AKVA_DEVMAP_MAX_ENTRIES]; static u_int akva_devmap_idx; -static vm_offset_t akva_devmap_vaddr = MAX_VADDR; +static vm_offset_t akva_devmap_vaddr = DEVMAP_MAX_VADDR; #ifdef __aarch64__ extern int early_boot; @@ -78,7 +67,7 @@ extern int early_boot; static void devmap_dump_table(int (*prfunc)(const char *, ...)) { - const struct arm_devmap_entry *pd; + const struct devmap_entry *pd; if (devmap_table == NULL || devmap_table[0].pd_size == 0) { prfunc("No static device mappings.\n"); @@ -96,7 +85,7 @@ devmap_dump_table(int (*prfunc)(const char *, ...)) * Print the contents of the static mapping table. Used for bootverbose. */ void -arm_devmap_print_table() +devmap_print_table() { devmap_dump_table(printf); } @@ -107,15 +96,15 @@ arm_devmap_print_table() * the first unusable byte of KVA. */ vm_offset_t -arm_devmap_lastaddr() +devmap_lastaddr() { - const struct arm_devmap_entry *pd; + const struct devmap_entry *pd; vm_offset_t lowaddr; if (akva_devmap_idx > 0) return (akva_devmap_vaddr); - lowaddr = MAX_VADDR; + lowaddr = DEVMAP_MAX_VADDR; for (pd = devmap_table; pd != NULL && pd->pd_size != 0; ++pd) { if (lowaddr > pd->pd_va) lowaddr = pd->pd_va; @@ -129,22 +118,22 @@ arm_devmap_lastaddr() * physical address and size and a virtual address allocated from the top of * kva. This automatically registers the akva table on the first call, so all a * platform has to do is call this routine to install as many mappings as it - * needs and when initarm() calls arm_devmap_bootstrap() it will pick up all the + * needs and when initarm() calls devmap_bootstrap() it will pick up all the * entries in the akva table automatically. */ void -arm_devmap_add_entry(vm_paddr_t pa, vm_size_t sz) +devmap_add_entry(vm_paddr_t pa, vm_size_t sz) { - struct arm_devmap_entry *m; + struct devmap_entry *m; if (devmap_bootstrap_done) - panic("arm_devmap_add_entry() after arm_devmap_bootstrap()"); + panic("devmap_add_entry() after devmap_bootstrap()"); if (akva_devmap_idx == (AKVA_DEVMAP_MAX_ENTRIES - 1)) panic("AKVA_DEVMAP_MAX_ENTRIES is too small"); if (akva_devmap_idx == 0) - arm_devmap_register_table(akva_devmap_entries); + devmap_register_table(akva_devmap_entries); /* * Allocate virtual address space from the top of kva downwards. If the @@ -167,10 +156,10 @@ arm_devmap_add_entry(vm_paddr_t pa, vm_size_t sz) } /* - * Register the given table as the one to use in arm_devmap_bootstrap(). + * Register the given table as the one to use in devmap_bootstrap(). */ void -arm_devmap_register_table(const struct arm_devmap_entry *table) +devmap_register_table(const struct devmap_entry *table) { devmap_table = table; @@ -183,13 +172,13 @@ arm_devmap_register_table(const struct arm_devmap_entry *table) * If a non-NULL table pointer is given it is used unconditionally, otherwise * the previously-registered table is used. This smooths transition from legacy * code that fills in a local table then calls this function passing that table, - * and newer code that uses arm_devmap_register_table() in platform-specific + * and newer code that uses devmap_register_table() in platform-specific * code, then lets the common initarm() call this function with a NULL pointer. */ void -arm_devmap_bootstrap(vm_offset_t l1pt, const struct arm_devmap_entry *table) +devmap_bootstrap(vm_offset_t l1pt, const struct devmap_entry *table) { - const struct arm_devmap_entry *pd; + const struct devmap_entry *pd; devmap_bootstrap_done = true; @@ -222,9 +211,9 @@ arm_devmap_bootstrap(vm_offset_t l1pt, const struct arm_devmap_entry *table) * corresponding virtual address, or NULL if not found. */ void * -arm_devmap_ptov(vm_paddr_t pa, vm_size_t size) +devmap_ptov(vm_paddr_t pa, vm_size_t size) { - const struct arm_devmap_entry *pd; + const struct devmap_entry *pd; if (devmap_table == NULL) return (NULL); @@ -242,9 +231,9 @@ arm_devmap_ptov(vm_paddr_t pa, vm_size_t size) * corresponding physical address, or DEVMAP_PADDR_NOTFOUND if not found. */ vm_paddr_t -arm_devmap_vtop(void * vpva, vm_size_t size) +devmap_vtop(void * vpva, vm_size_t size) { - const struct arm_devmap_entry *pd; + const struct devmap_entry *pd; vm_offset_t va; if (devmap_table == NULL) @@ -277,7 +266,7 @@ pmap_mapdev(vm_offset_t pa, vm_size_t size) void * rva; /* First look in the static mapping table. */ - if ((rva = arm_devmap_ptov(pa, size)) != NULL) + if ((rva = devmap_ptov(pa, size)) != NULL) return (rva); offset = pa & PAGE_MASK; @@ -310,7 +299,7 @@ pmap_unmapdev(vm_offset_t va, vm_size_t size) vm_offset_t offset; /* Nothing to do if we find the mapping in the static table. */ - if (arm_devmap_vtop((void*)va, size) != DEVMAP_PADDR_NOTFOUND) + if (devmap_vtop((void*)va, size) != DEVMAP_PADDR_NOTFOUND) return; offset = va & PAGE_MASK; diff --git a/sys/riscv/include/vmparam.h b/sys/riscv/include/vmparam.h index 04803bb..a2166c8 100644 --- a/sys/riscv/include/vmparam.h +++ b/sys/riscv/include/vmparam.h @@ -239,4 +239,6 @@ extern vm_offset_t init_pt_va; #define ZERO_REGION_SIZE (64 * 1024) /* 64KB */ +#define DEVMAP_MAX_VADDR VM_MAX_KERNEL_ADDRESS + #endif /* !_MACHINE_VMPARAM_H_ */ diff --git a/sys/riscv/riscv/devmap.c b/sys/riscv/riscv/devmap.c deleted file mode 100644 index 092532a..0000000 --- a/sys/riscv/riscv/devmap.c +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com> - * All rights reserved. - * - * Portions of this software were developed by SRI International and the - * University of Cambridge Computer Laboratory under DARPA/AFRL contract - * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme. - * - * Portions of this software were developed by the University of Cambridge - * Computer Laboratory as part of the CTSRD Project, with support from the - * UK Higher Education Innovation Fund (HEIF). - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -/* RISC-V doesn't provide memory-mapped devices yet */ - -#include "opt_ddb.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <vm/vm.h> -#include <vm/vm_extern.h> -#include <vm/pmap.h> -#include <machine/riscvreg.h> -#include <machine/vmparam.h> - -void * -pmap_mapdev(vm_offset_t pa, vm_size_t size) -{ - - return (NULL); -} - -void -pmap_unmapdev(vm_offset_t va, vm_size_t size) -{ - -} diff --git a/sys/arm/include/devmap.h b/sys/sys/devmap.h index d05c781..8380b67 100644 --- a/sys/arm/include/devmap.h +++ b/sys/sys/devmap.h @@ -26,14 +26,18 @@ * $FreeBSD$ */ -#ifndef _MACHINE_DEVMAP_H_ -#define _MACHINE_DEVMAP_H_ +#ifndef _SYS_DEVMAP_H_ +#define _SYS_DEVMAP_H_ + +#ifndef _KERNEL +#error "no user-servicable parts inside" +#endif /* * This structure is used by MD code to describe static mappings of devices * which are established as part of bringing up the MMU early in the boot. */ -struct arm_devmap_entry { +struct devmap_entry { vm_offset_t pd_va; /* virtual address */ vm_paddr_t pd_pa; /* physical address */ vm_size_t pd_size; /* size of region */ @@ -42,34 +46,34 @@ struct arm_devmap_entry { /* * Return the lowest KVA address used in any entry in the registered devmap * table. This works with whatever table is registered, including the internal - * table used by arm_devmap_add_entry() if that routine was used. Platforms can + * table used by devmap_add_entry() if that routine was used. Platforms can * implement platform_lastaddr() by calling this if static device mappings are * their only use of high KVA space. */ -vm_offset_t arm_devmap_lastaddr(void); +vm_offset_t devmap_lastaddr(void); /* * Automatically allocate KVA (from the top of the address space downwards) and * make static device mapping entries in an internal table. The internal table * is automatically registered on the first call to this. */ -void arm_devmap_add_entry(vm_paddr_t pa, vm_size_t sz); +void devmap_add_entry(vm_paddr_t pa, vm_size_t sz); /* * Register a platform-local table to be bootstrapped by the generic * initarm() in arm/machdep.c. This is used by newer code that allocates and * fills in its own local table but does not have its own initarm() routine. */ -void arm_devmap_register_table(const struct arm_devmap_entry * _table); +void devmap_register_table(const struct devmap_entry * _table); /* * Establish mappings for all the entries in the table. This is called * automatically from the common initarm() in arm/machdep.c, and also from the * custom initarm() routines in older code. If the table pointer is NULL, this - * will use the table installed previously by arm_devmap_register_table(). + * will use the table installed previously by devmap_register_table(). */ -void arm_devmap_bootstrap(vm_offset_t _l1pt, - const struct arm_devmap_entry *_table); +void devmap_bootstrap(vm_offset_t _l1pt, + const struct devmap_entry *_table); /* * Translate between virtual and physical addresses within a region that is @@ -82,10 +86,10 @@ void arm_devmap_bootstrap(vm_offset_t _l1pt, */ #define DEVMAP_PADDR_NOTFOUND ((vm_paddr_t)(-1)) -void * arm_devmap_ptov(vm_paddr_t _pa, vm_size_t _sz); -vm_paddr_t arm_devmap_vtop(void * _va, vm_size_t _sz); +void * devmap_ptov(vm_paddr_t _pa, vm_size_t _sz); +vm_paddr_t devmap_vtop(void * _va, vm_size_t _sz); /* Print the static mapping table; used for bootverbose output. */ -void arm_devmap_print_table(void); +void devmap_print_table(void); -#endif +#endif /* !_SYS_DEVMAP_H_ */ |