From 0f38ada123728ef6582697157ae87799678d4412 Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Fri, 24 Sep 2021 10:42:59 +0200 Subject: parisc: Fix boot priority and malloc initializations Make the malloc area initialization the first step after bootup. It's important, because the first mallocs otherwise ends up in lower memory area (PAGE0 from parisc) which will gets overwritten later. That change fixes the fw_cfg() interface as well. Before that change fw_cfg got initialized and zeroed-out shortly later in the boot process. And now the initialization of the boot structures succeeds too, so we can run boot_init() directly after setting up malloc and fw_cfg, and the bootindex parameter from qemu suddenly works out of the box. Signed-off-by: Helge Deller --- src/parisc/parisc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/parisc/parisc.c b/src/parisc/parisc.c index ac69904..2634b62 100644 --- a/src/parisc/parisc.c +++ b/src/parisc/parisc.c @@ -1778,10 +1778,16 @@ void __VISIBLE start_parisc_firmware(void) if (ram_size >= FIRMWARE_START) ram_size = FIRMWARE_START; + /* Initialize malloc stack */ + malloc_preinit(); + /* Initialize qemu fw_cfg interface */ PORT_QEMU_CFG_CTL = fw_cfg_port; qemu_cfg_init(); + /* Initialize boot structures. Needs working fw_cfg for bootprio option. */ + boot_init(); + i = romfile_loadint("/etc/firmware-min-version", 0); if (i && i > SEABIOS_HPPA_VERSION) { printf("\nSeaBIOS firmware is version %d, but version %d is required. " @@ -1859,8 +1865,6 @@ void __VISIBLE start_parisc_firmware(void) chassis_code = 0; - malloc_preinit(); - // set Qemu serial debug port DebugOutputPort = PARISC_SERIAL_CONSOLE; // PlatformRunningOn = PF_QEMU; // emulate runningOnQEMU() -- cgit v1.1