1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include <arch/romstage.h>
5 #include <console/console.h>
8 #include <mode_switch.h>
11 static void fsp_temp_ram_exit(void)
13 struct fsp_header hdr
;
15 temp_ram_exit_fn temp_ram_exit
;
18 const char *name
= CONFIG_FSP_M_CBFS
;
20 mapping
= cbfs_map(name
, &size
);
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);
34 status
= temp_ram_exit(NULL
);
36 if (status
!= FSP_SUCCESS
)
37 die("TempRamExit returned with error 0x%08x!\n", status
);
42 void late_car_teardown(void)