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  * Dedicated reset is not needed for the on-board Intel I210 GbE controller.
12  */
13 
14 static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINTN Data, VOID *ConfigPtr);
15 
17 {
18  {AGESA_DO_RESET, agesa_Reset },
19  {AGESA_READ_SPD, agesa_ReadSpd },
20  {AGESA_READ_SPD_RECOVERY, agesa_NoopUnsupported },
21  {AGESA_RUNFUNC_ONAP, agesa_RunFuncOnAp },
22  {AGESA_GNB_PCIE_SLOT_RESET, agesa_NoopUnsupported },
23  {AGESA_HOOKBEFORE_DRAM_INIT, board_BeforeDramInit },
24  {AGESA_HOOKBEFORE_DRAM_INIT_RECOVERY, agesa_NoopSuccess },
25  {AGESA_HOOKBEFORE_DQS_TRAINING, agesa_NoopSuccess },
26  {AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess },
27 };
29 
30 /* Call the host environment interface to provide a user hook opportunity. */
31 static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINTN Data, VOID *ConfigPtr)
32 {
33  MEM_DATA_STRUCT *MemData = ConfigPtr;
34 
35  printk(BIOS_INFO, "Setting DDR3 voltage: ");
36  FCH_IOMUX(184) = 2; // GPIO184: VMEM_LV_EN# lowers VMEM from 1.5 to 1.35V
37  switch (MemData->ParameterListPtr->DDR3Voltage) {
38  case VOLT1_25: // board is not able to provide this
39  MemData->ParameterListPtr->DDR3Voltage = VOLT1_35; // sorry
40  printk(BIOS_INFO, "can't provide 1.25 V, using ");
42  default: // AGESA.h says in mixed case 1.5V DIMMs get excluded
43  case VOLT1_35:
44  FCH_GPIO(184) = 0x08; // = output, disable PU, set to 0
45  printk(BIOS_INFO, "1.35 V\n");
46  break;
47  case VOLT1_5:
48  FCH_GPIO(184) = 0xC8; // = output, disable PU, set to 1
49  printk(BIOS_INFO, "1.5 V\n");
50  }
51 
52  return AGESA_SUCCESS;
53 }
#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:31
AGESA_STATUS agesa_ReadSpd(uint32_t Func, uintptr_t Data, void *ConfigPtr)
Definition: BiosCallOuts.c:81