blob: 95af6ef92d56b217eb5f760630690b862ba107b5 [file] [log] [blame]
Angel Pons560796c2020-04-03 01:22:52 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Piotr Króldcd2f172016-05-27 12:04:13 +02002
Kyösti Mälkki525930b2017-09-23 16:21:02 +03003#include <AGESA.h>
Krystian Hebelf77f2c72019-04-19 17:59:38 +02004#include <northbridge/amd/agesa/state_machine.h>
Piotr Króldcd2f172016-05-27 12:04:13 +02005
Michał Żygowski8e232702021-04-29 17:53:10 +02006#include "gpio_ftns.h"
7
Kyösti Mälkkie52738b2017-09-21 12:32:43 +03008static const PCIe_PORT_DESCRIPTOR PortList[] = {
Piotr Króldcd2f172016-05-27 12:04:13 +02009 {
10 0,
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030011 PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 3, 3),
12 PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db, 2, 5,
Piotr Króldcd2f172016-05-27 12:04:13 +020013 HotplugDisabled,
14 PcieGenMaxSupported,
15 PcieGenMaxSupported,
Michał Żygowski8e46d422020-03-20 16:19:55 +010016 AspmL0sL1,
Michał Żygowski869ac712020-04-04 08:49:21 +000017 0x01,
Michał Żygowski03a34042020-03-31 13:36:23 +020018 0)
Piotr Króldcd2f172016-05-27 12:04:13 +020019 },
20 /* Initialize Port descriptor (PCIe port, Lanes 1, PCI Device Number 2, ...) */
21 {
22 0,
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030023 PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 2, 2),
24 PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db, 2, 4,
Piotr Króldcd2f172016-05-27 12:04:13 +020025 HotplugDisabled,
26 PcieGenMaxSupported,
27 PcieGenMaxSupported,
Michał Żygowski8e46d422020-03-20 16:19:55 +010028 AspmL0sL1,
Michał Żygowski869ac712020-04-04 08:49:21 +000029 0x02,
Michał Żygowski03a34042020-03-31 13:36:23 +020030 0)
Piotr Króldcd2f172016-05-27 12:04:13 +020031 },
32 /* Initialize Port descriptor (PCIe port, Lanes 2, PCI Device Number 2, ...) */
33 {
34 0,
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030035 PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 1, 1),
36 PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db, 2, 3,
Piotr Króldcd2f172016-05-27 12:04:13 +020037 HotplugDisabled,
38 PcieGenMaxSupported,
39 PcieGenMaxSupported,
Michał Żygowski8e46d422020-03-20 16:19:55 +010040 AspmL0sL1,
Michał Żygowski869ac712020-04-04 08:49:21 +000041 0x03,
Michał Żygowski03a34042020-03-31 13:36:23 +020042 0)
Piotr Króldcd2f172016-05-27 12:04:13 +020043 },
44 /* Initialize Port descriptor (PCIe port, Lanes 3, PCI Device Number 2, ...) */
45 {
46 0,
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030047 PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 0, 0),
48 PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db, 2, 2,
Piotr Króldcd2f172016-05-27 12:04:13 +020049 HotplugDisabled,
50 PcieGenMaxSupported,
51 PcieGenMaxSupported,
Michał Żygowski8e46d422020-03-20 16:19:55 +010052 AspmL0sL1,
Michał Żygowski869ac712020-04-04 08:49:21 +000053 0x04,
Michał Żygowski03a34042020-03-31 13:36:23 +020054 0)
Piotr Króldcd2f172016-05-27 12:04:13 +020055 },
56 /* Initialize Port descriptor (PCIe port, Lanes 4-7, PCI Device Number 4, ...) */
57 {
58 DESCRIPTOR_TERMINATE_LIST,
Kyösti Mälkkie52738b2017-09-21 12:32:43 +030059 PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 4, 7),
60 PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db, 2, 1,
Piotr Króldcd2f172016-05-27 12:04:13 +020061 HotplugDisabled,
62 PcieGenMaxSupported,
63 PcieGenMaxSupported,
Michał Żygowski8e46d422020-03-20 16:19:55 +010064 AspmL0sL1,
Michał Żygowski869ac712020-04-04 08:49:21 +000065 0x05,
Michał Żygowski03a34042020-03-31 13:36:23 +020066 0)
Piotr Króldcd2f172016-05-27 12:04:13 +020067 }
68};
69
Piotr Króldcd2f172016-05-27 12:04:13 +020070static const PCIe_COMPLEX_DESCRIPTOR PcieComplex = {
71 .Flags = DESCRIPTOR_TERMINATE_LIST,
72 .SocketId = 0,
73 .PciePortList = PortList,
Kyösti Mälkki77477572017-01-14 13:01:16 +020074 .DdiLinkList = NULL,
Piotr Króldcd2f172016-05-27 12:04:13 +020075};
76
Krystian Hebelf77f2c72019-04-19 17:59:38 +020077void board_BeforeInitEarly(struct sysinfo *cb, AMD_EARLY_PARAMS *InitEarly)
Piotr Króldcd2f172016-05-27 12:04:13 +020078{
79 InitEarly->GnbConfig.PcieComplexList = &PcieComplex;
Michał Żygowski7bfdf5b2019-02-04 15:22:01 +010080 InitEarly->PlatformConfig.CStateMode = CStateModeC6;
81 InitEarly->PlatformConfig.CpbMode = CpbModeAuto;
Piotr Króldcd2f172016-05-27 12:04:13 +020082}
Michał Żygowski8e232702021-04-29 17:53:10 +020083
84void board_BeforeInitPost(struct sysinfo *cb, AMD_POST_PARAMS *Post)
85{
86 /*
87 * Bank interleaving does not work on this platform.
88 * Disable it so AGESA will return success.
89 */
90 Post->MemConfig.EnableBankIntlv = FALSE;
91 /* 4GB variants have ECC */
92 if (get_spd_offset())
93 Post->MemConfig.EnableEccFeature = TRUE;
94 else
95 Post->MemConfig.EnableEccFeature = FALSE;
96}