5 * Config FCH Hwm controller
7 * Init Hwm Controller features.
9 * @xrefitem bom "File Content Label" "Release Content"
12 * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $
16 *****************************************************************************
18 * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc.
19 * All rights reserved.
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.
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 ****************************************************************************
44 #include "FchPlatform.h"
46 #define FILECODE PROC_FCH_HWM_FAMILY_YANGTZE_YANGTZEHWMLATESERVICE_FILECODE
49 * Table for Function Number
55 STATIC UINT8 FunctionNumber
[] =
64 * Table for Max Thermal Zone
80 * Table for Max Register
94 /*-------------------------------------------------------------------------------
95 ;Procedure: IsZoneFuncEnable
97 ;Description: This routine will check every zone support function with BitMap from user define
104 ;-----------------------------------------------------------------------------
113 return (BOOLEAN
) (((Flag
>> (func
*4)) & 0xF) & ((UINT8
)1 << Zone
));
116 /*-------------------------------------------------------------------------------
117 ;Procedure: FchECfancontrolservice
119 ;Description: This routine service EC fan policy
126 ;-----------------------------------------------------------------------------
129 FchECfancontrolservice (
139 FCH_DATA_BLOCK
*LocalCfgPtr
;
140 AMD_CONFIG_PARAMS
*StdHeader
;
142 LocalCfgPtr
= (FCH_DATA_BLOCK
*) FchDataPtr
;
143 StdHeader
= LocalCfgPtr
->StdHeader
;
145 if (!IsImcEnabled (StdHeader
)) {
146 return; //IMC is not enabled
149 CurPoint
= &LocalCfgPtr
->Imc
.EcStruct
.MsgFun81Zone0MsgReg0
+ MaxZone
[0] * (MaxRegister
[0] - MSG_REG0
+ 1);
151 for ( FunIndex
= 1; FunIndex
<= 3; FunIndex
++ ) {
152 FunNum
= FunctionNumber
[FunIndex
];
153 for ( ZoneNum
= 0; ZoneNum
< MaxZone
[FunIndex
]; ZoneNum
++ ) {
154 IsSendEcMsg
= IsZoneFuncEnable (LocalCfgPtr
->Imc
.EcStruct
.IMCFUNSupportBitMap
, FunIndex
, ZoneNum
);
156 for ( RegNum
= MSG_REG0
; RegNum
<= MaxRegister
[FunIndex
]; RegNum
++ ) {
157 WriteECmsg (RegNum
, AccessWidth8
, CurPoint
, StdHeader
);
160 WriteECmsg (MSG_SYS_TO_IMC
, AccessWidth8
, &FunNum
, StdHeader
); // function number
161 WaitForEcLDN9MailboxCmdAck (StdHeader
);
163 CurPoint
+= (MaxRegister
[FunIndex
] - MSG_REG0
+ 1);
168 CurPoint
= &LocalCfgPtr
->Imc
.EcStruct
.MsgFun81Zone0MsgReg0
;
169 for ( FunIndex
= 0; FunIndex
<= 0; FunIndex
++ ) {
170 FunNum
= FunctionNumber
[FunIndex
];
171 for ( ZoneNum
= 0; ZoneNum
< MaxZone
[FunIndex
]; ZoneNum
++ ) {
172 IsSendEcMsg
= IsZoneFuncEnable (LocalCfgPtr
->Imc
.EcStruct
.IMCFUNSupportBitMap
, FunIndex
, ZoneNum
);
174 for ( RegNum
= MSG_REG0
; RegNum
<= MaxRegister
[FunIndex
]; RegNum
++ ) {
175 if (RegNum
== MSG_REG2
) {
178 WriteECmsg (RegNum
, AccessWidth8
, CurPoint
, StdHeader
);
181 WriteECmsg (MSG_SYS_TO_IMC
, AccessWidth8
, &FunNum
, StdHeader
); // function number
182 WaitForEcLDN9MailboxCmdAck (StdHeader
);
184 CurPoint
+= (MaxRegister
[FunIndex
] - MSG_REG0
+ 1);