1 /* SPDX-License-Identifier: GPL-2.0-only */
5 #include <amdblocks/acpimmio.h>
6 #include <northbridge/amd/agesa/BiosCallOuts.h>
9 static AGESA_STATUS
board_BeforeDramInit (UINT32 Func
, UINTN Data
, VOID
*ConfigPtr
);
11 const BIOS_CALLOUT_STRUCT BiosCallouts
[] =
13 {AGESA_DO_RESET
, agesa_Reset
},
14 {AGESA_READ_SPD
, agesa_ReadSpd
},
15 {AGESA_READ_SPD_RECOVERY
, agesa_NoopUnsupported
},
16 {AGESA_RUNFUNC_ONAP
, agesa_RunFuncOnAp
},
17 {AGESA_HOOKBEFORE_DQS_TRAINING
, agesa_NoopSuccess
},
18 {AGESA_HOOKBEFORE_DRAM_INIT
, board_BeforeDramInit
},
19 {AGESA_HOOKBEFORE_EXIT_SELF_REF
, agesa_NoopSuccess
},
20 {AGESA_GNB_PCIE_SLOT_RESET
, agesa_NoopUnsupported
},
22 const int BiosCalloutsLen
= ARRAY_SIZE(BiosCallouts
);
24 /* Call the host environment interface to provide a user hook opportunity. */
25 static AGESA_STATUS
board_BeforeDramInit (UINT32 Func
, UINTN Data
, VOID
*ConfigPtr
)
28 MEM_DATA_STRUCT
*MemData
;
35 Status
= AGESA_SUCCESS
;
36 GpioMmioAddr
= (uintptr_t)acpimmio_gpio_100
;
38 Data8
= Read64Mem8(GpioMmioAddr
+SB_GPIO_REG178
);
40 TempData8
= Read64Mem8(GpioMmioAddr
+SB_GPIO_REG178
);
43 Write64Mem8(GpioMmioAddr
+SB_GPIO_REG178
, TempData8
);
47 TempData8
= Read64Mem8(GpioMmioAddr
+SB_GPIO_REG178
);
50 Write64Mem8(GpioMmioAddr
+SB_GPIO_REG178
, TempData8
);
51 Data8
= Read64Mem8(GpioMmioAddr
+SB_GPIO_REG179
);
53 TempData8
= Read64Mem8(GpioMmioAddr
+SB_GPIO_REG179
);
56 Write64Mem8(GpioMmioAddr
+SB_GPIO_REG179
, TempData8
);
59 TempData8
= Read64Mem8(GpioMmioAddr
+SB_GPIO_REG179
);
62 Write64Mem8(GpioMmioAddr
+SB_GPIO_REG179
, TempData8
);
65 * this seems to be just copy-pasted from the AMD reference boards and
66 * needs some investigation
68 switch (MemData
->ParameterListPtr
->DDR3Voltage
) {
70 Data8
= Read64Mem8(GpioMmioAddr
+SB_GPIO_REG178
);
71 Data8
&= ~(UINT8
)BIT6
;
72 Write64Mem8(GpioMmioAddr
+SB_GPIO_REG178
, Data8
);
73 Data8
= Read64Mem8(GpioMmioAddr
+SB_GPIO_REG179
);
75 Write64Mem8(GpioMmioAddr
+SB_GPIO_REG179
, Data8
);
78 Data8
= Read64Mem8(GpioMmioAddr
+SB_GPIO_REG178
);
79 Data8
&= ~(UINT8
)BIT6
;
80 Write64Mem8(GpioMmioAddr
+SB_GPIO_REG178
, Data8
);
81 Data8
= Read64Mem8(GpioMmioAddr
+SB_GPIO_REG179
);
82 Data8
&= ~(UINT8
)BIT6
;
83 Write64Mem8(GpioMmioAddr
+SB_GPIO_REG179
, Data8
);
87 Data8
= Read64Mem8(GpioMmioAddr
+SB_GPIO_REG178
);
89 Write64Mem8(GpioMmioAddr
+SB_GPIO_REG178
, Data8
);
90 Data8
= Read64Mem8(GpioMmioAddr
+SB_GPIO_REG179
);
91 Data8
&= ~(UINT8
)BIT6
;
92 Write64Mem8(GpioMmioAddr
+SB_GPIO_REG179
, Data8
);
94 /* disable memory clear for boot time reduction */
95 MemData
->ParameterListPtr
->EnableMemClr
= FALSE
;