View | Details | Raw Unified | Return to bug 233863 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/src/sys/powerpc/aim/mp_cpudep.c (-40 / +42 lines)
Lines 50-56 Link Here
50
#include <dev/ofw/openfirm.h>
50
#include <dev/ofw/openfirm.h>
51
#include <machine/ofw_machdep.h>
51
#include <machine/ofw_machdep.h>
52
52
53
void *ap_pcpu;
53
void * volatile ap_pcpu;
54
54
55
static register_t bsp_state[8] __aligned(8);
55
static register_t bsp_state[8] __aligned(8);
56
56
Lines 68-73 Link Here
68
	case IBM970:
68
	case IBM970:
69
	case IBM970FX:
69
	case IBM970FX:
70
	case IBM970MP:
70
	case IBM970MP:
71
		/* Set HIOR to 0 */
72
		__asm __volatile("mtspr 311,%0" :: "r"(0));
73
		powerpc_sync();
74
75
		/*
76
		 * The 970 has strange rules about how to update HID registers.
77
		 * See Table 2-3, 970MP manual
78
		 *
79
		 * Note: HID4 and HID5 restored already in
80
		 * cpudep_ap_early_bootstrap()
81
		 */
82
83
		__asm __volatile("mtasr %0; sync" :: "r"(0));
84
	#ifdef __powerpc64__
85
		__asm __volatile(" \
86
			sync; isync;					\
87
			mtspr	%1, %0;					\
88
			mfspr	%0, %1;	mfspr	%0, %1;	mfspr	%0, %1;	\
89
			mfspr	%0, %1;	mfspr	%0, %1;	mfspr	%0, %1; \
90
			sync; isync" 
91
		    :: "r"(bsp_state[0]), "K"(SPR_HID0));
92
		__asm __volatile("sync; isync;	\
93
		    mtspr %1, %0; mtspr %1, %0; sync; isync"
94
		    :: "r"(bsp_state[1]), "K"(SPR_HID1));
95
	#else
96
		__asm __volatile(" \
97
			ld	%0,0(%2);				\
98
			sync; isync;					\
99
			mtspr	%1, %0;					\
100
			mfspr	%0, %1;	mfspr	%0, %1;	mfspr	%0, %1;	\
101
			mfspr	%0, %1;	mfspr	%0, %1;	mfspr	%0, %1; \
102
			sync; isync" 
103
		    : "=r"(reg) : "K"(SPR_HID0), "b"(bsp_state));
104
		__asm __volatile("ld %0, 8(%2); sync; isync;	\
105
		    mtspr %1, %0; mtspr %1, %0; sync; isync"
106
		    : "=r"(reg) : "K"(SPR_HID1), "b"(bsp_state));
107
	#endif
108
109
		powerpc_sync();
71
		/* Restore HID4 and HID5, which are necessary for the MMU */
110
		/* Restore HID4 and HID5, which are necessary for the MMU */
72
111
73
#ifdef __powerpc64__
112
#ifdef __powerpc64__
Lines 103-108 Link Here
103
		break;
142
		break;
104
	}
143
	}
105
144
145
powerpc_sync();
106
	__asm __volatile("mtsprg 0, %0" :: "r"(ap_pcpu));
146
	__asm __volatile("mtsprg 0, %0" :: "r"(ap_pcpu));
107
	powerpc_sync();
147
	powerpc_sync();
108
}
148
}
Lines 307-351 Link Here
307
	case IBM970:
347
	case IBM970:
308
	case IBM970FX:
348
	case IBM970FX:
309
	case IBM970MP:
349
	case IBM970MP:
310
		/* Set HIOR to 0 */
311
		__asm __volatile("mtspr 311,%0" :: "r"(0));
312
		powerpc_sync();
313
314
		/*
315
		 * The 970 has strange rules about how to update HID registers.
316
		 * See Table 2-3, 970MP manual
317
		 *
318
		 * Note: HID4 and HID5 restored already in
319
		 * cpudep_ap_early_bootstrap()
320
		 */
321
322
		__asm __volatile("mtasr %0; sync" :: "r"(0));
323
	#ifdef __powerpc64__
324
		__asm __volatile(" \
325
			sync; isync;					\
326
			mtspr	%1, %0;					\
327
			mfspr	%0, %1;	mfspr	%0, %1;	mfspr	%0, %1;	\
328
			mfspr	%0, %1;	mfspr	%0, %1;	mfspr	%0, %1; \
329
			sync; isync" 
330
		    :: "r"(bsp_state[0]), "K"(SPR_HID0));
331
		__asm __volatile("sync; isync;	\
332
		    mtspr %1, %0; mtspr %1, %0; sync; isync"
333
		    :: "r"(bsp_state[1]), "K"(SPR_HID1));
334
	#else
335
		__asm __volatile(" \
336
			ld	%0,0(%2);				\
337
			sync; isync;					\
338
			mtspr	%1, %0;					\
339
			mfspr	%0, %1;	mfspr	%0, %1;	mfspr	%0, %1;	\
340
			mfspr	%0, %1;	mfspr	%0, %1;	mfspr	%0, %1; \
341
			sync; isync" 
342
		    : "=r"(reg) : "K"(SPR_HID0), "b"(bsp_state));
343
		__asm __volatile("ld %0, 8(%2); sync; isync;	\
344
		    mtspr %1, %0; mtspr %1, %0; sync; isync"
345
		    : "=r"(reg) : "K"(SPR_HID1), "b"(bsp_state));
346
	#endif
347
348
		powerpc_sync();
349
		break;
350
		break;
350
	case IBMCELLBE:
351
	case IBMCELLBE:
351
		#ifdef NOTYET /* Causes problems if in instruction stream on 970 */
352
		#ifdef NOTYET /* Causes problems if in instruction stream on 970 */
Lines 416-420 Link Here
416
		    "suboptimal.\n");
417
		    "suboptimal.\n");
417
		break;
418
		break;
418
	}
419
	}
420
printf("cpudep_ap_setup: done\n");
419
}
421
}

Return to bug 233863