blob: f2f71a41829c31f83570514717bc68793930852a [file] [log] [blame]
Frank Vibrans2b4c8312011-02-14 18:30:54 +00001/* $NoKeywords:$ */
2/**
3 * @file
4 *
5 * mpson3.c
6 *
7 * Platform specific settings for ON DDR3 SO-DIMM system
8 *
9 * @xrefitem bom "File Content Label" "Release Content"
10 * @e project: AGESA
11 * @e sub-project: (Mem/Ps/ON)
efdesign9884cbce22011-08-04 12:09:17 -060012 * @e \$Revision: 46937 $ @e \$Date: 2011-02-11 08:50:58 -0700 (Fri, 11 Feb 2011) $
Frank Vibrans2b4c8312011-02-14 18:30:54 +000013 *
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#include "AGESA.h"
49#include "AdvancedApi.h"
50#include "mport.h"
51#include "ma.h"
52#include "Ids.h"
53#include "cpuFamRegisters.h"
54#include "mm.h"
55#include "mn.h"
56#include "mp.h"
57#include "PlatformMemoryConfiguration.h"
58#include "Filecode.h"
59#define FILECODE PROC_MEM_PS_ON_MPSON3_FILECODE
60/*----------------------------------------------------------------------------
61 * DEFINITIONS AND MACROS
62 *
63 *----------------------------------------------------------------------------
64 */
65STATIC CONST DRAM_TERM_ENTRY OnSoDdr3DramTerm[] = {
66 {DDR800 + DDR1066, ONE_DIMM, NO_DIMM, 2, 0, 0},
67 {DDR1333, ONE_DIMM, NO_DIMM, 1, 0, 0},
68 {DDR800, TWO_DIMM, NO_DIMM, 3, 0, 2},
69 {DDR1066 + DDR1333, TWO_DIMM, NO_DIMM, 5, 0, 2}
70};
71
72/*----------------------------------------------------------------------------
73 * TYPEDEFS AND STRUCTURES
74 *
75 *----------------------------------------------------------------------------
76 */
77
78/*----------------------------------------------------------------------------
79 * PROTOTYPES OF LOCAL FUNCTIONS
80 *
81 *----------------------------------------------------------------------------
82 */
83BOOLEAN
84STATIC
85MemPDoPsSON3 (
86 IN OUT MEM_NB_BLOCK *NBPtr
87 );
88
89VOID
90STATIC
91MemPGetPORFreqLimitSON3 (
92 IN OUT MEM_NB_BLOCK *NBPtr
93 );
94
95/*
96 *-----------------------------------------------------------------------------
97 * EXPORTED FUNCTIONS
98 *
99 *-----------------------------------------------------------------------------
100 */
101/* -----------------------------------------------------------------------------*/
102/**
103 *
104 * This function is the constructor the platform specific settings for SO SIMM-DDR3 ON DDR3
105 *
106 * @param[in,out] *MemPtr Pointer to MEM_DATA_STRUCTURE
107 * @param[in,out] *ChannelPtr Pointer to CH_DEF_STRUCT
108 * @param[in,out] *PsPtr Pointer to MEM_PS_BLOCK
109 *
110 * @return AGESA_SUCCESS
111 *
112 */
113
114AGESA_STATUS
115MemPConstructPsSON3 (
116 IN OUT MEM_DATA_STRUCT *MemPtr,
117 IN OUT CH_DEF_STRUCT *ChannelPtr,
118 IN OUT MEM_PS_BLOCK *PsPtr
119 )
120{
121 ASSERT (MemPtr != 0);
122 ASSERT (ChannelPtr != 0);
123
124 if ((ChannelPtr->MCTPtr->LogicalCpuid.Family & AMD_FAMILY_14_ON) == 0) {
125 return AGESA_UNSUPPORTED;
126 }
127 if (ChannelPtr->TechType != DDR3_TECHNOLOGY) {
128 return AGESA_UNSUPPORTED;
129 }
130 if (ChannelPtr->SODimmPresent != ChannelPtr->ChDimmValid) {
131 return AGESA_UNSUPPORTED;
132 }
133 PsPtr->MemPDoPs = MemPDoPsSON3;
efdesign9884cbce22011-08-04 12:09:17 -0600134
135 if ((ChannelPtr->MCTPtr->LogicalCpuid.Revision & AMD_F14_ON_Cx) == 0) {
Frank Vibrans2b4c8312011-02-14 18:30:54 +0000136 PsPtr->MemPGetPORFreqLimit = MemPGetPORFreqLimitSON3;
efdesign9884cbce22011-08-04 12:09:17 -0600137 } else {
138 // Do not force frequency limit for Rev C
139 PsPtr->MemPGetPORFreqLimit = (VOID (*) (MEM_NB_BLOCK *)) memDefRet;
140 }
141
Frank Vibrans2b4c8312011-02-14 18:30:54 +0000142 return AGESA_SUCCESS;
143}
144
145/* -----------------------------------------------------------------------------*/
146/**
147 *
148 * This is function sets the platform specific settings for S-DDR3 ON DDR3
149 *
150 * @param[in,out] *NBPtr Pointer to MEM_NB_BLOCK
151 *
152 * @return TRUE - Find settings for corresponding platform and dimm population.
153 * @return FALSE - Fail to find settings for corresponding platform and dimm population.
154 *
155 */
156
157BOOLEAN
158STATIC
159MemPDoPsSON3 (
160 IN OUT MEM_NB_BLOCK *NBPtr
161 )
162{
163 if (!MemPGetDramTerm (NBPtr, GET_SIZE_OF (OnSoDdr3DramTerm), OnSoDdr3DramTerm)) {
164 return FALSE;
165 }
166 return TRUE;
167}
168
169/* -----------------------------------------------------------------------------*/
170/**
171 *
172 * This is function gets the POR speed limit for Sodimm DDR3 of ON
173 *
174 * @param[in,out] *NBPtr Pointer to MEM_NB_BLOCK
175 *
176 *
177 */
178
179VOID
180STATIC
181MemPGetPORFreqLimitSON3 (
182 IN OUT MEM_NB_BLOCK *NBPtr
183 )
184{
185 if ((NBPtr->DCTPtr->Timings.TargetSpeed == DDR1333_FREQUENCY) && (MemNGetBitFieldNb (NBPtr, BFFixedErrataSkipPorFreqCap) == 0)) {
186 NBPtr->DCTPtr->Timings.TargetSpeed = DDR1066_FREQUENCY;
187 }
188}