Source-Changes-HG archive

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

[src/matt-nb6-plus]: src/sys/arch/arm Merge improved arm support (especially ...



details:   https://anonhg.NetBSD.org/src/rev/b85933b9c554
branches:  matt-nb6-plus
changeset: 774510:b85933b9c554
user:      matt <matt%NetBSD.org@localhost>
date:      Wed Nov 28 22:40:09 2012 +0000

description:
Merge improved arm support (especially Cortex) from HEAD
including OMAP and BCM53xx support.

diffstat:

 sys/arch/arm/arm/arm_machdep.c           |   162 +-
 sys/arch/arm/arm/ast.c                   |    19 +-
 sys/arch/arm/arm/bcopyinout.S            |    12 +-
 sys/arch/arm/arm/bus_space_asm_generic.S |   342 ++++-
 sys/arch/arm/arm/compat_13_machdep.c     |    11 +-
 sys/arch/arm/arm/compat_16_machdep.c     |    20 +-
 sys/arch/arm/arm/cpu_exec.c              |    95 +
 sys/arch/arm/arm/cpufunc.c               |   410 +++---
 sys/arch/arm/arm/cpufunc_asm.S           |     4 +-
 sys/arch/arm/arm/cpufunc_asm_arm11.S     |    15 +-
 sys/arch/arm/arm/cpufunc_asm_arm67.S     |    14 +-
 sys/arch/arm/arm/cpufunc_asm_arm7tdmi.S  |    13 +-
 sys/arch/arm/arm/cpufunc_asm_arm8.S      |    15 +-
 sys/arch/arm/arm/cpufunc_asm_arm9.S      |    16 +-
 sys/arch/arm/arm/cpufunc_asm_armv5.S     |    15 +-
 sys/arch/arm/arm/cpufunc_asm_armv5_ec.S  |    15 +-
 sys/arch/arm/arm/cpufunc_asm_armv6.S     |    11 +-
 sys/arch/arm/arm/cpufunc_asm_armv7.S     |   345 ++++-
 sys/arch/arm/arm/cpufunc_asm_fa526.S     |    18 +-
 sys/arch/arm/arm/cpufunc_asm_sa1.S       |    21 +-
 sys/arch/arm/arm/cpufunc_asm_sheeva.S    |    13 +-
 sys/arch/arm/arm/cpufunc_asm_xscale.S    |    18 +-
 sys/arch/arm/arm/db_trace.c              |    72 +-
 sys/arch/arm/arm/disassem.c              |    11 +-
 sys/arch/arm/arm/disksubr_mbr.c          |    16 +-
 sys/arch/arm/arm/linux_syscall.c         |    12 +-
 sys/arch/arm/arm/lock_cas.S              |    36 +-
 sys/arch/arm/arm/process_machdep.c       |    10 +-
 sys/arch/arm/arm/sig_machdep.c           |    31 +-
 sys/arch/arm/arm/syscall.c               |    96 +-
 sys/arch/arm/arm/undefined.c             |    40 +-
 sys/arch/arm/arm32/arm32_boot.c          |   369 +++++
 sys/arch/arm/arm32/arm32_kvminit.c       |   889 +++++++++++++
 sys/arch/arm/arm32/arm32_machdep.c       |   127 +-
 sys/arch/arm/arm32/arm32_reboot.c        |   193 ++
 sys/arch/arm/arm32/bus_dma.c             |   974 ++++++++++++--
 sys/arch/arm/arm32/cortex_pmc.c          |    89 +-
 sys/arch/arm/arm32/cpu.c                 |   298 +++-
 sys/arch/arm/arm32/cpuswitch.S           |    82 +-
 sys/arch/arm/arm32/db_interface.c        |    76 +-
 sys/arch/arm/arm32/db_machdep.c          |   102 +-
 sys/arch/arm/arm32/exception.S           |    31 +-
 sys/arch/arm/arm32/fault.c               |   127 +-
 sys/arch/arm/arm32/genassym.cf           |    32 +-
 sys/arch/arm/arm32/intr.c                |    13 +-
 sys/arch/arm/arm32/irq_dispatch.S        |    56 +-
 sys/arch/arm/arm32/locore.S              |    79 +-
 sys/arch/arm/arm32/netbsd32_machdep.c    |    96 +
 sys/arch/arm/arm32/pmap.c                |   149 +-
 sys/arch/arm/arm32/setstack.S            |     7 +-
 sys/arch/arm/arm32/stubs.c               |     6 +-
 sys/arch/arm/arm32/sys_machdep.c         |    39 +-
 sys/arch/arm/arm32/vm_machdep.c          |    68 +-
 sys/arch/arm/broadcom/bcm53xx_board.c    |   698 ++++++++++
 sys/arch/arm/broadcom/bcm53xx_cca.c      |   307 ++++
 sys/arch/arm/broadcom/bcm53xx_ccb.c      |   185 ++
 sys/arch/arm/broadcom/bcm53xx_eth.c      |  1946 ++++++++++++++++++++++++++++++
 sys/arch/arm/broadcom/bcm53xx_i2c.c      |    87 +
 sys/arch/arm/broadcom/bcm53xx_idm.c      |   179 ++
 sys/arch/arm/broadcom/bcm53xx_intr.h     |   138 ++
 sys/arch/arm/broadcom/bcm53xx_mdio.c     |   166 ++
 sys/arch/arm/broadcom/bcm53xx_pax.c      |   599 +++++++++
 sys/arch/arm/broadcom/bcm53xx_reg.h      |   892 +++++++++++++
 sys/arch/arm/broadcom/bcm53xx_rng.c      |   200 +++
 sys/arch/arm/broadcom/bcm53xx_sdhc.c     |   125 +
 sys/arch/arm/broadcom/bcm53xx_usb.c      |   289 ++++
 sys/arch/arm/broadcom/bcm53xx_var.h      |   125 +
 sys/arch/arm/broadcom/bcmgen_space.c     |   269 ++++
 sys/arch/arm/broadcom/files.bcm53xx      |    65 +
 sys/arch/arm/conf/Makefile.arm           |     6 +-
 sys/arch/arm/conf/files.arm              |    24 +-
 sys/arch/arm/conf/kern.ldscript.head     |     4 +-
 sys/arch/arm/cortex/a9_mpsubr.S          |   436 ++++++
 sys/arch/arm/cortex/a9tmr.c              |   333 +++++
 sys/arch/arm/cortex/a9tmr_intr.h         |    42 +
 sys/arch/arm/cortex/a9tmr_reg.h          |    93 +
 sys/arch/arm/cortex/a9tmr_var.h          |    53 +
 sys/arch/arm/cortex/a9wdt.c              |   249 +++
 sys/arch/arm/cortex/armperiph.c          |   177 ++
 sys/arch/arm/cortex/files.cortex         |    25 +
 sys/arch/arm/cortex/gic.c                |   577 ++++++++
 sys/arch/arm/cortex/gic_intr.h           |    56 +
 sys/arch/arm/cortex/gic_reg.h            |   202 +++
 sys/arch/arm/cortex/mpcore_var.h         |    40 +
 sys/arch/arm/cortex/pl310.c              |   322 ++++
 sys/arch/arm/cortex/pl310_reg.h          |   139 ++
 sys/arch/arm/cortex/pl310_var.h          |    37 +
 sys/arch/arm/cortex/scu_reg.h            |    71 +
 sys/arch/arm/include/arm32/db_machdep.h  |     3 +-
 sys/arch/arm/include/arm32/frame.h       |   236 ++-
 sys/arch/arm/include/arm32/machdep.h     |    66 +-
 sys/arch/arm/include/arm32/pmap.h        |   105 +-
 sys/arch/arm/include/arm32/psl.h         |     4 +-
 sys/arch/arm/include/arm32/pte.h         |     9 +-
 sys/arch/arm/include/arm32/vmparam.h     |    10 +-
 sys/arch/arm/include/armreg.h            |   172 ++-
 sys/arch/arm/include/asm.h               |    15 +-
 sys/arch/arm/include/bootconfig.h        |    10 +-
 sys/arch/arm/include/bus_defs.h          |   180 +-
 sys/arch/arm/include/bus_funcs.h         |   209 ++-
 sys/arch/arm/include/byte_swap.h         |    30 +-
 sys/arch/arm/include/cdefs.h             |    22 +-
 sys/arch/arm/include/cpu.h               |   133 +-
 sys/arch/arm/include/cpu_counter.h       |    79 +
 sys/arch/arm/include/cpufunc.h           |   123 +-
 sys/arch/arm/include/elf_machdep.h       |    23 +-
 sys/arch/arm/include/frame.h             |    28 +-
 sys/arch/arm/include/lock.h              |    88 +-
 sys/arch/arm/include/mutex.h             |    16 +-
 sys/arch/arm/include/netbsd32_machdep.h  |    69 +
 sys/arch/arm/include/param.h             |     7 +-
 sys/arch/arm/include/pcb.h               |    28 +-
 sys/arch/arm/include/pci_machdep.h       |    14 +-
 sys/arch/arm/include/proc.h              |     6 +-
 sys/arch/arm/include/sysarch.h           |     8 +-
 sys/arch/arm/include/types.h             |    21 +-
 sys/arch/arm/include/vfpvar.h            |    48 -
 sys/arch/arm/mainbus/cpu_mainbus.c       |    53 +-
 sys/arch/arm/mainbus/mainbus.c           |     8 +-
 sys/arch/arm/mainbus/mainbus.h           |     9 +-
 sys/arch/arm/mainbus/mainbus_io.c        |    43 +-
 sys/arch/arm/omap/files.omap             |     2 +-
 sys/arch/arm/omap/files.omap2            |    17 +-
 sys/arch/arm/omap/obio_mputmr.c          |    35 +-
 sys/arch/arm/omap/obio_ohci.c            |   145 +-
 sys/arch/arm/omap/obio_wdt.c             |     6 +-
 sys/arch/arm/omap/omap2430_intr.h        |   292 ++--
 sys/arch/arm/omap/omap2_gpio.c           |    34 +-
 sys/arch/arm/omap/omap2_gpmcreg.h        |     8 +-
 sys/arch/arm/omap/omap2_icu.c            |     6 +-
 sys/arch/arm/omap/omap2_intr.h           |   144 +--
 sys/arch/arm/omap/omap2_nand.c           |    10 +-
 sys/arch/arm/omap/omap2_obio.c           |    24 +-
 sys/arch/arm/omap/omap2_obioreg.h        |    60 +-
 sys/arch/arm/omap/omap2_obiovar.h        |    13 +-
 sys/arch/arm/omap/omap2_reg.h            |   168 ++-
 sys/arch/arm/omap/omap3_ehci.c           |   254 +++
 sys/arch/arm/omap/omap3_sdhc.c           |   291 ++++
 sys/arch/arm/omap/omap3_sdmmcreg.h       |    74 +
 sys/arch/arm/omap/omap4430_intr.h        |   152 ++
 sys/arch/arm/omap/omap_a2x_space.c       |    43 +-
 sys/arch/arm/omap/omap_a4x_space.c       |    42 +-
 sys/arch/arm/omap/omap_dma.c             |    25 +-
 sys/arch/arm/omap/omap_gpio.c            |     6 +-
 sys/arch/arm/omap/omap_intr.h            |     6 +-
 sys/arch/arm/omap/omap_nobyteacc_io.S    |     6 +-
 sys/arch/arm/omap/omap_nobyteacc_space.c |    42 +-
 sys/arch/arm/omap/omap_space.c           |    59 +-
 sys/arch/arm/omap/omap_start.S           |    10 +-
 sys/arch/arm/omap/omap_wdt.c             |    13 +-
 sys/arch/arm/omap/omapfb.c               |     6 +-
 sys/arch/arm/pic/files.pic               |     4 +-
 sys/arch/arm/pic/pic.c                   |   222 +++-
 sys/arch/arm/pic/pic_splfuncs.c          |    51 +-
 sys/arch/arm/pic/picvar.h                |    60 +-
 sys/arch/arm/vfp/vfp_init.c              |   439 ++++--
 156 files changed, 16986 insertions(+), 2644 deletions(-)

diffs (truncated from 26458 to 300 lines):

diff -r 8524fd7dba95 -r b85933b9c554 sys/arch/arm/arm/arm_machdep.c
--- a/sys/arch/arm/arm/arm_machdep.c    Wed Nov 28 22:31:47 2012 +0000
+++ b/sys/arch/arm/arm/arm_machdep.c    Wed Nov 28 22:40:09 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arm_machdep.c,v 1.30 2011/03/04 22:25:25 joerg Exp $   */
+/*     $NetBSD: arm_machdep.c,v 1.30.12.1 2012/11/28 22:40:09 matt Exp $       */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -75,11 +75,10 @@
 #include "opt_cpuoptions.h"
 #include "opt_cputypes.h"
 #include "opt_arm_debug.h"
-#include "opt_sa.h"
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: arm_machdep.c,v 1.30 2011/03/04 22:25:25 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm_machdep.c,v 1.30.12.1 2012/11/28 22:40:09 matt Exp $");
 
 #include <sys/exec.h>
 #include <sys/proc.h>
@@ -88,7 +87,8 @@
 #include <sys/ucontext.h>
 #include <sys/evcnt.h>
 #include <sys/cpu.h>
-#include <sys/savar.h>
+#include <sys/atomic.h>
+#include <sys/kcpuset.h>
 
 #ifdef EXEC_AOUT
 #include <sys/exec_aout.h>
@@ -96,18 +96,34 @@
 
 #include <arm/cpufunc.h>
 
-#include <machine/pcb.h>
 #include <machine/vmparam.h>
 
 /* the following is used externally (sysctl_hw) */
 char   machine[] = MACHINE;            /* from <machine/param.h> */
 char   machine_arch[] = MACHINE_ARCH;  /* from <machine/param.h> */
 
+#ifdef __PROG32
+extern const uint32_t undefinedinstruction_bounce[];
+#endif
+
 /* Our exported CPU info; we can have only one. */
 struct cpu_info cpu_info_store = {
        .ci_cpl = IPL_HIGH,
-#ifndef PROCESS_ID_IS_CURLWP
        .ci_curlwp = &lwp0,
+#ifdef __PROG32
+       .ci_undefsave[2] = (register_t) undefinedinstruction_bounce,
+#endif
+};
+
+#ifdef MULTIPROCESSOR
+struct cpu_info *cpu_info[MAXCPUS] = {
+       [0] = &cpu_info_store
+};
+#endif
+
+const pcu_ops_t * const pcu_ops_md_defs[PCU_UNIT_COUNT] = {
+#if defined(FPU_VFP)
+       [PCU_FPU] = &arm_vfp_ops,
 #endif
 };
 
@@ -148,11 +164,7 @@
 void
 setregs(struct lwp *l, struct exec_package *pack, vaddr_t stack)
 {
-       struct pcb *pcb;
-       struct trapframe *tf;
-
-       pcb = lwp_getpcb(l);
-       tf = pcb->pcb_tf;
+       struct trapframe * const tf = lwp_trapframe(l);
 
        memset(tf, 0, sizeof(*tf));
        tf->tf_r0 = l->l_proc->p_psstrp;
@@ -169,16 +181,13 @@
 #endif
 #endif
 
+       l->l_md.md_flags = 0;
 #ifdef EXEC_AOUT
        if (pack->ep_esch->es_makecmds == exec_aout_makecmds)
-               pcb->pcb_flags = PCB_NOALIGNFLT;
-       else
+               l->l_md.md_flags |= MDLWP_NOALIGNFLT;
 #endif
-       pcb->pcb_flags = 0;
 #ifdef FPU_VFP
-       l->l_md.md_flags &= ~MDP_VFPUSED;
-       if (pcb->pcb_vfpcpu != NULL)
-               vfp_saveregs_lwp(l, 0);
+       vfp_discardcontext();
 #endif
 }
 
@@ -201,81 +210,76 @@
        userret(l);
 }
 
