Martin Roth has submitted this change. ( https://review.coreboot.org/c/coreboot/+/52687 )
Change subject: psp_verstage: make get_max_workbuf_size optional ......................................................................
psp_verstage: make get_max_workbuf_size optional
From cezanne we have enough space in PSP so we don't have to worry about workbuf size. Hence the function only exists in picasso and deprecated for later platforms.
So wrap svc_get_max_workbuf_size and provide default weak function so future platforms don't have to implement dumb function for it.
TEST=build and boot zork, check weak function is not called in zork
Signed-off-by: Kangheui Won khwon@chromium.org Change-Id: I16e8edf8070aaacb3a6a6a8adc92b44a230c3139 Reviewed-on: https://review.coreboot.org/c/coreboot/+/52687 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Martin Roth martinroth@google.com --- M src/soc/amd/common/psp_verstage/include/psp_verstage.h M src/soc/amd/common/psp_verstage/psp_verstage.c M src/soc/amd/picasso/psp_verstage/svc.c 3 files changed, 18 insertions(+), 3 deletions(-)
Approvals: build bot (Jenkins): Verified Martin Roth: Looks good to me, approved
diff --git a/src/soc/amd/common/psp_verstage/include/psp_verstage.h b/src/soc/amd/common/psp_verstage/include/psp_verstage.h index f7cb1c9..6589725 100644 --- a/src/soc/amd/common/psp_verstage/include/psp_verstage.h +++ b/src/soc/amd/common/psp_verstage/include/psp_verstage.h @@ -56,6 +56,7 @@ void verstage_soc_init(void); uintptr_t *map_spi_rom(void);
+uint32_t get_max_workbuf_size(uint32_t *size); 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);
diff --git a/src/soc/amd/common/psp_verstage/psp_verstage.c b/src/soc/amd/common/psp_verstage/psp_verstage.c index 58f17e1..f6cc5e9 100644 --- a/src/soc/amd/common/psp_verstage/psp_verstage.c +++ b/src/soc/amd/common/psp_verstage/psp_verstage.c @@ -25,6 +25,14 @@
void __weak verstage_mainboard_early_init(void) {} void __weak verstage_mainboard_init(void) {} +uint32_t __weak get_max_workbuf_size(uint32_t *size) +{ + /* This svc only exists in picasso and deprecated for later platforms. + * Provide sane default function here for those platforms. + */ + *size = (uint32_t)((uintptr_t)_etransfer_buffer - (uintptr_t)_transfer_buffer); + return 0; +}
static void reboot_into_recovery(struct vb2_context *ctx, uint32_t subcode) { @@ -133,10 +141,11 @@ struct transfer_info_struct buffer_info = {0};
/* - * This should never fail, but if it does, we should still try to - * save the buffer. If that fails, then we should go to recovery mode. + * This should never fail on picasso, but if it does, we should still + * try to save the buffer. If that fails, then we should go to + * recovery mode. */ - if (svc_get_max_workbuf_size(&max_buffer_size)) { + if (get_max_workbuf_size(&max_buffer_size)) { post_code(POSTCODE_DEFAULT_BUFFER_SIZE_NOTICE); printk(BIOS_NOTICE, "Notice: using default transfer buffer size.\n"); max_buffer_size = MIN_TRANSFER_BUFFER_SIZE; diff --git a/src/soc/amd/picasso/psp_verstage/svc.c b/src/soc/amd/picasso/psp_verstage/svc.c index a20c2a6..28e6baf 100644 --- a/src/soc/amd/picasso/psp_verstage/svc.c +++ b/src/soc/amd/picasso/psp_verstage/svc.c @@ -149,6 +149,11 @@ return retval; }
+uint32_t get_max_workbuf_size(uint32_t *size) +{ + return svc_get_max_workbuf_size(size); +} + uint32_t svc_get_max_workbuf_size(uint32_t *size) { uint32_t retval = 0;