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