PERFORCE change 140765 for review

Marcel Moolenaar marcel at FreeBSD.org
Sun Apr 27 22:52:15 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=140765

Change 140765 by marcel at marcel_xcllnt on 2008/04/27 22:51:23

	IFC @140764

Affected files ...

.. //depot/projects/e500/bin/sh/arith.h#2 integrate
.. //depot/projects/e500/bin/sh/arith.y#2 integrate
.. //depot/projects/e500/bin/sh/shell.h#2 integrate
.. //depot/projects/e500/sys/conf/files.powerpc#24 integrate
.. //depot/projects/e500/sys/dev/ath/if_ath.c#8 integrate
.. //depot/projects/e500/sys/powerpc/aim/clock.c#7 integrate
.. //depot/projects/e500/sys/powerpc/aim/locore.S#8 integrate
.. //depot/projects/e500/sys/powerpc/aim/machdep.c#13 integrate
.. //depot/projects/e500/sys/powerpc/aim/mmu_oea.c#5 integrate
.. //depot/projects/e500/sys/powerpc/aim/mp_cpudep.c#1 branch
.. //depot/projects/e500/sys/powerpc/aim/swtch.S#6 integrate
.. //depot/projects/e500/sys/powerpc/aim/trap_subr.S#7 integrate
.. //depot/projects/e500/sys/powerpc/aim/vm_machdep.c#11 integrate
.. //depot/projects/e500/sys/powerpc/booke/pmap.c#15 integrate
.. //depot/projects/e500/sys/powerpc/booke/trap_subr.S#9 integrate
.. //depot/projects/e500/sys/powerpc/conf/NOTES#12 integrate
.. //depot/projects/e500/sys/powerpc/include/cpufunc.h#3 integrate
.. //depot/projects/e500/sys/powerpc/include/pcpu.h#7 integrate
.. //depot/projects/e500/sys/powerpc/include/smp.h#2 integrate
.. //depot/projects/e500/sys/powerpc/powerpc/intr_machdep.c#10 integrate
.. //depot/projects/e500/sys/powerpc/powerpc/mp_machdep.c#3 integrate
.. //depot/projects/e500/sys/powerpc/powerpc/openpic.c#5 integrate

Differences ...

==== //depot/projects/e500/bin/sh/arith.h#2 (text+ko) ====

@@ -27,11 +27,15 @@
  * SUCH DAMAGE.
  *
  *	@(#)arith.h	1.1 (Berkeley) 5/4/95
- * $FreeBSD: src/bin/sh/arith.h,v 1.11 2005/08/13 07:59:46 stefanf Exp $
+ * $FreeBSD: src/bin/sh/arith.h,v 1.12 2008/04/27 20:46:45 stefanf Exp $
  */
 
+#include "shell.h"
+
+#define DIGITS(var) (3 + (2 + CHAR_BIT * sizeof((var))) / 3)
+
 extern char *arith_buf, *arith_startbuf;
 
-int arith(char *);
+arith_t arith(char *);
 void arith_lex_reset(void);
 int expcmd(int, char **);

==== //depot/projects/e500/bin/sh/arith.y#2 (text+ko) ====

@@ -38,7 +38,7 @@
 #endif /* not lint */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/bin/sh/arith.y,v 1.21 2005/08/13 07:59:46 stefanf Exp $");
+__FBSDID("$FreeBSD: src/bin/sh/arith.y,v 1.22 2008/04/27 20:46:45 stefanf Exp $");
 
 #include <limits.h>
 #include <stdio.h>
@@ -75,7 +75,10 @@
 
 exp:
 	expr
-		{ return ($1); }
+		{
+		*YYPARSE_PARAM = $1;
+		return (0);
+		}
 	;
 
 expr:
@@ -259,12 +262,13 @@
 #include "output.h"
 #include "memalloc.h"
 
-#define lstrlen(var) (3 + (2 + CHAR_BIT * sizeof((var))) / 3)
+#define YYPARSE_PARAM_TYPE arith_t *
+#define YYPARSE_PARAM result
 
 char *arith_buf, *arith_startbuf;
 
 int yylex(void);
-int yyparse(void);
+int yyparse(YYPARSE_PARAM_TYPE);
 
 static int
 arith_assign(char *name, arith_t value)
@@ -272,22 +276,22 @@
 	char *str;
 	int ret;
 
-	str = (char *)ckmalloc(lstrlen(value));
+	str = (char *)ckmalloc(DIGITS(value));
 	sprintf(str, ARITH_FORMAT_STR, value);
 	ret = setvarsafe(name, str, 0);
 	free(str);
 	return ret;
 }
 
