ARM: remove initrd handling from mmu code

Let the platform mmu_map_physical_memory the initrd region, and
reserve it before calling mmu_init. This removes another hardcoded
address, since e.g. U-Boot gets the address from the uImage file.
This commit is contained in:
Ithamar R. Adema 2014-09-06 22:25:31 +02:00
parent 0a163b65c7
commit e3020a5039
4 changed files with 20 additions and 15 deletions

View File

@ -61,8 +61,7 @@ HAIKU_BOARD_SDIMAGE_FILES =
#
# gcc flags for the specific cpu
local flags = -mcpu=cortex-a8 -mfpu=vfpv3 -mfloat-abi=hard
-DHAIKU_BOARD_LOADER_UIBASE=$(HAIKU_BOARD_LOADER_UIBASE) ;
local flags = -mcpu=cortex-a8 -mfpu=vfpv3 -mfloat-abi=hard ;
HAIKU_ASFLAGS_$(HAIKU_PACKAGING_ARCH) += $(flags) ;
HAIKU_CCFLAGS_$(HAIKU_PACKAGING_ARCH) += $(flags) ;

View File

@ -110,12 +110,6 @@ static struct memblock LOADER_MEMORYMAP[] = {
kLoaderBaseAddress + 0x11FFFFF,
ARM_MMU_L2_FLAG_C,
},
{
"RAM_initrd", // initrd
HAIKU_BOARD_LOADER_UIBASE,
HAIKU_BOARD_LOADER_UIBASE + 0x500000,
ARM_MMU_L2_FLAG_C,
},
#ifdef FB_BASE
{
@ -548,8 +542,10 @@ mmu_init_for_kernel(void)
TRACE(("mmu_init_for_kernel\n"));
// save the memory we've physically allocated
gKernelArgs.physical_allocated_range[0].size
= sNextPhysicalAddress - gKernelArgs.physical_allocated_range[0].start;
int index = gKernelArgs.num_physical_allocated_ranges;
gKernelArgs.physical_allocated_range[index].start = SDRAM_BASE;
gKernelArgs.physical_allocated_range[index].size = sNextPhysicalAddress - SDRAM_BASE;
gKernelArgs.num_physical_allocated_ranges++;
// Save the memory we've virtually allocated (for the kernel and other
// stuff)
@ -619,11 +615,6 @@ mmu_init(void)
gKernelArgs.physical_memory_range[0].size = highestRAMAddress - SDRAM_BASE;
gKernelArgs.num_physical_memory_ranges = 1;
gKernelArgs.physical_allocated_range[0].start = SDRAM_BASE;
gKernelArgs.physical_allocated_range[0].size = 0;
gKernelArgs.num_physical_allocated_ranges = 1;
// remember the start of the allocated physical pages
init_page_directory();
// map in a kernel stack

View File

@ -134,6 +134,9 @@ _start(void)
// Flick on "OK" led, use pre-mmu firmware base
gpio_write(gPeripheralBase + GPIO_BASE, 16, 0);
// Reserve memory for boot archive before switching on MMU
insert_physical_allocated_range(BOOT_ARCHIVE_BASE, BOOT_ARCHIVE_SIZE);
// To debug mmu, enable serial_init above me!
mmu_init();

View File

@ -267,8 +267,20 @@ start_raw(int argc, const char **argv)
dump_fdt(gFDT);
}
if (args.platform.boot_tgz_size > 0) {
insert_physical_allocated_range((addr_t)args.platform.boot_tgz_data,
args.platform.boot_tgz_size);
}
mmu_init();
// Handle our tarFS post-mmu
if (args.platform.boot_tgz_size > 0) {
args.platform.boot_tgz_data = (void*)mmu_map_physical_memory((addr_t)
args.platform.boot_tgz_data, args.platform.boot_tgz_size,
kDefaultPageFlags);
}
// wait a bit to give the user the opportunity to press a key
// spin(750000);