Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Change IBM4xx to use the common powerpc PIC framework.



details:   https://anonhg.NetBSD.org/src/rev/d76ee000147e
branches:  trunk
changeset: 766319:d76ee000147e
user:      matt <matt%NetBSD.org@localhost>
date:      Mon Jun 20 17:44:33 2011 +0000

description:
Change IBM4xx to use the common powerpc PIC framework.
Consolidate most ibm4xx initppc function into ibm4xx_init
and Make all IBM4xx use it.
Change explora to use initppc instead of bootstrap.

diffstat:

 sys/arch/evbppc/conf/files.explora            |    6 +-
 sys/arch/evbppc/conf/files.virtex             |    4 +-
 sys/arch/evbppc/conf/files.walnut             |    3 +-
 sys/arch/evbppc/conf/std.explora              |    4 +-
 sys/arch/evbppc/conf/std.obs405               |    4 +-
 sys/arch/evbppc/conf/std.virtex               |    4 +-
 sys/arch/evbppc/conf/std.walnut               |    4 +-
 sys/arch/evbppc/explora/explora_start.S       |    4 +-
 sys/arch/evbppc/explora/machdep.c             |  153 +----
 sys/arch/evbppc/obs405/obs200_machdep.c       |   28 +-
 sys/arch/evbppc/obs405/obs266_machdep.c       |   28 +-
 sys/arch/evbppc/obs405/obs600_autoconf.c      |    8 +-
 sys/arch/evbppc/obs405/obs600_machdep.c       |   31 +-
 sys/arch/evbppc/virtex/machdep.c              |  147 +----
 sys/arch/evbppc/walnut/machdep.c              |  164 +----
 sys/arch/powerpc/conf/files.ibm4xx            |    5 +-
 sys/arch/powerpc/ibm4xx/clock.c               |   16 +-
 sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c      |  198 ++--
 sys/arch/powerpc/ibm4xx/intr.c                |  891 --------------------------
 sys/arch/powerpc/ibm4xx/pic_uic.c             |  380 +++++++++++
 sys/arch/powerpc/include/ibm4xx/cpu.h         |   19 +-
 sys/arch/powerpc/include/ibm4xx/ibm4xx_intr.h |   96 --
 22 files changed, 568 insertions(+), 1629 deletions(-)

diffs (truncated from 2777 to 300 lines):

diff -r 4d8544801681 -r d76ee000147e sys/arch/evbppc/conf/files.explora
--- a/sys/arch/evbppc/conf/files.explora        Mon Jun 20 17:31:37 2011 +0000
+++ b/sys/arch/evbppc/conf/files.explora        Mon Jun 20 17:44:33 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.explora,v 1.8 2008/02/20 21:43:34 drochner Exp $
+#      $NetBSD: files.explora,v 1.9 2011/06/20 17:44:33 matt Exp $
 
 # maxpartitions must be first item in files.${ARCH}
 
@@ -10,11 +10,13 @@
 defparam       opt_explora.h   COM_CONSOLE_SPEED
 
 include                "arch/powerpc/fpu/files.fpu"
+include                "arch/powerpc/pic/files.pic"
 
 file   arch/evbppc/explora/autoconf.c
 file   arch/evbppc/explora/consinit.c
 file   arch/evbppc/explora/machdep.c
-file   arch/powerpc/ibm4xx/intr.c
+file   arch/powerpc/ibm4xx/ibm4xx_machdep.c
+file   arch/powerpc/ibm4xx/pic_uic.c
 file   dev/md_root.c                           memory_disk_hooks
 
 # Explora local bus
diff -r 4d8544801681 -r d76ee000147e sys/arch/evbppc/conf/files.virtex
--- a/sys/arch/evbppc/conf/files.virtex Mon Jun 20 17:31:37 2011 +0000
+++ b/sys/arch/evbppc/conf/files.virtex Mon Jun 20 17:44:33 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.virtex,v 1.4 2010/03/18 13:47:04 kiyohara Exp $
+#      $NetBSD: files.virtex,v 1.5 2011/06/20 17:44:33 matt Exp $
 #
 # Xilinx Virtex specific configuration
 
