1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <PlatformMemoryConfiguration.h>
6 #include <northbridge/amd/agesa/state_machine.h>
9 * Lane ID Mapping (from Fam15h BKDG: Table 45: Lane Id Mapping)
12 * 0 P_UMI_[T,R]X[P,N]0 - southbridge link, connect via dev 8
13 * 1 P_UMI_[T,R]X[P,N]1 - southbridge link, connect via dev 8
14 * 2 P_UMI_[T,R]X[P,N]2 - southbridge link, connect via dev 8
15 * 3 P_UMI_[T,R]X[P,N]3 - southbridge link, connect via dev 8
16 * 4 P_GPP_[T,R]X[P,N]0 - may connect to PCI dev 4 - 7
17 * 5 P_GPP_[T,R]X[P,N]1 - may connect to PCI dev 4 - 7
18 * 6 P_GPP_[T,R]X[P,N]2 - may connect to PCI dev 4 - 7
19 * 7 P_GPP_[T,R]X[P,N]3 - may connect to PCI dev 4 - 7
20 * 8 P_GFX_[T,R]X[P,N]0 - may be used to form GFX slot or DDI
21 * 9 P_GFX_[T,R]X[P,N]1 - may be used to form GFX slot or DDI
22 * 10 P_GFX_[T,R]X[P,N]2 - may be used to form GFX slot or DDI
23 * 11 P_GFX_[T,R]X[P,N]3 - may be used to form GFX slot or DDI
24 * 12 P_GFX_[T,R]X[P,N]4 - may be used to form GFX slot or DDI
25 * 13 P_GFX_[T,R]X[P,N]5 - may be used to form GFX slot or DDI
26 * 14 P_GFX_[T,R]X[P,N]6 - may be used to form GFX slot or DDI
27 * 15 P_GFX_[T,R]X[P,N]7 - may be used to form GFX slot or DDI
28 * 16 P_GFX_[T,R]X[P,N]8 - may be used to form GFX slot or DDI
29 * 17 P_GFX_[T,R]X[P,N]9 - may be used to form GFX slot or DDI
30 * 18 P_GFX_[T,R]X[P,N]10 - may be used to form GFX slot or DDI
31 * 19 P_GFX_[T,R]X[P,N]11 - may be used to form GFX slot or DDI
32 * 20 P_GFX_[T,R]X[P,N]12 - may be used to form GFX slot or DDI
33 * 21 P_GFX_[T,R]X[P,N]13 - may be used to form GFX slot or DDI
34 * 22 P_GFX_[T,R]X[P,N]14 - may be used to form GFX slot or DDI
35 * 23 P_GFX_[T,R]X[P,N]15 - may be used to form GFX slot or DDI
36 * 24 DP0_TX[P,N]0 - rest is just for DDI (graphics outputs)
53 static const PCIe_PORT_DESCRIPTOR PortList
[] = {
54 /* PCIe port, Lanes 15:8, PCI Device Number 2, PCIE SLOT x8 */
57 PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine
, 15, 8),
58 PCIE_PORT_DATA_INITIALIZER(PortEnabled
, ChannelTypeExt6db
, 2,
64 /* PCIe port, Lanes 16:23, PCI Device Number 3, Disabled */
67 PCIE_ENGINE_DATA_INITIALIZER(PcieUnusedEngine
, 16, 23),
68 PCIE_PORT_DATA_INITIALIZER(PortDisabled
, ChannelTypeExt6db
, 3,
75 /* PCIe port, Lanes 4, PCI Device Number 4, LAN */
78 PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine
, 4, 4),
79 PCIE_PORT_DATA_INITIALIZER(PortEnabled
, ChannelTypeExt6db
, 4,
86 /* PCIe port, Lanes 5, PCI Device Number 5, PCIE MINI0 */
89 PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine
, 5, 5),
90 PCIE_PORT_DATA_INITIALIZER(PortEnabled
, ChannelTypeExt6db
, 5,
97 /* PCIe port, Lanes 6, PCI Device Number 6, PCIE MINI1 */
100 PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine
, 6, 6),
101 PCIE_PORT_DATA_INITIALIZER(PortEnabled
, ChannelTypeExt6db
, 6,
108 /* PCIe port, Lanes 7, PCI Device Number 7, Disabled */
111 PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine
, 7, 7),
112 PCIE_PORT_DATA_INITIALIZER(PortDisabled
, ChannelTypeExt6db
, 7,
119 /* PCIe port, Lanes 0:3, PCI Device Number 8, Bridge to FCH */
121 DESCRIPTOR_TERMINATE_LIST
,
122 PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine
, 0, 3),
123 PCIE_PORT_DATA_INITIALIZER(PortEnabled
, ChannelTypeExt6db
, 8,
131 static const PCIe_DDI_DESCRIPTOR DdiList
[] = {
135 PCIE_ENGINE_DATA_INITIALIZER(PcieDdiEngine
, 24, 27),
136 PCIE_DDI_DATA_INITIALIZER(ConnectorTypeDP
, Aux1
, Hdp1
)
141 PCIE_ENGINE_DATA_INITIALIZER(PcieDdiEngine
, 28, 31),
142 PCIE_DDI_DATA_INITIALIZER(ConnectorTypeDP
, Aux2
, Hdp2
)
144 // DP2 to MINI-DDI Card
146 DESCRIPTOR_TERMINATE_LIST
,
147 PCIE_ENGINE_DATA_INITIALIZER(PcieDdiEngine
, 32, 35),
148 PCIE_DDI_DATA_INITIALIZER(ConnectorTypeDP
, Aux3
, Hdp3
)
152 void board_BeforeInitReset(struct sysinfo
*cb
, AMD_RESET_PARAMS
*Reset
)
154 FCH_RESET_INTERFACE
*FchReset
= &Reset
->FchInterface
;
155 FchReset
->Xhci0Enable
= FALSE
;
156 FchReset
->Xhci1Enable
= FALSE
;
159 static const PCIe_COMPLEX_DESCRIPTOR PcieComplex
= {
160 .Flags
= DESCRIPTOR_TERMINATE_LIST
,
162 .PciePortList
= PortList
,
163 .DdiLinkList
= DdiList
,
166 void board_BeforeInitEarly(struct sysinfo
*cb
, AMD_EARLY_PARAMS
*InitEarly
)
168 InitEarly
->GnbConfig
.PcieComplexList
= &PcieComplex
;
171 /*----------------------------------------------------------------------------------------
172 * CUSTOMER OVERRIDES MEMORY TABLE
173 *----------------------------------------------------------------------------------------
177 * Platform Specific Overriding Table allows IBV/OEM to pass in platform information to AGESA
178 * (e.g. MemClk routing, the number of DIMM slots per channel,...). If PlatformSpecificTable
179 * is populated, AGESA will base its settings on the data from the table. Otherwise, it will
180 * use its default conservative settings.
182 static CONST PSO_ENTRY ROMDATA PlatformMemoryTable
[] = {
183 NUMBER_OF_DIMMS_SUPPORTED(ANY_SOCKET
, ANY_CHANNEL
, 1),
184 NUMBER_OF_CHANNELS_SUPPORTED(ANY_SOCKET
, 2),
185 MEMCLK_DIS_MAP(ANY_SOCKET
, ANY_CHANNEL
, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00),
186 CKE_TRI_MAP(ANY_SOCKET
, ANY_CHANNEL
, 0x05, 0x0A),
187 ODT_TRI_MAP(ANY_SOCKET
, ANY_CHANNEL
, 0x01, 0x02, 0x00, 0x00),
188 CS_TRI_MAP(ANY_SOCKET
, ANY_CHANNEL
, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00),
193 void board_BeforeInitPost(struct sysinfo
*cb
, AMD_POST_PARAMS
*InitPost
)
195 InitPost
->MemConfig
.PlatformMemoryConfiguration
= (PSO_ENTRY
*)PlatformMemoryTable
;
198 void board_BeforeInitMid(struct sysinfo
*cb
, AMD_MID_PARAMS
*InitMid
)
200 /* 0 iGpuVgaAdapter, 1 iGpuVgaNonAdapter; */
201 InitMid
->GnbMidConfiguration
.iGpuVgaMode
= 0;