Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | /* TODO: Check if this is still correct */ |
| 4 | |
| 5 | #include <acpi/acpi.h> |
| 6 | #include <amdblocks/apob_cache.h> |
Matt DeVillier | bcb67ed | 2022-12-16 17:25:01 -0600 | [diff] [blame] | 7 | #include <amdblocks/vbios_cache.h> |
Matt DeVillier | 65a4445 | 2023-02-16 09:57:40 -0600 | [diff] [blame] | 8 | #include <bootmode.h> |
Karthikeyan Ramasubramanian | 47b393a | 2023-10-13 16:18:56 +0000 | [diff] [blame^] | 9 | #include <bootsplash.h> |
Matt DeVillier | bcb67ed | 2022-12-16 17:25:01 -0600 | [diff] [blame] | 10 | #include <console/console.h> |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 11 | #include <device/pci.h> |
| 12 | #include <fsp/api.h> |
| 13 | #include <program_loading.h> |
| 14 | |
| 15 | static void fsp_assign_vbios_upds(FSP_S_CONFIG *scfg) |
| 16 | { |
Matt DeVillier | 65a4445 | 2023-02-16 09:57:40 -0600 | [diff] [blame] | 17 | if (CONFIG(USE_SELECTIVE_GOP_INIT) && vbios_cache_is_valid() && |
| 18 | !display_init_required()) { |
| 19 | scfg->vbios_buffer = 0; |
| 20 | printk(BIOS_SPEW, "%s: using VBIOS cache; skipping GOP driver.\n", __func__); |
| 21 | return; |
| 22 | |
Matt DeVillier | bcb67ed | 2022-12-16 17:25:01 -0600 | [diff] [blame] | 23 | } |
| 24 | printk(BIOS_SPEW, "%s: not using VBIOS cache; running GOP driver.\n", __func__); |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 25 | scfg->vbios_buffer = CONFIG(RUN_FSP_GOP) ? PCI_VGA_RAM_IMAGE_START : 0; |
| 26 | } |
| 27 | |
| 28 | void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd) |
| 29 | { |
| 30 | FSP_S_CONFIG *scfg = &supd->FspsConfig; |
| 31 | |
| 32 | fsp_assign_vbios_upds(scfg); |
| 33 | |
| 34 | /* |
| 35 | * At this point FSP-S has been loaded into RAM. If we were to start loading the APOB |
| 36 | * before FSP-S was loaded, we would introduce contention onto the SPI bus and |
| 37 | * slow down the FSP-S read from SPI. Since FSP-S takes a while to execute and performs |
| 38 | * no SPI operations, we can read the APOB while FSP-S executes. |
| 39 | */ |
| 40 | start_apob_cache_read(); |
| 41 | /* |
| 42 | * We enqueue the payload to be loaded after the APOB. This might cause a bit of |
| 43 | * bus contention when loading uCode and OPROMs, but since those calls happen at |
| 44 | * different points in the boot state machine it's a little harder to sequence all the |
| 45 | * async loading correctly. So in order to keep the complexity down, we enqueue the |
| 46 | * payload preload here. The end goal will be to add uCode and OPROM preloading |
| 47 | * before the payload so that the sequencing is correct. |
| 48 | * |
| 49 | * While FSP-S is executing, it's not currently possible to enqueue other transactions |
| 50 | * because FSP-S doesn't call `thread_yield()`. So the payload will start loading |
| 51 | * right after FSP-S completes. |
| 52 | */ |
| 53 | if (!acpi_is_wakeup_s3()) |
| 54 | payload_preload(); |
| 55 | } |
Karthikeyan Ramasubramanian | 47b393a | 2023-10-13 16:18:56 +0000 | [diff] [blame^] | 56 | |
| 57 | void soc_load_logo(FSPS_UPD *supd) |
| 58 | { |
| 59 | uint32_t logo_size; |
| 60 | bmp_load_logo(&supd->FspsConfig.logo_bmp_buffer, &logo_size); |
| 61 | } |