summaryrefslogtreecommitdiff
path: root/src/soc/amd
diff options
context:
space:
mode:
authorKangheui Won <khwon@chromium.org>2021-04-25 12:11:17 +1000
committerMartin Roth <martinroth@google.com>2021-04-29 15:16:54 +0000
commit695732b0d7dd2a5f307922876c6ca91d8a486665 (patch)
tree198a1ce3b157a27f68355a9275fa39d93a903bc8 /src/soc/amd
parent3bad01373d771d9fce8ae7d667b2e3a3c2267d6d (diff)
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>
Diffstat (limited to 'src/soc/amd')
-rw-r--r--src/soc/amd/common/psp_verstage/include/psp_verstage.h1
-rw-r--r--src/soc/amd/common/psp_verstage/psp_verstage.c15
-rw-r--r--src/soc/amd/picasso/psp_verstage/svc.c5
3 files changed, 18 insertions, 3 deletions
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 f7cb1c94b0..65897257ab 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 @@ uint32_t verstage_soc_early_init(void);
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 58f17e14f1..f6cc5e95b8 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 @@ static struct mem_region_device boot_dev =
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 @@ static uint32_t save_buffers(struct vb2_context **ctx)
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 a20c2a618f..28e6bafa95 100644
--- a/src/soc/amd/picasso/psp_verstage/svc.c
+++ b/src/soc/amd/picasso/psp_verstage/svc.c
@@ -149,6 +149,11 @@ uint32_t svc_write_postcode(uint32_t postcode)
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;