blob: 60f39428022323c2064ef9e214b4df1925e924b4 [file] [log] [blame]
Felix Held8d0a6092021-01-14 01:40:50 +01001/* SPDX-License-Identifier: GPL-2.0-only */
2
Raul E Rangel73193cf2021-07-16 13:53:29 -06003#include <acpi/acpi.h>
Raul E Rangel61f441272021-06-25 11:24:38 -06004#include <amdblocks/apob_cache.h>
Nikolai Vyssotski42cd4dd2021-03-11 19:29:51 -06005#include <device/pci.h>
Raul E Rangel61f441272021-06-25 11:24:38 -06006#include <fsp/api.h>
Raul E Rangel73193cf2021-07-16 13:53:29 -06007#include <program_loading.h>
Felix Held8d0a6092021-01-14 01:40:50 +01008
Nikolai Vyssotski2d241462021-02-11 20:08:22 -06009static void fsp_assign_vbios_upds(FSP_S_CONFIG *scfg)
10{
Matt Papageorge5f5ca0c2021-03-25 11:22:47 -050011 scfg->vbios_buffer = CONFIG(RUN_FSP_GOP) ? PCI_VGA_RAM_IMAGE_START : 0;
Nikolai Vyssotski2d241462021-02-11 20:08:22 -060012}
13
Felix Held8d0a6092021-01-14 01:40:50 +010014void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
15{
Nikolai Vyssotski2d241462021-02-11 20:08:22 -060016 FSP_S_CONFIG *scfg = &supd->FspsConfig;
17
18 fsp_assign_vbios_upds(scfg);
Raul E Rangel61f441272021-06-25 11:24:38 -060019
20 /*
Raul Rangel0b370362023-05-08 18:02:28 +000021 * At this point FSP-S has been loaded into RAM. If we were to start loading the APOB
22 * before FSP-S was loaded, we would introduce contention onto the SPI bus and
23 * slow down the FSP-S read from SPI. Since FSP-S takes a while to execute and performs
24 * no SPI operations, we can read the APOB while FSP-S executes.
Raul E Rangel61f441272021-06-25 11:24:38 -060025 */
26 start_apob_cache_read();
Raul E Rangel73193cf2021-07-16 13:53:29 -060027 /*
28 * We enqueue the payload to be loaded after the APOB. This might cause a bit of
29 * bus contention when loading uCode and OPROMs, but since those calls happen at
30 * different points in the boot state machine it's a little harder to sequence all the
31 * async loading correctly. So in order to keep the complexity down, we enqueue the
32 * payload preload here. The end goal will be to add uCode and OPROM preloading
33 * before the payload so that the sequencing is correct.
34 *
35 * While FSP-S is executing, it's not currently possible to enqueue other transactions
36 * because FSP-S doesn't call `thread_yield()`. So the payload will start loading
37 * right after FSP-S completes.
38 */
39 if (!acpi_is_wakeup_s3())
40 payload_preload();
Felix Held8d0a6092021-01-14 01:40:50 +010041}