@@ -18,6 +18,8 @@
 file   arch/evbppc/virtex/design_gsrd1.c       design_gsrd1
 file   arch/evbppc/virtex/design_gsrd2.c       design_gsrd2 | design_dfc
 
+file   arch/powerpc/ibm4xx/ibm4xx_machdep.c
+
 # Memory Disk for install kernel
 file   dev/md_root.c                           memory_disk_hooks
 
diff -r 4d8544801681 -r d76ee000147e sys/arch/evbppc/conf/files.walnut
--- a/sys/arch/evbppc/conf/files.walnut Mon Jun 20 17:31:37 2011 +0000
+++ b/sys/arch/evbppc/conf/files.walnut Mon Jun 20 17:44:33 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.walnut,v 1.16 2010/03/18 13:47:04 kiyohara Exp $
+#      $NetBSD: files.walnut,v 1.17 2011/06/20 17:44:33 matt Exp $
 #
 # walnut-specific configuration info
 
@@ -6,6 +6,7 @@
 file   arch/evbppc/walnut/consinit.c
 file   arch/evbppc/walnut/machdep.c
 file   arch/powerpc/ibm4xx/ibm4xx_autoconf.c
+file   arch/powerpc/ibm4xx/ibm4xx_machdep.c
 
 # Memory Disk for install kernel
 file   dev/md_root.c                           memory_disk_hooks
diff -r 4d8544801681 -r d76ee000147e sys/arch/evbppc/conf/std.explora
--- a/sys/arch/evbppc/conf/std.explora  Mon Jun 20 17:31:37 2011 +0000
+++ b/sys/arch/evbppc/conf/std.explora  Mon Jun 20 17:44:33 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: std.explora,v 1.4 2005/12/11 12:17:11 christos Exp $
+#      $NetBSD: std.explora,v 1.5 2011/06/20 17:44:33 matt Exp $
 #
 # Standard/required options for NetBSD/explora.
 
@@ -18,7 +18,7 @@
 makeoptions    BOARDTYPE="explora"
 makeoptions    PPCDIR="ibm4xx"
 
-options        PPC_INTR_IMPL="<powerpc/ibm4xx/ibm4xx_intr.h>"
+options        PPC_INTR_IMPL="<powerpc/intr.h>"
 
 options        INTSTK=8192
 
diff -r 4d8544801681 -r d76ee000147e sys/arch/evbppc/conf/std.obs405
--- a/sys/arch/evbppc/conf/std.obs405   Mon Jun 20 17:31:37 2011 +0000
+++ b/sys/arch/evbppc/conf/std.obs405   Mon Jun 20 17:44:33 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: std.obs405,v 1.4 2010/03/18 14:15:38 kiyohara Exp $
+#      $NetBSD: std.obs405,v 1.5 2011/06/20 17:44:33 matt Exp $
 #
 # Standard/required options for NetBSD/obs405.
 
@@ -16,7 +16,7 @@
 makeoptions    BOARDTYPE="obs405"
 makeoptions    PPCDIR="ibm4xx"
 
-options        PPC_INTR_IMPL="<powerpc/ibm4xx/ibm4xx_intr.h>"
+options        PPC_INTR_IMPL="<powerpc/intr.h>"
 options        PPC_PCI_MACHDEP_IMPL="<powerpc/ibm4xx/pci_machdep.h>"
 
 options        INTSTK=16384
diff -r 4d8544801681 -r d76ee000147e sys/arch/evbppc/conf/std.virtex
--- a/sys/arch/evbppc/conf/std.virtex   Mon Jun 20 17:31:37 2011 +0000
+++ b/sys/arch/evbppc/conf/std.virtex   Mon Jun 20 17:44:33 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: std.virtex,v 1.2 2010/03/18 13:47:04 kiyohara Exp $
+#      $NetBSD: std.virtex,v 1.3 2011/06/20 17:44:33 matt Exp $
 #
 # Standard/required options for NetBSD/virtex.
 
