version 1.14, 2000/06/28 16:27:53 |
version 1.14.4.2, 2002/10/10 18:39:33 |
|
|
/* $NetBSD$ */ |
/* $NetBSD$ */ |
|
|
#define PCICISADEBUG |
|
|
|
/* |
/* |
* Copyright (c) 1997 Marc Horowitz. All rights reserved. |
* Copyright (c) 1997 Marc Horowitz. All rights reserved. |
* |
* |
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
*/ |
|
|
#include <sys/types.h> |
#include <sys/cdefs.h> |
|
__KERNEL_RCSID(0, "$NetBSD$"); |
|
|
|
#define PCICISADEBUG |
|
|
#include <sys/param.h> |
#include <sys/param.h> |
#include <sys/systm.h> |
#include <sys/systm.h> |
#include <sys/device.h> |
#include <sys/device.h> |
Line 62 int pcicisa_debug = 0; |
|
Line 64 int pcicisa_debug = 0; |
|
int pcic_isa_probe __P((struct device *, struct cfdata *, void *)); |
int pcic_isa_probe __P((struct device *, struct cfdata *, void *)); |
void pcic_isa_attach __P((struct device *, struct device *, void *)); |
void pcic_isa_attach __P((struct device *, struct device *, void *)); |
|
|
struct cfattach pcic_isa_ca = { |
CFATTACH_DECL(pcic_isa, sizeof(struct pcic_isa_softc), |
sizeof(struct pcic_isa_softc), pcic_isa_probe, pcic_isa_attach |
pcic_isa_probe, pcic_isa_attach, NULL, NULL); |
}; |
|
|
|
static struct pcmcia_chip_functions pcic_isa_functions = { |
static struct pcmcia_chip_functions pcic_isa_functions = { |
pcic_chip_mem_alloc, |
pcic_chip_mem_alloc, |
Line 93 pcic_isa_probe(parent, match, aux) |
|
Line 94 pcic_isa_probe(parent, match, aux) |
|
struct isa_attach_args *ia = aux; |
struct isa_attach_args *ia = aux; |
bus_space_tag_t iot = ia->ia_iot; |
bus_space_tag_t iot = ia->ia_iot; |
bus_space_handle_t ioh, memh; |
bus_space_handle_t ioh, memh; |
int val, found; |
int val, found, msize; |
|
|
/* Disallow wildcarded i/o address. */ |
if (ia->ia_nio < 1) |
if (ia->ia_iobase == ISACF_PORT_DEFAULT) |
return (0); |
|
if (ia->ia_niomem < 1) |
return (0); |
return (0); |
|
|
if (bus_space_map(iot, ia->ia_iobase, PCIC_IOSIZE, 0, &ioh)) |
if (ISA_DIRECT_CONFIG(ia)) |
return (0); |
return (0); |
|
|
if (ia->ia_msize == -1) |
/* Disallow wildcarded i/o address. */ |
ia->ia_msize = PCIC_MEMSIZE; |
if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT) |
|
return (0); |
|
if (ia->ia_iomem[0].ir_addr == ISACF_IOMEM_DEFAULT) |
|
return (0); |
|
|
|
if (bus_space_map(iot, ia->ia_io[0].ir_addr, PCIC_IOSIZE, 0, &ioh)) |
|
return (0); |
|
|
if (bus_space_map(ia->ia_memt, ia->ia_maddr, ia->ia_msize, 0, &memh)) |
if (ia->ia_iomem[0].ir_size == ISACF_IOSIZ_DEFAULT) |
|
msize = PCIC_MEMSIZE; |
|
else |
|
msize = ia->ia_iomem[0].ir_size; |
|
|
|
if (bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr, |
|
msize, 0, &memh)) { |
|
bus_space_unmap(iot, ioh, PCIC_IOSIZE); |
return (0); |
return (0); |
|
} |
|
|
found = 0; |
found = 0; |
|
|
Line 148 pcic_isa_probe(parent, match, aux) |
|
Line 164 pcic_isa_probe(parent, match, aux) |
|
|
|
|
|
bus_space_unmap(iot, ioh, PCIC_IOSIZE); |
bus_space_unmap(iot, ioh, PCIC_IOSIZE); |
bus_space_unmap(ia->ia_memt, memh, ia->ia_msize); |
bus_space_unmap(ia->ia_memt, memh, msize); |
|
|
if (!found) |
if (!found) |
return (0); |
return (0); |
|
|
ia->ia_iosize = PCIC_IOSIZE; |
ia->ia_nio = 1; |
|
ia->ia_io[0].ir_size = PCIC_IOSIZE; |
|
|
|
ia->ia_niomem = 1; |
|
ia->ia_iomem[0].ir_size = msize; |
|
|
|
/* IRQ is special. */ |
|
|
|
ia->ia_ndrq = 0; |
|
|
return (1); |
return (1); |
} |
} |
Line 173 pcic_isa_attach(parent, self, aux) |
|
Line 197 pcic_isa_attach(parent, self, aux) |
|
bus_space_handle_t memh; |
bus_space_handle_t memh; |
|
|
/* Map i/o space. */ |
/* Map i/o space. */ |
if (bus_space_map(iot, ia->ia_iobase, ia->ia_iosize, 0, &ioh)) { |
if (bus_space_map(iot, ia->ia_io[0].ir_addr, PCIC_IOSIZE, 0, &ioh)) { |
printf(": can't map i/o space\n"); |
printf(": can't map i/o space\n"); |
return; |
return; |
} |
} |
|
|
/* Map mem space. */ |
/* Map mem space. */ |
if (bus_space_map(memt, ia->ia_maddr, ia->ia_msize, 0, &memh)) { |
if (bus_space_map(memt, ia->ia_iomem[0].ir_addr, |
|
ia->ia_iomem[0].ir_size, 0, &memh)) { |
printf(": can't map mem space\n"); |
printf(": can't map mem space\n"); |
return; |
return; |
} |
} |
|
|
sc->membase = ia->ia_maddr; |
sc->membase = ia->ia_iomem[0].ir_addr; |
sc->subregionmask = (1 << (ia->ia_msize / PCIC_MEM_PAGESIZE)) - 1; |
sc->subregionmask = |
|
(1 << (ia->ia_iomem[0].ir_size / PCIC_MEM_PAGESIZE)) - 1; |
|
|
isc->sc_ic = ic; |
isc->sc_ic = ic; |
sc->pct = (pcmcia_chipset_tag_t) & pcic_isa_functions; |
sc->pct = (pcmcia_chipset_tag_t) & pcic_isa_functions; |
Line 194 pcic_isa_attach(parent, self, aux) |
|
Line 220 pcic_isa_attach(parent, self, aux) |
|
sc->ioh = ioh; |
sc->ioh = ioh; |
sc->memt = memt; |
sc->memt = memt; |
sc->memh = memh; |
sc->memh = memh; |
sc->irq = ia->ia_irq; |
if (ia->ia_nirq > 0) |
|
sc->irq = ia->ia_irq[0].ir_irq; |
|
else |
|
sc->irq = ISACF_IRQ_DEFAULT; |
|
|
printf("\n"); |
printf("\n"); |
|
|
pcic_attach(sc); |
pcic_attach(sc); |
pcic_isa_bus_width_probe(sc, iot, ioh, ia->ia_iobase, ia->ia_iosize); |
pcic_isa_bus_width_probe(sc, iot, ioh, ia->ia_io[0].ir_addr, |
|
PCIC_IOSIZE); |
pcic_attach_sockets(sc); |
pcic_attach_sockets(sc); |
|
|
config_interrupts(self, pcic_isa_config_interrupts); |
config_interrupts(self, pcic_isa_config_interrupts); |