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>
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;