@@ -17,7 +17,7 @@
 makeoptions    BOARDTYPE="virtex"
 makeoptions    PPCDIR="ibm4xx"
 
-options        PPC_INTR_IMPL="<powerpc/ibm4xx/ibm4xx_intr.h>"
+options        PPC_INTR_IMPL="<powerpc/intr.h>"
 options        KERNBASE=0x25000
 options        INTSTK=16384
 
diff -r 4d8544801681 -r d76ee000147e sys/arch/evbppc/conf/std.walnut
--- a/sys/arch/evbppc/conf/std.walnut   Mon Jun 20 17:31:37 2011 +0000
+++ b/sys/arch/evbppc/conf/std.walnut   Mon Jun 20 17:44:33 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: std.walnut,v 1.6 2005/12/11 12:17:11 christos Exp $
+#      $NetBSD: std.walnut,v 1.7 2011/06/20 17:44:33 matt Exp $
 #
 # Standard/required options for NetBSD/walnut.
 
@@ -17,7 +17,7 @@
 makeoptions    BOARDTYPE="walnut"
 makeoptions    PPCDIR="ibm4xx"
 
-options        PPC_INTR_IMPL="<powerpc/ibm4xx/ibm4xx_intr.h>"
+options        PPC_INTR_IMPL="<powerpc/intr.h>"
 options        PPC_PCI_MACHDEP_IMPL="<powerpc/ibm4xx/pci_machdep.h>"
 options        KERNBASE=0x25000
 
diff -r 4d8544801681 -r d76ee000147e sys/arch/evbppc/explora/explora_start.S
--- a/sys/arch/evbppc/explora/explora_start.S   Mon Jun 20 17:31:37 2011 +0000
+++ b/sys/arch/evbppc/explora/explora_start.S   Mon Jun 20 17:44:33 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: explora_start.S,v 1.8 2011/01/17 08:23:54 matt Exp $   */
+/*     $NetBSD: explora_start.S,v 1.9 2011/06/20 17:44:33 matt Exp $   */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -188,7 +188,7 @@
        ori     3,3,__start@l
 
 /* Run the remaining setup in C. */
-       bl      _C_LABEL(bootstrap)
+       bl      _C_LABEL(initppc)
 
        bl      _C_LABEL(main)
 
diff -r 4d8544801681 -r d76ee000147e sys/arch/evbppc/explora/machdep.c
--- a/sys/arch/evbppc/explora/machdep.c Mon Jun 20 17:31:37 2011 +0000
+++ b/sys/arch/evbppc/explora/machdep.c Mon Jun 20 17:44:33 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.35 2011/06/18 06:44:25 matt Exp $        */
+/*     $NetBSD: machdep.c,v 1.36 2011/06/20 17:44:33 matt Exp $        */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.35 2011/06/18 06:44:25 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.36 2011/06/20 17:44:33 matt Exp $");
 
 #include "opt_explora.h"
 #include "opt_modular.h"
@@ -88,68 +88,13 @@
 static struct mem_region phys_mem[MEMREGIONS];
 static struct mem_region avail_mem[MEMREGIONS];
 
