blob: 3b1c903b3a62d39f954bbd0bc19ccf0a8ef3656d [file] [log] [blame]
WANG Siyuanf77f7342013-08-13 17:09:51 +08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2012 Advanced Micro Devices, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
WANG Siyuanf77f7342013-08-13 17:09:51 +080014 */
15
Elyes HAOUAS19f5ba82018-10-14 14:52:06 +020016#include <AGESA.h>
Kyösti Mälkki53052fe2016-04-27 09:04:11 +030017#include <PlatformMemoryConfiguration.h>
WANG Siyuanf77f7342013-08-13 17:09:51 +080018
Kyösti Mälkkiaeadd842017-03-04 07:33:30 +020019#include <northbridge/amd/agesa/state_machine.h>
Kyösti Mälkki34ad72c2014-10-21 13:43:46 +030020
WANG Siyuanf77f7342013-08-13 17:09:51 +080021
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030022static const PCIe_PORT_DESCRIPTOR PortList[] = {
WANG Siyuanf77f7342013-08-13 17:09:51 +080023 {
Kyösti Mälkki9d035fa2015-05-23 14:27:44 +030024 0,
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030025 PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 3, 3),
26 PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db, 2, 5,
WANG Siyuanf77f7342013-08-13 17:09:51 +080027 HotplugDisabled,
28 PcieGenMaxSupported,
29 PcieGenMaxSupported,
30 AspmDisabled, 0x01, 0)
31 },
32 /* Initialize Port descriptor (PCIe port, Lanes 1, PCI Device Number 2, ...) */
33 {
Kyösti Mälkki9d035fa2015-05-23 14:27:44 +030034 0,
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030035 PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 2, 2),
36 PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db, 2, 4,
WANG Siyuanf77f7342013-08-13 17:09:51 +080037 HotplugDisabled,
38 PcieGenMaxSupported,
39 PcieGenMaxSupported,
40 AspmDisabled, 0x02, 0)
41 },
42 /* Initialize Port descriptor (PCIe port, Lanes 2, PCI Device Number 2, ...) */
43 {
Kyösti Mälkki9d035fa2015-05-23 14:27:44 +030044 0,
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030045 PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 1, 1),
46 PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db, 2, 3,
WANG Siyuanf77f7342013-08-13 17:09:51 +080047 HotplugDisabled,
48 PcieGenMaxSupported,
49 PcieGenMaxSupported,
50 AspmDisabled, 0x03, 0)
51 },
52 /* Initialize Port descriptor (PCIe port, Lanes 3, PCI Device Number 2, ...) */
53 {
54 0,
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030055 PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 0, 0),
56 PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db, 2, 2,
WANG Siyuanf77f7342013-08-13 17:09:51 +080057 HotplugDisabled,
58 PcieGenMaxSupported,
59 PcieGenMaxSupported,
60 AspmDisabled, 0x04, 0)
61 },
62 /* Initialize Port descriptor (PCIe port, Lanes 4-7, PCI Device Number 4, ...) */
63 {
Kyösti Mälkki9d035fa2015-05-23 14:27:44 +030064 DESCRIPTOR_TERMINATE_LIST,
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030065 PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 4, 7),
66 PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db, 2, 1,
WANG Siyuanf77f7342013-08-13 17:09:51 +080067 HotplugDisabled,
68 PcieGenMaxSupported,
69 PcieGenMaxSupported,
70 AspmDisabled, 0x05, 0)
71 }
72};
73
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030074static const PCIe_DDI_DESCRIPTOR DdiList[] = {
WANG Siyuanf77f7342013-08-13 17:09:51 +080075 /* DP0 to HDMI0/DP */
76 {
77 0,
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030078 PCIE_ENGINE_DATA_INITIALIZER(PcieDdiEngine, 8, 11),
79 PCIE_DDI_DATA_INITIALIZER(ConnectorTypeHDMI, Aux1, Hdp1)
WANG Siyuanf77f7342013-08-13 17:09:51 +080080 },
81 /* DP1 to FCH */
82 {
83 0,
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030084 PCIE_ENGINE_DATA_INITIALIZER(PcieDdiEngine, 12, 15),
85 PCIE_DDI_DATA_INITIALIZER(ConnectorTypeHDMI, Aux2, Hdp2)
WANG Siyuanf77f7342013-08-13 17:09:51 +080086 },
87 /* DP2 to HDMI1/DP */
88 {
89 DESCRIPTOR_TERMINATE_LIST,
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030090 PCIE_ENGINE_DATA_INITIALIZER(PcieDdiEngine, 16, 19),
91 PCIE_DDI_DATA_INITIALIZER(ConnectorTypeCrt, Aux3, Hdp3)
WANG Siyuanf77f7342013-08-13 17:09:51 +080092 },
93};
94
95static const PCIe_COMPLEX_DESCRIPTOR PcieComplex = {
96 .Flags = DESCRIPTOR_TERMINATE_LIST,
97 .SocketId = 0,
98 .PciePortList = PortList,
99 .DdiLinkList = DdiList
100};
101
Kyösti Mälkkiaeadd842017-03-04 07:33:30 +0200102void board_BeforeInitReset(struct sysinfo *cb, AMD_RESET_PARAMS *Reset)
103{
104 FCH_RESET_INTERFACE *FchReset = &Reset->FchInterface;
105 FchReset->Xhci0Enable = IS_ENABLED(CONFIG_HUDSON_XHCI_ENABLE);
106 FchReset->Xhci1Enable = FALSE;
107}
108
Kyösti Mälkkiaeadd842017-03-04 07:33:30 +0200109void board_BeforeInitEarly(struct sysinfo *cb, AMD_EARLY_PARAMS *InitEarly)
WANG Siyuanf77f7342013-08-13 17:09:51 +0800110{
Kyösti Mälkki87df2672017-09-23 14:36:16 +0300111 InitEarly->GnbConfig.PcieComplexList = &PcieComplex;
Kyösti Mälkki296696d2014-12-16 09:29:56 +0200112}
113
Kyösti Mälkki53052fe2016-04-27 09:04:11 +0300114/*----------------------------------------------------------------------------------------
115 * CUSTOMER OVERIDES MEMORY TABLE
116 *----------------------------------------------------------------------------------------
117 */
118
119/*
120 * Platform Specific Overriding Table allows IBV/OEM to pass in platform information to AGESA
121 * (e.g. MemClk routing, the number of DIMM slots per channel,...). If PlatformSpecificTable
122 * is populated, AGESA will base its settings on the data from the table. Otherwise, it will
123 * use its default conservative settings.
124 */
Kyösti Mälkkiaeadd842017-03-04 07:33:30 +0200125static CONST PSO_ENTRY ROMDATA PlatformMemoryTable[] = {
Kyösti Mälkki53052fe2016-04-27 09:04:11 +0300126
127 #define SEED_A 0x12
128 HW_RXEN_SEED(
129 ANY_SOCKET, CHANNEL_A, ALL_DIMMS,
130 SEED_A, SEED_A, SEED_A, SEED_A, SEED_A, SEED_A, SEED_A, SEED_A,
131 SEED_A),
132
Kyösti Mälkkie52738b2017-09-21 12:32:43 +0300133 NUMBER_OF_DIMMS_SUPPORTED(ANY_SOCKET, ANY_CHANNEL, 2),
134 NUMBER_OF_CHANNELS_SUPPORTED(ANY_SOCKET, 1),
135 MOTHER_BOARD_LAYERS(LAYERS_4),
Kyösti Mälkki53052fe2016-04-27 09:04:11 +0300136
Kyösti Mälkkie52738b2017-09-21 12:32:43 +0300137 MEMCLK_DIS_MAP(ANY_SOCKET, ANY_CHANNEL, 0x01, 0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00),
138 CKE_TRI_MAP(ANY_SOCKET, ANY_CHANNEL, 0x01, 0x02, 0x04, 0x08), /* TODO: bit2map, bit3map */
139 ODT_TRI_MAP(ANY_SOCKET, ANY_CHANNEL, 0x01, 0x02, 0x04, 0x08),
140 CS_TRI_MAP(ANY_SOCKET, ANY_CHANNEL, 0x01, 0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00),
Kyösti Mälkki53052fe2016-04-27 09:04:11 +0300141
142 PSO_END
143};
144
Kyösti Mälkkiaeadd842017-03-04 07:33:30 +0200145void board_BeforeInitPost(struct sysinfo *cb, AMD_POST_PARAMS *InitPost)
146{
147 InitPost->MemConfig.PlatformMemoryConfiguration = (PSO_ENTRY *)PlatformMemoryTable;
148}
149
150void board_BeforeInitMid(struct sysinfo *cb, AMD_MID_PARAMS *InitMid)
151{
152 /* 0 iGpuVgaAdapter, 1 iGpuVgaNonAdapter; */
153 InitMid->GnbMidConfiguration.iGpuVgaMode = 0;
154}