blob: 1d71f897f26dc3c5098062fd5db1426ee0b2bb41 [file] [log] [blame]
Dave Frodinc43bce52014-12-03 08:22:46 -07001/*
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.
Dave Frodinc43bce52014-12-03 08:22:46 -070014 */
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 {
Kyösti Mälkki9d035fa2015-05-23 14:27:44 +030028 0,
Dave Frodinc43bce52014-12-03 08:22:46 -070029 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 3, 3),
30 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled, ChannelTypeExt6db, 2, 5,
31 HotplugDisabled,
32 PcieGenMaxSupported,
33 PcieGenMaxSupported,
34 AspmDisabled, 0x01, 0)
35 },
36 /* Initialize Port descriptor (PCIe port, Lanes 1, PCI Device Number 2, ...) */
37 {
Kyösti Mälkki9d035fa2015-05-23 14:27:44 +030038 0,
Dave Frodinc43bce52014-12-03 08:22:46 -070039 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 2, 2),
40 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled, ChannelTypeExt6db, 2, 4,
41 HotplugDisabled,
42 PcieGenMaxSupported,
43 PcieGenMaxSupported,
44 AspmDisabled, 0x02, 0)
45 },
46 /* Initialize Port descriptor (PCIe port, Lanes 2, PCI Device Number 2, ...) */
47 {
Kyösti Mälkki9d035fa2015-05-23 14:27:44 +030048 0,
Dave Frodinc43bce52014-12-03 08:22:46 -070049 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 {
Kyösti Mälkki9d035fa2015-05-23 14:27:44 +030068 DESCRIPTOR_TERMINATE_LIST,
Dave Frodinc43bce52014-12-03 08:22:46 -070069 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 4, 7),
70 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled, ChannelTypeExt6db, 2, 1,
71 HotplugDisabled,
72 PcieGenMaxSupported,
73 PcieGenMaxSupported,
74 AspmDisabled, 0x05, 0)
75 }
76};
77
78static const PCIe_DDI_DESCRIPTOR DdiList [] = {
79 /* DP0 to HDMI0/DP */
80 {
81 0,
82 PCIE_ENGINE_DATA_INITIALIZER (PcieDdiEngine, 8, 11),
Dave Frodind6aa7cf2014-11-21 14:57:03 -070083 PCIE_DDI_DATA_INITIALIZER (ConnectorTypeHDMI, Aux1, Hdp1)
Dave Frodinc43bce52014-12-03 08:22:46 -070084 },
Dave Frodind6aa7cf2014-11-21 14:57:03 -070085 /* DP1 to high-speed edge connector */
Dave Frodinc43bce52014-12-03 08:22:46 -070086 {
87 DESCRIPTOR_TERMINATE_LIST,
Dave Frodind6aa7cf2014-11-21 14:57:03 -070088 PCIE_ENGINE_DATA_INITIALIZER (PcieDdiEngine, 12, 15),
89 PCIE_DDI_DATA_INITIALIZER (ConnectorTypeDP, Aux2, Hdp2)
Dave Frodinc43bce52014-12-03 08:22:46 -070090 },
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:
Dave Frodinc43bce52014-12-03 08:22:46 -0700109 * @param[in] *InitEarly
110 *
111 * @retval VOID
112 *
113 **/
114/*---------------------------------------------------------------------------------------*/
Kyösti Mälkki6e74b2c2014-12-16 07:34:58 +0200115
116static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
Dave Frodinc43bce52014-12-03 08:22:46 -0700117{
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);
Kyösti Mälkki1ef67e12014-12-16 16:45:52 +0200133 ASSERT(Status == AGESA_SUCCESS);
Dave Frodinc43bce52014-12-03 08:22:46 -0700134
135 PcieComplexListPtr = (PCIe_COMPLEX_DESCRIPTOR *) AllocHeapParams.BufferPtr;
136 LibAmdMemCopy (PcieComplexListPtr, &PcieComplex, sizeof(PcieComplex), &InitEarly->StdHeader);
137 InitEarly->GnbConfig.PcieComplexList = PcieComplexListPtr;
Kyösti Mälkki6e74b2c2014-12-16 07:34:58 +0200138 return AGESA_SUCCESS;
Dave Frodinc43bce52014-12-03 08:22:46 -0700139}
Kyösti Mälkki6e74b2c2014-12-16 07:34:58 +0200140
Kyösti Mälkki296696d2014-12-16 09:29:56 +0200141static AGESA_STATUS OemInitMid(AMD_MID_PARAMS * InitMid)
142{
143 /* 0 iGpuVgaAdapter, 1 iGpuVgaNonAdapter; */
144 InitMid->GnbMidConfiguration.iGpuVgaMode = 0;
145 return AGESA_SUCCESS;
146}
147
Kyösti Mälkki6e74b2c2014-12-16 07:34:58 +0200148const struct OEM_HOOK OemCustomize = {
149 .InitEarly = OemInitEarly,
Kyösti Mälkki296696d2014-12-16 09:29:56 +0200150 .InitMid = OemInitMid,
Kyösti Mälkki6e74b2c2014-12-16 07:34:58 +0200151};