7 * On Dimm thermal management.
9 * @xrefitem bom "File Content Label" "Release Content"
11 * @e sub-project: (Mem/Feat)
12 * @e \$Revision: 44324 $ @e \$Date: 2010-12-22 02:16:51 -0700 (Wed, 22 Dec 2010) $
15 /*****************************************************************************
17 * Copyright (C) 2012 Advanced Micro Devices, Inc.
18 * All rights reserved.
20 * Redistribution and use in source and binary forms, with or without
21 * modification, are permitted provided that the following conditions are met:
22 * * Redistributions of source code must retain the above copyright
23 * notice, this list of conditions and the following disclaimer.
24 * * Redistributions in binary form must reproduce the above copyright
25 * notice, this list of conditions and the following disclaimer in the
26 * documentation and/or other materials provided with the distribution.
27 * * Neither the name of Advanced Micro Devices, Inc. nor the names of
28 * its contributors may be used to endorse or promote products derived
29 * from this software without specific prior written permission.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
32 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
33 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
34 * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY
35 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
36 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
37 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
38 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
40 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 * ***************************************************************************
47 *----------------------------------------------------------------------------
50 *----------------------------------------------------------------------------
60 #include "mfodthermal.h"
65 #define FILECODE PROC_MEM_FEAT_ODTHERMAL_MFODTHERMAL_FILECODE
67 /*----------------------------------------------------------------------------
68 * DEFINITIONS AND MACROS
70 *----------------------------------------------------------------------------
73 /*----------------------------------------------------------------------------
74 * TYPEDEFS AND STRUCTURES
76 *----------------------------------------------------------------------------
79 /*----------------------------------------------------------------------------
80 * PROTOTYPES OF LOCAL FUNCTIONS
82 *----------------------------------------------------------------------------
85 /*----------------------------------------------------------------------------
88 *----------------------------------------------------------------------------
90 /*-----------------------------------------------------------------------------*/
93 * This function does On-Dimm thermal management.
95 * @param[in, out] *NBPtr - Pointer to the MEM_NB_BLOCK.
97 * @return TRUE - This feature is enabled.
98 * @return FALSE - This feature is not enabled.
103 IN OUT MEM_NB_BLOCK *NBPtr
108 CH_DEF_STRUCT *ChannelPtr;
109 MEM_DATA_STRUCT *MemPtr;
118 ASSERT (NBPtr != NULL);
119 MemPtr = NBPtr->MemPtr;
120 AGESA_TESTPOINT (TpProcMemOnDimmThermal, &MemPtr->StdHeader);
121 if (NBPtr->MCTPtr->NodeMemSize != 0) {
122 for (Dct = 0; Dct < NBPtr->DctCount; Dct++) {
123 NBPtr->SwitchDCT (NBPtr, Dct);
124 // Only go through the DCT if it is not disabled.
125 if (NBPtr->GetBitField (NBPtr, BFDisDramInterface) == 0) {
126 ChannelPtr = NBPtr->ChannelPtr;
127 // If Ganged mode is enabled, need to go through all dram devices on both DCTs.
128 if (!NBPtr->Ganged || (NBPtr->Dct != 1)) {
129 if (!(NBPtr->IsSupported[CheckSetSameDctODTsEn]) || (NBPtr->IsSupported[CheckSetSameDctODTsEn] && (NBPtr->Dct != 1))) {
134 for (i = 0; i < MAX_DIMMS_PER_CHANNEL; i ++) {
135 if (NBPtr->TechPtr->GetDimmSpdBuffer (NBPtr->TechPtr, &SpdBufferPtr, i)) {
136 // Check byte 31: thermal and refresh option.
137 ThermalOp = SpdBufferPtr[THERMAL_OPT];
138 // Bit 3: ODTS readout
139 if (!((ThermalOp >> 3) & 1)) {
142 // Bit 0: Extended Temperature Range.
143 if (!(ThermalOp & 1)) {
149 if (!NBPtr->Ganged || (NBPtr->Dct == 1)) {
150 // If in ganged mode, need to switch back to DCT0 to set the registers.
151 if (NBPtr->Ganged || NBPtr->IsSupported[CheckSetSameDctODTsEn]) {
152 NBPtr->SwitchDCT (NBPtr, 0);
153 ChannelPtr = NBPtr->ChannelPtr;
155 // If all dram devices on a DCT support ODTS
157 NBPtr->SetBitField (NBPtr, BFODTSEn, 1);
159 ChannelPtr->ExtendTmp = ExtendTmp;
162 IDS_HDT_CONSOLE (MEM_FLOW, "\tDct %d\n", Dct);
163 IDS_HDT_CONSOLE (MEM_FLOW, "\t\tODTSEn = %d\n", ODTSEn);
164 IDS_HDT_CONSOLE (MEM_FLOW, "\t\tExtendTmp = %d\n", ExtendTmp);
171 /*----------------------------------------------------------------------------
174 *----------------------------------------------------------------------------