diff options
author | imp <imp@FreeBSD.org> | 1999-10-27 05:24:09 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 1999-10-27 05:24:09 +0000 |
commit | 21f0026c8502ee6b99ec2b4554601965e4ff56c4 (patch) | |
tree | a54fe11741b87859526bd8efc12baa63b4386400 | |
parent | 4adedd4be68344bba77f9193048735387fc662b1 (diff) | |
download | FreeBSD-src-21f0026c8502ee6b99ec2b4554601965e4ff56c4.zip FreeBSD-src-21f0026c8502ee6b99ec2b4554601965e4ff56c4.tar.gz |
Make these compile. Next step is to connect newbus plumbing.
-rw-r--r-- | sys/dev/pcic/i82365.c | 78 | ||||
-rw-r--r-- | sys/dev/pcic/i82365_isa.c | 36 | ||||
-rw-r--r-- | sys/dev/pcic/i82365_isasubr.c | 21 | ||||
-rw-r--r-- | sys/dev/pcic/i82365_isavar.h | 12 | ||||
-rw-r--r-- | sys/dev/pcic/i82365var.h | 11 |
5 files changed, 88 insertions, 70 deletions
diff --git a/sys/dev/pcic/i82365.c b/sys/dev/pcic/i82365.c index 71d6a02..0b3fbf3 100644 --- a/sys/dev/pcic/i82365.c +++ b/sys/dev/pcic/i82365.c @@ -1,8 +1,6 @@ /* $NetBSD: i82365.c,v 1.23 1999/02/19 03:14:00 mycroft Exp $ */ /* $FreeBSD$ */ -#define PCICDEBUG - /* * Copyright (c) 1997 Marc Horowitz. All rights reserved. * @@ -45,6 +43,8 @@ #include <sys/rman.h> #include <machine/resource.h> +#include <machine/clock.h> + #include <sys/proc.h> #include <sys/wait.h> #include <sys/kthread.h> @@ -67,6 +67,9 @@ int pcic_debug = 0; #define DPRINTF(arg) #endif +#define DETACH_FORCE 0x1 + + #define PCIC_VENDOR_UNKNOWN 0 #define PCIC_VENDOR_I82365SLR0 1 #define PCIC_VENDOR_I82365SLR1 2 @@ -83,8 +86,10 @@ int pcic_debug = 0; void pcic_attach_socket __P((struct pcic_handle *)); void pcic_init_socket __P((struct pcic_handle *)); +#if XXX int pcic_submatch __P((struct device *, struct cfdata *, void *)); int pcic_print __P((void *arg, const char *pnp)); +#endif int pcic_intr_socket __P((struct pcic_handle *)); void pcic_attach_card __P((struct pcic_handle *)); @@ -174,9 +179,10 @@ pcic_vendor_to_string(vendor) } void -pcic_attach(sc) - struct pcic_softc *sc; +pcic_attach(device_t dev) { + struct pcic_softc *sc = (struct pcic_softc *) + device_get_softc(dev); int vendor, count, i, reg; /* now check for each controller/socket */ @@ -265,7 +271,7 @@ pcic_attach(sc) */ if (sc->handle[i].flags & PCIC_FLAG_SOCKETP) { - SIMPLEQ_INIT(&sc->handle[i].events); + STAILQ_INIT(&sc->handle[i].events); pcic_write(&sc->handle[i], PCIC_CSC_INTR, 0); pcic_read(&sc->handle[i], PCIC_CSC); } @@ -275,7 +281,7 @@ pcic_attach(sc) (sc->handle[1].flags & PCIC_FLAG_SOCKETP)) { vendor = pcic_vendor(&sc->handle[0]); - printf("%s: controller 0 (%s) has ", sc->dev.dv_xname, + device_printf(dev, "controller 0 (%s) has ", pcic_vendor_to_string(vendor)); if ((sc->handle[0].flags & PCIC_FLAG_SOCKETP) && @@ -295,7 +301,7 @@ pcic_attach(sc) (sc->handle[3].flags & PCIC_FLAG_SOCKETP)) { vendor = pcic_vendor(&sc->handle[2]); - printf("%s: controller 1 (%s) has ", sc->dev.dv_xname, + device_printf(dev, "controller 1 (%s) has ", pcic_vendor_to_string(vendor)); if ((sc->handle[2].flags & PCIC_FLAG_SOCKETP) && @@ -344,8 +350,10 @@ pcic_attach_socket(h) paa.iobase = h->sc->iobase; paa.iosize = h->sc->iosize; +#if XXX h->pccard = config_found_sm(&h->sc->dev, &paa, pcic_print, pcic_submatch); +#endif /* if there's actually a pccard device attached, initialize the slot */ @@ -377,14 +385,14 @@ pcic_create_event_thread(arg) panic("pcic_create_event_thread: unknown pcic socket"); } - if (kthread_create1(pcic_event_thread, h, &h->event_thread, - "%s,%s", h->sc->dev.dv_xname, cs)) { - printf("%s: unable to create event thread for sock 0x%02x\n", - h->sc->dev.dv_xname, h->sock); + if (kthread_create(pcic_event_thread, h, &h->event_thread, + "%s,%s", device_get_name(h->sc->dev), cs)) { + device_printf(h->sc->dev, + "cannot create event thread for sock 0x%02x\n", h->sock); panic("pcic_create_event_thread"); } else - printf("%s: create event thread for sock 0x%02x\n", - h->sc->dev.dv_xname, h->sock); + device_printf(h->sc->dev, + "create event thread for sock 0x%02x\n", h->sock); } @@ -398,7 +406,7 @@ pcic_event_thread(arg) while (h->shutdown == 0) { s = splhigh(); - if ((pe = SIMPLEQ_FIRST(&h->events)) == NULL) { + if ((pe = STAILQ_FIRST(&h->events)) == NULL) { splx(s); (void) tsleep(&h->events, PWAIT, "pcicev", 0); continue; @@ -408,7 +416,7 @@ pcic_event_thread(arg) (void) tsleep((caddr_t)pcic_event_thread, PWAIT, "pcicss", hz/4); } s = splhigh(); - SIMPLEQ_REMOVE_HEAD(&h->events, pe, pe_q); + STAILQ_REMOVE_HEAD_UNTIL(&h->events, pe, pe_q); splx(s); switch (pe->pe_type) { @@ -417,16 +425,16 @@ pcic_event_thread(arg) while (1) { struct pcic_event *pe1, *pe2; - if ((pe1 = SIMPLEQ_FIRST(&h->events)) == NULL) + if ((pe1 = STAILQ_FIRST(&h->events)) == NULL) break; if (pe1->pe_type != PCIC_EVENT_REMOVAL) break; - if ((pe2 = SIMPLEQ_NEXT(pe1, pe_q)) == NULL) + if ((pe2 = STAILQ_NEXT(pe1, pe_q)) == NULL) break; if (pe2->pe_type == PCIC_EVENT_INSERTION) { - SIMPLEQ_REMOVE_HEAD(&h->events, pe1, pe_q); + STAILQ_REMOVE_HEAD_UNTIL(&h->events, pe1, pe_q); free(pe1, M_TEMP); - SIMPLEQ_REMOVE_HEAD(&h->events, pe2, pe_q); + STAILQ_REMOVE_HEAD_UNTIL(&h->events, pe2, pe_q); free(pe2, M_TEMP); } } @@ -441,16 +449,16 @@ pcic_event_thread(arg) while (1) { struct pcic_event *pe1, *pe2; - if ((pe1 = SIMPLEQ_FIRST(&h->events)) == NULL) + if ((pe1 = STAILQ_FIRST(&h->events)) == NULL) break; if (pe1->pe_type != PCIC_EVENT_INSERTION) break; - if ((pe2 = SIMPLEQ_NEXT(pe1, pe_q)) == NULL) + if ((pe2 = STAILQ_NEXT(pe1, pe_q)) == NULL) break; if (pe2->pe_type == PCIC_EVENT_REMOVAL) { - SIMPLEQ_REMOVE_HEAD(&h->events, pe1, pe_q); + STAILQ_REMOVE_HEAD_UNTIL(&h->events, pe1, pe_q); free(pe1, M_TEMP); - SIMPLEQ_REMOVE_HEAD(&h->events, pe2, pe_q); + STAILQ_REMOVE_HEAD_UNTIL(&h->events, pe2, pe_q); free(pe2, M_TEMP); } } @@ -488,7 +496,7 @@ pcic_init_socket(h) if (h->event_thread != NULL) panic("pcic_attach_socket: event thread"); #endif - kthread_create(pcic_create_event_thread, h); + pcic_create_event_thread(h); /* set up the card to interrupt on card detect */ @@ -522,6 +530,7 @@ pcic_init_socket(h) } } +#if XXX int pcic_submatch(parent, cf, aux) struct device *parent; @@ -583,7 +592,9 @@ pcic_submatch(parent, cf, aux) return ((*cf->cf_attach->ca_match)(parent, cf, aux)); } +#endif +#if XXX int pcic_print(arg, pnp) void *arg; @@ -615,6 +626,7 @@ pcic_print(arg, pnp) return (UNCONF); } +#endif int pcic_intr(arg) @@ -707,7 +719,7 @@ pcic_queue_event(h, event) pe->pe_type = event; s = splhigh(); - SIMPLEQ_INSERT_TAIL(&h->events, pe, pe_q); + STAILQ_INSERT_TAIL(&h->events, pe, pe_q); splx(s); wakeup(&h->events); } @@ -718,8 +730,10 @@ pcic_attach_card(h) { struct pccard_softc *psc = (void*)h->pccard; if (!(h->flags & PCIC_FLAG_CARDP)) { +#if XXX /* call the MI attach function */ psc->sc_if.if_card_attach (psc); +#endif h->flags |= PCIC_FLAG_CARDP; } else { @@ -737,7 +751,9 @@ pcic_detach_card(h, flags) h->flags &= ~PCIC_FLAG_CARDP; /* call the MI detach function */ +#if XXX psc->sc_if.if_card_detach (psc, flags); +#endif } else { DPRINTF(("pcic_detach_card: already detached")); } @@ -749,7 +765,9 @@ pcic_deactivate_card(h) { struct pccard_softc *psc = (void*)h->pccard; /* call the MI deactivate function */ +#if XXX psc->sc_if.if_card_deactivate (psc); +#endif /* power down the socket */ pcic_write(h, PCIC_PWRCTL, 0); @@ -784,10 +802,12 @@ pcic_chip_mem_alloc(pch, size, pcmhp) for (i = 0; i <= PCIC_MAX_MEM_PAGES - sizepg; i++) { if ((h->sc->subregionmask & (mask << i)) == (mask << i)) { +#if XXX if (bus_space_subregion(h->sc->memt, h->sc->memh, i * PCIC_MEM_PAGESIZE, sizepg * PCIC_MEM_PAGESIZE, &memh)) return (1); +#endif mhandle = mask << i; addr = h->sc->membase + (i * PCIC_MEM_PAGESIZE); h->sc->subregionmask &= ~(mhandle); @@ -1037,16 +1057,20 @@ pcic_chip_io_alloc(pch, start, size, align, pcihp) if (start) { ioaddr = start; +#if XXX if (bus_space_map(iot, start, size, 0, &ioh)) return (1); +#endif DPRINTF(("pcic_chip_io_alloc map port %lx+%lx\n", (u_long) ioaddr, (u_long) size)); } else { flags |= PCCARD_IO_ALLOCATED; +#if XXX if (bus_space_alloc(iot, h->sc->iobase, h->sc->iobase + h->sc->iosize, size, align, 0, 0, &ioaddr, &ioh)) return (1); +#endif DPRINTF(("pcic_chip_io_alloc alloc port %lx+%lx\n", (u_long) ioaddr, (u_long) size)); } @@ -1069,10 +1093,12 @@ pcic_chip_io_free(pch, pcihp) bus_space_handle_t ioh = pcihp->ioh; bus_size_t size = pcihp->size; +#if XXX if (pcihp->flags & PCCARD_IO_ALLOCATED) bus_space_free(iot, ioh, size); else bus_space_unmap(iot, ioh, size); +#endif } @@ -1314,7 +1340,9 @@ pcic_chip_socket_enable(pch) /* set the card type */ +#if XXX cardtype = psc->sc_if.if_card_gettype (psc); +#endif reg = pcic_read(h, PCIC_INTR); reg &= ~(PCIC_INTR_CARDTYPE_MASK | PCIC_INTR_IRQ_MASK | PCIC_INTR_ENABLE); diff --git a/sys/dev/pcic/i82365_isa.c b/sys/dev/pcic/i82365_isa.c index 6e41f3c..4012a76 100644 --- a/sys/dev/pcic/i82365_isa.c +++ b/sys/dev/pcic/i82365_isa.c @@ -1,8 +1,6 @@ /* $NetBSD: i82365_isa.c,v 1.11 1998/06/09 07:25:00 thorpej Exp $ */ /* $FreeBSD$ */ -#define PCICISADEBUG - /* * Copyright (c) 1997 Marc Horowitz. All rights reserved. * @@ -70,22 +68,9 @@ int pcicisa_debug = 0 /* XXX */ ; #define DPRINTF(arg) #endif -int pcic_isa_probe __P((struct device *, struct cfdata *, void *)); -void pcic_isa_attach __P((struct device *, struct device *, void *)); - -void *pcic_isa_chip_intr_establish __P((pccard_chipset_handle_t, - struct pccard_function *, int, int (*) (void *), void *)); -void pcic_isa_chip_intr_disestablish __P((pccard_chipset_handle_t, void *)); +int pcic_isa_probe(device_t dev); +int pcic_isa_attach(device_t dev); -#ifdef __FreeBSD__ -struct cfattach pcic_isa_ca = { - sizeof(struct pcic_softc), pcic_isa_probe, pcic_isa_attach -}; -#else -struct cfattach pcic_isa_ca = { - sizeof(struct pcic_softc), pcic_isa_probe, pcic_isa_attach -}; -#endif static struct pccard_chip_functions pcic_isa_functions = { pcic_chip_mem_alloc, pcic_chip_mem_free, @@ -105,11 +90,9 @@ static struct pccard_chip_functions pcic_isa_functions = { }; int -pcic_isa_probe(parent, match, aux) - struct device *parent; - struct cfdata *match; - void *aux; +pcic_isa_probe(device_t dev) { +#if XXX struct isa_attach_args *ia = aux; bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh, memh; @@ -182,15 +165,14 @@ pcic_isa_probe(parent, match, aux) return (0); ia->ia_iosize = PCIC_IOSIZE; - +#endif return (1); } -void -pcic_isa_attach(parent, self, aux) - struct device *parent, *self; - void *aux; +int +pcic_isa_attach(device_t dev) { +#if 0 struct pcic_softc *sc = (void *) self; struct isa_attach_args *ia = aux; isa_chipset_tag_t ic = ia->ia_ic; @@ -259,4 +241,6 @@ pcic_isa_attach(parent, self, aux) } pcic_attach_sockets(sc); +#endif + return 0; } diff --git a/sys/dev/pcic/i82365_isasubr.c b/sys/dev/pcic/i82365_isasubr.c index 7741fa0..671225e 100644 --- a/sys/dev/pcic/i82365_isasubr.c +++ b/sys/dev/pcic/i82365_isasubr.c @@ -1,8 +1,6 @@ /* $NetBSD: i82365_isasubr.c,v 1.1 1998/06/07 18:28:31 sommerfe Exp $ */ /* $FreeBSD$ */ -#define PCICISADEBUG - /* * Copyright (c) 1998 Bill Sommerfeld. All rights reserved. * Copyright (c) 1997 Marc Horowitz. All rights reserved. @@ -121,13 +119,15 @@ int pcicsubr_debug = 0 /* XXX */ ; #define DPRINTF(arg) #endif -void pcic_isa_bus_width_probe (sc, iot, ioh, base, length) - struct pcic_softc *sc; +void pcic_isa_bus_width_probe (dev, iot, ioh, base, length) + 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 *) + device_get_softc(dev); bus_space_handle_t ioh_high; int i, iobuswidth, tmp1, tmp2; @@ -138,12 +138,13 @@ void pcic_isa_bus_width_probe (sc, iot, ioh, base, length) iobuswidth = 12; +#if XXX /* Map i/o space. */ if (bus_space_map(iot, base + 0x400, length, 0, &ioh_high)) { printf("%s: can't map high i/o space\n", sc->dev.dv_xname); return; } - +#endif for (i = 0; i < PCIC_NSLOTS; i++) { if (sc->handle[i].flags & PCIC_FLAG_SOCKETP) { /* @@ -164,7 +165,9 @@ void pcic_isa_bus_width_probe (sc, iot, ioh, base, length) } } +#if XXX bus_space_free(iot, ioh_high, length); +#endif /* * XXX mycroft recommends I/O space range 0x400-0xfff . I should put @@ -227,6 +230,8 @@ pcic_isa_chip_intr_establish(pch, pf, ipl, fct, arg) int (*fct) __P((void *)); void *arg; { +#define IST_LEVEL 1 +#define IST_PULSE 2 struct pcic_handle *h = (struct pcic_handle *) pch; isa_chipset_tag_t ic = h->sc->intr_est; int irq, ist; @@ -240,12 +245,14 @@ pcic_isa_chip_intr_establish(pch, pf, ipl, fct, arg) else ist = IST_LEVEL; +#if XXX if (isa_intr_alloc(ic, PCIC_INTR_IRQ_VALIDMASK & pcic_isa_intr_alloc_mask, ist, &irq)) return (NULL); if ((ih = isa_intr_establish(ic, irq, ist, ipl, fct, arg)) == NULL) return (NULL); +#endif reg = pcic_read(h, PCIC_INTR); reg &= ~PCIC_INTR_IRQ_MASK; @@ -254,7 +261,7 @@ pcic_isa_chip_intr_establish(pch, pf, ipl, fct, arg) h->ih_irq = irq; - printf("%s: card irq %d\n", h->pccard->dv_xname, irq); + printf("card irq %d\n",irq); return (ih); } @@ -274,5 +281,7 @@ pcic_isa_chip_intr_disestablish(pch, ih) reg &= ~(PCIC_INTR_IRQ_MASK | PCIC_INTR_ENABLE); pcic_write(h, PCIC_INTR, reg); +#if XXX isa_intr_disestablish(ic, ih); +#endif } diff --git a/sys/dev/pcic/i82365_isavar.h b/sys/dev/pcic/i82365_isavar.h index 8e4ea91..7dc49fe 100644 --- a/sys/dev/pcic/i82365_isavar.h +++ b/sys/dev/pcic/i82365_isavar.h @@ -34,17 +34,17 @@ extern int pcic_isa_intr_alloc_mask; /* - * Establish/disestablish interrupts for PCMCIA functions. + * Establish/disestablish interrupts for PCCARD functions. */ -void *pcic_isa_chip_intr_establish __P((pcmcia_chipset_handle_t, - struct pcmcia_function *, int, int (*) (void *), void *)); -void pcic_isa_chip_intr_disestablish __P((pcmcia_chipset_handle_t, void *)); +void *pcic_isa_chip_intr_establish __P((pccard_chipset_handle_t, + struct pccard_function *, int, int (*) (void *), void *)); +void pcic_isa_chip_intr_disestablish __P((pccard_chipset_handle_t, void *)); /* * Figure out how wide the ISA bus is... */ -void pcic_isa_bus_width_probe __P((struct pcic_softc *, bus_space_tag_t, - bus_space_handle_t, bus_addr_t, u_int32_t)); +void pcic_isa_bus_width_probe (device_t, bus_space_tag_t, bus_space_handle_t, + bus_addr_t, u_int32_t); diff --git a/sys/dev/pcic/i82365var.h b/sys/dev/pcic/i82365var.h index 7a3d279..28998e7 100644 --- a/sys/dev/pcic/i82365var.h +++ b/sys/dev/pcic/i82365var.h @@ -38,7 +38,7 @@ struct proc; struct pcic_event { - SIMPLEQ_ENTRY(pcic_event) pe_q; + STAILQ_ENTRY(pcic_event) pe_q; int pe_type; }; @@ -70,7 +70,7 @@ struct pcic_handle { int shutdown; struct proc *event_thread; - SIMPLEQ_HEAD(, pcic_event) events; + STAILQ_HEAD(, pcic_event) events; }; #define PCIC_FLAG_SOCKETP 0x0001 @@ -96,7 +96,7 @@ struct pcic_handle { #define PCIC_NSLOTS 4 struct pcic_softc { - struct device dev; + device_t dev; bus_space_tag_t memt; bus_space_handle_t memh; @@ -136,13 +136,10 @@ int pcic_ident_ok __P((int)); int pcic_vendor __P((struct pcic_handle *)); char *pcic_vendor_to_string __P((int)); -void pcic_attach __P((struct pcic_softc *)); +void pcic_attach(device_t dev); void pcic_attach_sockets __P((struct pcic_softc *)); int pcic_intr __P((void *arg)); -static __inline int pcic_read __P((struct pcic_handle *, int)); -static __inline void pcic_write __P((struct pcic_handle *, int, int)); - int pcic_chip_mem_alloc __P((pccard_chipset_handle_t, bus_size_t, struct pccard_mem_handle *)); void pcic_chip_mem_free __P((pccard_chipset_handle_t, |