AGESA F15: AMD family15 AGESA code
[coreboot.git] / src / vendorcode / amd / agesa / f15 / Include / OptionFamily15hEarlySample.h
1 /* $NoKeywords:$ */
2 /**
3  * @file
4  *
5  * Family 15h 'early sample' support
6  *
7  * This file defines the required structures for family 15h pre-production processors.
8  *
9  * @xrefitem bom "File Content Label" "Release Content"
10  * @e project:      AGESA
11  * @e sub-project:  Core
12  * @e \$Revision: 53356 $   @e \$Date: 2011-05-18 14:14:18 -0600 (Wed, 18 May 2011) $
13  */
14 /*****************************************************************************
15  *
16  * Copyright (C) 2012 Advanced Micro Devices, Inc.
17  * All rights reserved.
18  *
19  * Redistribution and use in source and binary forms, with or without
20  * modification, are permitted provided that the following conditions are met:
21  *     * Redistributions of source code must retain the above copyright
22  *       notice, this list of conditions and the following disclaimer.
23  *     * Redistributions in binary form must reproduce the above copyright
24  *       notice, this list of conditions and the following disclaimer in the
25  *       documentation and/or other materials provided with the distribution.
26  *     * Neither the name of Advanced Micro Devices, Inc. nor the names of
27  *       its contributors may be used to endorse or promote products derived
28  *       from this software without specific prior written permission.
29  *
30  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
31  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
32  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
33  * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY
34  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
35  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
36  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
37  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
39  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  *
41  *
42  ***************************************************************************/
43
44 #ifndef _OPTION_FAMILY_15H_EARLY_SAMPLE_H_
45 #define _OPTION_FAMILY_15H_EARLY_SAMPLE_H_
46
47
48 /*---------------------------------------------------------------------------------------
49  *          M I X E D   (Definitions And Macros / Typedefs, Structures, Enums)
50  *---------------------------------------------------------------------------------------
51  */
52
53
54 /*---------------------------------------------------------------------------------------
55  *                 D E F I N I T I O N S     A N D     M A C R O S
56  *---------------------------------------------------------------------------------------
57  */
58
59
60 /*---------------------------------------------------------------------------------------
61  *               T Y P E D E F S,   S T R U C T U R E S,    E N U M S
62  *---------------------------------------------------------------------------------------
63  */
64
65 /*
66  * Install family 15h model 0x00 - 0x0F Early Sample support
67  */
68
69 /**
70  *  Early sample hook point during HTC initialization
71  *
72  *  @param[in,out] HtcRegister             Value of F3x64 to be written.
73  *  @param[in]     StdHeader               Handle of Header for calling lib functions and services.
74  *
75  */
76 typedef VOID F_F15_OR_ES_HTC_INIT_HOOK (
77   IN OUT   UINT32  *HtcRegister,
78   IN       AMD_CONFIG_PARAMS *StdHeader
79   );
80
81 /// Reference to a Method.
82 typedef F_F15_OR_ES_HTC_INIT_HOOK *PF_F15_OR_ES_HTC_INIT_HOOK;
83
84 /// Hook points in the core functionality necessary for
85 /// providing support for pre-production CPUs.
86 typedef struct {
87   PF_F15_OR_ES_HTC_INIT_HOOK     F15OrHtcInitHook;    ///< Allows for override of a certain processor register value during HTC init
88 } F15_OR_ES_CORE_SUPPORT;
89
90 /**
91  *  Returns whether or not the processor should enable the CPB feature.
92  *
93  *  @param[in,out] IsEnabled               Whether or not to enable CPB
94  *  @param[in]     StdHeader               Handle of Header for calling lib functions and services.
95  *
96  */
97 typedef VOID F_F15_OR_ES_IS_CPB_SUPPORTED (
98   IN OUT   BOOLEAN *IsEnabled,
99   IN       AMD_CONFIG_PARAMS *StdHeader
100   );
101
102 /// Reference to a Method.
103 typedef F_F15_OR_ES_IS_CPB_SUPPORTED *PF_F15_OR_ES_IS_CPB_SUPPORTED;
104
105
106
107 /// Hook points in the CPB feature necessary for
108 /// providing support for pre-production CPUs.
109 typedef struct {
110   PF_F15_OR_ES_IS_CPB_SUPPORTED    F15OrIsCpbSupportedHook;   ///< CPB enablement override
111 } F15_OR_ES_CPB_SUPPORT;
112
113 /**
114  *  Returns whether or not the processor should enable the C6 feature.
115  *
116  *  @param[in,out] IsEnabled               Whether or not to enable C6
117  *  @param[in]     StdHeader               Handle of Header for calling lib functions and services.
118  *
119  */
120 typedef VOID F_F15_OR_ES_IS_C6_SUPPORTED (
121   IN OUT   BOOLEAN *IsEnabled,
122   IN       AMD_CONFIG_PARAMS *StdHeader
123   );
124
125 /// Reference to a Method.
126 typedef F_F15_OR_ES_IS_C6_SUPPORTED *PF_F15_OR_ES_IS_C6_SUPPORTED;
127
128
129
130 /// Hook points in the C6 feature necessary for
131 /// providing support for pre-production CPUs.
132 typedef struct {
133   PF_F15_OR_ES_IS_C6_SUPPORTED    F15OrIsC6SupportedHook;   ///< C6 enablement override
134 } F15_OR_ES_C6_SUPPORT;
135
136
137 /**
138  *  Workaround to avoid patch loading from causing NB cycles
139  *
140  *  @param[in,out] StdHeader     - Config handle for library and services.
141  *  @param[in,out] SavedMsrValue - Saved a MSR value
142  *
143  */
144 typedef VOID F_F15_OR_ES_AVOID_NB_CYCLES_START (
145   IN OUT   AMD_CONFIG_PARAMS *StdHeader,
146   IN       UINT64            *SavedMsrValue
147   );
148
149 /// Reference to a Method.
150 typedef F_F15_OR_ES_AVOID_NB_CYCLES_START *PF_F15_OR_ES_AVOID_NB_CYCLES_START;
151
152 /**
153  *  Workaround to avoid patch loading from causing NB cycles
154  *
155  *  @param[in,out] StdHeader - Config handle for library and services.
156  *  @param[in] SavedMsrValue - Saved a MSR value
157  *
158  *
159  */
160 typedef VOID F_F15_OR_ES_AVOID_NB_CYCLES_END (
161   IN OUT   AMD_CONFIG_PARAMS *StdHeader,
162   IN       UINT64            *SavedMsrValue
163   );
164
165 /// Reference to a Method.
166 typedef F_F15_OR_ES_AVOID_NB_CYCLES_END *PF_F15_OR_ES_AVOID_NB_CYCLES_END;
167
168 /**
169  *  Workaround for Ax processors after patch is loaded.
170  *
171  *  @param[in] StdHeader     - Config handle for library and services.
172  *  @param[in] IsPatchLoaded - Is patch loaded
173  *
174  *
175  */
176 typedef VOID F_F15_OR_ES_AFTER_PATCH_LOADED (
177   IN OUT   AMD_CONFIG_PARAMS *StdHeader,
178   IN       BOOLEAN IsPatchLoaded
179   );
180
181 /// Reference to a Method.
182 typedef F_F15_OR_ES_AFTER_PATCH_LOADED *PF_F15_OR_ES_AFTER_PATCH_LOADED;
183
184 /**
185  *  Update the CPU microcode.
186  *
187  *  @param[in] StdHeader   - Config handle for library and services.
188  *
189  *  @retval    TRUE   - Patch Loaded Successfully.
190  *  @retval    FALSE  - Patch Did Not Get Loaded.
191  *
192  */
193 typedef BOOLEAN F_F15_OR_ES_LOAD_MCU_PATCH (
194   IN OUT   AMD_CONFIG_PARAMS *StdHeader
195   );
196
197 /// Reference to a Method.
198 typedef F_F15_OR_ES_LOAD_MCU_PATCH *PF_F15_OR_ES_LOAD_MCU_PATCH;
199
200
201 /// Hook points in the Microcode Update feature necessary for
202 /// providing support for pre-production CPUs.
203 typedef struct {
204   PF_F15_OR_ES_AVOID_NB_CYCLES_START  F15OrESAvoidNbCyclesStart; ///< Workaround to avoid patch loading from causing NB cycles
205   PF_F15_OR_ES_AVOID_NB_CYCLES_END    F15OrESAvoidNbCyclesEnd;   ///< Workaround to avoid patch loading from causing NB cycles
206   PF_F15_OR_ES_LOAD_MCU_PATCH         F15OrUpdateMcuPatchHook;   ///< Processor MCU Update override
207   PF_F15_OR_ES_AFTER_PATCH_LOADED     F15OrESAfterPatchLoaded;   ///< Workaround for Ax processors after patch is loaded
208 } F15_OR_ES_MCU_PATCH;
209
210
211
212 typedef BOOLEAN F_F15_TN_ES_LOAD_MCU_PATCH (
213   IN OUT   AMD_CONFIG_PARAMS *StdHeader
214   );
215
216 /// Reference to a Method.
217 typedef F_F15_TN_ES_LOAD_MCU_PATCH *PF_F15_TN_ES_LOAD_MCU_PATCH;
218
219 /// Hook points in the Microcode Update feature necessary for
220 /// providing support for pre-production CPUs.
221 typedef struct {
222   PF_F15_TN_ES_LOAD_MCU_PATCH    F15TnUpdateMcuPatchHook;   ///< Processor MCU Update override
223 } F15_TN_ES_MCU_PATCH;
224
225 /*---------------------------------------------------------------------------------------
226  *                        F U N C T I O N    P R O T O T Y P E
227  *---------------------------------------------------------------------------------------
228  */
229
230
231 #endif  // _OPTION_FAMILY_15H_EARLY_SAMPLE_H_