Reconnect probing of the width of the isa bus, calling pcic_attach and

pcic_attach_sockets.  Rework bus width probe mapping and unmapping to
use the newbus bus_{allocate,release}_resource with a rid of 1 to work
on FreeBSD.  Remove a few now unneeded #includes.
This commit is contained in:
Warner Losh 1999-11-29 07:15:33 +00:00
parent b71e3dafa5
commit a9b6aa5eaf
3 changed files with 32 additions and 41 deletions

View File

@ -201,15 +201,10 @@ pcic_isa_attach(device_t dev)
sc->memt = rman_get_bustag(sc->mem_res); sc->memt = rman_get_bustag(sc->mem_res);
sc->memh = rman_get_bushandle(sc->mem_res);; sc->memh = rman_get_bushandle(sc->mem_res);;
#if 0 /* Not yet */
pcic_attach(dev); pcic_attach(dev);
pcic_isa_bus_width_probe (dev);
pcic_isa_bus_width_probe (dev, sc->iot, sc->ioh,
rman_get_start(sc->port_res),
rman_get_end(sc->port_res) - rman_get_end(sc->port_res) + 1);
pcic_attach_sockets(dev); pcic_attach_sockets(dev);
#endif
return 0; return 0;
error: error:
if (sc->port_res) if (sc->port_res)

View File

