AGESA F15: AMD family15 AGESA code
[coreboot.git] / src / vendorcode / amd / agesa / f15 / Proc / CPU / Family / 0x15 / cpuF15Utilities.h
1 /* $NoKeywords:$ */
2 /**
3  * @file
4  *
5  * AMD Family_15 specific utility functions.
6  *
7  * Provides numerous utility functions specific to family 15h.
8  *
9  * @xrefitem bom "File Content Label" "Release Content"
10  * @e project:      AGESA
11  * @e sub-project:  CPU/Family/0x15
12  * @e \$Revision: 55600 $   @e \$Date: 2011-06-23 12:39:18 -0600 (Thu, 23 Jun 2011) $
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_F15_UTILITES_H_
47 #define _CPU_F15_UTILITES_H_
48
49
50 /*---------------------------------------------------------------------------------------
51  *          M I X E D   (Definitions And Macros / Typedefs, Structures, Enums)
52  *---------------------------------------------------------------------------------------
53  */
54
55
56 /*---------------------------------------------------------------------------------------
57  *                 D E F I N I T I O N S     A N D     M A C R O S
58  *---------------------------------------------------------------------------------------
59  */
60
61
62 /*---------------------------------------------------------------------------------------
63  *               T Y P E D E F S,   S T R U C T U R E S,    E N U M S
64  *---------------------------------------------------------------------------------------
65  */
66 /// The structure for Software Initiated NB Voltage Transitions
67 typedef struct {
68   UINT32  VidCode;          ///< VID code to transition to
69   BOOLEAN SlamMode;         ///< Whether voltage is to be slammed, or stepped
70 } SW_VOLT_TRANS_NB;
71
72 /*---------------------------------------------------------------------------------------
73  *                        F U N C T I O N    P R O T O T Y P E
74  *---------------------------------------------------------------------------------------
75  */
76
77 AGESA_STATUS
78 F15DisablePstate (
79   IN       CPU_SPECIFIC_SERVICES *FamilySpecificServices,
80   IN       UINT8 StateNumber,
81   IN       AMD_CONFIG_PARAMS *StdHeader
82   );
83
84 AGESA_STATUS
85 F15TransitionPstate (
86   IN       CPU_SPECIFIC_SERVICES *FamilySpecificServices,
87   IN       UINT8              StateNumber,
88   IN       BOOLEAN            WaitForTransition,
89   IN       AMD_CONFIG_PARAMS *StdHeader
90   );
91
92 AGESA_STATUS
93 F15GetTscRate (
94   IN       CPU_SPECIFIC_SERVICES *FamilySpecificServices,
95      OUT   UINT32 *FrequencyInMHz,
96   IN       AMD_CONFIG_PARAMS *StdHeader
97   );
98
99 BOOLEAN
100 F15LaunchApCore (
101   IN       CPU_SPECIFIC_SERVICES *FamilySpecificServices,
102   IN       UINT32 SocketNum,
103   IN       UINT32 ModuleNum,
104   IN       UINT32 CoreNum,
105   IN       UINT32 PrimaryCoreNum,
106   IN       AMD_CONFIG_PARAMS *StdHeader
107   );
108
109 VOID
110 F15HtPhyOverrideDllCompensation (
111   IN       UINT32              Data,
112   IN       AMD_CONFIG_PARAMS   *StdHeader
113   );
114
115 BOOLEAN
116 F15GetNextHtLinkFeatures (
117   IN       CPU_SPECIFIC_SERVICES  *FamilySpecificServices,
118   IN OUT   UINTN                  *Link,
119   IN OUT   PCI_ADDR               *LinkBase,
120      OUT   HT_HOST_FEATS          *HtHostFeats,
121   IN       AMD_CONFIG_PARAMS      *StdHeader
122   );
123
124 BOOLEAN
125 F15NextLinkHasHtPhyFeats (
126   IN       CPU_SPECIFIC_SERVICES  *FamilySpecificServices,
127   IN OUT   PCI_ADDR           *HtHostCapability,
128   IN OUT   UINT32             *Link,
129   IN       HT_PHY_LINK_FEATS  *HtPhyLinkType,
130      OUT   BOOLEAN            *MatchedSublink1,
131      OUT   HT_FREQUENCIES     *Frequency0,
132      OUT   HT_FREQUENCIES     *Frequency1,
133   IN       AMD_CONFIG_PARAMS  *StdHeader
134   );
135
136 VOID
137 F15SetHtPhyRegister (
138   IN       CPU_SPECIFIC_SERVICES  *FamilySpecificServices,
139   IN       HT_PHY_TYPE_ENTRY_DATA  *HtPhyEntry,
140   IN       PCI_ADDR                 CapabilitySet,
141   IN       UINT32                   Link,
142   IN       AMD_CONFIG_PARAMS       *StdHeader
143   );
144
145 BOOLEAN
146 F15CommonGetNbCofVidUpdate (
147   IN       CPU_SPECIFIC_SERVICES *FamilySpecificServices,
148   IN       PCI_ADDR *PciAddress,
149      OUT   BOOLEAN *NbVidUpdateAll,
150   IN       AMD_CONFIG_PARAMS *StdHeader
151   );
152
153 BOOLEAN
154 F15IsNbPstateEnabled (
155   IN       CPU_SPECIFIC_SERVICES  *FamilySpecificServices,
156   IN       PLATFORM_CONFIGURATION *PlatformConfig,
157   IN       AMD_CONFIG_PARAMS      *StdHeader
158   );
159
160 #endif  // _CPU_F15_UTILITES_H_