WANG Siyuan | f77f734 | 2013-08-13 17:09:51 +0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2012 Advanced Micro Devices, Inc. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
Bruce Griffith | 5bdcff5 | 2013-08-23 19:48:17 -0600 | [diff] [blame] | 20 | #include <device/azalia.h> |
Kyösti Mälkki | 526c2fb | 2014-07-10 22:16:58 +0300 | [diff] [blame] | 21 | #include "AGESA.h" |
WANG Siyuan | f77f734 | 2013-08-13 17:09:51 +0800 | [diff] [blame] | 22 | #include "amdlib.h" |
| 23 | #include "BiosCallOuts.h" |
| 24 | #include "Ids.h" |
| 25 | #include "OptionsIds.h" |
| 26 | #include "heapManager.h" |
| 27 | #include "FchPlatform.h" |
| 28 | #include "cbfs.h" |
Kyösti Mälkki | 6025efa | 2014-05-05 13:20:56 +0300 | [diff] [blame] | 29 | #include <stdlib.h> |
WANG Siyuan | f77f734 | 2013-08-13 17:09:51 +0800 | [diff] [blame] | 30 | |
Kyösti Mälkki | 6025efa | 2014-05-05 13:20:56 +0300 | [diff] [blame] | 31 | const BIOS_CALLOUT_STRUCT BiosCallouts[] = |
WANG Siyuan | f77f734 | 2013-08-13 17:09:51 +0800 | [diff] [blame] | 32 | { |
Kyösti Mälkki | ef9343c | 2014-05-04 11:42:55 +0300 | [diff] [blame] | 33 | {AGESA_ALLOCATE_BUFFER, agesa_AllocateBuffer }, |
| 34 | {AGESA_DEALLOCATE_BUFFER, agesa_DeallocateBuffer }, |
| 35 | {AGESA_LOCATE_BUFFER, agesa_LocateBuffer }, |
WANG Siyuan | f77f734 | 2013-08-13 17:09:51 +0800 | [diff] [blame] | 36 | {AGESA_READ_SPD, fam16kb_ReadSpd }, |
Kyösti Mälkki | 83cc3b0 | 2014-05-04 23:13:08 +0300 | [diff] [blame] | 37 | {AGESA_DO_RESET, agesa_Reset }, |
| 38 | {AGESA_READ_SPD_RECOVERY, agesa_NoopUnsupported }, |
| 39 | {AGESA_RUNFUNC_ONAP, agesa_RunFuncOnAp }, |
| 40 | {AGESA_GET_IDS_INIT_DATA, agesa_EmptyIdsInitData }, |
| 41 | {AGESA_HOOKBEFORE_DQS_TRAINING, agesa_NoopSuccess }, |
| 42 | {AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess }, |
WANG Siyuan | f77f734 | 2013-08-13 17:09:51 +0800 | [diff] [blame] | 43 | {AGESA_FCH_OEM_CALLOUT, Fch_Oem_config }, |
Kyösti Mälkki | cb989f2 | 2014-05-04 23:13:08 +0300 | [diff] [blame] | 44 | {AGESA_GNB_GFX_GET_VBIOS_IMAGE, agesa_GfxGetVbiosImage } |
WANG Siyuan | f77f734 | 2013-08-13 17:09:51 +0800 | [diff] [blame] | 45 | }; |
Kyösti Mälkki | 6025efa | 2014-05-05 13:20:56 +0300 | [diff] [blame] | 46 | const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts); |
WANG Siyuan | f77f734 | 2013-08-13 17:09:51 +0800 | [diff] [blame] | 47 | |
| 48 | /** |
Bruce Griffith | 5bdcff5 | 2013-08-23 19:48:17 -0600 | [diff] [blame] | 49 | * CODEC Initialization Table for Azalia HD Audio using Realtek ALC662 chip |
WANG Siyuan | f77f734 | 2013-08-13 17:09:51 +0800 | [diff] [blame] | 50 | */ |
Bruce Griffith | 5bdcff5 | 2013-08-23 19:48:17 -0600 | [diff] [blame] | 51 | static const CODEC_ENTRY Alc662_VerbTbl[] = |
| 52 | { |
| 53 | { 0x14, /*01014010*/ /* Port D - green headphone jack */ |
| 54 | (AZALIA_PINCFG_PORT_JACK << 30) |
| 55 | | ((AZALIA_PINCFG_LOCATION_EXTERNAL | AZALIA_PINCFG_LOCATION_REAR) << 24) |
| 56 | | (AZALIA_PINCFG_DEVICE_LINEOUT << 20) |
| 57 | | (AZALIA_PINCFG_CONN_MINI_HEADPHONE_JACK << 16) |
| 58 | | (AZALIA_PINCFG_COLOR_GREEN << 12) |
| 59 | | (1 << 4) |
| 60 | | (0 << 0) |
| 61 | }, |
| 62 | { 0x15, /*0x90170120*/ /* Port A - white speaker header */ |
| 63 | (AZALIA_PINCFG_PORT_FIXED << 30) |
| 64 | | (AZALIA_PINCFG_LOCATION_INTERNAL << 24) |
| 65 | | (AZALIA_PINCFG_DEVICE_SPEAKER << 20) |
| 66 | | (AZALIA_PINCFG_CONN_OTHER_ANALOG << 16) |
| 67 | | (AZALIA_PINCFG_COLOR_WHITE << 12) |
| 68 | | (AZALIA_PINCFG_MISC_IGNORE_PRESENCE << 8) |
| 69 | | (2 << 4) |
| 70 | | (0 << 0) |
| 71 | }, |
| 72 | { 0x16, 0x411111F0 }, /* Port G - not connected */ |
| 73 | { 0x18, /*0x01A19040*/ /* Port B - pink headphone jack */ |
| 74 | (AZALIA_PINCFG_PORT_JACK << 30) |
| 75 | | ((AZALIA_PINCFG_LOCATION_EXTERNAL | AZALIA_PINCFG_LOCATION_REAR) << 24) |
| 76 | | (AZALIA_PINCFG_DEVICE_MICROPHONE << 20) |
| 77 | | (AZALIA_PINCFG_CONN_MINI_HEADPHONE_JACK << 16) |
| 78 | | (AZALIA_PINCFG_COLOR_PINK << 12) |
| 79 | | (4 << 4) |
| 80 | | (0 << 0) |
| 81 | }, |
| 82 | { 0x19, /*0x02A19050*/ /* Port F - front panel header mic */ |
| 83 | (AZALIA_PINCFG_PORT_NC << 30) |
| 84 | | ((AZALIA_PINCFG_LOCATION_EXTERNAL | AZALIA_PINCFG_LOCATION_FRONT) << 24) |
| 85 | | (AZALIA_PINCFG_DEVICE_MICROPHONE << 20) |
| 86 | | (AZALIA_PINCFG_CONN_MINI_HEADPHONE_JACK << 16) |
| 87 | | (AZALIA_PINCFG_COLOR_PINK << 12) |
| 88 | | (5 << 4) |
| 89 | | (0 << 0) |
| 90 | }, |
| 91 | { 0x1A, /*0x0181304F*/ /* Port C - NL blue headphone jack */ |
| 92 | (AZALIA_PINCFG_PORT_NC << 30) |
| 93 | | ((AZALIA_PINCFG_LOCATION_EXTERNAL | AZALIA_PINCFG_LOCATION_REAR) << 24) |
| 94 | | (AZALIA_PINCFG_DEVICE_LINEIN << 20) |
| 95 | | (AZALIA_PINCFG_CONN_MINI_HEADPHONE_JACK << 16) |
| 96 | | (AZALIA_PINCFG_COLOR_BLUE << 12) |
| 97 | | (4 << 4) |
| 98 | | (0xF << 0) |
| 99 | }, |
| 100 | { 0x1B, /*0x02214030*/ /* Port E - front panel line-out */ |
| 101 | (AZALIA_PINCFG_PORT_NC << 30) |
| 102 | | ((AZALIA_PINCFG_LOCATION_EXTERNAL | AZALIA_PINCFG_LOCATION_FRONT) << 24) |
| 103 | | (AZALIA_PINCFG_DEVICE_HP_OUT << 20) |
| 104 | | (AZALIA_PINCFG_CONN_MINI_HEADPHONE_JACK << 16) |
| 105 | | (AZALIA_PINCFG_COLOR_GREEN << 12) |
| 106 | | (3 << 4) |
| 107 | | (0 << 0) |
| 108 | }, |
| 109 | { 0x1C, 0x411111F0 }, /* CD-in - Not Connected */ |
| 110 | { 0x1D, 0x411111F0 }, /* PC Beep - Not Connected */ |
| 111 | { 0x1E, 0x411111F0 }, /* S/PDIF - Not connected */ |
| 112 | { 0xFF, 0xFFFFFFFF }, |
WANG Siyuan | f77f734 | 2013-08-13 17:09:51 +0800 | [diff] [blame] | 113 | }; |
| 114 | |
Bruce Griffith | 5bdcff5 | 2013-08-23 19:48:17 -0600 | [diff] [blame] | 115 | static const CODEC_TBL_LIST CodecTableList[] = |
WANG Siyuan | f77f734 | 2013-08-13 17:09:51 +0800 | [diff] [blame] | 116 | { |
Bruce Griffith | 5bdcff5 | 2013-08-23 19:48:17 -0600 | [diff] [blame] | 117 | {0x10ec0662, (CODEC_ENTRY*)Alc662_VerbTbl}, |
WANG Siyuan | f77f734 | 2013-08-13 17:09:51 +0800 | [diff] [blame] | 118 | {(UINT32)0x0FFFFFFFF, (CODEC_ENTRY*)0x0FFFFFFFFUL} |
| 119 | }; |
| 120 | |
| 121 | #define FAN_INPUT_INTERNAL_DIODE 0 |
| 122 | #define FAN_INPUT_TEMP0 1 |
| 123 | #define FAN_INPUT_TEMP1 2 |
| 124 | #define FAN_INPUT_TEMP2 3 |
| 125 | #define FAN_INPUT_TEMP3 4 |
| 126 | #define FAN_INPUT_TEMP0_FILTER 5 |
| 127 | #define FAN_INPUT_ZERO 6 |
| 128 | #define FAN_INPUT_DISABLED 7 |
| 129 | |
| 130 | #define FAN_AUTOMODE (1 << 0) |
| 131 | #define FAN_LINEARMODE (1 << 1) |
| 132 | #define FAN_STEPMODE ~(1 << 1) |
| 133 | #define FAN_POLARITY_HIGH (1 << 2) |
| 134 | #define FAN_POLARITY_LOW ~(1 << 2) |
| 135 | |
| 136 | /* Normally, 4-wire fan runs at 25KHz and 3-wire fan runs at 100Hz */ |
| 137 | #define FREQ_28KHZ 0x0 |
| 138 | #define FREQ_25KHZ 0x1 |
| 139 | #define FREQ_23KHZ 0x2 |
| 140 | #define FREQ_21KHZ 0x3 |
| 141 | #define FREQ_29KHZ 0x4 |
| 142 | #define FREQ_18KHZ 0x5 |
| 143 | #define FREQ_100HZ 0xF7 |
| 144 | #define FREQ_87HZ 0xF8 |
| 145 | #define FREQ_58HZ 0xF9 |
| 146 | #define FREQ_44HZ 0xFA |
| 147 | #define FREQ_35HZ 0xFB |
| 148 | #define FREQ_29HZ 0xFC |
| 149 | #define FREQ_22HZ 0xFD |
| 150 | #define FREQ_14HZ 0xFE |
| 151 | #define FREQ_11HZ 0xFF |
| 152 | |
| 153 | /* imb_a180 Hardware Monitor Fan Control |
| 154 | * Hardware limitation: |
| 155 | * HWM failed to read the input temperture vi I2C, |
| 156 | * if other software switch the I2C switch by mistake or intention. |
| 157 | * We recommend to using IMC to control Fans, instead of HWM. |
| 158 | */ |
| 159 | #if 0 |
| 160 | static void oem_fan_control(FCH_DATA_BLOCK *FchParams) |
| 161 | { |
| 162 | FCH_HWM_FAN_CTR oem_factl[5] = { |
Paul Menzel | 02b5a74 | 2014-08-16 07:31:19 +0200 | [diff] [blame^] | 163 | /* temperature input, fan mode, frequency, low_duty, med_duty, multiplier, lowtemp, medtemp, hightemp, LinearRange, LinearHoldCount */ |
WANG Siyuan | f77f734 | 2013-08-13 17:09:51 +0800 | [diff] [blame] | 164 | /* imb_a180 FanOUT0 Fan header J32 */ |
| 165 | {FAN_INPUT_INTERNAL_DIODE, (FAN_STEPMODE | FAN_POLARITY_HIGH), FREQ_100HZ, 40, 60, 0, 40, 65, 85, 0, 0}, |
| 166 | /* imb_a180 FanOUT1 Fan header J31*/ |
| 167 | {FAN_INPUT_INTERNAL_DIODE, (FAN_STEPMODE | FAN_POLARITY_HIGH), FREQ_100HZ, 40, 60, 0, 40, 65, 85, 0, 0}, |
| 168 | {FAN_INPUT_INTERNAL_DIODE, (FAN_STEPMODE | FAN_POLARITY_HIGH), FREQ_100HZ, 40, 60, 0, 40, 65, 85, 0, 0}, |
| 169 | {FAN_INPUT_INTERNAL_DIODE, (FAN_STEPMODE | FAN_POLARITY_HIGH), FREQ_100HZ, 40, 60, 0, 40, 65, 85, 0, 0}, |
| 170 | {FAN_INPUT_INTERNAL_DIODE, (FAN_STEPMODE | FAN_POLARITY_HIGH), FREQ_100HZ, 40, 60, 0, 40, 65, 85, 0, 0}, |
| 171 | }; |
| 172 | LibAmdMemCopy ((VOID *)(FchParams->Hwm.HwmFanControl), &oem_factl, (sizeof (FCH_HWM_FAN_CTR) * 5), FchParams->StdHeader); |
| 173 | |
| 174 | /* Enable IMC fan control. the recommand way */ |
| 175 | #if defined CONFIG_HUDSON_IMC_FWM && (CONFIG_HUDSON_IMC_FWM == 1) |
| 176 | /* HwMonitorEnable = TRUE && HwmFchtsiAutoOpll ==FALSE to call FchECfancontrolservice */ |
| 177 | FchParams->Hwm.HwMonitorEnable = TRUE; |
| 178 | FchParams->Hwm.HwmFchtsiAutoPoll = FALSE;/* 0 disable, 1 enable TSI Auto Polling */ |
| 179 | |
| 180 | FchParams->Imc.ImcEnable = TRUE; |
| 181 | FchParams->Hwm.HwmControl = 1; /* 1 IMC, 0 HWM */ |
| 182 | FchParams->Imc.ImcEnableOverWrite = 1; /* 2 disable IMC , 1 enable IMC, 0 following hw strap setting */ |
| 183 | |
| 184 | LibAmdMemFill(&(FchParams->Imc.EcStruct), 0, sizeof(FCH_EC), FchParams->StdHeader); |
| 185 | |
| 186 | /* Thermal Zone Parameter */ |
| 187 | FchParams->Imc.EcStruct.MsgFun81Zone0MsgReg0 = 0x00; |
| 188 | FchParams->Imc.EcStruct.MsgFun81Zone0MsgReg1 = 0x00; /* Zone */ |
| 189 | FchParams->Imc.EcStruct.MsgFun81Zone0MsgReg2 = 0x00; //BIT0 | BIT2 | BIT5; |
| 190 | FchParams->Imc.EcStruct.MsgFun81Zone0MsgReg3 = 0x00;//6 | BIT3; |
| 191 | FchParams->Imc.EcStruct.MsgFun81Zone0MsgReg4 = 0x00; |
| 192 | FchParams->Imc.EcStruct.MsgFun81Zone0MsgReg5 = 0x00; |
| 193 | FchParams->Imc.EcStruct.MsgFun81Zone0MsgReg6 = 0x98; /* SMBUS Address for SMBUS based temperature sensor such as SB-TSI and ADM1032 */ |
| 194 | FchParams->Imc.EcStruct.MsgFun81Zone0MsgReg7 = 2; |
| 195 | FchParams->Imc.EcStruct.MsgFun81Zone0MsgReg8 = 0; /* PWM steping rate in unit of PWM level percentage */ |
| 196 | FchParams->Imc.EcStruct.MsgFun81Zone0MsgReg9 = 0; |
| 197 | |
| 198 | /* IMC Fan Policy temperature thresholds */ |
| 199 | FchParams->Imc.EcStruct.MsgFun83Zone0MsgReg0 = 0x00; |
| 200 | FchParams->Imc.EcStruct.MsgFun83Zone0MsgReg1 = 0x00; /* Zone */ |
| 201 | FchParams->Imc.EcStruct.MsgFun83Zone0MsgReg2 = 0;///80; /*AC0 threshold in Celsius */ |
| 202 | FchParams->Imc.EcStruct.MsgFun83Zone0MsgReg3 = 0; /*AC1 threshold in Celsius */ |
| 203 | FchParams->Imc.EcStruct.MsgFun83Zone0MsgReg4 = 0; /*AC2 threshold in Celsius */ |
| 204 | FchParams->Imc.EcStruct.MsgFun83Zone0MsgReg5 = 0; /*AC3 threshold in Celsius, 0xFF is not define */ |
| 205 | FchParams->Imc.EcStruct.MsgFun83Zone0MsgReg6 = 0; /*AC4 threshold in Celsius, 0xFF is not define */ |
| 206 | FchParams->Imc.EcStruct.MsgFun83Zone0MsgReg7 = 0; /*AC5 threshold in Celsius, 0xFF is not define */ |
| 207 | FchParams->Imc.EcStruct.MsgFun83Zone0MsgReg8 = 0; /*AC6 threshold in Celsius, 0xFF is not define */ |
| 208 | FchParams->Imc.EcStruct.MsgFun83Zone0MsgReg9 = 0; /*AC7 lowest threshold in Celsius, 0xFF is not define */ |
| 209 | FchParams->Imc.EcStruct.MsgFun83Zone0MsgRegA = 0; /*critical threshold* in Celsius, 0xFF is not define */ |
| 210 | FchParams->Imc.EcStruct.MsgFun83Zone0MsgRegB = 0x00; |
| 211 | |
| 212 | /* IMC Fan Policy PWM Settings */ |
| 213 | FchParams->Imc.EcStruct.MsgFun85Zone0MsgReg0 = 0x00; |
| 214 | FchParams->Imc.EcStruct.MsgFun85Zone0MsgReg1 = 0x00; /* Zone */ |
| 215 | FchParams->Imc.EcStruct.MsgFun85Zone0MsgReg2 = 0; /* AL0 percentage */ |
| 216 | FchParams->Imc.EcStruct.MsgFun85Zone0MsgReg3 = 0; /* AL1 percentage */ |
| 217 | FchParams->Imc.EcStruct.MsgFun85Zone0MsgReg4 = 0; /* AL2 percentage */ |
| 218 | FchParams->Imc.EcStruct.MsgFun85Zone0MsgReg5 = 0x00; /* AL3 percentage */ |
| 219 | FchParams->Imc.EcStruct.MsgFun85Zone0MsgReg6 = 0x00; /* AL4 percentage */ |
| 220 | FchParams->Imc.EcStruct.MsgFun85Zone0MsgReg7 = 0x00; /* AL5 percentage */ |
| 221 | FchParams->Imc.EcStruct.MsgFun85Zone0MsgReg8 = 0x00; /* AL6 percentage */ |
| 222 | FchParams->Imc.EcStruct.MsgFun85Zone0MsgReg9 = 0x00; /* AL7 percentage */ |
| 223 | |
| 224 | FchParams->Imc.EcStruct.MsgFun81Zone1MsgReg0 = 0x00; |
| 225 | FchParams->Imc.EcStruct.MsgFun81Zone1MsgReg1 = 0x01; /* Zone */ |
| 226 | FchParams->Imc.EcStruct.MsgFun81Zone1MsgReg2 = 0x55;//BIT0 | BIT2 | BIT5; |
| 227 | FchParams->Imc.EcStruct.MsgFun81Zone1MsgReg3 = 0x17; |
| 228 | FchParams->Imc.EcStruct.MsgFun81Zone1MsgReg4 = 0x00; |
| 229 | FchParams->Imc.EcStruct.MsgFun81Zone1MsgReg5 = 0x00; |
| 230 | FchParams->Imc.EcStruct.MsgFun81Zone1MsgReg6 = 0x90; /* SMBUS Address for SMBUS based temperature sensor such as SB-TSI and ADM1032 */ |
| 231 | FchParams->Imc.EcStruct.MsgFun81Zone1MsgReg7 = 0; |
| 232 | FchParams->Imc.EcStruct.MsgFun81Zone1MsgReg8 = 0; /* PWM steping rate in unit of PWM level percentage */ |
| 233 | FchParams->Imc.EcStruct.MsgFun81Zone1MsgReg9 = 0; |
| 234 | |
| 235 | FchParams->Imc.EcStruct.MsgFun83Zone1MsgReg0 = 0x00; |
| 236 | FchParams->Imc.EcStruct.MsgFun83Zone1MsgReg1 = 0x01; /* zone */ |
| 237 | FchParams->Imc.EcStruct.MsgFun83Zone1MsgReg2 = 60; /*AC0 threshold in Celsius */ |
| 238 | FchParams->Imc.EcStruct.MsgFun83Zone1MsgReg3 = 40; /*AC1 threshold in Celsius */ |
| 239 | FchParams->Imc.EcStruct.MsgFun83Zone1MsgReg4 = 0; /*AC2 threshold in Celsius */ |
| 240 | FchParams->Imc.EcStruct.MsgFun83Zone1MsgReg5 = 0; /*AC3 threshold in Celsius, 0xFF is not define */ |
| 241 | FchParams->Imc.EcStruct.MsgFun83Zone1MsgReg6 = 0; /*AC4 threshold in Celsius, 0xFF is not define */ |
| 242 | FchParams->Imc.EcStruct.MsgFun83Zone1MsgReg7 = 0; /*AC5 threshold in Celsius, 0xFF is not define */ |
| 243 | FchParams->Imc.EcStruct.MsgFun83Zone1MsgReg8 = 0; /*AC6 threshold in Celsius, 0xFF is not define */ |
| 244 | FchParams->Imc.EcStruct.MsgFun83Zone1MsgReg9 = 0; /*AC7 lowest threshold in Celsius, 0xFF is not define */ |
| 245 | FchParams->Imc.EcStruct.MsgFun83Zone1MsgRegA = 0; /*critical threshold* in Celsius, 0xFF is not define */ |
| 246 | FchParams->Imc.EcStruct.MsgFun83Zone1MsgRegB = 0x00; |
| 247 | |
| 248 | FchParams->Imc.EcStruct.MsgFun85Zone1MsgReg0 = 0x00; |
| 249 | FchParams->Imc.EcStruct.MsgFun85Zone1MsgReg1 = 0x01; /*Zone */ |
| 250 | FchParams->Imc.EcStruct.MsgFun85Zone1MsgReg2 = 0; /* AL0 percentage */ |
| 251 | FchParams->Imc.EcStruct.MsgFun85Zone1MsgReg3 = 0; /* AL1 percentage */ |
| 252 | FchParams->Imc.EcStruct.MsgFun85Zone1MsgReg4 = 0; /* AL2 percentage */ |
| 253 | FchParams->Imc.EcStruct.MsgFun85Zone1MsgReg5 = 0x00; /* AL3 percentage */ |
| 254 | FchParams->Imc.EcStruct.MsgFun85Zone1MsgReg6 = 0x00; /* AL4 percentage */ |
| 255 | FchParams->Imc.EcStruct.MsgFun85Zone1MsgReg7 = 0x00; /* AL5 percentage */ |
| 256 | FchParams->Imc.EcStruct.MsgFun85Zone1MsgReg8 = 0x00; /* AL6 percentage */ |
| 257 | FchParams->Imc.EcStruct.MsgFun85Zone1MsgReg9 = 0x00; /* AL7 percentage */ |
| 258 | |
| 259 | FchParams->Imc.EcStruct.MsgFun81Zone2MsgReg0 = 0x00; |
| 260 | FchParams->Imc.EcStruct.MsgFun81Zone2MsgReg1 = 0x2; /* Zone */ |
| 261 | FchParams->Imc.EcStruct.MsgFun81Zone2MsgReg2 = 0x0;//BIT0 | BIT2 | BIT5; |
| 262 | FchParams->Imc.EcStruct.MsgFun81Zone2MsgReg3 = 0x0; |
| 263 | FchParams->Imc.EcStruct.MsgFun81Zone2MsgReg4 = 0x00; |
| 264 | FchParams->Imc.EcStruct.MsgFun81Zone2MsgReg5 = 0x00; |
| 265 | FchParams->Imc.EcStruct.MsgFun81Zone2MsgReg6 = 0x98; /* SMBUS Address for SMBUS based temperature sensor such as SB-TSI and ADM1032 */ |
| 266 | FchParams->Imc.EcStruct.MsgFun81Zone2MsgReg7 = 2; |
| 267 | FchParams->Imc.EcStruct.MsgFun81Zone2MsgReg8 = 5; /* PWM steping rate in unit of PWM level percentage */ |
| 268 | FchParams->Imc.EcStruct.MsgFun81Zone2MsgReg9 = 0; |
| 269 | |
| 270 | FchParams->Imc.EcStruct.MsgFun81Zone3MsgReg0 = 0x00; |
| 271 | FchParams->Imc.EcStruct.MsgFun81Zone3MsgReg1 = 0x3; /* Zone */ |
| 272 | FchParams->Imc.EcStruct.MsgFun81Zone3MsgReg2 = 0x0;//BIT0 | BIT2 | BIT5; |
| 273 | FchParams->Imc.EcStruct.MsgFun81Zone3MsgReg3 = 0x0; |
| 274 | FchParams->Imc.EcStruct.MsgFun81Zone3MsgReg4 = 0x00; |
| 275 | FchParams->Imc.EcStruct.MsgFun81Zone3MsgReg5 = 0x00; |
| 276 | FchParams->Imc.EcStruct.MsgFun81Zone3MsgReg6 = 0x0; /* SMBUS Address for SMBUS based temperature sensor such as SB-TSI and ADM1032 */ |
| 277 | FchParams->Imc.EcStruct.MsgFun81Zone3MsgReg7 = 0; |
| 278 | FchParams->Imc.EcStruct.MsgFun81Zone3MsgReg8 = 0; /* PWM steping rate in unit of PWM level percentage */ |
| 279 | FchParams->Imc.EcStruct.MsgFun81Zone3MsgReg9 = 0; |
| 280 | |
| 281 | /* IMC Function */ |
| 282 | FchParams->Imc.EcStruct.IMCFUNSupportBitMap = 0x333;//BIT0 | BIT4 |BIT8; |
| 283 | |
| 284 | /* NOTE: |
| 285 | * FchInitLateHwm will overwrite the EcStruct with EcDefaultMassege, |
| 286 | * AGESA put EcDefaultMassege as global data in ROM, so we can't overwride it. |
| 287 | * so we remove it from AGESA code. Please Seee FchInitLateHwm. |
| 288 | */ |
| 289 | |
| 290 | #else /* HWM fan control, the way not recommand */ |
| 291 | FchParams->Imc.ImcEnable = FALSE; |
| 292 | FchParams->Hwm.HwMonitorEnable = TRUE; |
| 293 | FchParams->Hwm.HwmFchtsiAutoPoll = TRUE;/* 1 enable, 0 disable TSI Auto Polling */ |
| 294 | |
| 295 | #endif /* CONFIG_HUDSON_IMC_FWM */ |
| 296 | } |
| 297 | #endif |
| 298 | |
| 299 | /** |
| 300 | * Fch Oem setting callback |
| 301 | * |
| 302 | * Configure platform specific Hudson device, |
| 303 | * such Azalia, SATA, IMC etc. |
| 304 | */ |
| 305 | AGESA_STATUS Fch_Oem_config(UINT32 Func, UINT32 FchData, VOID *ConfigPtr) |
| 306 | { |
Kyösti Mälkki | dfad070 | 2014-07-10 06:32:36 +0300 | [diff] [blame] | 307 | AMD_CONFIG_PARAMS *StdHeader = ConfigPtr; |
WANG Siyuan | f77f734 | 2013-08-13 17:09:51 +0800 | [diff] [blame] | 308 | |
Kyösti Mälkki | dfad070 | 2014-07-10 06:32:36 +0300 | [diff] [blame] | 309 | if (StdHeader->Func == AMD_INIT_RESET) { |
Kyösti Mälkki | b166628 | 2014-07-06 22:40:15 +0300 | [diff] [blame] | 310 | FCH_RESET_DATA_BLOCK *FchParams_reset = (FCH_RESET_DATA_BLOCK *)FchData; |
WANG Siyuan | f77f734 | 2013-08-13 17:09:51 +0800 | [diff] [blame] | 311 | printk(BIOS_DEBUG, "Fch OEM config in INIT RESET "); |
| 312 | //FchParams_reset->EcChannel0 = TRUE; /* logical devicd 3 */ |
Kyösti Mälkki | b166628 | 2014-07-06 22:40:15 +0300 | [diff] [blame] | 313 | FchParams_reset->FchReset.Xhci0Enable = IS_ENABLED(CONFIG_HUDSON_XHCI_ENABLE); |
| 314 | FchParams_reset->FchReset.Xhci1Enable = FALSE; |
Kyösti Mälkki | dfad070 | 2014-07-10 06:32:36 +0300 | [diff] [blame] | 315 | } else if (StdHeader->Func == AMD_INIT_ENV) { |
WANG Siyuan | f77f734 | 2013-08-13 17:09:51 +0800 | [diff] [blame] | 316 | FCH_DATA_BLOCK *FchParams_env = (FCH_DATA_BLOCK *)FchData; |
| 317 | printk(BIOS_DEBUG, "Fch OEM config in INIT ENV "); |
| 318 | |
| 319 | /* Azalia Controller OEM Codec Table Pointer */ |
Bruce Griffith | 5bdcff5 | 2013-08-23 19:48:17 -0600 | [diff] [blame] | 320 | FchParams_env->Azalia.AzaliaOemCodecTablePtr = (CODEC_TBL_LIST*)CodecTableList; |
WANG Siyuan | f77f734 | 2013-08-13 17:09:51 +0800 | [diff] [blame] | 321 | /* Azalia Controller Front Panel OEM Table Pointer */ |
| 322 | |
| 323 | /* Fan Control */ |
| 324 | //oem_fan_control(FchParams_env); |
| 325 | |
| 326 | /* XHCI configuration */ |
Kyösti Mälkki | b166628 | 2014-07-06 22:40:15 +0300 | [diff] [blame] | 327 | FchParams_env->Usb.Xhci0Enable = IS_ENABLED(CONFIG_HUDSON_XHCI_ENABLE); |
WANG Siyuan | f77f734 | 2013-08-13 17:09:51 +0800 | [diff] [blame] | 328 | FchParams_env->Usb.Xhci1Enable = FALSE; |
| 329 | |
| 330 | /* sata configuration */ |
| 331 | } |
| 332 | printk(BIOS_DEBUG, "Done\n"); |
| 333 | |
| 334 | return AGESA_SUCCESS; |
| 335 | } |