Renze Nicolai | a688b7c | 2016-11-18 23:08:13 +0100 | [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 | |
| 16 | #include "AGESA.h" |
| 17 | #include <northbridge/amd/agesa/BiosCallOuts.h> |
| 18 | |
| 19 | #include <cbfs.h> |
| 20 | #include <vendorcode/amd/agesa/f15tn/Proc/Fch/FchPlatform.h> |
| 21 | #include <stdlib.h> |
| 22 | |
| 23 | static AGESA_STATUS Fch_Oem_config(UINT32 Func, UINTN FchData, VOID *ConfigPtr); |
| 24 | |
| 25 | const BIOS_CALLOUT_STRUCT BiosCallouts[] = |
| 26 | { |
| 27 | {AGESA_DO_RESET, agesa_Reset }, |
| 28 | {AGESA_READ_SPD, agesa_ReadSpd }, |
| 29 | {AGESA_READ_SPD_RECOVERY, agesa_NoopUnsupported }, |
| 30 | {AGESA_RUNFUNC_ONAP, agesa_RunFuncOnAp }, |
| 31 | {AGESA_GET_IDS_INIT_DATA, agesa_EmptyIdsInitData }, |
| 32 | {AGESA_HOOKBEFORE_DQS_TRAINING, agesa_NoopSuccess }, |
| 33 | {AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess }, |
| 34 | {AGESA_FCH_OEM_CALLOUT, Fch_Oem_config }, |
| 35 | {AGESA_GNB_GFX_GET_VBIOS_IMAGE, agesa_GfxGetVbiosImage } |
| 36 | }; |
| 37 | const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts); |
| 38 | |
| 39 | /** |
| 40 | * ASUS F2A85-M board ALC887-VD Verb Table |
| 41 | * |
| 42 | * Copied from `/sys/class/sound/hwC1D0/init_pin_configs` when running |
| 43 | * the vendor BIOS. |
| 44 | */ |
| 45 | const CODEC_ENTRY f2a85_m_alc887_VerbTbl[] = { |
| 46 | {0x11, 0x99430140}, |
| 47 | {0x12, 0x411111f0}, |
| 48 | {0x14, 0x01014010}, |
| 49 | {0x15, 0x01011012}, |
| 50 | {0x16, 0x01016011}, |
| 51 | {0x17, 0x01012014}, |
| 52 | {0x18, 0x01a19850}, |
| 53 | {0x19, 0x02a19c60}, |
| 54 | {0x1a, 0x0181305f}, |
| 55 | {0x1b, 0x02214c20}, |
| 56 | {0x1c, 0x411111f0}, |
| 57 | {0x1d, 0x4005e601}, |
| 58 | {0x1e, 0x01456130}, |
| 59 | {0x1f, 0x411111f0}, |
| 60 | {0xff, 0xffffffff} |
| 61 | }; |
| 62 | |
| 63 | static const CODEC_TBL_LIST CodecTableList[] = |
| 64 | { |
| 65 | {0x10ec0887, (CODEC_ENTRY*)&f2a85_m_alc887_VerbTbl[0]}, |
| 66 | {(UINT32)0x0FFFFFFFF, (CODEC_ENTRY*)0x0FFFFFFFFUL} |
| 67 | }; |
| 68 | |
| 69 | /** |
| 70 | * Fch Oem setting callback |
| 71 | * |
| 72 | * Configure platform specific Hudson device, |
| 73 | * such Azalia, SATA, GEC, IMC etc. |
| 74 | */ |
| 75 | static AGESA_STATUS Fch_Oem_config(UINT32 Func, UINTN FchData, VOID *ConfigPtr) |
| 76 | { |
| 77 | AMD_CONFIG_PARAMS *StdHeader = ConfigPtr; |
| 78 | |
| 79 | if (StdHeader->Func == AMD_INIT_RESET) { |
| 80 | FCH_RESET_DATA_BLOCK *FchParams_reset = (FCH_RESET_DATA_BLOCK *)FchData; |
| 81 | printk(BIOS_DEBUG, "Fch OEM config in INIT RESET "); |
| 82 | FchParams_reset->LegacyFree = IS_ENABLED(CONFIG_HUDSON_LEGACY_FREE); |
| 83 | FchParams_reset->FchReset.Xhci0Enable = IS_ENABLED(CONFIG_HUDSON_XHCI_ENABLE); |
| 84 | FchParams_reset->FchReset.Xhci1Enable = IS_ENABLED(CONFIG_HUDSON_XHCI_ENABLE); |
| 85 | } else if (StdHeader->Func == AMD_INIT_ENV) { |
| 86 | FCH_DATA_BLOCK *FchParams_env = (FCH_DATA_BLOCK *)FchData; |
| 87 | printk(BIOS_DEBUG, "Fch OEM config in INIT ENV "); |
| 88 | |
| 89 | /* Azalia Controller OEM Codec Table Pointer */ |
| 90 | FchParams_env->Azalia.AzaliaOemCodecTablePtr = (CODEC_TBL_LIST *)(&CodecTableList[0]); |
| 91 | /* Azalia Controller Front Panel OEM Table Pointer */ |
| 92 | FchParams_env->Imc.ImcEnable = FALSE; |
| 93 | FchParams_env->Hwm.HwMonitorEnable = FALSE; |
| 94 | FchParams_env->Hwm.HwmFchtsiAutoPoll = FALSE;/* 1 enable, 0 disable TSI Auto Polling */ |
| 95 | |
| 96 | /* XHCI configuration */ |
| 97 | FchParams_env->Usb.Xhci0Enable = IS_ENABLED(CONFIG_HUDSON_XHCI_ENABLE); |
| 98 | FchParams_env->Usb.Xhci1Enable = IS_ENABLED(CONFIG_HUDSON_XHCI_ENABLE); |
| 99 | } |
| 100 | printk(BIOS_DEBUG, "Done\n"); |
| 101 | |
| 102 | return AGESA_SUCCESS; |
| 103 | } |