Converted to use the new bus-specific attach args,
and the bus_space_peek_N functions.
This commit is contained in:
parent
19f9c211b0
commit
a50332b3e7
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bwtwo_any.c,v 1.2 2001/04/10 12:44:12 fredette Exp $ */
|
||||
/* $NetBSD: bwtwo_any.c,v 1.3 2001/06/27 02:59:27 fredette Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
@ -136,13 +136,17 @@ bwtwomatch_any(parent, cf, aux)
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
struct confargs *ca = aux;
|
||||
struct mainbus_attach_args *ma = aux;
|
||||
bus_space_handle_t bh;
|
||||
int matched;
|
||||
|
||||
return (bus_space_probe(ca->ca_bustag, 0, ca->ca_paddr,
|
||||
4, /* probe size */
|
||||
0, /* offset */
|
||||
0, /* flags */
|
||||
NULL, NULL));
|
||||
/* Make sure there is something there... */
|
||||
if (bus_space_map(ma->ma_bustag, ma->ma_paddr + BWREG_REG, sizeof(struct bwtworeg),
|
||||
0, &bh))
|
||||
return (0);
|
||||
matched = (bus_space_peek_1(ma->ma_bustag, bh, 0, NULL) == 0);
|
||||
bus_space_unmap(ma->ma_bustag, bh, sizeof(struct bwtworeg));
|
||||
return (matched);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -152,16 +156,16 @@ bwtwoattach_any(parent, self, aux)
|
||||
{
|
||||
struct bwtwosun2_softc *scsun2 = (struct bwtwosun2_softc *)self;
|
||||
struct bwtwo_softc *sc = &scsun2->sc;
|
||||
struct confargs *ca = aux;
|
||||
struct mainbus_attach_args *ma = aux;
|
||||
struct fbdevice *fb = &sc->sc_fb;
|
||||
bus_space_handle_t bh;
|
||||
int isconsole;
|
||||
char *name;
|
||||
|
||||
/* Remember cookies for bwtwo_mmap() */
|
||||
sc->sc_bustag = ca->ca_bustag;
|
||||
sc->sc_bustag = ma->ma_bustag;
|
||||
sc->sc_btype = (bus_type_t)0;
|
||||
sc->sc_paddr = (bus_addr_t)ca->ca_paddr;
|
||||
sc->sc_paddr = ma->ma_paddr;
|
||||
|
||||
fb->fb_flags = sc->sc_dev.dv_cfdata->cf_flags;
|
||||
fb->fb_type.fb_depth = 1;
|
||||
@ -178,7 +182,7 @@ bwtwoattach_any(parent, self, aux)
|
||||
sc->sc_set_video = bwtwo_set_video_sun2;
|
||||
|
||||
/* Map the registers. */
|
||||
if (bus_space_map(ca->ca_bustag, ca->ca_paddr + BWREG_REG, sizeof(struct bwtworeg),
|
||||
if (bus_space_map(ma->ma_bustag, ma->ma_paddr + BWREG_REG, sizeof(struct bwtworeg),
|
||||
0, &scsun2->bh)) {
|
||||
printf("%s: cannot map regs\n", self->dv_xname);
|
||||
return;
|
||||
@ -186,7 +190,7 @@ bwtwoattach_any(parent, self, aux)
|
||||
|
||||
if (isconsole) {
|
||||
int ramsize = fb->fb_type.fb_height * fb->fb_linebytes;
|
||||
if (bus_space_map(ca->ca_bustag, ca->ca_paddr + sc->sc_pixeloffset,
|
||||
if (bus_space_map(ma->ma_bustag, ma->ma_paddr + sc->sc_pixeloffset,
|
||||
ramsize,
|
||||
BUS_SPACE_MAP_LINEAR, &bh) != 0) {
|
||||
printf("%s: cannot map pixels\n", self->dv_xname);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: clock.c,v 1.1 2001/04/06 15:05:55 fredette Exp $ */
|
||||
/* $NetBSD: clock.c,v 1.2 2001/06/27 02:59:26 fredette Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Matthew Fredette
|
||||
@ -108,23 +108,26 @@ clock_match(parent, cf, args)
|
||||
struct cfdata *cf;
|
||||
void *args;
|
||||
{
|
||||
struct confargs *ca = args;
|
||||
struct obio_attach_args *oba = args;
|
||||
bus_space_handle_t bh;
|
||||
int matched;
|
||||
|
||||
/* This driver only supports one unit. */
|
||||
if (cf->cf_unit != 0)
|
||||
return (0);
|
||||
|
||||
/* Make sure there is something there... */
|
||||
if (!bus_space_probe(ca->ca_bustag, 0, ca->ca_paddr,
|
||||
1, /* probe size */
|
||||
0, /* offset */
|
||||
0, /* flags */
|
||||
NULL, NULL))
|
||||
if (bus_space_map(oba->oba_bustag, oba->oba_paddr, sizeof(struct am9513),
|
||||
0, &bh))
|
||||
return (0);
|
||||
matched = (bus_space_peek_2(oba->oba_bustag, bh, 0, NULL) == 0);
|
||||
bus_space_unmap(oba->oba_bustag, bh, sizeof(struct am9513));
|
||||
if (!matched)
|
||||
return (0);
|
||||
|
||||
/* Default interrupt priority. */
|
||||
if (ca->ca_intpri == -1)
|
||||
ca->ca_intpri = CLOCK_PRI;
|
||||
if (oba->oba_pri == -1)
|
||||
oba->oba_pri = CLOCK_PRI;
|
||||
|
||||
return (1);
|
||||
}
|
||||
@ -135,15 +138,15 @@ clock_attach(parent, self, args)
|
||||
struct device *self;
|
||||
void *args;
|
||||
{
|
||||
struct confargs *ca = args;
|
||||
struct obio_attach_args *oba = args;
|
||||
bus_space_handle_t bh;
|
||||
|
||||
printf("\n");
|
||||
|
||||
/* Get a mapping for it. */
|
||||
if (bus_space_map(ca->ca_bustag, ca->ca_paddr, sizeof(struct am9513), 0, &bh))
|
||||
if (bus_space_map(oba->oba_bustag, oba->oba_paddr, sizeof(struct am9513), 0, &bh))
|
||||
panic("clock_attach");
|
||||
am9513_bt = ca->ca_bustag;
|
||||
am9513_bt = oba->oba_bustag;
|
||||
am9513_bh = bh;
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tod.c,v 1.2 2001/06/11 21:33:47 fredette Exp $ */
|
||||
/* $NetBSD: tod.c,v 1.3 2001/06/27 02:59:26 fredette Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Matthew Fredette
|
||||
@ -93,21 +93,21 @@ tod_obio_match(parent, cf, args)
|
||||
struct cfdata *cf;
|
||||
void *args;
|
||||
{
|
||||
struct confargs *ca = args;
|
||||
struct obio_attach_args *oba = args;
|
||||
bus_space_handle_t bh;
|
||||
int matched;
|
||||
|
||||
/* This driver only supports one unit. */
|
||||
if (cf->cf_unit != 0)
|
||||
return (0);
|
||||
|
||||
/* Make sure there is something there... */
|
||||
if (!bus_space_probe(ca->ca_bustag, 0, ca->ca_paddr,
|
||||
1, /* probe size */
|
||||
0, /* offset */
|
||||
0, /* flags */
|
||||
NULL, NULL))
|
||||
if (bus_space_map(oba->oba_bustag, oba->oba_paddr, MM58167REG_BANK_SZ,
|
||||
0, &bh))
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
matched = (bus_space_peek_1(oba->oba_bustag, bh, 0, NULL) == 0);
|
||||
bus_space_unmap(oba->oba_bustag, bh, MM58167REG_BANK_SZ);
|
||||
return (matched);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -116,14 +116,14 @@ tod_obio_attach(parent, self, args)
|
||||
struct device *self;
|
||||
void *args;
|
||||
{
|
||||
struct confargs *ca = args;
|
||||
struct obio_attach_args *oba = args;
|
||||
struct mm58167_softc *sc;
|
||||
|
||||
sc = (struct mm58167_softc *) self;
|
||||
|
||||
/* Map the device. */
|
||||
sc->mm58167_regt = ca->ca_bustag;
|
||||
if (bus_space_map(ca->ca_bustag, ca->ca_paddr, MM58167REG_BANK_SZ, 0, &sc->mm58167_regh))
|
||||
sc->mm58167_regt = oba->oba_bustag;
|
||||
if (bus_space_map(oba->oba_bustag, oba->oba_paddr, MM58167REG_BANK_SZ, 0, &sc->mm58167_regh))
|
||||
panic("tod_obio_attach: can't map");
|
||||
|
||||
tod_attach(sc);
|
||||
|
Loading…
Reference in New Issue
Block a user