Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 1 | /* $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'Callaghan | e963b38 | 2014-07-06 19:27:14 +1000 | [diff] [blame] | 20 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 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. |
Edward O'Callaghan | e963b38 | 2014-07-06 19:27:14 +1000 | [diff] [blame] | 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 |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 30 | * from this software without specific prior written permission. |
Edward O'Callaghan | e963b38 | 2014-07-06 19:27:14 +1000 | [diff] [blame] | 31 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 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. |
Edward O'Callaghan | e963b38 | 2014-07-06 19:27:14 +1000 | [diff] [blame] | 42 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 43 | * *************************************************************************** |
| 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'Callaghan | cd47560 | 2014-07-07 21:08:23 +1000 | [diff] [blame] | 65 | #include <stdlib.h> |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 66 | |
| 67 | /*---------------------------------------------------------------------------- |
| 68 | * TYPEDEFS, STRUCTURES, ENUMS |
| 69 | * |
| 70 | *---------------------------------------------------------------------------- |
| 71 | */ |
| 72 | |
| 73 | /// Test patterns for DQS training |
| 74 | typedef 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 | |
| 93 | VOID |
| 94 | MemUWriteCachelines ( |
| 95 | IN UINT32 Address, |
| 96 | IN UINT8 Pattern[], |
| 97 | IN UINT16 ClCount |
| 98 | ); |
| 99 | |
| 100 | VOID |
| 101 | MemUReadCachelines ( |
| 102 | IN UINT8 Buffer[], |
| 103 | IN UINT32 Address, |
| 104 | IN UINT16 ClCount |
| 105 | ); |
| 106 | |
| 107 | VOID |
| 108 | MemUDummyCLRead ( |
| 109 | IN UINT32 Address |
| 110 | ); |
| 111 | |
| 112 | VOID |
| 113 | MemUFlushPattern ( |
| 114 | IN UINT32 Address, |
| 115 | IN UINT16 ClCount |
| 116 | ); |
| 117 | |
| 118 | |
| 119 | VOID |
| 120 | MemUFillTrainPattern ( |
| 121 | IN TRAIN_PATTERN Pattern, |
| 122 | IN UINT8 Buffer[], |
| 123 | IN UINT16 Size |
| 124 | ); |
| 125 | |
| 126 | UINT32 |
| 127 | MemUSetUpperFSbase ( |
| 128 | IN UINT32 Address, |
| 129 | IN OUT MEM_DATA_STRUCT *MemPtr |
| 130 | ); |
| 131 | |
| 132 | VOID |
| 133 | MemUSetTargetWTIO ( |
| 134 | IN UINT32 Address, |
| 135 | IN OUT MEM_DATA_STRUCT *MemPtr |
| 136 | ); |
| 137 | |
| 138 | VOID |
| 139 | MemUResetTargetWTIO ( |
| 140 | IN OUT MEM_DATA_STRUCT *MemPtr |
| 141 | ); |
| 142 | |
| 143 | VOID |
| 144 | MemUProcIOClFlush ( |
| 145 | IN UINT32 Address, |
| 146 | IN UINT16 ClCount, |
| 147 | IN OUT MEM_DATA_STRUCT *MemPtr |
| 148 | ); |
| 149 | |
| 150 | VOID |
| 151 | MemUWait10ns ( |
| 152 | IN UINT32 Count, |
| 153 | IN OUT MEM_DATA_STRUCT *MemPtr |
| 154 | ); |
| 155 | |
| 156 | VOID |
| 157 | MemUGetWrLvNblErr ( |
| 158 | IN OUT UINT16 *ErrBitmap, |
| 159 | IN UINT32 TestAddr, |
| 160 | IN UINT16 ClCount |
| 161 | ); |
| 162 | |
| 163 | VOID |
| 164 | AlignPointerTo16Byte ( |
| 165 | IN OUT UINT8 **BufferPtrPtr |
| 166 | ); |
| 167 | |
| 168 | VOID * |
| 169 | FindPSOverrideEntry ( |
| 170 | IN PSO_TABLE *PlatformMemoryConfiguration, |
| 171 | IN PSO_ENTRY EntryType, |
| 172 | IN UINT8 SocketID, |
| 173 | IN UINT8 ChannelID |
| 174 | ); |
| 175 | |
| 176 | UINT8 |
| 177 | GetMaxDimmsPerChannel ( |
| 178 | IN PSO_TABLE *PlatformMemoryConfiguration, |
| 179 | IN UINT8 SocketID, |
| 180 | IN UINT8 ChannelID |
| 181 | ); |
| 182 | |
| 183 | UINT8 |
| 184 | GetMaxChannelsPerSocket ( |
| 185 | IN PSO_TABLE *PlatformMemoryConfiguration, |
| 186 | IN UINT8 SocketID, |
| 187 | IN AMD_CONFIG_PARAMS *StdHeader |
| 188 | ); |
| 189 | |
| 190 | UINT8 |
| 191 | GetMaxCSPerChannel ( |
| 192 | IN PSO_TABLE *PlatformMemoryConfiguration, |
| 193 | IN UINT8 SocketID, |
| 194 | IN UINT8 ChannelID |
| 195 | ); |
| 196 | |
| 197 | UINT8 |
| 198 | GetSpdSocketIndex ( |
| 199 | IN PSO_TABLE *PlatformMemoryConfiguration, |
| 200 | IN UINT8 SocketID, |
| 201 | IN AMD_CONFIG_PARAMS *StdHeader |
| 202 | ); |
| 203 | |
| 204 | UINT8 |
| 205 | GetSpdChannelIndex ( |
| 206 | IN PSO_TABLE *PlatformMemoryConfiguration, |
| 207 | IN UINT8 SocketID, |
| 208 | IN UINT8 ChannelID, |
| 209 | IN AMD_CONFIG_PARAMS *StdHeader |
| 210 | ); |
| 211 | |
| 212 | UINT32 |
| 213 | GetVarMtrrHiMsk ( |
| 214 | IN CPU_LOGICAL_ID *LogicalIdPtr, |
| 215 | IN AMD_CONFIG_PARAMS *StdHeader |
| 216 | ); |
| 217 | |
| 218 | VOID |
| 219 | MemUMFenceInstr ( |
Frank Vibrans | ccad951 | 2011-05-05 16:49:11 +0000 | [diff] [blame] | 220 | VOID |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 221 | ); |
| 222 | |
| 223 | #endif /* _MU_H_ */ |
| 224 | |
| 225 | |