blob: d64047bcbe800e3ca67ae2339f4f6068f98a9b09 [file] [log] [blame]
Frank Vibrans2b4c8312011-02-14 18:30:54 +00001/* $NoKeywords:$ */
2/**
3 * @file
4 *
5 * mu.h
6 *
7 * Utility support
8 *
9 * @xrefitem bom "File Content Label" "Release Content"
10 * @e project: AGESA
11 * @e sub-project: (Mem)
12 * @e \$Revision: 38442 $ @e \$Date: 2010-09-24 06:39:57 +0800 (Fri, 24 Sep 2010) $
13 *
14 **/
15/*
16 *****************************************************************************
17 *
18 * Copyright (c) 2011, Advanced Micro Devices, Inc.
19 * All rights reserved.
Edward O'Callaghane963b382014-07-06 19:27:14 +100020 *
Frank Vibrans2b4c8312011-02-14 18:30:54 +000021 * 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.
Edward O'Callaghane963b382014-07-06 19:27:14 +100028 * * Neither the name of Advanced Micro Devices, Inc. nor the names of
29 * its contributors may be used to endorse or promote products derived
Frank Vibrans2b4c8312011-02-14 18:30:54 +000030 * from this software without specific prior written permission.
Edward O'Callaghane963b382014-07-06 19:27:14 +100031 *
Frank Vibrans2b4c8312011-02-14 18:30:54 +000032 * 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.
Edward O'Callaghane963b382014-07-06 19:27:14 +100042 *
Frank Vibrans2b4c8312011-02-14 18:30:54 +000043 * ***************************************************************************
44 *
45 */
46
47#ifndef _MU_H_
48#define _MU_H_
49
50/*----------------------------------------------------------------------------
51 * Mixed (DEFINITIONS AND MACROS / TYPEDEFS, STRUCTURES, ENUMS)
52 *
53 *----------------------------------------------------------------------------
54 */
55
56/*-----------------------------------------------------------------------------
57 * DEFINITIONS AND MACROS
58 *
59 *-----------------------------------------------------------------------------
60 */
61#ifndef PSO_ENTRY
62 #define PSO_ENTRY UINT8
63#endif
64
Edward O'Callaghancd475602014-07-07 21:08:23 +100065#include <stdlib.h>
Frank Vibrans2b4c8312011-02-14 18:30:54 +000066
67/*----------------------------------------------------------------------------
68 * TYPEDEFS, STRUCTURES, ENUMS
69 *
70 *----------------------------------------------------------------------------
71 */
72
73/// Test patterns for DQS training
74typedef enum {
75 TestPattern0, ///< Test pattern used in first pass of receiver enable training
76 TestPattern1, ///< Test pattern used in first pass of receiver enable training
77 TestPattern2, ///< Test pattern used in second pass of receiver enable training
78 TestPatternJD1B, ///< 72-bit test pattern used in position training (ganged mode)
79 TestPatternJD1A, ///< 72-bit test pattern used in position training
80 TestPatternJD256B, ///< 256-bit test pattern used in position training (ganged mode)
81 TestPatternJD256A, ///< 256-bit test pattern used in position training
82 TestPatternML, ///< Test pattern used in first pass of max latency training
83 TestPattern3, ///< Test pattern used in first pass of receiver enable training
84 TestPattern4 ///< Test pattern used in first pass of receiver enable training
85} TRAIN_PATTERN;
86
87/*----------------------------------------------------------------------------
88 * FUNCTIONS PROTOTYPE
89 *
90 *----------------------------------------------------------------------------
91 */
92
93VOID
94MemUWriteCachelines (
95 IN UINT32 Address,
96 IN UINT8 Pattern[],
97 IN UINT16 ClCount
98 );
99
100VOID
101MemUReadCachelines (
102 IN UINT8 Buffer[],
103 IN UINT32 Address,
104 IN UINT16 ClCount
105 );
106
107VOID
108MemUDummyCLRead (
109 IN UINT32 Address
110 );
111
112VOID
113MemUFlushPattern (
114 IN UINT32 Address,
115 IN UINT16 ClCount
116 );
117
118
119VOID
120MemUFillTrainPattern (
121 IN TRAIN_PATTERN Pattern,
122 IN UINT8 Buffer[],
123 IN UINT16 Size
124 );
125
126UINT32
127MemUSetUpperFSbase (
128 IN UINT32 Address,
129 IN OUT MEM_DATA_STRUCT *MemPtr
130 );
131
132VOID
133MemUSetTargetWTIO (
134 IN UINT32 Address,
135 IN OUT MEM_DATA_STRUCT *MemPtr
136 );
137
138VOID
139MemUResetTargetWTIO (
140 IN OUT MEM_DATA_STRUCT *MemPtr
141 );
142
143VOID
144MemUProcIOClFlush (
145 IN UINT32 Address,
146 IN UINT16 ClCount,
147 IN OUT MEM_DATA_STRUCT *MemPtr
148 );
149
150VOID
151MemUWait10ns (
152 IN UINT32 Count,
153 IN OUT MEM_DATA_STRUCT *MemPtr
154 );
155
156VOID
157MemUGetWrLvNblErr (
158 IN OUT UINT16 *ErrBitmap,
159 IN UINT32 TestAddr,
160 IN UINT16 ClCount
161 );
162
163VOID
164AlignPointerTo16Byte (
165 IN OUT UINT8 **BufferPtrPtr
166 );
167
168VOID *
169FindPSOverrideEntry (
170 IN PSO_TABLE *PlatformMemoryConfiguration,
171 IN PSO_ENTRY EntryType,
172 IN UINT8 SocketID,
173 IN UINT8 ChannelID
174 );
175
176UINT8
177GetMaxDimmsPerChannel (
178 IN PSO_TABLE *PlatformMemoryConfiguration,
179 IN UINT8 SocketID,
180 IN UINT8 ChannelID
181 );
182
183UINT8
184GetMaxChannelsPerSocket (
185 IN PSO_TABLE *PlatformMemoryConfiguration,
186 IN UINT8 SocketID,
187 IN AMD_CONFIG_PARAMS *StdHeader
188 );
189
190UINT8
191GetMaxCSPerChannel (
192 IN PSO_TABLE *PlatformMemoryConfiguration,
193 IN UINT8 SocketID,
194 IN UINT8 ChannelID
195 );
196
197UINT8
198GetSpdSocketIndex (
199 IN PSO_TABLE *PlatformMemoryConfiguration,
200 IN UINT8 SocketID,
201 IN AMD_CONFIG_PARAMS *StdHeader
202 );
203
204UINT8
205GetSpdChannelIndex (
206 IN PSO_TABLE *PlatformMemoryConfiguration,
207 IN UINT8 SocketID,
208 IN UINT8 ChannelID,
209 IN AMD_CONFIG_PARAMS *StdHeader
210 );
211
212UINT32
213GetVarMtrrHiMsk (
214 IN CPU_LOGICAL_ID *LogicalIdPtr,
215 IN AMD_CONFIG_PARAMS *StdHeader
216 );
217
218VOID
219MemUMFenceInstr (
Frank Vibransccad9512011-05-05 16:49:11 +0000220 VOID
Frank Vibrans2b4c8312011-02-14 18:30:54 +0000221 );
222
223#endif /* _MU_H_ */
224
225