blob: 8f28990b6bc85266b35dc1561ad171164c26aca8 [file] [log] [blame]
Frank Vibrans2b4c8312011-02-14 18:30:54 +00001/* $NoKeywords:$ */
2/**
3 * @file
4 *
5 * mnprotoon.c
6 *
7 * Northbridge support functions for Errata and early samples
8 *
9 * @xrefitem bom "File Content Label" "Release Content"
10 * @e project: AGESA
11 * @e sub-project: (Mem/NB/ON)
12 * @e \$Revision: 37691 $ @e \$Date: 2010-09-10 04:28:23 +0800 (Fri, 10 Sep 2010) $
13 *
14 **/
15/*
16 *****************************************************************************
17 *
18 * Copyright (c) 2011, Advanced Micro Devices, Inc.
19 * All rights reserved.
Edward O'Callaghan1542a6f2014-07-06 19:24:06 +100020 *
Frank Vibrans2b4c8312011-02-14 18:30:54 +000021 * 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.
Edward O'Callaghan1542a6f2014-07-06 19:24:06 +100028 * * Neither the name of Advanced Micro Devices, Inc. nor the names of
29 * its contributors may be used to endorse or promote products derived
Frank Vibrans2b4c8312011-02-14 18:30:54 +000030 * from this software without specific prior written permission.
Edward O'Callaghan1542a6f2014-07-06 19:24:06 +100031 *
Frank Vibrans2b4c8312011-02-14 18:30:54 +000032 * 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.
Edward O'Callaghan1542a6f2014-07-06 19:24:06 +100042 *
Frank Vibrans2b4c8312011-02-14 18:30:54 +000043 * ***************************************************************************
44 *
45 */
46
47
48
49#include "AGESA.h"
50#include "amdlib.h"
51#include "Ids.h"
52#include "mm.h"
53#include "mn.h"
54#include "cpuRegisters.h"
55#include "AdvancedApi.h"
56#include "Filecode.h"
57#define FILECODE PROC_MEM_NB_ON_MNPROTOON_FILECODE
58
59/*----------------------------------------------------------------------------
60 * PROTOTYPES OF LOCAL FUNCTIONS
61 *
62 *----------------------------------------------------------------------------
63 */
64BOOLEAN
65STATIC
66MemNForceAutoCompON (
67 IN OUT MEM_NB_BLOCK *NBPtr,
68 IN OUT VOID *OptParam
69 );
70
71BOOLEAN
72STATIC
73MemNDetectMemPllErrorON (
74 IN OUT MEM_NB_BLOCK *NBPtr,
75 IN OUT VOID *OptParam
76 );
77/*
78 *-----------------------------------------------------------------------------
79 * EXPORTED FUNCTIONS
80 *
81 *-----------------------------------------------------------------------------
82 */
efdesign9884cbce22011-08-04 12:09:17 -060083VOID
84MemNInitEarlySampleSupportON (
85 IN OUT MEM_NB_BLOCK *NBPtr
86 );
87
Frank Vibrans2b4c8312011-02-14 18:30:54 +000088/* -----------------------------------------------------------------------------*/
89/**
90 *
91 * This function initializes early sample support for Ontario
92 *
93 * @param[in,out] NBPtr - Pointer to the MEM_NB_BLOCK
94 *
95 */
96VOID
97MemNInitEarlySampleSupportON (
98 IN OUT MEM_NB_BLOCK *NBPtr
99 )
100{
101 if ((NBPtr->MCTPtr->LogicalCpuid.Revision & AMD_F14_ON_A0) != 0) {
102 NBPtr->IsSupported[DramSrHys] = FALSE; // UBTS 233978
103 NBPtr->NBRegTable[BFRxMaxDurDllNoLock] = 0;
104 NBPtr->NBRegTable[BFTxMaxDurDllNoLock] = 0;
105 NBPtr->FamilySpecificHook[ForceAutoComp] = MemNForceAutoCompON;
106 }
107 if ((NBPtr->MCTPtr->LogicalCpuid.Revision & (AMD_F14_ON_A0 | AMD_F14_ON_A1)) != 0) {
108 NBPtr->FamilySpecificHook[DetectMemPllError] = MemNDetectMemPllErrorON;
109 }
110}
111
112
113/*----------------------------------------------------------------------------
114 * LOCAL FUNCTIONS
115 *
116 *----------------------------------------------------------------------------
117 */
118
119/*-----------------------------------------------------------------------------
120 *
121 *
122 * This function forces auto compensation to be disabled all the time for
123 * ON A0
124 *
125 * @param[in,out] *NBPtr - Pointer to the MEM_NB_BLOCK
126 * @param[in,out] OptParam - Optional parameter
127 *
128 * @return TRUE
129 * ----------------------------------------------------------------------------
130 */
131BOOLEAN
132STATIC
133MemNForceAutoCompON (
134 IN OUT MEM_NB_BLOCK *NBPtr,
135 IN OUT VOID *OptParam
136 )
137{
138 MemNSetBitFieldNb (NBPtr, BFPNOdtCal, 0x2020);
139 MemNSetBitFieldNb (NBPtr, BFPNDrvCal, 0x8080);
140 MemNSetBitFieldNb (NBPtr, BFCalVal, 0x8000);
141
142 return TRUE;
143}
144
145/*-----------------------------------------------------------------------------
146 *
147 *
148 * This function detects MemPll divide by 3 bug
149 *
150 * @param[in,out] *NBPtr - Pointer to the MEM_NB_BLOCK
151 * @param[in,out] OptParam - Optional parameter
152 *
153 * @return TRUE
154 * ----------------------------------------------------------------------------
155 */
156BOOLEAN
157STATIC
158MemNDetectMemPllErrorON (
159 IN OUT MEM_NB_BLOCK *NBPtr,
160 IN OUT VOID *OptParam
161 )
162{
163 UINT16 Value;
164
165 Value = 0xFFFF;
166 if ((*(UINT8 *) OptParam) < 5) {
167 LibAmdIoWrite (AccessWidth16, IDS_DEBUG_PORT, &Value, &NBPtr->MemPtr->StdHeader);
168 }
169 return TRUE;
170}