soc/amd/{common/psp_verstage,soc/picasso}: Remove workbuf shrinking

This feature was never used. Let's remove it to keep things simple.

BUG=221231786
TEST=Boot test guybrush and morphius and verify transfer buffer is
correctly passed.

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I93a284db919f82763dcd31cec76af4b773eb3f80
Reviewed-on: https://review.coreboot.org/c/coreboot/+/62345
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Rob Barnes <robbarnes@google.com>
This commit is contained in:
Raul E Rangel 2022-02-24 10:58:29 -07:00 committed by Raul Rangel
parent ea4ad0ddf9
commit 5e0ed5016c
3 changed files with 11 additions and 56 deletions

View File

@ -59,7 +59,6 @@ void verstage_soc_i2c_init(void);
void verstage_soc_spi_init(void); void verstage_soc_spi_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);
uint32_t get_bios_dir_addr(struct embedded_firmware *ef_table); uint32_t get_bios_dir_addr(struct embedded_firmware *ef_table);

View File

@ -27,15 +27,6 @@ extern char _bss_start, _bss_end;
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)
{ {
subcode += PSP_VBOOT_ERROR_SUBCODE; subcode += PSP_VBOOT_ERROR_SUBCODE;
@ -142,51 +133,21 @@ static uint32_t update_boot_region(struct vb2_context *ctx)
* Save workbuf (and soon memory console and timestamps) to the bootloader to pass * Save workbuf (and soon memory console and timestamps) to the bootloader to pass
* back to coreboot. * back to coreboot.
*/ */
static uint32_t save_buffers(struct vb2_context **ctx) static uint32_t save_buffers(void)
{ {
uint32_t retval; uint32_t retval;
uint32_t buffer_size = MIN_TRANSFER_BUFFER_SIZE; uint32_t buffer_size;
uint32_t max_buffer_size;
struct transfer_info_struct buffer_info = {0}; struct transfer_info_struct buffer_info = {0};
/* buffer_size =
* This should never fail on picasso, but if it does, we should still (uint32_t)((uintptr_t)_etransfer_buffer - (uintptr_t)_transfer_buffer);
* try to save the buffer. If that fails, then we should go to
* recovery mode.
*/
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;
}
printk(BIOS_DEBUG, "\nMaximum buffer size: %d bytes\n", max_buffer_size);
/* Shrink workbuf if MP2 is in use and cannot be used to save buffer */ buffer_info.console_offset = (uint32_t)((uintptr_t)_preram_cbmem_console -
if (max_buffer_size < VB2_FIRMWARE_WORKBUF_RECOMMENDED_SIZE) { (uintptr_t)_transfer_buffer);
retval = vb2api_relocate(_vboot2_work, _vboot2_work, MIN_WORKBUF_TRANSFER_SIZE, buffer_info.timestamp_offset = (uint32_t)((uintptr_t)_timestamp -
ctx); (uintptr_t)_transfer_buffer);
if (retval != VB2_SUCCESS) { buffer_info.fmap_offset = (uint32_t)((uintptr_t)_fmap_cache -
printk(BIOS_ERR, "Error shrinking workbuf. Error code %#x\n", retval); (uintptr_t)_transfer_buffer);
buffer_size = VB2_FIRMWARE_WORKBUF_RECOMMENDED_SIZE;
post_code(POSTCODE_WORKBUF_RESIZE_WARNING);
}
} else {
buffer_size =
(uint32_t)((uintptr_t)_etransfer_buffer - (uintptr_t)_transfer_buffer);
buffer_info.console_offset = (uint32_t)((uintptr_t)_preram_cbmem_console -
(uintptr_t)_transfer_buffer);
buffer_info.timestamp_offset = (uint32_t)((uintptr_t)_timestamp -
(uintptr_t)_transfer_buffer);
buffer_info.fmap_offset = (uint32_t)((uintptr_t)_fmap_cache -
(uintptr_t)_transfer_buffer);
}
if (buffer_size > max_buffer_size) {
printk(BIOS_ERR, "Buffer is larger than max buffer size.\n");
post_code(POSTCODE_WORKBUF_BUFFER_SIZE_ERROR);
return POSTCODE_WORKBUF_BUFFER_SIZE_ERROR;
}
buffer_info.magic_val = TRANSFER_MAGIC_VAL; buffer_info.magic_val = TRANSFER_MAGIC_VAL;
buffer_info.struct_bytes = sizeof(buffer_info); buffer_info.struct_bytes = sizeof(buffer_info);
@ -332,7 +293,7 @@ void Main(void)
reboot_into_recovery(ctx, retval); reboot_into_recovery(ctx, retval);
post_code(POSTCODE_SAVE_BUFFERS); post_code(POSTCODE_SAVE_BUFFERS);
retval = save_buffers(&ctx); retval = save_buffers();
if (retval) if (retval)
reboot_into_recovery(ctx, retval); reboot_into_recovery(ctx, retval);

View File

@ -14,11 +14,6 @@ uint32_t save_uapp_data(void *address, uint32_t size)
return svc_save_uapp_data(UAPP_COPYBUF_CHROME_WORKBUF, address, size); return svc_save_uapp_data(UAPP_COPYBUF_CHROME_WORKBUF, address, size);
} }
uint32_t get_max_workbuf_size(uint32_t *size)
{
return svc_get_max_workbuf_size(size);
}
uint32_t get_bios_dir_addr(struct embedded_firmware *ef_table) uint32_t get_bios_dir_addr(struct embedded_firmware *ef_table)
{ {
return ef_table->bios1_entry; return ef_table->bios1_entry;