-#ifdef KERN_SA
-/*
- * XXX This is a terrible name.
- */
-void
-upcallret(struct lwp *l)
-{
-
-       userret(l);
-}
-
-/*
- * cpu_upcall:
- *
- *     Send an an upcall to userland.
- */
-void 
-cpu_upcall(struct lwp *l, int type, int nevents, int ninterrupted, void *sas,
-    void *ap, void *sp, sa_upcall_t upcall)
-{
-       struct trapframe *tf;
-       struct saframe *sf, frame;
-
-       tf = process_frame(l);
-
-       /* Finally, copy out the rest of the frame. */
-#if 0 /* First 4 args in regs (see below). */
-       frame.sa_type = type;
-       frame.sa_sas = sas;
-       frame.sa_events = nevents;
-       frame.sa_interrupted = ninterrupted;
-#endif
-       frame.sa_arg = ap;
-
-       sf = (struct saframe *)sp - 1;
-       if (copyout(&frame, sf, sizeof(frame)) != 0) {
-               /* Copying onto the stack didn't work. Die. */
-               sigexit(l, SIGILL);
-               /* NOTREACHED */
-       }
-
-       tf->tf_r0 = type;
-       tf->tf_r1 = (int) sas;
-       tf->tf_r2 = nevents;
-       tf->tf_r3 = ninterrupted;
-       tf->tf_pc = (int) upcall;
-#ifdef THUMB_CODE
-       if (((int) upcall) & 1)
-               tf->tf_spsr |= PSR_T_bit;
-       else
-               tf->tf_spsr &= ~PSR_T_bit;
-#endif
-       tf->tf_usr_sp = (int) sf;
-       tf->tf_usr_lr = 0;              /* no return */
-}
-
-#endif /* KERN_SA */
-
 void
 cpu_need_resched(struct cpu_info *ci, int flags)
 {
-       bool immed = (flags & RESCHED_IMMED) != 0;
+       struct lwp * const l = ci->ci_data.cpu_onproc;
+       const bool immed = (flags & RESCHED_IMMED) != 0;
+#ifdef MULTIPROCESSOR
+       struct cpu_info * const cur_ci = curcpu();
+       u_long ipi = IPI_NOP;
+#endif
 
+       if (__predict_false((l->l_pflag & LP_INTR) != 0)) {
+               /*
+                * No point doing anything, it will switch soon.
+                * Also here to prevent an assertion failure in
+                * kpreempt() due to preemption being set on a
+                * soft interrupt LWP.
+                */
+               return;
+       }
        if (ci->ci_want_resched && !immed)
                return;
 
+       if (l == ci->ci_data.cpu_idlelwp) {
+#ifdef MULTIPROCESSOR
+               /*
+                * If the other CPU is idling, it must be waiting for an
+                * event.  So give it one.
+                */
+               if (ci != cur_ci)
+                       goto send_ipi;
+#endif
+               return;
+       }
+#ifdef MULTIPROCESSOR
+       atomic_swap_uint(&ci->ci_want_resched, 1);
+#else
        ci->ci_want_resched = 1;
-       if (curlwp != ci->ci_data.cpu_idlelwp)
-               setsoftast();
+#endif
+       if (flags & RESCHED_KPREEMPT) {
+#ifdef __HAVE_PREEMPTION
+               atomic_or_uint(&l->l_dopreempt, DOPREEMPT_ACITBE);
+               if (ci == cur_ci) {
+                       softint_trigger(SOFTINT_KPREEMPT);
+               } else {
+                       ipi = IPI_KPREEMPT;
+                       goto send_ipi;
+               }
+#endif /* __HAVE_PREEMPTION */
+               return;
+       }
+       ci->ci_astpending = 1;
+#ifdef MULTIPROCESSOR
+       if (ci == curcpu() || !immed)
+               return;
+       ipi = IPI_AST;
+
+   send_ipi:
+       intr_ipi_send(ci->ci_kcpuset, ipi);
+#endif /* MULTIPROCESSOR */
 }
 
 bool
 cpu_intr_p(void)
 {
-       return curcpu()->ci_intr_depth != 0;
+       struct cpu_info * const ci = curcpu();
+#ifdef __HAVE_PIC_FAST_SOFTINTS
+       if (ci->ci_cpl < IPL_VM)
+               return false;
+#endif
+       return ci->ci_intr_depth != 0;
 }
 
 void
