sbus/* --> dev/*

deal with multiple bus types (start of vme/obio support)
This commit is contained in:
deraadt 1994-09-17 23:57:27 +00:00
parent 152b1d19d4
commit 1be17e489e
9 changed files with 252 additions and 85 deletions

View File

@ -42,7 +42,7 @@
* @(#)bsd_audio.c 8.1 (Berkeley) 6/11/93
*
* from: Header: bsd_audio.c,v 1.18 93/04/24 16:20:35 leres Exp (LBL)
* $Id: bsd_audio.c,v 1.1 1993/10/02 10:22:33 deraadt Exp $
* $Id: bsd_audio.c,v 1.2 1994/09/17 23:57:27 deraadt Exp $
*/
#include "bsdaudio.h"
#if NBSDAUDIO > 0
@ -283,7 +283,8 @@ audioattach(parent, self, args)
void *args;
{
register struct audio_softc *sc = (struct audio_softc *)self;
register struct romaux *ra = args;
register struct confargs *ca = args;
register struct romaux *ra = &ca->ca_ra;
register volatile struct amd7930 *amd;
register int pri;

View File

@ -42,7 +42,7 @@
* %W% (Berkeley) %G%
*
* from: Header: bt_subr.c,v 1.1 93/10/12 15:28:39 torek Exp
* $Id: bt_subr.c,v 1.2 1993/11/29 06:15:27 deraadt Exp $
* $Id: bt_subr.c,v 1.3 1994/09/17 23:57:30 deraadt Exp $
*/
#include <sys/param.h>
@ -51,8 +51,8 @@
#include <machine/fbio.h>
#include <sparc/sbus/btreg.h>
#include <sparc/sbus/btvar.h>
#include <sparc/dev/btreg.h>
#include <sparc/dev/btvar.h>
/*
* Common code for dealing with Brooktree video DACs.

View File

@ -42,7 +42,7 @@
* @(#)bwtwo.c 8.1 (Berkeley) 6/11/93
*
* from: Header: bwtwo.c,v 1.14 92/11/26 02:28:04 torek Exp
* $Id: bwtwo.c,v 1.3 1994/07/04 21:37:20 deraadt Exp $
* $Id: bwtwo.c,v 1.4 1994/09/17 23:57:31 deraadt Exp $
*/
/*
@ -65,8 +65,8 @@
#include <machine/pmap.h>
#include <machine/fbvar.h>
#include <sparc/sbus/bwtworeg.h>
#include <sparc/sbus/sbusvar.h>
#include <sparc/dev/bwtworeg.h>
#include <sparc/dev/sbusvar.h>
/* per-display variables */
struct bwtwo_softc {
@ -79,6 +79,7 @@ struct bwtwo_softc {
/* autoconfiguration driver */
static void bwtwoattach(struct device *, struct device *, void *);
static int bwtwomatch(struct device *, struct cfdata *, void *);
struct cfdriver bwtwocd =
{ NULL, "bwtwo", matchbyname, bwtwoattach,
DV_DULL, sizeof(struct bwtwo_softc) };
@ -107,8 +108,8 @@ bwtwoattach(parent, self, args)
void *args;
{
register struct bwtwo_softc *sc = (struct bwtwo_softc *)self;
register struct sbus_attach_args *sa = args;
register int node = sa->sa_ra.ra_node, ramsize;
register struct confargs *ca = args;
register int node = ca->ca_ra.ra_node, ramsize;
register struct bwtwo_all *p;
int isconsole;
@ -138,8 +139,8 @@ bwtwoattach(parent, self, args)
* going to print characters via rconsole.
*/
isconsole = node == fbnode && fbconstty != NULL;
p = (struct bwtwo_all *)sa->sa_ra.ra_paddr;
if ((sc->sc_fb.fb_pixels = sa->sa_ra.ra_vaddr) == NULL && isconsole) {
p = (struct bwtwo_all *)ca->ca_ra.ra_paddr;
if ((sc->sc_fb.fb_pixels = ca->ca_ra.ra_vaddr) == NULL && isconsole) {
/* this probably cannot happen, but what the heck */
sc->sc_fb.fb_pixels = mapiodev(p->ba_ram, ramsize);
}

View File

@ -42,7 +42,7 @@
* %W% (Berkeley) %G%
*
* from: Header: cgsix.c,v 1.2 93/10/18 00:01:51 torek Exp
* $Id: cgsix.c,v 1.4 1994/07/04 21:37:22 deraadt Exp $
* $Id: cgsix.c,v 1.5 1994/09/17 23:57:32 deraadt Exp $
*/
/*
@ -73,10 +73,10 @@
#include <machine/pmap.h>
#include <machine/fbvar.h>
#include <sparc/sbus/btreg.h>
#include <sparc/sbus/btvar.h>
#include <sparc/sbus/cgsixreg.h>
#include <sparc/sbus/sbusvar.h>
#include <sparc/dev/btreg.h>
#include <sparc/dev/btvar.h>
#include <sparc/dev/cgsixreg.h>
#include <sparc/dev/sbusvar.h>
union cursor_cmap { /* colormap, like bt_cmap, but tiny */
u_char cm_map[2][3]; /* 2 R/G/B entries */
@ -110,8 +110,9 @@ struct cgsix_softc {
/* autoconfiguration driver */
static void cgsixattach(struct device *, struct device *, void *);
static int cgsixmatch(struct device *, struct cfdata *, void *);
struct cfdriver cgsixcd =
{ NULL, "cgsix", matchbyname, cgsixattach,
{ NULL, "cgsix", cgsixmatch, cgsixattach,
DV_DULL, sizeof(struct cgsix_softc) };
/* frame buffer generic driver */
@ -133,6 +134,37 @@ static void cg6_loadomap __P((struct cgsix_softc *));
static void cg6_setcursor __P((struct cgsix_softc *));/* set position */
static void cg6_loadcursor __P((struct cgsix_softc *));/* set shape */
/*
* Match a cgsix.
*/
int
cgsixmatch(parent, cf, aux)
struct device *parent;
struct cfdata *cf;
void *aux;
{
struct confargs *ca = aux;
struct romaux *ra = &ca->ca_ra;
if (ca->ca_bustype == BUS_VME || ca->ca_bustype == BUS_OBIO) {
struct cg6_layout *p = (struct cg6_layout *)ra->ra_vaddr;
printf("[addr %8x %8x irq %d]", ra->ra_paddr, ra->ra_vaddr,
ra->ra_intr);
ra->ra_len = NBPG;
/*
* On the VME or OBIO busses, if we don't bus error it
* exists. The obio/vme functions will have mapped the
* first page for us, but we need to look at a register
* much later on. So, map it instead.
*/
obio_tmp_map(&p->cg6_fhc_un.un_fhc);
return (probeget(&p->cg6_fhc_un.un_fhc, 4) != 0);
}
return (strcmp(cf->cf_driver->cd_name, ra->ra_name) == 0);
}
/*
* Attach a display.
*/
@ -142,24 +174,44 @@ cgsixattach(parent, self, args)
void *args;
{
register struct cgsix_softc *sc = (struct cgsix_softc *)self;
register struct sbus_attach_args *sa = args;
register int node = sa->sa_ra.ra_node, ramsize, i;
register struct confargs *ca = args;
register int node, ramsize, i;
register volatile struct bt_regs *bt;
register volatile struct cg6_layout *p;
int sbus = 1;
char *nam;
sc->sc_fb.fb_major = CGSIX_MAJOR; /* XXX to be removed */
sc->sc_fb.fb_driver = &cg6_fbdriver;
sc->sc_fb.fb_device = &sc->sc_dev;
sc->sc_fb.fb_type.fb_type = FBTYPE_SUNFAST_COLOR;
sc->sc_fb.fb_type.fb_width = getpropint(node, "width", 1152);
sc->sc_fb.fb_type.fb_height = getpropint(node, "height", 900);
sc->sc_fb.fb_linebytes = getpropint(node, "linebytes", 1152);
switch (ca->ca_bustype) {
case BUS_OBIO:
case BUS_VME:
sbus = node = 0;
sc->sc_fb.fb_type.fb_width = 1152;
sc->sc_fb.fb_type.fb_height = 900;
sc->sc_fb.fb_linebytes = 1152;
nam = "cgsix";
break;
case BUS_SBUS:
node = ca->ca_ra.ra_node;
sc->sc_fb.fb_type.fb_width = getpropint(node, "width", 1152);
sc->sc_fb.fb_type.fb_height = getpropint(node, "height", 900);
sc->sc_fb.fb_linebytes = getpropint(node, "linebytes", 1152);
nam = getpropstring(node, "model");
break;
case BUS_MAIN:
printf("cgsix on mainbus?\n");
return;
}
ramsize = sc->sc_fb.fb_type.fb_height * sc->sc_fb.fb_linebytes;
sc->sc_fb.fb_type.fb_depth = 8;
sc->sc_fb.fb_type.fb_cmsize = 256;
sc->sc_fb.fb_type.fb_size = ramsize;
printf(": %s, %d x %d", getpropstring(node, "model"),
printf(": %s, %d x %d", nam,
sc->sc_fb.fb_type.fb_width, sc->sc_fb.fb_type.fb_height);
/*
@ -167,7 +219,7 @@ cgsixattach(parent, self, args)
* the video RAM mapped. Just map what we care about for ourselves
* (the FHC, THC, and Brooktree registers).
*/
sc->sc_physadr = p = (struct cg6_layout *)sa->sa_ra.ra_paddr;
sc->sc_physadr = p = (struct cg6_layout *)ca->ca_ra.ra_paddr;
sc->sc_bt = bt = (volatile struct bt_regs *)
mapiodev((caddr_t)&p->cg6_bt_un.un_btregs, sizeof *sc->sc_bt);
sc->sc_fhc = (volatile int *)
@ -193,7 +245,8 @@ cgsixattach(parent, self, args)
sc->sc_thc->thc_misc |= THC_MISC_VIDEN;
printf("\n");
sbus_establish(&sc->sc_sd, &sc->sc_dev);
if (ca->ca_bustype == BUS_SBUS)
sbus_establish(&sc->sc_sd, &sc->sc_dev);
if (node == fbnode)
fb_attach(&sc->sc_fb);
}

View File

@ -42,7 +42,7 @@
* %W% (Berkeley) %G%
*
* from: Header: cgthree.c,v 1.8 93/10/31 05:09:24 torek Exp
* $Id: cgthree.c,v 1.6 1994/07/04 21:37:25 deraadt Exp $
* $Id: cgthree.c,v 1.7 1994/09/17 23:57:34 deraadt Exp $
*/
/*
@ -68,10 +68,10 @@
#include <machine/pmap.h>
#include <machine/fbvar.h>
#include <sparc/sbus/btreg.h>
#include <sparc/sbus/btvar.h>
#include <sparc/sbus/cgthreereg.h>
#include <sparc/sbus/sbusvar.h>
#include <sparc/dev/btreg.h>
#include <sparc/dev/btvar.h>
#include <sparc/dev/cgthreereg.h>
#include <sparc/dev/sbusvar.h>
/* per-display variables */
struct cgthree_softc {
@ -86,9 +86,11 @@ struct cgthree_softc {
/* autoconfiguration driver */
static void cgthreeattach(struct device *, struct device *, void *);
struct cfdriver cgthreecd =
{ NULL, "cgthree", matchbyname, cgthreeattach,
DV_DULL, sizeof(struct cgthree_softc) };
static int cgthreematch(struct device *, struct cfdata *, void *);
struct cfdriver cgthreecd = {
NULL, "cgthree", cgthreematch, cgthreeattach,
DV_DULL, sizeof(struct cgthree_softc)
};
/* frame buffer generic driver */
static void cgthreeunblank(struct device *);
@ -104,6 +106,34 @@ static void cgthreeloadcmap __P((struct cgthree_softc *, int, int));
#define CGTHREE_MAJOR 55 /* XXX */
/*
* Match a cgsix.
*/
int
cgthreematch(parent, cf, aux)
struct device *parent;
struct cfdata *cf;
void *aux;
{
struct confargs *ca = aux;
struct romaux *ra = &ca->ca_ra;
if (ca->ca_bustype == BUS_VME || ca->ca_bustype == BUS_OBIO) {
printf("[addr %8x %8x irq %d]", ra->ra_paddr, ra->ra_vaddr,
ra->ra_intr);
ra->ra_len = NBPG;
/*
* On the VME or OBIO busses, if we don't bus error it
* exists. The obio/vme functions will have mapped the
* first page for us, but we need to look at a register
* much later on. So, map it instead.
*/
return (probeget(ra->ra_vaddr, 4) != 0);
}
return (strcmp(cf->cf_driver->cd_name, ra->ra_name) == 0);
}
/*
* Attach a display. We need to notice if it is the console, too.
*/
@ -113,11 +143,13 @@ cgthreeattach(parent, self, args)
void *args;
{
register struct cgthree_softc *sc = (struct cgthree_softc *)self;
register struct sbus_attach_args *sa = args;
register int node = sa->sa_ra.ra_node, ramsize, i;
register struct confargs *ca = args;
register int node, ramsize, i;
register volatile struct bt_regs *bt;
register struct cgthree_all *p;
int isconsole;
int sbus = 1;
char *nam;
sc->sc_fb.fb_major = CGTHREE_MAJOR; /* XXX to be removed */
@ -128,15 +160,30 @@ cgthreeattach(parent, self, args)
* to be correct as defaults go...
*/
sc->sc_fb.fb_type.fb_type = FBTYPE_SUN3COLOR;
sc->sc_fb.fb_type.fb_width = getpropint(node, "width", 1152);
sc->sc_fb.fb_type.fb_height = getpropint(node, "height", 900);
sc->sc_fb.fb_linebytes = getpropint(node, "linebytes", 1152);
switch (ca->ca_bustype) {
case BUS_OBIO:
case BUS_VME:
sbus = node = 0;
sc->sc_fb.fb_type.fb_width = 1152;
sc->sc_fb.fb_type.fb_height = 900;
sc->sc_fb.fb_linebytes = 1152;
nam = "cgthree";
break;
case BUS_SBUS:
node = ca->ca_ra.ra_node;
sc->sc_fb.fb_type.fb_width = getpropint(node, "width", 1152);
sc->sc_fb.fb_type.fb_height = getpropint(node, "height", 900);
sc->sc_fb.fb_linebytes = getpropint(node, "linebytes", 1152);
nam = getpropstring(node, "model");
break;
}
ramsize = roundup(sc->sc_fb.fb_type.fb_height * sc->sc_fb.fb_linebytes,
NBPG);
sc->sc_fb.fb_type.fb_depth = 8;
sc->sc_fb.fb_type.fb_cmsize = 256;
sc->sc_fb.fb_type.fb_size = ramsize;
printf(": %s, %d x %d", getpropstring(node, "model"),
printf(": %s, %d x %d", nam,
sc->sc_fb.fb_type.fb_width, sc->sc_fb.fb_type.fb_height);
/*
@ -146,8 +193,8 @@ cgthreeattach(parent, self, args)
* going to print characters via rconsole.
*/
isconsole = node == fbnode && fbconstty != NULL;
p = (struct cgthree_all *)sa->sa_ra.ra_paddr;
if ((sc->sc_fb.fb_pixels = sa->sa_ra.ra_vaddr) == NULL && isconsole) {
p = (struct cgthree_all *)ca->ca_ra.ra_paddr;
if ((sc->sc_fb.fb_pixels = ca->ca_ra.ra_vaddr) == NULL && isconsole) {
/* this probably cannot happen, but what the heck */
sc->sc_fb.fb_pixels = mapiodev(p->ba_ram, ramsize);
}
@ -172,7 +219,8 @@ cgthreeattach(parent, self, args)
#endif
} else
printf("\n");
sbus_establish(&sc->sc_sd, &sc->sc_dev);
if (sbus)
sbus_establish(&sc->sc_sd, &sc->sc_dev);
if (node == fbnode)
fb_attach(&sc->sc_fb);
}

View File

@ -32,7 +32,7 @@
*
* from: Header: if_le.c,v 1.25 93/10/31 04:47:50 leres Locked
* from: @(#)if_le.c 8.2 (Berkeley) 10/30/93
* $Id: if_le.c,v 1.10 1994/07/04 21:37:27 deraadt Exp $
* $Id: if_le.c,v 1.11 1994/09/17 23:57:35 deraadt Exp $
*/
#include "bpfilter.h"
@ -84,8 +84,8 @@
#include <machine/cpu.h>
#include <machine/pmap.h>
#include <sparc/sbus/if_lereg.h>
#include <sparc/sbus/sbusvar.h>
#include <sparc/dev/if_lereg.h>
#include <sparc/dev/sbusvar.h>
/* DVMA address to LANCE address -- the Sbus/MMU will resupply the 0xff */
#define LANCE_ADDR(x) ((int)(x) & ~0xff000000)
@ -147,8 +147,9 @@ struct le_softc {
/* autoconfiguration driver */
void leattach(struct device *, struct device *, void *);
int lematch(struct device *, struct cfdata *, void *);
struct cfdriver lecd =
{ NULL, "le", matchbyname, leattach, DV_IFNET, sizeof(struct le_softc) };
{ NULL, "le", lematch, leattach, DV_IFNET, sizeof(struct le_softc) };
/* Forwards */
void leattach(struct device *, struct device *, void *);
@ -167,6 +168,31 @@ void leerror(struct le_softc *, int);
void lererror(struct le_softc *, char *);
void lexerror(struct le_softc *);
int
lematch(parent, cf, aux)
struct device *parent;
struct cfdata *cf;
void *aux;
{
register struct confargs *ca = aux;
register struct romaux *ra = &ca->ca_ra;
if (ca->ca_bustype == BUS_VME || ca->ca_bustype == BUS_OBIO) {
printf("[addr %8x %8x irq %d]", ra->ra_paddr, ra->ra_vaddr,
ra->ra_intr);
ra->ra_len = NBPG;
/*
* On the VME or OBIO busses, if we don't bus error it
* exists. The obio/vme functions will have mapped the
* first page for us, but we need to look at a register
* much later on. So, map it instead.
*/
return (probeget(ra->ra_vaddr, 2) != 0);
}
return (strcmp(cf->cf_driver->cd_name, ra->ra_name) == 0);
}
/*
* Interface exists: make available by filling in network interface
* record. System will initialize the interface when it is ready
@ -179,7 +205,7 @@ leattach(parent, self, args)
void *args;
{
register struct le_softc *sc = (struct le_softc *)self;
register struct sbus_attach_args *sa = args;
register struct confargs *ca = args;
register volatile struct lereg2 *ler2;
struct ifnet *ifp = &sc->sc_if;
register struct bootpath *bp;
@ -189,14 +215,14 @@ leattach(parent, self, args)
extern void myetheraddr(u_char *);
extern caddr_t dvma_malloc(size_t);
if (sa->sa_ra.ra_nintr != 1) {
printf(": expected 1 interrupt, got %d\n", sa->sa_ra.ra_nintr);
if (ca->ca_ra.ra_nintr != 1) {
printf(": expected 1 interrupt, got %d\n", ca->ca_ra.ra_nintr);
return;
}
pri = sa->sa_ra.ra_intr[0].int_pri;
pri = ca->ca_ra.ra_intr[0].int_pri;
printf(" pri %d", pri);
sc->sc_r1 = (volatile struct lereg1 *)
mapiodev(sa->sa_ra.ra_paddr, sizeof(struct lereg1));
mapiodev(ca->ca_ra.ra_paddr, sizeof(struct lereg1));
ler2 = sc->sc_r2 = (volatile struct lereg2 *)
dvma_malloc(sizeof(struct lereg2));
@ -255,12 +281,12 @@ leattach(parent, self, args)
if_attach(ifp);
ether_ifattach(ifp);
#define SAME_LANCE(bp, sa) \
((bp->val[0] == sa->sa_slot && bp->val[1] == sa->sa_offset) || \
#define SAME_LANCE(bp, ca) \
((bp->val[0] == ca->ca_slot && bp->val[1] == ca->ca_offset) || \
(bp->val[0] == -1 && bp->val[1] == sc->sc_dev.dv_unit))
bp = sa->sa_ra.ra_bp;
if (bp != NULL && strcmp(bp->name, "le") == 0 && SAME_LANCE(bp, sa))
bp = ca->ca_ra.ra_bp;
if (bp != NULL && strcmp(bp->name, "le") == 0 && SAME_LANCE(bp, ca))
bootdv = &sc->sc_dev;
}
@ -431,7 +457,7 @@ leinit(unit)
s = splimp();
ifp->if_flags |= IFF_RUNNING;
lereset(&sc->sc_dev);
lestart(ifp);
lestart(ifp);
splx(s);
}
return (0);

View File

@ -42,7 +42,7 @@
* @(#)kbd.c 8.1 (Berkeley) 6/11/93
*
* from: Header: kbd.c,v 1.16 92/11/26 01:28:44 torek Exp (LBL)
* $Id: kbd.c,v 1.12 1994/08/25 20:57:38 deraadt Exp $
* $Id: kbd.c,v 1.13 1994/09/17 23:57:36 deraadt Exp $
*/
/*
@ -284,10 +284,10 @@ kbdattach(int nkbd)
if (kbd_softc.k_cons != NULL) {
k = &kbd_softc;
tp = k->k_kbd;
(*k->k_open)(tp); /* never to be closed */
(*k->k_open)(tp); /* never to be closed */
if (ttyoutput(KBD_CMD_RESET, tp) >= 0)
panic("kbdattach");
(*tp->t_oproc)(tp); /* get it going */
(*tp->t_oproc)(tp); /* get it going */
}
}

View File

@ -42,7 +42,7 @@
* @(#)sbus.c 8.1 (Berkeley) 6/11/93
*
* from: Header: sbus.c,v 1.10 92/11/26 02:28:13 torek Exp (LBL)
* $Id: sbus.c,v 1.1 1993/10/02 10:23:55 deraadt Exp $
* $Id: sbus.c,v 1.2 1994/09/17 23:57:38 deraadt Exp $
*/
/*
@ -54,14 +54,15 @@
#include <machine/autoconf.h>
#include <sparc/sbus/sbusreg.h>
#include <sparc/sbus/sbusvar.h>
#include <sparc/dev/sbusreg.h>
#include <sparc/dev/sbusvar.h>
/* autoconfiguration driver */
void sbus_attach __P((struct device *, struct device *, void *));
struct cfdriver sbuscd =
{ NULL, "sbus", matchbyname, sbus_attach,
DV_DULL, sizeof(struct sbus_softc) };
struct cfdriver sbuscd = {
NULL, "sbus", matchbyname, sbus_attach,
DV_DULL, sizeof(struct sbus_softc)
};
/*
* Print the location of some sbus-attached device (called just
@ -74,11 +75,11 @@ sbus_print(args, sbus)
void *args;
char *sbus;
{
register struct sbus_attach_args *sa = args;
register struct confargs *ca = args;
if (sbus)
printf("%s at %s", sa->sa_ra.ra_name, sbus);
printf(" slot %d offset 0x%x", sa->sa_slot, sa->sa_offset);
printf("%s at %s", ca->ca_ra.ra_name, sbus);
printf(" slot %d offset 0x%x", ca->ca_slot, ca->ca_offset);
return (UNCONF);
}
@ -92,10 +93,11 @@ sbus_attach(parent, self, aux)
void *aux;
{
register struct sbus_softc *sc = (struct sbus_softc *)self;
struct confargs *ca = aux;
register struct romaux *ra = &ca->ca_ra;
register int base, node, slot;
register char *name;
struct sbus_attach_args sa;
register struct romaux *ra;
struct confargs oca;
/*
* XXX there is only one Sbus, for now -- do not know how to
@ -110,15 +112,14 @@ sbus_attach(parent, self, aux)
* Record clock frequency for synchronous SCSI.
* IS THIS THE CORRECT DEFAULT??
*/
ra = aux;
node = ra->ra_node;
sc->sc_clockfreq = getpropint(node, "clock-frequency", 25*1000*1000);
printf(": clock = %s MHz\n", clockfreq(sc->sc_clockfreq));
if (ra->ra_bp != NULL && strcmp(ra->ra_bp->name, "sbus") == 0)
sa.sa_ra.ra_bp = ra->ra_bp + 1;
oca.ca_ra.ra_bp = ra->ra_bp + 1;
else
sa.sa_ra.ra_bp = NULL;
oca.ca_ra.ra_bp = NULL;
/*
* Loop through ROM children, fixing any relative addresses
@ -126,18 +127,19 @@ sbus_attach(parent, self, aux)
*/
for (node = firstchild(node); node; node = nextsibling(node)) {
name = getpropstring(node, "name");
if (!romprop(&sa.sa_ra, name, node))
if (!romprop(&oca.ca_ra, name, node))
continue;
base = (int)sa.sa_ra.ra_paddr;
base = (int)oca.ca_ra.ra_paddr;
if (SBUS_ABS(base)) {
sa.sa_slot = SBUS_ABS_TO_SLOT(base);
sa.sa_offset = SBUS_ABS_TO_OFFSET(base);
oca.ca_slot = SBUS_ABS_TO_SLOT(base);
oca.ca_offset = SBUS_ABS_TO_OFFSET(base);
} else {
sa.sa_slot = slot = sa.sa_ra.ra_iospace;
sa.sa_offset = base;
sa.sa_ra.ra_paddr = (void *)SBUS_ADDR(slot, base);
oca.ca_slot = slot = oca.ca_ra.ra_iospace;
oca.ca_offset = base;
oca.ca_ra.ra_paddr = (void *)SBUS_ADDR(slot, base);
}
(void) config_found(&sc->sc_dev, (void *)&sa, sbus_print);
oca.ca_bustype = BUS_SBUS;
(void) config_found(&sc->sc_dev, (void *)&oca, sbus_print);
}
}
@ -177,3 +179,31 @@ sbusreset(sbus)
}
}
}
/*
* find a device matching "name" and unit number
*/
struct device *
getdevunit(name, unit)
char *name;
int unit;
{
struct device *dev = alldevs;
char num[10], fullname[16];
int lunit;
/* compute length of name and decimal expansion of unit number */
sprintf(num, "%d", unit);
lunit = strlen(num);
if (strlen(name) + lunit >= sizeof(fullname) - 1)
panic("config_attach: device name too long");
strcpy(fullname, name);
strcat(fullname, num);
while (strcmp(dev->dv_xname, fullname) != 0) {
if ((dev = dev->dv_next) == NULL)
return NULL;
}
return dev;
}

View File

@ -42,7 +42,7 @@
* @(#)zs.c 8.1 (Berkeley) 7/19/93
*
* from: Header: zs.c,v 1.30 93/07/19 23:44:42 torek Exp
* $Id: zs.c,v 1.12 1994/08/20 09:11:02 deraadt Exp $
* $Id: zs.c,v 1.13 1994/09/17 23:57:39 deraadt Exp $
*/
/*
@ -207,8 +207,15 @@ zs_write(zc, reg, val)
static int
zsmatch(struct device *parent, struct cfdata *cf, void *aux)
{
struct romaux *ra = aux;
struct confargs *ca = aux;
struct romaux *ra = &ca->ca_ra;
if (ca->ca_bustype == BUS_VME || ca->ca_bustype == BUS_OBIO) {
printf("[addr %8x %8x irq %d]", ra->ra_paddr, ra->ra_vaddr,
ra->ra_intr);
ra->ra_len = NBPG;
return (probeget(ra->ra_vaddr, 1) != 0);
}
return (getpropint(ra->ra_node, "slave", -2) == cf->cf_unit);
}
@ -226,7 +233,8 @@ zsattach(struct device *parent, struct device *dev, void *aux)
register struct zs_chanstate *cs;
register volatile struct zsdevice *addr;
register struct tty *tp, *ctp;
register struct romaux *ra = aux;
register struct confargs *ca = aux;
register struct romaux *ra = &ca->ca_ra;
int pri, softcar;
static int didintr, prevpri;