Siyuan Wang | affe85f | 2013-07-25 15:14:15 +0800 | [diff] [blame] | 1 | /* $NoKeywords:$ */ |
| 2 | /** |
| 3 | * @file |
| 4 | * |
| 5 | * PCIe init tables. |
| 6 | * |
| 7 | * |
| 8 | * |
| 9 | * @xrefitem bom "File Content Label" "Release Content" |
| 10 | * @e project: AGESA |
| 11 | * @e sub-project: GNB |
| 12 | * @e \$Revision: 85361 $ @e \$Date: 2013-01-07 11:15:28 -0600 (Mon, 07 Jan 2013) $ |
| 13 | * |
| 14 | */ |
| 15 | /* |
| 16 | ***************************************************************************** |
| 17 | * |
| 18 | * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. |
| 19 | * All rights reserved. |
| 20 | * |
| 21 | * Redistribution and use in source and binary forms, with or without |
| 22 | * modification, are permitted provided that the following conditions are met: |
| 23 | * * Redistributions of source code must retain the above copyright |
| 24 | * notice, this list of conditions and the following disclaimer. |
| 25 | * * Redistributions in binary form must reproduce the above copyright |
| 26 | * notice, this list of conditions and the following disclaimer in the |
| 27 | * documentation and/or other materials provided with the distribution. |
| 28 | * * Neither the name of Advanced Micro Devices, Inc. nor the names of |
| 29 | * its contributors may be used to endorse or promote products derived |
| 30 | * from this software without specific prior written permission. |
| 31 | * |
| 32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 33 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 35 | * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY |
| 36 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 37 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 38 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 39 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 40 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 41 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 42 | * *************************************************************************** |
| 43 | * |
| 44 | */ |
| 45 | /*---------------------------------------------------------------------------------------- |
| 46 | * M O D U L E S U S E D |
| 47 | *---------------------------------------------------------------------------------------- |
| 48 | */ |
| 49 | #include "AGESA.h" |
| 50 | #include "Gnb.h" |
| 51 | #include "GnbPcie.h" |
| 52 | #include "GnbRegistersKB.h" |
| 53 | |
| 54 | /*---------------------------------------------------------------------------------------- |
| 55 | * D E F I N I T I O N S A N D M A C R O S |
| 56 | *---------------------------------------------------------------------------------------- |
| 57 | */ |
| 58 | |
| 59 | |
| 60 | /*---------------------------------------------------------------------------------------- |
| 61 | * T Y P E D E F S A N D S T R U C T U R E S |
| 62 | *---------------------------------------------------------------------------------------- |
| 63 | */ |
| 64 | |
| 65 | |
| 66 | /*---------------------------------------------------------------------------------------- |
| 67 | * P R O T O T Y P E S O F L O C A L F U N C T I O N S |
| 68 | *---------------------------------------------------------------------------------------- |
| 69 | */ |
| 70 | |
| 71 | |
| 72 | /*---------------------------------------------------------------------------------------- |
| 73 | * T A B L E S |
| 74 | *---------------------------------------------------------------------------------------- |
| 75 | */ |
| 76 | |
Arthur Heymans | b80de18 | 2022-05-16 15:29:53 +0200 | [diff] [blame^] | 77 | STATIC CONST PCIE_HOST_REGISTER_ENTRY PcieInitEarlyTable ROMDATA[] = { |
Siyuan Wang | affe85f | 2013-07-25 15:14:15 +0800 | [diff] [blame] | 78 | { |
| 79 | PHY_SPACE (0, 0, D0F0xE4_PHY_4440_ADDRESS), |
| 80 | D0F0xE4_PHY_4440_PllDbgRoIPFDResetCntrl_MASK, |
| 81 | 0x2 << D0F0xE4_PHY_4440_PllDbgRoIPFDResetCntrl_OFFSET |
| 82 | }, |
| 83 | { |
| 84 | PHY_SPACE (0, 0, D0F0xE4_PHY_4450_ADDRESS), |
| 85 | D0F0xE4_PHY_4450_PllCfgROVTOIBiasCntrlOvrdVal0_MASK | |
| 86 | D0F0xE4_PHY_4450_PllCfgROBWCntrlOvrdVal0_MASK, |
| 87 | (0x0 << D0F0xE4_PHY_4450_PllCfgROVTOIBiasCntrlOvrdVal0_OFFSET) | (0x90 << D0F0xE4_PHY_4450_PllCfgROBWCntrlOvrdVal0_OFFSET) |
| 88 | }, |
| 89 | { |
| 90 | PHY_SPACE (0, 0, D0F0xE4_PHY_0004_ADDRESS), |
| 91 | D0F0xE4_PHY_0004_CfgIdleDetTh_MASK, |
| 92 | 0x0 << D0F0xE4_PHY_0004_CfgIdleDetTh_OFFSET |
| 93 | } |
| 94 | }; |
| 95 | |
| 96 | CONST PCIE_HOST_REGISTER_TABLE_HEADER ROMDATA PcieInitEarlyTableKB = { |
| 97 | &PcieInitEarlyTable[0], |
Patrick Georgi | 6b688f5 | 2021-02-12 13:49:11 +0100 | [diff] [blame] | 98 | ARRAY_SIZE(PcieInitEarlyTable) |
| 99 | }; |
Siyuan Wang | affe85f | 2013-07-25 15:14:15 +0800 | [diff] [blame] | 100 | |
Arthur Heymans | b80de18 | 2022-05-16 15:29:53 +0200 | [diff] [blame^] | 101 | STATIC CONST PCIE_HOST_REGISTER_ENTRY ROMDATA CoreInitTable [] = { |
Siyuan Wang | affe85f | 2013-07-25 15:14:15 +0800 | [diff] [blame] | 102 | { |
| 103 | D0F0xE4_CORE_0020_ADDRESS, |
| 104 | D0F0xE4_CORE_0020_CiRcOrderingDis_MASK | |
| 105 | D0F0xE4_CORE_0020_CiSlvOrderingDis_MASK, |
| 106 | (0x1 << D0F0xE4_CORE_0020_CiRcOrderingDis_OFFSET) |
| 107 | }, |
| 108 | { |
| 109 | D0F0xE4_CORE_0010_ADDRESS, |
| 110 | D0F0xE4_CORE_0010_RxUmiAdjPayloadSize_MASK, |
| 111 | (0x4 << D0F0xE4_CORE_0010_RxUmiAdjPayloadSize_OFFSET) |
| 112 | }, |
| 113 | { |
| 114 | D0F0xE4_CORE_001C_ADDRESS, |
| 115 | D0F0xE4_CORE_001C_TxArbRoundRobinEn_MASK | |
| 116 | D0F0xE4_CORE_001C_TxArbSlvLimit_MASK | |
| 117 | D0F0xE4_CORE_001C_TxArbMstLimit_MASK, |
| 118 | (0x1 << D0F0xE4_CORE_001C_TxArbRoundRobinEn_OFFSET) | |
| 119 | (0x4 << D0F0xE4_CORE_001C_TxArbSlvLimit_OFFSET) | |
| 120 | (0x4 << D0F0xE4_CORE_001C_TxArbMstLimit_OFFSET) |
| 121 | }, |
| 122 | { |
| 123 | D0F0xE4_CORE_0040_ADDRESS, |
| 124 | D0F0xE4_CORE_0040_PElecIdleMode_MASK, |
| 125 | (0x1 << D0F0xE4_CORE_0040_PElecIdleMode_OFFSET) |
| 126 | }, |
| 127 | { |
| 128 | D0F0xE4_CORE_0002_ADDRESS, |
| 129 | D0F0xE4_CORE_0002_HwDebug_0_MASK, |
| 130 | (0x1 << D0F0xE4_CORE_0002_HwDebug_0_OFFSET) |
| 131 | }, |
| 132 | { |
| 133 | D0F0xE4_CORE_00C1_ADDRESS, |
| 134 | D0F0xE4_CORE_00C1_StrapLinkBwNotificationCapEn_MASK | |
| 135 | D0F0xE4_CORE_00C1_StrapGen2Compliance_MASK, |
| 136 | (0x1 << D0F0xE4_CORE_00C1_StrapLinkBwNotificationCapEn_OFFSET) | |
| 137 | (0x1 << D0F0xE4_CORE_00C1_StrapGen2Compliance_OFFSET) |
| 138 | }, |
| 139 | { |
| 140 | D0F0xE4_CORE_00B0_ADDRESS, |
| 141 | D0F0xE4_CORE_00B0_StrapF0MsiEn_MASK | |
| 142 | D0F0xE4_CORE_00B0_StrapF0AerEn_MASK, |
| 143 | (0x1 << D0F0xE4_CORE_00B0_StrapF0MsiEn_OFFSET) | (0x0 << D0F0xE4_CORE_00B0_StrapF0AerEn_OFFSET) |
| 144 | } |
| 145 | }; |
| 146 | |
| 147 | CONST PCIE_HOST_REGISTER_TABLE_HEADER ROMDATA CoreInitTableKB = { |
| 148 | &CoreInitTable[0], |
Patrick Georgi | 6b688f5 | 2021-02-12 13:49:11 +0100 | [diff] [blame] | 149 | ARRAY_SIZE(CoreInitTable) |
| 150 | }; |
Siyuan Wang | affe85f | 2013-07-25 15:14:15 +0800 | [diff] [blame] | 151 | |
| 152 | |
Arthur Heymans | b80de18 | 2022-05-16 15:29:53 +0200 | [diff] [blame^] | 153 | STATIC CONST PCIE_PORT_REGISTER_ENTRY ROMDATA PortInitEarlyTable [] = { |
Siyuan Wang | affe85f | 2013-07-25 15:14:15 +0800 | [diff] [blame] | 154 | { |
| 155 | DxFxxE4_x70_ADDRESS, |
| 156 | DxFxxE4_x70_RxRcbCplTimeoutMode_MASK, |
| 157 | (0x1 << DxFxxE4_x70_RxRcbCplTimeoutMode_OFFSET) |
| 158 | }, |
| 159 | { |
| 160 | DxFxxE4_xA0_ADDRESS, |
| 161 | DxFxxE4_xA0_Lc16xClearTxPipe_MASK | DxFxxE4_xA0_LcL1ImmediateAck_MASK | DxFxxE4_xA0_LcL0sInactivity_MASK, |
| 162 | (0x1 << DxFxxE4_xA0_Lc16xClearTxPipe_OFFSET) | |
| 163 | (0x1 << DxFxxE4_xA0_LcL1ImmediateAck_OFFSET) | |
| 164 | (0x6 << DxFxxE4_xA0_LcL0sInactivity_OFFSET) |
| 165 | }, |
| 166 | { |
| 167 | DxFxxE4_xA1_ADDRESS, |
| 168 | DxFxxE4_xA1_LcDontGotoL0sifL1Armed_MASK, |
| 169 | (0x1 << DxFxxE4_xA1_LcDontGotoL0sifL1Armed_OFFSET) |
| 170 | }, |
| 171 | { |
| 172 | DxFxxE4_xA2_ADDRESS, |
| 173 | DxFxxE4_xA2_LcRenegotiateEn_MASK | DxFxxE4_xA2_LcUpconfigureSupport_MASK, |
| 174 | (0x1 << DxFxxE4_xA2_LcRenegotiateEn_OFFSET) | |
| 175 | (0x1 << DxFxxE4_xA2_LcUpconfigureSupport_OFFSET) |
| 176 | }, |
| 177 | { |
| 178 | DxFxxE4_xA3_ADDRESS, |
| 179 | DxFxxE4_xA3_LcXmitFtsBeforeRecovery_MASK, |
| 180 | (0x1 << DxFxxE4_xA3_LcXmitFtsBeforeRecovery_OFFSET) |
| 181 | }, |
| 182 | { |
| 183 | DxFxxE4_xB1_ADDRESS, |
| 184 | DxFxxE4_xB1_LcElecIdleMode_MASK | |
| 185 | DxFxxE4_xB1_LcDeassertRxEnInL0s_MASK | |
| 186 | DxFxxE4_xB1_LcBlockElIdleinL0_MASK, |
| 187 | (0x1 << DxFxxE4_xB1_LcElecIdleMode_OFFSET) | |
| 188 | (0x1 << DxFxxE4_xB1_LcDeassertRxEnInL0s_OFFSET) | |
| 189 | (0x1 << DxFxxE4_xB1_LcBlockElIdleinL0_OFFSET) |
| 190 | }, |
| 191 | { |
| 192 | 0xC0, |
| 193 | 0x70000, |
| 194 | (0x1 << 16) |
| 195 | } |
| 196 | }; |
| 197 | |
| 198 | CONST PCIE_PORT_REGISTER_TABLE_HEADER ROMDATA PortInitEarlyTableKB = { |
| 199 | &PortInitEarlyTable[0], |
Patrick Georgi | 6b688f5 | 2021-02-12 13:49:11 +0100 | [diff] [blame] | 200 | ARRAY_SIZE(PortInitEarlyTable) |
| 201 | }; |
Siyuan Wang | affe85f | 2013-07-25 15:14:15 +0800 | [diff] [blame] | 202 | |
| 203 | |
| 204 | STATIC PCIE_PORT_REGISTER_ENTRY ROMDATA PortInitMidTable [] = { |
| 205 | { |
| 206 | DxFxxE4_xA2_ADDRESS, |
| 207 | DxFxxE4_xA2_LcDynLanesPwrState_MASK, |
| 208 | (0x3 << DxFxxE4_xA2_LcDynLanesPwrState_OFFSET) |
| 209 | }, |
| 210 | { |
| 211 | DxFxxE4_x6A_ADDRESS, |
| 212 | DxFxxE4_x6A_ErrReportingDis_MASK, |
| 213 | (0x1 << DxFxxE4_x6A_ErrReportingDis_OFFSET) |
| 214 | }, |
| 215 | // { |
| 216 | // 0xC0, |
| 217 | // DxFxxE4_xC0_StrapAutoRcSpeedNegotiationDis_MASK, |
| 218 | // (0x1 << DxFxxE4_xC0_StrapAutoRcSpeedNegotiationDis_OFFSET) |
| 219 | // } |
| 220 | }; |
| 221 | |
| 222 | CONST PCIE_PORT_REGISTER_TABLE_HEADER ROMDATA PortInitMidTableKB = { |
| 223 | &PortInitMidTable[0], |
Patrick Georgi | 6b688f5 | 2021-02-12 13:49:11 +0100 | [diff] [blame] | 224 | ARRAY_SIZE(PortInitMidTable) |
| 225 | }; |