Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Apr 2006 04:41:44 GMT
From:      Kip Macy <kmacy@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 95413 for review
Message-ID:  <200604170441.k3H4fir9083525@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=95413

Change 95413 by kmacy@kmacy_storage:sun4v_rwbuf on 2006/04/17 04:40:43

	use intr_{disable,restore} functions
	add cpu_yield

Affected files ...

.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/machdep.c#20 edit

Differences ...

==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/machdep.c#20 (text+ko) ====

@@ -122,6 +122,7 @@
 int cold = 1;
 long Maxmem;
 long realmem;
+cpumask_t ipi_ready_mask;
 
 char pcpu0[PCPU_PAGES * PAGE_SIZE];
 struct trapframe frame0;
@@ -245,8 +246,7 @@
 
 	td = curthread;
 	if (td->td_md.md_spinlock_count == 0) {
-		pil = rdpr(pil);
-		wrpr(pil, 0, PIL_TICK);
+		pil = intr_disable();
 		td->td_md.md_saved_pil = pil;
 	}
 	td->td_md.md_spinlock_count++;
@@ -261,8 +261,9 @@
 	td = curthread;
 	critical_exit();
 	td->td_md.md_spinlock_count--;
-	if (td->td_md.md_spinlock_count == 0)
-		wrpr(pil, td->td_md.md_saved_pil, 0);
+	if (td->td_md.md_spinlock_count == 0) {
+		intr_restore(td->td_md.md_saved_pil);
+	}
 }
 
 unsigned
@@ -319,9 +320,6 @@
 
 	OF_getprop(child, "clock-frequency", &clock, sizeof(clock));
 
-
-
-
 	/*
 	 * Initialize the console before printing anything.
 	 */
@@ -354,7 +352,6 @@
 	mp_tramp = mp_tramp_alloc();
 #endif
 
-
 	env = getenv("kernelname");
 	if (env != NULL) {
 		strlcpy(kernelname, env, sizeof(kernelname));
@@ -364,6 +361,7 @@
 	/*
 	 * Initialize proc0 stuff (p_contested needs to be done early).
 	 */
+
 	proc_linkup(&proc0, &ksegrp0, &thread0);
 	proc0.p_md.md_sigtramp = NULL;
 	proc0.p_md.md_utrap = NULL;
@@ -396,7 +394,8 @@
 	 */
 	pmap_bootstrap(end);
 
-	thread0.td_kstack = kstack0; 
+	thread0.td_kstack = kstack0;
+	thread0.td_md.md_saved_pil = 0;
 	thread0.td_pcb = (struct pcb *)
 		(thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
 	thread0.td_pcb->pcb_kstack = (uint64_t)(((char *)thread0.td_pcb) - (CCFSZ + SPOFF));
@@ -735,11 +734,14 @@
 void
 cpu_idle(void)
 {
-	/* shouldn't be needed - but.. */
-	wrpr(pil, 0, 0);
-#ifdef SMP
-	hv_cpu_yield();
-#endif
+
+	if (rdpr(pil) != 0) 
+		panic("pil in cpu_idle not 0 - %ld", rdpr(pil));
+	if (rdpr(pstate) != 0x16)
+		panic("interrupts disabled in cpu_idle %ld", rdpr(pstate));
+		/* XXX heinous hack begin*/
+	
+	cpu_yield();
 }
 
 int
@@ -844,6 +846,7 @@
 
 	pcb = td->td_pcb;
 	tf = td->td_frame;
+	tf->tf_fprs = ~FPRS_FEF;
 	bcopy(pcb->pcb_ufp, fpregs->fr_regs, sizeof(fpregs->fr_regs));
 	fpregs->fr_fsr = tf->tf_fsr;
 	fpregs->fr_gsr = tf->tf_gsr;
@@ -901,3 +904,10 @@
 	mtx_pool_unlock(mtxpool_sleep, ut);
 	return (ut);
 }
+
+void
+cpu_yield(void)
+{
+	if (rdpr(pil) < PIL_TICK)
+		hv_cpu_yield();
+}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604170441.k3H4fir9083525>