payloads/edk2: Disable the CPU Timer Lib unless supported
[coreboot.git] / src / mainboard / pcengines / apu1 / BiosCallOuts.c
blobaff72ca0cd767ee16f058903e0ace0e076fb2aab
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
4 #include <AGESA.h>
5 #include <spd_bin.h>
6 #include <northbridge/amd/agesa/BiosCallOuts.h>
7 #include <SB800.h>
9 #include "gpio_ftns.h"
11 static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINTN Data, VOID *ConfigPtr);
12 static AGESA_STATUS board_ReadSpd_from_cbfs(UINT32 Func, UINTN Data, VOID *ConfigPtr);
14 const BIOS_CALLOUT_STRUCT BiosCallouts[] =
16 {AGESA_DO_RESET, agesa_Reset },
17 {AGESA_READ_SPD, board_ReadSpd_from_cbfs },
18 {AGESA_READ_SPD_RECOVERY, agesa_NoopUnsupported },
19 {AGESA_RUNFUNC_ONAP, agesa_RunFuncOnAp },
20 {AGESA_GNB_PCIE_SLOT_RESET, agesa_NoopSuccess },
21 {AGESA_HOOKBEFORE_DRAM_INIT, board_BeforeDramInit },
22 {AGESA_HOOKBEFORE_DRAM_INIT_RECOVERY, agesa_NoopSuccess },
23 {AGESA_HOOKBEFORE_DQS_TRAINING, agesa_NoopSuccess },
24 {AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess },
26 const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
28 /* Call the host environment interface to provide a user hook opportunity. */
29 static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINTN Data, VOID *ConfigPtr)
31 // Unlike e.g. AMD Inagua, Persimmon is unable to vary the RAM voltage.
32 // Make sure the right speed settings are selected.
33 ((MEM_DATA_STRUCT*)ConfigPtr)->ParameterListPtr->DDR3Voltage = VOLT1_5;
34 return AGESA_SUCCESS;
37 static AGESA_STATUS board_ReadSpd_from_cbfs(UINT32 Func, UINTN Data, VOID *ConfigPtr)
39 AGESA_READ_SPD_PARAMS *info = ConfigPtr;
41 if (!ENV_RAMINIT)
42 return AGESA_UNSUPPORTED;
44 u8 index = get_spd_offset();
46 if (info->MemChannelId > 0)
47 return AGESA_UNSUPPORTED;
48 if (info->SocketId != 0)
49 return AGESA_UNSUPPORTED;
50 if (info->DimmId != 0)
51 return AGESA_UNSUPPORTED;
53 /* Read index 0, first SPD_SIZE bytes of spd.bin file. */
54 if (read_ddr3_spd_from_cbfs((u8*)info->Buffer, index) < 0)
55 die("No SPD data\n");
57 return AGESA_SUCCESS;