-int
+arith_t
 arith(char *s)
 {
-	long result;
+	arith_t result;
 
 	arith_buf = arith_startbuf = s;
 
 	INTOFF;
-	result = yyparse();
+	yyparse(&result);
 	arith_lex_reset();	/* Reprime lex. */
 	INTON;
 
@@ -313,7 +317,7 @@
 	char *p;
 	char *concat;
 	char **ap;
-	long i;
+	arith_t i;
 
 	if (argc > 1) {
 		p = argv[1];
@@ -338,7 +342,7 @@
 
 	i = arith(p);
 
-	out1fmt("%ld\n", i);
+	out1fmt(ARITH_FORMAT_STR "\n", i);
 	return !i;
 }
 

==== //depot/projects/e500/bin/sh/shell.h#2 (text+ko) ====

@@ -30,9 +30,14 @@
  * SUCH DAMAGE.
  *
  *	@(#)shell.h	8.2 (Berkeley) 5/4/95
- * $FreeBSD: src/bin/sh/shell.h,v 1.17 2004/04/06 20:06:51 markm Exp $
+ * $FreeBSD: src/bin/sh/shell.h,v 1.18 2008/04/27 20:46:45 stefanf Exp $
  */
 
+#ifndef SHELL_H_
+#define SHELL_H_
+
+#include <inttypes.h>
+
 /*
  * The follow should be set to reflect the type of system you have:
  *	JOBS -> 1 if you have Berkeley job control, 0 otherwise.
@@ -50,10 +55,10 @@
 /*
  * Type of used arithmetics. SUSv3 requires us to have at least signed long.
  */
-typedef long arith_t;
-#define	ARITH_FORMAT_STR  "%ld"
-#define	atoarith_t(arg)  strtol(arg, NULL, 0)
-#define	strtoarith_t(nptr, endptr, base)  strtol(nptr, endptr, base)
+typedef intmax_t arith_t;
+#define	ARITH_FORMAT_STR  "%" PRIdMAX
+#define	atoarith_t(arg)  strtoimax(arg, NULL, 0)
+#define	strtoarith_t(nptr, endptr, base)  strtoimax(nptr, endptr, base)
 
 typedef void *pointer;
 #define STATIC  static
@@ -68,3 +73,5 @@
 #else
 #define TRACE(param)
 #endif
+
+#endif /* !SHELL_H_ */

==== //depot/projects/e500/sys/conf/files.powerpc#24 (text+ko) ====

@@ -1,7 +1,7 @@
 # This file tells config what files go into building a kernel,
 # files marked standard are always included.
 #
-# $FreeBSD: src/sys/conf/files.powerpc,v 1.75 2008/04/26 17:57:28 raj Exp $
+# $FreeBSD: src/sys/conf/files.powerpc,v 1.76 2008/04/27 22:33:41 marcel Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -69,6 +69,7 @@
 powerpc/aim/locore.S		optional	aim no-obj
 powerpc/aim/machdep.c		optional	aim
 powerpc/aim/mmu_oea.c		optional	aim
+powerpc/aim/mp_cpudep.c		optional	aim smp
 powerpc/aim/nexus.c		optional	aim
 powerpc/aim/ofw_machdep.c	optional	aim
 powerpc/aim/ofwmagic.S		optional	aim

==== //depot/projects/e500/sys/dev/ath/if_ath.c#8 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.180 2008/04/20 20:35:35 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.181 2008/04/27 22:03:56 sam Exp $");
 
 /*
  * Driver for the Atheros Wireless LAN controller.
@@ -5920,7 +5920,12 @@
 	ath_hal_setregdomain(ah, 0);
 	/* XXX not quite right but close enough for now */
 	getchannels(sc, nchans, chans, CTRY_DEBUG, AH_TRUE, AH_FALSE);
+
+	/* NB: restore previous state */
 	ath_hal_setregdomain(ah, ord);
+	(void) getchannels(sc, NULL, NULL, ic->ic_regdomain.country,
+	     ic->ic_regdomain.ecm ? AH_TRUE : AH_FALSE,
+	     ic->ic_regdomain.location == 'O' ? AH_TRUE : AH_FALSE);
 }
 
 static int

==== //depot/projects/e500/sys/powerpc/aim/clock.c#7 (text+ko) ====

@@ -56,15 +56,16 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/powerpc/aim/clock.c,v 1.33 2008/04/22 19:38:30 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/powerpc/aim/clock.c,v 1.34 2008/04/27 22:33:42 marcel Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
+#include <sys/bus.h>
+#include <sys/interrupt.h>
+#include <sys/pcpu.h>
 #include <sys/sysctl.h>
-#include <sys/bus.h>
 #include <sys/timetc.h>
-#include <sys/interrupt.h>
 
 #include <dev/ofw/openfirm.h>
 
@@ -76,11 +77,9 @@
 /*
  * Initially we assume a processor with a bus frequency of 12.5 MHz.
  */
-u_int			tickspending;
 u_long			ns_per_tick = 80;
 static u_long		ticks_per_sec = 12500000;
 static long		ticks_per_intr;
-static volatile u_long	lasttb;
 
 static timecounter_get_t	decr_get_timecount;
 
@@ -95,7 +94,6 @@
 void
 decr_intr(struct trapframe *frame)
 {
-	u_long		tb;
 	long		tick;
 	int		nticks;
 
@@ -109,36 +107,17 @@
 	 * Based on the actual time delay since the last decrementer reload,
 	 * we arrange for earlier interrupt next time.
 	 */
-	__asm ("mftb %0; mfdec %1" : "=r"(tb), "=r"(tick));
+	__asm ("mfdec %0" : "=r"(tick));
 	for (nticks = 0; tick < 0; nticks++)
 		tick += ticks_per_intr;
 	mtdec(tick);
-	/*
-	 * lasttb is used during microtime. Set it to the virtual
-	 * start of this tick interval.
-	 */
-	lasttb = tb + tick - ticks_per_intr;
 
-	nticks += tickspending;
-	tickspending = 0;
-
-	/*
-	 * Reenable interrupts
-	 */
-#if 0
-	msr = mfmsr();
-	mtmsr(msr | PSL_EE | PSL_RI);
-#endif
-	/*
-	 * Do standard timer interrupt stuff.
-	 * Do softclock stuff only on the last iteration.
-	 */
-#if 0
-	while (--nticks > 0) {
-		hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
+	while (nticks-- > 0) {
+		if (PCPU_GET(cpuid) == 0)
+			hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
+		else
+			hardclock_cpu(TRAPF_USERMODE(frame));
 	}
-#endif
-	hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
 }
 
 void
@@ -166,7 +145,6 @@
 
 			ns_per_tick = 1000000000 / ticks_per_sec;
 			ticks_per_intr = ticks_per_sec / hz;
-			__asm __volatile ("mftb %0" : "=r"(lasttb));
 			mtdec(ticks_per_intr);
 
 			mtmsr(msr);

==== //depot/projects/e500/sys/powerpc/aim/locore.S#8 (text+ko) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/powerpc/aim/locore.S,v 1.26 2008/04/16 23:28:11 marcel Exp $ */
+/* $FreeBSD: src/sys/powerpc/aim/locore.S,v 1.28 2008/04/27 22:33:42 marcel Exp $ */
 /* $NetBSD: locore.S,v 1.24 2000/05/31 05:09:17 thorpej Exp $ */
 
 /*-
@@ -77,19 +77,21 @@
         .globl  kernbase
         .set    kernbase, KERNBASE
 
+#define	TMPSTKSZ	8192		/* 8K temporary stack */
+
 /*
  * Globals
  */
 	.data
+	.align	4
 GLOBAL(tmpstk)
-	.space	8208
+	.space	TMPSTKSZ
 GLOBAL(esym)
 	.long	0			/* end of symbol table */
 
 GLOBAL(ofmsr)
 	.long	0, 0, 0, 0, 0		/* msr/sprg0-3 used in Open Firmware */
 
-#define	INTSTK		16384		/* 16K interrupt stack */
 #define	INTRCNT_COUNT	256		/* max(HROWPIC_IRQMAX,OPENPIC_IRQMAX) */
 GLOBAL(intrnames)
 	.space	INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
@@ -151,9 +153,8 @@
 	stw	5,openfirmware_entry at l(8) /* save client interface handler */
 	mr	3,5
 
-	lis	1,tmpstk at ha
-	addi	1,1,tmpstk at l
-	addi	1,1,8192
+	lis	1,(tmpstk+TMPSTKSZ-16)@ha
+	addi	1,1,(tmpstk+TMPSTKSZ-16)@l
 
 	mfmsr	0
 	lis	9,ofmsr at ha

==== //depot/projects/e500/sys/powerpc/aim/machdep.c#13 (text+ko) ====

@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/powerpc/aim/machdep.c,v 1.114 2008/04/25 05:18:49 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/powerpc/aim/machdep.c,v 1.115 2008/04/27 22:33:42 marcel Exp $");
 
 #include "opt_compat.h"
 #include "opt_ddb.h"
@@ -129,7 +129,8 @@
 
 int cold = 1;
 
-static struct pcpu pcpu0;
+struct pcpu __pcpu[MAXCPU];
+
 static struct trapframe frame0;
 
 char		machine[] = "powerpc";
@@ -236,6 +237,9 @@
 
 extern char	kernel_text[], _end[];
 
+#ifdef SMP
+extern void	*rstcode, *rstsize;
+#endif
 extern void	*trapcode, *trapsize;
 extern void	*alitrap, *alisize;
 extern void	*dsitrap, *dsisize;
@@ -288,7 +292,7 @@
 	/*
 	 * Set up per-cpu data.
 	 */
-	pc = &pcpu0;
+	pc = __pcpu;
 	pcpu_init(pc, 0, sizeof(struct pcpu));
 	pc->pc_curthread = &thread0;
 	pc->pc_cpuid = 0;
@@ -320,7 +324,11 @@
 	 */
 	mtmsr(mfmsr() & ~(PSL_IR | PSL_DR));
 	isync();
+#ifdef SMP
+	bcopy(&rstcode,  (void *)EXC_RST,  (size_t)&rstsize);
+#else
 	bcopy(&trapcode, (void *)EXC_RST,  (size_t)&trapsize);
+#endif
 	bcopy(&trapcode, (void *)EXC_MCHK, (size_t)&trapsize);
 	bcopy(&dsitrap,  (void *)EXC_DSI,  (size_t)&dsisize);
 	bcopy(&trapcode, (void *)EXC_ISI,  (size_t)&trapsize);
@@ -337,8 +345,7 @@
 	bcopy(&trapcode, (void *)EXC_THRM, (size_t)&trapsize);
 	bcopy(&trapcode, (void *)EXC_BPT,  (size_t)&trapsize);
 #ifdef KDB
-	bcopy(&dblow,	 (void *)EXC_RST,  (size_t)&dbsize);
-	bcopy(&dblow,	 (void *)EXC_MCHK, (size_t)&dbsize);
+	bcopy(&dblow,   (void *)EXC_MCHK, (size_t)&dbsize);
 	bcopy(&dblow,   (void *)EXC_PGM,  (size_t)&dbsize);
 	bcopy(&dblow,   (void *)EXC_TRC,  (size_t)&dbsize);
 	bcopy(&dblow,   (void *)EXC_BPT,  (size_t)&dbsize);

==== //depot/projects/e500/sys/powerpc/aim/mmu_oea.c#5 (text+ko) ====

@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/powerpc/aim/mmu_oea.c,v 1.119 2008/04/17 00:37:40 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/powerpc/aim/mmu_oea.c,v 1.120 2008/04/27 22:33:42 marcel Exp $");
 
 /*
  * Manages physical address maps.
@@ -147,6 +147,7 @@
 #include <machine/md_var.h>
 #include <machine/psl.h>
 #include <machine/pte.h>
+#include <machine/smp.h>
 #include <machine/sr.h>
 #include <machine/mmuvar.h>
 
@@ -203,8 +204,6 @@
 
 extern struct pmap ofw_pmap;
 
-
-
 /*
  * Lock for the pteg and pvo tables.
  */
@@ -605,6 +604,59 @@
 }
 
 void
+pmap_cpu_bootstrap(volatile uint32_t *trcp, int ap)
+{
+	u_int sdr;
+	int i;
+
+	trcp[0] = 0x1000;
+	trcp[1] = (uint32_t)&pmap_cpu_bootstrap;
+
+	if (ap) {
+		__asm __volatile("mtdbatu 0,%0" :: "r"(battable[0].batu));
+		__asm __volatile("mtdbatl 0,%0" :: "r"(battable[0].batl));
+		isync();
+		__asm __volatile("mtibatu 0,%0" :: "r"(battable[0].batu));
+		__asm __volatile("mtibatl 0,%0" :: "r"(battable[0].batl));
+		isync();
+	}
+
+	trcp[0] = 0x1001;
+
+	for (i = 1; i < 4; i++) {
+		__asm __volatile("mtdbatu %0,%1" :: "n"(i), "r"(0));
+		__asm __volatile("mtibatu %0,%1" :: "n"(i), "r"(0));
+		isync();
+	}
+
+	trcp[0] = 0x1002;
+
+	__asm __volatile("mtdbatu 1,%0" :: "r"(battable[8].batu));
+	__asm __volatile("mtdbatl 1,%0" :: "r"(battable[8].batl));
+	isync();
+
+	trcp[0] = 0x1003;
+
+	for (i = 0; i < 16; i++)
+		mtsrin(i << ADDR_SR_SHFT, EMPTY_SEGMENT);
+
+	trcp[0] = 0x1004;
+
+	__asm __volatile("mtsr %0,%1" :: "n"(KERNEL_SR), "r"(KERNEL_SEGMENT));
+	__asm __volatile("mtsr %0,%1" :: "n"(KERNEL2_SR), "r"(KERNEL2_SEGMENT));
+	__asm __volatile("sync");
+
+	trcp[0] = 0x1005;
+
+	sdr = (u_int)moea_pteg_table | (moea_pteg_mask >> 10);
+	__asm __volatile("mtsdr1 %0" :: "r"(sdr));
+	isync();
+
+	trcp[0] = 0x1006;
+	trcp[1] = sdr;
+}
+
+void
 moea_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend)
 {
 	ihandle_t	mmui;
@@ -612,9 +664,9 @@
 	int		sz;
 	int		i, j;
 	int		ofw_mappings;
+	uint32_t	trace[2];
 	vm_size_t	size, physsz, hwphyssz;
 	vm_offset_t	pa, va, off;
-	u_int		batl, batu;
 
         /*
          * Set up BAT0 to map the lowest 256 MB area
@@ -647,18 +699,15 @@
 	 * Use an IBAT and a DBAT to map the bottom segment of memory
 	 * where we are.
 	 */
-	batu = BATU(0x00000000, BAT_BL_256M, BAT_Vs);
-	batl = BATL(0x00000000, BAT_M, BAT_PP_RW);
 	__asm (".balign 32; \n"
 	       "mtibatu 0,%0; mtibatl 0,%1; isync; \n"
 	       "mtdbatu 0,%0; mtdbatl 0,%1; isync"
-	    :: "r"(batu), "r"(batl));
+	    :: "r"(battable[0].batu), "r"(battable[0].batl));
 
 	/* map pci space */
