Damien Zammit | d2b5b73 | 2017-10-04 20:07:47 +1100 | [diff] [blame] | 1 | /* |
| 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 | |
Elyes HAOUAS | 19f5ba8 | 2018-10-14 14:52:06 +0200 | [diff] [blame] | 16 | #include <AGESA.h> |
Damien Zammit | d2b5b73 | 2017-10-04 20:07:47 +1100 | [diff] [blame] | 17 | #include <PlatformMemoryConfiguration.h> |
| 18 | |
| 19 | #include <northbridge/amd/agesa/state_machine.h> |
| 20 | |
| 21 | static const PCIe_PORT_DESCRIPTOR PortList[] = { |
| 22 | { |
| 23 | 0, |
| 24 | PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 3, 3), |
| 25 | PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db, 2, 5, |
| 26 | HotplugDisabled, |
| 27 | PcieGenMaxSupported, |
| 28 | PcieGenMaxSupported, |
| 29 | AspmDisabled, 0x01, 0) |
| 30 | }, |
| 31 | /* Initialize Port descriptor (PCIe port, Lanes 1, PCI Device Number 2, ...) */ |
| 32 | { |
| 33 | 0, |
| 34 | PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 2, 2), |
| 35 | PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db, 2, 4, |
| 36 | HotplugDisabled, |
| 37 | PcieGenMaxSupported, |
| 38 | PcieGenMaxSupported, |
| 39 | AspmDisabled, 0x02, 0) |
| 40 | }, |
| 41 | /* Initialize Port descriptor (PCIe port, Lanes 2, PCI Device Number 2, ...) */ |
| 42 | { |
| 43 | 0, |
| 44 | PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 1, 1), |
| 45 | PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db, 2, 3, |
| 46 | HotplugDisabled, |
| 47 | PcieGenMaxSupported, |
| 48 | PcieGenMaxSupported, |
| 49 | AspmDisabled, 0x03, 0) |
| 50 | }, |
| 51 | /* Initialize Port descriptor (PCIe port, Lanes 3, PCI Device Number 2, ...) */ |
| 52 | { |
| 53 | 0, |
| 54 | PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 0, 0), |
| 55 | PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db, 2, 2, |
| 56 | HotplugDisabled, |
| 57 | PcieGenMaxSupported, |
| 58 | PcieGenMaxSupported, |
| 59 | AspmDisabled, 0x04, 0) |
| 60 | }, |
| 61 | /* Initialize Port descriptor (PCIe port, Lanes 4-7, PCI Device Number 4, ...) */ |
| 62 | { |
| 63 | DESCRIPTOR_TERMINATE_LIST, |
| 64 | PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 4, 7), |
| 65 | PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db, 2, 1, |
| 66 | HotplugDisabled, |
| 67 | PcieGenMaxSupported, |
| 68 | PcieGenMaxSupported, |
| 69 | AspmDisabled, 0x05, 0) |
| 70 | } |
| 71 | }; |
| 72 | |
| 73 | static const PCIe_DDI_DESCRIPTOR DdiList[] = { |
| 74 | /* DP0 to HDMI0/DP */ |
| 75 | { |
| 76 | 0, |
| 77 | PCIE_ENGINE_DATA_INITIALIZER(PcieDdiEngine, 8, 11), |
| 78 | PCIE_DDI_DATA_INITIALIZER(ConnectorTypeDP, Aux1, Hdp1) |
| 79 | }, |
| 80 | /* DP1 to FCH */ |
| 81 | { |
| 82 | 0, |
| 83 | PCIE_ENGINE_DATA_INITIALIZER(PcieDdiEngine, 12, 15), |
| 84 | PCIE_DDI_DATA_INITIALIZER(ConnectorTypeDP, Aux2, Hdp2) |
| 85 | }, |
| 86 | /* DP2 to HDMI1/DP */ |
| 87 | { |
| 88 | DESCRIPTOR_TERMINATE_LIST, |
| 89 | PCIE_ENGINE_DATA_INITIALIZER(PcieDdiEngine, 16, 19), |
| 90 | PCIE_DDI_DATA_INITIALIZER(ConnectorTypeCrt, Aux3, Hdp3) |
| 91 | }, |
| 92 | }; |
| 93 | |
| 94 | static const PCIe_COMPLEX_DESCRIPTOR PcieComplex = { |
| 95 | .Flags = DESCRIPTOR_TERMINATE_LIST, |
| 96 | .SocketId = 0, |
| 97 | .PciePortList = PortList, |
| 98 | .DdiLinkList = DdiList |
| 99 | }; |
| 100 | |
| 101 | void board_BeforeInitReset(struct sysinfo *cb, AMD_RESET_PARAMS *Reset) |
| 102 | { |
| 103 | FCH_RESET_INTERFACE *FchReset = &Reset->FchInterface; |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame^] | 104 | FchReset->Xhci0Enable = CONFIG(HUDSON_XHCI_ENABLE); |
Damien Zammit | d2b5b73 | 2017-10-04 20:07:47 +1100 | [diff] [blame] | 105 | FchReset->Xhci1Enable = FALSE; |
| 106 | } |
| 107 | |
| 108 | void board_BeforeInitEarly(struct sysinfo *cb, AMD_EARLY_PARAMS *InitEarly) |
| 109 | { |
| 110 | InitEarly->GnbConfig.PcieComplexList = &PcieComplex; |
| 111 | } |
| 112 | |
| 113 | /*---------------------------------------------------------------------------------------- |
| 114 | * CUSTOMER OVERIDES MEMORY TABLE |
| 115 | *---------------------------------------------------------------------------------------- |
| 116 | */ |
| 117 | |
| 118 | /* |
| 119 | * Platform Specific Overriding Table allows IBV/OEM to pass in platform information to AGESA |
| 120 | * (e.g. MemClk routing, the number of DIMM slots per channel,...). If PlatformSpecificTable |
| 121 | * is populated, AGESA will base its settings on the data from the table. Otherwise, it will |
| 122 | * use its default conservative settings. |
| 123 | */ |
| 124 | static CONST PSO_ENTRY ROMDATA PlatformMemoryTable[] = { |
| 125 | #define SEED_A 0x12 |
| 126 | HW_RXEN_SEED( |
| 127 | ANY_SOCKET, CHANNEL_A, ALL_DIMMS, |
| 128 | SEED_A, SEED_A, SEED_A, SEED_A, SEED_A, SEED_A, SEED_A, SEED_A, |
| 129 | SEED_A), |
| 130 | |
| 131 | NUMBER_OF_DIMMS_SUPPORTED(ANY_SOCKET, ANY_CHANNEL, 2), |
| 132 | NUMBER_OF_CHANNELS_SUPPORTED(ANY_SOCKET, 1), |
| 133 | MOTHER_BOARD_LAYERS(LAYERS_4), |
| 134 | |
| 135 | MEMCLK_DIS_MAP(ANY_SOCKET, ANY_CHANNEL, 0x01, 0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00), |
| 136 | CKE_TRI_MAP(ANY_SOCKET, ANY_CHANNEL, 0x01, 0x02, 0x04, 0x08), /* TODO: bit2map, bit3map */ |
| 137 | ODT_TRI_MAP(ANY_SOCKET, ANY_CHANNEL, 0x01, 0x02, 0x04, 0x08), |
| 138 | CS_TRI_MAP(ANY_SOCKET, ANY_CHANNEL, 0x01, 0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00), |
| 139 | |
| 140 | PSO_END |
| 141 | }; |
| 142 | |
| 143 | void board_BeforeInitPost(struct sysinfo *cb, AMD_POST_PARAMS *InitPost) |
| 144 | { |
| 145 | InitPost->MemConfig.PlatformMemoryConfiguration = (PSO_ENTRY *)PlatformMemoryTable; |
| 146 | } |
| 147 | |
| 148 | void board_BeforeInitMid(struct sysinfo *cb, AMD_MID_PARAMS *InitMid) |
| 149 | { |
| 150 | /* 0 iGpuVgaAdapter, 1 iGpuVgaNonAdapter; */ |
| 151 | InitMid->GnbMidConfiguration.iGpuVgaMode = 0; |
| 152 | } |