blob: b98b2ac84625848438ca65f99be30768aa649415 [file] [log] [blame]
Dave Frodinc43bce52014-12-03 08:22:46 -07001/*
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.
Dave Frodinc43bce52014-12-03 08:22:46 -070014 */
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>
Dave Frodinc43bce52014-12-03 08:22:46 -070018
Kyösti Mälkki74e854c2017-03-05 14:21:39 +020019#include <northbridge/amd/agesa/state_machine.h>
Dave Frodinc43bce52014-12-03 08:22:46 -070020
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030021static const PCIe_PORT_DESCRIPTOR PortList[] = {
Dave Frodinc43bce52014-12-03 08:22:46 -070022 {
Kyösti Mälkki9d035fa2015-05-23 14:27:44 +030023 0,
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030024 PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 3, 3),
25 PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db, 2, 5,
Dave Frodinc43bce52014-12-03 08:22:46 -070026 HotplugDisabled,
27 PcieGenMaxSupported,
28 PcieGenMaxSupported,
29 AspmDisabled, 0x01, 0)
30 },
31 /* Initialize Port descriptor (PCIe port, Lanes 1, PCI Device Number 2, ...) */
32 {
Kyösti Mälkki9d035fa2015-05-23 14:27:44 +030033 0,
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030034 PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 2, 2),
35 PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db, 2, 4,
Dave Frodinc43bce52014-12-03 08:22:46 -070036 HotplugDisabled,
37 PcieGenMaxSupported,
38 PcieGenMaxSupported,
39 AspmDisabled, 0x02, 0)
40 },
41 /* Initialize Port descriptor (PCIe port, Lanes 2, PCI Device Number 2, ...) */
42 {
Kyösti Mälkki9d035fa2015-05-23 14:27:44 +030043 0,
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030044 PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 1, 1),
45 PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db, 2, 3,
Dave Frodinc43bce52014-12-03 08:22:46 -070046 HotplugDisabled,
47 PcieGenMaxSupported,
48 PcieGenMaxSupported,
49 AspmDisabled, 0x03, 0)
50 },
51 /* Initialize Port descriptor (PCIe port, Lanes 3, PCI Device Number 2, ...) */
52 {
53 0,
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030054 PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 0, 0),
55 PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db, 2, 2,
Dave Frodinc43bce52014-12-03 08:22:46 -070056 HotplugDisabled,
57 PcieGenMaxSupported,
58 PcieGenMaxSupported,
59 AspmDisabled, 0x04, 0)
60 },
61 /* Initialize Port descriptor (PCIe port, Lanes 4-7, PCI Device Number 4, ...) */
62 {
Kyösti Mälkki9d035fa2015-05-23 14:27:44 +030063 DESCRIPTOR_TERMINATE_LIST,
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030064 PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 4, 7),
65 PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db, 2, 1,
Dave Frodinc43bce52014-12-03 08:22:46 -070066 HotplugDisabled,
67 PcieGenMaxSupported,
68 PcieGenMaxSupported,
69 AspmDisabled, 0x05, 0)
70 }
71};
72
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030073static const PCIe_DDI_DESCRIPTOR DdiList[] = {
Dave Frodinc43bce52014-12-03 08:22:46 -070074 /* DP0 to HDMI0/DP */
75 {
76 0,
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030077 PCIE_ENGINE_DATA_INITIALIZER(PcieDdiEngine, 8, 11),
78 PCIE_DDI_DATA_INITIALIZER(ConnectorTypeHDMI, Aux1, Hdp1)
Dave Frodinc43bce52014-12-03 08:22:46 -070079 },
Dave Frodind6aa7cf2014-11-21 14:57:03 -070080 /* DP1 to high-speed edge connector */
Dave Frodinc43bce52014-12-03 08:22:46 -070081 {
82 DESCRIPTOR_TERMINATE_LIST,
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030083 PCIE_ENGINE_DATA_INITIALIZER(PcieDdiEngine, 12, 15),
84 PCIE_DDI_DATA_INITIALIZER(ConnectorTypeDP, Aux2, Hdp2)
Dave Frodinc43bce52014-12-03 08:22:46 -070085 },
86};
87
88static const PCIe_COMPLEX_DESCRIPTOR PcieComplex = {
89 .Flags = DESCRIPTOR_TERMINATE_LIST,
90 .SocketId = 0,
91 .PciePortList = PortList,
92 .DdiLinkList = DdiList
93};
94
Kyösti Mälkki74e854c2017-03-05 14:21:39 +020095void board_BeforeInitReset(struct sysinfo *cb, AMD_RESET_PARAMS *Reset)
96{
97 FCH_RESET_INTERFACE *FchReset = &Reset->FchInterface;
98 FchReset->Xhci0Enable = IS_ENABLED(CONFIG_HUDSON_XHCI_ENABLE);
99 FchReset->Xhci1Enable = FALSE;
100}
101
Kyösti Mälkki74e854c2017-03-05 14:21:39 +0200102void board_BeforeInitEarly(struct sysinfo *cb, AMD_EARLY_PARAMS *InitEarly)
Dave Frodinc43bce52014-12-03 08:22:46 -0700103{
Kyösti Mälkki87df2672017-09-23 14:36:16 +0300104 InitEarly->GnbConfig.PcieComplexList = &PcieComplex;
Kyösti Mälkki296696d2014-12-16 09:29:56 +0200105}
106
Kyösti Mälkki53052fe2016-04-27 09:04:11 +0300107/*----------------------------------------------------------------------------------------
108 * CUSTOMER OVERIDES MEMORY TABLE
109 *----------------------------------------------------------------------------------------
110 */
111
112/*
113 * Platform Specific Overriding Table allows IBV/OEM to pass in platform information to AGESA
114 * (e.g. MemClk routing, the number of DIMM slots per channel,...). If PlatformSpecificTable
115 * is populated, AGESA will base its settings on the data from the table. Otherwise, it will
116 * use its default conservative settings.
117 */
Kyösti Mälkki74e854c2017-03-05 14:21:39 +0200118static CONST PSO_ENTRY ROMDATA PlatformMemoryTable[] = {
Kyösti Mälkki53052fe2016-04-27 09:04:11 +0300119
120 #define SEED_WL 0x0E
121 WRITE_LEVELING_SEED(
122 ANY_SOCKET, CHANNEL_A, ALL_DIMMS,
123 SEED_WL,SEED_WL,SEED_WL,SEED_WL,SEED_WL,SEED_WL,SEED_WL,SEED_WL,
124 SEED_WL),
125
126 #define SEED_A 0x12
127 HW_RXEN_SEED(
128 ANY_SOCKET, CHANNEL_A, ALL_DIMMS,
129 SEED_A, SEED_A, SEED_A, SEED_A, SEED_A, SEED_A, SEED_A, SEED_A,
130 SEED_A),
131
Kyösti Mälkkie52738b2017-09-21 12:32:43 +0300132 NUMBER_OF_DIMMS_SUPPORTED(ANY_SOCKET, ANY_CHANNEL, 1),
133 NUMBER_OF_CHANNELS_SUPPORTED(ANY_SOCKET, 1),
134 MOTHER_BOARD_LAYERS(LAYERS_6),
Kyösti Mälkki53052fe2016-04-27 09:04:11 +0300135
Kyösti Mälkkie52738b2017-09-21 12:32:43 +0300136 MEMCLK_DIS_MAP(ANY_SOCKET, ANY_CHANNEL, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00),
137 CKE_TRI_MAP(ANY_SOCKET, ANY_CHANNEL, 0x01, 0x02, 0x04, 0x08), /* TODO: bit2map, bit3map */
138 ODT_TRI_MAP(ANY_SOCKET, ANY_CHANNEL, 0x01, 0x02, 0x04, 0x08),
139 CS_TRI_MAP(ANY_SOCKET, ANY_CHANNEL, 0x01, 0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00),
Kyösti Mälkki53052fe2016-04-27 09:04:11 +0300140
141 PSO_END
142};
143
Kyösti Mälkki74e854c2017-03-05 14:21:39 +0200144void board_BeforeInitPost(struct sysinfo *cb, AMD_POST_PARAMS *InitPost)
145{
146 InitPost->MemConfig.PlatformMemoryConfiguration = (PSO_ENTRY *)PlatformMemoryTable;
147}
148
149void board_BeforeInitMid(struct sysinfo *cb, AMD_MID_PARAMS *InitMid)
150{
151 /* 0 iGpuVgaAdapter, 1 iGpuVgaNonAdapter; */
152 InitMid->GnbMidConfiguration.iGpuVgaMode = 0;
153}