4 * Power on Reset register initialization.
8 * @xrefitem bom "File Content Label" "Release Content"
11 * @e \$Revision:$ @e \$Date:$
14 /*****************************************************************************
16 * Copyright (C) 2012 Advanced Micro Devices, Inc.
17 * All rights reserved.
19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions are met:
21 * * Redistributions of source code must retain the above copyright
22 * notice, this list of conditions and the following disclaimer.
23 * * Redistributions in binary form must reproduce the above copyright
24 * notice, this list of conditions and the following disclaimer in the
25 * documentation and/or other materials provided with the distribution.
26 * * Neither the name of Advanced Micro Devices, Inc. nor the names of
27 * its contributors may be used to endorse or promote products derived
28 * from this software without specific prior written permission.
30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
31 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
32 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
33 * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY
34 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
35 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
36 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
37 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
39 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 ***************************************************************************/
44 /*----------------------------------------------------------------------------------------
45 * M O D U L E S U S E D
46 *----------------------------------------------------------------------------------------
49 #include "NbPlatform.h"
50 #include "amdDebugOutLib.h"
52 /*----------------------------------------------------------------------------------------
53 * D E F I N I T I O N S A N D M A C R O S
54 *----------------------------------------------------------------------------------------
58 /*----------------------------------------------------------------------------------------
59 * T Y P E D E F S A N D S T R U C T U R E S
60 *----------------------------------------------------------------------------------------
63 /*----------------------------------------------------------------------------------------
64 * 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
65 *----------------------------------------------------------------------------------------
68 NbPorInitValidateInput (
69 IN AMD_NB_CONFIG *pConfig
72 /*----------------------------------------------------------------------------------------
73 * E X P O R T E D F U N C T I O N S
74 *----------------------------------------------------------------------------------------
76 /// PCI registers init table
77 CONST REGISTER_ENTRY NbPorPciTable[] = {
78 {NB_PCI_REG04, 0xFD, 0x02},
79 //Reg84h[4]=1 (EV6MODE) to allow decode of 640k-1MB
80 {NB_PCI_REG84, 0xEF, 0x10},
81 //Reg4Ch[1]=1 (APIC_ENABLE) force cpu request with address 0xFECx_xxxx to south-bridge
82 //Reg4Ch[6]=1 (BMMsgEn) enable BM_Set message generation
83 {NB_PCI_REG4C, 0x00, 0x42},
84 //Reg4Ch[16]=1 (WakeC2En) enable Wake_from_C2 message generation.
85 //Reg4Ch[18]=1 (P4IntEnable) Enable north-bridge to accept MSI with address 0xFEEx_xxxx from south-bridge
86 {NB_PCI_REG4E, 0xFF, 0x05},
87 //Set temporary NB TOM to 0xE0000000
88 {NB_PCI_REG90 + 3, 0x00, 0xE0}
91 /// MISCIND registers init table
92 CONST INDIRECT_REG_ENTRY NbPorMiscTable[] = {
93 // NB_MISC_IND_WR_EN + IOC_PCIE_CNTL
94 // Block non-snoop DMA request if PMArbDis is set.
101 // NBCFG (NBMISCIND 0x0): NB_CNTL -
102 // HIDE_NB_AGP_CAP ([0], default=1)HIDE
103 // HIDE_P2P_AGP_CAP ([1], default=1)HIDE
104 // HIDE_NB_GART_BAR ([2], default=1)HIDE
105 // HIDE_MMCFG_BAR ([3], default=1)HIDE
106 // AGPMODE30 ([4], default=0)DISABLE
107 // AGP30ENCHANCED ([5], default=0)DISABLE
108 // HIDE_AGP_CAP ([8], default=1)ENABLE
114 //NBMISIND:0x01 Bit[8]=1 IOC will forward the byte-enable (BE), which is 16'b0 for zero-byte reads, of the PCIE DMA request upstream to HTIU.
115 //NBMISIND:0x01 Bit[9]=1 zero-byte reads.
121 //NBMISIND:0x40 Bit[8]=1 and Bit[10]=1 following bits are required to set in order to allow PWM features to work.
127 //Enable slot power message
183 //NBMISCIND:0x0C[13]= 1 Enables GSM Mode.
189 //NBMISCIND:0x12[16]= 1 ReqID for GPP1 and GPP2
190 //NBMISCIND:0x12[17]= 1 ReqID for GPP3a, GPP3b, SB
191 //NBMISCIND:0x12[18]= 0 ReqID override for SB
192 //NBMISCIND:0x12[19]= 1 Enable INT accumulators
193 //NBMISCIND:0x12[20, 21, 23]= 1 4103, 4125, 4155 4186 (A21).
194 //NBMISCIND:0x12[22]=0 Prevent spurious DR of UMA request (RPR 5.9.3)
197 (UINT32)~(BIT18 + BIT22),
200 //NBMISCIND:0x75[15.13,16..18,21..19,24..22,25..25] = 0x4 Enable AER
201 //NBMISCIND:0x75[29]= 1 Device ID for hotplug and PME message.
205 (4 << 13) | (4 << 16) | (4 << 19) | (4 << 22) | (4 << 25) | BIT29
211 BIT6 + BIT7 + BIT14 + BIT15 + BIT22 + BIT23
220 (UINT32)~(BIT0 + BIT1 + BIT19),
230 (UINT32)~(BIT7 + BIT15 + BIT23),
235 (UINT32)~(0xffful << 20),
240 (UINT32)~(0xful << 16),
245 (UINT32)~(0xful << 24 ),
248 // Enable ACS capability
256 /// HTIUIND registers init table
257 CONST INDIRECT_REG_ENTRY NbPorHtiuTable[] = {
258 //HTIU x 05 [8] = 0x0 Enables PC checking for FCB release.
259 //HTIU x 05 [13,13,3,14,10,12,17,18,15,4,6,19] = 0x1 Misc (A21)
260 {NB_HTIU_REG05, 0xFFFFFEFF, BIT8 + BIT16 + BIT13 + BIT3 + BIT14 + BIT10 + BIT12 + BIT17 + BIT18 + BIT15 +
261 BIT4 + BIT6 + BIT19 },
262 //HTIU x 06 [0] = 0x0 Enables writes to pass in-progress reads
263 //HTIU x 06 [1] = 0x1 Enables streaming of CPU writes
264 //HTIU x 06 [9] = 0x1 Enables extended write buffer for CPU writes
265 //HTIU x 06 [13] = 0x1 Enables additional response buffers
266 //HTIU x 06 [17] = 0x1 Enables special reads to pass writes
267 //HTIU x 06 [16:15] = 0x3 Enables decoding of C1e/C3 and FID cycles
268 //HTIU x 06 [25] = 0x1 Enables HTIU-display handshake bypass.
269 //HTIU x 06 [30] = 0x1 Enables tagging fix
270 {NB_HTIU_REG06, 0xFFFFFFFE, 0x04203A202},
271 //HTIU x 07 [0] = 0x1 Enables byte-write optimization for IOC requests
272 //HTIU x 07 [1] = 0x0 Disables delaying STPCLK de-assert during FID sequence. Needed when enhanced UMA arbitration is used.
273 //HTIU x 07 [2] = 0x0 Disables upstream system-management delay
274 {NB_HTIU_REG07, 0xFFFFFFF9, 0x0001 },
275 //HTIU x 1C [31:17]=0xfff i.e. 0001 1111 1111 111 or 1FFE Enables all traffic to be detected as GSM traffic.
276 {NB_HTIU_REG1C, 0xFFFFFFFF, 0x1ffe0000 },
277 //HTIU x 15 [27]=0x1 Powers down the chipset DLLs in the LS2 state.
278 {NB_HTIU_REG15, 0xFFFFFFFF, BIT27 },
279 //Enable transmit PHY to reinitialize in HT1 mode when tristate is enabled
280 //HTIU x 16 [10]=0x1 enable proper DLL reset sequence.
281 {NB_HTIU_REG16, 0xFFFFFFFF, BIT11 + BIT10},
282 //HTIU x 2A [1:0]=0x1 Optimize chipset HT transmitter drive strength
283 {NB_HTIU_REG2A, 0xfffffffc, 0x00000001 }
286 /*----------------------------------------------------------------------------------------*/
288 * Amd Power on Reset Initialization for all NB.
293 * @param[in] ConfigPtr Northbridges configuration block pointer.
299 AmdPowerOnResetInit (
300 IN AMD_NB_CONFIG_BLOCK *ConfigPtr
305 Status = LibNbApiCall (NbPowerOnResetInit, ConfigPtr);
310 /*----------------------------------------------------------------------------------------*/
312 * NB Power on Reset Initialization.
313 * Basic registers initialization.
317 * @param[in] NbConfigPtr Northbridge configuration structure pointer.
324 IN AMD_NB_CONFIG *NbConfigPtr
328 REGISTER_ENTRY *pTable;
331 CIMX_TRACE ((TRACE_DATA (GET_BLOCK_CONFIG_PTR (NbConfigPtr), CIMX_NBPOR_TRACE), "[NBPOR]NbPowerOnResetInit Enter\n"));
332 Status = NbPorInitValidateInput (NbConfigPtr);
333 if (Status == AGESA_FATAL) {
334 REPORT_EVENT (AGESA_FATAL, GENERAL_ERROR_BAD_CONFIGURATION, 0, 0, 0, 0, NbConfigPtr);
339 pTable = (REGISTER_ENTRY*)FIX_PTR_ADDR (&NbPorPciTable[0], NULL);
340 for (i = 0; i < (sizeof (NbPorPciTable) / sizeof (REGISTER_ENTRY)); i++) {
341 LibNbPciRMW (NbConfigPtr->NbPciAddress.AddressValue | pTable->Register, AccessWidth8, pTable->Mask, pTable->Data, NbConfigPtr);
344 //Init Misc registers
345 LibNbIndirectTableInit (
346 NbConfigPtr->NbPciAddress.AddressValue | NB_MISC_INDEX,
348 (INDIRECT_REG_ENTRY*)FIX_PTR_ADDR (&NbPorMiscTable[0], NULL),
349 (sizeof (NbPorMiscTable) / sizeof (INDIRECT_REG_ENTRY)),
353 //Init Htiu registers
354 LibNbIndirectTableInit (
355 NbConfigPtr->NbPciAddress.AddressValue | NB_HTIU_INDEX,
357 (INDIRECT_REG_ENTRY*)FIX_PTR_ADDR (&NbPorHtiuTable[0],NULL),
358 (sizeof (NbPorHtiuTable) / sizeof (INDIRECT_REG_ENTRY)),
362 CIMX_TRACE ((TRACE_DATA (GET_BLOCK_CONFIG_PTR (NbConfigPtr), CIMX_NBPOR_TRACE), "[NBPOR]NbPowerOnResetInit Exit\n"));
366 /*----------------------------------------------------------------------------------------*/
368 * Validate input parameters
373 * @param[in] pConfig Northbridge configuration structure pointer.
378 NbPorInitValidateInput (
379 IN AMD_NB_CONFIG *pConfig
382 return (LibNbGetRevisionInfo (pConfig).Type == NB_UNKNOWN)?AGESA_FATAL:AGESA_SUCCESS;