coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
temp_ram_exit.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include <cbmem.h>
4 #include <cbfs.h>
5 #include <console/console.h>
6 #include <fsp/util.h>
7 
9 {
10  FSP_INFO_HEADER *fih;
11  uint32_t status;
12  FSP_TEMP_RAM_EXIT temp_ram_exit;
13 
14  /* CBMEM_ID_VBOOT_WORKBUF is used as vboot workbuffer.
15  * Init CBMEM before loading fsp, to have buffer available */
17 
18  void *fsp = cbfs_map("fsp.bin", NULL);
19  if (!fsp) {
20  die("Unable to locate fsp.bin\n");
21  } else {
22  /* This leaks a mapping which this code assumes is benign as
23  * the flash is memory mapped CPU's address space. */
24 
25  /* FIXME: the implementation of find_fsp is utter garbage
26  as it casts error values to FSP_INFO_HEADER pointers.
27  Checking for return values can only be done sanely once
28  that is fixed. */
29  fih = find_fsp((uintptr_t)fsp);
30  }
31 
32  temp_ram_exit = (FSP_TEMP_RAM_EXIT)(fih->TempRamExitEntryOffset +
33  fih->ImageBase);
34  printk(BIOS_DEBUG, "Calling TempRamExit: %p\n", temp_ram_exit);
35  status = temp_ram_exit(NULL);
36 
37  if (status != FSP_SUCCESS) {
38  printk(BIOS_CRIT, "TempRamExit returned 0x%08x\n", status);
39  die("TempRamExit returned an error!\n");
40  }
41 }
#define asmlinkage
Definition: cpu.h:8
static void * cbfs_map(const char *name, size_t *size_out)
Definition: cbfs.h:246
int cbmem_initialize(void)
Definition: imd_cbmem.c:88
#define printk(level,...)
Definition: stdlib.h:16
void __noreturn die(const char *fmt,...)
Definition: die.c:17
asmlinkage void chipset_teardown_car_main(void)
Definition: temp_ram_exit.c:8
#define FSP_SUCCESS
Definition: api.h:11
FSP_INFO_HEADER * find_fsp(uintptr_t fsp_base_address)
Definition: fsp_util.c:12
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128
#define BIOS_CRIT
BIOS_CRIT - Recovery unlikely.
Definition: loglevel.h:56
#define NULL
Definition: stddef.h:19
unsigned int uint32_t
Definition: stdint.h:14
unsigned long uintptr_t
Definition: stdint.h:21