blob: c44a9944c23513c45a7c65a7e63c39beeec63805 [file] [log] [blame]
Sergej Ivanovd777c782015-04-03 18:10:27 +03001/*
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.
Sergej Ivanovd777c782015-04-03 18:10:27 +030014 */
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>
Sergej Ivanovd777c782015-04-03 18:10:27 +030021#include "Filecode.h"
22
23#include <northbridge/amd/agesa/agesawrapper.h>
24
25#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,
Sergej Ivanovd777c782015-04-03 18:10:27 +030030 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,
Sergej Ivanovd777c782015-04-03 18:10:27 +030040 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,
Sergej Ivanovd777c782015-04-03 18:10:27 +030050 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,
Sergej Ivanovd777c782015-04-03 18:10:27 +030070 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:
116 * @param[in] *InitEarly
117 *
118 * @retval VOID
119 *
120 **/
121/*---------------------------------------------------------------------------------------*/
122
123static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
124{
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);
140 ASSERT(Status == AGESA_SUCCESS);
141
142 PcieComplexListPtr = (PCIe_COMPLEX_DESCRIPTOR *) AllocHeapParams.BufferPtr;
143 LibAmdMemCopy (PcieComplexListPtr, &PcieComplex, sizeof(PcieComplex), &InitEarly->StdHeader);
144 InitEarly->GnbConfig.PcieComplexList = PcieComplexListPtr;
145 return AGESA_SUCCESS;
146}
147
148static 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 #define SEED_A 0x12
168 HW_RXEN_SEED(
169 ANY_SOCKET, CHANNEL_A, ALL_DIMMS,
170 SEED_A, SEED_A, SEED_A, SEED_A, SEED_A, SEED_A, SEED_A, SEED_A,
171 SEED_A),
172
173 NUMBER_OF_DIMMS_SUPPORTED (ANY_SOCKET, ANY_CHANNEL, 2),
174 NUMBER_OF_CHANNELS_SUPPORTED (ANY_SOCKET, 1),
175 MOTHER_BOARD_LAYERS (LAYERS_4),
176
177 MEMCLK_DIS_MAP (ANY_SOCKET, ANY_CHANNEL, 0x01, 0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00),
178 CKE_TRI_MAP (ANY_SOCKET, ANY_CHANNEL, 0x01, 0x02, 0x04, 0x08), /* TODO: bit2map, bit3map */
179 ODT_TRI_MAP (ANY_SOCKET, ANY_CHANNEL, 0x01, 0x02, 0x04, 0x08),
180 CS_TRI_MAP (ANY_SOCKET, ANY_CHANNEL, 0x01, 0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00),
181
182 PSO_END
183};
184
Sergej Ivanovd777c782015-04-03 18:10:27 +0300185const struct OEM_HOOK OemCustomize = {
186 .InitEarly = OemInitEarly,
187 .InitMid = OemInitMid,
188};