ec/google/chromeec: Enable ACPI memory mapping for Microchip EC
[coreboot.git] / src / drivers / intel / fsp2_0 / temp_ram_exit.c
blob5b8247cecbd987f7ba4c7cc4a37be18f0eab559f
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
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>
11 static void fsp_temp_ram_exit(void)
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;
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");
26 if (fsp_validate_component(&hdr, mapping, size) != CB_SUCCESS)
27 die("Invalid FSPM header!\n");
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);
36 if (status != FSP_SUCCESS)
37 die("TempRamExit returned with error 0x%08x!\n", status);
39 cbfs_unmap(mapping);
42 void late_car_teardown(void)
44 fsp_temp_ram_exit();