| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <acpi/acpi.h> |
| 4 | #include <amdblocks/apob_cache.h> |
| 5 | #include <amdblocks/vbt.h> |
| 6 | #include <device/pci.h> |
| 7 | #include <fsp/api.h> |
| 8 | #include <program_loading.h> |
| 9 | |
| 10 | static void fsp_assign_vbios_upds(FSP_S_CONFIG *scfg) |
| 11 | { |
| 12 | /* |
| 13 | * The VBIOS contains the ATOMBIOS tables that will be modified as |
| 14 | * part of FSP GOP init. We can delay loading of the VBIOS until |
| 15 | * before FSP notify AFTER_PCI_ENUM. |
| 16 | */ |
| 17 | scfg->vbios_buffer = (uintptr_t)vbt_get(); |
| 18 | } |
| 19 | |
| 20 | void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd) |
| 21 | { |
| 22 | FSP_S_CONFIG *scfg = &supd->FspsConfig; |
| 23 | |
| 24 | fsp_assign_vbios_upds(scfg); |
| 25 | |
| 26 | /* |
| 27 | * At this point FSP-S has been loaded into RAM. If we were to start loading the APOB |
| 28 | * before FSP-S was loaded, we would introduce contention onto the SPI bus and |
| 29 | * slow down the FSP-S read from SPI. Since FSP-S takes a while to execute and performs |
| 30 | * no SPI operations, we can read the APOB while FSP-S executes. |
| 31 | */ |
| 32 | start_apob_cache_read(); |
| 33 | /* |
| 34 | * We enqueue the payload to be loaded after the APOB. This might cause a bit of |
| 35 | * bus contention when loading uCode and OPROMs, but since those calls happen at |
| 36 | * different points in the boot state machine it's a little harder to sequence all the |
| 37 | * async loading correctly. So in order to keep the complexity down, we enqueue the |
| 38 | * payload preload here. The end goal will be to add uCode and OPROM preloading |
| 39 | * before the payload so that the sequencing is correct. |
| 40 | * |
| 41 | * While FSP-S is executing, it's not currently possible to enqueue other transactions |
| 42 | * because FSP-S doesn't call `thread_yield()`. So the payload will start loading |
| 43 | * right after FSP-S completes. |
| 44 | */ |
| 45 | if (!acpi_is_wakeup_s3()) |
| 46 | payload_preload(); |
| 47 | } |