coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
opensbi.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <sbi/fw_dynamic.h>
4 #include <arch/boot.h>
5 /* DO NOT INCLUDE COREBOOT HEADERS HERE */
6 
7 void run_opensbi(const int hart_id,
8  const void *fdt,
9  const void *opensbi,
10  const void *payload,
11  const int payload_mode)
12 {
13  struct fw_dynamic_info info = {
14  .magic = FW_DYNAMIC_INFO_MAGIC_VALUE,
15  .version = FW_DYNAMIC_INFO_VERSION_MAX,
16  .next_mode = payload_mode,
17  .next_addr = (uintptr_t)payload,
18  };
19 
20  csr_write(mepc, opensbi);
21  asm volatile (
22  "mv a0, %0\n\t"
23  "mv a1, %1\n\t"
24  "mv a2, %2\n\t"
25  "mret" :
26  : "r"(hart_id), "r"(fdt), "r"(&info)
27  : "a0", "a1", "a2");
28 }
static struct smmstore_params_info info
Definition: ramstage.c:12
void run_opensbi(const int hart_id, const void *fdt, const void *opensbi, const void *payload, const int payload_mode)
Definition: opensbi.c:7
unsigned long uintptr_t
Definition: stdint.h:21