blob: aec1343f02a538d6105a998232c4a011d4b95ed3 [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
16#include "AGESA.h"
17#include "amdlib.h"
18#include "Ids.h"
19#include "heapManager.h"
Kyösti Mälkki53052fe2016-04-27 09:04:11 +030020#include <PlatformMemoryConfiguration.h>
WANG Siyuanf77f7342013-08-13 17:09:51 +080021#include "Filecode.h"
22
Kyösti Mälkki34ad72c2014-10-21 13:43:46 +030023#include <northbridge/amd/agesa/agesawrapper.h>
24
WANG Siyuanf77f7342013-08-13 17:09:51 +080025#define FILECODE PROC_GNB_PCIE_FAMILY_0X15_F15PCIECOMPLEXCONFIG_FILECODE
26
27static const PCIe_PORT_DESCRIPTOR PortList [] = {
28 {
Kyösti Mälkki9d035fa2015-05-23 14:27:44 +030029 0,
WANG Siyuanf77f7342013-08-13 17:09:51 +080030 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 3, 3),
31 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled, ChannelTypeExt6db, 2, 5,
32 HotplugDisabled,
33 PcieGenMaxSupported,
34 PcieGenMaxSupported,
35 AspmDisabled, 0x01, 0)
36 },
37 /* Initialize Port descriptor (PCIe port, Lanes 1, PCI Device Number 2, ...) */
38 {
Kyösti Mälkki9d035fa2015-05-23 14:27:44 +030039 0,
WANG Siyuanf77f7342013-08-13 17:09:51 +080040 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 2, 2),
41 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled, ChannelTypeExt6db, 2, 4,
42 HotplugDisabled,
43 PcieGenMaxSupported,
44 PcieGenMaxSupported,
45 AspmDisabled, 0x02, 0)
46 },
47 /* Initialize Port descriptor (PCIe port, Lanes 2, PCI Device Number 2, ...) */
48 {
Kyösti Mälkki9d035fa2015-05-23 14:27:44 +030049 0,
WANG Siyuanf77f7342013-08-13 17:09:51 +080050 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 1, 1),
51 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled, ChannelTypeExt6db, 2, 3,
52 HotplugDisabled,
53 PcieGenMaxSupported,
54 PcieGenMaxSupported,
55 AspmDisabled, 0x03, 0)
56 },
57 /* Initialize Port descriptor (PCIe port, Lanes 3, PCI Device Number 2, ...) */
58 {
59 0,
60 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 0, 0),
61 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled, ChannelTypeExt6db, 2, 2,
62 HotplugDisabled,
63 PcieGenMaxSupported,
64 PcieGenMaxSupported,
65 AspmDisabled, 0x04, 0)
66 },
67 /* Initialize Port descriptor (PCIe port, Lanes 4-7, PCI Device Number 4, ...) */
68 {
Kyösti Mälkki9d035fa2015-05-23 14:27:44 +030069 DESCRIPTOR_TERMINATE_LIST,
WANG Siyuanf77f7342013-08-13 17:09:51 +080070 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 4, 7),
71 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled, ChannelTypeExt6db, 2, 1,
72 HotplugDisabled,
73 PcieGenMaxSupported,
74 PcieGenMaxSupported,
75 AspmDisabled, 0x05, 0)
76 }
77};
78
79static const PCIe_DDI_DESCRIPTOR DdiList [] = {
80 /* DP0 to HDMI0/DP */
81 {
82 0,
83 PCIE_ENGINE_DATA_INITIALIZER (PcieDdiEngine, 8, 11),
84 PCIE_DDI_DATA_INITIALIZER (ConnectorTypeHDMI, Aux1, Hdp1)
85 },
86 /* DP1 to FCH */
87 {
88 0,
89 PCIE_ENGINE_DATA_INITIALIZER (PcieDdiEngine, 12, 15),
90 PCIE_DDI_DATA_INITIALIZER (ConnectorTypeHDMI, Aux2, Hdp2)
91 },
92 /* DP2 to HDMI1/DP */
93 {
94 DESCRIPTOR_TERMINATE_LIST,
95 PCIE_ENGINE_DATA_INITIALIZER (PcieDdiEngine, 16, 19),
96 PCIE_DDI_DATA_INITIALIZER (ConnectorTypeCrt, Aux3, Hdp3)
97 },
98};
99
100static const PCIe_COMPLEX_DESCRIPTOR PcieComplex = {
101 .Flags = DESCRIPTOR_TERMINATE_LIST,
102 .SocketId = 0,
103 .PciePortList = PortList,
104 .DdiLinkList = DdiList
105};
106
107/*---------------------------------------------------------------------------------------*/
108/**
109 * OemCustomizeInitEarly
110 *
111 * Description:
112 * This is the stub function will call the host environment through the binary block
113 * interface (call-out port) to provide a user hook opportunity
114 *
115 * Parameters:
WANG Siyuanf77f7342013-08-13 17:09:51 +0800116 * @param[in] *InitEarly
117 *
118 * @retval VOID
119 *
120 **/
121/*---------------------------------------------------------------------------------------*/
Kyösti Mälkki6e74b2c2014-12-16 07:34:58 +0200122
123static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
WANG Siyuanf77f7342013-08-13 17:09:51 +0800124{
125 AGESA_STATUS Status;
126 PCIe_COMPLEX_DESCRIPTOR *PcieComplexListPtr;
127
128 ALLOCATE_HEAP_PARAMS AllocHeapParams;
129
130 /* GNB PCIe topology Porting */
131
132 /* */
133 /* Allocate buffer for PCIe_COMPLEX_DESCRIPTOR , PCIe_PORT_DESCRIPTOR and PCIe_DDI_DESCRIPTOR */
134 /* */
135 AllocHeapParams.RequestedBufferSize = sizeof(PcieComplex);
136
137 AllocHeapParams.BufferHandle = AMD_MEM_MISC_HANDLES_START;
138 AllocHeapParams.Persist = HEAP_LOCAL_CACHE;
139 Status = HeapAllocateBuffer (&AllocHeapParams, &InitEarly->StdHeader);
Kyösti Mälkki1ef67e12014-12-16 16:45:52 +0200140 ASSERT(Status == AGESA_SUCCESS);
WANG Siyuanf77f7342013-08-13 17:09:51 +0800141
142 PcieComplexListPtr = (PCIe_COMPLEX_DESCRIPTOR *) AllocHeapParams.BufferPtr;
143 LibAmdMemCopy (PcieComplexListPtr, &PcieComplex, sizeof(PcieComplex), &InitEarly->StdHeader);
144 InitEarly->GnbConfig.PcieComplexList = PcieComplexListPtr;
Kyösti Mälkki6e74b2c2014-12-16 07:34:58 +0200145 return AGESA_SUCCESS;
WANG Siyuanf77f7342013-08-13 17:09:51 +0800146}
Kyösti Mälkki6e74b2c2014-12-16 07:34:58 +0200147
Kyösti Mälkki296696d2014-12-16 09:29:56 +0200148static AGESA_STATUS OemInitMid(AMD_MID_PARAMS * InitMid)
149{
150 /* 0 iGpuVgaAdapter, 1 iGpuVgaNonAdapter; */
151 InitMid->GnbMidConfiguration.iGpuVgaMode = 0;
152 return AGESA_SUCCESS;
153}
154
Kyösti Mälkki53052fe2016-04-27 09:04:11 +0300155/*----------------------------------------------------------------------------------------
156 * CUSTOMER OVERIDES MEMORY TABLE
157 *----------------------------------------------------------------------------------------
158 */
159
160/*
161 * Platform Specific Overriding Table allows IBV/OEM to pass in platform information to AGESA
162 * (e.g. MemClk routing, the number of DIMM slots per channel,...). If PlatformSpecificTable
163 * is populated, AGESA will base its settings on the data from the table. Otherwise, it will
164 * use its default conservative settings.
165 */
166CONST PSO_ENTRY ROMDATA DefaultPlatformMemoryConfiguration[] = {
167
168 #define SEED_A 0x12
169 HW_RXEN_SEED(
170 ANY_SOCKET, CHANNEL_A, ALL_DIMMS,
171 SEED_A, SEED_A, SEED_A, SEED_A, SEED_A, SEED_A, SEED_A, SEED_A,
172 SEED_A),
173
174 NUMBER_OF_DIMMS_SUPPORTED (ANY_SOCKET, ANY_CHANNEL, 2),
175 NUMBER_OF_CHANNELS_SUPPORTED (ANY_SOCKET, 1),
176 MOTHER_BOARD_LAYERS (LAYERS_4),
177
178 MEMCLK_DIS_MAP (ANY_SOCKET, ANY_CHANNEL, 0x01, 0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00),
179 CKE_TRI_MAP (ANY_SOCKET, ANY_CHANNEL, 0x01, 0x02, 0x04, 0x08), /* TODO: bit2map, bit3map */
180 ODT_TRI_MAP (ANY_SOCKET, ANY_CHANNEL, 0x01, 0x02, 0x04, 0x08),
181 CS_TRI_MAP (ANY_SOCKET, ANY_CHANNEL, 0x01, 0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00),
182
183 PSO_END
184};
185
Kyösti Mälkki6e74b2c2014-12-16 07:34:58 +0200186const struct OEM_HOOK OemCustomize = {
187 .InitEarly = OemInitEarly,
Kyösti Mälkki296696d2014-12-16 09:29:56 +0200188 .InitMid = OemInitMid,
Kyösti Mälkki6e74b2c2014-12-16 07:34:58 +0200189};