-	batu = BATU(0x80000000, BAT_BL_256M, BAT_Vs);
-	batl = BATL(0x80000000, BAT_I|BAT_G, BAT_PP_RW);
-	__asm ("mtdbatu 1,%0; mtdbatl 1,%1; isync"
-	    :: "r"(batu), "r"(batl));
+	__asm __volatile("mtdbatu 1,%0" :: "r"(battable[8].batu));
+	__asm __volatile("mtdbatl 1,%0" :: "r"(battable[8].batl));
+	isync();
 
 	mem_regions(&pregions, &pregions_sz, &regions, &regions_sz);
 	CTR0(KTR_PMAP, "moea_bootstrap: physical memory");
@@ -844,18 +893,7 @@
 	kernel_pmap->pm_sr[KERNEL2_SR] = KERNEL2_SEGMENT;
 	kernel_pmap->pm_active = ~0;
 
-	/*
-	 * Initialize hardware.
-	 */
-	for (i = 0; i < 16; i++) {
-		mtsrin(i << ADDR_SR_SHFT, EMPTY_SEGMENT);
-	}
-	__asm __volatile ("mtsr %0,%1"
-	    :: "n"(KERNEL_SR), "r"(KERNEL_SEGMENT));
-	__asm __volatile ("mtsr %0,%1"
-	    :: "n"(KERNEL2_SR), "r"(KERNEL2_SEGMENT));
-	__asm __volatile ("sync; mtsdr1 %0; isync"
-	    :: "r"((u_int)moea_pteg_table | (moea_pteg_mask >> 10)));
+	pmap_cpu_bootstrap(trace, 0);
 	tlbia();
 
 	pmap_bootstrapped++;

