Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/86298?usp=email )
Change subject: soc/amd: Document VBIOS handling ......................................................................
soc/amd: Document VBIOS handling
The code flow isn't that obvious in the beginning. You pass an address of the VBIOS to FSP, but don't load any VBIOS until BS_DEV_RESOURCES phase. Add comments to document what is done and when. This will help to improve the code in the next step.
Change-Id: I643bc9088306d99cc0fbb79648809e16b068fb33 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/soc/amd/cezanne/fsp_s_params.c M src/soc/amd/common/block/graphics/graphics.c M src/soc/amd/glinda/fsp_s_params.c M src/soc/amd/mendocino/fsp_s_params.c M src/soc/amd/phoenix/fsp_s_params.c M src/soc/amd/picasso/fsp_s_params.c 6 files changed, 38 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/98/86298/1
diff --git a/src/soc/amd/cezanne/fsp_s_params.c b/src/soc/amd/cezanne/fsp_s_params.c index 60f3942..b9770f3 100644 --- a/src/soc/amd/cezanne/fsp_s_params.c +++ b/src/soc/amd/cezanne/fsp_s_params.c @@ -8,6 +8,11 @@
static void fsp_assign_vbios_upds(FSP_S_CONFIG *scfg) { + /* + * The VBIOS contains the ATOMBIOS tables that will be modified as + * part of FSP GOP init. We can delay loading of the VBIOS until + * before FSP notify AFTER_PCI_ENUM. + */ scfg->vbios_buffer = CONFIG(RUN_FSP_GOP) ? PCI_VGA_RAM_IMAGE_START : 0; }
diff --git a/src/soc/amd/common/block/graphics/graphics.c b/src/soc/amd/common/block/graphics/graphics.c index ea7308a..77420ae 100644 --- a/src/soc/amd/common/block/graphics/graphics.c +++ b/src/soc/amd/common/block/graphics/graphics.c @@ -147,9 +147,13 @@ }
/* - * Even though AMD does not need VBT we still need to implement the - * vbt_get() function to not break the build with GOP driver enabled - * (see fsps_return_value_handler() in fsp2_0/silicon_init.c + * On AMD platforms the VBT is called ATOMBIOS and is always part of the + * VGA Option ROM. As part of the FSP GOP init the ATOMBIOS tables are + * updated in place. Thus the VBIOS must be loaded into RAM before FSP GOP + * runs. The address of the VBIOS must be passed to FSP-S using UPDs, but + * loading of the VBIOS can be delayed until before FSP AFTER_PCI_ENUM + * notify is called. FSP expects a pointer to the PCI option rom instead + * a pointer to the ATOMBIOS table directly. */ void *vbt_get(void) { @@ -165,6 +169,7 @@ if (!CONFIG(RUN_FSP_GOP)) return;
+ /* Load the VBIOS before FSP AFTER_PCI_ENUM notify is called. */ timestamp_add_now(TS_OPROM_INITIALIZE); if (CONFIG(USE_SELECTIVE_GOP_INIT) && vbios_cache_is_valid() && !display_init_required()) { @@ -172,6 +177,11 @@ timestamp_add_now(TS_OPROM_COPY_END); return; } + + /* + * VBIOS cache was not used, so load it from CBFS and let FSP GOP + * initialize the ATOMBIOS tables. + */ rom = pci_rom_probe(dev); if (rom == NULL) { printk(BIOS_ERR, "%s: Unable to find ROM for %s\n", diff --git a/src/soc/amd/glinda/fsp_s_params.c b/src/soc/amd/glinda/fsp_s_params.c index 597f7a9..e037957 100644 --- a/src/soc/amd/glinda/fsp_s_params.c +++ b/src/soc/amd/glinda/fsp_s_params.c @@ -10,6 +10,11 @@
static void fsp_assign_vbios_upds(FSP_S_CONFIG *scfg) { + /* + * The VBIOS contains the ATOMBIOS tables that will be modified as + * part of FSP GOP init. We can delay loading of the VBIOS until + * before FSP notify AFTER_PCI_ENUM. + */ scfg->vbios_buffer = CONFIG(RUN_FSP_GOP) ? PCI_VGA_RAM_IMAGE_START : 0; }
diff --git a/src/soc/amd/mendocino/fsp_s_params.c b/src/soc/amd/mendocino/fsp_s_params.c index 50923e9..5c37334 100644 --- a/src/soc/amd/mendocino/fsp_s_params.c +++ b/src/soc/amd/mendocino/fsp_s_params.c @@ -20,6 +20,11 @@ printk(BIOS_SPEW, "%s: using VBIOS cache; skipping GOP driver.\n", __func__); return; } + /* + * The VBIOS contains the ATOMBIOS tables that will be modified as + * part of FSP GOP init. We can delay loading of the VBIOS until + * before FSP notify AFTER_PCI_ENUM. + */ printk(BIOS_SPEW, "%s: not using VBIOS cache; running GOP driver.\n", __func__); scfg->vbios_buffer = CONFIG(RUN_FSP_GOP) ? PCI_VGA_RAM_IMAGE_START : 0; } diff --git a/src/soc/amd/phoenix/fsp_s_params.c b/src/soc/amd/phoenix/fsp_s_params.c index 46c8e76..883cde0 100644 --- a/src/soc/amd/phoenix/fsp_s_params.c +++ b/src/soc/amd/phoenix/fsp_s_params.c @@ -10,6 +10,11 @@
static void fsp_assign_vbios_upds(FSP_S_CONFIG *scfg) { + /* + * The VBIOS contains the ATOMBIOS tables that will be modified as + * part of FSP GOP init. We can delay loading of the VBIOS until + * before FSP notify AFTER_PCI_ENUM. + */ scfg->vbios_buffer = CONFIG(RUN_FSP_GOP) ? PCI_VGA_RAM_IMAGE_START : 0; }
diff --git a/src/soc/amd/picasso/fsp_s_params.c b/src/soc/amd/picasso/fsp_s_params.c index 9f491d6..d4cfa27 100644 --- a/src/soc/amd/picasso/fsp_s_params.c +++ b/src/soc/amd/picasso/fsp_s_params.c @@ -185,6 +185,11 @@
static void fsp_assign_vbios_upds(FSP_S_CONFIG *scfg) { + /* + * The VBIOS contains the ATOMBIOS tables that will be modified as + * part of FSP GOP init. We can delay loading of the VBIOS until + * before FSP notify AFTER_PCI_ENUM. + */ scfg->vbios_buffer_addr = CONFIG(RUN_FSP_GOP) ? PCI_VGA_RAM_IMAGE_START : 0; }