From 26bf14c6fe0b446c81e6b74dcdc15e17e2c8d818 Mon Sep 17 00:00:00 2001 From: cgd Date: Fri, 12 Apr 1996 02:05:14 +0000 Subject: [PATCH] update for new ISA & bus code, and clean a bit --- sys/arch/alpha/alpha/clock.c | 37 ++++++++++--------------- sys/arch/alpha/alpha/clock_mc.c | 49 +++++++++++++++++++++------------ 2 files changed, 46 insertions(+), 40 deletions(-) diff --git a/sys/arch/alpha/alpha/clock.c b/sys/arch/alpha/alpha/clock.c index f385df5013a4..d5c6057997e7 100644 --- a/sys/arch/alpha/alpha/clock.c +++ b/sys/arch/alpha/alpha/clock.c @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.7 1996/03/17 01:06:18 thorpej Exp $ */ +/* $NetBSD: clock.c,v 1.8 1996/04/12 02:05:14 cgd Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -68,11 +68,11 @@ static int clockmatch __P((struct device *, void *, void *)); static void clockattach __P((struct device *, struct device *, void *)); struct cfattach clock_ca = { - sizeof(struct clock_softc), clockmatch, clockattach + sizeof(struct clock_softc), clockmatch, clockattach, }; struct cfdriver clock_cd = { - NULL, "clock", DV_DULL + NULL, "clock", DV_DULL, }; #if defined(DEC_3000_500) || defined(DEC_3000_300) || \ @@ -107,19 +107,24 @@ clockmatch(parent, cfdata, aux) } else #endif #if NISA - if ((parent->dv_cfdata->cf_driver == &isa_cd)) { - struct isadev_attach_args *ida = aux; + { + extern struct cfdriver isa_cd; - /* XXX XXX XXX */ - if (ida->ida_port[0] != 0x70 && ida->ida_port[0] != -1) + if ((parent->dv_cfdata->cf_driver == &isa_cd)) { + struct isa_attach_args *ia = aux; + + if (ia->ia_iobase != 0x70 && ia->ia_iobase != -1) return (0); - ida->ida_port[0] = 0x70; /* XXX */ - ida->ida_nports[0] = 2; /* XXX */ - ida->ida_iosiz[0] = 0; + ia->ia_iobase = 0x70; /* XXX */ + ia->ia_iosize = 2; /* XXX */ + ia->ia_msize = 0; } else #endif return (0); +#if NISA + } +#endif return (1); } @@ -331,15 +336,3 @@ resettodr() (*csc->sc_set)(csc, &ct); } - -/* - * Wait "n" microseconds. This doesn't belong here. XXX. - */ -delay(n) - int n; -{ - register long N = cycles_per_usec * (n); - - while (N > 0) - N -= 3; -} diff --git a/sys/arch/alpha/alpha/clock_mc.c b/sys/arch/alpha/alpha/clock_mc.c index 04f6792703d5..3d87e2059e11 100644 --- a/sys/arch/alpha/alpha/clock_mc.c +++ b/sys/arch/alpha/alpha/clock_mc.c @@ -1,4 +1,4 @@ -/* $NetBSD: clock_mc.c,v 1.4 1995/12/20 00:38:57 cgd Exp $ */ +/* $NetBSD: clock_mc.c,v 1.5 1996/04/12 02:05:18 cgd Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -49,6 +49,7 @@ #include #include /* XXX */ +#include #include #include @@ -78,8 +79,8 @@ struct mcclockdata { void (*mc_write) __P((struct clock_softc *csc, u_int reg, u_int datum)); u_int (*mc_read) __P((struct clock_softc *csc, u_int reg)); - __const void *mc_accessfns; - void *mc_accessarg; + bus_chipset_tag_t mc_bc; + bus_io_handle_t mc_ioh; void *mc_addr; }; @@ -119,32 +120,44 @@ mcclock_attach(parent, self, aux) csc->sc_set = mcclock_set; #if NIOASIC - if (parent->dv_cfdata->cf_driver == &ioasiccd) { + if (parent->dv_cfdata->cf_driver == &ioasic_cd) { struct ioasicdev_attach_args *ioasicdev = aux; + struct mcclockdata *cdp; /* * XXX should really allocate a new one and copy, or * something. unlikely we'll have more than one... */ - csc->sc_data = &mcclockdata_tc; - mcclockdata_tc.mc_addr = (void *)ioasicdev->iada_addr; + csc->sc_data = cdp = &mcclockdata_tc; + cdp->mc_addr = (void *)ioasicdev->iada_addr; } else #endif #if NISA - if (parent->dv_cfdata->cf_driver == &isacd) { + { + extern struct cfdriver isa_cd; + + if (parent->dv_cfdata->cf_driver == &isa_cd) { + struct isa_attach_args *ia = aux; + struct mcclockdata *cdp; + /* * XXX should really allocate a new one and copy, or * something. unlikely we'll have more than one... */ - csc->sc_data = &mcclockdata_isa; - mcclockdata_isa.mc_accessfns = ida->ida_piofns; - mcclockdata_isa.mc_accessarg = ida->ida_pioarg; + csc->sc_data = cdp = &mcclockdata_isa; + cdp->mc_bc = ia->ia_bc; + if (bus_io_map(cdp->mc_bc, ia->ia_iobase, ia->ia_iosize, + &cdp->mc_ioh)) + panic("couldn't map clock I/O space"); } else #endif { printf("\n"); panic("clockattach: can't tell what bus we're on"); } +#if NISA + } +#endif /* Turn interrupts off, just in case. */ mc146818_write(csc, MC_REGB, MC_REGB_BINARY | MC_REGB_24HR); @@ -257,11 +270,11 @@ mc_write_isa(csc, reg, datum) u_int reg, datum; { struct mcclockdata *cdp = csc->sc_data; - __const struct isa_pio_fns *ipf = cdp->mc_accessfns; - void *ipfa = cdp->mc_accessarg; + bus_chipset_tag_t bc = cdp->mc_bc; + bus_io_handle_t ioh = cdp->mc_ioh; - OUTB(ipf, ipfa, IO_RTC, reg); - OUTB(ipf, ipfa, IO_RTC + 1, datum); + bus_io_write_1(bc, ioh, 0, reg); + bus_io_write_1(bc, ioh, 1, datum); } static u_int @@ -270,10 +283,10 @@ mc_read_isa(csc, reg) u_int reg; { struct mcclockdata *cdp = csc->sc_data; - __const struct isa_pio_fns *ipf = cdp->mc_accessfns; - void *ipfa = cdp->mc_accessarg; + bus_chipset_tag_t bc = cdp->mc_bc; + bus_io_handle_t ioh = cdp->mc_ioh; - OUTB(ipf, ipfa, IO_RTC, reg); - return INB(ipf, ipfa, IO_RTC + 1); + bus_io_write_1(bc, ioh, 0, reg); + return bus_io_read_1(bc, ioh, 1); } #endif /* NISA */