==== //depot/projects/e500/sys/powerpc/aim/swtch.S#6 (text+ko) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/powerpc/aim/swtch.S,v 1.24 2008/03/02 17:05:56 raj Exp $ */
+/* $FreeBSD: src/sys/powerpc/aim/swtch.S,v 1.25 2008/04/27 22:33:42 marcel Exp $ */
 /* $NetBSD: locore.S,v 1.24 2000/05/31 05:09:17 thorpej Exp $ */
 
 /*-
@@ -67,6 +67,13 @@
 #include <machine/asm.h>
 
 /*
+ * void cpu_throw(struct thread *old, struct thread *new)
+ */
+ENTRY(cpu_throw)
+	mr	%r15, %r4
+	b	cpu_switchin
+
+/*
  * void cpu_switch(struct thread *old,
  *		   struct thread *new,
  *		   struct mutex *mtx); 
@@ -94,7 +101,8 @@
 	mr	%r14,%r3		/* Copy the old thread ptr... */
 	mr	%r15,%r4		/* and the new thread ptr in scratch */
 	
-	lwz	%r6,PCB_FLAGS(%r5)	/* Save FPU context if needed */
+	lwz	%r6,PCB_FLAGS(%r5)
+	/* Save FPU context if needed */
 	andi.	%r6, %r6, PCB_FPU
 	beq	.L1
 	bl	save_fpu
