Call initarm_lastaddr() later in the init sequence, after establishing
static device mappings, rather than as the first of the initializations that a platform can hook into. This allows a platform to allocate KVA from the top of the address space downwards for things like static device mapping, and return the final "last usable address" result after that and other early init work is done. Because some platforms were doing work in initarm_lastaddr() that needs to be done early, add a new initarm_early_init() routine and move the early init code to that routine on those platforms. Rename platform_devmap_init() to initarm_devmap_init() to match all the other init routines called from initarm() that are designed to be implemented by platform code. Add a comment block that explains when these routines are called and the type of work expected to be done in each of them.
This commit is contained in:
parent
cecc016791
commit
515cbe8673
@ -61,6 +61,12 @@ initarm_lastaddr(void)
|
||||
return (DEVMAP_BOOTSTRAP_MAP_START);
|
||||
}
|
||||
|
||||
void
|
||||
initarm_early_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
initarm_gpio_init(void)
|
||||
{
|
||||
@ -80,7 +86,7 @@ static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = {
|
||||
* Construct pmap_devmap[] with DT-derived config data.
|
||||
*/
|
||||
int
|
||||
platform_devmap_init(void)
|
||||
initarm_devmap_init(void)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
|
@ -1303,7 +1303,7 @@ initarm(struct arm_boot_params *abp)
|
||||
availmem_regions_sz = curr;
|
||||
|
||||
/* Platform-specific initialisation */
|
||||
vm_max_kernel_address = initarm_lastaddr();
|
||||
initarm_early_init();
|
||||
|
||||
pcpu0_init();
|
||||
|
||||
@ -1419,9 +1419,10 @@ initarm(struct arm_boot_params *abp)
|
||||
pmap_map_entry(l1pagetable, ARM_VECTORS_HIGH, systempage.pv_pa,
|
||||
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE, PTE_CACHE);
|
||||
|
||||
/* Map pmap_devmap[] entries */
|
||||
err_devmap = platform_devmap_init();
|
||||
/* Establish static device mappings. */
|
||||
err_devmap = initarm_devmap_init();
|
||||
arm_devmap_bootstrap(l1pagetable, NULL);
|
||||
vm_max_kernel_address = initarm_lastaddr();
|
||||
|
||||
cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL * 2)) | DOMAIN_CLIENT);
|
||||
pmap_pa = kernel_l1pt.pv_pa;
|
||||
|
@ -69,6 +69,12 @@ initarm_lastaddr(void)
|
||||
return (DEVMAP_BOOTSTRAP_MAP_START);
|
||||
}
|
||||
|
||||
void
|
||||
initarm_early_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
initarm_gpio_init(void)
|
||||
{
|
||||
@ -103,7 +109,7 @@ static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = {
|
||||
* Construct pmap_devmap[] with DT-derived config data.
|
||||
*/
|
||||
int
|
||||
platform_devmap_init(void)
|
||||
initarm_devmap_init(void)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
|
@ -88,31 +88,24 @@ vm_offset_t
|
||||
initarm_lastaddr(void)
|
||||
{
|
||||
|
||||
/* XXX - Get rid of this stuff soon. */
|
||||
boothowto |= RB_VERBOSE|RB_MULTIPLE;
|
||||
bootverbose = 1;
|
||||
|
||||
/*
|
||||
* Normally initarm() calls platform_devmap_init() much later in the
|
||||
* init process to set up static device mappings. To calculate the
|
||||
* highest available kva address we have to do that setup first. It
|
||||
* maps downwards from ARM_VECTORS_HIGH and the last usable kva address
|
||||
* is the point right before the virtual address of the first static
|
||||
* mapping. So go set up the static mapping table now, then we can
|
||||
* return the lowest static devmap vaddr as the end of usable kva.
|
||||
*/
|
||||
imx_devmap_init();
|
||||
|
||||
arm_devmap_register_table(devmap_entries);
|
||||
|
||||
return (devmap_vaddr);
|
||||
}
|
||||
|
||||
int
|
||||
platform_devmap_init(void)
|
||||
void
|
||||
initarm_early_init(void)
|
||||
{
|
||||
|
||||
/* On imx this work is done during initarm_lastaddr(). */
|
||||
/* XXX - Get rid of this stuff soon. */
|
||||
boothowto |= RB_VERBOSE|RB_MULTIPLE;
|
||||
bootverbose = 1;
|
||||
}
|
||||
|
||||
int
|
||||
initarm_devmap_init(void)
|
||||
{
|
||||
|
||||
imx_devmap_init();
|
||||
arm_devmap_register_table(devmap_entries);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -33,11 +33,39 @@ vm_offset_t linux_parse_boot_param(struct arm_boot_params *abp);
|
||||
vm_offset_t fake_preload_metadata(struct arm_boot_params *abp);
|
||||
vm_offset_t parse_boot_param(struct arm_boot_params *abp);
|
||||
|
||||
/* Called by initarm */
|
||||
/*
|
||||
* Initialization functions called by the common initarm() function in
|
||||
* arm/machdep.c (but not necessarily from the custom initarm() functions of
|
||||
* older code).
|
||||
*
|
||||
* - initarm_early_init() is called very early, after parsing the boot params
|
||||
* and after physical memory has been located and sized.
|
||||
*
|
||||
* - platform_devmap_init() is called as one of the last steps of early virtual
|
||||
* memory initialization, shortly before the new page tables are installed.
|
||||
*
|
||||
* - initarm_lastaddr() is called after platform_devmap_init(), and must return
|
||||
* the address of the first byte of unusable KVA space. This allows a
|
||||
* platform to carve out of the top of the KVA space whatever reserves it
|
||||
* needs for things like static device mapping, and this is called to get the
|
||||
* value before calling pmap_bootstrap() which uses the value to size the
|
||||
* available KVA.
|
||||
*
|
||||
* - initarm_gpio_init() is called after the static device mappings are
|
||||
* established and just before cninit(). The intention is that the routine
|
||||
* can do any hardware setup (such as gpio or pinmux) necessary to make the
|
||||
* console functional.
|
||||
*
|
||||
* - initarm_late_init() is called just after cninit(). This is the first of
|
||||
* the init routines that can use printf() and expect the output to appear on
|
||||
* a standard console.
|
||||
*
|
||||
*/
|
||||
void initarm_early_init(void);
|
||||
int initarm_devmap_init(void);
|
||||
vm_offset_t initarm_lastaddr(void);
|
||||
void initarm_gpio_init(void);
|
||||
void initarm_late_init(void);
|
||||
int platform_devmap_init(void);
|
||||
|
||||
/* Board-specific attributes */
|
||||
void board_set_serial(uint64_t);
|
||||
|
@ -61,13 +61,17 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
vm_offset_t
|
||||
initarm_lastaddr(void)
|
||||
{
|
||||
|
||||
return (fdt_immr_va);
|
||||
}
|
||||
|
||||
void
|
||||
initarm_early_init(void)
|
||||
{
|
||||
|
||||
if (fdt_immr_addr(LPC_DEV_BASE) != 0)
|
||||
while (1);
|
||||
|
||||
/* Platform-specific initialisation */
|
||||
return (fdt_immr_va);
|
||||
}
|
||||
|
||||
void
|
||||
@ -94,7 +98,7 @@ static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = {
|
||||
* Construct pmap_devmap[] with DT-derived config data.
|
||||
*/
|
||||
int
|
||||
platform_devmap_init(void)
|
||||
initarm_devmap_init(void)
|
||||
{
|
||||
|
||||
/*
|
||||
|
@ -201,13 +201,17 @@ platform_mpp_init(void)
|
||||
|
||||
vm_offset_t
|
||||
initarm_lastaddr(void)
|
||||
{
|
||||
|
||||
return (fdt_immr_va);
|
||||
}
|
||||
|
||||
void
|
||||
initarm_early_init(void)
|
||||
{
|
||||
|
||||
if (fdt_immr_addr(MV_BASE) != 0)
|
||||
while (1);
|
||||
|
||||
/* Platform-specific initialisation */
|
||||
return (fdt_immr_va);
|
||||
}
|
||||
|
||||
void
|
||||
@ -316,7 +320,7 @@ __weak_reference(mv_default_fdt_pci_devmap, fdt_pci_devmap);
|
||||
* Construct pmap_devmap[] with DT-derived config data.
|
||||
*/
|
||||
int
|
||||
platform_devmap_init(void)
|
||||
initarm_devmap_init(void)
|
||||
{
|
||||
phandle_t root, child;
|
||||
pcell_t bank_count;
|
||||
|
@ -59,6 +59,12 @@ initarm_lastaddr(void)
|
||||
return (DEVMAP_BOOTSTRAP_MAP_START);
|
||||
}
|
||||
|
||||
void
|
||||
initarm_early_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
initarm_gpio_init(void)
|
||||
{
|
||||
@ -82,7 +88,7 @@ static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = {
|
||||
* Construct pmap_devmap[] with DT-derived config data.
|
||||
*/
|
||||
int
|
||||
platform_devmap_init(void)
|
||||
initarm_devmap_init(void)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
|
@ -53,6 +53,12 @@ initarm_lastaddr(void)
|
||||
return (DEVMAP_BOOTSTRAP_MAP_START);
|
||||
}
|
||||
|
||||
void
|
||||
initarm_early_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
initarm_gpio_init(void)
|
||||
{
|
||||
@ -72,7 +78,7 @@ static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = {
|
||||
* Construct pmap_devmap[] with DT-derived config data.
|
||||
*/
|
||||
int
|
||||
platform_devmap_init(void)
|
||||
initarm_devmap_init(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -105,12 +105,17 @@ tegra2_osc_freq_detect(void)
|
||||
|
||||
vm_offset_t
|
||||
initarm_lastaddr(void)
|
||||
{
|
||||
|
||||
return (fdt_immr_va);
|
||||
}
|
||||
|
||||
void
|
||||
initarm_early_init(void)
|
||||
{
|
||||
|
||||
if (fdt_immr_addr(TEGRA2_BASE) != 0) /* FIXME ???? */
|
||||
while (1);
|
||||
|
||||
return (fdt_immr_va);
|
||||
}
|
||||
|
||||
void
|
||||
@ -132,7 +137,7 @@ static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = {
|
||||
* Construct pmap_devmap[] with DT-derived config data.
|
||||
*/
|
||||
int
|
||||
platform_devmap_init(void)
|
||||
initarm_devmap_init(void)
|
||||
{
|
||||
int i = 0;
|
||||
fdt_devmap[i].pd_va = 0xe0000000;
|
||||
|
@ -63,10 +63,16 @@ vm_offset_t
|
||||
initarm_lastaddr(void)
|
||||
{
|
||||
|
||||
ti_cpu_reset = NULL;
|
||||
return (DEVMAP_BOOTSTRAP_MAP_START);
|
||||
}
|
||||
|
||||
void
|
||||
initarm_early_init(void)
|
||||
{
|
||||
|
||||
ti_cpu_reset = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
initarm_gpio_init(void)
|
||||
{
|
||||
@ -87,7 +93,7 @@ static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = {
|
||||
* Construct pmap_devmap[] with DT-derived config data.
|
||||
*/
|
||||
int
|
||||
platform_devmap_init(void)
|
||||
initarm_devmap_init(void)
|
||||
{
|
||||
int i = 0;
|
||||
#if defined(SOC_OMAP4)
|
||||
|
@ -64,6 +64,12 @@ initarm_lastaddr(void)
|
||||
return (DEVMAP_BOOTSTRAP_MAP_START);
|
||||
}
|
||||
|
||||
void
|
||||
initarm_early_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
initarm_gpio_init(void)
|
||||
{
|
||||
@ -85,7 +91,7 @@ static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = {
|
||||
* Construct pmap_devmap[] with DT-derived config data.
|
||||
*/
|
||||
int
|
||||
platform_devmap_init(void)
|
||||
initarm_devmap_init(void)
|
||||
{
|
||||
int i = 0;
|
||||
fdt_devmap[i].pd_va = 0xf0100000;
|
||||
|
@ -63,6 +63,12 @@ initarm_lastaddr(void)
|
||||
return (ZYNQ7_PSIO_VBASE);
|
||||
}
|
||||
|
||||
void
|
||||
initarm_early_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
initarm_gpio_init(void)
|
||||
{
|
||||
@ -80,7 +86,7 @@ static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_SIZE];
|
||||
* Construct pmap_devmap[] with DT-derived config data.
|
||||
*/
|
||||
int
|
||||
platform_devmap_init(void)
|
||||
initarm_devmap_init(void)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user