blob: ec0c3d3d921dbaa77928a4fadf04edaee68c523d [file] [log] [blame]
Kyösti Mälkki595ef3d2015-05-27 12:44:16 +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.
Kyösti Mälkki595ef3d2015-05-27 12:44:16 +030014 */
15
16#include "AGESA.h"
17#include "amdlib.h"
18#include "Ids.h"
19#include "heapManager.h"
20#include "Filecode.h"
21
22#include <northbridge/amd/agesa/agesawrapper.h>
23
24#define FILECODE PROC_GNB_PCIE_FAMILY_0X15_F15PCIECOMPLEXCONFIG_FILECODE
25
26static const PCIe_PORT_DESCRIPTOR PortList [] = {
27 {
28 0,
29 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 3, 3),
30 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled, ChannelTypeExt6db, 2, 5,
Fabian Kunkel7558dba2015-05-25 17:08:17 +020031 HotplugBasic,
Kyösti Mälkki595ef3d2015-05-27 12:44:16 +030032 PcieGenMaxSupported,
33 PcieGenMaxSupported,
34 AspmDisabled, 0x01, 0)
35 },
36 /* Initialize Port descriptor (PCIe port, Lanes 1, PCI Device Number 2, ...) */
37 {
38 0,
39 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 2, 2),
40 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled, ChannelTypeExt6db, 2, 4,
Fabian Kunkel7558dba2015-05-25 17:08:17 +020041 HotplugBasic,
Kyösti Mälkki595ef3d2015-05-27 12:44:16 +030042 PcieGenMaxSupported,
43 PcieGenMaxSupported,
44 AspmDisabled, 0x02, 0)
45 },
46 /* Initialize Port descriptor (PCIe port, Lanes 2, PCI Device Number 2, ...) */
47 {
48 0,
49 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 1, 1),
50 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled, ChannelTypeExt6db, 2, 3,
51 HotplugDisabled,
52 PcieGenMaxSupported,
53 PcieGenMaxSupported,
54 AspmDisabled, 0x03, 0)
55 },
56 /* Initialize Port descriptor (PCIe port, Lanes 3, PCI Device Number 2, ...) */
57 {
58 0,
59 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 0, 0),
60 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled, ChannelTypeExt6db, 2, 2,
61 HotplugDisabled,
62 PcieGenMaxSupported,
63 PcieGenMaxSupported,
64 AspmDisabled, 0x04, 0)
65 },
66 /* Initialize Port descriptor (PCIe port, Lanes 4-7, PCI Device Number 4, ...) */
67 {
68 DESCRIPTOR_TERMINATE_LIST,
69 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 4, 7),
70 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled, ChannelTypeExt6db, 2, 1,
Fabian Kunkel7558dba2015-05-25 17:08:17 +020071 HotplugBasic,
Kyösti Mälkki595ef3d2015-05-27 12:44:16 +030072 PcieGenMaxSupported,
73 PcieGenMaxSupported,
74 AspmDisabled, 0x05, 0)
75 }
76};
77
78static const PCIe_DDI_DESCRIPTOR DdiList [] = {
Fabian Kunkel7558dba2015-05-25 17:08:17 +020079 /* eDP0 to LVDS connector*/
Kyösti Mälkki595ef3d2015-05-27 12:44:16 +030080 {
81 0,
82 PCIE_ENGINE_DATA_INITIALIZER (PcieDdiEngine, 8, 11),
Fabian Kunkel7558dba2015-05-25 17:08:17 +020083 PCIE_DDI_DATA_INITIALIZER (ConnectorTypeDP, Aux1, Hdp1)
Kyösti Mälkki595ef3d2015-05-27 12:44:16 +030084 },
Fabian Kunkel7558dba2015-05-25 17:08:17 +020085 /* DP1 to HDMI */
Kyösti Mälkki595ef3d2015-05-27 12:44:16 +030086 {
87 DESCRIPTOR_TERMINATE_LIST,
88 PCIE_ENGINE_DATA_INITIALIZER (PcieDdiEngine, 12, 15),
Fabian Kunkel7558dba2015-05-25 17:08:17 +020089 PCIE_DDI_DATA_INITIALIZER (ConnectorTypeHDMI, Aux2, Hdp2)
Kyösti Mälkki595ef3d2015-05-27 12:44:16 +030090 },
91};
92
93static const PCIe_COMPLEX_DESCRIPTOR PcieComplex = {
94 .Flags = DESCRIPTOR_TERMINATE_LIST,
95 .SocketId = 0,
96 .PciePortList = PortList,
97 .DdiLinkList = DdiList
98};
99
100/*---------------------------------------------------------------------------------------*/
101/**
102 * OemCustomizeInitEarly
103 *
104 * Description:
105 * This is the stub function will call the host environment through the binary block
106 * interface (call-out port) to provide a user hook opportunity
107 *
108 * Parameters:
109 * @param[in] *InitEarly
110 *
111 * @retval VOID
112 *
113 **/
114/*---------------------------------------------------------------------------------------*/
115
116static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
117{
118 AGESA_STATUS Status;
119 PCIe_COMPLEX_DESCRIPTOR *PcieComplexListPtr;
120
121 ALLOCATE_HEAP_PARAMS AllocHeapParams;
122
123 /* GNB PCIe topology Porting */
124
125 /* */
126 /* Allocate buffer for PCIe_COMPLEX_DESCRIPTOR , PCIe_PORT_DESCRIPTOR and PCIe_DDI_DESCRIPTOR */
127 /* */
128 AllocHeapParams.RequestedBufferSize = sizeof(PcieComplex);
129
130 AllocHeapParams.BufferHandle = AMD_MEM_MISC_HANDLES_START;
131 AllocHeapParams.Persist = HEAP_LOCAL_CACHE;
132 Status = HeapAllocateBuffer (&AllocHeapParams, &InitEarly->StdHeader);
133 ASSERT(Status == AGESA_SUCCESS);
134
135 PcieComplexListPtr = (PCIe_COMPLEX_DESCRIPTOR *) AllocHeapParams.BufferPtr;
136 LibAmdMemCopy (PcieComplexListPtr, &PcieComplex, sizeof(PcieComplex), &InitEarly->StdHeader);
137 InitEarly->GnbConfig.PcieComplexList = PcieComplexListPtr;
138 return AGESA_SUCCESS;
139}
140
141static AGESA_STATUS OemInitMid(AMD_MID_PARAMS * InitMid)
142{
143 /* 0 iGpuVgaAdapter, 1 iGpuVgaNonAdapter; */
144 InitMid->GnbMidConfiguration.iGpuVgaMode = 0;
145 return AGESA_SUCCESS;
146}
147
148const struct OEM_HOOK OemCustomize = {
149 .InitEarly = OemInitEarly,
150 .InitMid = OemInitMid,
151};