2 * This file is part of the coreboot project.
4 * Copyright (C) 2012 Advanced Micro Devices, Inc.
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.
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.
19 #include "heapManager.h"
22 #include <northbridge/amd/agesa/agesawrapper.h>
24 #define FILECODE PROC_GNB_PCIE_FAMILY_0X15_F15PCIECOMPLEXCONFIG_FILECODE
26 static const PCIe_PORT_DESCRIPTOR PortList
[] = {
29 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine
, 3, 3),
30 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled
, ChannelTypeExt6db
, 2, 5,
34 AspmDisabled
, 0x01, 0)
36 /* Initialize Port descriptor (PCIe port, Lanes 1, PCI Device Number 2, ...) */
39 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine
, 2, 2),
40 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled
, ChannelTypeExt6db
, 2, 4,
44 AspmDisabled
, 0x02, 0)
46 /* Initialize Port descriptor (PCIe port, Lanes 2, PCI Device Number 2, ...) */
49 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine
, 1, 1),
50 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled
, ChannelTypeExt6db
, 2, 3,
54 AspmDisabled
, 0x03, 0)
56 /* Initialize Port descriptor (PCIe port, Lanes 3, PCI Device Number 2, ...) */
59 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine
, 0, 0),
60 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled
, ChannelTypeExt6db
, 2, 2,
64 AspmDisabled
, 0x04, 0)
66 /* Initialize Port descriptor (PCIe port, Lanes 4-7, PCI Device Number 4, ...) */
68 DESCRIPTOR_TERMINATE_LIST
,
69 PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine
, 4, 7),
70 PCIE_PORT_DATA_INITIALIZER_V2 (PortEnabled
, ChannelTypeExt6db
, 2, 1,
74 AspmDisabled
, 0x05, 0)
78 static const PCIe_DDI_DESCRIPTOR DdiList
[] = {
82 PCIE_ENGINE_DATA_INITIALIZER (PcieDdiEngine
, 8, 11),
83 PCIE_DDI_DATA_INITIALIZER (ConnectorTypeHDMI
, Aux1
, Hdp1
)
88 PCIE_ENGINE_DATA_INITIALIZER (PcieDdiEngine
, 12, 15),
89 PCIE_DDI_DATA_INITIALIZER (ConnectorTypeHDMI
, Aux2
, Hdp2
)
93 DESCRIPTOR_TERMINATE_LIST
,
94 PCIE_ENGINE_DATA_INITIALIZER (PcieDdiEngine
, 16, 19),
95 PCIE_DDI_DATA_INITIALIZER (ConnectorTypeCrt
, Aux3
, Hdp3
)
99 static const PCIe_COMPLEX_DESCRIPTOR PcieComplex
= {
100 .Flags
= DESCRIPTOR_TERMINATE_LIST
,
102 .PciePortList
= PortList
,
103 .DdiLinkList
= DdiList
106 /*---------------------------------------------------------------------------------------*/
108 * OemCustomizeInitEarly
111 * This is the stub function will call the host environment through the binary block
112 * interface (call-out port) to provide a user hook opportunity
115 * @param[in] *InitEarly
120 /*---------------------------------------------------------------------------------------*/
122 static AGESA_STATUS
OemInitEarly(AMD_EARLY_PARAMS
* InitEarly
)
125 PCIe_COMPLEX_DESCRIPTOR
*PcieComplexListPtr
;
127 ALLOCATE_HEAP_PARAMS AllocHeapParams
;
129 /* GNB PCIe topology Porting */
132 /* Allocate buffer for PCIe_COMPLEX_DESCRIPTOR , PCIe_PORT_DESCRIPTOR and PCIe_DDI_DESCRIPTOR */
134 AllocHeapParams
.RequestedBufferSize
= sizeof(PcieComplex
);
136 AllocHeapParams
.BufferHandle
= AMD_MEM_MISC_HANDLES_START
;
137 AllocHeapParams
.Persist
= HEAP_LOCAL_CACHE
;
138 Status
= HeapAllocateBuffer (&AllocHeapParams
, &InitEarly
->StdHeader
);
139 ASSERT(Status
== AGESA_SUCCESS
);
141 PcieComplexListPtr
= (PCIe_COMPLEX_DESCRIPTOR
*) AllocHeapParams
.BufferPtr
;
142 LibAmdMemCopy (PcieComplexListPtr
, &PcieComplex
, sizeof(PcieComplex
), &InitEarly
->StdHeader
);
143 InitEarly
->GnbConfig
.PcieComplexList
= PcieComplexListPtr
;
144 return AGESA_SUCCESS
;
147 static AGESA_STATUS
OemInitMid(AMD_MID_PARAMS
* InitMid
)
149 /* 0 iGpuVgaAdapter, 1 iGpuVgaNonAdapter; */
150 InitMid
->GnbMidConfiguration
.iGpuVgaMode
= 0;
151 return AGESA_SUCCESS
;
154 const struct OEM_HOOK OemCustomize
= {
155 .InitEarly
= OemInitEarly
,
156 .InitMid
= OemInitMid
,