From owner-p4-projects Sat Jun 29 10: 9:19 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4ADC537B400; Sat, 29 Jun 2002 10:07:53 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E9A1737B401 for ; Sat, 29 Jun 2002 10:07:52 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4024143E06 for ; Sat, 29 Jun 2002 10:07:52 -0700 (PDT) (envelope-from julian@freebsd.org) Received: from freefall.freebsd.org (perforce@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g5TH7qJU037438 for ; Sat, 29 Jun 2002 10:07:52 -0700 (PDT) (envelope-from julian@freebsd.org) Received: (from perforce@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g5TH7pZ1037435 for perforce@freebsd.org; Sat, 29 Jun 2002 10:07:51 -0700 (PDT) Date: Sat, 29 Jun 2002 10:07:51 -0700 (PDT) Message-Id: <200206291707.g5TH7pZ1037435@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to julian@freebsd.org using -f From: Julian Elischer Subject: PERFORCE change 13597 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=13597 Change 13597 by julian@julian_ref on 2002/06/29 10:07:22 MFC Affected files ... .. //depot/projects/kse/sys/conf/files.powerpc#7 integrate .. //depot/projects/kse/sys/pci/if_ti.c#12 integrate .. //depot/projects/kse/sys/powerpc/include/cpufunc.h#9 integrate .. //depot/projects/kse/sys/powerpc/include/critical.h#2 integrate .. //depot/projects/kse/sys/powerpc/include/in_cksum.h#1 branch .. //depot/projects/kse/sys/powerpc/include/pcb.h#5 integrate .. //depot/projects/kse/sys/powerpc/include/pmap.h#7 integrate .. //depot/projects/kse/sys/powerpc/powerpc/autoconf.c#5 integrate .. //depot/projects/kse/sys/powerpc/powerpc/bcopy.c#2 integrate .. //depot/projects/kse/sys/powerpc/powerpc/clock.c#6 integrate .. //depot/projects/kse/sys/powerpc/powerpc/in_cksum.c#1 branch .. //depot/projects/kse/sys/powerpc/powerpc/interrupt.c#1 branch .. //depot/projects/kse/sys/powerpc/powerpc/locore.s#8 integrate .. //depot/projects/kse/sys/powerpc/powerpc/ofw_machdep.c#4 integrate .. //depot/projects/kse/sys/powerpc/powerpc/pmap.c#17 integrate .. //depot/projects/kse/sys/powerpc/powerpc/swtch.s#13 integrate .. //depot/projects/kse/sys/powerpc/powerpc/trap_subr.S#4 integrate Differences ... ==== //depot/projects/kse/sys/conf/files.powerpc#7 (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.10 2002/05/13 07:53:22 benno Exp $ +# $FreeBSD: src/sys/conf/files.powerpc,v 1.12 2002/06/29 09:50:20 benno Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -21,6 +21,8 @@ powerpc/powerpc/extintr.c standard powerpc/powerpc/fpu.c standard powerpc/powerpc/fuswintr.c standard +powerpc/powerpc/in_cksum.c optional inet +powerpc/powerpc/interrupt.c standard powerpc/powerpc/machdep.c standard powerpc/powerpc/nexus.c standard powerpc/powerpc/ofwmagic.s standard ==== //depot/projects/kse/sys/pci/if_ti.c#12 (text+ko) ==== @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/pci/if_ti.c,v 1.61 2002/06/29 02:32:34 peter Exp $ + * $FreeBSD: src/sys/pci/if_ti.c,v 1.62 2002/06/29 11:26:05 alfred Exp $ */ /* @@ -152,7 +152,7 @@ #if !defined(lint) static const char rcsid[] = - "$FreeBSD: src/sys/pci/if_ti.c,v 1.61 2002/06/29 02:32:34 peter Exp $"; + "$FreeBSD: src/sys/pci/if_ti.c,v 1.62 2002/06/29 11:26:05 alfred Exp $"; #endif struct ti_softc *tis[8]; @@ -251,7 +251,7 @@ #ifdef TI_PRIVATE_JUMBOS static int ti_alloc_jumbo_mem (struct ti_softc *); static void *ti_jalloc (struct ti_softc *); -static void ti_jfree (caddr_t, void *); +static void ti_jfree (void *, void *); #endif /* TI_PRIVATE_JUMBOS */ static int ti_newbuf_std (struct ti_softc *, int, struct mbuf *); static int ti_newbuf_mini (struct ti_softc *, int, struct mbuf *); @@ -1077,7 +1077,7 @@ * Release a jumbo buffer. */ static void ti_jfree(buf, args) - caddr_t buf; + void *buf; void *args; { struct ti_softc *sc; ==== //depot/projects/kse/sys/powerpc/include/cpufunc.h#9 (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.13 2002/04/16 11:45:09 benno Exp $ + * $FreeBSD: src/sys/powerpc/include/cpufunc.h,v 1.14 2002/06/29 10:00:07 benno Exp $ */ #ifndef _MACHINE_CPUFUNC_H_ @@ -102,6 +102,13 @@ } static __inline void +eieio(void) +{ + + __asm __volatile ("eieio"); +} + +static __inline void isync(void) { ==== //depot/projects/kse/sys/powerpc/include/critical.h#2 (text+ko) ==== @@ -12,7 +12,7 @@ * related support functions residing * in //critical.c - prototyped * - * $FreeBSD: src/sys/powerpc/include/critical.h,v 1.1 2002/04/01 23:51:22 dillon Exp $ + * $FreeBSD: src/sys/powerpc/include/critical.h,v 1.2 2002/06/29 09:55:57 benno Exp $ */ #ifndef _MACHINE_CRITICAL_H_ @@ -43,7 +43,7 @@ msr = mfmsr(); td->td_md.md_savecrit = msr; - msr &= ~(PSL_EE | PSL_RI); + msr &= ~PSL_EE; mtmsr(msr); } ==== //depot/projects/kse/sys/powerpc/include/pcb.h#5 (text+ko) ==== @@ -29,7 +29,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $NetBSD: pcb.h,v 1.4 2000/06/04 11:57:17 tsubai Exp $ - * $FreeBSD: src/sys/powerpc/include/pcb.h,v 1.4 2002/05/13 07:44:42 benno Exp $ + * $FreeBSD: src/sys/powerpc/include/pcb.h,v 1.5 2002/06/29 09:39:43 benno Exp $ */ #ifndef _MACHINE_PCB_H_ @@ -38,7 +38,7 @@ typedef int faultbuf[23]; struct pcb { - register_t pcb_context[18]; /* non-volatile r14-r31 */ + register_t pcb_context[20]; /* non-volatile r14-r31 */ register_t pcb_cr; /* Condition register */ register_t pcb_sp; /* stack pointer */ register_t pcb_lr; /* link register */ ==== //depot/projects/kse/sys/powerpc/include/pmap.h#7 (text+ko) ==== @@ -29,7 +29,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $NetBSD: pmap.h,v 1.17 2000/03/30 16:18:24 jdolecek Exp $ - * $FreeBSD: src/sys/powerpc/include/pmap.h,v 1.6 2002/04/29 07:43:15 peter Exp $ + * $FreeBSD: src/sys/powerpc/include/pmap.h,v 1.8 2002/06/29 09:47:06 benno Exp $ */ #ifndef _MACHINE_PMAP_H_ @@ -68,11 +68,15 @@ #ifdef _KERNEL void pmap_bootstrap(vm_offset_t, vm_offset_t); +void *pmap_mapdev(vm_offset_t, vm_size_t); +void pmap_unmapdev(vm_offset_t, vm_size_t); void pmap_deactivate(struct thread *); vm_offset_t pmap_kextract(vm_offset_t); int pmap_pte_spill(vm_offset_t); +#define vtophys(va) pmap_kextract(((vm_offset_t)(va))) + extern vm_offset_t avail_start; extern vm_offset_t avail_end; extern vm_offset_t phys_avail[]; ==== //depot/projects/kse/sys/powerpc/powerpc/autoconf.c#5 (text+ko) ==== @@ -26,7 +26,7 @@ #ifndef lint static const char rcsid[] = - "$FreeBSD: src/sys/powerpc/powerpc/autoconf.c,v 1.8 2002/03/31 07:15:27 phk Exp $"; + "$FreeBSD: src/sys/powerpc/powerpc/autoconf.c,v 1.9 2002/06/29 09:33:18 benno Exp $"; #endif #include "opt_bootp.h" @@ -60,6 +60,23 @@ static void configure(void *); SYSINIT(configure, SI_SUB_CONFIGURE, SI_ORDER_THIRD, configure, NULL) +#ifdef NFS_ROOT +SYSINIT(cpu_rootconf, SI_SUB_ROOT_CONF, SI_ORDER_FIRST, cpu_rootconf, NULL) + +#ifndef BOOTP_NFSROOT +#error "NFS_ROOT support not implemented for the non-BOOTP_NFSROOT case" +#endif + +extern void bootpc_init(void); + +void +cpu_rootconf() +{ + + bootpc_init(); + rootdevnames[0] = "nfs:"; +} +#endif /* * Determine i/o configuration for a machine. ==== //depot/projects/kse/sys/powerpc/powerpc/bcopy.c#2 (text+ko) ==== @@ -44,7 +44,7 @@ #endif /* LIBC_SCCS and not lint */ #ifndef lint static char *rcsid = - "$FreeBSD: src/sys/powerpc/powerpc/bcopy.c,v 1.1 2001/06/10 02:39:37 benno Exp $"; + "$FreeBSD: src/sys/powerpc/powerpc/bcopy.c,v 1.2 2002/06/29 09:34:54 benno Exp $"; #endif #include @@ -152,3 +152,10 @@ memcpy(dst0, src0, length); } + +void +ovbcopy(const void *src0, void *dst0, size_t length) +{ + + memcpy(dst0, src0, length); +} ==== //depot/projects/kse/sys/powerpc/powerpc/clock.c#6 (text+ko) ==== @@ -57,7 +57,7 @@ #ifndef lint static const char rcsid[] = - "$FreeBSD: src/sys/powerpc/powerpc/clock.c,v 1.8 2002/04/30 19:34:31 phk Exp $"; + "$FreeBSD: src/sys/powerpc/powerpc/clock.c,v 1.9 2002/06/29 09:28:21 benno Exp $"; #endif /* not lint */ #include @@ -83,7 +83,8 @@ /* * Initially we assume a processor with a bus frequency of 12.5 MHz. */ -static u_long ticks_per_sec = 12500000; +u_int tickspending; +static u_long ticks_per_sec = 12500000; static u_long ns_per_tick = 80; static long ticks_per_intr; static volatile u_long lasttb; @@ -189,28 +190,25 @@ */ lasttb = tb + tick - ticks_per_intr; - /* - * This probably needs some kind of locking. - */ - - intrcnt[CNT_CLOCK]++; - 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(frame); } +#endif hardclock(frame); } ==== //depot/projects/kse/sys/powerpc/powerpc/locore.s#8 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/powerpc/powerpc/locore.s,v 1.10 2002/04/29 12:14:31 benno Exp $ */ +/* $FreeBSD: src/sys/powerpc/powerpc/locore.s,v 1.12 2002/06/29 09:31:27 benno Exp $ */ /* $NetBSD: locore.S,v 1.24 2000/05/31 05:09:17 thorpej Exp $ */ /* @@ -82,41 +82,7 @@ .space 8208 GLOBAL(esym) .long 0 /* end of symbol table */ -GLOBAL(proc0paddr) - .long 0 /* proc0 p_addr */ -GLOBAL(PTmap) - .long 0 /* PTmap */ -GLOBAL(decrnest) - .long 0 -GLOBAL(intrnames) - .asciz "irq0", "irq1", "irq2", "irq3" - .asciz "irq4", "irq5", "irq6", "irq7" - .asciz "irq8", "irq9", "irq10", "irq11" - .asciz "irq12", "irq13", "irq14", "irq15" - .asciz "irq16", "irq17", "irq18", "irq19" - .asciz "irq20", "irq21", "irq22", "irq23" - .asciz "irq24", "irq25", "irq26", "irq27" - .asciz "irq28", "irq29", "irq30", "irq31" - .asciz "irq32", "irq33", "irq34", "irq35" - .asciz "irq36", "irq37", "irq38", "irq39" - .asciz "irq40", "irq41", "irq42", "irq43" - .asciz "irq44", "irq45", "irq46", "irq47" - .asciz "irq48", "irq49", "irq50", "irq51" - .asciz "irq52", "irq53", "irq54", "irq55" - .asciz "irq56", "irq57", "irq58", "irq59" - .asciz "irq60", "irq61", "irq62", "irq63" - .asciz "clock", "softclock", "softnet", "softserial" -GLOBAL(eintrnames) - .align 4 -GLOBAL(intrcnt) - .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - .long 0,0,0,0 -GLOBAL(eintrcnt) - GLOBAL(ofmsr) .long 0 /* msr used in Open Firmware */ @@ -204,196 +170,14 @@ lis 4,end@ha addi 4,4,end@l mr 5,4 - li 9,PAGE_MASK - add 4,4,9 - andc 4,4,9 - lis 9,OF_buf@ha - stw 4,OF_buf@l(9) - addi 4,4,PAGE_SIZE - lis 9,proc0paddr@ha - stw 4,proc0paddr@l(9) - addi 4,4,USPACE-FRAMELEN - mr 1,4 - xor 0,0,0 - stwu 0,-16(1) lis 3,kernel_text@ha addi 3,3,kernel_text@l -#if 0 - mr 5,6 -#endif bl powerpc_init bl mi_startup b OF_exit -#if 0 /* XXX: We may switch back to this in the future. */ -/* - * OpenFirmware entry point - */ -ENTRY(openfirmware) - mflr 0 /* save return address */ - stw 0,4(1) - stwu 1,-16(1) /* setup stack frame */ - - mfmsr 4 /* save msr */ - stw 4,8(1) - - lis 4,openfirmware_entry@ha /* get firmware entry point */ - lwz 4,openfirmware_entry@l(4) - mtlr 4 - - li 0,0 /* clear battable translations */ - mtdbatu 2,0 - mtdbatu 3,0 - mtibatu 2,0 - mtibatu 3,0 - - lis 4,ofmsr@ha /* Open Firmware msr */ - lwz 4,ofmsr@l(4) - mtmsr 4 - isync - - lis 4,srsave@ha /* save old SR */ - addi 4,4,srsave@l - li 5,0 -1: mfsrin 0,5 - stw 0,0(4) - addi 4,4,4 - addis 5,5,0x10000000@h - cmpwi 5,0 - bne 1b - - lis 4,ofw_pmap@ha /* load OFW SR */ - addi 4,4,ofw_pmap@l - lwz 0,PM_KERNELSR(4) - cmpwi 0,0 /* pm_sr[KERNEL_SR] == 0? */ - beq 2f /* then skip (not initialized yet) */ - li 5,0 -1: lwz 0,0(4) - mtsrin 0,5 - addi 4,4,4 - addis 5,5,0x10000000@h - cmpwi 5,0 - bne 1b -2: - blrl /* call Open Firmware */ - - mfmsr 4 - li 5,PSL_IR|PSL_DR - andc 4,4,5 - mtmsr 4 - isync - - lis 4,srsave@ha /* restore saved SR */ - addi 4,4,srsave@l - li 5,0 -1: lwz 0,0(4) - mtsrin 0,5 - addi 4,4,4 - addis 5,5,0x10000000@h - cmpwi 5,0 - bne 1b - - lwz 4,8(1) /* restore msr */ - mtmsr 4 - isync - - lwz 1,0(1) /* and return */ - lwz 0,4(1) - mtlr 0 - blr -#endif - -/* - * Switch to/from OpenFirmware real mode stack - * - * Note: has to be called as the very first thing in OpenFirmware interface - * routines. - * E.g.: - * int - * OF_xxx(arg1, arg2) - * type arg1, arg2; - * { - * static struct { - * char *name; - * int nargs; - * int nreturns; - * char *method; - * int arg1; - * int arg2; - * int ret; - * } args = { - * "xxx", - * 2, - * 1, - * }; - * - * ofw_stack(); - * args.arg1 = arg1; - * args.arg2 = arg2; - * if (openfirmware(&args) < 0) - * return -1; - * return args.ret; - * } - */ - - .local firmstk - .comm firmstk,PAGE_SIZE,8 - -ENTRY(ofw_stack) - mfmsr 8 /* turn off interrupts */ - andi. 0,8,~(PSL_EE|PSL_RI)@l - mtmsr 0 - stw 8,4(1) /* abuse return address slot */ - - lwz 5,0(1) /* get length of stack frame */ - subf 5,1,5 - - lis 7,firmstk+PAGE_SIZE-8@ha - addi 7,7,firmstk+PAGE_SIZE-8@l - lis 6,ofw_back@ha - addi 6,6,ofw_back@l - subf 4,5,7 /* make room for stack frame on - new stack */ - stw 6,-4(7) /* setup return pointer */ - stwu 1,-8(7) - - stw 7,-8(4) - - addi 3,1,8 - addi 1,4,-8 - subi 5,5,8 - - cmpw 3,4 - beqlr - - mr 0,5 - addi 5,5,-1 - cmpwi 0,0 - beqlr - -1: lwz 0,0(3) - stw 0,0(4) - addi 3,3,1 - addi 4,4,1 - mr 0,5 - addi 5,5,-1 - cmpwi 0,0 - bne 1b - blr - -ofw_back: - lwz 1,0(1) /* get callers original stack pointer */ - - lwz 0,4(1) /* get saved msr from abused slot */ - mtmsr 0 - - lwz 1,0(1) /* return */ - lwz 0,4(1) - mtlr 0 - blr - /* * int setfault() * ==== //depot/projects/kse/sys/powerpc/powerpc/ofw_machdep.c#4 (text+ko) ==== @@ -33,7 +33,7 @@ #ifndef lint static const char rcsid[] = - "$FreeBSD: src/sys/powerpc/powerpc/ofw_machdep.c,v 1.3 2002/05/27 11:18:12 benno Exp $"; + "$FreeBSD: src/sys/powerpc/powerpc/ofw_machdep.c,v 1.4 2002/06/29 09:16:30 benno Exp $"; #endif /* not lint */ #include @@ -53,6 +53,7 @@ #include #include +#include #define OFMEM_REGIONS 32 static struct mem_region OFmem[OFMEM_REGIONS + 1], OFavail[OFMEM_REGIONS + 3]; @@ -106,43 +107,8 @@ long oldmsr; int result; u_int srsave[16]; - - if (pmap_bootstrapped) { - __asm __volatile("mfsr %0,0" : "=r"(srsave[0])); - __asm __volatile("mfsr %0,1" : "=r"(srsave[1])); - __asm __volatile("mfsr %0,2" : "=r"(srsave[2])); - __asm __volatile("mfsr %0,3" : "=r"(srsave[3])); - __asm __volatile("mfsr %0,4" : "=r"(srsave[4])); - __asm __volatile("mfsr %0,5" : "=r"(srsave[5])); - __asm __volatile("mfsr %0,6" : "=r"(srsave[6])); - __asm __volatile("mfsr %0,7" : "=r"(srsave[7])); - __asm __volatile("mfsr %0,8" : "=r"(srsave[8])); - __asm __volatile("mfsr %0,9" : "=r"(srsave[9])); - __asm __volatile("mfsr %0,10" : "=r"(srsave[10])); - __asm __volatile("mfsr %0,11" : "=r"(srsave[11])); - __asm __volatile("mfsr %0,12" : "=r"(srsave[12])); - __asm __volatile("mfsr %0,13" : "=r"(srsave[13])); - __asm __volatile("mfsr %0,14" : "=r"(srsave[14])); - __asm __volatile("mfsr %0,15" : "=r"(srsave[15])); + u_int i; - __asm __volatile("mtsr 0,%0" :: "r"(ofw_pmap.pm_sr[0])); - __asm __volatile("mtsr 1,%0" :: "r"(ofw_pmap.pm_sr[1])); - __asm __volatile("mtsr 2,%0" :: "r"(ofw_pmap.pm_sr[2])); - __asm __volatile("mtsr 3,%0" :: "r"(ofw_pmap.pm_sr[3])); - __asm __volatile("mtsr 4,%0" :: "r"(ofw_pmap.pm_sr[4])); - __asm __volatile("mtsr 5,%0" :: "r"(ofw_pmap.pm_sr[5])); - __asm __volatile("mtsr 6,%0" :: "r"(ofw_pmap.pm_sr[6])); - __asm __volatile("mtsr 7,%0" :: "r"(ofw_pmap.pm_sr[7])); - __asm __volatile("mtsr 8,%0" :: "r"(ofw_pmap.pm_sr[8])); - __asm __volatile("mtsr 9,%0" :: "r"(ofw_pmap.pm_sr[9])); - __asm __volatile("mtsr 10,%0" :: "r"(ofw_pmap.pm_sr[10])); - __asm __volatile("mtsr 11,%0" :: "r"(ofw_pmap.pm_sr[11])); - __asm __volatile("mtsr 12,%0" :: "r"(ofw_pmap.pm_sr[12])); - __asm __volatile("mtsr 13,%0" :: "r"(ofw_pmap.pm_sr[13])); - __asm __volatile("mtsr 14,%0" :: "r"(ofw_pmap.pm_sr[14])); - __asm __volatile("mtsr 15,%0" :: "r"(ofw_pmap.pm_sr[15])); - } - __asm __volatile( "\t" "sync\n\t" "mfmsr %0\n\t" @@ -152,35 +118,37 @@ : "r" (ofmsr) ); + if (pmap_bootstrapped) { + /* + * Swap the kernel's address space with OpenFirmware's + */ + for (i = 0; i < 16; i++) { + srsave[i] = mfsrin(i << ADDR_SR_SHFT); + mtsrin(i << ADDR_SR_SHFT, ofw_pmap.pm_sr[i]); + } + isync(); + } + result = ofwcall(args); + if (pmap_bootstrapped) { + /* + * Restore the kernel's addr space. The isync() doesn;t + * work outside the loop unless mtsrin() is open-coded + * in an asm statement :( + */ + for (i = 0; i < 16; i++) { + mtsrin(i << ADDR_SR_SHFT, srsave[i]); + isync(); + } + } + __asm( "\t" "mtmsr %0\n\t" "isync\n" : : "r" (oldmsr) ); - if (pmap_bootstrapped) { - __asm __volatile("mtsr 0,%0" :: "r"(srsave[0])); - __asm __volatile("mtsr 1,%0" :: "r"(srsave[1])); - __asm __volatile("mtsr 2,%0" :: "r"(srsave[2])); - __asm __volatile("mtsr 3,%0" :: "r"(srsave[3])); - __asm __volatile("mtsr 4,%0" :: "r"(srsave[4])); - __asm __volatile("mtsr 5,%0" :: "r"(srsave[5])); - __asm __volatile("mtsr 6,%0" :: "r"(srsave[6])); - __asm __volatile("mtsr 7,%0" :: "r"(srsave[7])); - __asm __volatile("mtsr 8,%0" :: "r"(srsave[8])); - __asm __volatile("mtsr 9,%0" :: "r"(srsave[9])); - __asm __volatile("mtsr 10,%0" :: "r"(srsave[10])); - __asm __volatile("mtsr 11,%0" :: "r"(srsave[11])); - __asm __volatile("mtsr 12,%0" :: "r"(srsave[12])); - __asm __volatile("mtsr 13,%0" :: "r"(srsave[13])); - __asm __volatile("mtsr 14,%0" :: "r"(srsave[14])); - __asm __volatile("mtsr 15,%0" :: "r"(srsave[15])); - __asm __volatile("sync"); - } - - return (result); } ==== //depot/projects/kse/sys/powerpc/powerpc/pmap.c#17 (text+ko) ==== @@ -92,7 +92,7 @@ #ifndef lint static const char rcsid[] = - "$FreeBSD: src/sys/powerpc/powerpc/pmap.c,v 1.37 2002/05/28 07:38:55 benno Exp $"; + "$FreeBSD: src/sys/powerpc/powerpc/pmap.c,v 1.39 2002/06/29 09:45:59 benno Exp $"; #endif /* not lint */ /* @@ -250,10 +250,9 @@ static vm_object_t pmap_pvo_obj; static u_int pmap_pvo_count; -#define PMAP_PVO_SIZE 1024 +#define BPVO_POOL_SIZE 32768 static struct pvo_entry *pmap_bpvo_pool; -static int pmap_bpvo_pool_index; -static int pmap_bpvo_pool_count; +static int pmap_bpvo_pool_index = 0; #define VSID_NBPW (sizeof(u_int32_t) * 8) static u_int pmap_vsid_bitmap[NPMAPS / VSID_NBPW]; @@ -541,6 +540,33 @@ vm_offset_t pa, va, off; u_int batl, batu; + /* + * Set up BAT0 to only map the lowest 256 MB area + */ + battable[0x0].batl = BATL(0x00000000, BAT_M, BAT_PP_RW); + battable[0x0].batu = BATU(0x00000000, BAT_BL_256M, BAT_Vs); + + /* + * Map PCI memory space. + */ + battable[0x8].batl = BATL(0x80000000, BAT_I|BAT_G, BAT_PP_RW); + battable[0x8].batu = BATU(0x80000000, BAT_BL_256M, BAT_Vs); + + battable[0x9].batl = BATL(0x90000000, BAT_I|BAT_G, BAT_PP_RW); + battable[0x9].batu = BATU(0x90000000, BAT_BL_256M, BAT_Vs); + + battable[0xa].batl = BATL(0xa0000000, BAT_I|BAT_G, BAT_PP_RW); + battable[0xa].batu = BATU(0xa0000000, BAT_BL_256M, BAT_Vs); + + battable[0xb].batl = BATL(0xb0000000, BAT_I|BAT_G, BAT_PP_RW); + battable[0xb].batu = BATU(0xb0000000, BAT_BL_256M, BAT_Vs); + + /* + * Map obio devices. + */ + battable[0xf].batl = BATL(0xf0000000, BAT_I|BAT_G, BAT_PP_RW); + battable[0xf].batu = BATU(0xf0000000, BAT_BL_256M, BAT_Vs); + /* * Use an IBAT and a DBAT to map the bottom segment of memory * where we are. @@ -549,10 +575,20 @@ batl = BATL(0x00000000, BAT_M, BAT_PP_RW); __asm ("mtibatu 0,%0; mtibatl 0,%1; mtdbatu 0,%0; mtdbatl 0,%1" :: "r"(batu), "r"(batl)); + #if 0 + /* map frame buffer */ + batu = BATU(0x90000000, BAT_BL_256M, BAT_Vs); + batl = BATL(0x90000000, BAT_I|BAT_G, BAT_PP_RW); + __asm ("mtdbatu 1,%0; mtdbatl 1,%1" + :: "r"(batu), "r"(batl)); +#endif + +#if 1 + /* map pci space */ batu = BATU(0x80000000, BAT_BL_256M, BAT_Vs); - batl = BATL(0x80000000, BAT_M, BAT_PP_RW); - __asm ("mtibatu 1,%0; mtibatl 1,%1; mtdbatu 1,%0; mtdbatl 1,%1" + batl = BATL(0x80000000, BAT_I|BAT_G, BAT_PP_RW); + __asm ("mtdbatu 1,%0; mtdbatl 1,%1" :: "r"(batu), "r"(batl)); #endif @@ -629,9 +665,9 @@ /* * Initialise the unmanaged pvo pool. */ - pmap_bpvo_pool = (struct pvo_entry *)pmap_bootstrap_alloc(PAGE_SIZE, 0); + pmap_bpvo_pool = (struct pvo_entry *)pmap_bootstrap_alloc( + BPVO_POOL_SIZE*sizeof(struct pvo_entry), 0); pmap_bpvo_pool_index = 0; - pmap_bpvo_pool_count = (int)PAGE_SIZE / sizeof(struct pvo_entry); /* * Make sure kernel vsid is allocated as well as VSID 0. @@ -984,25 +1020,25 @@ { CTR0(KTR_PMAP, "pmap_init"); -} -void -pmap_init2(void) -{ - - CTR0(KTR_PMAP, "pmap_init2"); - pmap_pvo_obj = vm_object_allocate(OBJT_PHYS, 16); pmap_pvo_count = 0; pmap_upvo_zone = uma_zcreate("UPVO entry", sizeof (struct pvo_entry), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM); uma_zone_set_allocf(pmap_upvo_zone, pmap_pvo_allocf); pmap_mpvo_zone = uma_zcreate("MPVO entry", sizeof(struct pvo_entry), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM); uma_zone_set_allocf(pmap_mpvo_zone, pmap_pvo_allocf); pmap_initialized = TRUE; } +void +pmap_init2(void) +{ + + CTR0(KTR_PMAP, "pmap_init2"); +} + boolean_t pmap_is_modified(vm_page_t m) { @@ -1778,10 +1814,10 @@ if (pmap_initialized) { pvo = uma_zalloc(zone, M_NOWAIT); } else { - if (pmap_bpvo_pool_index >= pmap_bpvo_pool_count) { - pmap_bpvo_pool = (struct pvo_entry *) - pmap_bootstrap_alloc(PAGE_SIZE, 0); - pmap_bpvo_pool_index = 0; + if (pmap_bpvo_pool_index >= BPVO_POOL_SIZE) { + panic("pmap_enter: bpvo pool exhausted, %d, %d, %d", + pmap_bpvo_pool_index, BPVO_POOL_SIZE, + BPVO_POOL_SIZE * sizeof(struct pvo_entry)); } pvo = &pmap_bpvo_pool[pmap_bpvo_pool_index]; pmap_bpvo_pool_index++; @@ -2236,3 +2272,46 @@ return ((rv & ptebit) != 0); } + +/* + * Map a set of physical memory pages into the kernel virtual + * address space. Return a pointer to where it is mapped. This + * routine is intended to be used for mapping device memory, + * NOT real memory. + */ +void * +pmap_mapdev(vm_offset_t pa, vm_size_t size) +{ + vm_offset_t va, tmpva, offset; + + pa = trunc_page(pa); + offset = pa & PAGE_MASK; + size = roundup(offset + size, PAGE_SIZE); + + GIANT_REQUIRED; + + va = kmem_alloc_pageable(kernel_map, size); + if (!va) + panic("pmap_mapdev: Couldn't alloc kernel virtual memory"); + + for (tmpva = va; size > 0;) { + pmap_kenter(tmpva, pa); + TLBIE(tmpva); /* XXX or should it be invalidate-all ? */ + size -= PAGE_SIZE; + tmpva += PAGE_SIZE; + pa += PAGE_SIZE; + } + + return ((void *)(va + offset)); +} + +void +pmap_unmapdev(vm_offset_t va, vm_size_t size) +{ + vm_offset_t base, offset; + + base = trunc_page(va); + offset = va & PAGE_MASK; + size = roundup(offset + size, PAGE_SIZE); + kmem_free(kernel_map, base, size); +} ==== //depot/projects/kse/sys/powerpc/powerpc/swtch.s#13 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/powerpc/powerpc/swtch.s,v 1.13 2002/05/09 14:13:29 benno Exp $ */ +/* $FreeBSD: src/sys/powerpc/powerpc/swtch.s,v 1.14 2002/06/29 09:39:44 benno Exp $ */ /* $NetBSD: locore.S,v 1.24 2000/05/31 05:09:17 thorpej Exp $ */ /* @@ -75,9 +75,10 @@ lwz %r4,PC_CURTHREAD(%r3) /* Get the current thread */ lwz %r3,TD_PCB(%r4) /* Get a pointer to the PCB */ - stmw %r14,PCB_CONTEXT(%r3) /* Save the non-volatile GP regs */ - mr %r14,%r3 /* Copy the curthread pointer */ - mr %r15,%r4 /* ... and the current pcb pointer */ + mr %r12,%r2 + stmw %r12,PCB_CONTEXT(%r3) /* Save the non-volatile GP regs */ + mr %r14,%r3 /* Copy the current pcb pointer */ + mr %r15,%r4 /* ... and the curthread pointer */ mfcr %r16 /* Save the condition register */ stw %r16,PCB_CR(%r3) mflr %r16 /* Save the link register */ @@ -106,9 +107,9 @@ mfsprg %r4,0 /* Get the pcpu pointer */ stw %r16,PC_CURTHREAD(%r4) /* Store new current thread */ - lwz %r16,TD_PCB(%r16) /* Grab the new PCB */ + mr %r3,%r16 /* and save in r3 */ + lwz %r16,TD_PCB(%r16) /* Store new current PCB */ stw %r16,PC_CURPCB(%r4) - mr %r4,%r16 #if 0 lwz %r29, PCB_FLAGS(%r4) /* Restore FPU regs if needed */ @@ -118,13 +119,16 @@ bl enable_fpu #endif + /* thread to restore is in r3 */ .L2: - lmw %r14,PCB_CONTEXT(%r4) /* Load the non-volatile GP regs */ - lwz %r5,PCB_CR(%r4) /* Load the condition register */ + lwz %r3, TD_PCB(%r3) + lmw %r12,PCB_CONTEXT(%r3) /* Load the non-volatile GP regs */ + mr %r2,%r12 + lwz %r5,PCB_CR(%r3) /* Load the condition register */ mtcr %r5 - lwz %r5,PCB_LR(%r4) /* Load the link register */ + lwz %r5,PCB_LR(%r3) /* Load the link register */ mtlr %r5 - lwz %r1,PCB_SP(%r4) /* Load the stack pointer */ + lwz %r1,PCB_SP(%r3) /* Load the stack pointer */ blr /* @@ -132,7 +136,8 @@ * Update pcb, saving current processor state */ ENTRY(savectx) - stmw %r14,PCB_CONTEXT(%r3) /* Save the non-volatile GP regs */ + mr %r12,%r2 + stmw %r12,PCB_CONTEXT(%r3) /* Save the non-volatile GP regs */ mfcr %r4 /* Save the condition register */ stw %r4,PCB_CONTEXT(%r3) blr ==== //depot/projects/kse/sys/powerpc/powerpc/trap_subr.S#4 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/powerpc/powerpc/trap_subr.S,v 1.4 2002/05/28 12:31:34 benno Exp $ */ +/* $FreeBSD: src/sys/powerpc/powerpc/trap_subr.S,v 1.5 2002/06/29 09:28:21 benno Exp $ */ /* $NetBSD: trap_subr.S,v 1.20 2002/04/22 23:20:08 kleink Exp $ */ /* @@ -46,8 +46,6 @@ #define EXC_AST 0x3000 .data .align 4 -astpending: - .long 0 cpassert: .asciz "attempting to return from kernel with no current pmap" @@ -275,48 +273,6 @@ CNAME(isi601size)= .-CNAME(isitrap601) /* - * This one for the external interrupt handler. - */ - .globl CNAME(extint),CNAME(extsize) -CNAME(extint): - mtsprg 1,1 /* save SP */ - stmw 28,tempsave(0) /* free r28-r31 */ - mflr 28 /* save LR */ - mfcr 29 /* save CR */ - mfxer 30 /* save XER */ - lis 1,intstk+INTSTK@ha /* get interrupt stack */ - addi 1,1,intstk+INTSTK@l /* this is really intr_depth! */ - lwz 31,0(1) /* were we already running on intstk? */ - addic. 31,31,1 - stw 31,0(1) - beq 1f - mfsprg 1,1 /* yes, get old SP */ -1: - ba extintr -CNAME(extsize) = .-CNAME(extint) - -/* - * And this one for the decrementer interrupt handler. - */ - .globl CNAME(decrint),CNAME(decrsize) -CNAME(decrint): - mtsprg 1,1 /* save SP */ - stmw 28,tempsave(0) /* free r28-r31 */ - mflr 28 /* save LR */ - mfcr 29 /* save CR */ - mfxer 30 /* save XER */ - lis 1,intstk+INTSTK@ha /* get interrupt stack */ - addi 1,1,intstk+INTSTK@l - lwz 31,0(1) /* were we already running on intstk? */ - addic. 31,31,1 - stw 31,0(1) - beq 1f - mfsprg 1,1 /* yes, get old SP */ -1: - ba decrintr -CNAME(decrsize) = .-CNAME(decrint) - -/* * Now the tlb software load for 603 processors: * (Code essentially from the 603e User Manual, Chapter 5, but * corrected a lot.) @@ -579,7 +535,7 @@ mfsrr1 31; \ stmw 30,savearea+24(0); \ mfmsr 30; \ - ori 30,30,(PSL_DR|PSL_IR); \ + ori 30,30,(PSL_DR|PSL_IR)@l; \ mtmsr 30; \ isync; \ mfsprg 31,1; \ >>> TRUNCATED FOR MAIL (1000 lines) <<< To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message