Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include "psp_verstage.h" |
| 4 | |
Felix Held | 26935d1 | 2020-12-08 00:40:04 +0100 | [diff] [blame] | 5 | #include <amdblocks/acpimmio.h> |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 6 | #include <bl_uapp/bl_syscall_public.h> |
| 7 | #include <boot_device.h> |
Martin Roth | e21698b | 2020-06-26 08:55:15 -0600 | [diff] [blame] | 8 | #include <cbfs.h> |
Karthikeyan Ramasubramanian | c2f6f35 | 2021-09-10 12:03:30 -0600 | [diff] [blame] | 9 | #include <commonlib/region.h> |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 10 | #include <console/console.h> |
Martin Roth | e21698b | 2020-06-26 08:55:15 -0600 | [diff] [blame] | 11 | #include <fmap.h> |
Martin Roth | 50cca76 | 2020-08-13 11:06:18 -0600 | [diff] [blame] | 12 | #include <pc80/mc146818rtc.h> |
Kangheui Won | fab6e44 | 2021-10-18 15:35:28 +1100 | [diff] [blame] | 13 | #include <soc/iomap.h> |
Martin Roth | 0c12abe | 2020-06-26 08:40:56 -0600 | [diff] [blame] | 14 | #include <soc/psp_transfer.h> |
Martin Roth | 50cca76 | 2020-08-13 11:06:18 -0600 | [diff] [blame] | 15 | #include <security/vboot/vbnv.h> |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 16 | #include <security/vboot/misc.h> |
| 17 | #include <security/vboot/symbols.h> |
| 18 | #include <security/vboot/vboot_common.h> |
| 19 | #include <arch/stages.h> |
| 20 | #include <stdarg.h> |
| 21 | #include <stdio.h> |
Kangheui Won | 4e2f5fd | 2020-09-17 16:37:13 +1000 | [diff] [blame] | 22 | #include <timestamp.h> |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 23 | |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 24 | extern char _bss_start, _bss_end; |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 25 | |
| 26 | void __weak verstage_mainboard_early_init(void) {} |
Rob Barnes | f6e421f | 2021-11-08 13:04:18 -0700 | [diff] [blame^] | 27 | void __weak verstage_mainboard_espi_init(void) {} |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 28 | void __weak verstage_mainboard_init(void) {} |
Kangheui Won | 695732b | 2021-04-25 12:11:17 +1000 | [diff] [blame] | 29 | uint32_t __weak get_max_workbuf_size(uint32_t *size) |
| 30 | { |
| 31 | /* This svc only exists in picasso and deprecated for later platforms. |
| 32 | * Provide sane default function here for those platforms. |
| 33 | */ |
| 34 | *size = (uint32_t)((uintptr_t)_etransfer_buffer - (uintptr_t)_transfer_buffer); |
| 35 | return 0; |
| 36 | } |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 37 | |
| 38 | static void reboot_into_recovery(struct vb2_context *ctx, uint32_t subcode) |
| 39 | { |
| 40 | subcode += PSP_VBOOT_ERROR_SUBCODE; |
| 41 | svc_write_postcode(subcode); |
| 42 | |
Martin Roth | c9689e0 | 2020-08-20 17:25:37 -0600 | [diff] [blame] | 43 | /* |
| 44 | * If there's an error but the PSP_verstage is already booting to RO, |
| 45 | * don't reset the system. It may be that the error is fatal, but if |
| 46 | * the system is stuck, don't intentionally force it into a reboot loop. |
| 47 | */ |
| 48 | if (ctx->flags & VB2_CONTEXT_RECOVERY_MODE) { |
| 49 | printk(BIOS_ERR, "Already in recovery mode. Staying in RO.\n"); |
| 50 | return; |
| 51 | } |
| 52 | |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 53 | vb2api_fail(ctx, VB2_RECOVERY_RO_UNSPECIFIED, (int)subcode); |
| 54 | vboot_save_data(ctx); |
| 55 | |
| 56 | svc_debug_print("Rebooting into recovery\n"); |
| 57 | vboot_reboot(); |
| 58 | } |
| 59 | |
Martin Roth | 50cca76 | 2020-08-13 11:06:18 -0600 | [diff] [blame] | 60 | static uint32_t check_cmos_recovery(void) |
| 61 | { |
| 62 | /* Only reset if cmos is valid */ |
| 63 | if (vbnv_cmos_failed()) |
| 64 | return 0; |
| 65 | |
| 66 | /* If the byte is set, clear it, then return error to reboot */ |
| 67 | if (cmos_read(CMOS_RECOVERY_BYTE) == CMOS_RECOVERY_MAGIC_VAL) { |
| 68 | cmos_write(0x00, CMOS_RECOVERY_BYTE); |
| 69 | printk(BIOS_DEBUG, "Reboot into recovery requested by coreboot\n"); |
| 70 | return POSTCODE_CMOS_RECOVERY; |
| 71 | } |
| 72 | |
| 73 | return 0; |
| 74 | } |
| 75 | |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 76 | /* |
| 77 | * Tell the PSP where to load the rest of the firmware from |
| 78 | */ |
| 79 | static uint32_t update_boot_region(struct vb2_context *ctx) |
| 80 | { |
Kangheui Won | 26bb4aa | 2021-10-18 15:31:45 +1100 | [diff] [blame] | 81 | struct embedded_firmware *ef_table; |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 82 | uint32_t psp_dir_addr, bios_dir_addr; |
| 83 | uint32_t *psp_dir_in_spi, *bios_dir_in_spi; |
Kangheui Won | ac7ec27 | 2021-01-15 15:04:25 +1100 | [diff] [blame] | 84 | const char *fname; |
| 85 | void *amdfw_location; |
Karthikeyan Ramasubramanian | c2f6f35 | 2021-09-10 12:03:30 -0600 | [diff] [blame] | 86 | void *boot_dev_base = rdev_mmap_full(boot_device_ro()); |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 87 | |
| 88 | /* Continue booting from RO */ |
| 89 | if (ctx->flags & VB2_CONTEXT_RECOVERY_MODE) { |
| 90 | printk(BIOS_ERR, "In recovery mode. Staying in RO.\n"); |
| 91 | return 0; |
| 92 | } |
| 93 | |
| 94 | if (vboot_is_firmware_slot_a(ctx)) { |
Martin Roth | e21698b | 2020-06-26 08:55:15 -0600 | [diff] [blame] | 95 | fname = "apu/amdfw_a"; |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 96 | } else { |
Martin Roth | e21698b | 2020-06-26 08:55:15 -0600 | [diff] [blame] | 97 | fname = "apu/amdfw_b"; |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 98 | } |
| 99 | |
Kangheui Won | ac7ec27 | 2021-01-15 15:04:25 +1100 | [diff] [blame] | 100 | amdfw_location = cbfs_map(fname, NULL); |
Martin Roth | e21698b | 2020-06-26 08:55:15 -0600 | [diff] [blame] | 101 | if (!amdfw_location) { |
| 102 | printk(BIOS_ERR, "Error: AMD Firmware table not found.\n"); |
| 103 | return POSTCODE_AMD_FW_MISSING; |
| 104 | } |
Kangheui Won | 26bb4aa | 2021-10-18 15:31:45 +1100 | [diff] [blame] | 105 | ef_table = (struct embedded_firmware *)amdfw_location; |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 106 | if (ef_table->signature != EMBEDDED_FW_SIGNATURE) { |
| 107 | printk(BIOS_ERR, "Error: ROMSIG address is not correct.\n"); |
| 108 | return POSTCODE_ROMSIG_MISMATCH_ERROR; |
| 109 | } |
| 110 | |
Kangheui Won | 26bb4aa | 2021-10-18 15:31:45 +1100 | [diff] [blame] | 111 | psp_dir_addr = ef_table->combo_psp_directory; |
Kangheui Won | 5858fb4 | 2021-05-06 13:30:51 +1000 | [diff] [blame] | 112 | bios_dir_addr = get_bios_dir_addr(ef_table); |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 113 | psp_dir_in_spi = (uint32_t *)((psp_dir_addr & SPI_ADDR_MASK) + |
Karthikeyan Ramasubramanian | c2f6f35 | 2021-09-10 12:03:30 -0600 | [diff] [blame] | 114 | (uint32_t)boot_dev_base); |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 115 | bios_dir_in_spi = (uint32_t *)((bios_dir_addr & SPI_ADDR_MASK) + |
Karthikeyan Ramasubramanian | c2f6f35 | 2021-09-10 12:03:30 -0600 | [diff] [blame] | 116 | (uint32_t)boot_dev_base); |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 117 | if (*psp_dir_in_spi != PSP_COOKIE) { |
| 118 | printk(BIOS_ERR, "Error: PSP Directory address is not correct.\n"); |
| 119 | return POSTCODE_PSP_COOKIE_MISMATCH_ERROR; |
| 120 | } |
| 121 | if (*bios_dir_in_spi != BDT1_COOKIE) { |
| 122 | printk(BIOS_ERR, "Error: BIOS Directory address is not correct.\n"); |
| 123 | return POSTCODE_BDT1_COOKIE_MISMATCH_ERROR; |
| 124 | } |
| 125 | |
Kangheui Won | fab6e44 | 2021-10-18 15:35:28 +1100 | [diff] [blame] | 126 | /* EFS2 uses relative address and PSP isn't happy with that */ |
| 127 | if (ef_table->efs_gen.gen == EFS_SECOND_GEN) { |
| 128 | psp_dir_addr = FLASH_BASE_ADDR + (psp_dir_addr & SPI_ADDR_MASK); |
| 129 | bios_dir_addr = FLASH_BASE_ADDR + (bios_dir_addr & SPI_ADDR_MASK); |
| 130 | } |
| 131 | |
Kangheui Won | 26bb4aa | 2021-10-18 15:31:45 +1100 | [diff] [blame] | 132 | if (update_psp_bios_dir(&psp_dir_addr, &bios_dir_addr)) { |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 133 | printk(BIOS_ERR, "Error: Updated BIOS Directory could not be set.\n"); |
| 134 | return POSTCODE_UPDATE_PSP_BIOS_DIR_ERROR; |
| 135 | } |
| 136 | |
| 137 | return 0; |
| 138 | } |
| 139 | |
| 140 | /* |
| 141 | * Save workbuf (and soon memory console and timestamps) to the bootloader to pass |
| 142 | * back to coreboot. |
| 143 | */ |
| 144 | static uint32_t save_buffers(struct vb2_context **ctx) |
| 145 | { |
| 146 | uint32_t retval; |
Martin Roth | 0c12abe | 2020-06-26 08:40:56 -0600 | [diff] [blame] | 147 | uint32_t buffer_size = MIN_TRANSFER_BUFFER_SIZE; |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 148 | uint32_t max_buffer_size; |
Martin Roth | 0c12abe | 2020-06-26 08:40:56 -0600 | [diff] [blame] | 149 | struct transfer_info_struct buffer_info = {0}; |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 150 | |
| 151 | /* |
Kangheui Won | 695732b | 2021-04-25 12:11:17 +1000 | [diff] [blame] | 152 | * This should never fail on picasso, but if it does, we should still |
| 153 | * try to save the buffer. If that fails, then we should go to |
| 154 | * recovery mode. |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 155 | */ |
Kangheui Won | 695732b | 2021-04-25 12:11:17 +1000 | [diff] [blame] | 156 | if (get_max_workbuf_size(&max_buffer_size)) { |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 157 | post_code(POSTCODE_DEFAULT_BUFFER_SIZE_NOTICE); |
| 158 | printk(BIOS_NOTICE, "Notice: using default transfer buffer size.\n"); |
Martin Roth | 0c12abe | 2020-06-26 08:40:56 -0600 | [diff] [blame] | 159 | max_buffer_size = MIN_TRANSFER_BUFFER_SIZE; |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 160 | } |
| 161 | printk(BIOS_DEBUG, "\nMaximum buffer size: %d bytes\n", max_buffer_size); |
| 162 | |
Martin Roth | 0c12abe | 2020-06-26 08:40:56 -0600 | [diff] [blame] | 163 | /* Shrink workbuf if MP2 is in use and cannot be used to save buffer */ |
| 164 | if (max_buffer_size < VB2_FIRMWARE_WORKBUF_RECOMMENDED_SIZE) { |
| 165 | retval = vb2api_relocate(_vboot2_work, _vboot2_work, MIN_WORKBUF_TRANSFER_SIZE, |
| 166 | ctx); |
| 167 | if (retval != VB2_SUCCESS) { |
| 168 | printk(BIOS_ERR, "Error shrinking workbuf. Error code %#x\n", retval); |
| 169 | buffer_size = VB2_FIRMWARE_WORKBUF_RECOMMENDED_SIZE; |
| 170 | post_code(POSTCODE_WORKBUF_RESIZE_WARNING); |
| 171 | } |
| 172 | } else { |
| 173 | buffer_size = |
| 174 | (uint32_t)((uintptr_t)_etransfer_buffer - (uintptr_t)_transfer_buffer); |
| 175 | |
| 176 | buffer_info.console_offset = (uint32_t)((uintptr_t)_preram_cbmem_console - |
| 177 | (uintptr_t)_transfer_buffer); |
| 178 | buffer_info.timestamp_offset = (uint32_t)((uintptr_t)_timestamp - |
| 179 | (uintptr_t)_transfer_buffer); |
| 180 | buffer_info.fmap_offset = (uint32_t)((uintptr_t)_fmap_cache - |
| 181 | (uintptr_t)_transfer_buffer); |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | if (buffer_size > max_buffer_size) { |
Martin Roth | 0c12abe | 2020-06-26 08:40:56 -0600 | [diff] [blame] | 185 | printk(BIOS_ERR, "Error: Buffer is larger than max buffer size.\n"); |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 186 | post_code(POSTCODE_WORKBUF_BUFFER_SIZE_ERROR); |
| 187 | return POSTCODE_WORKBUF_BUFFER_SIZE_ERROR; |
| 188 | } |
| 189 | |
Martin Roth | 0c12abe | 2020-06-26 08:40:56 -0600 | [diff] [blame] | 190 | buffer_info.magic_val = TRANSFER_MAGIC_VAL; |
| 191 | buffer_info.struct_bytes = sizeof(buffer_info); |
| 192 | buffer_info.buffer_size = buffer_size; |
| 193 | buffer_info.workbuf_offset = (uint32_t)((uintptr_t)_fmap_cache - |
| 194 | (uintptr_t)_vboot2_work); |
| 195 | |
Kangheui Won | 5f027fa | 2020-08-25 18:12:19 +1000 | [diff] [blame] | 196 | memcpy(_transfer_buffer, &buffer_info, sizeof(buffer_info)); |
| 197 | |
Kangheui Won | a767eb4 | 2021-04-14 09:35:28 +1000 | [diff] [blame] | 198 | retval = save_uapp_data((void *)_transfer_buffer, buffer_size); |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 199 | if (retval) { |
Martin Roth | 0c12abe | 2020-06-26 08:40:56 -0600 | [diff] [blame] | 200 | printk(BIOS_ERR, "Error: Could not save workbuf. Error code 0x%08x\n", retval); |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 201 | return POSTCODE_WORKBUF_SAVE_ERROR; |
| 202 | } |
| 203 | |
| 204 | return 0; |
| 205 | } |
| 206 | |
| 207 | void Main(void) |
| 208 | { |
| 209 | uint32_t retval; |
| 210 | struct vb2_context *ctx = NULL; |
Karthikeyan Ramasubramanian | c2f6f35 | 2021-09-10 12:03:30 -0600 | [diff] [blame] | 211 | void *boot_dev_base; |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 212 | |
| 213 | /* |
| 214 | * Do not use printk() before console_init() |
| 215 | * Do not use post_code() before verstage_mainboard_init() |
| 216 | */ |
Kangheui Won | 4e2f5fd | 2020-09-17 16:37:13 +1000 | [diff] [blame] | 217 | timestamp_init(timestamp_get()); |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 218 | svc_write_postcode(POSTCODE_ENTERED_PSP_VERSTAGE); |
| 219 | svc_debug_print("Entering verstage on PSP\n"); |
| 220 | memset(&_bss_start, '\0', &_bss_end - &_bss_start); |
| 221 | |
| 222 | svc_write_postcode(POSTCODE_CONSOLE_INIT); |
| 223 | console_init(); |
| 224 | |
| 225 | svc_write_postcode(POSTCODE_EARLY_INIT); |
| 226 | retval = verstage_soc_early_init(); |
| 227 | if (retval) { |
Rob Barnes | c30a1fa | 2021-11-08 06:43:07 -0700 | [diff] [blame] | 228 | /* |
| 229 | * If verstage_soc_early_init fails, cmos is probably not |
| 230 | * accessible, so rebooting into recovery is not an option. |
| 231 | * Just reboot and hope for the best. |
| 232 | */ |
| 233 | svc_write_postcode(POSTCODE_EARLY_INIT_ERROR); |
| 234 | svc_debug_print("verstage_soc_early_init failed! -- rebooting\n"); |
| 235 | vboot_reboot(); |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 236 | } |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 237 | |
Rob Barnes | f6e421f | 2021-11-08 13:04:18 -0700 | [diff] [blame^] | 238 | printk(BIOS_DEBUG, "calling verstage_mainboard_espi_init\n"); |
| 239 | verstage_mainboard_espi_init(); |
| 240 | |
| 241 | printk(BIOS_DEBUG, "calling verstage_mainboard_early_init\n"); |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 242 | verstage_mainboard_early_init(); |
| 243 | |
| 244 | svc_write_postcode(POSTCODE_LATE_INIT); |
Felix Held | 26935d1 | 2020-12-08 00:40:04 +0100 | [diff] [blame] | 245 | fch_io_enable_legacy_io(); |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 246 | verstage_soc_init(); |
| 247 | verstage_mainboard_init(); |
| 248 | |
| 249 | post_code(POSTCODE_VERSTAGE_MAIN); |
| 250 | |
Kangheui Won | ac7ec27 | 2021-01-15 15:04:25 +1100 | [diff] [blame] | 251 | vboot_run_logic(); |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 252 | |
Martin Roth | c9689e0 | 2020-08-20 17:25:37 -0600 | [diff] [blame] | 253 | ctx = vboot_get_context(); |
Martin Roth | 50cca76 | 2020-08-13 11:06:18 -0600 | [diff] [blame] | 254 | retval = check_cmos_recovery(); |
| 255 | if (retval) |
Martin Roth | c9689e0 | 2020-08-20 17:25:37 -0600 | [diff] [blame] | 256 | reboot_into_recovery(ctx, retval); |
Martin Roth | 0c12abe | 2020-06-26 08:40:56 -0600 | [diff] [blame] | 257 | |
Kangheui Won | ac7ec27 | 2021-01-15 15:04:25 +1100 | [diff] [blame] | 258 | post_code(POSTCODE_UPDATE_BOOT_REGION); |
Kangheui Won | 9752725 | 2021-05-20 10:02:00 +1000 | [diff] [blame] | 259 | |
| 260 | /* |
| 261 | * Since psp_verstage doesn't load next stage we never call |
| 262 | * any cbfs API on RO path. However we still need to initialize |
| 263 | * RO CBFS MCACHE manually to pass it in transfer_buffer. |
| 264 | * In RW path, MCACHE build will be skipped for RO region since |
| 265 | * we already built here. |
| 266 | */ |
| 267 | cbfs_get_boot_device(true); |
| 268 | |
Kangheui Won | ac7ec27 | 2021-01-15 15:04:25 +1100 | [diff] [blame] | 269 | retval = update_boot_region(ctx); |
| 270 | if (retval) |
| 271 | reboot_into_recovery(ctx, retval); |
| 272 | |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 273 | post_code(POSTCODE_SAVE_BUFFERS); |
| 274 | retval = save_buffers(&ctx); |
| 275 | if (retval) |
Martin Roth | c9689e0 | 2020-08-20 17:25:37 -0600 | [diff] [blame] | 276 | reboot_into_recovery(ctx, retval); |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 277 | |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 278 | |
| 279 | post_code(POSTCODE_UNMAP_SPI_ROM); |
Karthikeyan Ramasubramanian | c2f6f35 | 2021-09-10 12:03:30 -0600 | [diff] [blame] | 280 | boot_dev_base = rdev_mmap_full(boot_device_ro()); |
| 281 | if (boot_dev_base) { |
| 282 | if (svc_unmap_spi_rom((void *)boot_dev_base)) |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 283 | printk(BIOS_ERR, "Error unmapping SPI rom\n"); |
| 284 | } |
| 285 | |
| 286 | post_code(POSTCODE_UNMAP_FCH_DEVICES); |
| 287 | unmap_fch_devices(); |
| 288 | |
| 289 | post_code(POSTCODE_LEAVING_VERSTAGE); |
| 290 | |
| 291 | printk(BIOS_DEBUG, "Leaving verstage on PSP\n"); |
| 292 | svc_exit(retval); |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 293 | } |
| 294 | |
Martin Roth | c7acf16 | 2020-05-28 00:44:50 -0600 | [diff] [blame] | 295 | /* |
| 296 | * The stage_entry function is not used directly, but stage_entry() is marked as an entry |
| 297 | * point in arm/arch/header.h, so if stage_entry() isn't present and calling Main(), all |
| 298 | * the verstage code gets dropped by the linker. Slightly hacky, but mostly harmless. |
| 299 | */ |
| 300 | void stage_entry(uintptr_t stage_arg) |
| 301 | { |
| 302 | Main(); |
| 303 | } |