coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
BiosCallOuts.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <AGESA.h>
4 #include <console/console.h>
6 #include <SB800.h>
8 
9 /* Should AGESA_GNB_PCIE_SLOT_RESET use agesa_NoopSuccess?
10  *
11  * COM Express doesn't provide dedicated resets for individual lanes
12  * and it's not needed for the on-board Intel I210 GbE controller.
13  */
14 
15 static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINTN Data, VOID *ConfigPtr);
16 
18 {
19  {AGESA_DO_RESET, agesa_Reset },
20  {AGESA_READ_SPD, agesa_ReadSpd },
21  {AGESA_READ_SPD_RECOVERY, agesa_NoopUnsupported },
22  {AGESA_RUNFUNC_ONAP, agesa_RunFuncOnAp },
23  {AGESA_GNB_PCIE_SLOT_RESET, agesa_NoopUnsupported },
24  {AGESA_HOOKBEFORE_DRAM_INIT, board_BeforeDramInit },
25  {AGESA_HOOKBEFORE_DRAM_INIT_RECOVERY, agesa_NoopSuccess },
26  {AGESA_HOOKBEFORE_DQS_TRAINING, agesa_NoopSuccess },
27  {AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess },
28 };
30 
31 /* Call the host environment interface to provide a user hook opportunity. */
32 static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINTN Data, VOID *ConfigPtr)
33 {
34  MEM_DATA_STRUCT *MemData = ConfigPtr;
35 
36  printk(BIOS_INFO, "Setting DDR3 voltage: ");
37  FCH_IOMUX(65) = 1; // GPIO65: VMEM_LV_EN# lowers VMEM from 1.5 to 1.35V
38  switch (MemData->ParameterListPtr->DDR3Voltage) {
39  case VOLT1_25: // board is not able to provide this
40  MemData->ParameterListPtr->DDR3Voltage = VOLT1_35; // sorry
41  printk(BIOS_INFO, "can't provide 1.25 V, using ");
43  default: // AGESA.h says in mixed case 1.5V DIMMs get excluded
44  case VOLT1_35:
45  FCH_GPIO(65) = 0x08; // = output, disable PU, set to 0
46  printk(BIOS_INFO, "1.35 V\n");
47  break;
48  case VOLT1_5:
49  FCH_GPIO(65) = 0xC8; // = output, disable PU, set to 1
50  printk(BIOS_INFO, "1.5 V\n");
51  }
52 
53  return AGESA_SUCCESS;
54 }
#define AGESA_SUCCESS
Definition: Amd.h:38
unsigned int AGESA_STATUS
Definition: Amd.h:36
#define ARRAY_SIZE(a)
Definition: helpers.h:12
#define printk(level,...)
Definition: stdlib.h:16
#define __fallthrough
Definition: compiler.h:39
AGESA_STATUS agesa_RunFuncOnAp(UINT32 Func, UINTN Data, VOID *ConfigPtr)
Definition: def_callouts.c:102
AGESA_STATUS agesa_NoopUnsupported(UINT32 Func, UINTN Data, VOID *ConfigPtr)
Definition: def_callouts.c:48
AGESA_STATUS agesa_NoopSuccess(UINT32 Func, UINTN Data, VOID *ConfigPtr)
Definition: def_callouts.c:53
AGESA_STATUS agesa_Reset(UINT32 Func, UINTN Data, VOID *ConfigPtr)
Definition: def_callouts.c:66
#define FCH_GPIO(gpio_nr)
Definition: gpio_oem.h:18
#define FCH_IOMUX(gpio_nr)
Definition: gpio_oem.h:16
#define BIOS_INFO
BIOS_INFO - Expected events.
Definition: loglevel.h:113
const int BiosCalloutsLen
Definition: BiosCallOuts.c:25
const BIOS_CALLOUT_STRUCT BiosCallouts[]
Definition: BiosCallOuts.c:13
static AGESA_STATUS board_BeforeDramInit(UINT32 Func, UINTN Data, VOID *ConfigPtr)
Definition: BiosCallOuts.c:32
AGESA_STATUS agesa_ReadSpd(uint32_t Func, uintptr_t Data, void *ConfigPtr)
Definition: BiosCallOuts.c:81