From a767eb4ed9dd942a5d5b28162b81be6d559bdab0 Mon Sep 17 00:00:00 2001 From: Kangheui Won Date: Wed, 14 Apr 2021 09:35:28 +1000 Subject: [PATCH] psp_verstage: move svc to platform-specific dir Since there are some differences between picasso PSP svc and cezanne PSP svc, each platform should have their own svc wrapper. Moreover cezanne PSP will drop unused parameters from update_psp_bios_dir and save_uapp_data so make wrapper around it. BUG=b:182477057 BRANCH=none TEST=build psp_verstage and boot on zork Signed-off-by: Kangheui Won Change-Id: I69f998865fc3184ea8900a431924a315c5ee9133 Reviewed-on: https://review.coreboot.org/c/coreboot/+/52307 Reviewed-by: Martin Roth Tested-by: build bot (Jenkins) --- src/soc/amd/common/psp_verstage/Makefile.inc | 1 - .../common/psp_verstage/{ => include}/psp_verstage.h | 3 +++ src/soc/amd/common/psp_verstage/psp_verstage.c | 6 ++---- src/soc/amd/picasso/psp_verstage/Makefile.inc | 2 ++ src/soc/amd/{common => picasso}/psp_verstage/svc.c | 12 ++++++++++++ src/soc/amd/{common => picasso}/psp_verstage/svc.h | 0 6 files changed, 19 insertions(+), 5 deletions(-) rename src/soc/amd/common/psp_verstage/{ => include}/psp_verstage.h (92%) rename src/soc/amd/{common => picasso}/psp_verstage/svc.c (92%) rename src/soc/amd/{common => picasso}/psp_verstage/svc.h (100%) diff --git a/src/soc/amd/common/psp_verstage/Makefile.inc b/src/soc/amd/common/psp_verstage/Makefile.inc index 40d9c45763..406d28bcc0 100644 --- a/src/soc/amd/common/psp_verstage/Makefile.inc +++ b/src/soc/amd/common/psp_verstage/Makefile.inc @@ -16,7 +16,6 @@ verstage-y += printk.c verstage-y += psp_verstage.c verstage-y += psp.c verstage-y += reset.c -verstage-y += svc.c verstage-y += timer.c verstage-y += vboot_crypto.c diff --git a/src/soc/amd/common/psp_verstage/psp_verstage.h b/src/soc/amd/common/psp_verstage/include/psp_verstage.h similarity index 92% rename from src/soc/amd/common/psp_verstage/psp_verstage.h rename to src/soc/amd/common/psp_verstage/include/psp_verstage.h index 4f85d7caa1..f7cb1c94b0 100644 --- a/src/soc/amd/common/psp_verstage/psp_verstage.h +++ b/src/soc/amd/common/psp_verstage/include/psp_verstage.h @@ -56,4 +56,7 @@ uint32_t verstage_soc_early_init(void); void verstage_soc_init(void); uintptr_t *map_spi_rom(void); +uint32_t update_psp_bios_dir(uint32_t *psp_dir_offset, uint32_t *bios_dir_offset); +uint32_t save_uapp_data(void *address, uint32_t size); + #endif /* PSP_VERSTAGE_H */ diff --git a/src/soc/amd/common/psp_verstage/psp_verstage.c b/src/soc/amd/common/psp_verstage/psp_verstage.c index d4c5d155af..58f17e14f1 100644 --- a/src/soc/amd/common/psp_verstage/psp_verstage.c +++ b/src/soc/amd/common/psp_verstage/psp_verstage.c @@ -113,8 +113,7 @@ static uint32_t update_boot_region(struct vb2_context *ctx) return POSTCODE_BDT1_COOKIE_MISMATCH_ERROR; } - if (svc_update_psp_bios_dir((void *)&psp_dir_addr, - (void *)&bios_dir_addr, DIR_OFFSET_SET)) { + if (update_psp_bios_dir((void *)&psp_dir_addr, (void *)&bios_dir_addr)) { printk(BIOS_ERR, "Error: Updated BIOS Directory could not be set.\n"); return POSTCODE_UPDATE_PSP_BIOS_DIR_ERROR; } @@ -179,8 +178,7 @@ static uint32_t save_buffers(struct vb2_context **ctx) memcpy(_transfer_buffer, &buffer_info, sizeof(buffer_info)); - retval = svc_save_uapp_data(UAPP_COPYBUF_CHROME_WORKBUF, (void *)_transfer_buffer, - buffer_size); + retval = save_uapp_data((void *)_transfer_buffer, buffer_size); if (retval) { printk(BIOS_ERR, "Error: Could not save workbuf. Error code 0x%08x\n", retval); return POSTCODE_WORKBUF_SAVE_ERROR; diff --git a/src/soc/amd/picasso/psp_verstage/Makefile.inc b/src/soc/amd/picasso/psp_verstage/Makefile.inc index e70360fa51..32b594d2cb 100644 --- a/src/soc/amd/picasso/psp_verstage/Makefile.inc +++ b/src/soc/amd/picasso/psp_verstage/Makefile.inc @@ -3,5 +3,7 @@ verstage-generic-ccopts += -I$(src)/soc/amd/picasso/psp_verstage/include verstage-generic-ccopts += -I$(src)/vendorcode/amd/fsp/picasso/include +verstage-y += svc.c + verstage-y += $(top)/src/vendorcode/amd/fsp/picasso/bl_uapp/bl_uapp_startup.S verstage-y += $(top)/src/vendorcode/amd/fsp/picasso/bl_uapp/bl_uapp_end.S diff --git a/src/soc/amd/common/psp_verstage/svc.c b/src/soc/amd/picasso/psp_verstage/svc.c similarity index 92% rename from src/soc/amd/common/psp_verstage/svc.c rename to src/soc/amd/picasso/psp_verstage/svc.c index acc9c70318..a20c2a618f 100644 --- a/src/soc/amd/common/psp_verstage/svc.c +++ b/src/soc/amd/picasso/psp_verstage/svc.c @@ -4,6 +4,7 @@ #include #include +#include #include void svc_exit(uint32_t status) @@ -95,6 +96,12 @@ uint32_t svc_unmap_spi_rom(void *spi_rom_addr) return retval; } +uint32_t update_psp_bios_dir(uint32_t *psp_dir_offset, uint32_t *bios_dir_offset) +{ + return svc_update_psp_bios_dir(psp_dir_offset, bios_dir_offset, + DIR_OFFSET_SET); +} + uint32_t svc_update_psp_bios_dir(uint32_t *psp_dir_offset, uint32_t *bios_dir_offset, enum dir_offset_operation operation) { @@ -105,6 +112,11 @@ uint32_t svc_update_psp_bios_dir(uint32_t *psp_dir_offset, return retval; } +uint32_t save_uapp_data(void *address, uint32_t size) +{ + return svc_save_uapp_data(UAPP_COPYBUF_CHROME_WORKBUF, address, size); +} + uint32_t svc_save_uapp_data(enum uapp_copybuf type, void *address, uint32_t size) { diff --git a/src/soc/amd/common/psp_verstage/svc.h b/src/soc/amd/picasso/psp_verstage/svc.h similarity index 100% rename from src/soc/amd/common/psp_verstage/svc.h rename to src/soc/amd/picasso/psp_verstage/svc.h