coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
OemCustomize.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <Porting.h>
4 #include <AGESA.h>
5 
7 #include <PlatformMemoryConfiguration.h>
8 
9 /*
10  * Lane ID Mapping (from Fam15h BKDG: Table 45: Lane Id Mapping)
11  *
12  * Lane Id
13  * 0 P_UMI_[T,R]X[P,N]0 - southbridge link, connect via dev 8
14  * 1 P_UMI_[T,R]X[P,N]1 - southbridge link, connect via dev 8
15  * 2 P_UMI_[T,R]X[P,N]2 - southbridge link, connect via dev 8
16  * 3 P_UMI_[T,R]X[P,N]3 - southbridge link, connect via dev 8
17  * 4 P_GPP_[T,R]X[P,N]0 - may connect to PCI dev 4 - 7
18  * 5 P_GPP_[T,R]X[P,N]1 - may connect to PCI dev 4 - 7
19  * 6 P_GPP_[T,R]X[P,N]2 - may connect to PCI dev 4 - 7
20  * 7 P_GPP_[T,R]X[P,N]3 - may connect to PCI dev 4 - 7
21  * 8 P_GFX_[T,R]X[P,N]0 - may be used to form GFX slot or DDI
22  * 9 P_GFX_[T,R]X[P,N]1 - may be used to form GFX slot or DDI
23  * 10 P_GFX_[T,R]X[P,N]2 - may be used to form GFX slot or DDI
24  * 11 P_GFX_[T,R]X[P,N]3 - may be used to form GFX slot or DDI
25  * 12 P_GFX_[T,R]X[P,N]4 - may be used to form GFX slot or DDI
26  * 13 P_GFX_[T,R]X[P,N]5 - may be used to form GFX slot or DDI
27  * 14 P_GFX_[T,R]X[P,N]6 - may be used to form GFX slot or DDI
28  * 15 P_GFX_[T,R]X[P,N]7 - may be used to form GFX slot or DDI
29  * 16 P_GFX_[T,R]X[P,N]8 - may be used to form GFX slot or DDI
30  * 17 P_GFX_[T,R]X[P,N]9 - may be used to form GFX slot or DDI
31  * 18 P_GFX_[T,R]X[P,N]10 - may be used to form GFX slot or DDI
32  * 19 P_GFX_[T,R]X[P,N]11 - may be used to form GFX slot or DDI
33  * 20 P_GFX_[T,R]X[P,N]12 - may be used to form GFX slot or DDI
34  * 21 P_GFX_[T,R]X[P,N]13 - may be used to form GFX slot or DDI
35  * 22 P_GFX_[T,R]X[P,N]14 - may be used to form GFX slot or DDI
36  * 23 P_GFX_[T,R]X[P,N]15 - may be used to form GFX slot or DDI
37  * 24 DP0_TX[P,N]0 - rest is just for DDI (graphics outputs)
38  * 25 DP0_TX[P,N]1
39  * 26 DP0_TX[P,N]2
40  * 27 DP0_TX[P,N]3
41  * 28 DP1_TX[P,N]0
42  * 29 DP1_TX[P,N]1
43  * 30 DP1_TX[P,N]2
44  * 31 DP1_TX[P,N]3
45  * 32 DP2_TX[P,N]0
46  * 33 DP2_TX[P,N]1
47  * 34 DP2_TX[P,N]2
48  * 35 DP2_TX[P,N]3
49  * 36 DP2_TX[P,N]4
50  * 37 DP2_TX[P,N]5
51  * 38 DP2_TX[P,N]6
52  */
53 
54 static const PCIe_PORT_DESCRIPTOR PortList[] = {
55  /* PCIe port, Lanes 8:23, PCI Device Number 2, blue x16 slot */
56  {
57  0,
58  PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 8, 23),
59  PCIE_PORT_DATA_INITIALIZER(PortEnabled, ChannelTypeExt6db, 2,
60  HotplugDisabled,
61  PcieGenMaxSupported,
62  PcieGenMaxSupported,
63  AspmDisabled, 1)
64  },
65  /* PCIe port, Lanes 4:7, PCI Device Number 4, black x16 slot (in fact x4) */
66  {
67  0,
68  PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 4, 7),
69  PCIE_PORT_DATA_INITIALIZER(PortEnabled, ChannelTypeExt6db, 4,
70  HotplugDisabled,
71  PcieGenMaxSupported,
72  PcieGenMaxSupported,
73  AspmDisabled, 1)
74  },
75  /* PCIe port, Lanes 0:3, UMI link to SB, PCI Device Number 8 */
76  {
77  DESCRIPTOR_TERMINATE_LIST,
78  PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 0, 3),
79  PCIE_PORT_DATA_INITIALIZER(PortEnabled, ChannelTypeExt6db, 8,
80  HotplugDisabled,
81  PcieGenMaxSupported,
82  PcieGenMaxSupported,
83  AspmDisabled, 0)
84  },
85 };
86 
87 /*
88  * It is not known, if the setup is complete.
89  *
90  * Tested and works: VGA/DVI, HDMI
91  */
92 static const PCIe_DDI_DESCRIPTOR DdiList[] = {
93  // DP0 to HDMI0/DP
94  {
95  0,
96  PCIE_ENGINE_DATA_INITIALIZER(PcieDdiEngine, 24, 27),
97  PCIE_DDI_DATA_INITIALIZER(ConnectorTypeHDMI, Aux1, Hdp1)
98  },
99  // DP1 to FCH
100  {
101  0,
102  PCIE_ENGINE_DATA_INITIALIZER(PcieDdiEngine, 28, 31),
103  PCIE_DDI_DATA_INITIALIZER(ConnectorTypeNutmegDpToVga, Aux2, Hdp2)
104  },
105  // DP2 to HDMI1/DP
106  {
107  0,
108  PCIE_ENGINE_DATA_INITIALIZER(PcieDdiEngine, 32, 35),
109  PCIE_DDI_DATA_INITIALIZER(ConnectorTypeHDMI, Aux3, Hdp3)
110  },
111 };
112 
113 static const PCIe_COMPLEX_DESCRIPTOR PcieComplex = {
114  .Flags = DESCRIPTOR_TERMINATE_LIST,
115  .SocketId = 0,
116  .PciePortList = PortList,
117  .DdiLinkList = DdiList,
118 };
119 
120 void board_BeforeInitReset(struct sysinfo *cb, AMD_RESET_PARAMS *Reset)
121 {
122  FCH_RESET_INTERFACE *FchReset = &Reset->FchInterface;
123  FchReset->Xhci0Enable = CONFIG(HUDSON_XHCI_ENABLE);
124  FchReset->Xhci1Enable = CONFIG(HUDSON_XHCI_ENABLE);
125 }
126 
127 void board_BeforeInitEarly(struct sysinfo *cb, AMD_EARLY_PARAMS *InitEarly)
128 {
129  InitEarly->GnbConfig.PcieComplexList = &PcieComplex;
130  InitEarly->GnbConfig.PsppPolicy = 0;
131 }
132 
133 /* CUSTOMER OVERRIDES MEMORY TABLE */
134 /*
135  * Platform Specific Overriding Table allows IBV/OEM to pass in platform information to AGESA
136  * (e.g. MemClk routing, the number of DIMM slots per channel,...). If PlatformSpecificTable
137  * is populated, AGESA will base its settings on the data from the table. Otherwise, it will
138  * use its default conservative settings.
139  */
140 
141 static CONST PSO_ENTRY ROMDATA MemoryTable_XM_E[] = {
142 
143  NUMBER_OF_DIMMS_SUPPORTED(ANY_SOCKET, ANY_CHANNEL, 1),
144  NUMBER_OF_CHANNELS_SUPPORTED(ANY_SOCKET, 2),
145 
146  PSO_END
147 };
148 
149 void board_BeforeInitPost(struct sysinfo *cb, AMD_POST_PARAMS *InitPost)
150 {
151  InitPost->MemConfig.PlatformMemoryConfiguration = (PSO_ENTRY *) MemoryTable_XM_E;
152 }
153 
154 void board_BeforeInitMid(struct sysinfo *cb, AMD_MID_PARAMS *InitMid)
155 {
156  /* 0 iGpuVgaAdapter, 1 iGpuVgaNonAdapter; */
157  InitMid->GnbMidConfiguration.iGpuVgaMode = 0;
158 }
void board_BeforeInitEarly(struct sysinfo *cb, AMD_EARLY_PARAMS *InitEarly)
Definition: OemCustomize.c:72
void board_BeforeInitPost(struct sysinfo *cb, AMD_POST_PARAMS *InitPost)
Definition: OemCustomize.c:95
void board_BeforeInitReset(struct sysinfo *cb, AMD_RESET_PARAMS *Reset)
Definition: OemCustomize.c:88
void board_BeforeInitMid(struct sysinfo *cb, AMD_MID_PARAMS *InitMid)
Definition: OemCustomize.c:135
static const PCIe_COMPLEX_DESCRIPTOR PcieComplex
Definition: OemCustomize.c:113
static const PCIe_DDI_DESCRIPTOR DdiList[]
Definition: OemCustomize.c:92
static const PCIe_PORT_DESCRIPTOR PortList[]
Definition: OemCustomize.c:54
static CONST PSO_ENTRY ROMDATA MemoryTable_XM_E[]
Definition: OemCustomize.c:141
@ CONFIG
Definition: dsi_common.h:201