AGESA F15: AMD family15 AGESA code
[coreboot.git] / src / vendorcode / amd / agesa / f15 / Proc / CPU / Family / 0x10 / cpuF10FeatureLeveling.h
1 /* $NoKeywords:$ */
2 /**
3  * @file
4  *
5  * AMD Family_10 specific feature leveling functions.
6  *
7  * Provides feature leveling functions specific to family 10h.
8  *
9  * @xrefitem bom "File Content Label" "Release Content"
10  * @e project:      AGESA
11  * @e sub-project:  CPU/Family/0x10
12  * @e \$Revision: 44324 $   @e \$Date: 2010-12-22 02:16:51 -0700 (Wed, 22 Dec 2010) $
13  *
14  */
15 /*
16  ******************************************************************************
17  *
18  * Copyright (C) 2012 Advanced Micro Devices, Inc.
19  * All rights reserved.
20  *
21  * Redistribution and use in source and binary forms, with or without
22  * modification, are permitted provided that the following conditions are met:
23  *     * Redistributions of source code must retain the above copyright
24  *       notice, this list of conditions and the following disclaimer.
25  *     * Redistributions in binary form must reproduce the above copyright
26  *       notice, this list of conditions and the following disclaimer in the
27  *       documentation and/or other materials provided with the distribution.
28  *     * Neither the name of Advanced Micro Devices, Inc. nor the names of
29  *       its contributors may be used to endorse or promote products derived
30  *       from this software without specific prior written permission.
31  *
32  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
33  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
35  * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY
36  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
37  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
38  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
39  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42  *
43  ******************************************************************************
44  */
45
46 #ifndef _CPU_F10_FEATURE_LEVELING_H_
47 #define _CPU_F10_FEATURE_LEVELING_H_
48
49 #include "cpuFamilyTranslation.h"
50 #include "cpuPostInit.h"
51 /*---------------------------------------------------------------------------------------
52  *          M I X E D   (Definitions And Macros / Typedefs, Structures, Enums)
53  *---------------------------------------------------------------------------------------
54  */
55
56
57 /*---------------------------------------------------------------------------------------
58  *                 D E F I N I T I O N S     A N D     M A C R O S
59  *---------------------------------------------------------------------------------------
60  */
61
62
63 /*---------------------------------------------------------------------------------------
64  *               T Y P E D E F S,   S T R U C T U R E S,    E N U M S
65  *---------------------------------------------------------------------------------------
66  */
67 /// F10 CPU Feature Low
68 typedef struct {
69   UINT32 FPU:1;               ///< Bit0
70   UINT32 VME:1;               ///< Bit1
71   UINT32 DE:1;                ///< Bit2
72   UINT32 PSE:1;               ///< Bit3
73   UINT32 TimeStampCounter:1;  ///< Bit4
74   UINT32 MSR:1;               ///< Bit5
75   UINT32 PAE:1;               ///< Bit6
76   UINT32 MCE:1;               ///< Bit7
77   UINT32 CMPXCHG8B:1;         ///< Bit8
78   UINT32 APIC:1;              ///< Bit9
79   UINT32 Reserved1:1;         ///< Bit10
80   UINT32 SysEnterSysExit:1;   ///< Bit11
81   UINT32 MTRR:1;              ///< Bit12
82   UINT32 PGE:1;               ///< Bit13
83   UINT32 MCA:1;               ///< Bit14
84   UINT32 CMOV:1;              ///< Bit15
85   UINT32 PAT:1;               ///< Bit16
86   UINT32 PSE36:1;             ///< Bit17
87   UINT32 Reserved2:1;         ///< Bit18
88   UINT32 CLFSH:1;             ///< Bit19
89   UINT32 Reserved3:3;         ///< Bit20~22
90   UINT32 MMX:1;               ///< Bit23
91   UINT32 FXSR:1;              ///< Bit24
92   UINT32 SSE:1;               ///< Bit25
93   UINT32 SSE2:1;              ///< Bit26
94   UINT32 Reserved4:1;         ///< Bit27
95   UINT32 HTT:1;               ///< Bit28
96   UINT32 Reserved5:3;         ///< Bit29~31
97 } CPU_F10_FEATURES_LO;
98
99 /// F10 CPU Feature High
100 typedef struct {
101   UINT32 SSE3:1;            ///< Bit0
102   UINT32 Reserved1:2;       ///< Bit1~2
103   UINT32 Monitor:1;         ///< Bit3
104   UINT32 Reserved2:9;       ///< Bit4~12
105   UINT32 CMPXCHG16B:1;      ///< Bit13
106   UINT32 Reserved3:9;       ///< Bit14~22
107   UINT32 POPCNT:1;          ///< Bit23
108   UINT32 Reserved4:8;       ///< Bit24~31
109 } CPU_F10_FEATURES_HI;
110
111 /// F10 CPU Feature
112 typedef struct {
113   CPU_F10_FEATURES_LO CpuF10FeaturesLo; ///< Low
114   CPU_F10_FEATURES_HI CpuF10FeaturesHi; ///< High
115 } CPU_F10_FEATURES;
116
117 /// F10 CPU Extended Feature Low
118 typedef struct {
119   UINT32 FPU:1;               ///< Bit0
120   UINT32 VME:1;               ///< Bit1
121   UINT32 DE:1;                ///< Bit2
122   UINT32 PSE:1;               ///< Bit3
123   UINT32 TimeStampCounter:1;  ///< Bit4
124   UINT32 MSR:1;               ///< Bit5
125   UINT32 PAE:1;               ///< Bit6
126   UINT32 MCE:1;               ///< Bit7
127   UINT32 CMPXCHG8B:1;         ///< Bit8
128   UINT32 APIC:1;              ///< Bit9
129   UINT32 Reserved1:1;         ///< Bit10
130   UINT32 SysCallSysRet:1;     ///< Bit11
131   UINT32 MTRR:1;              ///< Bit12
132   UINT32 PGE:1;               ///< Bit13
133   UINT32 MCA:1;               ///< Bit14
134   UINT32 CMOV:1;              ///< Bit15
135   UINT32 PAT:1;               ///< Bit16
136   UINT32 PSE36:1;             ///< Bit17
137   UINT32 Reserved2:2;         ///< Bit18~19
138   UINT32 NX:1;                ///< Bit20
139   UINT32 Reserved3:1;         ///< Bit21
140   UINT32 MmxExt:1;            ///< Bit22
141   UINT32 MMX:1;               ///< Bit23
142   UINT32 FXSR:1;              ///< Bit24
143   UINT32 FFXSR:1;             ///< Bit25
144   UINT32 Page1GB:1;           ///< Bit26
145   UINT32 RDTSCP:1;            ///< Bit27
146   UINT32 Reserved4:1;         ///< Bit28
147   UINT32 LM:1;                ///< Bit29
148   UINT32 ThreeDNowExt:1;      ///< Bit30
149   UINT32 ThreeDNow:1;         ///< Bit31
150 } CPU_F10_EXT_FEATURES_LO;
151
152 /// F10 CPU Extended Feature High
153 typedef struct {
154   UINT32 LahfSahf:1;        ///< Bit0
155   UINT32 CmpLegacy:1;       ///< Bit1
156   UINT32 SVM:1;             ///< Bit2
157   UINT32 ExtApicSpace:1;    ///< Bit3
158   UINT32 AltMovCr8:1;       ///< Bit4
159   UINT32 ABM:1;             ///< Bit5
160   UINT32 SSE4A:1;           ///< Bit6
161   UINT32 MisAlignSse:1;     ///< Bit7
162   UINT32 ThreeDNowPrefetch:1; ///< Bit8
163   UINT32 OSVM:1;            ///< Bit9
164   UINT32 IBS:1;             ///< Bit10
165   UINT32 Reserved1:1;       ///< Bit11
166   UINT32 SKINIT:1;          ///< Bit12
167   UINT32 WDT:1;             ///< Bit13
168   UINT32 Reserved2:5;       ///< Bit14~18
169   UINT32 NodeId:1;          ///< Bit19
170   UINT32 Reserved3:12;      ///< Bit20~31
171 } CPU_F10_EXT_FEATURES_HI;
172
173 /// F10 CPU Extended Feature
174 typedef struct {
175   CPU_F10_EXT_FEATURES_LO CpuF10ExtFeaturesLo;  ///< Low
176   CPU_F10_EXT_FEATURES_HI CpuF10ExtFeaturesHi;  ///< High
177 } CPU_F10_EXT_FEATURES;
178 /*---------------------------------------------------------------------------------------
179  *                        F U N C T I O N    P R O T O T Y P E
180  *---------------------------------------------------------------------------------------
181  */
182 VOID
183 F10SaveFeatures (
184   IN       CPU_SPECIFIC_SERVICES *FamilySpecificServices,
185   IN OUT   CPU_FEATURES_LIST *cpuFeatureList,
186   IN       AMD_CONFIG_PARAMS *StdHeader
187   );
188
189 VOID
190 F10WriteFeatures (
191   IN       CPU_SPECIFIC_SERVICES *FamilySpecificServices,
192   IN OUT   CPU_FEATURES_LIST *cpuFeatureList,
193   IN       AMD_CONFIG_PARAMS *StdHeader
194   );
195 #endif  // _CPU_F10_FEATURE_LEVELING_H_