@@ -102,6 +110,7 @@
 .L1:
 	bl	pmap_deactivate		/* Deactivate the current pmap */
 
+cpu_switchin:
 	mr	%r3,%r15		/* Get new thread ptr */
 	bl	pmap_activate		/* Activate the new address space */
 
@@ -110,7 +119,8 @@
 	lwz	%r17,TD_PCB(%r15)	/* Store new current PCB */
 	stw	%r17,PC_CURPCB(%r7)
 
-	lwz	%r6, PCB_FLAGS(%r17)	/* Restore FPU context if needed */
+	lwz	%r6, PCB_FLAGS(%r17)
+	/* Restore FPU context if needed */
 	andi.	%r6, %r6, PCB_FPU
 	beq	.L2
 	mr	%r3,%r15		/* Pass curthread to enable_fpu */

==== //depot/projects/e500/sys/powerpc/aim/trap_subr.S#7 (text+ko) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/powerpc/aim/trap_subr.S,v 1.18 2008/03/02 17:05:56 raj Exp $ */
+/* $FreeBSD: src/sys/powerpc/aim/trap_subr.S,v 1.19 2008/04/27 22:33:42 marcel Exp $ */
 /* $NetBSD: trap_subr.S,v 1.20 2002/04/22 23:20:08 kleink Exp $	*/
 
 /*-
@@ -228,20 +228,67 @@
 	mfsprg2	%r2;			/* restore r2 & r3 */		\
 	mfsprg3	%r3
 
