diff --git a/sys/arch/sun3x/sun3x/interreg.h b/sys/arch/sun3x/sun3x/interreg.h deleted file mode 100644 index fd953df9c664..000000000000 --- a/sys/arch/sun3x/sun3x/interreg.h +++ /dev/null @@ -1,52 +0,0 @@ -/* $NetBSD: interreg.h,v 1.1.1.1 1997/01/14 20:57:08 gwr Exp $ */ - -/*- - * Copyright (c) 1996 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Adam Glass. - * - * 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 - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#define IREG_CLOCK_ENAB_7 0x80 -#define IREG_RESERVED 0x40 -#define IREG_CLOCK_ENAB_5 0x20 -#define IREG_VIDEO_ENAB 0x10 -#define IREG_SOFT_ENAB_3 0x08 -#define IREG_SOFT_ENAB_2 0x04 -#define IREG_SOFT_ENAB_1 0x02 -#define IREG_ALL_ENAB 0x01 - -#define IREG_BITS "\20\8CLK7\7RSV6\6CLK5\5VIDEO\4SOFT3\3SOFT2\2SOFT1\1ALL\n" - -extern volatile u_char *interrupt_reg; - -void set_clk_mode __P((u_char on, u_char off, int enable)); diff --git a/sys/arch/sun3x/sun3x/intersil7170.h b/sys/arch/sun3x/sun3x/intersil7170.h deleted file mode 100644 index 91d8748e390b..000000000000 --- a/sys/arch/sun3x/sun3x/intersil7170.h +++ /dev/null @@ -1,95 +0,0 @@ -/* $NetBSD: intersil7170.h,v 1.1.1.1 1997/01/14 20:57:08 gwr Exp $ */ - -/*- - * Copyright (c) 1996 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Adam Glass. - * - * 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 - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Driver support for the intersil7170 used in sun[34]s to provide - * real time clock and time-of-day support. - * - * Derived from: datasheet "ICM7170 a uP-Compatible Real-Time Clock" - * document #301680-005, Dec 85 - */ - -struct date_time { /* from p. 7 of 10 */ - unsigned char dt_csec; - unsigned char dt_hour; - unsigned char dt_min; - unsigned char dt_sec; - unsigned char dt_month; - unsigned char dt_day; - unsigned char dt_year; - unsigned char dt_dow; -}; - -struct intersil7170 { - struct date_time counters; - struct date_time clk_ram; /* should be ok as both are word aligned */ - unsigned char clk_intr_reg; - unsigned char clk_cmd_reg; -}; - -/* bit assignments for command register, p. 6 of 10, write-only */ -#define INTERSIL_CMD_FREQ_32K 0x0 -#define INTERSIL_CMD_FREQ_1M 0x1 -#define INTERSIL_CMD_FREQ_2M 0x2 -#define INTERSIL_CMD_FREQ_4M 0x3 - -#define INTERSIL_CMD_12HR_MODE 0x0 -#define INTERSIL_CMD_24HR_MODE 0x4 - -#define INTERSIL_CMD_STOP 0x0 -#define INTERSIL_CMD_RUN 0x8 - -#define INTERSIL_CMD_IDISABLE 0x0 -#define INTERSIL_CMD_IENABLE 0x10 - -#define INTERSIL_CMD_TEST_MODE 0x20 -#define INTERSIL_CMD_NORMAL_MODE 0x0 - -/* bit assignments for interrupt register r/w, p 7 of 10*/ - -#define INTERSIL_INTER_ALARM 0x1 /* r/w */ -#define INTERSIL_INTER_CSECONDS 0x2 /* r/w */ -#define INTERSIL_INTER_DSECONDS 0x4 /* r/w */ -#define INTERSIL_INTER_SECONDS 0x8 /* r/w */ -#define INTERSIL_INTER_MINUTES 0x10 /* r/w */ -#define INTERSIL_INTER_HOURS 0x20 /* r/w */ -#define INTERSIL_INTER_DAYS 0x40 /* r/w */ -#define INTERSIL_INTER_PENDING 0x80 /* read-only */ - -#define INTERSIL_INTER_BITS "\20\10PENDING\7DAYS\6HRS\5MIN\4SCDS\3DSEC\2CSEC\1ALARM" - diff --git a/sys/arch/sun3x/sun3x/intreg.c b/sys/arch/sun3x/sun3x/intreg.c deleted file mode 100644 index b5f9118ef505..000000000000 --- a/sys/arch/sun3x/sun3x/intreg.c +++ /dev/null @@ -1,215 +0,0 @@ -/* $NetBSD: intreg.c,v 1.1.1.1 1997/01/14 20:57:09 gwr Exp $ */ - -/*- - * Copyright (c) 1996 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Adam Glass and Gordon W. Ross. - * - * 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 - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * This handles multiple attach of autovectored interrupts, - * and the handy software interrupt request register. - */ - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "interreg.h" -#include "machdep.h" - -struct intreg_softc { - struct device sc_dev; - volatile u_char *sc_reg; -}; - -static int intreg_match __P((struct device *, struct cfdata *, void *)); -static void intreg_attach __P((struct device *, struct device *, void *)); -static int soft1intr __P((void *)); - -struct cfattach intreg_ca = { - sizeof(struct intreg_softc), intreg_match, intreg_attach -}; - -struct cfdriver intreg_cd = { - NULL, "intreg", DV_DULL -}; - -volatile u_char *interrupt_reg; - - -/* called early (by internal_configure) */ -void -intreg_init() -{ - interrupt_reg = obio_find_mapping(OBIO_INTERREG, 1); - if (!interrupt_reg) - mon_panic("interrupt reg VA not found\n"); - /* Turn off all interrupts until clock_attach */ - *interrupt_reg = 0; -} - - -static int -intreg_match(parent, cf, args) - struct device *parent; - struct cfdata *cf; - void *args; -{ - struct confargs *ca = args; - - /* This driver only supports one unit. */ - if (cf->cf_unit != 0) - return (0); - - /* Validate the given address. */ - if (ca->ca_paddr != OBIO_INTERREG) - return (0); - - return (1); -} - - -static void -intreg_attach(parent, self, args) - struct device *parent; - struct device *self; - void *args; -{ - struct intreg_softc *sc = (void *)self; - - printf("\n"); - - sc->sc_reg = interrupt_reg; - - /* Install handler for our "soft" interrupt. */ - isr_add_autovect(soft1intr, (void *)sc, 1); -} - - -/* - * Level 1 software interrupt. - * Possible reasons: - * Network software interrupt - * Soft clock interrupt - */ -static int -soft1intr(arg) - void *arg; -{ - union sun3sir sir; - int s; - - s = splhigh(); - sir.sir_any = sun3sir.sir_any; - sun3sir.sir_any = 0; - isr_soft_clear(1); - splx(s); - - if (sir.sir_any) { - cnt.v_soft++; - if (sir.sir_which[SIR_NET]) { - sir.sir_which[SIR_NET] = 0; - netintr(); - } - if (sir.sir_which[SIR_CLOCK]) { - sir.sir_which[SIR_CLOCK] = 0; - softclock(); - } - if (sir.sir_which[SIR_SPARE2]) { - sir.sir_which[SIR_SPARE2] = 0; - /* spare2intr(); */ - } - if (sir.sir_which[SIR_SPARE3]) { - sir.sir_which[SIR_SPARE3] = 0; - /* spare3intr(); */ - } - return (1); - } - return(0); -} - - -static int isr_soft_pending; -void isr_soft_request(level) - int level; -{ - u_char bit, reg_val; - int s; - - if ((level < 1) || (level > 3)) - panic("isr_soft_request"); - - bit = 1 << level; - - /* XXX - Should do this in the callers... */ - if (isr_soft_pending & bit) - return; - - s = splhigh(); - isr_soft_pending |= bit; - reg_val = *interrupt_reg; - *interrupt_reg &= ~IREG_ALL_ENAB; - - *interrupt_reg |= bit; - *interrupt_reg |= IREG_ALL_ENAB; - splx(s); -} - -void isr_soft_clear(level) - int level; -{ - u_char bit, reg_val; - int s; - - if ((level < 1) || (level > 3)) - panic("isr_soft_clear"); - - bit = 1 << level; - - s = splhigh(); - isr_soft_pending &= ~bit; - reg_val = *interrupt_reg; - *interrupt_reg &= ~IREG_ALL_ENAB; - - *interrupt_reg &= ~bit; - *interrupt_reg |= IREG_ALL_ENAB; - splx(s); -} -