zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 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: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $ |
| 13 | */ |
| 14 | /***************************************************************************** |
| 15 | * |
Siyuan Wang | 641f00c | 2013-06-08 11:50:55 +0800 | [diff] [blame] | 16 | * Copyright (c) 2008 - 2012, Advanced Micro Devices, Inc. |
| 17 | * All rights reserved. |
zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 18 | * |
Siyuan Wang | 641f00c | 2013-06-08 11:50:55 +0800 | [diff] [blame] | 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. |
zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 29 | * |
Siyuan Wang | 641f00c | 2013-06-08 11:50:55 +0800 | [diff] [blame] | 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. |
zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 40 | * |
| 41 | ***************************************************************************/ |
| 42 | |
| 43 | /* Macros to aid debugging */ |
| 44 | /* These definitions expand to zero (0) bytes of code when disabled */ |
| 45 | |
| 46 | #ifndef _IDS_H_ |
| 47 | #define _IDS_H_ |
| 48 | |
| 49 | #undef FALSE |
| 50 | #undef TRUE |
| 51 | #define FALSE 0 |
| 52 | #define TRUE 1 |
| 53 | // Proto type for optionsids.h |
| 54 | typedef UINT32 IDS_STATUS; ///< Status of IDS function. |
| 55 | #define IDS_SUCCESS ((IDS_STATUS) 0x00000000ul) ///< IDS Function is Successful. |
| 56 | #define IDS_UNSUPPORTED ((IDS_STATUS) 0xFFFFFFFFul) ///< IDS Function is not existed. |
| 57 | |
| 58 | #define IDS_STRINGIZE(a) #a ///< for define stringize macro |
| 59 | #ifndef IDS_DEADLOOP |
| 60 | #define IDS_DEADLOOP() { volatile UINTN __i; __i = 1; while (__i); } |
| 61 | #endif |
| 62 | /** |
| 63 | * IDS Option Hook Points |
| 64 | * |
| 65 | * These are the values to indicate hook point in AGESA for IDS Options. |
| 66 | * |
| 67 | */ |
| 68 | typedef enum { //vv- for debug reference only |
| 69 | IDS_INIT_EARLY_BEFORE, ///< 00 Option Hook Point before AGESA function AMD_INIT_EARLY. |
| 70 | ///< IDS Object is initialized. |
| 71 | ///< Override CPU Core Leveling Mode. |
| 72 | ///< Set P-State in Post |
| 73 | IDS_INIT_EARLY_AFTER, ///< 01 Option Hook Point after AGESA function AMD_INIT_EARLY. |
| 74 | IDS_INIT_LATE_BEFORE, ///< 02 Option Hook Point before AGESA function AMD_INIT_LATE. |
| 75 | ///< It will be used to control the following tables. |
| 76 | ///< ACPI P-State Table (_PSS, XPSS, _PCT, _PSD, _PPC) |
| 77 | ///< ACPI SRAT Table |
| 78 | ///< ACPI SLIT Table |
| 79 | ///< ACPI WHEA Table |
| 80 | ///< DMI Table |
| 81 | IDS_INIT_LATE_AFTER, ///< 03 Option Hook Point after AGESA function AMD_INIT_LATE. |
| 82 | IDS_INIT_MID_BEFORE, ///< 04 Option Hook Point before AGESA function AMD_INIT_MID. |
| 83 | IDS_INIT_MID_AFTER, ///< 05 Option Hook Point after AGESA function AMD_INIT_MID. |
| 84 | IDS_INIT_POST_BEFORE, ///< 06 Option Hook Point before AGESA function AMD_INIT_POST. |
| 85 | ///< Control Interleaving and DRAM memory hole |
| 86 | ///< Override the setting of ECC Control |
| 87 | ///< Override the setting of Online Spare Rank |
| 88 | IDS_INIT_POST_AFTER, ///< 07 Option Hook Point after AGESA function AMD_INIT_POST. |
| 89 | IDS_INIT_RESET_BEFORE, ///< 08 Option Hook Point before AGESA function AMD_INIT_RESET. |
| 90 | IDS_INIT_RESET_AFTER, ///< 09 Option Hook Point after AGESA function AMD_INIT_RESET. |
| 91 | IDS_INIT_POST_MID, ///< 0a Option Hook Point after AGESA function AMD_INIT_POST. |
| 92 | IDS_BEFORE_S3_SAVE, ///< 0b override any settings before S3 save. |
| 93 | IDS_BEFORE_S3_RESTORE, ///< 0c override any settings before S3 restore |
| 94 | IDS_AFTER_S3_SAVE, ///< 0d Override any settings after S3 save |
| 95 | IDS_AFTER_S3_RESTORE, ///< 0e Override any settings after S3 restore |
| 96 | IDS_BEFORE_DQS_TRAINING, ///< 0f override any settings before DQS training |
| 97 | IDS_BEFORE_DRAM_INIT, ///< 10 override any settings before Dram initialization |
| 98 | IDS_BEFORE_MEM_FREQ_CHG, ///< 11 override settings before MemClk frequency change |
| 99 | IDS_BEFORE_WARM_RESET , ///< 12 Override PCI or MSR Registers Before Warm Reset |
| 100 | IDS_BEFORE_PCI_INIT, ///< 13 Override PCI or MSR Registers Before PCI Init |
| 101 | IDS_BEFORE_AP_EARLY_HALT, ///< 14 Option Hook Point before AP early halt |
| 102 | IDS_BEFORE_S3_RESUME, ///< 15 Option Hook Point before s3 resume |
| 103 | IDS_AFTER_S3_RESUME, ///< 16 Option Hook Point after s3 resume |
| 104 | IDS_BEFORE_PM_INIT, ///< 17 Option Hook Point Before Pm Init |
| 105 | |
| 106 | IDS_MT_BASE = 0x20, ///< 0x20 ~ 0x38 24 time points reserved for MTTime |
| 107 | |
| 108 | IDS_PLATFORM_RSVD1 = 0x38, ///< from 0x38 to 0x3f will reserved for platform used |
| 109 | IDS_PLATFORM_RSVD2 = 0x39, ///< from 0x38 to 0x3f will reserved for platform used |
| 110 | IDS_PLATFORM_RSVD3 = 0x3a, ///< from 0x38 to 0x3f will reserved for platform used |
| 111 | IDS_PLATFORM_RSVD4 = 0x3b, ///< from 0x38 to 0x3f will reserved for platform used |
| 112 | IDS_PLATFORM_RSVD5 = 0x3c, ///< from 0x38 to 0x3f will reserved for platform used |
| 113 | IDS_PLATFORM_RSVD6 = 0x3d, ///< from 0x38 to 0x3f will reserved for platform used |
| 114 | IDS_PLATFORM_RSVD7 = 0x3e, ///< from 0x38 to 0x3f will reserved for platform used |
| 115 | IDS_PLATFORM_RSVD8 = 0x3f, ///< from 0x38 to 0x3f will reserved for platform used |
| 116 | |
| 117 | // All the above timing point is used by BVM, their value should never be changed |
| 118 | IDS_HT_CONTROL, ///< 40 Override the setting of HT Link Control |
| 119 | IDS_HT_TRISTATE, ///< 41 Enable or Disable HT Tri-state during an LDTSTP# |
| 120 | IDS_INIT_DRAM_TABLE, ///< 42 Generate override table for Dram Timing |
| 121 | ///< Dram Controller, Drive Strength and DQS Timing |
| 122 | IDS_GET_DRAM_TABLE, ///< 43 Generate override table for Dram Timing |
| 123 | IDS_GANGING_MODE, ///< 44 override Memory Mode Unganged |
| 124 | IDS_POWERDOWN_MODE, ///< 45 override Power Down Mode |
| 125 | IDS_BURST_LENGTH32, ///< 46 override Burst Length32 |
| 126 | IDS_ALL_MEMORY_CLOCK, ///< 47 override All Memory Clks Enable |
| 127 | IDS_ECC, ///< 48 override ECC parameter |
| 128 | IDS_ECCSYMBOLSIZE, ///< 49 override ECC symbol size |
| 129 | IDS_CPU_Early_Override, ///< 4a override CPU early parameter |
| 130 | IDS_CACHE_FLUSH_HLT, ///< 4b override Cache Flush Hlt |
| 131 | IDS_CHANNEL_INTERLEAVE, ///< 4c override Channel Interleave |
| 132 | IDS_MEM_ERROR_RECOVERY, ///< 4d override memory error recovery |
| 133 | IDS_MEM_RETRAIN_TIMES, ///< 4e override memory retrain times |
| 134 | IDS_MEM_SIZE_OVERLAY, ///< 4f Override the syslimit |
| 135 | IDS_HT_ASSIST, ///< 50 Override Probe Filter |
| 136 | IDS_CHECK_NEGATIVE_WL, ///< 51 Check for negative write leveling result |
| 137 | IDS_DLL_SHUT_DOWN, ///< 52 Check for Dll Shut Down |
| 138 | IDS_POR_MEM_FREQ, ///< 53 Entry to enable/disable MemClk frequency enforcement |
| 139 | IDS_PHY_DLL_STANDBY_CTRL, ///< 54 Enable/Disable Phy DLL standby feature |
| 140 | IDS_PLATFORMCFG_OVERRIDE, ///< 55 Hook for Override PlatformConfig structure |
| 141 | IDS_LOADCARD_ERROR_RECOVERY, ///< 56 Special error handling for load card support |
| 142 | IDS_MEM_IGNORE_ERROR, ///< 57 Ignore error and do not do fatal exit in memory |
| 143 | IDS_GNB_SMU_SERVICE_CONFIG, ///< 58 Config GNB SMU service |
| 144 | IDS_GNB_ORBDYNAMIC_WAKE, ///< 59 config GNB dynamic wake |
| 145 | IDS_GNB_PLATFORMCFG_OVERRIDE, ///< 5a override ids gnb platform config |
| 146 | IDS_GNB_LCLK_DPM_EN, ///< 5b override GNB LCLK DPM configuration |
| 147 | IDS_GNB_LCLK_DEEP_SLEEP, ///< 5c override GNB LCLK DPM deep sleep |
| 148 | IDS_GNB_CLOCK_GATING, ///< 5d Override GNB Clock gating config |
| 149 | IDS_NB_PSTATE_DIDVID, ///< 5e Override NB P-state settings |
| 150 | IDS_CPB_CTRL, ///< 5f Config the Core peformance boost feature |
| 151 | IDS_HTC_CTRL, ///< 60 Hook for Hardware Thermal Control |
| 152 | IDS_CC6_WORKAROUND, ///< 61 Hook for skip CC6 work around |
| 153 | IDS_MEM_MR0, ///< 62 Hook for override Memory Mr0 register |
| 154 | IDS_TRAP_TABLE, ///< 63 Hook for add IDS register table to the loop |
| 155 | IDS_NBBUFFERALLOCATIONATEARLY, ///< 64 Hook for override North bridge bufer allocation |
| 156 | IDS_BEFORE_S3_SPECIAL, ///< 65 Hook to bypass S3 special functions |
| 157 | IDS_SET_PCI_REGISTER_ENTRY, ///< 66 Hook to SetRegisterForPciEntry |
| 158 | IDS_ERRATUM463_WORKAROUND, ///< 67 Hook to Erratum 463 workaround |
| 159 | IDS_BEFORE_MEMCLR, ///< 68 Hook before set Memclr bit |
| 160 | IDS_OVERRIDE_IO_CSTATE, ///< 69 Hook for override io C-state setting |
| 161 | IDS_NBPSDIS_OVERRIDE, ///< 6a Hook for override NB pstate disable setting |
| 162 | IDS_NBPS_REG_OVERRIDE, ///< 6b Hook for override Memory NBps reg |
| 163 | IDS_LOW_POWER_PSTATE, ///< 6c Hook for disalbe Low power_Pstates feature |
| 164 | IDS_CST_CREATE, ///< 6d Hook for create _CST |
| 165 | IDS_CST_SIZE, ///< 6e Hook for get _CST size |
| 166 | IDS_ENFORCE_VDDIO, ///< 6f Hook to override VDDIO |
| 167 | IDS_STRETCH_FREQUENCY_LIMIT, ///< 70 Hook for enforcing memory stretch frequency limit |
| 168 | IDS_INIT_MEM_REG_TABLE, ///< 71 Hook for init memory register table |
| 169 | IDS_SKIP_FUSED_MAX_RATE, ///< 72 Hook to skip fused max rate cap |
| 170 | IDS_FCH_INIT_AT_RESET, ///< 73 Hook for FCH reset parameter |
| 171 | IDS_FCH_INIT_AT_ENV, ///< 74 Hook for FCH ENV parameter |
| 172 | IDS_ENFORCE_PLAT_TABLES, ///< 75 Hook to enforce platform specific tables |
| 173 | IDS_NBPS_MIN_FREQ, ///< 76 Hook for override MIN nb ps freq |
| 174 | IDS_GNB_FORCE_CABLESAFE, ///< 77 Hook for override Force Cable Safe |
| 175 | IDS_SKIP_PM_TRANSITION_STEP, ///< 78 Hook for provide IDS ability to skip this PM step |
| 176 | IDS_GNB_PROPERTY, ///< 79 Hook for GNB Property |
| 177 | IDS_GNB_PCIE_POWER_GATING, ///< 7A Hook for GNB PCIe Power Gating |
| 178 | IDS_MEM_DYN_DRAM_TERM, ///< 7B Hook for Override Dynamic Dram Term |
| 179 | IDS_MEM_DRAM_TERM, ///< 7C Hook for Override Dram Term |
| 180 | IDS_HT_TRACE_MODE, ///< 7D Trace Mode |
| 181 | IDS_GNB_ALTVDDNB, ///< 7E Hook for Override AltVddNB |
| 182 | IDS_UCODE, ///< 7F Enable or Disable microcode patching |
| 183 | IDS_FAM_REG_GMMX, ///< 80 GMMX register access |
| 184 | IDS_MEMORY_POWER_POLICY, ///< 81 Memory power policy |
| 185 | IDS_GET_STRETCH_FREQUENCY_LIMIT, ///< 82 Hook for enforcing memory stretch frequency limit |
| 186 | IDS_CPU_FEAT, ///< 83 Hook for runtime force cpu feature disable |
| 187 | IDS_AFTER_DCT_PHY_ACCESS, ///< 84 Hook for DctAccessDone check |
| 188 | IDS_FORCE_PHY_TO_M0, ///< 85 Hook to bypass M0 enforcement |
| 189 | IDS_GNB_PMM_SWTJOFFSET, ///< 86 Hook to GNBSWTJOFFSET |
| 190 | IDS_LOCK_DRAM_CFG, ///< 87 Hook to BFLockDramCfg |
| 191 | IDS_OPTION_END, ///< 88 End of IDS option |
| 192 | } AGESA_IDS_OPTION; |
| 193 | |
| 194 | #include "OptionsIds.h" |
| 195 | #include "Filecode.h" |
| 196 | |
| 197 | /* Initialize IDS controls */ |
| 198 | #ifndef IDSOPT_IDS_ENABLED |
| 199 | #define IDSOPT_IDS_ENABLED FALSE |
| 200 | #endif |
| 201 | |
| 202 | #ifndef IDSOPT_CONTROL_ENABLED |
| 203 | #define IDSOPT_CONTROL_ENABLED FALSE |
| 204 | #endif |
| 205 | |
| 206 | #ifndef IDSOPT_CONTROL_NV_TO_CMOS |
| 207 | #define IDSOPT_CONTROL_NV_TO_CMOS FALSE |
| 208 | #endif |
| 209 | |
| 210 | #ifndef IDSOPT_TRACING_ENABLED |
| 211 | #define IDSOPT_TRACING_ENABLED FALSE |
| 212 | #endif |
| 213 | |
| 214 | #ifndef IDSOPT_TRACE_USER_OPTIONS |
| 215 | #define IDSOPT_TRACE_USER_OPTIONS TRUE |
| 216 | #endif |
| 217 | |
| 218 | #ifndef IDSOPT_PERF_ANALYSIS |
| 219 | #define IDSOPT_PERF_ANALYSIS FALSE |
| 220 | #endif |
| 221 | |
| 222 | #ifndef IDSOPT_HEAP_CHECKING |
| 223 | #define IDSOPT_HEAP_CHECKING FALSE |
| 224 | #endif |
| 225 | |
zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 226 | #ifndef IDSOPT_ERROR_TRAP_ENABLED |
| 227 | #define IDSOPT_ERROR_TRAP_ENABLED FALSE |
| 228 | #endif |
| 229 | |
| 230 | #ifndef IDSOPT_CAR_CORRUPTION_CHECK_ENABLED |
| 231 | #define IDSOPT_CAR_CORRUPTION_CHECK_ENABLED FALSE |
| 232 | #endif |
| 233 | |
| 234 | #ifndef IDSOPT_DEBUG_CODE_ENABLED |
| 235 | #define IDSOPT_DEBUG_CODE_ENABLED FALSE |
| 236 | #endif |
| 237 | |
| 238 | #ifndef IDSOPT_IDT_EXCEPTION_TRAP |
| 239 | #define IDSOPT_IDT_EXCEPTION_TRAP FALSE |
| 240 | #endif |
| 241 | |
| 242 | #ifndef IDSOPT_C_OPTIMIZATION_DISABLED |
| 243 | #define IDSOPT_C_OPTIMIZATION_DISABLED FALSE |
| 244 | #endif |
| 245 | |
| 246 | #ifndef IDSOPT_TRACING_CONSOLE_HDTOUT |
| 247 | #define IDSOPT_TRACING_CONSOLE_HDTOUT FALSE |
| 248 | #endif |
| 249 | |
| 250 | #ifndef IDSOPT_TRACING_CONSOLE_SERIALPORT |
| 251 | #define IDSOPT_TRACING_CONSOLE_SERIALPORT FALSE |
| 252 | #endif |
| 253 | |
| 254 | #ifndef IDSOPT_TRACING_CONSOLE_REDIRECT_IO |
| 255 | #define IDSOPT_TRACING_CONSOLE_REDIRECT_IO FALSE |
| 256 | #endif |
| 257 | |
| 258 | #if IDSOPT_IDS_ENABLED == FALSE |
| 259 | #undef IDSOPT_CONTROL_ENABLED |
| 260 | #undef IDSOPT_TRACING_ENABLED |
| 261 | #undef IDSOPT_PERF_ANALYSIS |
| 262 | #undef IDSOPT_HEAP_CHECKING |
zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 263 | #undef IDSOPT_ERROR_TRAP_ENABLED |
| 264 | #undef IDSOPT_CAR_CORRUPTION_CHECK_ENABLED |
| 265 | #undef IDSOPT_DEBUG_CODE_ENABLED |
| 266 | #undef IDSOPT_TRACE_USER_OPTIONS |
| 267 | #undef IDSOPT_TRACING_CONSOLE_HDTOUT |
| 268 | #undef IDSOPT_TRACING_CONSOLE_SERIALPORT |
| 269 | #undef IDSOPT_TRACING_CONSOLE_REDIRECT_IO |
| 270 | |
| 271 | #define IDSOPT_CONTROL_ENABLED FALSE |
| 272 | #define IDSOPT_TRACING_ENABLED FALSE |
| 273 | #define IDSOPT_PERF_ANALYSIS FALSE |
| 274 | #define IDSOPT_HEAP_CHECKING FALSE |
zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 275 | #define IDSOPT_ERROR_TRAP_ENABLED FALSE |
| 276 | #define IDSOPT_CAR_CORRUPTION_CHECK_ENABLED FALSE |
| 277 | #define IDSOPT_DEBUG_CODE_ENABLED FALSE |
| 278 | #define IDSOPT_TRACE_USER_OPTIONS FALSE |
| 279 | #define IDSOPT_TRACING_CONSOLE_HDTOUT FALSE |
| 280 | #define IDSOPT_TRACING_CONSOLE_SERIALPORT FALSE |
| 281 | #define IDSOPT_TRACING_CONSOLE_REDIRECT_IO FALSE |
| 282 | #endif |
| 283 | |
| 284 | //Disable when master token Tracing is set to FALSE |
| 285 | #if (IDSOPT_TRACING_ENABLED == FALSE) || (defined (IDSOPT_CUSTOMIZE_TRACING_SERVICE)) |
| 286 | #undef IDSOPT_TRACING_CONSOLE_HDTOUT |
| 287 | #define IDSOPT_TRACING_CONSOLE_HDTOUT FALSE |
| 288 | |
| 289 | #undef IDSOPT_TRACING_CONSOLE_SERIALPORT |
| 290 | #define IDSOPT_TRACING_CONSOLE_SERIALPORT FALSE |
| 291 | |
| 292 | #undef IDSOPT_TRACING_CONSOLE_REDIRECT_IO |
| 293 | #define IDSOPT_TRACING_CONSOLE_REDIRECT_IO FALSE |
| 294 | #endif |
| 295 | |
| 296 | //Disable Tracing if all support HW layer set to FALSE |
| 297 | #if ((IDSOPT_TRACING_CONSOLE_HDTOUT == FALSE) && (IDSOPT_TRACING_CONSOLE_SERIALPORT == FALSE) && (IDSOPT_TRACING_CONSOLE_REDIRECT_IO == FALSE)) |
| 298 | #ifndef IDSOPT_CUSTOMIZE_TRACING_SERVICE |
| 299 | #undef IDSOPT_TRACING_ENABLED |
| 300 | #define IDSOPT_TRACING_ENABLED FALSE |
| 301 | #endif |
| 302 | #endif |
| 303 | /** |
| 304 | * Make a Progress Report to the User. |
| 305 | * |
| 306 | * This Macro is always enabled. The default action is to write the TestPoint value |
| 307 | * to an I/O port. The I/O port is 8 bits in size and the default address is 0x80. |
| 308 | * IBVs can change AGESA's default port by defining IDS_DEBUG_PORT to desired port |
| 309 | * in OptionsIds.h in their build tip. |
| 310 | * |
| 311 | * @param[in] TestPoint The value for display indicating progress |
| 312 | * @param[in,out] StdHeader Pointer of AMD_CONFIG_PARAMS |
| 313 | * |
| 314 | **/ |
| 315 | |
| 316 | #define AGESA_TESTPOINT(TestPoint, StdHeader) IdsAgesaTestPoint ((TestPoint), (StdHeader)) |
| 317 | |
| 318 | #ifndef IDS_DEBUG_PORT |
| 319 | #define IDS_DEBUG_PORT 0x80 |
| 320 | #endif |
| 321 | |
| 322 | /** |
| 323 | * @def STOP_HERE |
| 324 | * (macro) - Causes program to halt. This is @b only for use during active debugging . |
| 325 | * |
| 326 | * Causes the program to halt and display the file number of the source of the |
| 327 | * halt (displayed in decimal). |
| 328 | * |
| 329 | **/ |
| 330 | #if IDSOPT_IDS_ENABLED == TRUE |
| 331 | #ifdef STOP_CODE |
| 332 | #undef STOP_CODE |
| 333 | #endif |
| 334 | #define STOP_CODE (((UINT32)FILECODE)*0x10000ul + \ |
| 335 | ((__LINE__) % 10) + (((__LINE__ / 10) % 10)*0x10) + \ |
| 336 | (((__LINE__ / 100) % 10)*0x100) + (((__LINE__ / 1000) % 10)*0x1000)) |
| 337 | #define STOP_HERE IdsErrorStop (STOP_CODE); |
| 338 | #else |
| 339 | #define STOP_HERE STOP_HERE_Needs_To_Be_Removed //"WARNING: Debug code needs to be removed for production builds." |
| 340 | #endif |
| 341 | |
zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 342 | #if IDSOPT_CAR_CORRUPTION_CHECK_ENABLED == TRUE |
| 343 | #undef IDSOPT_ERROR_TRAP_ENABLED |
| 344 | #define IDSOPT_ERROR_TRAP_ENABLED TRUE |
| 345 | #define IDS_CAR_CORRUPTION_CHECK(StdHeader) IdsCarCorruptionCheck(StdHeader) |
| 346 | #else |
| 347 | #define IDS_CAR_CORRUPTION_CHECK(StdHeader) |
| 348 | #endif |
| 349 | /** |
| 350 | * @def DEBUG_CODE |
| 351 | * Make the code active when IDSOPT_DEBUG_CODE_ENABLED enable |
| 352 | * |
| 353 | */ |
| 354 | #ifndef DEBUG_CODE |
| 355 | #if IDSOPT_DEBUG_CODE_ENABLED == TRUE |
| 356 | #define DEBUG_CODE(Code) Code |
| 357 | #else |
| 358 | #define DEBUG_CODE(Code) |
| 359 | #endif |
| 360 | #endif |
| 361 | |
| 362 | /** |
| 363 | * @def IDS_ERROR_TRAP |
| 364 | * Trap AGESA Error events with stop code display. |
| 365 | * |
| 366 | * Works similarly to use of "ASSERT (FALSE);" |
| 367 | * |
| 368 | */ |
| 369 | #if IDSOPT_ERROR_TRAP_ENABLED == TRUE |
| 370 | #ifdef STOP_CODE |
| 371 | #undef STOP_CODE |
| 372 | #endif |
| 373 | #define STOP_CODE (((UINT32)FILECODE)*0x10000ul + \ |
| 374 | ((__LINE__) % 10) + (((__LINE__ / 10) % 10)*0x10) + \ |
| 375 | (((__LINE__ / 100) % 10)*0x100) + (((__LINE__ / 1000) % 10)*0x1000)) |
| 376 | |
| 377 | #define IDS_ERROR_TRAP IdsErrorStop (STOP_CODE) |
| 378 | #else |
| 379 | #define IDS_ERROR_TRAP |
| 380 | #endif |
| 381 | |
| 382 | ///give the extended Macro default value |
| 383 | #ifndef __IDS_EXTENDED__ |
| 384 | #define IDS_EXTENDED_HOOK(idsoption, dataptr, idsnvptr, stdheader) IDS_SUCCESS |
| 385 | #define IDS_TRACE_DEFAULT (0) |
| 386 | #define IDS_INITIAL_F10_PM_STEP |
| 387 | #define IDS_INITIAL_F12_PM_STEP |
| 388 | #define IDS_INITIAL_F14_PM_STEP |
| 389 | #define IDS_INITIAL_F15_OR_PM_STEP |
| 390 | #define IDS_INITIAL_F15_TN_PM_STEP |
| 391 | #define IDS_F15_TN_PM_CUSTOM_STEP |
| 392 | #define IDS_EXTENDED_GET_DATA_EARLY(data, StdHeader) |
| 393 | #define IDS_EXTENDED_GET_DATA_LATE(data, StdHeader) |
| 394 | #define IDS_EXTENDED_HEAP_SIZE 0 |
| 395 | #define IDS_EXT_INCLUDE_F10(file) |
| 396 | #define IDS_EXT_INCLUDE_F12(file) |
| 397 | #define IDS_EXT_INCLUDE_F14(file) |
| 398 | #define IDS_EXT_INCLUDE_F15(file) |
| 399 | #define IDS_EXT_INCLUDE(file) |
| 400 | #define IDS_PAD_4K |
| 401 | #define IDS_EXTENDED_CODE(code) |
| 402 | #endif |
| 403 | |
| 404 | #ifndef IDS_NUM_NV_ITEM |
| 405 | #define IDS_NUM_NV_ITEM (IDS_NUM_EXT_NV_ITEM) |
| 406 | #endif |
| 407 | |
| 408 | #define IDS_CMOS_INDEX_PORT 0x70 |
| 409 | #define IDS_CMOS_DATA_PORT 0x71 |
| 410 | #define IDS_CMOS_REGION_START 0x20 |
| 411 | #define IDS_CMOS_REGION_END 0x7F |
| 412 | #define IDS_AP_GET_NV_FROM_CMOS(x) FALSE |
| 413 | |
| 414 | #if IDSOPT_CONTROL_ENABLED == TRUE |
| 415 | #define IDS_OPTION_HOOK(IdsOption, DataPtr, StdHeader) \ |
| 416 | AmdIdsCtrlDispatcher ((IdsOption), (DataPtr), (StdHeader)) |
| 417 | |
| 418 | #define IDS_OPTION_CALLOUT(CallOutId, DataPtr, StdHeader) \ |
| 419 | IdsOptionCallout ((CallOutId), (DataPtr), (StdHeader)) |
| 420 | #if IDSOPT_CONTROL_NV_TO_CMOS == TRUE |
| 421 | #undef IDS_AP_GET_NV_FROM_CMOS |
| 422 | #define IDS_AP_GET_NV_FROM_CMOS(x) AmdIdsApGetNvFromCmos(x) |
| 423 | #ifdef IDS_OPT_CMOS_INDEX_PORT |
| 424 | #undef IDS_CMOS_INDEX_PORT |
| 425 | #define IDS_CMOS_INDEX_PORT IDS_OPT_CMOS_INDEX_PORT |
| 426 | #endif |
| 427 | |
| 428 | #ifdef IDS_OPT_CMOS_DATA_PORT |
| 429 | #undef IDS_CMOS_DATA_PORT |
| 430 | #define IDS_CMOS_DATA_PORT IDS_OPT_CMOS_DATA_PORT |
| 431 | #endif |
| 432 | |
| 433 | #ifdef IDS_OPT_CMOS_REGION_START |
| 434 | #undef IDS_CMOS_REGION_START |
| 435 | #define IDS_CMOS_REGION_START IDS_OPT_CMOS_REGION_START |
| 436 | #endif |
| 437 | |
| 438 | #ifdef IDS_OPT_CMOS_REGION_END |
| 439 | #undef IDS_CMOS_REGION_END |
| 440 | #define IDS_CMOS_REGION_END IDS_OPT_CMOS_REGION_END |
| 441 | #endif |
| 442 | #endif |
| 443 | #else |
| 444 | #define IDS_OPTION_HOOK(IdsOption, DataPtr, StdHeader) |
| 445 | |
| 446 | #define IDS_OPTION_CALLOUT(CallOutId, DataPtr, StdHeader) //AGESA_SUCCESS |
| 447 | #endif |
| 448 | |
| 449 | /** |
| 450 | * Macro to add a *skip* hook for IDS options |
| 451 | * |
| 452 | * The default minimal action is to do nothing and there is no any code to increase. |
| 453 | * For debug environments, IDS dispatcher function will be called to perform |
| 454 | * the detailed action and to skip AGESA code if necessary. |
| 455 | * |
| 456 | * @param[in] IdsOption IDS Option ID for this hook point |
| 457 | * @param[in, out] DataPtr Data Pointer to override |
| 458 | * @param[in, out] StdHeader Pointer of AMD_CONFIG_PARAMS |
| 459 | * |
| 460 | * |
| 461 | **/ |
| 462 | |
| 463 | #if IDSOPT_CONTROL_ENABLED == TRUE |
| 464 | #define IDS_SKIP_HOOK(IdsOption, DataPtr, StdHeader) \ |
| 465 | if (AmdIdsCtrlDispatcher (IdsOption, DataPtr, StdHeader) == IDS_SUCCESS) |
| 466 | #else |
| 467 | #define IDS_SKIP_HOOK(IdsOption, DataPtr, StdHeader) |
| 468 | #endif |
| 469 | |
| 470 | /** |
| 471 | * Macro to add a heap manager routine |
| 472 | * |
| 473 | * when memory is allocated the heap manager actually allocates two extra dwords of data, |
| 474 | * one dword buffer before the actual memory, and one dword afterwards. |
| 475 | * a complete heap walk and check to be performed at any time. |
| 476 | * it would ASSERT if the heap is corrupt |
| 477 | * |
| 478 | * @param[in] StdHeader Pointer of AMD_CONFIG_PARAMS |
| 479 | * |
| 480 | * |
| 481 | **/ |
| 482 | |
| 483 | // Heap debug feature |
| 484 | #define SENTINEL_BEFORE_VALUE 0x64616548ul // "Head" |
| 485 | #define SENTINEL_AFTER_VALUE 0x6C696154ul // "Tail" |
| 486 | #if IDSOPT_IDS_ENABLED == TRUE |
| 487 | #if IDSOPT_HEAP_CHECKING == TRUE |
| 488 | #define SIZE_OF_SENTINEL 4 |
| 489 | #define NUM_OF_SENTINEL 2 // Before ("Head") and After ("Tail") |
| 490 | #define SET_SENTINEL_BEFORE(NodePtr, AlignTo16Byte) (*(UINT32 *) ((UINT8 *) NodePtr + sizeof (BUFFER_NODE) + AlignTo16Byte) = SENTINEL_BEFORE_VALUE); |
| 491 | #define SET_SENTINEL_AFTER(NodePtr) (*(UINT32 *) ((UINT8 *) NodePtr + sizeof (BUFFER_NODE) + NodePtr->BufferSize - SIZE_OF_SENTINEL) = SENTINEL_AFTER_VALUE); |
| 492 | #define Heap_Check(stdheader) AmdHeapIntactCheck(stdheader) |
| 493 | #else |
| 494 | #define SIZE_OF_SENTINEL 0 |
| 495 | #define NUM_OF_SENTINEL 0 |
| 496 | #define SET_SENTINEL_BEFORE(NodePtr, AlignTo16Byte) |
| 497 | #define SET_SENTINEL_AFTER(NodePtr) |
| 498 | #define Heap_Check(stdheader) |
| 499 | #endif |
| 500 | #else |
| 501 | #define SIZE_OF_SENTINEL 0 |
| 502 | #define NUM_OF_SENTINEL 0 |
| 503 | #define SET_SENTINEL_BEFORE(NodePtr, AlignTo16Byte) |
| 504 | #define SET_SENTINEL_AFTER(NodePtr) |
| 505 | #define Heap_Check(stdheader) |
| 506 | #endif |
| 507 | |
| 508 | /** |
| 509 | * Macro to add IDT for debugging exception. |
| 510 | * |
| 511 | * A debug feature. Adding a 'jmp $' into every exception handler. |
| 512 | * So debugger could use HDT to skip 'jmp $' and execute the iret, |
| 513 | * then they could find which instruction cause the exception. |
| 514 | * |
| 515 | * @param[in] FunctionId IDS Function ID for this hook point |
| 516 | * @param[in, out] DataPtr Data Pointer to override |
| 517 | * @param[in, out] StdHeader Pointer of AMD_CONFIG_PARAMS |
| 518 | * |
| 519 | * |
| 520 | **/ |
| 521 | #if IDSOPT_IDS_ENABLED == TRUE |
| 522 | #if IDSOPT_IDT_EXCEPTION_TRAP == TRUE |
| 523 | #define IDS_EXCEPTION_TRAP(FunctionId, DataPtr, StdHeader) IdsExceptionTrap (FunctionId, DataPtr, StdHeader) |
| 524 | #else |
| 525 | #define IDS_EXCEPTION_TRAP(FunctionId, DataPtr, StdHeader) |
| 526 | #endif |
| 527 | #else |
| 528 | #define IDS_EXCEPTION_TRAP(FunctionId, DataPtr, StdHeader) |
| 529 | #endif |
| 530 | |
| 531 | |
| 532 | //Note a is from 0 to 63 |
| 533 | #define DEBUG_PRINT_SHIFT(a) ((UINT64)1 << a) |
| 534 | //If you change the Bitmap definition below, please change the Hash in ParseFilter of hdtout2008.pl accordingly |
| 535 | //Memory Masks |
| 536 | #define MEM_SETREG DEBUG_PRINT_SHIFT (0) |
| 537 | #define MEM_GETREG DEBUG_PRINT_SHIFT (1) |
| 538 | #define MEM_FLOW DEBUG_PRINT_SHIFT (2) |
| 539 | #define MEM_STATUS DEBUG_PRINT_SHIFT (3) |
| 540 | #define MEM_UNDEF_BF DEBUG_PRINT_SHIFT (4) |
| 541 | #define MEMORY_TRACE_RSV2 DEBUG_PRINT_SHIFT (5) |
| 542 | #define MEMORY_TRACE_RSV3 DEBUG_PRINT_SHIFT (6) |
| 543 | #define MEMORY_TRACE_RSV4 DEBUG_PRINT_SHIFT (7) |
| 544 | #define MEMORY_TRACE_RSV5 DEBUG_PRINT_SHIFT (8) |
| 545 | #define MEMORY_TRACE_RSV6 DEBUG_PRINT_SHIFT (9) |
| 546 | |
| 547 | |
| 548 | |
| 549 | //CPU Masks |
| 550 | #define CPU_TRACE DEBUG_PRINT_SHIFT (10) |
| 551 | #define CPU_TRACE_RSV1 DEBUG_PRINT_SHIFT (11) |
| 552 | #define CPU_TRACE_RSV2 DEBUG_PRINT_SHIFT (12) |
| 553 | #define CPU_TRACE_RSV3 DEBUG_PRINT_SHIFT (13) |
| 554 | #define CPU_TRACE_RSV4 DEBUG_PRINT_SHIFT (14) |
| 555 | #define CPU_TRACE_RSV5 DEBUG_PRINT_SHIFT (15) |
| 556 | #define CPU_TRACE_RSV6 DEBUG_PRINT_SHIFT (16) |
| 557 | #define CPU_TRACE_RSV7 DEBUG_PRINT_SHIFT (17) |
| 558 | #define CPU_TRACE_RSV8 DEBUG_PRINT_SHIFT (18) |
| 559 | #define CPU_TRACE_RSV9 DEBUG_PRINT_SHIFT (19) |
| 560 | |
| 561 | //GNB Masks |
| 562 | #define GNB_TRACE DEBUG_PRINT_SHIFT (20) |
| 563 | #define PCIE_MISC DEBUG_PRINT_SHIFT (21) |
| 564 | #define PCIE_PORTREG_TRACE DEBUG_PRINT_SHIFT (22) |
| 565 | #define PCIE_HOSTREG_TRACE DEBUG_PRINT_SHIFT (23) |
| 566 | #define GNB_TRACE_RSV2 DEBUG_PRINT_SHIFT (24) |
| 567 | #define NB_MISC DEBUG_PRINT_SHIFT (25) |
| 568 | #define GNB_TRACE_RSV3 DEBUG_PRINT_SHIFT (26) |
| 569 | #define GFX_MISC DEBUG_PRINT_SHIFT (27) |
| 570 | #define NB_SMUREG_TRACE DEBUG_PRINT_SHIFT (28) |
| 571 | #define GNB_TRACE_RSV1 DEBUG_PRINT_SHIFT (29) |
| 572 | |
| 573 | //HT Masks |
| 574 | #define HT_TRACE DEBUG_PRINT_SHIFT (30) |
| 575 | #define HT_TRACE_RSV1 DEBUG_PRINT_SHIFT (31) |
| 576 | #define HT_TRACE_RSV2 DEBUG_PRINT_SHIFT (32) |
| 577 | #define HT_TRACE_RSV3 DEBUG_PRINT_SHIFT (33) |
| 578 | #define HT_TRACE_RSV4 DEBUG_PRINT_SHIFT (34) |
| 579 | #define HT_TRACE_RSV5 DEBUG_PRINT_SHIFT (35) |
| 580 | #define HT_TRACE_RSV6 DEBUG_PRINT_SHIFT (36) |
| 581 | #define HT_TRACE_RSV7 DEBUG_PRINT_SHIFT (37) |
| 582 | #define HT_TRACE_RSV8 DEBUG_PRINT_SHIFT (38) |
| 583 | #define HT_TRACE_RSV9 DEBUG_PRINT_SHIFT (39) |
| 584 | |
| 585 | //FCH Masks |
| 586 | #define FCH_TRACE DEBUG_PRINT_SHIFT (40) |
| 587 | #define FCH_TRACE_RSV1 DEBUG_PRINT_SHIFT (41) |
| 588 | #define FCH_TRACE_RSV2 DEBUG_PRINT_SHIFT (42) |
| 589 | #define FCH_TRACE_RSV3 DEBUG_PRINT_SHIFT (43) |
| 590 | #define FCH_TRACE_RSV4 DEBUG_PRINT_SHIFT (44) |
| 591 | #define FCH_TRACE_RSV5 DEBUG_PRINT_SHIFT (45) |
| 592 | #define FCH_TRACE_RSV6 DEBUG_PRINT_SHIFT (46) |
| 593 | #define FCH_TRACE_RSV7 DEBUG_PRINT_SHIFT (47) |
| 594 | #define FCH_TRACE_RSV8 DEBUG_PRINT_SHIFT (48) |
| 595 | #define FCH_TRACE_RSV9 DEBUG_PRINT_SHIFT (49) |
| 596 | |
| 597 | //Other Masks |
| 598 | #define MAIN_FLOW DEBUG_PRINT_SHIFT (50) |
| 599 | #define EVENT_LOG DEBUG_PRINT_SHIFT (51) |
| 600 | #define PERFORMANCE_ANALYSE DEBUG_PRINT_SHIFT (52) |
| 601 | |
| 602 | //Ids Masks |
| 603 | #define IDS_TRACE DEBUG_PRINT_SHIFT (53) |
| 604 | #define BVM_TRACE DEBUG_PRINT_SHIFT (54) |
| 605 | #define IDS_TRACE_RSV2 DEBUG_PRINT_SHIFT (55) |
| 606 | #define IDS_TRACE_RSV3 DEBUG_PRINT_SHIFT (56) |
| 607 | |
| 608 | //S3 |
| 609 | #define S3_TRACE DEBUG_PRINT_SHIFT (57) |
| 610 | |
| 611 | //Library function to read/write PCI/MSR registers |
| 612 | #define LIB_PCI_RD DEBUG_PRINT_SHIFT (58) |
| 613 | #define LIB_PCI_WR DEBUG_PRINT_SHIFT (59) |
| 614 | |
| 615 | //Reserved |
| 616 | #define TRACE_RSV3 DEBUG_PRINT_SHIFT (60) |
| 617 | #define TRACE_RSV4 DEBUG_PRINT_SHIFT (61) |
| 618 | #define TRACE_RSV5 DEBUG_PRINT_SHIFT (62) |
| 619 | #define TRACE_RSV6 DEBUG_PRINT_SHIFT (63) |
| 620 | |
| 621 | #define GNB_TRACE_DEFAULT\ |
| 622 | (\ |
| 623 | GNB_TRACE | PCIE_MISC | NB_MISC | GFX_MISC \ |
| 624 | ) |
| 625 | |
| 626 | #define GNB_TRACE_REG\ |
| 627 | (\ |
| 628 | PCIE_PORTREG_TRACE | PCIE_HOSTREG_TRACE | \ |
| 629 | NB_SMUREG_TRACE | GNB_TRACE_RSV1 \ |
| 630 | ) |
| 631 | |
| 632 | #define GNB_TRACE_ALL\ |
| 633 | (\ |
| 634 | GNB_TRACE_DEFAULT | GNB_TRACE_REG \ |
| 635 | ) |
| 636 | |
| 637 | #define CPU_TRACE_ALL\ |
| 638 | (\ |
| 639 | CPU_TRACE | CPU_TRACE_RSV1 | CPU_TRACE_RSV2 | CPU_TRACE_RSV3 | \ |
| 640 | CPU_TRACE_RSV4 | CPU_TRACE_RSV5 | CPU_TRACE_RSV6 | CPU_TRACE_RSV7 | \ |
| 641 | CPU_TRACE_RSV8 | CPU_TRACE_RSV9\ |
| 642 | ) |
| 643 | |
| 644 | #define MEMORY_TRACE_ALL\ |
| 645 | (\ |
| 646 | MEM_FLOW | MEM_GETREG | MEM_SETREG | MEM_STATUS | \ |
| 647 | MEMORY_TRACE_RSV1 | MEMORY_TRACE_RSV2 | MEMORY_TRACE_RSV3 | MEMORY_TRACE_RSV4 | \ |
| 648 | MEMORY_TRACE_RSV5 | MEMORY_TRACE_RSV6\ |
| 649 | ) |
| 650 | |
| 651 | #define HT_TRACE_ALL\ |
| 652 | (\ |
| 653 | HT_TRACE | HT_TRACE_RSV1 | HT_TRACE_RSV2 | HT_TRACE_RSV3 | \ |
| 654 | HT_TRACE_RSV4 | HT_TRACE_RSV5 | HT_TRACE_RSV6 | HT_TRACE_RSV7 | \ |
| 655 | HT_TRACE_RSV8 | HT_TRACE_RSV9\ |
| 656 | ) |
| 657 | |
| 658 | #define FCH_TRACE_ALL\ |
| 659 | (\ |
| 660 | FCH_TRACE | FCH_TRACE_RSV1 | FCH_TRACE_RSV2 | FCH_TRACE_RSV3 | \ |
| 661 | FCH_TRACE_RSV4 | FCH_TRACE_RSV5 | FCH_TRACE_RSV6 | FCH_TRACE_RSV7 | \ |
| 662 | FCH_TRACE_RSV8 | FCH_TRACE_RSV9\ |
| 663 | ) |
| 664 | |
| 665 | #define IDS_TRACE_ALL\ |
| 666 | (\ |
| 667 | IDS_TRACE | BVM_TRACE | IDS_TRACE_RSV2 | IDS_TRACE_RSV3\ |
| 668 | ) |
| 669 | |
| 670 | #define OTHER_TRACE_ALL\ |
| 671 | (\ |
| 672 | MAIN_FLOW | EVENT_LOG | PERFORMANCE_ANALYSE\ |
| 673 | ) |
| 674 | |
| 675 | |
| 676 | #define TRACE_MASK_ALL (0xFFFFFFFFFFFFFFFFull) |
| 677 | #ifndef IDS_DEBUG_PRINT_MASK |
| 678 | #define IDS_DEBUG_PRINT_MASK (GNB_TRACE_DEFAULT | CPU_TRACE_ALL | MEM_FLOW | MEM_STATUS | HT_TRACE_ALL | FCH_TRACE_ALL | MAIN_FLOW | IDS_TRACE_DEFAULT) |
| 679 | #endif |
| 680 | |
| 681 | /// if no specific define INIT & EXIT will be NULL |
| 682 | #define IDS_HDT_CONSOLE_INIT(x) |
| 683 | #define IDS_HDT_CONSOLE_EXIT(x) |
| 684 | |
| 685 | /// AGESA tracing service |
| 686 | #if IDSOPT_TRACING_ENABLED == TRUE |
| 687 | #ifdef IDSOPT_CUSTOMIZE_TRACING_SERVICE |
| 688 | #define IDS_HDT_CONSOLE IDSOPT_CUSTOMIZE_TRACING_SERVICE |
| 689 | #ifdef IDSOPT_CUSTOMIZE_TRACING_SERVICE_INIT |
| 690 | #undef IDS_HDT_CONSOLE_INIT |
| 691 | #define IDS_HDT_CONSOLE_INIT(x) IDSOPT_CUSTOMIZE_TRACING_SERVICE_INIT (x) |
| 692 | #endif |
| 693 | #ifdef IDSOPT_CUSTOMIZE_TRACING_SERVICE_EXIT |
| 694 | #undef IDS_HDT_CONSOLE_EXIT |
| 695 | #define IDS_HDT_CONSOLE_EXIT(x) IDSOPT_CUSTOMIZE_TRACING_SERVICE_EXIT (x) |
| 696 | #endif |
| 697 | #else |
Kyösti Mälkki | 86ee4db | 2016-06-22 22:50:10 +0300 | [diff] [blame] | 698 | #ifndef __GNUC__ |
| 699 | #pragma warning(disable: 4127) |
| 700 | #define IDS_HDT_CONSOLE(f, s, ...) |
zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 701 | #else |
Kyösti Mälkki | 86ee4db | 2016-06-22 22:50:10 +0300 | [diff] [blame] | 702 | #define IDS_HDT_CONSOLE(f, s, ...) printk (BIOS_DEBUG, s, ##__VA_ARGS__); |
zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 703 | #endif |
| 704 | #define CONSOLE AmdIdsDebugPrintAll |
| 705 | #endif |
| 706 | #define IDS_HDT_CONSOLE_DEBUG_CODE(Code) Code |
| 707 | #define IDS_TIMEOUT_CTL(t) IdsMemTimeOut (t) |
| 708 | #else |
| 709 | #define IDS_HDT_CONSOLE 1 ? (VOID) 0 : AmdIdsDebugPrint |
| 710 | #define IDS_HDT_CONSOLE_DEBUG_CODE(Code) |
| 711 | #define CONSOLE CONSOLE_Needs_To_Be_Removed_For_Production_Build //"WARNING: CONSOLE needs to be removed for production builds." |
| 712 | #define IDS_TIMEOUT_CTL(t) |
| 713 | #endif |
| 714 | |
| 715 | /// Macros for serial port tracing |
| 716 | #ifdef IDSOPT_SERIAL_PORT |
| 717 | #define IDS_SERIAL_PORT IDSOPT_SERIAL_PORT |
| 718 | #endif |
| 719 | |
| 720 | #ifndef IDS_SERIAL_PORT |
| 721 | #define IDS_SERIAL_PORT 0x3F8 |
| 722 | #endif |
| 723 | |
| 724 | // Macros for redirect IO tracing |
| 725 | #ifdef IDSOPT_DEBUG_PRINT_IO_PORT |
| 726 | #define IDS_DEBUG_PRINT_IO_PORT IDSOPT_DEBUG_PRINT_IO_PORT |
| 727 | #endif |
| 728 | |
| 729 | #ifndef IDS_DEBUG_PRINT_IO_PORT |
| 730 | #define IDS_DEBUG_PRINT_IO_PORT 0x80 |
| 731 | #endif |
| 732 | |
| 733 | /** |
| 734 | * Macros to add HDT OUT |
| 735 | * |
| 736 | * The default minimal action is to do nothing and there is no any code to increase. |
| 737 | * For debug environments, the debug information can be displayed in HDT or other |
| 738 | * devices. |
| 739 | * |
| 740 | **/ |
| 741 | #if IDSOPT_TRACING_CONSOLE_HDTOUT == TRUE |
| 742 | #undef IDS_HDT_CONSOLE_INIT |
| 743 | #undef IDS_HDT_CONSOLE_EXIT |
| 744 | #define IDS_HDT_CONSOLE_INIT(x) AmdIdsHdtOutInit (x) |
| 745 | #define IDS_HDT_CONSOLE_EXIT(x) AmdIdsHdtOutExit (x) |
| 746 | #define IDS_HDT_CONSOLE_S3_EXIT(x) AmdIdsHdtOutS3Exit (x) |
| 747 | #define IDS_HDT_CONSOLE_S3_AP_EXIT(x) AmdIdsHdtOutS3ApExit (x) |
| 748 | |
| 749 | #define IDS_HDT_CONSOLE_FLUSH_BUFFER(x) AmdIdsHdtOutBufferFlush (x) |
| 750 | #define IDS_HDT_CONSOLE_ASSERT(x) AmdIdsDebugPrintAssert (x) |
| 751 | #define IDS_FUNCLIST_ADDR ScriptFuncList |
| 752 | #define IDS_FUNCLIST_EXTERN() extern SCRIPT_FUNCTION ScriptFuncList[] |
| 753 | #else |
| 754 | #define IDS_HDT_CONSOLE_S3_EXIT(x) |
| 755 | #define IDS_HDT_CONSOLE_S3_AP_EXIT(x) |
| 756 | #define IDS_HDT_CONSOLE_FLUSH_BUFFER(x) |
| 757 | #define IDS_HDT_CONSOLE_ASSERT(x) |
| 758 | #define IDS_FUNCLIST_ADDR NULL |
| 759 | #define IDS_FUNCLIST_EXTERN() |
| 760 | #endif |
| 761 | |
| 762 | #define IDS_TRACE_SHOW_BLD_OPT_CFG IDSOPT_TRACE_USER_OPTIONS |
| 763 | |
| 764 | #if IDSOPT_PERF_ANALYSIS == TRUE |
| 765 | #ifdef STOP_CODE |
| 766 | #undef STOP_CODE |
| 767 | #endif |
| 768 | #define STOP_CODE (((UINT32)FILECODE)*0x10000ul + \ |
| 769 | ((__LINE__) % 10) + (((__LINE__ / 10) % 10)*0x10) + \ |
| 770 | (((__LINE__ / 100) % 10)*0x100) + (((__LINE__ / 1000) % 10)*0x1000)) |
| 771 | |
| 772 | #define IDS_PERF_TIMESTAMP(StdHeader) IdsPerfTimestamp (STOP_CODE, (StdHeader)) |
| 773 | #define IDS_PERF_ANALYSE(StdHeader) IdsPerfAnalyseTimestamp (StdHeader) |
| 774 | #else |
| 775 | #define IDS_PERF_TIMESTAMP(StdHeader) |
| 776 | #define IDS_PERF_ANALYSE(StdHeader) |
| 777 | #endif |
| 778 | |
| 779 | ///For IDS feat use |
| 780 | #define IDS_FAMILY_ALL 0xFFFFFFFFFFFFFFFFull |
| 781 | #define IDS_BSP_ONLY TRUE |
| 782 | #define IDS_ALL_CORES FALSE |
| 783 | |
| 784 | #define IDS_LATE_RUN_AP_TASK_ID PROC_IDS_LIBRARY_IDSLIB_FILECODE |
| 785 | |
| 786 | #define IDS_CALLOUT_INIT 0x01 ///< The function data of IDS callout function of initialization. |
| 787 | |
| 788 | #define IDS_CALLOUT_GNB_PPFUSE_OVERRIDE 0x83 ///< The function data of IDS callout function of GNB pp fuse table. |
| 789 | #define IDS_CALLOUT_GNB_INTEGRATED_TABLE_CONFIG 0x84 ///< The function data of IDS callout function of GNB integrated table. |
| 790 | #define IDS_CALLOUT_GNB_NB_POWERGATE_CONFIG 0x85 ///< The function data of IDS callout function of GNB NB power gate config. |
| 791 | #define IDS_CALLOUT_GNB_PCIE_POWERGATE_CONFIG 0x86 ///< The function data of IDS callout function of GNB PCIE power gateconfig. |
| 792 | #define IDS_CALLOUT_GNB_PCIE_PLATFORM_CONFIG 0x87 ///< The function data of IDS callout function of GNB pcie platform config. |
| 793 | #define IDS_CALLOUT_GNB_PCIE_PHY_CONFIG 0x88 ///< The function data of IDS callout function of GNB pcie PHY config. |
| 794 | #define IDS_CALLOUT_GNB_GMM_REGISTER_OVERRIDE 0x89 ///< The function data of IDS callout function of GNB GMM register override |
| 795 | #define IDS_CALLOUT_MTC1E_PLATFORM_CONFIG 0x8A ///< The function data of IDS callout function of Message Triggered C1e platform config. |
| 796 | #define IDS_CALLOUT_FCH_INIT_RESET 0x8B ///< The function data of IDS callout function of FchInitReset |
| 797 | #define IDS_CALLOUT_FCH_INIT_ENV 0x8C ///< The function data of IDS callout function of FchInitEnv. |
| 798 | #define IDS_CALLOUT_POWER_PLAN_INIT 0x8D ///< The function data of IDS callout function of Override Power Plan Init |
| 799 | /// Function entry for HDT script to call |
| 800 | typedef struct _SCRIPT_FUNCTION { |
Stefan Reinauer | d91ddc8 | 2015-07-30 11:17:40 -0700 | [diff] [blame] | 801 | UINTN FuncAddr; ///< Function address in ROM |
zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 802 | CHAR8 FuncName[40]; ///< Function name |
| 803 | } SCRIPT_FUNCTION; |
| 804 | |
| 805 | /// Data Structure for Mem ECC parameter override |
| 806 | typedef struct { |
| 807 | IN BOOLEAN CfgEccRedirection; ///< ECC Redirection |
| 808 | IN UINT16 CfgScrubDramRate; ///< Scrub Dram Rate |
| 809 | IN UINT16 CfgScrubL2Rate; ///< Scrub L2Rate |
| 810 | IN UINT16 CfgScrubL3Rate; ///< Scrub L3Rate |
| 811 | IN UINT16 CfgScrubIcRate; ///< Scrub Ic Rate |
| 812 | IN UINT16 CfgScrubDcRate; ///< Scrub Dc Rate |
| 813 | IN BOOLEAN CfgEccSyncFlood; ///< ECC Sync Flood |
| 814 | } ECC_OVERRIDE_STRUCT; |
| 815 | |
| 816 | |
| 817 | |
| 818 | |
| 819 | /** |
| 820 | * AGESA Test Points |
| 821 | * |
| 822 | * These are the values displayed to the user to indicate progress through boot. |
| 823 | * These can be used in a debug environment to stop the debugger at a specific |
| 824 | * test point: |
| 825 | * For SimNow!, this command |
| 826 | * bi 81 w vb 49 |
| 827 | * will stop the debugger on one of the TracePoints (49 is the TP value in this example). |
| 828 | * |
| 829 | */ |
| 830 | typedef enum { |
| 831 | StartProcessorTestPoints, ///< 00 Entry used for range testing for @b Processor related TPs |
| 832 | |
| 833 | // Memory test points |
| 834 | TpProcMemBeforeMemDataInit, ///< 01 .. Memory structure initialization (Public interface) |
| 835 | TpProcMemBeforeSpdProcessing, ///< 02 .. SPD Data processing (Public interface) |
| 836 | TpProcMemAmdMemAuto, ///< 03 .. Memory configuration (Public interface) |
| 837 | TpProcMemDramInit, ///< 04 .. DRAM initialization |
| 838 | TpProcMemSPDChecking, ///< 05 .. |
| 839 | TpProcMemModeChecking, ///< 06 .. |
| 840 | TpProcMemSpeedTclConfig, ///< 07 .. Speed and TCL configuration |
| 841 | TpProcMemSpdTiming, ///< 08 .. |
| 842 | TpProcMemDramMapping, ///< 09 .. |
| 843 | TpProcMemPlatformSpecificConfig, ///< 0A .. |
| 844 | TPProcMemPhyCompensation, ///< 0B .. |
| 845 | TpProcMemStartDcts, ///< 0C .. |
| 846 | TpProcMemBeforeDramInit, ///< 0D .. (Public interface) |
| 847 | TpProcMemPhyFenceTraining, ///< 0E .. |
| 848 | TpProcMemSynchronizeDcts, ///< 0F .. |
| 849 | TpProcMemSystemMemoryMapping, ///< 10 .. |
| 850 | TpProcMemMtrrConfiguration, ///< 11 .. |
| 851 | TpProcMemDramTraining, ///< 12 .. |
| 852 | TpProcMemBeforeAnyTraining, ///< 13 .. (Public interface) |
| 853 | TpProcMemWriteLevelizationTraining, ///< 14 .. |
| 854 | TpProcMemWlFirstPass, ///< 15 .. Below 800Mhz first pass start |
| 855 | TpProcMemWlSecondPass, ///< 16 .. Above 800Mhz second pass start |
| 856 | TpProcMemWlTrainTargetDimm, ///< 17 .. Target DIMM configured |
| 857 | TpProcMemWlPrepDimms, ///< 18 .. Prepare DIMMS for WL |
| 858 | TpProcMemWlConfigDimms, ///< 19 .. Configure DIMMS for WL |
| 859 | TpProcMemReceiverEnableTraining, ///< 1A .. |
| 860 | TpProcMemRcvrStartSweep, ///< 1B .. Start sweep loop |
| 861 | TpProcMemRcvrSetDelay, ///< 1C .. Set receiver Delay |
| 862 | TpProcMemRcvrWritePattern, ///< 1D .. Write test pattern |
| 863 | TpProcMemRcvrReadPattern, ///< 1E .. Read test pattern |
| 864 | TpProcMemRcvrTestPattern, ///< 1F .. Compare test pattern |
| 865 | TpProcMemRcvrCalcLatency, ///< 20 .. Calculate MaxRdLatency per channel |
| 866 | TpProcMemReceiveDqsTraining, ///< 21 .. |
| 867 | TpProcMemRcvDqsSetDelay, ///< 22 .. Set Write Data delay |
| 868 | TpProcMemRcvDqsWritePattern, ///< 23 .. Write test pattern |
| 869 | TpProcMemRcvDqsStartSweep, ///< 24 .. Start read sweep |
| 870 | TpProcMemRcvDqsSetRcvDelay, ///< 25 .. Set Receive DQS delay |
| 871 | TpProcMemRcvDqsReadPattern, ///< 26 .. Read Test pattern |
| 872 | TpProcMemRcvDqsTstPattern, ///< 27 .. Compare Test pattern |
| 873 | TpProcMemRcvDqsResults, ///< 28 .. Update results |
| 874 | TpProcMemRcvDqsFindWindow, ///< 29 .. Start Find passing window |
| 875 | TpProcMemTransmitDqsTraining, ///< 2A .. |
| 876 | TpProcMemTxDqStartSweep, ///< 2B .. Start write sweep |
| 877 | TpProcMemTxDqSetDelay, ///< 2C .. Set Transmit DQ delay |
| 878 | TpProcMemTxDqWritePattern, ///< 2D .. Write test pattern |
| 879 | TpProcMemTxDqReadPattern, ///< 2E .. Read Test pattern |
| 880 | TpProcMemTxDqTestPattern, ///< 2F .. Compare Test pattern |
| 881 | TpProcMemTxDqResults, ///< 30 .. Update results |
| 882 | TpProcMemTxDqFindWindow, ///< 31 .. Start Find passing window |
| 883 | TpProcMemMaxRdLatencyTraining, ///< 32 .. |
| 884 | TpProcMemMaxRdLatStartSweep, ///< 33 .. Start sweep |
| 885 | TpProcMemMaxRdLatSetDelay, ///< 34 .. Set delay |
| 886 | TpProcMemMaxRdLatWritePattern, ///< 35 .. Write test pattern |
| 887 | TpProcMemMaxRdLatReadPattern, ///< 36 .. Read Test pattern |
| 888 | TpProcMemMaxRdLatTestPattern, ///< 37 .. Compare Test pattern |
| 889 | TpProcMemOnlineSpareInit, ///< 38 .. Online Spare init |
| 890 | TpProcMemBankInterleaveInit, ///< 39 .. Bank Interleave Init |
| 891 | TpProcMemNodeInterleaveInit, ///< 3A .. Node Interleave Init |
| 892 | TpProcMemChannelInterleaveInit, ///< 3B .. Channel Interleave Init |
| 893 | TpProcMemEccInitialization, ///< 3C .. ECC initialization |
| 894 | TpProcMemPlatformSpecificInit, ///< 3D .. Platform Specific Init |
| 895 | TpProcMemBeforeAgesaReadSpd, ///< 3E .. Before callout for "AgesaReadSpd" |
| 896 | TpProcMemAfterAgesaReadSpd, ///< 3F .. After callout for "AgesaReadSpd" |
| 897 | TpProcMemBeforeAgesaHookBeforeDramInit, ///< 40 .. Before optional callout "AgesaHookBeforeDramInit" |
| 898 | TpProcMemAfterAgesaHookBeforeDramInit, ///< 41 .. After optional callout "AgesaHookBeforeDramInit" |
| 899 | TpProcMemBeforeAgesaHookBeforeDQSTraining, ///< 42 .. Before optional callout "AgesaHookBeforeDQSTraining" |
| 900 | TpProcMemAfterAgesaHookBeforeDQSTraining, ///< 43 .. After optional callout "AgesaHookBeforeDQSTraining" |
| 901 | TpProcMemBeforeAgesaHookBeforeExitSelfRef, ///< 44 .. Before optional callout "AgesaHookBeforeDramInit" |
| 902 | TpProcMemAfterAgesaHookBeforeExitSelfRef, ///< 45 .. After optional callout "AgesaHookBeforeDramInit" |
| 903 | TpProcMemAfterMemDataInit, ///< 46 .. After MemDataInit |
| 904 | TpProcMemInitializeMCT, ///< 47 .. Before InitializeMCT |
| 905 | TpProcMemLvDdr3, ///< 48 .. Before LV DDR3 |
| 906 | TpProcMemInitMCT, ///< 49 .. Before InitMCT |
| 907 | TpProcMemOtherTiming, ///< 4A.. Before OtherTiming |
| 908 | TpProcMemUMAMemTyping, ///< 4B .. Before UMAMemTyping |
| 909 | TpProcMemSetDqsEccTmgs, ///< 4C .. Before SetDqsEccTmgs |
| 910 | TpProcMemMemClr, ///< 4D .. Before MemClr |
| 911 | TpProcMemOnDimmThermal, ///< 4E .. Before On DIMM Thermal |
| 912 | TpProcMemDmi, ///< 4F .. Before DMI |
| 913 | TpProcMemEnd, ///< 50 .. End of memory code |
| 914 | |
| 915 | // CPU test points |
| 916 | TpProcCpuEntryDmi, ///< 51 .. Entry point CreateDmiRecords |
| 917 | TpProcCpuEntryPstate, ///< 52 .. Entry point GenerateSsdt |
| 918 | TpProcCpuEntryPstateLeveling, ///< 53 .. Entry point PStateLeveling |
| 919 | TpProcCpuEntryPstateGather, ///< 54 .. Entry point PStateGatherData |
| 920 | TpProcCpuEntryWhea, ///< 55 .. Entry point CreateAcpiWhea |
| 921 | TpProcCpuEntrySrat, ///< 56 .. Entry point CreateAcpiSrat |
| 922 | TpProcCpuEntrySlit, ///< 57 .. Entry point CreateAcpiSlit |
| 923 | TpProcCpuProcessRegisterTables, ///< 58 .. Register table processing |
| 924 | TpProcCpuSetBrandID, ///< 59 .. Set brand ID |
| 925 | TpProcCpuLocalApicInit, ///< 5A .. Initialize local APIC |
| 926 | TpProcCpuLoadUcode, ///< 5B .. Load microcode patch |
| 927 | TpProcCpuBeforePMFeatureInit, ///< 5C .. BeforePM feature dispatch point |
| 928 | TpProcCpuPowerMgmtInit, ///< 5D .. Power Management table processing |
| 929 | TpProcCpuEarlyFeatureInit, ///< 5E .. Early feature dispatch point |
| 930 | TpProcCpuCoreLeveling, ///< 5F .. Core Leveling |
| 931 | TpProcCpuApMtrrSync, ///< 60 .. AP MTRR sync up |
| 932 | TpProcCpuPostFeatureInit, ///< 61 .. POST feature dispatch point |
| 933 | TpProcCpuFeatureLeveling, ///< 62 .. CPU Feature Leveling |
| 934 | TpProcCpuBeforeRelinquishAPsFeatureInit, ///< 63 .. Before Relinquishing control of APs feature dispatch point |
| 935 | TpProcCpuBeforeAllocateWheaBuffer, ///< 64 .. Before the WHEA init code calls out to allocate a buffer |
| 936 | TpProcCpuAfterAllocateWheaBuffer, ///< 65 .. After the WHEA init code calls out to allocate a buffer |
| 937 | TpProcCpuBeforeAllocateSratBuffer, ///< 66 .. Before the SRAT init code calls out to allocate a buffer |
| 938 | TpProcCpuAfterAllocateSratBuffer, ///< 67 .. After the SRAT init code calls out to allocate a buffer |
| 939 | TpProcCpuBeforeLocateSsdtBuffer, ///< 68 .. Before the P-state init code calls out to locate a buffer |
| 940 | TpProcCpuAfterLocateSsdtBuffer, ///< 69 .. After the P-state init code calls out to locate a buffer |
| 941 | TpProcCpuBeforeAllocateSsdtBuffer, ///< 6A .. Before the P-state init code calls out to allocate a buffer |
| 942 | TpProcCpuAfterAllocateSsdtBuffer, ///< 6B .. After the P-state init code calls out to allocate a buffer |
| 943 | Agtp6c , |
| 944 | Agtp6d , |
| 945 | |
| 946 | // HT test points |
| 947 | TpProcHtEntry = 0x71, ///< 71 .. Coherent Discovery begin (Public interface) |
| 948 | TpProcHtTopology, ///< 72 .. Topology match, routing, begin |
| 949 | TpProcHtManualNc, ///< 73 .. Manual Non-coherent Init begin |
| 950 | TpProcHtAutoNc, ///< 74 .. Automatic Non-coherent init begin |
| 951 | TpProcHtOptGather, ///< 75 .. Optimization: Gather begin |
| 952 | TpProcHtOptRegang, ///< 76 .. Optimization: Regang begin |
| 953 | TpProcHtOptLinks, ///< 77 .. Optimization: Link Begin |
| 954 | TpProcHtOptSubLinks, ///< 78 .. Optimization: Sublinks begin |
| 955 | TpProcHtOptFinish, ///< 79 .. Optimization: Set begin |
| 956 | TpProcHtTrafficDist, ///< 7A .. Traffic Distribution begin |
| 957 | TpProcHtTuning, ///< 7B .. Misc Tuning Begin |
| 958 | TpProcHtDone, ///< 7C .. HT Init complete |
| 959 | TpProcHtApMapEntry, ///< 7D .. AP HT: Init Maps begin |
| 960 | TpProcHtApMapDone, ///< 7E .. AP HT: Complete |
| 961 | |
| 962 | // Extended memory test point |
| 963 | TpProcMemSendMRS2 = 0x80, ///< 80 .. Sending MRS2 |
| 964 | TpProcMemSendMRS3, ///< 81 .. Sedding MRS3 |
| 965 | TpProcMemSendMRS1, ///< 82 .. Sending MRS1 |
| 966 | TpProcMemSendMRS0, ///< 83 .. Sending MRS0 |
| 967 | TpProcMemContinPatternGenRead, ///< 84 .. Continuous Pattern Read |
| 968 | TpProcMemContinPatternGenWrite, ///< 85 .. Continuous Pattern Write |
| 969 | Agtp86 , |
| 970 | Agtp87 , |
| 971 | TpProcMemAfter2dTrainExtVrefChange, ///< 88 .. Mem: After optional callout to platfrom BIOS to change External Vref during 2d Training |
| 972 | TpProcMemConfigureDCTForGeneral, ///< 89 .. Configure DCT For General use begin |
| 973 | TpProcMemProcConfigureDCTForTraining, ///< 8A .. Configure DCT For training begin |
| 974 | TpProcMemConfigureDCTNonExplicitSeq,///< 8B .. Configure DCT For Non-Explicit |
| 975 | TpProcMemSynchronizeChannels, ///< 8C .. Configure to Sync channels |
| 976 | TpProcMemC6StorageAllocation, ///< 8D .. Allocate C6 Storage |
| 977 | |
| 978 | StartNbTestPoints = 0x90, ///< 90 Entry used for range testing for @b NorthBridge related TPs |
| 979 | TpNbxxx, ///< 91 . |
| 980 | EndNbTestPoints, ///< 92 End of TP range for NB |
| 981 | |
| 982 | StartFchTestPoints = 0xB0, ///< B0 Entry used for range testing for @b FCH related TPs |
| 983 | TpFchInitResetDispatching, ///< B1 .. FCH InitReset dispatch point |
| 984 | TpFchGppBeforePortTraining, ///< B2 .. Before FCH GPP port training |
| 985 | TpFchGppGen1PortPolling, ///< B3 .. FCH GPP port polling with GEN1 speed |
| 986 | TpFchGppGen2PortPolling, ///< B4 .. FCH GPP port polling with GEN2 speed |
| 987 | TpFchGppAfterPortTraining, ///< B5 .. After FCH GPP port training |
| 988 | TpFchInitEnvDispatching, ///< B6 .. FCH InitEnv dispatch point |
| 989 | TpFchInitMidDispatching, ///< B7 .. FCH InitMid dispatch point |
| 990 | TpFchInitLateDispatching, ///< B8 .. FCH InitLate dispatch point |
| 991 | TpFchGppHotPlugging, ///< B9 .. FCH GPP hot plug event |
| 992 | TpFchGppHotUnplugging, ///< BA .. AFCH GPP hot unplug event |
| 993 | TpFchInitS3EarlyDispatching, ///< BB .. FCH InitS3Early dispatch point |
| 994 | TpFchInitS3LateDispatching, ///< BC .. FCH InitS3Late dispatch point |
| 995 | EndFchTestPoints, ///< BF End of TP range for FCH |
| 996 | |
| 997 | // Interface test points |
| 998 | TpIfAmdInitResetEntry = 0xC0, ///< C0 .. Entry to AmdInitReset |
| 999 | TpIfAmdInitResetExit, ///< C1 .. Exiting from AmdInitReset |
| 1000 | TpIfAmdInitRecoveryEntry, ///< C2 .. Entry to AmdInitRecovery |
| 1001 | TpIfAmdInitRecoveryExit, ///< C3 .. Exiting from AmdInitRecovery |
| 1002 | TpIfAmdInitEarlyEntry, ///< C4 .. Entry to AmdInitEarly |
| 1003 | TpIfAmdInitEarlyExit, ///< C5 .. Exiting from AmdInitEarly |
| 1004 | TpIfAmdInitPostEntry, ///< C6 .. Entry to AmdInitPost |
| 1005 | TpIfAmdInitPostExit, ///< C7 .. Exiting from AmdInitPost |
| 1006 | TpIfAmdInitEnvEntry, ///< C8 .. Entry to AmdInitEnv |
| 1007 | TpIfAmdInitEnvExit, ///< C9 .. Exiting from AmdInitEnv |
| 1008 | TpIfAmdInitMidEntry, ///< CA .. Entry to AmdInitMid |
| 1009 | TpIfAmdInitMidExit, ///< CB .. Exiting from AmdInitMid |
| 1010 | TpIfAmdInitLateEntry, ///< CC .. Entry to AmdInitLate |
| 1011 | TpIfAmdInitLateExit, ///< CD .. Exiting from AmdInitLate |
| 1012 | TpIfAmdS3SaveEntry, ///< CE .. Entry to AmdS3Save |
| 1013 | TpIfAmdS3SaveExit, ///< CF .. Exiting from AmdS3Save |
| 1014 | TpIfAmdInitResumeEntry, ///< D0 .. Entry to AmdInitResume |
| 1015 | TpIfAmdInitResumeExit, ///< D1 .. Exiting from AmdInitResume |
| 1016 | TpIfAmdS3LateRestoreEntry, ///< D2 .. Entry to AmdS3LateRestore |
| 1017 | TpIfAmdS3LateRestoreExit, ///< D3 .. Exiting from AmdS3LateRestore |
| 1018 | TpIfAmdLateRunApTaskEntry, ///< D4 .. Entry to AmdS3LateRestore |
| 1019 | TpIfAmdLateRunApTaskExit, ///< D5 .. Exiting from AmdS3LateRestore |
| 1020 | TpIfAmdReadEventLogEntry, ///< D6 .. Entry to AmdReadEventLog |
| 1021 | TpIfAmdReadEventLogExit, ///< D7 .. Exiting from AmdReadEventLog |
| 1022 | TpIfAmdGetApicIdEntry, ///< D8 .. Entry to AmdGetApicId |
| 1023 | TpIfAmdGetApicIdExit, ///< D9 .. Exiting from AmdGetApicId |
| 1024 | TpIfAmdGetPciAddressEntry, ///< DA .. Entry to AmdGetPciAddress |
| 1025 | TpIfAmdGetPciAddressExit, ///< DB .. Exiting from AmdGetPciAddress |
| 1026 | TpIfAmdIdentifyCoreEntry, ///< DC .. Entry to AmdIdentifyCore |
| 1027 | TpIfAmdIdentifyCoreExit, ///< DD .. Exiting from AmdIdentifyCore |
| 1028 | TpIfBeforeRunApFromIds, ///< DE .. After IDS calls out to run code on an AP |
| 1029 | TpIfAfterRunApFromIds, ///< DF .. After IDS calls out to run code on an AP |
| 1030 | TpIfBeforeGetIdsData, ///< E0 .. Before IDS calls out to get IDS data |
| 1031 | TpIfAfterGetIdsData, ///< E1 .. After IDS calls out to get IDS data |
| 1032 | TpIfBeforeAllocateHeapBuffer, ///< E2 .. Before the heap manager calls out to allocate a buffer |
| 1033 | TpIfAfterAllocateHeapBuffer, ///< E3 .. After the heap manager calls out to allocate a buffer |
| 1034 | TpIfBeforeDeallocateHeapBuffer, ///< E4 .. Before the heap manager calls out to deallocate a buffer |
| 1035 | TpIfAfterDeallocateHeapBuffer, ///< E5 .. After the heap manager calls out to deallocate a buffer |
| 1036 | TpIfBeforeLocateHeapBuffer, ///< E6 .. Before the heap manager calls out to locate a buffer |
| 1037 | TpIfAfterLocateHeapBuffer, ///< E7 .. After the heap manager calls out to locate a buffer |
| 1038 | TpIfBeforeRunApFromAllAps, ///< E8 .. Before the BSP calls out to run code on an AP |
| 1039 | TpIfAfterRunApFromAllAps, ///< E9 .. After the BSP calls out to run code on an AP |
| 1040 | TpIfBeforeRunApFromAllCore0s, ///< EA .. Before the BSP calls out to run code on an AP |
| 1041 | TpIfAfterRunApFromAllCore0s, ///< EB .. After the BSP calls out to run code on an AP |
| 1042 | TpIfBeforeAllocateS3SaveBuffer, ///< EC .. Before the S3 save code calls out to allocate a buffer |
| 1043 | TpIfAfterAllocateS3SaveBuffer, ///< ED .. After the S3 save code calls out to allocate a buffer |
| 1044 | TpIfBeforeAllocateMemoryS3SaveBuffer, ///< EE .. Before the memory S3 save code calls out to allocate a buffer |
| 1045 | TpIfAfterAllocateMemoryS3SaveBuffer, ///< EF .. After the memory S3 save code calls out to allocate a buffer |
| 1046 | TpIfBeforeLocateS3PciBuffer, ///< F0 .. Before the memory code calls out to locate a buffer |
| 1047 | TpIfAfterLocateS3PciBuffer, ///< F1 .. After the memory code calls out to locate a buffer |
| 1048 | TpIfBeforeLocateS3CPciBuffer, ///< F2 .. Before the memory code calls out to locate a buffer |
| 1049 | TpIfAfterLocateS3CPciBuffer, ///< F3 .. After the memory code calls out to locate a buffer |
| 1050 | TpIfBeforeLocateS3MsrBuffer, ///< F4 .. Before the memory code calls out to locate a buffer |
| 1051 | TpIfAfterLocateS3MsrBuffer, ///< F5 .. After the memory code calls out to locate a buffer |
| 1052 | TpIfBeforeLocateS3CMsrBuffer, ///< F6 .. Before the memory code calls out to locate a buffer |
| 1053 | TpIfAfterLocateS3CMsrBuffer, ///< F7 .. After the memory code calls out to locate a buffer |
| 1054 | TpPerfUnit, ///< F8 .. The Unit of performance measure. |
| 1055 | EndAgesaTps = 0xFF, ///< Last defined AGESA TP |
| 1056 | } AGESA_TP; |
| 1057 | |
| 1058 | ///Ids Feat description |
| 1059 | typedef enum { |
| 1060 | IDS_FEAT_UCODE_UPDATE = 0x0000, ///< Feat for Ucode Update |
| 1061 | IDS_FEAT_TARGET_PSTATE, ///< Feat for Target Pstate |
| 1062 | IDS_FEAT_POSTPSTATE, ///< Feat for Post Pstate |
| 1063 | IDS_FEAT_ECC_CTRL, ///< Feat for Ecc Control |
| 1064 | IDS_FEAT_ECC_SYMBOL_SIZE, ///< Feat for Ecc symbol size |
| 1065 | IDS_FEAT_DCT_ALLMEMCLK, ///< Feat for all memory clock |
| 1066 | IDS_FEAT_DCT_GANGMODE, ///< Feat for Dct gang mode |
| 1067 | IDS_FEAT_DCT_BURSTLENGTH, ///< Feat for dct burst length |
| 1068 | IDS_FEAT_DCT_POWERDOWN, ///< Feat for dct power down |
| 1069 | IDS_FEAT_DCT_DLLSHUTDOWN, ///< Feat for dct dll shut down |
| 1070 | IDS_FEAT_PROBE_FILTER, ///< Feat for probe filter |
| 1071 | IDS_FEAT_HDTOUT, ///< Feat for hdt out |
| 1072 | IDS_FEAT_HT_SETTING, ///< Feat for Ht setting |
| 1073 | IDS_FEAT_GNB_PLATFORMCFG, ///< Feat for override GNB platform config |
| 1074 | IDS_FEAT_CPB_CTRL, ///< Feat for Config the Core peformance boost feature |
| 1075 | IDS_FEAT_HTC_CTRL, ///< Feat for Hardware Thermal Control |
| 1076 | IDS_FEAT_MEMORY_MAPPING, ///< Feat for Memory Mapping |
| 1077 | IDS_FEAT_POWER_POLICY, ///< Feat for Power Policy |
| 1078 | IDS_FEAT_NV_TO_CMOS, ///< Feat for Save BSP Nv to CMOS |
| 1079 | IDS_FEAT_COMMON, ///< Common Feat |
| 1080 | IDS_FEAT_END = 0xFF ///< End of Common feat |
| 1081 | } IDS_FEAT; |
| 1082 | |
| 1083 | ///Ids IDT table function ID |
| 1084 | typedef enum { |
| 1085 | IDS_IDT_REPLACE_IDTR_FOR_BSC = 0x0000, ///< Function ID for saving IDTR for BSC |
| 1086 | IDS_IDT_RESTORE_IDTR_FOR_BSC, ///< Function ID for restoring IDTR for BSC |
| 1087 | IDS_IDT_UPDATE_EXCEPTION_VECTOR_FOR_AP, ///< Function ID for updating exception vector |
| 1088 | } IDS_IDT_FUNC_ID; |
| 1089 | |
| 1090 | typedef IDS_STATUS IDS_COMMON_FUNC ( |
| 1091 | IN OUT VOID *DataPtr, |
| 1092 | IN OUT AMD_CONFIG_PARAMS *StdHeader, |
| 1093 | IN IDS_NV_ITEM *IdsNvPtr |
| 1094 | ); |
| 1095 | |
| 1096 | typedef IDS_COMMON_FUNC *PIDS_COMMON_FUNC; |
| 1097 | |
| 1098 | /// Data Structure of IDS Feature block |
| 1099 | typedef struct _IDS_FAMILY_FEAT_STRUCT { |
| 1100 | IDS_FEAT IdsFeat; ///< Ids Feat ID |
| 1101 | BOOLEAN IsBsp; ///< swith for Bsp check |
| 1102 | AGESA_IDS_OPTION IdsOption; ///< IDS option |
| 1103 | UINT64 CpuFamily; ///< |
| 1104 | PIDS_COMMON_FUNC pf_idsoption; ///<pointer to function |
| 1105 | } IDS_FAMILY_FEAT_STRUCT; |
| 1106 | |
| 1107 | |
| 1108 | /// Data Structure of IDS option |
| 1109 | typedef struct _IDS_OPTION_STRUCT { |
| 1110 | AGESA_IDS_OPTION idsoption; ///< IDS option |
| 1111 | PIDS_COMMON_FUNC pf_idsoption; ///<pointer to function |
| 1112 | } IDS_OPTION_STRUCT; |
| 1113 | |
| 1114 | /// Data Structure of IDS option table |
| 1115 | typedef struct _IDS_OPTION_STRUCT_TBL { |
| 1116 | UINT8 version; ///<Version of IDS option table |
| 1117 | UINT16 size; ///<Size of IDS option table |
| 1118 | CONST IDS_OPTION_STRUCT *pIdsOptionStruct; ///<pointer to array of structure |
| 1119 | } IDS_OPTION_STRUCT_TBL; |
| 1120 | |
| 1121 | #define IDS_NV_TO_CMOS_LEN_BYTE 1 |
| 1122 | #define IDS_NV_TO_CMOS_LEN_WORD 2 |
| 1123 | #define IDS_NV_TO_CMOS_LEN_END 0xFF |
| 1124 | #define IDS_NV_TO_CMOS_ID_END 0xFFFF |
| 1125 | |
| 1126 | /// Data struct of set/get NV to/from CMOS |
| 1127 | typedef struct _IDS_NV_TO_CMOS { |
| 1128 | UINT8 Length; ///< Length of NV |
| 1129 | UINT16 IDS_NV_ID; ///< IDS id |
| 1130 | } IDS_NV_TO_CMOS; |
| 1131 | |
| 1132 | IDS_STATUS |
| 1133 | AmdIdsCtrlDispatcher ( |
| 1134 | IN AGESA_IDS_OPTION IdsOption, |
| 1135 | IN OUT VOID *DataPtr, |
| 1136 | IN OUT AMD_CONFIG_PARAMS *StdHeader |
| 1137 | ); |
| 1138 | |
| 1139 | AGESA_STATUS |
| 1140 | IdsOptionCallout ( |
| 1141 | IN UINTN CallOutId, |
| 1142 | IN OUT VOID *DataPtr, |
| 1143 | IN OUT AMD_CONFIG_PARAMS *StdHeader |
| 1144 | ); |
| 1145 | |
| 1146 | VOID |
| 1147 | AmdIdsHdtOutInit ( |
| 1148 | IN OUT AMD_CONFIG_PARAMS *StdHeader |
| 1149 | ); |
| 1150 | |
| 1151 | VOID |
| 1152 | AmdIdsHdtOutExit ( |
| 1153 | IN OUT AMD_CONFIG_PARAMS *StdHeader |
| 1154 | ); |
| 1155 | |
| 1156 | VOID |
| 1157 | AmdIdsHdtOutS3Exit ( |
| 1158 | IN OUT AMD_CONFIG_PARAMS *StdHeader |
| 1159 | ); |
| 1160 | |
| 1161 | VOID |
| 1162 | AmdIdsHdtOutS3ApExit ( |
| 1163 | IN OUT AMD_CONFIG_PARAMS *StdHeader |
| 1164 | ); |
| 1165 | |
| 1166 | VOID |
| 1167 | AmdIdsDebugPrint ( |
| 1168 | IN UINT64 Flag, |
| 1169 | IN CONST CHAR8 *Format, |
| 1170 | IN ... |
| 1171 | ); |
| 1172 | |
| 1173 | VOID |
| 1174 | AmdIdsDebugPrintHt ( |
| 1175 | IN CHAR8 *Format, |
| 1176 | IN ... |
| 1177 | ); |
| 1178 | |
| 1179 | VOID |
| 1180 | AmdIdsDebugPrintCpu ( |
| 1181 | IN CHAR8 *Format, |
| 1182 | IN ... |
| 1183 | ); |
| 1184 | |
| 1185 | VOID |
| 1186 | AmdIdsDebugPrintMem ( |
| 1187 | IN CHAR8 *Format, |
| 1188 | IN ... |
| 1189 | ); |
| 1190 | |
| 1191 | VOID |
| 1192 | AmdIdsDebugPrintGnb ( |
| 1193 | IN CHAR8 *Format, |
| 1194 | IN ... |
| 1195 | ); |
| 1196 | |
| 1197 | VOID |
| 1198 | AmdIdsDebugPrintAll ( |
| 1199 | IN CHAR8 *Format, |
| 1200 | IN ... |
| 1201 | ); |
| 1202 | |
| 1203 | VOID |
| 1204 | AmdIdsHdtOutBufferFlush ( |
| 1205 | IN OUT AMD_CONFIG_PARAMS *StdHeader |
| 1206 | ); |
| 1207 | |
| 1208 | VOID |
| 1209 | IdsMemTimeOut ( |
| 1210 | IN OUT VOID *DataPtr |
| 1211 | ); |
| 1212 | |
| 1213 | VOID |
| 1214 | IdsAgesaTestPoint ( |
| 1215 | IN AGESA_TP TestPoint, |
| 1216 | IN OUT AMD_CONFIG_PARAMS *StdHeader |
| 1217 | ); |
| 1218 | |
| 1219 | /** |
zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 1220 | * The engine code for ASSERT MACRO |
| 1221 | * |
| 1222 | * Halt execution with stop code display. Stop Code is displayed on port 80, with rotation so that |
| 1223 | * it is visible on 8, 16, or 32 bit display. The stop code is alternated with 0xDEAD on the display, |
| 1224 | * to help distinguish the stop code from a post code loop. |
| 1225 | * Additional features may be available if using simulation. |
| 1226 | * |
| 1227 | * @param[in] FileCode File code(define in FILECODE.h) mix with assert Line num. |
| 1228 | * |
| 1229 | */ |
| 1230 | BOOLEAN |
| 1231 | IdsErrorStop ( |
| 1232 | IN UINT32 FileCode |
| 1233 | ); |
| 1234 | |
| 1235 | VOID |
| 1236 | IdsDelay (VOID |
| 1237 | ); |
| 1238 | |
| 1239 | BOOLEAN |
| 1240 | AmdHeapIntactCheck ( |
| 1241 | IN AMD_CONFIG_PARAMS *StdHeader |
| 1242 | ); |
| 1243 | |
| 1244 | VOID |
| 1245 | IdsCarCorruptionCheck ( |
| 1246 | IN OUT AMD_CONFIG_PARAMS *StdHeader |
| 1247 | ); |
| 1248 | |
| 1249 | IDS_STATUS |
| 1250 | IdsExceptionTrap ( |
| 1251 | IN IDS_IDT_FUNC_ID IdsIdtFuncId, |
| 1252 | IN VOID *DataPtr, |
| 1253 | IN OUT AMD_CONFIG_PARAMS *StdHeader |
| 1254 | ); |
| 1255 | |
| 1256 | AGESA_STATUS |
| 1257 | IdsPerfTimestamp ( |
| 1258 | IN UINT32 LineInFile, |
| 1259 | IN OUT AMD_CONFIG_PARAMS *StdHeader |
| 1260 | ); |
| 1261 | |
| 1262 | AGESA_STATUS |
| 1263 | IdsPerfAnalyseTimestamp ( |
| 1264 | IN OUT AMD_CONFIG_PARAMS *StdHeader |
| 1265 | ); |
| 1266 | |
| 1267 | |
| 1268 | #if IDSOPT_IDS_ENABLED == FALSE |
| 1269 | #undef IEM_SKIP_CODE |
| 1270 | #undef IEM_INSERT_CODE |
| 1271 | #endif |
| 1272 | #ifndef IEM_SKIP_CODE |
| 1273 | #define IEM_SKIP_CODE(L) |
| 1274 | #endif |
| 1275 | #ifndef IEM_INSERT_CODE |
| 1276 | #define IEM_INSERT_CODE(L, Fn, Parm) |
| 1277 | #endif |
| 1278 | |
| 1279 | #endif // _IDS_H_ |