-#ifdef KDB
+#ifdef SMP
 /*
- * Define the kdb debugger stack
+ * Processor reset exception handler. These are typically
+ * the first instructions the processor executes after a
+ * software reset.
  */
-	.data
-GLOBAL(dbstk)
-	.space INTSTK+8			/* kdb stack */
+	.globl	CNAME(rstcode), CNAME(rstsize)
+CNAME(rstcode):
+	bl	1f
+
+	/* We use this space for tracing purposes. */
+	.long	0
+	.long	0
+
+1:
+	mflr	%r2
+	mfmsr	%r3
+	stw	%r2,0(%r2)		/* trace: 0x104 - we're here. */
+	stw	%r3,4(%r2)		/* trace data: MSR */
+	sync
+
+	lis	%r1,(tmpstk+TMPSTKSZ-16)@ha
+	addi	%r1,%r1,(tmpstk+TMPSTKSZ-16)@l
+
+	addi	%r3,%r2,4
+	stw	%r3,0(%r1)
+	sync
+	stw	%r3,0(%r2)		/* trace: 0x108 - stack is writable */
+	stw	%r1,4(%r2)		/* trace data: SP */
+	sync
+
+	mr	%r3,%r2
+	lis	%r4,1 at l
+	bla	CNAME(pmap_cpu_bootstrap)
+
+	addi	%r3,%r2,8
+	stw	%r3,0(%r2)		/* trace 0x10c - back from 1st call */
+	sync
+
+	mr	%r3,%r2
+	bla	CNAME(cpudep_ap_bootstrap)
+	mr	%r1,%r3
+
+	addi    %r3,%r2,12
+	stw     %r3,0(%r2)              /* trace 0x110 - back from 2nd call */
+	stw	%r1,4(%r2)		/* trace data: SP */
+
+	mr	%r3,%r2
+	bla	CNAME(machdep_ap_bootstrap)
+
+	/* Should not be reached */
+9:
+	b	9b
+CNAME(rstsize) = . - CNAME(rstcode)
 #endif
 
 /*
  * This code gets copied to all the trap vectors
  * (except ISI/DSI, ALI, and the interrupts)
  */
-	.text
+
 	.globl	CNAME(trapcode),CNAME(trapsize)
 CNAME(trapcode):
 	mtsprg1	%r1			/* save SP */
@@ -385,8 +432,8 @@
 	stw	%r30,(PC_DBSAVE  +CPUSAVE_R30)(%r1) /* save r30 */
 	lwz	%r31,(PC_DISISAVE+CPUSAVE_R31)(%r1) /* get  r31 */
 	stw	%r31,(PC_DBSAVE  +CPUSAVE_R31)(%r1) /* save r31 */
-	lis	%r1,dbstk+INTSTK at ha	/* get new SP */
-	addi	%r1,%r1,dbstk+INTSTK at l
+	lis	%r1,(tmpstk+TMPSTKSZ-16)@ha	/* get new SP */
+	addi	%r1,%r1,(tmpstk+TMPSTKSZ-16)@l
 	b	dbtrap
 #endif
 
@@ -457,8 +504,8 @@
 /*
  * Deliberate entry to dbtrap
  */
-	.globl	CNAME(ppc_db_trap)
-CNAME(ppc_db_trap):
+	.globl	CNAME(breakpoint)
+CNAME(breakpoint):
 	mtsprg1	%r1
 	mfmsr	%r3
 	mtsrr1	%r3
@@ -533,8 +580,8 @@
         stw	%r30,(PC_DBSAVE+CPUSAVE_R30)(%r1)	/* free r30 */
         stw	%r31,(PC_DBSAVE+CPUSAVE_R31)(%r1)	/* free r31 */
         mflr	%r28					/* save LR */
-	lis	%r1,dbstk+INTSTK at ha	/* get new SP */
-	addi	%r1,%r1,dbstk+INTSTK at l
+	lis	%r1,(tmpstk+TMPSTKSZ-16)@ha	/* get new SP */
+	addi	%r1,%r1,(tmpstk+TMPSTKSZ-16)@l
 	bla	dbtrap
 CNAME(dbsize) = .-CNAME(dblow)
 #endif /* KDB */

