From: deraadt Date: Tue, 7 May 1996 07:34:16 +0000 (+0000) Subject: convert to machine/bus.h X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=44a395f2af00a3f807317542ab3c85bc500d56b1;p=openbsd convert to machine/bus.h --- diff --git a/sys/dev/pcmcia/if_ep_pcmcia.c b/sys/dev/pcmcia/if_ep_pcmcia.c index 22d6998c328..4d852b5f05b 100644 --- a/sys/dev/pcmcia/if_ep_pcmcia.c +++ b/sys/dev/pcmcia/if_ep_pcmcia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ep_pcmcia.c,v 1.2 1996/05/05 13:39:22 mickey Exp $ */ +/* $OpenBSD: if_ep_pcmcia.c,v 1.3 1996/05/07 07:34:16 deraadt Exp $ */ /* $NetBSD: if_ep.c,v 1.90 1996/04/11 22:29:15 cgd Exp $ */ /* @@ -63,7 +63,7 @@ #endif #include -#include +#include #include #include @@ -97,22 +97,24 @@ ep_pcmcia_isasetup(parent, match, aux, pc_link) struct ep_softc *sc = (void *) match; struct isa_attach_args *ia = aux; struct ifnet *ifp = &sc->sc_arpcom.ac_if; + bus_chipset_tag_t bc = sc->sc_bc; + bus_io_handle_t ioh = sc->sc_ioh; int i; extern int ifqmaxlen; - outw(ia->ia_iobase + EP_COMMAND, WINDOW_SELECT | 0); - outw(ia->ia_iobase + EP_W0_CONFIG_CTRL, ENABLE_DRQ_IRQ); - outw(ia->ia_iobase + EP_W0_RESOURCE_CFG, 0x3f00); + bus_io_write_2(bc, ioh, EP_COMMAND, WINDOW_SELECT | 0); + bus_io_write_2(bc, ioh, EP_W0_CONFIG_CTRL, ENABLE_DRQ_IRQ); + bus_io_write_2(bc, ioh, EP_W0_RESOURCE_CFG, 0x3f00); /* * ok til here. Now try to figure out which link we have. * try coax first... */ #ifdef EP_COAX_DEFAULT - outw(ia->ia_iobase + EP_W0_ADDRESS_CFG, 0xC000); + bus_io_write_2(bc, ioh, EP_W0_ADDRESS_CFG, 0xC000); #else /* COAX as default is reported to be a problem */ - outw(ia->ia_iobase + EP_W0_ADDRESS_CFG, 0x0000); + bus_io_write_2(bc, ioh, EP_W0_ADDRESS_CFG, 0x0000); #endif ifp->if_snd.ifq_maxlen = ifqmaxlen; @@ -199,12 +201,19 @@ ep_pcmcia_attach(parent, self, aux) void *aux; { struct ep_softc *sc = (void *)self; - u_short conn = 0; struct isa_attach_args *ia = aux; + bus_chipset_tag_t bc = ia->ia_bc; + bus_io_handle_t ioh; + u_short conn = 0; + + if (bus_io_map(bc, ia->ia_iobase, ia->ia_iosize, &ioh)) + panic("ep_isa_attach: can't map i/o space"); - sc->ep_iobase = ia->ia_iobase; + sc->sc_bc = bc; + sc->sc_ioh = ioh; + GO_WINDOW(0); - conn = inw(ia->ia_iobase + EP_W0_CONFIG_CTRL); + conn = bus_io_read_2(bc, ioh, EP_W0_CONFIG_CTRL); printf(": "); diff --git a/sys/dev/pcmcia/pcmcia.c b/sys/dev/pcmcia/pcmcia.c index ea06da22e63..f6f330054ab 100644 --- a/sys/dev/pcmcia/pcmcia.c +++ b/sys/dev/pcmcia/pcmcia.c @@ -1,4 +1,4 @@ -/* $Id: pcmcia.c,v 1.4 1996/05/03 07:59:40 deraadt Exp $ */ +/* $Id: pcmcia.c,v 1.5 1996/05/07 07:34:17 deraadt Exp $ */ /* * Copyright (c) 1996 John T. Kohl. All rights reserved. * Copyright (c) 1994 Stefan Grefen. All rights reserved. @@ -47,7 +47,6 @@ #include #include #include -#include #include #include @@ -678,10 +677,10 @@ pcmcia_mapcard(link, unit, pc_cf) goto error; } -#define GETMEM(x) bus_mem_read_1(pca->scratch_bc, SCRATCH_MEM(pca), \ +#define GETMEM(x) bus_mem_read_1(pca->pa_bc, SCRATCH_MEM(pca), \ (pc_cf->cfg_off & (SCRATCH_SIZE(pca)-1)) + x) #define PUTMEM(x,v) \ - bus_mem_write_1(pca->scratch_bc, SCRATCH_MEM(pca), \ + bus_mem_write_1(pca->pa_bc, SCRATCH_MEM(pca), \ (pc_cf->cfg_off & (SCRATCH_SIZE(pca)-1)) + x, v) if (ISSET(pc_cf->cfgtype, DOSRESET)) {