Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sgimips Merge forward matt-nb5-mips64



details:   https://anonhg.NetBSD.org/src/rev/87a431e1a34a
branches:  trunk
changeset: 762371:87a431e1a34a
user:      matt <matt%NetBSD.org@localhost>
date:      Sun Feb 20 07:59:49 2011 +0000

description:
Merge forward matt-nb5-mips64
Adapt to new interrupt/spl framework
Deal with arcbios calls being O32 and kernels being N32/N64.
Need to save/restore T8 across arcbios calls.

diffstat:

 sys/arch/sgimips/conf/Makefile.sgimips.inc |    4 +-
 sys/arch/sgimips/conf/files.sgimips        |    3 +-
 sys/arch/sgimips/conf/std.sgimips64        |    4 +-
 sys/arch/sgimips/dev/crime.c               |   20 +-
 sys/arch/sgimips/dev/crmfb.c               |    8 +-
 sys/arch/sgimips/dev/ctl.c                 |   67 ++++---
 sys/arch/sgimips/dev/imc.c                 |    8 +-
 sys/arch/sgimips/dev/int.c                 |   30 +-
 sys/arch/sgimips/dev/pic.c                 |    8 +-
 sys/arch/sgimips/dev/zs.c                  |    8 +-
 sys/arch/sgimips/gio/newportreg.h          |    3 +-
 sys/arch/sgimips/gio/pci_gio.c             |    7 +-
 sys/arch/sgimips/hpc/if_sq.c               |    6 +-
 sys/arch/sgimips/include/intr.h            |   63 +------
 sys/arch/sgimips/include/sysconf.h         |   14 +-
 sys/arch/sgimips/ioc/if_le_oioc.c          |   10 +-
 sys/arch/sgimips/mace/if_mec.c             |    8 +-
 sys/arch/sgimips/mace/macekbc.c            |    6 +-
 sys/arch/sgimips/mace/pci_mace.c           |    6 +-
 sys/arch/sgimips/sgimips/arcemu.c          |   27 +-
 sys/arch/sgimips/sgimips/arcemu.h          |    8 +-
 sys/arch/sgimips/sgimips/bus.c             |   29 +-
 sys/arch/sgimips/sgimips/clock.c           |   17 +-
 sys/arch/sgimips/sgimips/console.c         |    8 +-
 sys/arch/sgimips/sgimips/cpu.c             |  108 +++++-------
 sys/arch/sgimips/sgimips/machdep.c         |  250 ++++++++++------------------
 sys/arch/sgimips/sgimips/mainbus.c         |    9 +-
 sys/arch/sgimips/stand/Makefile.booters    |   10 +-
 sys/arch/sgimips/stand/boot/Makefile       |    6 +-
 sys/arch/sgimips/stand/boot64/Makefile     |   14 +-
 sys/arch/sgimips/stand/common/boot.c       |    7 +-
 sys/arch/sgimips/stand/common/disk.c       |   12 +-
 sys/arch/sgimips/stand/common/getchar.c    |    6 +-
 sys/arch/sgimips/stand/common/putchar.c    |    8 +-
 sys/arch/sgimips/stand/common/start.S      |   45 ++--
 35 files changed, 371 insertions(+), 476 deletions(-)

diffs (truncated from 2175 to 300 lines):

diff -r e23472eb800e -r 87a431e1a34a sys/arch/sgimips/conf/Makefile.sgimips.inc
--- a/sys/arch/sgimips/conf/Makefile.sgimips.inc        Sun Feb 20 07:58:13 2011 +0000
+++ b/sys/arch/sgimips/conf/Makefile.sgimips.inc        Sun Feb 20 07:59:49 2011 +0000
@@ -1,7 +1,9 @@
-#      $NetBSD: Makefile.sgimips.inc,v 1.11 2006/12/22 21:07:52 rumble Exp $
+#      $NetBSD: Makefile.sgimips.inc,v 1.12 2011/02/20 07:59:49 matt Exp $
 
 WANT_ECOFF?=no
 
+GENASSYM_EXTRAS+=      ${S}/dev/arcbios/genassym.cf
+
 .if ${WANT_ECOFF} == "yes"
 SYSTEM_LD_TAIL_EXTRA=; \
                echo ${ELF2ECOFF} $@ $@.ecoff; ${ELF2ECOFF} $@ $@.ecoff; \