==== //depot/projects/e500/sys/powerpc/aim/vm_machdep.c#11 (text+ko) ====

@@ -38,7 +38,7 @@
  *
  *	from: @(#)vm_machdep.c	7.3 (Berkeley) 5/13/91
  *	Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
- * $FreeBSD: src/sys/powerpc/aim/vm_machdep.c,v 1.120 2008/03/12 10:12:00 jeff Exp $
+ * $FreeBSD: src/sys/powerpc/aim/vm_machdep.c,v 1.121 2008/04/27 22:33:42 marcel Exp $
  */
 /*-
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -192,15 +192,6 @@
 {
 }
 
-/* Temporary helper */
-void
-cpu_throw(struct thread *old, struct thread *new)
-{
-
-	cpu_switch(old, new, old->td_lock);
-	panic("cpu_throw() didn't");
-}
-
 /*
  * Reset back to firmware.
  */

==== //depot/projects/e500/sys/powerpc/booke/pmap.c#15 (text+ko) ====

@@ -50,7 +50,7 @@
   */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/powerpc/booke/pmap.c,v 1.1 2008/03/03 17:17:00 raj Exp $");
+__FBSDID("$FreeBSD: src/sys/powerpc/booke/pmap.c,v 1.2 2008/04/27 21:04:54 marcel Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -379,20 +379,6 @@
 };
 MMU_DEF(booke_mmu);
 
-/*
- * This routine defines the region(s) of memory that should
- * not be tested for the modified bit.
- */
-static __inline int
-track_modified_needed(pmap_t pmap, vm_offset_t va)
-{
-
-	if (pmap == kernel_pmap)
-		return ((va < kmi.clean_sva) || (va >= kmi.clean_eva));
-	else
-		return (1);
-}
-
 /* Return number of entries in TLB0. */
 static __inline void
 tlb0_get_tlbconf(void)
@@ -780,10 +766,8 @@
 		if (PTE_ISMANAGED(pte)) {
 
 			/* Handle modified pages. */
-			if (PTE_ISMODIFIED(pte)) {
-				if (track_modified_needed(pmap, va))
-					vm_page_dirty(m);
-			}
+			if (PTE_ISMODIFIED(pte))
+				vm_page_dirty(m);
 
 			/* Referenced pages. */
 			if (PTE_ISREFERENCED(pte))
@@ -1487,10 +1471,8 @@
 				pte->flags |= PTE_UW;
 		} else {
 			/* Handle modified pages, sense modify status. */
-			if (PTE_ISMODIFIED(pte)) {
-				if (track_modified_needed(pmap, va))
-					vm_page_dirty(m);
-			}
+			if (PTE_ISMODIFIED(pte))
+				vm_page_dirty(m);
 		}
 
 		/* If we're turning on execute permissions, flush the icache. */
@@ -1809,10 +1791,8 @@
 				m = PHYS_TO_VM_PAGE(PTE_PA(pte));
 
 				/* Handle modified pages. */
-				if (PTE_ISMODIFIED(pte)) {
-					if (track_modified_needed(pmap, va))
-						vm_page_dirty(m);
-				}
+				if (PTE_ISMODIFIED(pte))
+					vm_page_dirty(m);
 
 				/* Referenced pages. */
 				if (PTE_ISREFERENCED(pte))
@@ -1850,11 +1830,8 @@
 				m = PHYS_TO_VM_PAGE(PTE_PA(pte));
 
 				/* Handle modified pages. */
-				if (PTE_ISMODIFIED(pte)) {
-					if (track_modified_needed(pv->pv_pmap,
-					    pv->pv_va))
-						vm_page_dirty(m);
-				}
+				if (PTE_ISMODIFIED(pte))
+					vm_page_dirty(m);
 
 				/* Referenced pages. */
 				if (PTE_ISREFERENCED(pte))
@@ -2055,9 +2032,6 @@
 			if (!PTE_ISVALID(pte))
 				goto make_sure_to_unlock;
 
-			if (!track_modified_needed(pv->pv_pmap, pv->pv_va))
-				goto make_sure_to_unlock;
-
 			if (PTE_ISMODIFIED(pte)) {
 				PMAP_UNLOCK(pv->pv_pmap);
 				return (TRUE);
@@ -2138,9 +2112,6 @@
 			if (!PTE_ISVALID(pte))
 				goto make_sure_to_unlock;
 
-			if (!track_modified_needed(pv->pv_pmap, pv->pv_va))
-				goto make_sure_to_unlock;
-
 			if (PTE_ISREFERENCED(pte)) {
 				pte->flags &= ~PTE_REFERENCED;
 				tlb0_flush_entry(pv->pv_pmap, pv->pv_va);

==== //depot/projects/e500/sys/powerpc/booke/trap_subr.S#9 (text+ko) ====

@@ -26,7 +26,7 @@
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/powerpc/booke/trap_subr.S,v 1.1 2008/03/03 17:17:00 raj Exp $
+ * $FreeBSD: src/sys/powerpc/booke/trap_subr.S,v 1.2 2008/04/27 22:33:42 marcel Exp $
  */
 /*-
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -795,8 +795,8 @@
 /*
  * Deliberate entry to dbtrap
  */
-	.globl	CNAME(ppc_db_trap)
-CNAME(ppc_db_trap):
+	.globl	CNAME(breakpoint)
+CNAME(breakpoint):
 	mtsprg1	%r1
 	mfmsr	%r3
 	mtsrr1	%r3

==== //depot/projects/e500/sys/powerpc/conf/NOTES#12 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/powerpc/conf/NOTES,v 1.16 2008/03/04 03:05:53 marcel Exp $
+# $FreeBSD: src/sys/powerpc/conf/NOTES,v 1.17 2008/04/27 22:33:42 marcel Exp $
 #
 # This file contains machine dependent kernel configuration notes.  For
 # machine independent notes, look in /sys/conf/NOTES.
@@ -61,8 +61,6 @@
 #####################################################################
 # Options we don't want to deal with
 
-nooption 	SMP
-nooption 	ADAPTIVE_SX
 nooption	PPC_DEBUG
 nooption	PPC_PROBE_CHIPSET
 nooption 	SC_NO_MODE_CHANGE

==== //depot/projects/e500/sys/powerpc/include/cpufunc.h#3 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/powerpc/include/cpufunc.h,v 1.23 2008/04/27 17:13:22 marcel Exp $
+ * $FreeBSD: src/sys/powerpc/include/cpufunc.h,v 1.24 2008/04/27 22:33:42 marcel Exp $
  */
 
 #ifndef _MACHINE_CPUFUNC_H_
@@ -49,16 +49,8 @@
 struct thread;
 
 #ifdef KDB
-void ppc_db_trap(void);
-#endif
-
-static __inline void
-breakpoint(void)
-{
-#ifdef KDB
-	ppc_db_trap();
+void breakpoint(void);
 #endif
-}
 
 /* CPU register mangling inlines */
 

==== //depot/projects/e500/sys/powerpc/include/pcpu.h#7 (text+ko) ====

@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/powerpc/include/pcpu.h,v 1.26 2008/03/06 16:59:36 marcel Exp $
+ * $FreeBSD: src/sys/powerpc/include/pcpu.h,v 1.27 2008/04/27 22:33:42 marcel Exp $
  */
 
 #ifndef	_MACHINE_PCPU_H_
@@ -40,6 +40,11 @@
 	int		pc_inside_intr;					\
 	struct pmap	*pc_curpmap;		/* current pmap */	\
 	struct thread	*pc_fputhread;		/* current fpu user */  \
+	uintptr_t	pc_hwref;					\
+	uint32_t	pc_pir;						\
+	int		pc_bsp:1;					\
+	int		pc_awake:1;					\
+	uint32_t	pc_ipimask;					\
 	register_t	pc_tempsave[CPUSAVE_LEN];			\
 	register_t	pc_disisave[CPUSAVE_LEN];			\
 	register_t	pc_dbsave[CPUSAVE_LEN];
@@ -112,18 +117,18 @@
 	int		pc_md_placeholder
 #endif
 
-#define PCPUP	((struct pcpu *) powerpc_get_pcpup())
+#define pcpup	((struct pcpu *) powerpc_get_pcpup())
 
-#define	PCPU_GET(member)	(PCPUP->pc_ ## member)
+#define	PCPU_GET(member)	(pcpup->pc_ ## member)
 
 /*
  * XXX The implementation of this operation should be made atomic
  * with respect to preemption.
  */
-#define	PCPU_ADD(member, value)	(PCPUP->pc_ ## member += (value))
+#define	PCPU_ADD(member, value)	(pcpup->pc_ ## member += (value))
 #define	PCPU_INC(member)	PCPU_ADD(member, 1)
-#define	PCPU_PTR(member)	(&PCPUP->pc_ ## member)
-#define	PCPU_SET(member,value)	(PCPUP->pc_ ## member = (value))
+#define	PCPU_PTR(member)	(&pcpup->pc_ ## member)
+#define	PCPU_SET(member,value)	(pcpup->pc_ ## member = (value))
 
 #endif	/* _KERNEL */
 

==== //depot/projects/e500/sys/powerpc/include/smp.h#2 (text+ko) ====

@@ -1,7 +1,64 @@
-/* $FreeBSD: src/sys/powerpc/include/smp.h,v 1.1 2001/06/16 07:14:04 benno Exp $ */
+/*-
+ * Copyright (c) 2008 Marcel Moolenaar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright

>>> TRUNCATED FOR MAIL (1000 lines) <<<


More information about the p4-projects mailing list