AGESA F15: AMD family15 AGESA code
[coreboot.git] / src / vendorcode / amd / agesa / f15 / Proc / Common / CommonInits.c
1 /* $NoKeywords:$ */
2 /**
3  * @file
4  *
5  * Common initialization routines.
6  *
7  * Contains common initialization routines across AGESA entries of phases.
8  *
9  * @xrefitem bom "File Content Label" "Release Content"
10  * @e project:      AGESA
11  * @e sub-project:  Common
12  * @e \$Revision: 56279 $   @e \$Date: 2011-07-11 13:11:28 -0600 (Mon, 11 Jul 2011) $
13  *
14  */
15 /*****************************************************************************
16  *
17  * Copyright (C) 2012 Advanced Micro Devices, Inc.
18  * All rights reserved.
19  *
20  * Redistribution and use in source and binary forms, with or without
21  * modification, are permitted provided that the following conditions are met:
22  *     * Redistributions of source code must retain the above copyright
23  *       notice, this list of conditions and the following disclaimer.
24  *     * Redistributions in binary form must reproduce the above copyright
25  *       notice, this list of conditions and the following disclaimer in the
26  *       documentation and/or other materials provided with the distribution.
27  *     * Neither the name of Advanced Micro Devices, Inc. nor the names of
28  *       its contributors may be used to endorse or promote products derived
29  *       from this software without specific prior written permission.
30  *
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
32  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
33  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
34  * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY
35  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
36  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
37  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
38  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
40  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41  *
42  ******************************************************************************
43  */
44
45
46 /*----------------------------------------------------------------------------------------
47  *                             M O D U L E S    U S E D
48  *----------------------------------------------------------------------------------------
49  */
50 #include "AGESA.h"
51 #include "Ids.h"
52 #include "Filecode.h"
53 #include "heapManager.h"
54 #include "CommonInits.h"
55 CODE_GROUP (G1_PEICC)
56 RDATA_GROUP (G2_PEI)
57
58 #define FILECODE PROC_COMMON_COMMONINITS_FILECODE
59 /*----------------------------------------------------------------------------------------
60  *                   D E F I N I T I O N S    A N D    M A C R O S
61  *----------------------------------------------------------------------------------------
62  */
63 extern BUILD_OPT_CFG UserOptions;
64
65 /*----------------------------------------------------------------------------------------
66  *                  T Y P E D E F S     A N D     S T R U C T U R E S
67  *----------------------------------------------------------------------------------------
68  */
69
70 /*----------------------------------------------------------------------------------------
71  *           P R O T O T Y P E S     O F     L O C A L     F U N C T I O N S
72  *----------------------------------------------------------------------------------------
73  */
74
75
76 /*----------------------------------------------------------------------------------------
77  *                          E X P O R T E D    F U N C T I O N S
78  *----------------------------------------------------------------------------------------
79  */
80
81 /*------------------------------------------------------------------------------------*/
82
83 /**
84  * Common routine to initialize PLATFORM_CONFIGURATION.
85  *
86  * @param[in,out]   PlatformConfig   Platform profile/build option config structure
87  * @param[in,out]   StdHeader        AMD standard header config param
88  *
89  * @retval      AGESA_SUCCESS     Always Succeeds.
90  *
91  */
92 AGESA_STATUS
93 CommonPlatformConfigInit (
94   IN OUT   PLATFORM_CONFIGURATION    *PlatformConfig,
95   IN OUT   AMD_CONFIG_PARAMS         *StdHeader
96   )
97 {
98   UINTN i;
99
100   PlatformConfig->PlatformProfile = UserOptions.CfgPerformanceProfile;
101   PlatformConfig->PlatformDeemphasisList = UserOptions.CfgPlatformDeemphasisList;
102   PlatformConfig->CoreLevelingMode = (UINT8) UserOptions.CfgCoreLevelingMode;
103   PlatformConfig->C1eMode = UserOptions.CfgPlatformC1eMode;
104   PlatformConfig->C1ePlatformData = UserOptions.CfgPlatformC1eOpData;
105   PlatformConfig->C1ePlatformData1 = UserOptions.CfgPlatformC1eOpData1;
106   PlatformConfig->C1ePlatformData2 = UserOptions.CfgPlatformC1eOpData2;
107   PlatformConfig->C1ePlatformData3 = UserOptions.CfgPlatformC1eOpData3;
108   PlatformConfig->CStateMode = UserOptions.CfgPlatformCStateMode;
109   PlatformConfig->CStatePlatformData = UserOptions.CfgPlatformCStateOpData;
110   PlatformConfig->CStateIoBaseAddress = UserOptions.CfgPlatformCStateIoBaseAddress;
111   PlatformConfig->CpbMode = UserOptions.CfgPlatformCpbMode;
112   PlatformConfig->UserOptionDmi = UserOptions.OptionDmi;
113   PlatformConfig->UserOptionPState = UserOptions.OptionAcpiPstates;
114   PlatformConfig->UserOptionSrat = UserOptions.OptionSrat;
115   PlatformConfig->UserOptionSlit = UserOptions.OptionSlit;
116   PlatformConfig->UserOptionWhea = UserOptions.OptionWhea;
117   PlatformConfig->LowPowerPstateForProcHot = UserOptions.CfgLowPowerPstateForProcHot;
118   PlatformConfig->PowerCeiling = UserOptions.CfgAmdPstateCapValue;
119   PlatformConfig->ForcePstateIndependent = UserOptions.CfgAcpiPstateIndependent;
120   PlatformConfig->PStatesInHpcMode = UserOptions.OptionPStatesInHpcMode;
121   PlatformConfig->NumberOfIoApics = UserOptions.CfgPlatNumIoApics;
122   for (i = 0; i < MaxVrmType; i++) {
123     PlatformConfig->VrmProperties[i] = UserOptions.CfgPlatVrmCfg[i];
124   }
125   PlatformConfig->ProcessorScopeInSb = UserOptions.CfgProcessorScopeInSb;
126   PlatformConfig->ProcessorScopeName0 = UserOptions.CfgProcessorScopeName0;
127   PlatformConfig->ProcessorScopeName1 = UserOptions.CfgProcessorScopeName1;
128   PlatformConfig->GnbHdAudio = UserOptions.CfgGnbHdAudio;
129   PlatformConfig->AbmSupport = UserOptions.CfgAbmSupport;
130   PlatformConfig->DynamicRefreshRate = UserOptions.CfgDynamicRefreshRate;
131   PlatformConfig->LcdBackLightControl = UserOptions.CfgLcdBackLightControl;
132   if ((StdHeader->HeapStatus == HEAP_LOCAL_CACHE) ||
133       (StdHeader->HeapStatus == HEAP_TEMP_MEM) ||
134       (StdHeader->HeapStatus == HEAP_SYSTEM_MEM)) {
135     IDS_OPTION_HOOK (IDS_PLATFORMCFG_OVERRIDE, PlatformConfig, StdHeader);
136   }
137   return AGESA_SUCCESS;
138 }
139