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>
This commit is contained in:
Kangheui Won 2021-04-25 12:11:17 +10:00 committed by Martin Roth
parent 3bad01373d
commit 695732b0d7
3 changed files with 18 additions and 3 deletions

View File

@ -56,6 +56,7 @@ uint32_t verstage_soc_early_init(void);
void verstage_soc_init(void); void verstage_soc_init(void);
uintptr_t *map_spi_rom(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 update_psp_bios_dir(uint32_t *psp_dir_offset, uint32_t *bios_dir_offset);
uint32_t save_uapp_data(void *address, uint32_t size); uint32_t save_uapp_data(void *address, uint32_t size);

View File

@ -25,6 +25,14 @@ static struct mem_region_device boot_dev =
void __weak verstage_mainboard_early_init(void) {} void __weak verstage_mainboard_early_init(void) {}
void __weak verstage_mainboard_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) 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}; struct transfer_info_struct buffer_info = {0};
/* /*
* This should never fail, but if it does, we should still try to * This should never fail on picasso, but if it does, we should still
* save the buffer. If that fails, then we should go to recovery mode. * 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); post_code(POSTCODE_DEFAULT_BUFFER_SIZE_NOTICE);
printk(BIOS_NOTICE, "Notice: using default transfer buffer size.\n"); printk(BIOS_NOTICE, "Notice: using default transfer buffer size.\n");
max_buffer_size = MIN_TRANSFER_BUFFER_SIZE; max_buffer_size = MIN_TRANSFER_BUFFER_SIZE;

View File

@ -149,6 +149,11 @@ uint32_t svc_write_postcode(uint32_t postcode)
return retval; 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 svc_get_max_workbuf_size(uint32_t *size)
{ {
uint32_t retval = 0; uint32_t retval = 0;