diff -r e23472eb800e -r 87a431e1a34a sys/arch/sgimips/conf/files.sgimips
--- a/sys/arch/sgimips/conf/files.sgimips       Sun Feb 20 07:58:13 2011 +0000
+++ b/sys/arch/sgimips/conf/files.sgimips       Sun Feb 20 07:59:49 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.sgimips,v 1.49 2009/08/21 04:10:33 thorpej Exp $
+#      $NetBSD: files.sgimips,v 1.50 2011/02/20 07:59:49 matt Exp $
 
 maxpartitions 16
 
@@ -14,6 +14,7 @@
 
 file dev/arcbios/arcbios.c
 file dev/arcbios/arcbios_tty.c
+file dev/arcbios/arcbios_calls.S
 
 file arch/sgimips/sgimips/arcemu.c
 
diff -r e23472eb800e -r 87a431e1a34a sys/arch/sgimips/conf/std.sgimips64
--- a/sys/arch/sgimips/conf/std.sgimips64       Sun Feb 20 07:58:13 2011 +0000
+++ b/sys/arch/sgimips/conf/std.sgimips64       Sun Feb 20 07:59:49 2011 +0000
@@ -1,8 +1,8 @@
-#      $NetBSD: std.sgimips64,v 1.2 2009/12/14 00:46:12 matt Exp $
+#      $NetBSD: std.sgimips64,v 1.3 2011/02/20 07:59:49 matt Exp $
 
 no makeoptions MACHINE_ARCH
 makeoptions    MACHINE_ARCH="mips64eb"
 makeoptions    LP64="yes"
 
 options        EXEC_ELF64      # exec ELF64 binaries
-options        COMPAT_NETBSD64
+options        COMPAT_NETBSD32
diff -r e23472eb800e -r 87a431e1a34a sys/arch/sgimips/dev/crime.c
--- a/sys/arch/sgimips/dev/crime.c      Sun Feb 20 07:58:13 2011 +0000
+++ b/sys/arch/sgimips/dev/crime.c      Sun Feb 20 07:59:49 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: crime.c,v 1.33 2008/08/08 16:05:47 tsutsui Exp $       */
+/*     $NetBSD: crime.c,v 1.34 2011/02/20 07:59:50 matt Exp $  */
 
 /*
  * Copyright (c) 2004 Christopher SEKIYA
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: crime.c,v 1.33 2008/08/08 16:05:47 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crime.c,v 1.34 2011/02/20 07:59:50 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -66,7 +66,7 @@
 void           crime_bus_reset(void);
 void           crime_watchdog_reset(void);
 void           crime_watchdog_disable(void);
-void           crime_intr(uint32_t, uint32_t, uint32_t, uint32_t);
+void           crime_intr(vaddr_t, uint32_t, uint32_t);
 void           *crime_intr_establish(int, int, int (*)(void *), void *);
 
 static bus_space_tag_t crm_iot;
@@ -99,6 +99,7 @@
 crime_attach(struct device *parent, struct device *self, void *aux)
 {
        struct mainbus_attach_args *ma = aux;
+       struct cpu_info * const ci = curcpu();
        uint64_t crm_id;
        uint64_t baseline, endline;
        uint32_t startctr, endctr, cps;
@@ -157,11 +158,12 @@
        } while (endline - baseline < (CRIME_TIMER_FREQ / 10));
 
        cps = (endctr - startctr) * 10;
-       curcpu()->ci_cpu_freq = cps;
-       if (mips_cpu_flags & CPU_MIPS_DOUBLE_COUNT)
-               curcpu()->ci_cpu_freq *= 2;
-       curcpu()->ci_cycles_per_hz = (cps + (hz / 2)) / hz;
-       curcpu()->ci_divisor_delay = (cps + (1000000 / 2)) / 1000000;
+       ci->ci_cpu_freq = cps;
+       ci->ci_cctr_freq = cps;
+       if (mips_options.mips_cpu_flags & CPU_MIPS_DOUBLE_COUNT)
+               ci->ci_cpu_freq *= 2;
+       ci->ci_cycles_per_hz = (cps + (hz / 2)) / hz;
+       ci->ci_divisor_delay = (cps + (1000000 / 2)) / 1000000;
 
        /* Turn on memory error and crime error interrupts.
           All others turned on as devices are registered. */
@@ -207,7 +209,7 @@
 }
 
 void
