blob: fa1cc653aeef7e344d54b8e3153a56e426398156 [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.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
Patrick Georgib890a122015-03-26 15:17:45 +010017 * Foundation, Inc.
Sergej Ivanovd777c782015-04-03 18:10:27 +030018 */
19
20#include "AGESA.h"
21#include "amdlib.h"
22#include "Ids.h"
23#include "heapManager.h"
24#include "Filecode.h"
25
26#include <northbridge/amd/agesa/agesawrapper.h>
27
28#define FILECODE PROC_GNB_PCIE_FAMILY_0X15_F15PCIECOMPLEXCONFIG_FILECODE
29
30static const PCIe_PORT_DESCRIPTOR PortList [] = {
31 {
Kyösti Mälkki9d035fa2015-05-23 14:27:44 +030032 0,
Sergej Ivanovd777c782015-04-03 18:10:27 +030033 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 3, 3),
34 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled, ChannelTypeExt6db, 2, 5,
35 HotplugDisabled,
36 PcieGenMaxSupported,
37 PcieGenMaxSupported,
38 AspmDisabled, 0x01, 0)
39 },
40 /* Initialize Port descriptor (PCIe port, Lanes 1, PCI Device Number 2, ...) */
41 {
Kyösti Mälkki9d035fa2015-05-23 14:27:44 +030042 0,
Sergej Ivanovd777c782015-04-03 18:10:27 +030043 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 2, 2),
44 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled, ChannelTypeExt6db, 2, 4,
45 HotplugDisabled,
46 PcieGenMaxSupported,
47 PcieGenMaxSupported,
48 AspmDisabled, 0x02, 0)
49 },
50 /* Initialize Port descriptor (PCIe port, Lanes 2, PCI Device Number 2, ...) */
51 {
Kyösti Mälkki9d035fa2015-05-23 14:27:44 +030052 0,
Sergej Ivanovd777c782015-04-03 18:10:27 +030053 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 1, 1),
54 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled, ChannelTypeExt6db, 2, 3,
55 HotplugDisabled,
56 PcieGenMaxSupported,
57 PcieGenMaxSupported,
58 AspmDisabled, 0x03, 0)
59 },
60 /* Initialize Port descriptor (PCIe port, Lanes 3, PCI Device Number 2, ...) */
61 {
62 0,
63 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 0, 0),
64 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled, ChannelTypeExt6db, 2, 2,
65 HotplugDisabled,
66 PcieGenMaxSupported,
67 PcieGenMaxSupported,
68 AspmDisabled, 0x04, 0)
69 },
70 /* Initialize Port descriptor (PCIe port, Lanes 4-7, PCI Device Number 4, ...) */
71 {
Kyösti Mälkki9d035fa2015-05-23 14:27:44 +030072 DESCRIPTOR_TERMINATE_LIST,
Sergej Ivanovd777c782015-04-03 18:10:27 +030073 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 4, 7),
74 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled, ChannelTypeExt6db, 2, 1,
75 HotplugDisabled,
76 PcieGenMaxSupported,
77 PcieGenMaxSupported,
78 AspmDisabled, 0x05, 0)
79 }
80};
81
82static const PCIe_DDI_DESCRIPTOR DdiList [] = {
83 /* DP0 to HDMI0/DP */
84 {
85 0,
86 PCIE_ENGINE_DATA_INITIALIZER (PcieDdiEngine, 8, 11),
87 PCIE_DDI_DATA_INITIALIZER (ConnectorTypeHDMI, Aux1, Hdp1)
88 },
89 /* DP1 to FCH */
90 {
91 0,
92 PCIE_ENGINE_DATA_INITIALIZER (PcieDdiEngine, 12, 15),
93 PCIE_DDI_DATA_INITIALIZER (ConnectorTypeHDMI, Aux2, Hdp2)
94 },
95 /* DP2 to HDMI1/DP */
96 {
97 DESCRIPTOR_TERMINATE_LIST,
98 PCIE_ENGINE_DATA_INITIALIZER (PcieDdiEngine, 16, 19),
99 PCIE_DDI_DATA_INITIALIZER (ConnectorTypeCrt, Aux3, Hdp3)
100 },
101};
102
103static const PCIe_COMPLEX_DESCRIPTOR PcieComplex = {
104 .Flags = DESCRIPTOR_TERMINATE_LIST,
105 .SocketId = 0,
106 .PciePortList = PortList,
107 .DdiLinkList = DdiList
108};
109
110/*---------------------------------------------------------------------------------------*/
111/**
112 * OemCustomizeInitEarly
113 *
114 * Description:
115 * This is the stub function will call the host environment through the binary block
116 * interface (call-out port) to provide a user hook opportunity
117 *
118 * Parameters:
119 * @param[in] *InitEarly
120 *
121 * @retval VOID
122 *
123 **/
124/*---------------------------------------------------------------------------------------*/
125
126static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
127{
128 AGESA_STATUS Status;
129 PCIe_COMPLEX_DESCRIPTOR *PcieComplexListPtr;
130
131 ALLOCATE_HEAP_PARAMS AllocHeapParams;
132
133 /* GNB PCIe topology Porting */
134
135 /* */
136 /* Allocate buffer for PCIe_COMPLEX_DESCRIPTOR , PCIe_PORT_DESCRIPTOR and PCIe_DDI_DESCRIPTOR */
137 /* */
138 AllocHeapParams.RequestedBufferSize = sizeof(PcieComplex);
139
140 AllocHeapParams.BufferHandle = AMD_MEM_MISC_HANDLES_START;
141 AllocHeapParams.Persist = HEAP_LOCAL_CACHE;
142 Status = HeapAllocateBuffer (&AllocHeapParams, &InitEarly->StdHeader);
143 ASSERT(Status == AGESA_SUCCESS);
144
145 PcieComplexListPtr = (PCIe_COMPLEX_DESCRIPTOR *) AllocHeapParams.BufferPtr;
146 LibAmdMemCopy (PcieComplexListPtr, &PcieComplex, sizeof(PcieComplex), &InitEarly->StdHeader);
147 InitEarly->GnbConfig.PcieComplexList = PcieComplexListPtr;
148 return AGESA_SUCCESS;
149}
150
151static AGESA_STATUS OemInitMid(AMD_MID_PARAMS * InitMid)
152{
153 /* 0 iGpuVgaAdapter, 1 iGpuVgaNonAdapter; */
154 InitMid->GnbMidConfiguration.iGpuVgaMode = 0;
155 return AGESA_SUCCESS;
156}
157
158const struct OEM_HOOK OemCustomize = {
159 .InitEarly = OemInitEarly,
160 .InitMid = OemInitMid,
161};