diff -r 8524fd7dba95 -r b85933b9c554 sys/arch/arm/arm/ast.c
--- a/sys/arch/arm/arm/ast.c    Wed Nov 28 22:31:47 2012 +0000
+++ b/sys/arch/arm/arm/ast.c    Wed Nov 28 22:40:09 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ast.c,v 1.20 2010/12/20 00:25:26 matt Exp $    */
+/*     $NetBSD: ast.c,v 1.20.16.1 2012/11/28 22:40:09 matt Exp $       */
 
 /*
  * Copyright (c) 1994,1995 Mark Brinicombe
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ast.c,v 1.20 2010/12/20 00:25:26 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ast.c,v 1.20.16.1 2012/11/28 22:40:09 matt Exp $");
 
 #include "opt_ddb.h"
 
@@ -77,10 +77,7 @@
        mi_userret(l);
 
 #if defined(__PROG32) && defined(DIAGNOSTIC)
-       {
-               struct pcb *pcb = lwp_getpcb(l);
-               KASSERT((pcb->pcb_tf->tf_spsr & IF32_bits) == 0);
-       }
+       KASSERT((lwp_trapframe(l)->tf_spsr & IF32_bits) == 0);
 #endif
 }
 
@@ -94,8 +91,7 @@
 void
 ast(struct trapframe *tf)
 {
-       struct lwp *l = curlwp;
-       struct proc *p;
+       struct lwp * const l = curlwp;
 
 #ifdef acorn26
        /* Enable interrupts if they were enabled before the trap. */
@@ -109,20 +105,13 @@
        KASSERT((tf->tf_spsr & IF32_bits) == 0);
 #endif
 
-
        curcpu()->ci_data.cpu_ntrap++;
        //curcpu()->ci_data.cpu_nast++;
 
 #ifdef DEBUG
        KDASSERT(curcpu()->ci_cpl == IPL_NONE);
-       if (l == NULL)
-               panic("ast: no curlwp!");
-       if (lwp_getpcb(l) == NULL)
-               panic("ast: no pcb!");
 #endif 
 
-       p = l->l_proc;
-
        if (l->l_pflag & LP_OWEUPC) {



Home | Main Index | Thread Index | Old Index