@ -44,16 +44,6 @@
#include <machine/bus.h> #include <machine/bus.h>
#include <sys/rman.h> #include <sys/rman.h>
#include <machine/resource.h> #include <machine/resource.h>
#include <vm/vm.h>
#ifdef __FreeBSD__
#include <i386/isa/isa_device.h>
typedef int isa_chipset_tag_t;
#define delay(x) DELAY(x)
#else
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
#endif
#include <dev/pccard/pccardreg.h> #include <dev/pccard/pccardreg.h>
#include <dev/pccard/pccardvar.h> #include <dev/pccard/pccardvar.h>
@ -115,21 +105,29 @@ int pcic_isa_intr_alloc_mask = PCIC_ISA_INTR_ALLOC_MASK;
#ifdef PCICISADEBUG #ifdef PCICISADEBUG
int pcicsubr_debug = 0 /* XXX */ ; int pcicsubr_debug = 0 /* XXX */ ;
#define DPRINTF(arg) if (pcicsubr_debug) printf arg; #define DPRINTF(arg) if (pcicsubr_debug) printf arg;
#define DEVPRINTF(arg) if (pcicsubr_debug) device_printf arg;
#else #else
#define DPRINTF(arg) #define DPRINTF(arg)
#define DEVPRINTF(arg)
#endif #endif
void pcic_isa_bus_width_probe (dev, iot, ioh, base, length) void pcic_isa_bus_width_probe (device_t dev)
device_t dev;
bus_space_tag_t iot;
bus_space_handle_t ioh;
bus_addr_t base;
u_int32_t length;
{ {
struct pcic_softc *sc = (struct pcic_softc *) struct pcic_softc *sc = (struct pcic_softc *)
device_get_softc(dev); device_get_softc(dev);
bus_space_handle_t ioh_high; bus_space_handle_t ioh_high;
int i, iobuswidth, tmp1, tmp2; int i, iobuswidth, tmp1, tmp2;
int rid;
u_long base;
u_int32_t length;
bus_space_tag_t iot;
bus_space_handle_t ioh;
struct resource *r;
base = rman_get_start(sc->port_res);
length = rman_get_end(sc->port_res) - rman_get_end(sc->port_res) + 1;
iot = sc->iot;
ioh = sc->ioh;
/* /*
* figure out how wide the isa bus is. Do this by checking if the * figure out how wide the isa bus is. Do this by checking if the
@ -137,14 +135,14 @@ void pcic_isa_bus_width_probe (dev, iot, ioh, base, length)
*/ */
iobuswidth = 12; iobuswidth = 12;
rid = 1;
#if XXX r = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, base + 0x400,
/* Map i/o space. */ base + 0x400 + length, length, RF_ACTIVE);
if (bus_space_map(iot, base + 0x400, length, 0, &ioh_high)) { if (!r) {
printf("%s: can't map high i/o space\n", sc->dev.dv_xname); printf("Can't allocated mirror area for pcic bus width probe\n");
return; return;
} }
#endif ioh_high = rman_get_bushandle(r);
for (i = 0; i < PCIC_NSLOTS; i++) { for (i = 0; i < PCIC_NSLOTS; i++) {
if (sc->handle[i].flags & PCIC_FLAG_SOCKETP) { if (sc->handle[i].flags & PCIC_FLAG_SOCKETP) {
/* /*
@ -164,10 +162,7 @@ void pcic_isa_bus_width_probe (dev, iot, ioh, base, length)
iobuswidth = 10; iobuswidth = 10;
} }
} }
bus_release_resource(dev, SYS_RES_IOPORT, rid, r);
#if XXX
bus_space_free(iot, ioh_high, length);
#endif
/* /*
* XXX mycroft recommends I/O space range 0x400-0xfff . I should put * XXX mycroft recommends I/O space range 0x400-0xfff . I should put
@ -206,17 +201,15 @@ void pcic_isa_bus_width_probe (dev, iot, ioh, base, length)
#endif #endif
} }
DPRINTF(("%s: bus_space_alloc range 0x%04lx-0x%04lx (probed)\n", DEVPRINTF((dev, "bus_space_alloc range 0x%04lx-0x%04lx (probed)\n",
sc->dev.dv_xname, (long) sc->iobase, (long) sc->iobase, (long) sc->iobase + sc->iosize));
(long) sc->iobase + sc->iosize));
if (pcic_isa_alloc_iobase && pcic_isa_alloc_iosize) { if (pcic_isa_alloc_iobase && pcic_isa_alloc_iosize) {
sc->iobase = pcic_isa_alloc_iobase; sc->iobase = pcic_isa_alloc_iobase;
sc->iosize = pcic_isa_alloc_iosize; sc->iosize = pcic_isa_alloc_iosize;
DPRINTF(("%s: bus_space_alloc range 0x%04lx-0x%04lx " DEVPRINTF((dev, "bus_space_alloc range 0x%04lx-0x%04lx "
"(config override)\n", sc->dev.dv_xname, (long) sc->iobase, "(config override)\n", (long) sc->iobase,
(long) sc->iobase + sc->iosize)); (long) sc->iobase + sc->iosize));
} }
} }
@ -235,7 +228,9 @@ pcic_isa_chip_intr_establish(pch, pf, ipl, fct, arg)
#define IST_EDGE 3 #define IST_EDGE 3
struct pcic_handle *h = (struct pcic_handle *) pch; struct pcic_handle *h = (struct pcic_handle *) pch;
struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent); struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
#if XXX
isa_chipset_tag_t ic = sc->intr_est; isa_chipset_tag_t ic = sc->intr_est;
#endif
int irq, ist; int irq, ist;
void *ih; void *ih;
int reg; int reg;
@ -275,7 +270,9 @@ pcic_isa_chip_intr_disestablish(pch, ih)
{ {
struct pcic_handle *h = (struct pcic_handle *) pch; struct pcic_handle *h = (struct pcic_handle *) pch;
struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent); struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
#if XXX
isa_chipset_tag_t ic = sc->intr_est; isa_chipset_tag_t ic = sc->intr_est;
#endif
int reg; int reg;
h->ih_irq = 0; h->ih_irq = 0;

View File

@ -45,6 +45,5 @@ void pcic_isa_chip_intr_disestablish __P((pccard_chipset_handle_t, void *));
* Figure out how wide the ISA bus is... * Figure out how wide the ISA bus is...
*/ */
void pcic_isa_bus_width_probe (device_t, bus_space_tag_t, bus_space_handle_t, void pcic_isa_bus_width_probe(device_t);
bus_addr_t, u_int32_t);