tree: drop last paragraph of GPL copyright header
[coreboot.git] / src / mainboard / amd / bettong / BiosCallOuts.c
blobe14978a5135ec8a8305684ddb3c42e5993618949
1 /*
2 * This file is part of the coreboot project.
4 * Copyright (C) 2015 Advanced Micro Devices, Inc.
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.
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.
16 #include "AGESA.h"
17 #include "amdlib.h"
18 #include <northbridge/amd/pi/BiosCallOuts.h>
19 #include "Ids.h"
20 #include "OptionsIds.h"
21 #include "heapManager.h"
22 #include "FchPlatform.h"
23 #include "cbfs.h"
24 #if IS_ENABLED(CONFIG_HUDSON_IMC_FWM)
25 #include "imc.h"
26 #endif
27 #include "hudson.h"
28 #include <stdlib.h>
29 #include "BiosCallOuts.h"
31 static AGESA_STATUS Fch_Oem_config(UINT32 Func, UINT32 FchData, VOID *ConfigPtr);
33 const BIOS_CALLOUT_STRUCT BiosCallouts[] =
35 {AGESA_ALLOCATE_BUFFER, agesa_AllocateBuffer },
36 {AGESA_DEALLOCATE_BUFFER, agesa_DeallocateBuffer },
37 {AGESA_LOCATE_BUFFER, agesa_LocateBuffer },
38 {AGESA_READ_SPD, agesa_ReadSpd },
39 {AGESA_DO_RESET, agesa_Reset },
40 {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 },
45 {AGESA_FCH_OEM_CALLOUT, Fch_Oem_config },
46 {AGESA_GNB_GFX_GET_VBIOS_IMAGE, agesa_GfxGetVbiosImage }
48 const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
50 static const GPIO_CONTROL oem_bettong_gpio[] = {
51 {86, Function1, FCH_GPIO_PULL_UP_ENABLE | FCH_GPIO_OUTPUT_VALUE | FCH_GPIO_OUTPUT_ENABLE | DrvStrengthSel_12mA},
52 {64, Function1, FCH_GPIO_PULL_UP_ENABLE | FCH_GPIO_OUTPUT_VALUE | FCH_GPIO_OUTPUT_ENABLE | DrvStrengthSel_12mA},
53 {-1}
55 /**
56 * Fch Oem setting callback
58 * Configure platform specific Hudson device,
59 * such as Azalia, SATA, IMC etc.
61 AGESA_STATUS Fch_Oem_config(UINT32 Func, UINT32 FchData, VOID *ConfigPtr)
63 AMD_CONFIG_PARAMS *StdHeader = ConfigPtr;
65 if (StdHeader->Func == AMD_INIT_RESET) {
66 FCH_RESET_DATA_BLOCK *FchParams_reset = (FCH_RESET_DATA_BLOCK *)FchData;
67 printk(BIOS_DEBUG, "Fch OEM config in INIT RESET ");
68 //FchParams_reset->EcChannel0 = TRUE; /* logical devicd 3 */
69 FchParams_reset->FchReset.Xhci0Enable = IS_ENABLED(CONFIG_HUDSON_XHCI_ENABLE);
70 FchParams_reset->FchReset.Xhci1Enable = FALSE;
71 FchParams_reset->EarlyOemGpioTable = oem_bettong_gpio;
72 } else if (StdHeader->Func == AMD_INIT_ENV) {
73 FCH_DATA_BLOCK *FchParams_env = (FCH_DATA_BLOCK *)FchData;
74 printk(BIOS_DEBUG, "Fch OEM config in INIT ENV ");
75 #if IS_ENABLED(CONFIG_HUDSON_IMC_FWM)
76 oem_fan_control(FchParams_env);
77 #endif
79 /* XHCI configuration */
80 #if CONFIG_HUDSON_XHCI_ENABLE
81 FchParams_env->Usb.Xhci0Enable = TRUE;
82 #else
83 FchParams_env->Usb.Xhci0Enable = FALSE;
84 #endif
85 FchParams_env->Usb.Xhci1Enable = FALSE;
86 FchParams_env->Usb.USB30PortInit = 8; /* 8: If USB3 port is unremoveable. */
88 /* sata configuration */
90 printk(BIOS_DEBUG, "Done\n");
92 return AGESA_SUCCESS;