1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 3 #include <arch/cpu.h> 4 #include <commonlib/helpers.h> 5 #include <console/console.h> 6 #include <mode_switch.h> 7 #include <program_loading.h> 8 #include <symbols.h> 9 #include <assert.h> 10 payload_arch_usable_ram_quirk(uint64_t start,uint64_t size)11int payload_arch_usable_ram_quirk(uint64_t start, uint64_t size) 12 { 13 if (start < 1 * MiB && (start + size) <= 1 * MiB) { 14 printk(BIOS_DEBUG, 15 "Payload being loaded at below 1MiB without region being marked as RAM usable.\n"); 16 return 1; 17 } 18 19 return 0; 20 } 21 arch_prog_run(struct prog * prog)22void arch_prog_run(struct prog *prog) 23 { 24 #if ENV_RAMSTAGE && ENV_X86_64 25 const uint32_t arg = pointer_to_uint32_safe(prog_entry_arg(prog)); 26 const uint32_t entry = pointer_to_uint32_safe(prog_entry(prog)); 27 28 /* On x86 coreboot payloads expect to be called in protected mode */ 29 protected_mode_call_1arg((void *)(uintptr_t)entry, arg); 30 #else 31 #if ENV_X86_64 32 void (*doit)(void *arg); 33 #else 34 /* Ensure the argument is pushed on the stack. */ 35 asmlinkage void (*doit)(void *arg); 36 #endif 37 doit = prog_entry(prog); 38 doit(prog_entry_arg(prog)); 39 #endif 40 } 41