AGESA F15: AMD family15 AGESA code
[coreboot.git] / src / vendorcode / amd / agesa / f15 / Proc / IDS / IdsLib.h
1 /* $NoKeywords:$ */
2 /**
3  * @file
4  *
5  * AMD IDS Routines
6  *
7  * Contains AMD AGESA Integrated Debug Macros
8  *
9  * @xrefitem bom "File Content Label" "Release Content"
10  * @e project:      AGESA
11  * @e sub-project:  IDS
12  * @e \$Revision: 55552 $   @e \$Date: 2011-06-22 09:31:58 -0600 (Wed, 22 Jun 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 _IDS_LIB_H_
45 #define _IDS_LIB_H_
46 #include "OptionsIds.h"
47 #include "cpuRegisters.h"
48 #include "cpuApicUtilities.h"
49 #include "Table.h"
50 ///Specific time stamp performance analysis which need ids control support
51 #if IDSOPT_CONTROL_ENABLED == TRUE
52   #define PERF_SPEC_TS_ANALYSE(StdHeader)
53 #else
54   #define PERF_SPEC_TS_ANALYSE(StdHeader)
55 #endif
56
57
58 #define IDS_NV_READ_SKIP(NvValue, Nvid, IdsNvPtr, StdHeader)
59 #define IDS_GET_MASK32(HighBit, LowBit)
60
61 #define IDS_MAX_MEM_ITEMS   80     ///< Maximum IDS Mem Table Size in Heap.
62 ///Macro for Ids family feat
63 #define MAKE_IDS_FAMILY_FEAT_ALL_CORES(FEAT_ID, FAMILY, FUNCTION) \
64         {IDS_FEAT_COMMON, IDS_ALL_CORES, FEAT_ID, FAMILY, FUNCTION}
65
66
67 // TYPEDEFS, STRUCTURES, ENUMS
68 //
69
70 typedef AGESA_STATUS (*PF_IDS_AP_TASK) (VOID *AptaskPara, AMD_CONFIG_PARAMS *StdHeader);
71
72 ///Structure define for IdsAgesaRunFcnOnApLate
73 typedef struct _IDSAPLATETASK {
74   PF_IDS_AP_TASK  ApTask; ///< Point function which AP need to do
75   VOID *ApTaskPara; ///< Point to Ap function parameter1
76 } IDSAPLATETASK;
77
78 /// Data Structure defining IDS Data in HEAP
79 /// This data structure contains information that is stored in HEAP and will be
80 /// used in IDS backend function. It includes the size of memory to be allocated
81 /// for IDS, the relative offsets of the mapping table IDS setup options, the GRA
82 /// table and the register table to override mem setting. It also includes a base
83 /// address of IDS override image which will be used to control the behavior of
84 /// AGESA testpoint if this feature is enabled.
85 typedef struct {
86   BOOLEAN IgnoreIdsDefault;             ///< Control ignore Default value of IDS NV list specified by IdsNvTableOffset
87   UINT64 IdsImageBase;                 ///< IDS Override Image Base Address
88   UINT32 IdsHeapMemSize;              ///< IDS Total Memory Size in Heap
89   UINT32 IdsNvTableOffset;            ///< Offset of IDS NV Table
90   UINT32 IdsMemTableOffset;           ///< Offset of IDS Mem Table
91   UINT32 IdsExtendOffset;                ///< Offset of Ids extend heap
92 } IDS_CONTROL_STRUCT;
93
94
95 /// Data Structure of Parameters for TestPoint_TSC.
96 typedef struct {
97   UINT8 TestPoint;                    ///< The TestPoint of TestPoint_TSC
98   UINT64 StartTsc;                  ///< The StartTimer of TestPoint_TSC
99 } TestPoint_TSC;
100
101 /// Data Structure of Parameters for TP_Perf_STRUCT.
102 typedef struct {
103   UINT8 Index;                    ///< The Index of TP_Perf_STRUCT
104   UINT32 TscInMhz;            ///< Tsc counter in 1 mhz
105   TestPoint_TSC TP[EndAgesaTps];       ///< The TP of TP_Perf_STRUCT
106 } TP_Perf_STRUCT;
107
108
109 ///Bus speed Optimization
110 typedef enum {
111   IDS_POWER_POLICY_PERFORMANCE = 0,              ///< Performance
112   IDS_POWER_POLICY_POWER = 1,              ///< Power
113   IDS_POWER_POLICY_AUTO = 3,              ///< Auto
114 } IDS_NV_AMDBUSSPEEDOPTIMIZATION;
115
116
117 #define IDS_ALL_SOCKET 0xFF
118 #define IDS_ALL_MODULE 0xFF
119 #define IDS_ALL_CORE   0xFF
120 #define IDS_ALL_DCT   0xFF
121
122 #define IDS_CPB_BOOST_DIS_IGNORE  0xFFFFFFFF
123
124 #endif //_IDS_LIB_H_
125