3 /* ***************************************************************************/
7 /* * GX2 BISTs need to be run before BTB or caches are enabled.*/
8 /* * BIST result left in registers on failure to be checked with FS2.*/
10 /* ***************************************************************************/
17 msrnum = CPU_DM_CONFIG0;
19 msr.lo |= DM_CONFIG0_LOWER_DCDIS_SET;
27 outb(POST_CPU_DM_BIST_FAILURE , 0x80); /* 0x29*/
28 msr = rdmsr(msrnum); /* read back for pass fail*/
29 msr.lo &= 0x0F3FF0000;
30 if (msr.lo != 0xfeff0000)
33 msrnum = CPU_DM_CONFIG0;
35 msr.lo &= ~ DM_CONFIG0_LOWER_DCDIS_SET;
41 msrnum = CPU_FP_UROM_BIST;
44 outb(POST_CPU_FPU_BIST_FAILURE, 0x80); /* 0x89*/
45 inb(0x80); /* IO delay*/
46 msr = rdmsr(msrnum); /* read back for pass fail*/
47 while ((msr.lo&0x884) != 0x884)
48 msr = rdmsr(msrnum); /* Endless loop if BIST is broken*/
49 if ((msr.lo&0x642) != 0x642)
52 msr.lo = msr.hi = 0; /* clear FPU BIST bits*/
53 msrnum = CPU_FP_UROM_BIST;
60 msrnum = CPU_PF_BTBRMA_BIST;
63 outb(POST_CPU_BTB_BIST_FAILURE , 0x80); /* 0x8A*/
64 msr = rdmsr(msrnum); /* read back for pass fail*/
65 if ((msr.lo & 0x3030) != 0x3030)
71 print_err("BIST failed!\n");
74 /* ***************************************************************************/
76 /* ***************************************************************************/
81 /* Turn on BTM for early debug based on setup. */
82 /*if (getnvram( TOKEN_BTM_DIAG_MODE) & 3) {*/
84 /* Set Diagnostic Mode */
85 msrnum = CPU_GLD_MSR_DIAG;
87 msr.lo = DIAG_SEL1_SET | DIAG_SET0_SET;
90 /* Set up GLCP to grab BTM data.*/
91 msrnum = 0x04C00000C; /* GLCP_DBGOUT MSR*/
93 msr.lo = 0x08; /* reset value (SCOPE_SEL = 0) causes FIFO toshift out,*/
94 wrmsr(msrnum, msr); /* exchange it to anything else to prevent this*/
96 /* ;Turn off debug clock*/
97 msrnum = 0x04C000016; /* DBG_CLK_CTL*/
98 msr.lo = 0x00; /* No clock*/
102 /* ;Set debug clock to CPU*/
103 msrnum = 0x04C000016; /* DBG_CLK_CTL*/
104 msr.lo = 0x01; /* CPU CLOCK*/
108 /* ;Set fifo ctl to BTM bits wide*/
109 msrnum = 0x04C00005E; /* FIFO_CTL*/
110 msr.lo = 0x003880000; /* Bit [25:24] are size (11=BTM, 10 = 64 bit, 01= 32 bit, 00 = 16bit)*/
111 wrmsr(msrnum, msr); /* Bit [23:21] are position (100 = CPU downto0)*/
112 /* Bit [19] sets it up in slow data mode.*/
114 /* ;enable fifo loading - BTM sizing will constrain*/
115 /* ; only valid BTM packets to load - this action should always be on*/
117 msrnum = 0x04C00006F; /* GLCP ACTION7 - load fifo*/
118 msr.lo = 0x00000F000; /* Any nibble all 1's will always trigger*/
119 msr.hi = 0x000000000; /* */
122 /* ;start storing diag data in the fifo*/
123 msrnum = 0x04C00005F; /* DIAG CTL*/
124 msr.lo = 0x080000000; /* enable actions*/
125 msr.hi = 0x000000000;
128 /* Set up delay on data lines, so that the hold time*/
130 msrnum = 0x04C00000D ; /* GLCP IO DELAY CONTROLS*/
131 msr.lo = 0x082b5ad68;
132 msr.hi = 0x080ad6b57; /* RGB delay = 0x07*/
135 /* Set up DF to output diag information on DF pins.*/
136 msrnum = DF_GLD_MSR_MASTER_CONF;
141 msrnum = 0x04C00000C ; /* GLCP_DBGOUT MSR*/
143 msr.lo = 0x0; /* reset value (SCOPE_SEL = 0) causes FIFO to shift out,*/
145 /* end of code for BTM */
148 /* Enable Suspend on Halt*/
149 msrnum = CPU_XC_CONFIG;
151 msr.lo |= XC_CONFIG_SUSP_ON_HLT;
154 /* ENable SUSP and allow TSC to run in Suspend */
155 /* to keep speed detection happy*/
156 msrnum = CPU_BC_CONF_0;
158 msr.lo |= TSC_SUSP_SET | SUSP_EN_SET;
161 /* Setup throttling to proper mode if it is ever enabled.*/
162 msrnum = 0x04C00001E;
163 msr.hi = 0x000000000;
164 msr.lo = 0x00000603C;
168 /* Only do this if we are building for 5535*/
172 /* Enable CIS mode B in FooGlue*/
173 msrnum = MSR_FG + 0x10;
176 msr.lo |= 2; /* ModeB*/
181 /* Disable DOT PLL. Graphics init will enable it if needed.*/
183 msrnum = GLCP_DOTPLL;
185 msr.lo |= DOTPPL_LOWER_PD_SET;
200 /*if (getnvram( TOKEN_BIST_ENABLE) & == TVALUE_DISABLE) {*/
209 /* I hate to put this check here but it doesn't really work in cpubug.asm*/
210 msrnum = MSR_GLCP+0x17;
212 if (msr.lo < CPU_REV_2_1){
213 msrnum = CPU_PF_BTB_CONF;
215 msr.lo |= BTB_ENABLE_SET | RETURN_STACK_ENABLE_SET;
220 /* FPU impercise exceptions bit*/
222 /*if (getnvram( TOKEN_FPU_IE_ENABLE) != TVALUE_DISABLE) {*/
224 msrnum = CPU_FPU_MSR_MODE;
226 msr.lo |= FPU_IE_SET;
233 /* Allow NVRam to override DM Setup*/
234 /*if (getnvram( TOKEN_CACHE_DM_MODE) != 1) {*/
237 msrnum = CPU_DM_CONFIG0;
239 msr.lo |= DM_CONFIG0_LOWER_DCDIS_SET;
242 /* Allow NVRam to override IM Setup*/
243 /*if (getnvram( TOKEN_CACHE_IM_MODE) ==1) {*/
245 msrnum = CPU_IM_CONFIG;
247 msr.lo |= IM_CONFIG_LOWER_ICD_SET;
255 /* ***************************************************************************/
257 /* * MTestPinCheckBX*/
259 /* * Set MTEST pins to expected values from OPTIONS.INC/NVRAM*/
260 /* * This version is called when there isn't a stack available*/
262 /* ***************************************************************************/
264 MTestPinCheckBX (void){
268 /*if (getnvram( TOKEN_MTEST_ENABLE) ==TVALUE_DISABLE ) {*/
273 msrnum = MC_CFCLK_DBUG;
275 msr.hi |= CFCLK_UPPER_MTST_B2B_DIS_SET | CFCLK_UPPER_MTEST_EN_SET;
278 msrnum = GLCP_SYS_RSTPLL /* Get SDR/DDR mode from GLCP*/;
280 msr.lo >>= RSTPPL_LOWER_SDRMODE_SHIFT;
282 msrnum = MC_CFCLK_DBUG; /* Turn on SDR MTEST stuff*/
284 msr.lo |= CFCLK_LOWER_SDCLK_SET;
285 msr.hi |= CFCLK_UPPER_MTST_DQS_EN_SET;
289 /* Lock the cache down here.*/