Changes of sbi_attach_args. (and cleanup)

This commit is contained in:
ragge 2000-06-04 17:59:50 +00:00
parent 1e19df4bfd
commit 82e0b5f7db
2 changed files with 36 additions and 44 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uba_cmi.c,v 1.4 2000/06/04 06:16:57 matt Exp $ */ /* $NetBSD: uba_cmi.c,v 1.5 2000/06/04 17:59:50 ragge Exp $ */
/* /*
* Copyright (c) 1996 Jonathan Stone. * Copyright (c) 1996 Jonathan Stone.
* Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden. * Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden.
@ -52,6 +52,8 @@
#include <vax/uba/uba_common.h> #include <vax/uba/uba_common.h>
#include "locators.h"
/* Some CMI-specific defines */ /* Some CMI-specific defines */
#define UBASIZE ((UBAPAGES + UBAIOPAGES) * VAX_NBPG) #define UBASIZE ((UBAPAGES + UBAIOPAGES) * VAX_NBPG)
#define UMEM750(i) (0xfc0000 - (i) * UBASIZE) #define UMEM750(i) (0xfc0000 - (i) * UBASIZE)
@ -63,11 +65,11 @@
* and bus status/command registers, the latter are (partly) IPR's * and bus status/command registers, the latter are (partly) IPR's
* on 750. * on 750.
*/ */
static int dw750_match __P((struct device *, struct cfdata *, void *)); static int dw750_match(struct device *, struct cfdata *, void *);
static void dw750_attach __P((struct device *, struct device *, void *)); static void dw750_attach(struct device *, struct device *, void *);
static void dw750_init __P((struct uba_softc*)); static void dw750_init(struct uba_softc*);
#ifdef notyet #ifdef notyet
static void dw750_purge __P((struct uba_softc *, int)); static void dw750_purge(struct uba_softc *, int);
#endif #endif
struct cfattach uba_cmi_ca = { struct cfattach uba_cmi_ca = {
@ -77,29 +79,25 @@ struct cfattach uba_cmi_ca = {
extern struct vax_bus_space vax_mem_bus_space; extern struct vax_bus_space vax_mem_bus_space;
int int
dw750_match(parent, cf, aux) dw750_match(struct device *parent, struct cfdata *cf, void *aux)
struct device *parent;
struct cfdata *cf;
void *aux;
{ {
struct sbi_attach_args *sa = (struct sbi_attach_args *)aux; struct sbi_attach_args *sa = (struct sbi_attach_args *)aux;
if ((cf->cf_loc[0] != sa->nexnum) && (cf->cf_loc[0] > -1 )) if (cf->cf_loc[CMICF_TR] != sa->sa_nexnum &&
cf->cf_loc[CMICF_TR] != CMICF_TR_DEFAULT)
return 0; return 0;
/* /*
* The uba type is actually only telling where the uba * The uba type is actually only telling where the uba
* space is in nexus space. * space is in nexus space.
*/ */
if ((sa->type & ~3) != NEX_UBA0) if ((sa->sa_type & ~3) != NEX_UBA0)
return 0; return 0;
return 1; return 1;
} }
void void
dw750_attach(parent, self, aux) dw750_attach(struct device *parent, struct device *self, void *aux)
struct device *parent, *self;
void *aux;
{ {
struct uba_vsoftc *sc = (void *)self; struct uba_vsoftc *sc = (void *)self;
struct sbi_attach_args *sa = aux; struct sbi_attach_args *sa = aux;
@ -119,15 +117,14 @@ dw750_attach(parent, self, aux)
* Fill in variables used by the sgmap system. * Fill in variables used by the sgmap system.
*/ */
sc->uv_size = UBAPAGES * VAX_NBPG; sc->uv_size = UBAPAGES * VAX_NBPG;
sc->uv_uba = (void *)sa->nexaddr; /* Map registers is in adaptor */ sc->uv_uba = (void *)sa->sa_ioh; /* Map registers is in adaptor */
uba_dma_init(sc); uba_dma_init(sc);
uba_attach(&sc->uv_sc, UIOPAGE(sa->type == NEX_UBA1)); uba_attach(&sc->uv_sc, UIOPAGE(sa->sa_type == NEX_UBA1));
} }
void void
dw750_init(sc) dw750_init(struct uba_softc *sc)
struct uba_softc *sc;
{ {
mtpr(0, PR_IUR); mtpr(0, PR_IUR);
DELAY(500000); DELAY(500000);
@ -135,9 +132,7 @@ dw750_init(sc)
#ifdef notyet #ifdef notyet
void void
dw750_purge(sc, bdp) dw750_purge(struct uba_softc sc, int bdp)
struct uba_softc *sc;
int bdp;
{ {
sc->uh_uba->uba_dpr[bdp] |= UBADPR_PURGE | UBADPR_NXM | UBADPR_UCE; sc->uh_uba->uba_dpr[bdp] |= UBADPR_PURGE | UBADPR_NXM | UBADPR_UCE;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: uba_sbi.c,v 1.5 2000/06/04 06:16:57 matt Exp $ */ /* $NetBSD: uba_sbi.c,v 1.6 2000/06/04 17:59:50 ragge Exp $ */
/* /*
* Copyright (c) 1996 Jonathan Stone. * Copyright (c) 1996 Jonathan Stone.
* Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden. * Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden.
@ -54,6 +54,7 @@
#include <vax/uba/uba_common.h> #include <vax/uba/uba_common.h>
#include "locators.h"
#include "ioconf.h" #include "ioconf.h"
/* Some SBI-specific defines */ /* Some SBI-specific defines */
@ -86,16 +87,16 @@ char ubasr_bits[] = UBASR_BITS;
/* /*
* The DW780 are directly connected to the SBI on 11/780 and 8600. * The DW780 are directly connected to the SBI on 11/780 and 8600.
*/ */
static int dw780_match __P((struct device *, struct cfdata *, void *)); static int dw780_match(struct device *, struct cfdata *, void *);
static void dw780_attach __P((struct device *, struct device *, void *)); static void dw780_attach(struct device *, struct device *, void *);
static void dw780_init __P((struct uba_softc*)); static void dw780_init(struct uba_softc*);
static void dw780_beforescan __P((struct uba_softc *)); static void dw780_beforescan(struct uba_softc *);
static void dw780_afterscan __P((struct uba_softc *)); static void dw780_afterscan(struct uba_softc *);
static int dw780_errchk __P((struct uba_softc *)); static int dw780_errchk(struct uba_softc *);
static void uba_dw780int __P((void *)); static void uba_dw780int(void *);
static void ubaerror __P((struct uba_softc *, int *, int *)); static void ubaerror(struct uba_softc *, int *, int *);
#ifdef notyet #ifdef notyet
static void dw780_purge __P((struct uba_softc *, int)); static void dw780_purge(struct uba_softc *, int);
#endif #endif
struct cfattach uba_sbi_ca = { struct cfattach uba_sbi_ca = {
@ -107,33 +108,29 @@ extern struct vax_bus_space vax_mem_bus_space;
volatile int svec; volatile int svec;
int int
dw780_match(parent, cf, aux) dw780_match(struct device *parent, struct cfdata *cf, void *aux)
struct device *parent;
struct cfdata *cf;
void *aux;
{ {
struct sbi_attach_args *sa = (struct sbi_attach_args *)aux; struct sbi_attach_args *sa = (struct sbi_attach_args *)aux;
if ((cf->cf_loc[0] != sa->nexnum) && (cf->cf_loc[0] > -1 )) if (cf->cf_loc[SBICF_TR] != sa->sa_nexnum &&
cf->cf_loc[SBICF_TR] != SBICF_TR_DEFAULT)
return 0; return 0;
/* /*
* The uba type is actually only telling where the uba * The uba type is actually only telling where the uba
* space is in nexus space. * space is in nexus space.
*/ */
if ((sa->type & ~3) != NEX_UBA0) if ((sa->sa_type & ~3) != NEX_UBA0)
return 0; return 0;
return 1; return 1;
} }
void void
dw780_attach(parent, self, aux) dw780_attach(struct device *parent, struct device *self, void *aux)
struct device *parent, *self;
void *aux;
{ {
struct uba_vsoftc *sc = (void *)self; struct uba_vsoftc *sc = (void *)self;
struct sbi_attach_args *sa = aux; struct sbi_attach_args *sa = aux;
int ubaddr = sa->type & 3; int ubaddr = sa->sa_type & 3;
int i; int i;
printf(": DW780\n"); printf(": DW780\n");
@ -149,14 +146,14 @@ dw780_attach(parent, self, aux)
sc->uv_sc.uh_errchk = dw780_errchk; sc->uv_sc.uh_errchk = dw780_errchk;
sc->uv_sc.uh_iot = &vax_mem_bus_space; sc->uv_sc.uh_iot = &vax_mem_bus_space;
sc->uv_sc.uh_dmat = &sc->uv_dmat; sc->uv_sc.uh_dmat = &sc->uv_dmat;
sc->uv_uba = (void *)sa->nexaddr; sc->uv_uba = (void *)sa->sa_ioh;
sc->uh_ibase = VAX_NBPG + ubaddr * VAX_NBPG; sc->uh_ibase = VAX_NBPG + ubaddr * VAX_NBPG;
/* /*
* Set up dispatch vectors for DW780. * Set up dispatch vectors for DW780.
*/ */
for (i = 0; i < 4; i++) for (i = 14; i < 17; i++)
scb_vecalloc(256 + i * 64 + sa->nexnum * 4, uba_dw780int, scb_vecalloc(vecnum(0, i, sa->sa_nexnum), uba_dw780int,
sc, SCB_ISTACK, &sc->uv_sc.uh_intrcnt); sc, SCB_ISTACK, &sc->uv_sc.uh_intrcnt);
evcnt_attach(&sc->uv_sc.uh_dev, "intr", &sc->uv_sc.uh_intrcnt); evcnt_attach(&sc->uv_sc.uh_dev, "intr", &sc->uv_sc.uh_intrcnt);