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. |
Renze Nicolai | 282c832 | 2016-11-18 23:33:16 +0100 | [diff] [blame^] | 5 | * Copyright (C) 2016 Renze Nicolai <renze@rnplus.nl> |
Renze Nicolai | a688b7c | 2016-11-18 23:08:13 +0100 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | */ |
| 16 | |
| 17 | #include "AGESA.h" |
| 18 | #include <northbridge/amd/agesa/BiosCallOuts.h> |
| 19 | |
| 20 | #include <cbfs.h> |
| 21 | #include <vendorcode/amd/agesa/f15tn/Proc/Fch/FchPlatform.h> |
| 22 | #include <stdlib.h> |
| 23 | |
| 24 | static AGESA_STATUS Fch_Oem_config(UINT32 Func, UINTN FchData, VOID *ConfigPtr); |
| 25 | |
| 26 | const BIOS_CALLOUT_STRUCT BiosCallouts[] = |
| 27 | { |
| 28 | {AGESA_DO_RESET, agesa_Reset }, |
| 29 | {AGESA_READ_SPD, agesa_ReadSpd }, |
| 30 | {AGESA_READ_SPD_RECOVERY, agesa_NoopUnsupported }, |
| 31 | {AGESA_RUNFUNC_ONAP, agesa_RunFuncOnAp }, |
| 32 | {AGESA_GET_IDS_INIT_DATA, agesa_EmptyIdsInitData }, |
| 33 | {AGESA_HOOKBEFORE_DQS_TRAINING, agesa_NoopSuccess }, |
| 34 | {AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess }, |
| 35 | {AGESA_FCH_OEM_CALLOUT, Fch_Oem_config }, |
| 36 | {AGESA_GNB_GFX_GET_VBIOS_IMAGE, agesa_GfxGetVbiosImage } |
| 37 | }; |
| 38 | const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts); |
| 39 | |
| 40 | /** |
Renze Nicolai | 282c832 | 2016-11-18 23:33:16 +0100 | [diff] [blame^] | 41 | * MSI MS-7721 board ALC887-VD Verb Table |
Renze Nicolai | a688b7c | 2016-11-18 23:08:13 +0100 | [diff] [blame] | 42 | * |
Renze Nicolai | 282c832 | 2016-11-18 23:33:16 +0100 | [diff] [blame^] | 43 | * Copied from `/sys/class/sound/hwC1D3/init_pin_configs` when running |
Renze Nicolai | a688b7c | 2016-11-18 23:08:13 +0100 | [diff] [blame] | 44 | * the vendor BIOS. |
| 45 | */ |
Renze Nicolai | 282c832 | 2016-11-18 23:33:16 +0100 | [diff] [blame^] | 46 | const CODEC_ENTRY ms7721_alc887_VerbTbl[] = { |
| 47 | {0x11, 0x411111f0}, |
| 48 | {0x12, 0x411111f0}, |
| 49 | {0x14, 0x01014410}, |
| 50 | {0x15, 0x01011412}, |
| 51 | {0x16, 0x01016411}, |
| 52 | {0x17, 0x01012414}, |
| 53 | {0x18, 0x01a19c30}, |
| 54 | {0x19, 0x02a19c40}, |
| 55 | {0x1a, 0x0181343f}, |
| 56 | {0x1b, 0x02214c20}, |
| 57 | {0x1c, 0x411111f0}, |
| 58 | {0x1d, 0x4007f603}, |
| 59 | {0x1e, 0x411111f0}, |
| 60 | {0x1f, 0x411111f0} |
Renze Nicolai | a688b7c | 2016-11-18 23:08:13 +0100 | [diff] [blame] | 61 | }; |
| 62 | |
| 63 | static const CODEC_TBL_LIST CodecTableList[] = |
| 64 | { |
Renze Nicolai | 282c832 | 2016-11-18 23:33:16 +0100 | [diff] [blame^] | 65 | {0x10ec0887, (CODEC_ENTRY*)&ms7721_alc887_VerbTbl[0]}, |
Renze Nicolai | a688b7c | 2016-11-18 23:08:13 +0100 | [diff] [blame] | 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 | } |