| 1 |
|
| 2 |
|
| 3 |
#include <arch/romstage.h> |
| 4 |
#include <cbfs.h> |
| 5 |
#include <console/console.h> |
| 6 |
#include <fsp/api.h> |
| 7 |
#include <fsp/util.h> |
| 8 |
#include <mode_switch.h> |
| 9 |
#include <types.h> |
| 10 |
|
| 11 |
static void fsp_temp_ram_exit(void) |
| 12 |
{ |
| 13 |
struct fsp_header hdr; |
| 14 |
uint32_t status; |
| 15 |
temp_ram_exit_fn temp_ram_exit; |
| 16 |
void *mapping; |
| 17 |
size_t size; |
| 18 |
const char *name = CONFIG_FSP_M_CBFS; |
| 19 |
|
| 20 |
mapping = cbfs_map(name, &size); |
| 21 |
if (!mapping) { |
| 22 |
printk(BIOS_CRIT, "Could not map %s from CBFS\n", name); |
| 23 |
die("FSPM not available for CAR Exit!\n"); |
| 24 |
} |
| 25 |
|
| 26 |
if (fsp_validate_component(&hdr, mapping, size) != CB_SUCCESS) |
| 27 |
die("Invalid FSPM header!\n"); |
| 28 |
|
| 29 |
temp_ram_exit = (void *)(uintptr_t)(hdr.image_base + hdr.temp_ram_exit_entry_offset); |
| 30 |
printk(BIOS_DEBUG, "Calling TempRamExit: %p\n", temp_ram_exit); |
| 31 |
if (ENV_X86_64 && CONFIG(PLATFORM_USES_FSP2_X86_32)) |
| 32 |
status = protected_mode_call_1arg(temp_ram_exit, 0); |
| 33 |
else |
| 34 |
status = temp_ram_exit(NULL); |
| 35 |
|
| 36 |
if (status != FSP_SUCCESS) |
| 37 |
die("TempRamExit returned with error 0x%08x!\n", status); |
| 38 |
|
| 39 |
cbfs_unmap(mapping); |
| 40 |
} |
| 41 |
|
| 42 |
void late_car_teardown(void) |
| 43 |
{ |
| 44 |
fsp_temp_ram_exit(); |
| 45 |
} |