-crime_intr(uint32_t status, uint32_t cause, uint32_t pc, uint32_t ipending)
+crime_intr(vaddr_t pc, uint32_t status, uint32_t ipending)
 {
        uint64_t crime_intmask;
        uint64_t crime_intstat;
diff -r e23472eb800e -r 87a431e1a34a sys/arch/sgimips/dev/crmfb.c
--- a/sys/arch/sgimips/dev/crmfb.c      Sun Feb 20 07:58:13 2011 +0000
+++ b/sys/arch/sgimips/dev/crmfb.c      Sun Feb 20 07:59:49 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crmfb.c,v 1.26 2008/07/30 17:24:27 tsutsui Exp $ */
+/* $NetBSD: crmfb.c,v 1.27 2011/02/20 07:59:50 matt Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: crmfb.c,v 1.26 2008/07/30 17:24:27 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crmfb.c,v 1.27 2011/02/20 07:59:50 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -334,7 +334,7 @@
        crmfb_fill_rect(sc, 0, 0, sc->sc_width, sc->sc_height,
            ri->ri_devcmap[(defattr >> 16) & 0xff]);
 
-       consdev = ARCBIOS->GetEnvironmentVariable("ConsoleOut");
+       consdev = arcbios_GetEnvironmentVariable("ConsoleOut");
        if (consdev != NULL && strcmp(consdev, "video()") == 0) {
                wsdisplay_cnattach(&crmfb_defaultscreen, ri, 0, 0, defattr);
                aa.console = 1;
@@ -898,7 +898,7 @@
 
        /* turn off sync-on-green */
 
-       wantsync = ARCBIOS->GetEnvironmentVariable("SyncOnGreen");
+       wantsync = arcbios_GetEnvironmentVariable("SyncOnGreen");
        if ( (wantsync != NULL) && (wantsync[0] == 'n') ) {
                d = ( 1 << CRMFB_VT_FLAGS_SYNC_LOW_LSB) & 
                    CRMFB_REG_MASK(CRMFB_VT_FLAGS_SYNC_LOW_MSB, 
diff -r e23472eb800e -r 87a431e1a34a sys/arch/sgimips/dev/ctl.c
--- a/sys/arch/sgimips/dev/ctl.c        Sun Feb 20 07:58:13 2011 +0000
+++ b/sys/arch/sgimips/dev/ctl.c        Sun Feb 20 07:59:49 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ctl.c,v 1.1 2009/02/10 06:04:56 rumble Exp $    */
+/*     $NetBSD: ctl.c,v 1.2 2011/02/20 07:59:50 matt Exp $      */
 
 /*
  * Copyright (c) 2009 Stephen M. Rumble
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ctl.c,v 1.1 2009/02/10 06:04:56 rumble Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ctl.c,v 1.2 2011/02/20 07:59:50 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -46,17 +46,16 @@
 #include <sgimips/dev/ctlreg.h>
 
 struct ctl_softc {
-       struct device           sc_dev;
+       device_t                sc_dev;
 
        bus_space_tag_t         iot;
        bus_space_handle_t      ioh;
-
 };
 
-static int      ctl_match(struct device *, struct cfdata *, void *);
-static void     ctl_attach(struct device *, struct device *, void *);
+static int      ctl_match(device_t, cfdata_t, void *);
+static void     ctl_attach(device_t, device_t, void *);
 static void    ctl_bus_reset(void);
-static void    ctl_bus_error(uint32_t, uint32_t, uint32_t, uint32_t);
+static void    ctl_bus_error(vaddr_t, uint32_t, uint32_t);
 static void    ctl_watchdog_enable(void);
 static void    ctl_watchdog_disable(void);
 static void    ctl_watchdog_tickle(void);
@@ -66,14 +65,17 @@
 static void    ctl_blink(void *);
 #endif
 
-CFATTACH_DECL(ctl, sizeof(struct ctl_softc),
+CFATTACH_DECL_NEW(ctl, sizeof(struct ctl_softc),
     ctl_match, ctl_attach, NULL, NULL);
 
-static struct ctl_softc csc;
+static struct ctl_softc *csc;
 
 static int
-ctl_match(struct device * parent, struct cfdata * match, void *aux)
+ctl_match(device_t parent, cfdata_t match, void *aux)
 {
+       if (csc != NULL)
+               return 0;
+
        /*
         * CTL exists on IP6/IP10 systems.
         */
@@ -84,17 +86,21 @@
 }
 
 static void
-ctl_attach(struct device * parent, struct device * self, void *aux)
+ctl_attach(device_t parent, device_t self, void *aux)
 {
        struct mainbus_attach_args *ma = aux;
+       struct ctl_softc * const sc = device_private(self);
 
 #ifdef BLINK
        callout_init(&ctl_blink_ch, 0);
 #endif
 
-       csc.iot = SGIMIPS_BUS_SPACE_NORMAL;
-       if (bus_space_map(csc.iot, ma->ma_addr, 0,
-           BUS_SPACE_MAP_LINEAR, &csc.ioh))
+       sc->sc_dev = self;
+       csc = sc;
+
+       sc->iot = SGIMIPS_BUS_SPACE_NORMAL;
+       if (bus_space_map(sc->iot, ma->ma_addr, 0,
+           BUS_SPACE_MAP_LINEAR, &sc->ioh))
                panic("ctl_attach: could not allocate memory\n");
 
        platform.bus_reset = ctl_bus_reset;
@@ -103,7 +109,7 @@
        platform.watchdog_disable = ctl_watchdog_disable;
        platform.watchdog_reset = ctl_watchdog_tickle;
 
-       bus_space_write_2(csc.iot, csc.ioh, CTL_CPUCTRL,
+       bus_space_write_2(sc->iot, sc->ioh, CTL_CPUCTRL,
            (CTL_CPUCTRL_PARITY | CTL_CPUCTRL_SLAVE));
 
        printf("\n");
@@ -111,22 +117,23 @@
        ctl_bus_reset();
 
 #if defined(BLINK)
-       ctl_blink(&csc);
+       ctl_blink(sc);
 #endif
 }
 
 static void
 ctl_bus_reset(void)
 {
+       struct ctl_softc * const sc = csc;
 
-       bus_space_read_1(csc.iot, csc.ioh, CTL_LAN_PAR_CLR);
-       bus_space_read_1(csc.iot, csc.ioh, CTL_DMA_PAR_CLR);
-       bus_space_read_1(csc.iot, csc.ioh, CTL_CPU_PAR_CLR);
-       bus_space_read_1(csc.iot, csc.ioh, CTL_VME_PAR_CLR);
+       bus_space_read_1(sc->iot, sc->ioh, CTL_LAN_PAR_CLR);
+       bus_space_read_1(sc->iot, sc->ioh, CTL_DMA_PAR_CLR);
+       bus_space_read_1(sc->iot, sc->ioh, CTL_CPU_PAR_CLR);
+       bus_space_read_1(sc->iot, sc->ioh, CTL_VME_PAR_CLR);
 }
 
 static void
-ctl_bus_error(uint32_t status, uint32_t cause, uint32_t pc, uint32_t ipending)
+ctl_bus_error(vaddr_t pc, uint32_t status, uint32_t ipending)
 {
 
        printf("ctl0: bus error\n");
@@ -136,27 +143,29 @@
 static void
 ctl_watchdog_enable(void)
 {
+       struct ctl_softc * const sc = csc;
        uint32_t reg;
 
        /* XXX- doesn't seem to work properly */
        return;
 
-       reg = bus_space_read_2(csc.iot, csc.ioh, CTL_CPUCTRL);
+       reg = bus_space_read_2(sc->iot, sc->ioh, CTL_CPUCTRL);
        reg |= CTL_CPUCTRL_WDOG;
-       bus_space_write_2(csc.iot, csc.ioh, CTL_CPUCTRL, reg);
+       bus_space_write_2(sc->iot, sc->ioh, CTL_CPUCTRL, reg);
 }
 
 static void
 ctl_watchdog_disable(void)
 {
+       struct ctl_softc * const sc = csc;
        uint16_t reg;
 
        /* XXX- doesn't seem to work properly */
        return;
 
-       reg = bus_space_read_2(csc.iot, csc.ioh, CTL_CPUCTRL_WDOG);
+       reg = bus_space_read_2(sc->iot, sc->ioh, CTL_CPUCTRL_WDOG);
        reg &= ~(CTL_CPUCTRL_WDOG);
-       bus_space_write_2(csc.iot, csc.ioh, CTL_CPUCTRL, reg);
+       bus_space_write_2(sc->iot, sc->ioh, CTL_CPUCTRL, reg);



Home | Main Index | Thread Index | Old Index