diff options
Diffstat (limited to 'sys/arch/sun3/dev')
-rw-r--r-- | sys/arch/sun3/dev/cg4.c | 442 | ||||
-rw-r--r-- | sys/arch/sun3/dev/cg4reg.h | 51 | ||||
-rw-r--r-- | sys/arch/sun3/dev/fbvar.h | 4 | ||||
-rw-r--r-- | sys/arch/sun3/dev/idprom.c | 38 | ||||
-rw-r--r-- | sys/arch/sun3/dev/if_ie.c | 4 | ||||
-rw-r--r-- | sys/arch/sun3/dev/if_ie_obio.c | 70 | ||||
-rw-r--r-- | sys/arch/sun3/dev/if_le.c | 95 | ||||
-rw-r--r-- | sys/arch/sun3/dev/kd.c | 42 | ||||
-rw-r--r-- | sys/arch/sun3/dev/memerr.c | 38 | ||||
-rw-r--r-- | sys/arch/sun3/dev/obio.c | 78 | ||||
-rw-r--r-- | sys/arch/sun3/dev/si.c | 78 | ||||
-rw-r--r-- | sys/arch/sun3/dev/si_obio.c | 108 | ||||
-rw-r--r-- | sys/arch/sun3/dev/si_vme.c | 110 | ||||
-rw-r--r-- | sys/arch/sun3/dev/sivar.h | 48 | ||||
-rw-r--r-- | sys/arch/sun3/dev/xd.c | 7 | ||||
-rw-r--r-- | sys/arch/sun3/dev/zs.c | 44 |
16 files changed, 743 insertions, 514 deletions
diff --git a/sys/arch/sun3/dev/cg4.c b/sys/arch/sun3/dev/cg4.c index 7c3be6c1e63..1116c81c998 100644 --- a/sys/arch/sun3/dev/cg4.c +++ b/sys/arch/sun3/dev/cg4.c @@ -47,12 +47,19 @@ /* * color display (cg4) driver. * - * Does not handle interrupts, even though they can occur. + * Credits, history: + * Gordon Ross created this driver based on the cg3 driver from + * the sparc port as distributed in BSD 4.4 Lite, but included + * support for only the "type B" adapter (Brooktree DACs). + * Ezra Story added support for the "type A" (AMD DACs). * - * XXX should defer colormap updates to vertical retrace interrupts + * Todo: + * Make this driver handle video interrupts. + * Defer colormap updates to vertical retrace interrupts. */ #include <sys/param.h> +#include <sys/systm.h> #include <sys/device.h> #include <sys/ioctl.h> #include <sys/malloc.h> @@ -71,16 +78,30 @@ #include "btvar.h" #include "cg4reg.h" +#define CG4_MMAP_SIZE (CG4_OVERLAY_SIZE + CG4_ENABLE_SIZE + CG4_PIXMAP_SIZE) + extern unsigned char cpu_machine_id; +#define CMAP_SIZE 256 +struct soft_cmap { + u_char r[CMAP_SIZE]; + u_char g[CMAP_SIZE]; + u_char b[CMAP_SIZE]; +}; + /* per-display variables */ struct cg4_softc { struct device sc_dev; /* base device */ struct fbdevice sc_fb; /* frame buffer device */ - volatile struct bt_regs *sc_bt; /* Brooktree registers */ - int sc_phys; /* display RAM (phys addr) */ + int sc_cg4type; /* A or B */ + void *sc_va_cmap; /* Colormap h/w (mapped KVA) */ + int sc_pa_overlay; /* phys. addr. of overlay plane */ + int sc_pa_enable; /* phys. addr. of enable plane */ + int sc_pa_pixmap; /* phys. addr. of color plane */ int sc_blanked; /* true if blanked */ - union bt_cmap sc_cmap; /* Brooktree color map */ + + union bt_cmap *sc_btcm; /* Brooktree color map */ + struct soft_cmap sc_cmap; /* Generic soft colormap. */ }; /* autoconfiguration driver */ @@ -98,19 +119,25 @@ struct cfdriver cgfour_cd = { /* frame buffer generic driver */ int cg4open(), cg4close(), cg4mmap(); -static int cg4gattr __P((struct fbdevice *, struct fbgattr *)); -static int cg4gvideo __P((struct fbdevice *, int *)); -static int cg4svideo __P((struct fbdevice *, int *)); +static int cg4gattr __P((struct fbdevice *, struct fbgattr *)); +static int cg4gvideo __P((struct fbdevice *, int *)); +static int cg4svideo __P((struct fbdevice *, int *)); static int cg4getcmap __P((struct fbdevice *, struct fbcmap *)); static int cg4putcmap __P((struct fbdevice *, struct fbcmap *)); -static struct fbdriver cg4fbdriver = { +static void cg4a_init __P((struct cg4_softc *)); +static void cg4a_svideo __P((struct cg4_softc *, int)); +static void cg4a_ldcmap __P((struct cg4_softc *)); + +static void cg4b_init __P((struct cg4_softc *)); +static void cg4b_svideo __P((struct cg4_softc *, int)); +static void cg4b_ldcmap __P((struct cg4_softc *)); + +static struct fbdriver cg4_fbdriver = { cg4open, cg4close, cg4mmap, cg4gattr, cg4gvideo, cg4svideo, cg4getcmap, cg4putcmap }; -static void cg4loadcmap __P((struct cg4_softc *, int, int)); - /* * Match a cg4. */ @@ -120,31 +147,39 @@ cg4match(parent, vcf, args) void *vcf, *args; { struct confargs *ca = args; - int paddr, x; + int paddr; - /* XXX - Huge hack due to lack of probe info... */ + /* XXX: Huge hack due to lack of probe info... */ + /* XXX: Machines that might have a cg4 (gag). */ + /* XXX: Need info on the "P4" register... */ switch (cpu_machine_id) { - /* Machines that might have a cg4 (gag). */ - case SUN3_MACH_50: - case SUN3_MACH_60: + case SUN3_MACH_110: + /* XXX: Assume type A. */ + if (ca->ca_paddr == -1) + ca->ca_paddr = CG4A_DEF_BASE; + if (bus_peek(ca->ca_bustype, ca->ca_paddr, 1) == -1) + return (0); + if (bus_peek(BUS_OBIO, CG4A_OBIO_CMAP, 1) == -1) + return (0); break; - default: - return (0); - } - - if (ca->ca_paddr == -1) - ca->ca_paddr = 0xFF200000; - paddr = ca->ca_paddr; - x = bus_peek(ca->ca_bustype, paddr, 1); - if (x == -1) - return (0); + case SUN3_MACH_60: + /* XXX: Assume type A. */ + if (ca->ca_paddr == -1) + ca->ca_paddr = CG4B_DEF_BASE; + paddr = ca->ca_paddr; + if (bus_peek(ca->ca_bustype, paddr, 1) == -1) + return (0); + /* Make sure we're color */ + paddr += CG4B_OFF_PIXMAP; + if (bus_peek(ca->ca_bustype, paddr, 1) == -1) + return (0); + break; - paddr += CG4REG_PIXMAP; - x = bus_peek(ca->ca_bustype, paddr, 1); - if (x == -1) + default: return (0); + } return (1); } @@ -161,10 +196,18 @@ cg4attach(parent, self, args) struct fbdevice *fb = &sc->sc_fb; struct confargs *ca = args; struct fbtype *fbt; - volatile struct bt_regs *bt; - int i; - fb->fb_driver = &cg4fbdriver; + /* XXX: should do better than this... */ + switch (cpu_machine_id) { + case SUN3_MACH_110: + sc->sc_cg4type = CG4_TYPE_A; + break; + case SUN3_MACH_60: + default: + sc->sc_cg4type = CG4_TYPE_B; + } + + fb->fb_driver = &cg4_fbdriver; fb->fb_private = sc; fb->fb_name = sc->sc_dev.dv_xname; @@ -177,28 +220,29 @@ cg4attach(parent, self, args) fbt->fb_height = 900; fbt->fb_size = CG4_MMAP_SIZE; - sc->sc_phys = ca->ca_paddr; - sc->sc_bt = bt = (volatile struct bt_regs *) - bus_mapin(ca->ca_bustype, ca->ca_paddr, - sizeof(struct bt_regs *)); - - /* grab initial (current) color map */ - bt->bt_addr = 0; - for (i = 0; i < (256 * 3 / 4); i++) - sc->sc_cmap.cm_chip[i] = bt->bt_cmap; - - /* - * BT458 chip initialization as described in Brooktree's - * 1993 Graphics and Imaging Product Databook (DB004-1/93). - */ - bt->bt_addr = 0x04; /* select read mask register */ - bt->bt_ctrl = 0xff; /* all planes on */ - bt->bt_addr = 0x05; /* select blink mask register */ - bt->bt_ctrl = 0x00; /* all planes non-blinking */ - bt->bt_addr = 0x06; /* select command register */ - bt->bt_ctrl = 0x43; /* palette enabled, overlay planes enabled */ - bt->bt_addr = 0x07; /* select test register */ - bt->bt_ctrl = 0x00; /* set test mode */ + switch (sc->sc_cg4type) { + case CG4_TYPE_A: /* Sun3/110 */ + sc->sc_va_cmap = bus_mapin(BUS_OBIO, CG4A_OBIO_CMAP, + sizeof(struct amd_regs)); + sc->sc_pa_overlay = ca->ca_paddr + CG4A_OFF_OVERLAY; + sc->sc_pa_enable = ca->ca_paddr + CG4A_OFF_ENABLE; + sc->sc_pa_pixmap = ca->ca_paddr + CG4A_OFF_PIXMAP; + sc->sc_btcm = NULL; + cg4a_init(sc); + break; + + case CG4_TYPE_B: /* Sun3/60 */ + default: + sc->sc_va_cmap = (struct bt_regs *) + bus_mapin(ca->ca_bustype, ca->ca_paddr, + sizeof(struct bt_regs *)); + sc->sc_pa_overlay = ca->ca_paddr + CG4B_OFF_OVERLAY; + sc->sc_pa_enable = ca->ca_paddr + CG4B_OFF_ENABLE; + sc->sc_pa_pixmap = ca->ca_paddr + CG4B_OFF_PIXMAP; + sc->sc_btcm = malloc(sizeof(union bt_cmap), M_DEVBUF, M_WAITOK); + cg4b_init(sc); + break; + } printf(" (%dx%d)\n", fbt->fb_width, fbt->fb_height); fb_attach(fb, 4); @@ -245,8 +289,8 @@ cg4ioctl(dev, cmd, data, flags, p) * offset, allowing for the given protection, or return -1 for error. * * X11 expects its mmap'd region to look like this: - * 128k overlay memory - * 128k overlay-enable bitmap + * 128k overlay data memory + * 128k overlay enable bitmap * 1024k color memory * * The hardware really looks like this (starting at ca_paddr) @@ -273,20 +317,18 @@ cg4mmap(dev, off, prot) if ((unsigned)off >= CG4_MMAP_SIZE) return (-1); - physbase = sc->sc_phys; if (off < 0x40000) { if (off < 0x20000) { - /* overlay plane */ - physbase += CG4REG_OVERLAY; + physbase = sc->sc_pa_overlay; } else { /* enable plane */ off -= 0x20000; - physbase += CG4REG_ENABLE; + physbase = sc->sc_pa_enable; } } else { /* pixel map */ off -= 0x40000; - physbase += CG4REG_PIXMAP; + physbase = sc->sc_pa_pixmap; } /* @@ -334,85 +376,241 @@ static int cg4svideo(fb, on) int *on; { struct cg4_softc *sc = fb->fb_private; - register volatile struct bt_regs *bt = sc->sc_bt; - - if ((*on == 0) && (sc->sc_blanked == 0)) { - /* Turn OFF video (blank it). */ - bt->bt_addr = 0x06; /* command reg */ - bt->bt_ctrl = 0x70; /* overlay plane */ - bt->bt_addr = 0x04; /* read mask */ - bt->bt_ctrl = 0x00; /* color planes */ - /* - * Set color 0 to black -- note that this overwrites - * R of color 1. - */ - bt->bt_addr = 0; - bt->bt_cmap = 0; + int state; - sc->sc_blanked = 1; - } + state = *on; + if (sc->sc_cg4type == CG4_TYPE_A) + cg4a_svideo(sc, state); + else + cg4b_svideo(sc, state); + return (0); +} - if ((*on != 0) && (sc->sc_blanked != 0)) { - /* Turn video back ON (unblank). */ - sc->sc_blanked = 0; +/* + * FBIOGETCMAP: + * Copy current colormap out to user space. + */ +static int cg4getcmap(fb, fbcm) + struct fbdevice *fb; + struct fbcmap *fbcm; +{ + struct cg4_softc *sc = fb->fb_private; + struct soft_cmap *cm = &sc->sc_cmap; + int error, start, count; - /* restore color 0 (and R of color 1) */ - bt->bt_addr = 0; - bt->bt_cmap = sc->sc_cmap.cm_chip[0]; + start = fbcm->index; + count = fbcm->count; + if ((start < 0) || (start >= CMAP_SIZE) || + (count < 0) || (start + count > CMAP_SIZE) ) + return (EINVAL); + + if ((error = copyout(&cm->r[start], fbcm->red, count)) != 0) + return (error); + + if ((error = copyout(&cm->g[start], fbcm->green, count)) != 0) + return (error); + + if ((error = copyout(&cm->b[start], fbcm->blue, count)) != 0) + return (error); - /* restore read mask */ - bt->bt_addr = 0x06; /* command reg */ - bt->bt_ctrl = 0x73; /* overlay plane */ - bt->bt_addr = 0x04; /* read mask */ - bt->bt_ctrl = 0xff; /* color planes */ - } return (0); } -/* FBIOGETCMAP: */ -static int cg4getcmap(fb, cmap) +/* + * FBIOPUTCMAP: + * Copy new colormap from user space and load. + */ +static int cg4putcmap(fb, fbcm) struct fbdevice *fb; - struct fbcmap *cmap; + struct fbcmap *fbcm; { struct cg4_softc *sc = fb->fb_private; + struct soft_cmap *cm = &sc->sc_cmap; + int error, start, count; + + start = fbcm->index; + count = fbcm->count; + if ((start < 0) || (start >= CMAP_SIZE) || + (count < 0) || (start + count > CMAP_SIZE) ) + return (EINVAL); + + if ((error = copyin(fbcm->red, &cm->r[start], count)) != 0) + return (error); + + if ((error = copyin(fbcm->green, &cm->g[start], count)) != 0) + return (error); - return (bt_getcmap(cmap, &sc->sc_cmap, 256)); + if ((error = copyin(fbcm->blue, &cm->b[start], count)) != 0) + return (error); + + if (sc->sc_cg4type == CG4_TYPE_A) + cg4a_ldcmap(sc); + else + cg4b_ldcmap(sc); + + return (0); } -/* FBIOPUTCMAP: */ -static int cg4putcmap(fb, cmap) - struct fbdevice *fb; - struct fbcmap *cmap; +/**************************************************************** + * Routines for the "Type A" hardware + ****************************************************************/ + +static void +cg4a_init(sc) + struct cg4_softc *sc; { - struct cg4_softc *sc = fb->fb_private; - int error; - - /* copy to software map */ - error = bt_putcmap(cmap, &sc->sc_cmap, 256); - if (error == 0) { - /* now blast them into the chip */ - /* XXX should use retrace interrupt */ - cg4loadcmap(sc, cmap->index, cmap->count); + volatile struct amd_regs *ar = sc->sc_va_cmap; + struct soft_cmap *cm = &sc->sc_cmap; + int i; + + /* grab initial (current) color map */ + for(i = 0; i < 256; i++) { + cm->r[i] = ar->r[i]; + cm->g[i] = ar->g[i]; + cm->b[i] = ar->b[i]; + } +} + +static void +cg4a_ldcmap(sc) + struct cg4_softc *sc; +{ + volatile struct amd_regs *ar = sc->sc_va_cmap; + struct soft_cmap *cm = &sc->sc_cmap; + int i; + + /* + * Now blast them into the chip! + * XXX Should use retrace interrupt! + * Just set a "need load" bit and let the + * retrace interrupt handler do the work. + */ + for(i = 0; i < 256; i++) { + ar->r[i] = cm->r[i]; + ar->g[i] = cm->g[i]; + ar->b[i] = cm->b[i]; } - return (error); } -/* - * Load a subset of the current (new) colormap into the Brooktree DAC. - */ static void -cg4loadcmap(sc, start, ncolors) +cg4a_svideo(sc, on) struct cg4_softc *sc; - int start, ncolors; + int on; { - volatile struct bt_regs *bt; - u_int *ip; - int count; - - ip = &sc->sc_cmap.cm_chip[BT_D4M3(start)]; /* start/4 * 3 */ - count = BT_D4M3(start + ncolors - 1) - BT_D4M3(start) + 3; - bt = sc->sc_bt; - bt->bt_addr = BT_D4M4(start); - while (--count >= 0) - bt->bt_cmap = *ip++; + volatile struct amd_regs *ar = sc->sc_va_cmap; + int i; + + if ((on == 0) && (sc->sc_blanked == 0)) { + /* Turn OFF video (make it blank). */ + sc->sc_blanked = 1; + /* Load fake "all zero" colormap. */ + for (i = 0; i < 256; i++) { + ar->r[i] = 0; + ar->g[i] = 0; + ar->b[i] = 0; + } + } + + if ((on != 0) && (sc->sc_blanked != 0)) { + /* Turn video back ON (unblank). */ + sc->sc_blanked = 0; + /* Restore normal colormap. */ + cg4a_ldcmap(sc); + } } + + +/**************************************************************** + * Routines for the "Type B" hardware + ****************************************************************/ + +static void +cg4b_init(sc) + struct cg4_softc *sc; +{ + volatile struct bt_regs *bt = sc->sc_va_cmap; + struct soft_cmap *cm = &sc->sc_cmap; + union bt_cmap *btcm = sc->sc_btcm; + int i; + + /* + * BT458 chip initialization as described in Brooktree's + * 1993 Graphics and Imaging Product Databook (DB004-1/93). + */ + bt->bt_addr = 0x04; /* select read mask register */ + bt->bt_ctrl = 0xff; /* all planes on */ + bt->bt_addr = 0x05; /* select blink mask register */ + bt->bt_ctrl = 0x00; /* all planes non-blinking */ + bt->bt_addr = 0x06; /* select command register */ + bt->bt_ctrl = 0x43; /* palette enabled, overlay planes enabled */ + bt->bt_addr = 0x07; /* select test register */ + bt->bt_ctrl = 0x00; /* set test mode */ + + /* grab initial (current) color map */ + bt->bt_addr = 0; + for (i = 0; i < (256 * 3 / 4); i++) { + btcm->cm_chip[i] = bt->bt_cmap; + } + + /* Transpose into S/W form. */ + for (i = 0; i < 256; i++) { + cm->r[i] = btcm->cm_map[i][0]; + cm->g[i] = btcm->cm_map[i][1]; + cm->b[i] = btcm->cm_map[i][2]; + } +} + +static void +cg4b_ldcmap(sc) + struct cg4_softc *sc; +{ + volatile struct bt_regs *bt = sc->sc_va_cmap; + struct soft_cmap *cm = &sc->sc_cmap; + union bt_cmap *btcm = sc->sc_btcm; + int i; + + /* + * Now blast them into the chip! + * XXX Should use retrace interrupt! + * Just set a "need load" bit and let the + * retrace interrupt handler do the work. + */ + + /* Transpose into H/W form. */ + for (i = 0; i < 256; i++) { + btcm->cm_map[i][0] = cm->r[i]; + btcm->cm_map[i][1] = cm->g[i]; + btcm->cm_map[i][2] = cm->b[i]; + } + + bt->bt_addr = 0; + for (i = 0; i < (256 * 3 / 4); i++) { + bt->bt_cmap = btcm->cm_chip[i]; + } +} + +static void +cg4b_svideo(sc, on) + struct cg4_softc *sc; + int on; +{ + volatile struct bt_regs *bt = sc->sc_va_cmap; + int i; + + if ((on == 0) && (sc->sc_blanked == 0)) { + /* Turn OFF video (make it blank). */ + sc->sc_blanked = 1; + /* Load fake "all zero" colormap. */ + bt->bt_addr = 0; + for (i = 0; i < (256 * 3 / 4); i++) + bt->bt_cmap = 0; + } + + if ((on != 0) && (sc->sc_blanked != 0)) { + /* Turn video back ON (unblank). */ + sc->sc_blanked = 0; + /* Restore normal colormap. */ + cg4b_ldcmap(sc); + } +} + diff --git a/sys/arch/sun3/dev/cg4reg.h b/sys/arch/sun3/dev/cg4reg.h index 26627597489..51ec9638bd3 100644 --- a/sys/arch/sun3/dev/cg4reg.h +++ b/sys/arch/sun3/dev/cg4reg.h @@ -1,4 +1,4 @@ -/* $NetBSD: cg4reg.h,v 1.2 1995/04/07 02:47:40 gwr Exp $ */ +/* $NetBSD: cg4reg.h,v 1.3 1996/10/29 19:54:21 gwr Exp $ */ /* * Copyright (c) 1992, 1993 @@ -44,20 +44,51 @@ * @(#)cgthreereg.h 8.2 (Berkeley) 10/30/93 */ -/* Size that can be mapped. */ +/* + * Size that can be mapped (user-level mmap). + */ #define CG4_OVERLAY_SIZE 0x20000 /* size of overlay plane */ #define CG4_ENABLE_SIZE 0x20000 /* size of enable plane */ #define CG4_PIXMAP_SIZE 0x100000 /* size of frame buffer */ -#define CG4_MMAP_SIZE 0x140000 /* total mapping size */ + +/* number of colormap entries */ +#define CG4_CMAP_ENTRIES 256 + +/* + * There are two kinds of cg4 hardware: + * "Type A" has a AMD DACs (Digital-to-Analog Converters) + * "Type B" has a Brooktree DACs. H/W addresses differ too. + */ +#define CG4_TYPE_A 0 +#define CG4_TYPE_B 1 + +/* + * Memory layout of the Type A hardware (OBMEM) + */ +#define CG4A_DEF_BASE 0xFE400000 /* Sun3/110 */ +#define CG4A_OFF_ENABLE 0 +#define CG4A_OFF_PIXMAP 0x400000 +#define CG4A_OFF_OVERLAY 0xC00000 +#define CG4A_OBIO_CMAP 0x0E0000 /* OBIO space! */ + +/* colormap/status register structure */ +struct amd_regs { + u_char r[CG4_CMAP_ENTRIES]; + u_char g[CG4_CMAP_ENTRIES]; + u_char b[CG4_CMAP_ENTRIES]; + u_char status; +#define CG4A_STATUS_FIRSTHALF 0x80 +#define CG4A_STATUS_TOOLATE 0x40 +}; /* - * cgthree display registers. Much like bwtwo registers, except that - * there is a Brooktree Video DAC in there (so we also use btreg.h). + * Memory layout of the Type B hardware (OBMEM) + * Appears on the Sun3/60 at base 0xFF200000 */ +#define CG4B_DEF_BASE 0xFF200000 /* Sun3/60 */ +#define CG4B_OFF_CMAP 0 +#define CG4B_OFF_OVERLAY 0x200000 +#define CG4B_OFF_ENABLE 0x400000 +#define CG4B_OFF_PIXMAP 0x600000 -/* offsets (i.e. from 0xFF200000) */ -#define CG4REG_CMAP 0 -#define CG4REG_OVERLAY 0x200000 -#define CG4REG_ENABLE 0x400000 -#define CG4REG_PIXMAP 0x600000 diff --git a/sys/arch/sun3/dev/fbvar.h b/sys/arch/sun3/dev/fbvar.h index 8e5b3598519..aae60c99151 100644 --- a/sys/arch/sun3/dev/fbvar.h +++ b/sys/arch/sun3/dev/fbvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: fbvar.h,v 1.2 1995/04/07 02:51:21 gwr Exp $ */ +/* $NetBSD: fbvar.h,v 1.3 1996/10/29 19:27:37 gwr Exp $ */ /* * Copyright (c) 1992, 1993 @@ -78,6 +78,6 @@ struct fbdriver { int (*fbd_putcmap) __P((struct fbdevice *, struct fbcmap *)); }; -void fbattach __P((struct fbdevice *, int)); +void fb_attach __P((struct fbdevice *, int)); int fbioctlfb __P((struct fbdevice *, u_long, caddr_t)); extern int enoioctl(); diff --git a/sys/arch/sun3/dev/idprom.c b/sys/arch/sun3/dev/idprom.c index 7dd09171120..70c9d2f2892 100644 --- a/sys/arch/sun3/dev/idprom.c +++ b/sys/arch/sun3/dev/idprom.c @@ -1,9 +1,12 @@ -/* $NetBSD: idprom.c,v 1.12 1996/03/26 15:16:09 gwr Exp $ */ +/* $NetBSD: idprom.c,v 1.13 1996/11/20 18:56:50 gwr Exp $ */ -/* - * Copyright (c) 1993 Adam Glass +/*- + * 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: @@ -14,20 +17,23 @@ * 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 Adam Glass. - * 4. The name of the authors may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * 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 AUTHORS ``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 AUTHORS 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 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 REGENTS 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. */ /* diff --git a/sys/arch/sun3/dev/if_ie.c b/sys/arch/sun3/dev/if_ie.c index 2ab99bc4a20..32f52c05e8f 100644 --- a/sys/arch/sun3/dev/if_ie.c +++ b/sys/arch/sun3/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ie.c,v 1.12 1996/05/09 21:15:47 thorpej Exp $ */ +/* $NetBSD: if_ie.c,v 1.15 1996/10/30 00:24:33 gwr Exp $ */ /*- * Copyright (c) 1993, 1994, 1995 Charles Hannum. @@ -269,7 +269,7 @@ ie_attach(sc) int off; /* MD code has done its part before calling this. */ - printf(" hwaddr %s\n", ether_sprintf(sc->sc_addr)); + printf(": hwaddr %s\n", ether_sprintf(sc->sc_addr)); /* Allocate from end of buffer space for ISCP, SCB */ off = sc->buf_area_sz; diff --git a/sys/arch/sun3/dev/if_ie_obio.c b/sys/arch/sun3/dev/if_ie_obio.c index a163ea497ab..76307fa0c92 100644 --- a/sys/arch/sun3/dev/if_ie_obio.c +++ b/sys/arch/sun3/dev/if_ie_obio.c @@ -1,9 +1,12 @@ -/* $NetBSD: if_ie_obio.c,v 1.2 1996/03/26 22:04:19 gwr Exp $ */ +/* $NetBSD: if_ie_obio.c,v 1.6 1996/11/20 18:56:51 gwr Exp $ */ -/* - * Copyright (c) 1994 Gordon W. Ross +/*- + * Copyright (c) 1996 The NetBSD Foundation, Inc. * All rights reserved. * + * This code is derived from software contributed to The NetBSD Foundation + * by Gordon W. Ross. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -14,20 +17,23 @@ * 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 Gordon Ross - * 4. The name of the Author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * 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 AUTHOR ``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 AUTHOR 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 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 REGENTS 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. */ /* @@ -84,28 +90,16 @@ ie_obio_match(parent, vcf, args) { struct cfdata *cf = vcf; struct confargs *ca = args; - int pa, x; -#ifdef DIAGNOSTIC - if (ca->ca_bustype != BUS_OBIO) { - printf("ie_obio_match: bustype %d?\n", ca->ca_bustype); + /* Make sure there is something there... */ + if (bus_peek(ca->ca_bustype, ca->ca_paddr, 1) == -1) return (0); - } -#endif - /* - * OBIO match functions may be called for every possible - * physical address, so match only our physical address. - */ - if ((pa = cf->cf_paddr) == -1) { - /* Use our default PA. */ - pa = OBIO_INTEL_ETHER; - } - if (pa != ca->ca_paddr) - return (0); + /* Default interrupt priority. */ + if (ca->ca_intpri == -1) + ca->ca_intpri = 3; - x = bus_peek(ca->ca_bustype, ca->ca_paddr, 1); - return (x != -1); + return (1); } void @@ -117,12 +111,6 @@ ie_obio_attach(parent, self, args) struct ie_softc *sc = (void *) self; struct cfdata *cf = self->dv_cfdata; struct confargs *ca = args; - int intpri; - - /* Default interrupt level. */ - if ((intpri = cf->cf_intpri) == -1) - intpri = 3; - printf(" level %d", intpri); sc->hard_type = IE_OBIO; sc->reset_586 = ie_obreset; @@ -177,7 +165,7 @@ ie_obio_attach(parent, self, args) ie_attach(sc); /* Install interrupt handler. */ - isr_add_autovect(ie_intr, (void *)sc, intpri); + isr_add_autovect(ie_intr, (void *)sc, ca->ca_intpri); } diff --git a/sys/arch/sun3/dev/if_le.c b/sys/arch/sun3/dev/if_le.c index 63d008828e7..c4ae12b0394 100644 --- a/sys/arch/sun3/dev/if_le.c +++ b/sys/arch/sun3/dev/if_le.c @@ -1,12 +1,11 @@ -/* $NetBSD: if_le.c,v 1.29 1996/05/07 01:32:31 thorpej Exp $ */ +/* $NetBSD: if_le.c,v 1.33 1996/11/20 18:56:52 gwr Exp $ */ /*- - * Copyright (c) 1995 Charles M. Hannum. All rights reserved. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. + * Copyright (c) 1996 The NetBSD Foundation, Inc. + * All rights reserved. * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell and Rick Macklem. + * 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 @@ -18,25 +17,23 @@ * 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 University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. + * 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 REGENTS 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 REGENTS 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. - * - * @(#)if_le.c 8.2 (Berkeley) 11/16/93 + * 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 REGENTS 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. */ #include "bpfilter.h" @@ -65,8 +62,24 @@ #include <dev/ic/am7990reg.h> #include <dev/ic/am7990var.h> -#include <sun3/dev/if_lereg.h> -#include <sun3/dev/if_levar.h> +/* + * LANCE registers. + * The real stuff is in dev/ic/am7990reg.h + */ +struct lereg1 { + volatile u_int16_t ler1_rdp; /* data port */ + volatile u_int16_t ler1_rap; /* register select port */ +}; + +/* + * Ethernet software status per interface. + * The real stuff is in dev/ic/am7990var.h + */ +struct le_softc { + struct am7990_softc sc_am7990; /* glue to MI code */ + + struct lereg1 *sc_r1; /* LANCE registers */ +}; static int le_match __P((struct device *, void *, void *)); static void le_attach __P((struct device *, struct device *, void *)); @@ -109,22 +122,16 @@ le_match(parent, vcf, aux) { struct cfdata *cf = vcf; struct confargs *ca = aux; - int pa, x; - - /* - * OBIO match functions may be called for every possible - * physical address, so match only our physical address. - */ - if ((pa = cf->cf_paddr) == -1) { - /* Use our default PA. */ - pa = OBIO_AMD_ETHER; - } - if (pa != ca->ca_paddr) + + /* Make sure there is something there... */ + if (bus_peek(ca->ca_bustype, ca->ca_paddr, 1) == -1) return (0); - /* The peek returns -1 on bus error. */ - x = bus_peek(ca->ca_bustype, ca->ca_paddr, 1); - return (x != -1); + /* Default interrupt priority. */ + if (ca->ca_intpri == -1) + ca->ca_intpri = 3; + + return (1); } void @@ -136,12 +143,6 @@ le_attach(parent, self, aux) struct am7990_softc *sc = &lesc->sc_am7990; struct cfdata *cf = self->dv_cfdata; struct confargs *ca = aux; - int intpri; - - /* Default interrupt level. */ - if ((intpri = cf->cf_intpri) == -1) - intpri = 3; - printf(" level %d", intpri); lesc->sc_r1 = (struct lereg1 *) obio_alloc(ca->ca_paddr, OBIO_AMD_ETHER_SIZE); @@ -166,5 +167,5 @@ le_attach(parent, self, aux) am7990_config(sc); /* Install interrupt handler. */ - isr_add_autovect(am7990_intr, (void *)sc, intpri); + isr_add_autovect(am7990_intr, (void *)sc, ca->ca_intpri); } diff --git a/sys/arch/sun3/dev/kd.c b/sys/arch/sun3/dev/kd.c index 6f7c9664570..c3326cc689a 100644 --- a/sys/arch/sun3/dev/kd.c +++ b/sys/arch/sun3/dev/kd.c @@ -1,9 +1,12 @@ -/* $NetBSD: kd.c,v 1.17 1996/06/15 14:58:02 gwr Exp $ */ +/* $NetBSD: kd.c,v 1.21 1996/11/20 18:56:55 gwr Exp $ */ -/* - * Copyright (c) 1994, 1995 Gordon W. Ross +/*- + * Copyright (c) 1996 The NetBSD Foundation, Inc. * All rights reserved. * + * This code is derived from software contributed to The NetBSD Foundation + * by Gordon W. Ross. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -12,22 +15,25 @@ * 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. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * 4. All advertising materials mentioning features or use of this software + * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Gordon Ross + * 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 AUTHOR ``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 AUTHOR 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 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 REGENTS 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. */ /* @@ -259,7 +265,7 @@ kdparam(tp, t) } -int +void kdstop(tp, flag) struct tty *tp; int flag; diff --git a/sys/arch/sun3/dev/memerr.c b/sys/arch/sun3/dev/memerr.c index e71b10f4c7a..676aef73f96 100644 --- a/sys/arch/sun3/dev/memerr.c +++ b/sys/arch/sun3/dev/memerr.c @@ -1,4 +1,4 @@ -/* $NetBSD: memerr.c,v 1.2 1996/04/07 05:47:28 gwr Exp $ */ +/* $NetBSD: memerr.c,v 1.6 1996/11/13 07:05:14 thorpej Exp $ */ /* * Copyright (c) 1992, 1993 @@ -92,22 +92,20 @@ memerr_match(parent, vcf, args) { struct cfdata *cf = vcf; struct confargs *ca = args; - int pa, x; /* This driver only supports one unit. */ if (cf->cf_unit != 0) return (0); - if ((pa = cf->cf_paddr) == -1) { - /* Use our default PA. */ - pa = OBIO_MEMERR; - } - if (pa != ca->ca_paddr) + /* The peek returns -1 on bus error. */ + if (bus_peek(ca->ca_bustype, ca->ca_paddr, 1) == -1) return (0); - /* The peek returns -1 on bus error. */ - x = bus_peek(ca->ca_bustype, ca->ca_paddr, 1); - return (x != -1); + /* Default interrupt priority. */ + if (ca->ca_intpri == -1) + ca->ca_intpri = ME_PRI; + + return (1); } static void @@ -120,12 +118,6 @@ memerr_attach(parent, self, args) struct confargs *ca = args; struct memerr *mer; - mer = (struct memerr *) - obio_alloc(ca->ca_paddr, sizeof(*mer)); - if (mer == NULL) - panic(": can not map register"); - sc->sc_reg = mer; - /* * Which type of memory subsystem do we have? */ @@ -143,11 +135,17 @@ memerr_attach(parent, self, args) sc->sc_csrbits = ME_PAR_STR; break; } + printf(": (%s memory)\n", sc->sc_typename); - printf(" (%s memory)\n", sc->sc_typename); + mer = (struct memerr *) + obio_alloc(ca->ca_paddr, sizeof(*mer)); + if (mer == NULL) + panic("memerr: can not map register"); + sc->sc_reg = mer; /* Install interrupt handler. */ - isr_add_autovect(memerr_interrupt, (void *)sc, ME_PRI); + isr_add_autovect(memerr_interrupt, + (void *)sc, ca->ca_intpri); /* Enable error interrupt (and checking). */ if (sc->sc_type == ME_PAR) @@ -175,6 +173,7 @@ memerr_interrupt(arg) u_char csr, ctx, err; u_int pa, va; int pte; + char bits[64]; csr = me->me_csr; if ((csr & ME_CSR_IPEND) == 0) @@ -190,7 +189,8 @@ memerr_interrupt(arg) (ctx & 8) ? "DVMA" : "CPU"); printf(" ctx=%d, vaddr=0x%x, paddr=0x%x\n", (ctx & 7), va, pa); - printf(" csr=%b\n", csr, sc->sc_csrbits); + printf(" csr=%s\n", bitmask_snprintf(csr, sc->sc_csrbits, + bits, sizeof(bits))); /* * If we have parity-checked memory, there is diff --git a/sys/arch/sun3/dev/obio.c b/sys/arch/sun3/dev/obio.c index 8573ec2ef7a..c015d61116c 100644 --- a/sys/arch/sun3/dev/obio.c +++ b/sys/arch/sun3/dev/obio.c @@ -1,10 +1,12 @@ -/* $NetBSD: obio.c,v 1.18 1996/03/26 15:16:14 gwr Exp $ */ +/* $NetBSD: obio.c,v 1.23 1996/11/20 18:56:56 gwr Exp $ */ -/* - * Copyright (c) 1994 Gordon W. Ross - * Copyright (c) 1993 Adam Glass +/*- + * 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: @@ -15,20 +17,23 @@ * 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 Adam Glass and Gordon Ross. - * 4. The name of the authors may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * 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 AUTHORS ``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 AUTHORS 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 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 REGENTS 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. */ #include <sys/param.h> @@ -43,7 +48,8 @@ static int obio_match __P((struct device *, void *, void *)); static void obio_attach __P((struct device *, struct device *, void *)); -static int obio_print __P((void *, char *parentname)); +static int obio_print __P((void *, const char *parentname)); +static int obio_submatch __P((struct device *, void *, void *)); struct cfattach obio_ca = { sizeof(struct device), obio_match, obio_attach @@ -87,7 +93,7 @@ obio_attach(parent, self, aux) ca->ca_intpri = -1; ca->ca_intvec = -1; - (void) config_found(self, ca, obio_print); + (void) config_found_sm(self, ca, obio_print, obio_submatch); } } @@ -98,7 +104,7 @@ obio_attach(parent, self, aux) static int obio_print(args, name) void *args; - char *name; + const char *name; { struct confargs *ca = args; @@ -106,11 +112,41 @@ obio_print(args, name) if (name) return(QUIET); - printf(" addr 0x%x", ca->ca_paddr); + if (ca->ca_paddr != -1) + printf(" addr 0x%x", ca->ca_paddr); + if (ca->ca_intpri != -1) + printf(" level %d", ca->ca_intpri); return(UNCONF); } +int +obio_submatch(parent, vcf, aux) + struct device *parent; + void *vcf, *aux; +{ + struct cfdata *cf = vcf; + struct confargs *ca = aux; + cfmatch_t submatch; + + /* + * Default addresses are mostly useless for OBIO. + * The address assignments are fixed for all time, + * so our config files might as well reflect that. + */ + if (cf->cf_paddr != ca->ca_paddr) + return 0; + + /* Now call the match function of the potential child. */ + submatch = cf->cf_attach->ca_match; + if (submatch == NULL) + panic("obio_submatch: no match function for: %s\n", + cf->cf_driver->cd_name); + + return ((*submatch)(parent, vcf, aux)); +} + + /*****************************************************************/ /* diff --git a/sys/arch/sun3/dev/si.c b/sys/arch/sun3/dev/si.c index 0bf52d046bc..3047596157e 100644 --- a/sys/arch/sun3/dev/si.c +++ b/sys/arch/sun3/dev/si.c @@ -1,10 +1,12 @@ -/* $NetBSD: si.c,v 1.25 1996/06/17 23:21:29 gwr Exp $ */ +/* $NetBSD: si.c,v 1.31 1996/11/20 18:56:59 gwr Exp $ */ -/* - * Copyright (c) 1995 David Jones, Gordon W. Ross - * Copyright (c) 1994 Adam Glass +/*- + * Copyright (c) 1996 The NetBSD Foundation, Inc. * All rights reserved. * + * This code is derived from software contributed to The NetBSD Foundation + * by Adam Glass, David Jones, 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: @@ -13,23 +15,25 @@ * 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. The name of the authors may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * 4. All advertising materials mentioning features or use of this software + * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by - * Adam Glass, David Jones, and Gordon Ross + * 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 AUTHORS ``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 AUTHORS 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 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 REGENTS 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. */ /* @@ -99,6 +103,12 @@ #include "sireg.h" #include "sivar.h" +/* + * Transfers smaller than this are done using PIO + * (on assumption they're not worth DMA overhead) + */ +#define MIN_DMA_LEN 128 + int si_debug = 0; #ifdef DEBUG static int si_link_flags = 0 /* | SDEV_DB2 */ ; @@ -108,7 +118,6 @@ static int si_link_flags = 0 /* | SDEV_DB2 */ ; int si_dma_intr_timo = 500; /* ticks (sec. X 100) */ static void si_minphys __P((struct buf *)); -static int si_print __P((void *, char *)); static struct scsi_adapter si_ops = { ncr5380_scsi_cmd, /* scsi_cmd() */ @@ -145,8 +154,25 @@ si_attach(sc) int i; /* + * Support the "options" (config file flags). + */ + if ((sc->sc_options & SI_DO_RESELECT) != 0) + ncr_sc->sc_flags |= NCR5380_PERMIT_RESELECT; + if ((sc->sc_options & SI_DMA_INTR) == 0) + ncr_sc->sc_flags |= NCR5380_FORCE_POLLING; +#if 1 /* XXX - Temporary */ + /* XXX - In case we think DMA is completely broken... */ + if ((sc->sc_options & SI_ENABLE_DMA) == 0) { + /* Override this function pointer. */ + ncr_sc->sc_dma_alloc = NULL; + } +#endif + ncr_sc->sc_min_dma_len = MIN_DMA_LEN; + + /* * Fill in the prototype scsi_link. */ + ncr_sc->sc_link.channel = SCSI_CHANNEL_ONLY_ONE; ncr_sc->sc_link.adapter_softc = sc; ncr_sc->sc_link.adapter_target = 7; ncr_sc->sc_link.adapter = &si_ops; @@ -187,17 +213,7 @@ si_attach(sc) si_reset_adapter(ncr_sc); ncr5380_init(ncr_sc); ncr5380_reset_scsibus(ncr_sc); - config_found(&(ncr_sc->sc_dev), &(ncr_sc->sc_link), si_print); -} - -static int -si_print(aux, name) - void *aux; - char *name; -{ - if (name != NULL) - printf("%s: scsibus ", name); - return UNCONF; + config_found(&(ncr_sc->sc_dev), &(ncr_sc->sc_link), scsiprint); } static void diff --git a/sys/arch/sun3/dev/si_obio.c b/sys/arch/sun3/dev/si_obio.c index 61c073f81a6..793c0a3b26c 100644 --- a/sys/arch/sun3/dev/si_obio.c +++ b/sys/arch/sun3/dev/si_obio.c @@ -1,10 +1,12 @@ -/* $NetBSD: si_obio.c,v 1.2 1996/06/17 23:21:35 gwr Exp $ */ +/* $NetBSD: si_obio.c,v 1.7 1996/11/20 18:57:00 gwr Exp $ */ -/* - * Copyright (c) 1995 David Jones, Gordon W. Ross - * Copyright (c) 1994 Adam Glass +/*- + * Copyright (c) 1996 The NetBSD Foundation, Inc. * All rights reserved. * + * This code is derived from software contributed to The NetBSD Foundation + * by Adam Glass, David Jones, 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: @@ -13,23 +15,25 @@ * 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. The name of the authors may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * 4. All advertising materials mentioning features or use of this software + * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by - * Adam Glass, David Jones, and Gordon Ross + * 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 AUTHORS ``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 AUTHORS 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 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 REGENTS 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. */ /* @@ -128,9 +132,6 @@ struct cfattach si_obio_ca = { /* Options. Interesting values are: 1,3,7 */ /* XXX: Using 1 for now to mask a (pmap?) bug not yet found... */ int si_obio_options = 1; /* XXX */ -#define SI_ENABLE_DMA 1 /* Use DMA (maybe polled) */ -#define SI_DMA_INTR 2 /* DMA completion interrupts */ -#define SI_DO_RESELECT 4 /* Allow disconnect/reselect */ static int @@ -140,38 +141,16 @@ si_obio_match(parent, vcf, args) { struct cfdata *cf = vcf; struct confargs *ca = args; - int pa, x; - -#ifdef DIAGNOSTIC - if (ca->ca_bustype != BUS_OBIO) { - printf("si_obio_match: bustype %d?\n", ca->ca_bustype); - return (0); - } -#endif - /* - * OBIO match functions may be called for every possible - * physical address, so match only our physical address. - */ - if ((pa = cf->cf_paddr) == -1) { - /* Use our default PA. */ - pa = OBIO_NCR_SCSI; - } - if (pa != ca->ca_paddr) + /* Make sure there is something there... */ + if (bus_peek(ca->ca_bustype, ca->ca_paddr + 1, 1) == -1) return (0); -#if 0 - if ((cpu_machine_id != SUN3_MACH_50) && - (cpu_machine_id != SUN3_MACH_60) ) - { - /* Only 3/50 and 3/60 have the obio si. */ - return (0); - } -#endif + /* Default interrupt priority. */ + if (ca->ca_intpri == -1) + ca->ca_intpri = 2; - /* Make sure there is something there... */ - x = bus_peek(ca->ca_bustype, ca->ca_paddr + 1, 1); - return (x != -1); + return (1); } static void @@ -183,21 +162,10 @@ si_obio_attach(parent, self, args) struct ncr5380_softc *ncr_sc = &sc->ncr_sc; struct cfdata *cf = self->dv_cfdata; struct confargs *ca = args; - int intpri; - - /* Default interrupt level. */ - if ((intpri = cf->cf_intpri) == -1) - intpri = 2; - printf(" level %d", intpri); - /* XXX: Get options from flags... */ - printf(" : options=%d\n", si_obio_options); - - ncr_sc->sc_flags = 0; - if (si_obio_options & SI_DO_RESELECT) - ncr_sc->sc_flags |= NCR5380_PERMIT_RESELECT; - if ((si_obio_options & SI_DMA_INTR) == 0) - ncr_sc->sc_flags |= NCR5380_FORCE_POLLING; + /* Get options from config flags... */ + sc->sc_options = cf->cf_flags | si_obio_options; + printf(": options=%d\n", sc->sc_options); sc->sc_adapter_type = ca->ca_bustype; sc->sc_regs = (struct si_regs *) @@ -218,21 +186,11 @@ si_obio_attach(parent, self, args) ncr_sc->sc_intr_on = NULL; ncr_sc->sc_intr_off = NULL; - ncr_sc->sc_min_dma_len = MIN_DMA_LEN; - -#if 1 /* XXX - Temporary */ - /* XXX - In case we think DMA is completely broken... */ - if ((si_obio_options & SI_ENABLE_DMA) == 0) { - /* Override this function pointer. */ - ncr_sc->sc_dma_alloc = NULL; - } -#endif - /* Need DVMA-capable memory for the UDC command block. */ sc->sc_dmacmd = dvma_malloc(sizeof (struct udc_table)); /* Attach interrupt handler. */ - isr_add_autovect(si_intr, (void *)sc, intpri); + isr_add_autovect(si_intr, (void *)sc, ca->ca_intpri); /* Do the common attach stuff. */ si_attach(sc); diff --git a/sys/arch/sun3/dev/si_vme.c b/sys/arch/sun3/dev/si_vme.c index d29bc905ee3..3b94011b255 100644 --- a/sys/arch/sun3/dev/si_vme.c +++ b/sys/arch/sun3/dev/si_vme.c @@ -1,10 +1,12 @@ -/* $NetBSD: si_vme.c,v 1.2 1996/06/17 23:21:39 gwr Exp $ */ +/* $NetBSD: si_vme.c,v 1.7 1996/11/20 18:57:01 gwr Exp $ */ -/* - * Copyright (c) 1995 David Jones, Gordon W. Ross - * Copyright (c) 1994 Adam Glass +/*- + * Copyright (c) 1996 The NetBSD Foundation, Inc. * All rights reserved. * + * This code is derived from software contributed to The NetBSD Foundation + * by Adam Glass, David Jones, 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: @@ -13,23 +15,25 @@ * 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. The name of the authors may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * 4. All advertising materials mentioning features or use of this software + * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by - * Adam Glass, David Jones, and Gordon Ross + * 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 AUTHORS ``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 AUTHORS 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 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 REGENTS 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. */ /* @@ -103,12 +107,6 @@ #include "sireg.h" #include "sivar.h" -/* - * Transfers smaller than this are done using PIO - * (on assumption they're not worth DMA overhead) - */ -#define MIN_DMA_LEN 128 - void si_vme_dma_setup __P((struct ncr5380_softc *)); void si_vme_dma_start __P((struct ncr5380_softc *)); void si_vme_dma_eop __P((struct ncr5380_softc *)); @@ -130,9 +128,6 @@ struct cfattach si_vmes_ca = { /* Options. Interesting values are: 1,3,7 */ int si_vme_options = 3; -#define SI_ENABLE_DMA 1 /* Use DMA (maybe polled) */ -#define SI_DMA_INTR 2 /* DMA completion interrupts */ -#define SI_DO_RESELECT 4 /* Allow disconnect/reselect */ static int @@ -142,7 +137,7 @@ si_vmes_match(parent, vcf, args) { struct cfdata *cf = vcf; struct confargs *ca = args; - int x, probe_addr; + int probe_addr; #ifdef DIAGNOSTIC if (ca->ca_bustype != BUS_VME16) { @@ -151,13 +146,6 @@ si_vmes_match(parent, vcf, args) } #endif - if ((cpu_machine_id == SUN3_MACH_50) || - (cpu_machine_id == SUN3_MACH_60) ) - { - /* Sun3/50 or Sun3/60 do not have VME. */ - return(0); - } - /* * Other Sun3 models may have VME "si" or "sc". * This driver has no default address. @@ -165,13 +153,9 @@ si_vmes_match(parent, vcf, args) if (ca->ca_paddr == -1) return (0); - /* Default interrupt priority always splbio==2 */ - if (ca->ca_intpri == -1) - ca->ca_intpri = 2; - /* Make sure there is something there... */ - x = bus_peek(ca->ca_bustype, ca->ca_paddr + 1, 1); - if (x == -1) + probe_addr = ca->ca_paddr + 1; + if (bus_peek(ca->ca_bustype, probe_addr, 1) == -1) return (0); /* @@ -181,8 +165,8 @@ si_vmes_match(parent, vcf, args) * 4K bytes in VME space but the "si" board occupies 2K bytes. */ /* Note: the "si" board should NOT respond here. */ - x = bus_peek(ca->ca_bustype, ca->ca_paddr + 0x801, 1); - if (x != -1) { + probe_addr = ca->ca_paddr + 0x801; + if (bus_peek(ca->ca_bustype, probe_addr, 1) != -1) { /* Something responded at 2K+1. Maybe an "sc" board? */ #ifdef DEBUG printf("si_vmes_match: May be an `sc' board at pa=0x%x\n", @@ -191,9 +175,12 @@ si_vmes_match(parent, vcf, args) return(0); } - return (1); -} + /* Default interrupt priority (always splbio==2) */ + if (ca->ca_intpri == -1) + ca->ca_intpri = 2; + return (1); +} static void si_vmes_attach(parent, self, args) @@ -201,33 +188,26 @@ si_vmes_attach(parent, self, args) void *args; { struct si_softc *sc = (struct si_softc *) self; - struct ncr5380_softc *ncr_sc = (struct ncr5380_softc *)sc; + struct ncr5380_softc *ncr_sc = &sc->ncr_sc; + struct cfdata *cf = self->dv_cfdata; struct confargs *ca = args; - int s; - /* XXX: Get options from flags... */ - printf(" : options=%d\n", si_vme_options); - - ncr_sc->sc_flags = 0; - if (si_vme_options & SI_DO_RESELECT) - ncr_sc->sc_flags |= NCR5380_PERMIT_RESELECT; - if ((si_vme_options & SI_DMA_INTR) == 0) - ncr_sc->sc_flags |= NCR5380_FORCE_POLLING; + /* Get options from config flags... */ + sc->sc_options = cf->cf_flags | si_vme_options; + printf(": options=%d\n", sc->sc_options); sc->sc_adapter_type = ca->ca_bustype; - sc->sc_adapter_iv_am = - VME_SUPV_DATA_24 | (ca->ca_intvec & 0xFF); - sc->sc_regs = (struct si_regs *) bus_mapin(ca->ca_bustype, ca->ca_paddr, sizeof(struct si_regs)); + sc->sc_adapter_iv_am = + VME_SUPV_DATA_24 | (ca->ca_intvec & 0xFF); /* * MD function pointers used by the MI code. */ ncr_sc->sc_pio_out = ncr5380_pio_out; ncr_sc->sc_pio_in = ncr5380_pio_in; - ncr_sc->sc_dma_alloc = si_dma_alloc; ncr_sc->sc_dma_free = si_dma_free; ncr_sc->sc_dma_setup = si_vme_dma_setup; @@ -238,16 +218,6 @@ si_vmes_attach(parent, self, args) ncr_sc->sc_intr_on = si_vme_intr_on; ncr_sc->sc_intr_off = si_vme_intr_off; - ncr_sc->sc_min_dma_len = MIN_DMA_LEN; - -#if 1 /* XXX - Temporary */ - /* XXX - In case we think DMA is completely broken... */ - if ((si_vme_options & SI_ENABLE_DMA) == 0) { - /* Override this function pointer. */ - ncr_sc->sc_dma_alloc = NULL; - } -#endif - /* Attach interrupt handler. */ isr_add_vectored(si_intr, (void *)sc, ca->ca_intpri, ca->ca_intvec); diff --git a/sys/arch/sun3/dev/sivar.h b/sys/arch/sun3/dev/sivar.h index 1bbaee4b7b3..fea6c6343fc 100644 --- a/sys/arch/sun3/dev/sivar.h +++ b/sys/arch/sun3/dev/sivar.h @@ -1,9 +1,12 @@ -/* $NetBSD: sivar.h,v 1.1 1996/03/26 15:01:15 gwr Exp $ */ +/* $NetBSD: sivar.h,v 1.3 1996/11/20 18:57:01 gwr Exp $ */ -/* - * Copyright (c) 1995 David Jones, Gordon W. Ross +/*- + * Copyright (c) 1996 The NetBSD Foundation, Inc. * All rights reserved. * + * This code is derived from software contributed to The NetBSD Foundation + * by Adam Glass, David Jones, 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: @@ -12,23 +15,25 @@ * 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. The name of the authors may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * 4. All advertising materials mentioning features or use of this software + * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by - * David Jones and Gordon Ross + * 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 AUTHORS ``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 AUTHORS 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 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 REGENTS 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. */ /* @@ -71,12 +76,19 @@ struct si_softc { volatile struct si_regs *sc_regs; int sc_adapter_type; int sc_adapter_iv_am; /* int. vec + address modifier */ + int sc_options; /* options for this instance */ int sc_reqlen; /* requested transfer length */ struct si_dma_handle *sc_dma; /* DMA command block for the OBIO controller. */ void *sc_dmacmd; }; +/* Options. Interesting values are: 1,3,7 */ +#define SI_ENABLE_DMA 1 /* Use DMA (maybe polled) */ +#define SI_DMA_INTR 2 /* DMA completion interrupts */ +#define SI_DO_RESELECT 4 /* Allow disconnect/reselect */ +/* The options are taken from the config file (PR#1929) */ + extern int si_debug; void si_attach __P((struct si_softc *)); diff --git a/sys/arch/sun3/dev/xd.c b/sys/arch/sun3/dev/xd.c index d5b8508dd81..103e714239f 100644 --- a/sys/arch/sun3/dev/xd.c +++ b/sys/arch/sun3/dev/xd.c @@ -1,4 +1,4 @@ -/* $NetBSD: xd.c,v 1.7 1996/03/17 02:04:07 thorpej Exp $ */ +/* $NetBSD: xd.c,v 1.10 1996/10/13 03:47:39 christos Exp $ */ /* * @@ -36,7 +36,7 @@ * x d . c x y l o g i c s 7 5 3 / 7 0 5 3 v m e / s m d d r i v e r * * author: Chuck Cranor <chuck@ccrc.wustl.edu> - * id: $NetBSD: xd.c,v 1.7 1996/03/17 02:04:07 thorpej Exp $ + * id: $NetBSD: xd.c,v 1.10 1996/10/13 03:47:39 christos Exp $ * started: 27-Feb-95 * references: [1] Xylogics Model 753 User's Manual * part number: 166-753-001, Revision B, May 21, 1988. @@ -101,7 +101,8 @@ * XDC_HWAIT: add iorq "N" to head of SC's wait queue */ #define XDC_HWAIT(SC, N) { \ - (SC)->waithead = ((SC)->waithead - 1) % XDC_MAXIOPB; \ + (SC)->waithead = ((SC)->waithead == 0) ? \ + (XDC_MAXIOPB - 1) : ((SC)->waithead - 1); \ (SC)->waitq[(SC)->waithead] = (N); \ (SC)->nwait++; \ } diff --git a/sys/arch/sun3/dev/zs.c b/sys/arch/sun3/dev/zs.c index c1f66193975..da46ddf06b2 100644 --- a/sys/arch/sun3/dev/zs.c +++ b/sys/arch/sun3/dev/zs.c @@ -1,9 +1,12 @@ -/* $NetBSD: zs.c,v 1.38 1996/06/17 15:17:06 gwr Exp $ */ +/* $NetBSD: zs.c,v 1.42 1996/11/20 18:57:03 gwr Exp $ */ -/* - * Copyright (c) 1995 Gordon W. Ross +/*- + * Copyright (c) 1996 The NetBSD Foundation, Inc. * All rights reserved. * + * This code is derived from software contributed to The NetBSD Foundation + * by Gordon W. Ross. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -12,22 +15,25 @@ * 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. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * 4. All advertising materials mentioning features or use of this software + * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Gordon Ross + * 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 AUTHOR ``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 AUTHOR 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 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 REGENTS 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. */ /* @@ -166,7 +172,7 @@ static u_char zs_init_reg[16] = { /* Definition of the driver for autoconfig. */ static int zsc_match __P((struct device *, void *, void *)); static void zsc_attach __P((struct device *, struct device *, void *)); -static int zsc_print __P((void *, char *name)); +static int zsc_print __P((void *, const char *name)); struct cfattach zsc_ca = { sizeof(struct zsc_softc), zsc_match, zsc_attach @@ -328,7 +334,7 @@ zsc_attach(parent, self, aux) static int zsc_print(aux, name) void *aux; - char *name; + const char *name; { struct zsc_attach_args *args = aux; |