1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
|
/* $NoKeywords:$ */
/**
* @file
*
* AMD CPU Reset API, and related functions and structures.
*
* Contains code that initialized the CPU after early reset.
*
* @xrefitem bom "File Content Label" "Release Content"
* @e project: AGESA
* @e sub-project: CPU
* @e \$Revision: 44324 $ @e \$Date: 2010-12-22 17:16:51 +0800 (Wed, 22 Dec 2010) $
*
*/
/*
******************************************************************************
*
* Copyright (c) 2011, Advanced Micro Devices, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Advanced Micro Devices, Inc. nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************
*/
#ifndef _CPU_POST_INIT_H_
#define _CPU_POST_INIT_H_
/*---------------------------------------------------------------------------------------
* M I X E D (Definitions And Macros / Typedefs, Structures, Enums)
*---------------------------------------------------------------------------------------
*/
// Forward declaration needed for multi-structure mutual references
AGESA_FORWARD_DECLARATION (CPU_CFOH_FAMILY_SERVICES);
/*---------------------------------------------------------------------------------------
* D E F I N I T I O N S A N D M A C R O S
*---------------------------------------------------------------------------------------
*/
#define P_STATE_DATA_GATHER_TEMP_ADDR 0x200000 ///< Fixed the row data at 2M memory address.
#define GLOBAL_CPU_FEATURE_LIST_TEMP_ADDR 0x200000 ///< Fixed the row data at 2M memory address.
/*---------------------------------------------------------------------------------------
* T Y P E D E F S, S T R U C T U R E S, E N U M S
*---------------------------------------------------------------------------------------
*/
//----------------------------------------------------------------------------
// CPU FEATURE LEVELING TYPEDEFS, STRUCTURES, ENUMS
//
//----------------------------------------------------------------------------
/// CPU FEATURE LIST
typedef struct {
UINT8 ABM:1; ///< byte 0 bit 0
UINT8 AES:1; ///< byte 0 bit 1
UINT8 AltMovCr8:1; ///< byte 0 bit 2
UINT8 APIC:1; ///< byte 0 bit 3
UINT8 AVX:1; ///< byte 0 bit 4
UINT8 CLFSH:1; ///< byte 0 bit 5
UINT8 CMOV:1; ///< byte 0 bit 6
UINT8 CmpLegacy:1; ///< byte 0 bit 7
UINT8 CMPXCHG8B:1; ///< byte 1 bit 0
UINT8 CMPXCHG16B:1; ///< byte 1 bit 1
UINT8 CVT16:1; ///< byte 1 bit 2
UINT8 DE:1; ///< byte 1 bit 3
UINT8 ExtApicSpace:1; ///< byte 1 bit 4
UINT8 FFXSR:1; ///< byte 1 bit 5
UINT8 FMA:1; ///< byte 1 bit 6
UINT8 FMA4:1; ///< byte 1 bit 7
UINT8 FPU:1; ///< byte 2 bit 0
UINT8 FXSR:1; ///< byte 2 bit 1
UINT8 HTT:1; ///< byte 2 bit 2
UINT8 IBS:1; ///< byte 2 bit 3
UINT8 LahfSahf:1; ///< byte 2 bit 4
UINT8 LM:1; ///< byte 2 bit 5
UINT8 LWP:1; ///< byte 2 bit 6
UINT8 MCA:1; ///< byte 2 bit 7
UINT8 MCE:1; ///< byte 3 bit 0
UINT8 MisAlignSse:1; ///< byte 3 bit 1
UINT8 MMX:1; ///< byte 3 bit 2
UINT8 MmxExt:1; ///< byte 3 bit 3
UINT8 Monitor:1; ///< byte 3 bit 4
UINT8 MSR:1; ///< byte 3 bit 5
UINT8 MTRR:1; ///< byte 3 bit 6
UINT8 NodeId:1; ///< byte 3 bit 7
UINT8 NX:1; ///< byte 4 bit 0
UINT8 OSVW:1; ///< byte 4 bit 1
UINT8 OSXSAVE:1; ///< byte 4 bit 2
UINT8 PAE:1; ///< byte 4 bit 3
UINT8 Page1GB:1; ///< byte 4 bit 4
UINT8 PAT:1; ///< byte 4 bit 5
UINT8 PCLMULQDQ:1; ///< byte 4 bit 6
UINT8 PGE:1; ///< byte 4 bit 7
UINT8 POPCNT:1; ///< byte 5 bit 0
UINT8 PSE:1; ///< byte 5 bit 1
UINT8 PSE36:1; ///< byte 5 bit 2
UINT8 RDTSCP:1; ///< byte 5 bit 3
UINT8 SKINIT:1; ///< byte 5 bit 4
UINT8 SSE:1; ///< byte 5 bit 5
UINT8 SSE2:1; ///< byte 5 bit 6
UINT8 SSE3:1; ///< byte 5 bit 7
UINT8 SSE4A:1; ///< byte 6 bit 0
UINT8 SSE41:1; ///< byte 6 bit 1
UINT8 SSE42:1; ///< byte 6 bit 2
UINT8 SSE5:1; ///< byte 6 bit 3
UINT8 SSSE3:1; ///< byte 6 bit 4
UINT8 SVM:1; ///< byte 6 bit 5
UINT8 SysCallSysRet:1; ///< byte 6 bit 6
UINT8 SysEnterSysExit:1; ///< byte 6 bit 7
UINT8 TBM0:1; ///< byte 7 bit 0
UINT8 TCE:1; ///< byte 7 bit 1
UINT8 ThreeDNow:1; ///< byte 7 bit 2
UINT8 ThreeDNowExt:1; ///< byte 7 bit 3
UINT8 ThreeDNowPrefetch:1; ///< byte 7 bit 4
UINT8 TimeStampCounter:1; ///< byte 7 bit 5
UINT8 VME:1; ///< byte 7 bit 6
UINT8 WDT:1; ///< byte 7 bit 7
UINT8 X2APIC:1; ///< byte 8 bit 0
UINT8 XOP:1; ///< byte 8 bit 1
UINT8 XSAVE:1; ///< byte 8 bit 2
UINT8 Reserve:5; ///< Reserved
} CPU_FEATURES_LIST;
//----------------------------------------------------------------------------
// POST INIT TYPEDEFS, STRUCTURES, ENUMS
//
//----------------------------------------------------------------------------
/// BSC to AP MSR sync up
typedef struct {
UINT32 RegisterAddress; ///< MSR Address
UINT64 RegisterValue; ///< BSC's MSR Value
} BSC_AP_MSR_SYNC;
/**
* Set Cache Flush On Halt Register.
*
* @CpuServiceInstances
*
* @param[in] FamilySpecificServices The current Family Specific Services.
* @param[in] EntryPoint Timepoint designator.
* @param[in] PlatformConfig Contains the runtime modifiable feature input data.
* @param[in] StdHeader Handle of Header for calling lib functions and services.
*
*/
typedef VOID (F_CPU_SET_CFOH_REG) (
IN CPU_CFOH_FAMILY_SERVICES *FamilySpecificServices,
IN UINT64 EntryPoint,
IN PLATFORM_CONFIGURATION *PlatformConfig,
IN AMD_CONFIG_PARAMS *StdHeader
);
/// Reference to a Method.
typedef F_CPU_SET_CFOH_REG *PF_CPU_SET_CFOH_REG;
/**
* Provide the interface to the Cache Flush On Halt Family Specific Services.
*
* Use the methods or data in this struct to adapt the feature code to a specific cpu family or model (or stepping!).
* Each supported Family must provide an implementation for all methods in this interface, even if the
* implementation is a CommonReturn().
*/
struct _CPU_CFOH_FAMILY_SERVICES { // See forward reference above
UINT16 Revision; ///< Interface version
// Public Methods.
PF_CPU_SET_CFOH_REG SetCacheFlushOnHaltRegister; ///< Method: Set Cache Flush On Halt register.
};
/*---------------------------------------------------------------------------------------
* F U N C T I O N P R O T O T Y P E
*---------------------------------------------------------------------------------------
*/
// These are P U B L I C functions, used by IBVs
AGESA_STATUS
AmdCpuPost (
IN AMD_CONFIG_PARAMS *StdHeader,
IN PLATFORM_CONFIGURATION *PlatformConfig
);
// These are P U B L I C functions, used by AGESA
VOID
FeatureLeveling (
IN OUT AMD_CONFIG_PARAMS *StdHeader
);
AGESA_STATUS
CopyHeapToTempRamAtPost (
IN OUT AMD_CONFIG_PARAMS *StdHeader
);
AGESA_STATUS
CopyHeapToMainRamAtPost (
IN OUT AMD_CONFIG_PARAMS *StdHeader
);
VOID
SyncApMsrsToBsc (
IN OUT BSC_AP_MSR_SYNC *ApMsrSync,
IN AMD_CONFIG_PARAMS *StdHeader
);
AGESA_STATUS
FinalizeAtPost (
IN AMD_CONFIG_PARAMS *StdHeader
);
VOID
SetCoresTscFreqSel (
IN AMD_CONFIG_PARAMS *StdHeader
);
#endif // _CPU_POST_INIT_H_
|