-void           bootstrap(u_int, u_int);
-static void    install_extint(void (*)(void));
-
-/*
- * Trap vectors
- */
-extern int defaulttrap, defaultsize;
-extern int sctrap, scsize;
-extern int alitrap, alisize;
-extern int dsitrap, dsisize;
-extern int isitrap, isisize;
-extern int mchktrap, mchksize;
-extern int tlbimiss4xx, tlbim4size;
-extern int tlbdmiss4xx, tlbdm4size;
-extern int pitfitwdog, pitfitwdogsize;
-extern int debugtrap, debugsize;
-extern int errata51handler, errata51size;
-#ifdef DDB
-extern int ddblow, ddbsize;
-#endif
-static struct {
-       int vector;
-       void *addr;
-       void *size;
-} trap_table[] = {
-       { EXC_SC,       &sctrap,        &scsize },
-       { EXC_ALI,      &alitrap,       &alisize },
-       { EXC_DSI,      &dsitrap,       &dsisize },
-       { EXC_ISI,      &isitrap,       &isisize },
-       { EXC_MCHK,     &mchktrap,      &mchksize },
-       { EXC_ITMISS,   &tlbimiss4xx,   &tlbim4size },
-       { EXC_DTMISS,   &tlbdmiss4xx,   &tlbdm4size },
-       { EXC_PIT,      &pitfitwdog,    &pitfitwdogsize },
-       { EXC_DEBUG,    &debugtrap,     &debugsize },
-       { (EXC_DTMISS|EXC_ALI), &errata51handler, &errata51size },
-#if defined(DDB)
-       { EXC_PGM,      &ddblow,        &ddbsize },
-#endif /* DDB */
-};
-
-/*
- * Install a trap vector. We cannot use memcpy because the
- * destination may be zero.
- */
-static void
-trap_copy(void *src, int dest, size_t len)
-{
-       uint32_t *src_p = src;
-       uint32_t *dest_p = (void *)dest;
-
-       while (len > 0) {
-               *dest_p++ = *src_p++;
-               len -= sizeof(uint32_t);
-       }
-}
+void           initppc(vaddr_t, vaddr_t);
 
 void
-bootstrap(u_int startkernel, u_int endkernel)
+initppc(vaddr_t startkernel, vaddr_t endkernel)
 {
        u_int i, j, t, br[4];
        u_int maddr, msize, size;
-       struct cpu_info * const ci = &cpu_info[0];
 
        br[0] = mfdcr(DCR_BR4);
        br[1] = mfdcr(DCR_BR5);
@@ -197,100 +142,13 @@
        ppc4xx_tlb_reserve(BASE_FB2, BASE_FB2, TLB_PG_SIZE, TLB_I | TLB_G);
 #endif
 
-       consinit();
-
        /* Disable all external interrupts */
        mtdcr(DCR_EXIER, 0);
 
        /* Disable all timer interrupts */
        mtspr(SPR_TCR, 0);
 
-       /* Initialize cache info for memcpy, etc. */
-       cpu_probe_cache();
-
-       /*
-        * Initialize lwp0 and current pcb and pmap pointers.
-        */
-       lwp0.l_cpu = ci;
-
-       curpcb = lwp_getpcb(&lwp0);
-       memset(curpcb, 0, sizeof(struct pcb));  /* XXX why? */
-       curpcb->pcb_pm = pmap_kernel();
-
-       /*
-        * Install trap vectors.
-        */
-
-       for (i = EXC_RSVD; i <= EXC_LAST; i += 0x100)
-               trap_copy(&defaulttrap, i, (size_t)&defaultsize);
-
-       for (i = 0; i < sizeof(trap_table)/sizeof(trap_table[0]); i++) {
-               trap_copy(trap_table[i].addr, trap_table[i].vector,
-                   (size_t)trap_table[i].size);
-       }
-
-       __syncicache((void *)EXC_RST, EXC_LAST - EXC_RST + 0x100);
-
-       /*
-        * Set Exception vector base.
-        * Handle trap instruction as PGM exception.
-        */
-
-       mtspr(SPR_EVPR, 0);
-
-       t = mfspr(SPR_DBCR0);
-       t &= ~DBCR0_TDE;
-       mtspr(SPR_DBCR0, t);
-
-       /*
-        * External interrupt handler install.
-        */
-
-       install_extint(ext_intr);
-
-       /*
-        * Now enable translation (and machine checks/recoverable interrupts).
-        */
-       __asm volatile (
-           "   mfmsr %0        \n"
-           "   ori %0,%0,%1    \n"
-           "   mtmsr %0        \n"



Home | Main Index | Thread Index | Old Index