From 506250333c76efa91fdf1b8cc6689e2a27b5274e Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Mon, 23 Jun 2003 09:28:01 +0000 Subject: Split the stp driver into its core, and md attachment routines, and provide attachment routines for sparc and sparc64. --- sys/arch/sparc/dev/stp_sbus.c | 182 ++++++++++++++++++++++++++++++++++++ sys/arch/sparc64/conf/files.sparc64 | 4 +- sys/arch/sparc64/dev/stp_sbus.c | 177 +++++++++++++++++++++++++++++++++++ sys/dev/sbus/files.sbus | 4 +- sys/dev/sbus/stp4020.c | 149 ++--------------------------- sys/dev/sbus/stp4020var.h | 79 ++++++++++++++++ 6 files changed, 450 insertions(+), 145 deletions(-) create mode 100644 sys/arch/sparc/dev/stp_sbus.c create mode 100644 sys/arch/sparc64/dev/stp_sbus.c create mode 100644 sys/dev/sbus/stp4020var.h diff --git a/sys/arch/sparc/dev/stp_sbus.c b/sys/arch/sparc/dev/stp_sbus.c new file mode 100644 index 00000000000..e22391c17fb --- /dev/null +++ b/sys/arch/sparc/dev/stp_sbus.c @@ -0,0 +1,182 @@ +/* $OpenBSD: stp_sbus.c,v 1.1 2003/06/23 09:27:55 miod Exp $ */ +/* $NetBSD: stp4020.c,v 1.23 2002/06/01 23:51:03 lukem Exp $ */ + +/*- + * Copyright (c) 1998 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Paul Kranenburg. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * STP4020: SBus/PCMCIA bridge supporting two Type-3 PCMCIA cards. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +struct stp4020_sbus_softc { + struct stp4020_softc stp; + struct sbusdev sc_sd; /* SBus device */ + struct rom_reg sc_reg; + struct intrhand sc_ih[2]; +}; + +int stpmatch(struct device *, void *, void *); +void stpattach(struct device *, struct device *, void *); + +struct cfattach stp_sbus_ca = { + sizeof(struct stp4020_sbus_softc), stpmatch, stpattach +}; + +int +stpmatch(parent, match, aux) + struct device *parent; + void *match; + void *aux; +{ + struct confargs *ca = aux; + + return (strcmp("SUNW,pcmcia", ca->ca_ra.ra_name) == 0); +} + +/* + * Attach all the sub-devices we can find + */ +void +stpattach(parent, self, aux) + struct device *parent, *self; + void *aux; +{ + struct confargs *ca = aux; + struct stp4020_sbus_softc *ssc = (void *)self; + struct stp4020_softc *sc = (void *)self; + int node; + int i; + bus_space_handle_t bh; + + node = ca->ca_ra.ra_node; + + /* Transfer bus tags */ + ssc->sc_reg = ca->ca_ra.ra_reg[0]; + sc->sc_bustag = &ssc->sc_reg; + + /* Set up per-socket static initialization */ + sc->sc_socks[0].sc = sc->sc_socks[1].sc = sc; + sc->sc_socks[0].tag = sc->sc_socks[1].tag = sc->sc_bustag; + + if (ca->ca_ra.ra_nreg < 8) { + printf(": only %d register sets\n", ca->ca_ra.ra_nreg); + return; + } + + if (ca->ca_ra.ra_nintr != 2) { + printf(": expect 2 interrupt Sbus levels; got %d\n", + ca->ca_ra.ra_nintr); + return; + } + +#define STP4020_BANK_PROM 0 +#define STP4020_BANK_CTRL 4 + for (i = 0; i < 8; i++) { + + /* + * STP4020 Register address map: + * bank 0: Forth PROM + * banks 1-3: socket 0, windows 0-2 + * bank 4: control registers + * banks 5-7: socket 1, windows 0-2 + */ + + if (i == STP4020_BANK_PROM) + /* Skip the PROM */ + continue; + + if (bus_space_map(&ca->ca_ra.ra_reg[i], 0, + ca->ca_ra.ra_reg[i].rr_len, 0, &bh) != 0) { + printf(": attach: cannot map registers\n"); + return; + } + + if (i == STP4020_BANK_CTRL) { + /* + * Copy tag and handle to both socket structures + * for easy access in control/status IO functions. + */ + sc->sc_socks[0].regs = sc->sc_socks[1].regs = bh; + } else if (i < STP4020_BANK_CTRL) { + /* banks 1-3 */ + sc->sc_socks[0].windows[i-1].winaddr = bh; + } else { + /* banks 5-7 */ + sc->sc_socks[1].windows[i-5].winaddr = bh; + } + } + + sbus_establish(&ssc->sc_sd, &sc->sc_dev); + + /* + * We get to use two SBus interrupt levels. + * The higher level we use for status change interrupts; + * the lower level for PC card I/O. + */ + ssc->sc_ih[1].ih_fun = stp4020_statintr; + ssc->sc_ih[1].ih_arg = sc; + intr_establish(ca->ca_ra.ra_intr[1].int_pri, + &ssc->sc_ih[1], -1); + printf(" pri %d", ca->ca_ra.ra_intr[1].int_pri); + + ssc->sc_ih[0].ih_fun = stp4020_iointr; + ssc->sc_ih[0].ih_arg = sc; + intr_establish(ca->ca_ra.ra_intr[0].int_pri, + &ssc->sc_ih[0], -1); + printf(" and %d", ca->ca_ra.ra_intr[0].int_pri); + + stpattach_common(sc, ((struct sbus_softc *)parent)->sc_clockfreq); +} diff --git a/sys/arch/sparc64/conf/files.sparc64 b/sys/arch/sparc64/conf/files.sparc64 index 1ceb1ce8e94..e16578c05e2 100644 --- a/sys/arch/sparc64/conf/files.sparc64 +++ b/sys/arch/sparc64/conf/files.sparc64 @@ -1,4 +1,4 @@ -# $OpenBSD: files.sparc64,v 1.45 2003/06/16 20:46:13 miod Exp $ +# $OpenBSD: files.sparc64,v 1.46 2003/06/23 09:28:00 miod Exp $ # $NetBSD: files.sparc64,v 1.50 2001/08/10 20:53:50 eeh Exp $ # maxpartitions must be first item in files.${ARCH} @@ -127,6 +127,8 @@ device audioce: audio, auconv attach audioce at ebus file arch/sparc64/dev/ce4231.c audioce +file arch/sparc64/dev/stp_sbus.c stp_sbus + # # Console related stuff # diff --git a/sys/arch/sparc64/dev/stp_sbus.c b/sys/arch/sparc64/dev/stp_sbus.c new file mode 100644 index 00000000000..a019a21947d --- /dev/null +++ b/sys/arch/sparc64/dev/stp_sbus.c @@ -0,0 +1,177 @@ +/* $OpenBSD: stp_sbus.c,v 1.1 2003/06/23 09:28:00 miod Exp $ */ +/* $NetBSD: stp4020.c,v 1.23 2002/06/01 23:51:03 lukem Exp $ */ + +/*- + * Copyright (c) 1998 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Paul Kranenburg. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * STP4020: SBus/PCMCIA bridge supporting two Type-3 PCMCIA cards. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +struct stp4020_sbus_softc { + struct stp4020_softc stp; + struct sbusdev sc_sd; /* SBus device */ +}; + +int stpmatch(struct device *, void *, void *); +void stpattach(struct device *, struct device *, void *); + +struct cfattach stp_sbus_ca = { + sizeof(struct stp4020_sbus_softc), stpmatch, stpattach +}; + +int +stpmatch(parent, match, aux) + struct device *parent; + void *match; + void *aux; +{ + struct sbus_attach_args *sa = aux; + + return (strcmp("SUNW,pcmcia", sa->sa_name) == 0); +} + +/* + * Attach all the sub-devices we can find + */ +void +stpattach(parent, self, aux) + struct device *parent, *self; + void *aux; +{ + struct sbus_attach_args *sa = aux; + struct stp4020_sbus_softc *ssc = (void *)self; + struct stp4020_softc *sc = (void *)self; + int node; + int i; + bus_space_handle_t bh; + + node = sa->sa_node; + + /* Transfer bus tags */ + sc->sc_bustag = sa->sa_bustag; + + /* Set up per-socket static initialization */ + sc->sc_socks[0].sc = sc->sc_socks[1].sc = sc; + sc->sc_socks[0].tag = sc->sc_socks[1].tag = sa->sa_bustag; + + if (sa->sa_nreg < 8) { + printf(": only %d register sets\n", sa->sa_nreg); + return; + } + + if (sa->sa_nintr != 2) { + printf(": expect 2 interrupt Sbus levels; got %d\n", + sa->sa_nintr); + return; + } + +#define STP4020_BANK_PROM 0 +#define STP4020_BANK_CTRL 4 + for (i = 0; i < 8; i++) { + + /* + * STP4020 Register address map: + * bank 0: Forth PROM + * banks 1-3: socket 0, windows 0-2 + * bank 4: control registers + * banks 5-7: socket 1, windows 0-2 + */ + + if (i == STP4020_BANK_PROM) + /* Skip the PROM */ + continue; + + if (sbus_bus_map(sa->sa_bustag, sa->sa_reg[i].sbr_slot, + sa->sa_reg[i].sbr_offset, sa->sa_reg[i].sbr_size, + BUS_SPACE_MAP_LINEAR, 0, &bh) != 0) { + printf(": attach: cannot map registers\n"); + return; + } + + if (i == STP4020_BANK_CTRL) { + /* + * Copy tag and handle to both socket structures + * for easy access in control/status IO functions. + */ + sc->sc_socks[0].regs = sc->sc_socks[1].regs = bh; + } else if (i < STP4020_BANK_CTRL) { + /* banks 1-3 */ + sc->sc_socks[0].windows[i-1].winaddr = bh; + } else { + /* banks 5-7 */ + sc->sc_socks[1].windows[i-5].winaddr = bh; + } + } + + sbus_establish(&ssc->sc_sd, &sc->sc_dev); + + /* + * We get to use two SBus interrupt levels. + * The higher level we use for status change interrupts; + * the lower level for PC card I/O. + */ + if (sa->sa_nintr != 0) { + bus_intr_establish(sa->sa_bustag, sa->sa_intr[1].sbi_pri, + IPL_NONE, 0, stp4020_statintr, sc); + + bus_intr_establish(sa->sa_bustag, sa->sa_intr[0].sbi_pri, + IPL_NONE, 0, stp4020_iointr, sc); + } + + stpattach_common(sc, sa->sa_frequency); +} diff --git a/sys/dev/sbus/files.sbus b/sys/dev/sbus/files.sbus index acf51678012..831d0008b7b 100644 --- a/sys/dev/sbus/files.sbus +++ b/sys/dev/sbus/files.sbus @@ -1,4 +1,4 @@ -# $OpenBSD: files.sbus,v 1.22 2003/05/14 23:32:36 miod Exp $ +# $OpenBSD: files.sbus,v 1.23 2003/06/23 09:28:00 miod Exp $ # $NetBSD: files.sbus,v 1.16 2000/12/08 17:29:12 martin Exp $ # # Config file and device description for machine-independent SBUS code. @@ -95,6 +95,6 @@ file dev/sbus/apio.c apio | lpt_apio needs-flag # STP4020 SBus to PCMCIA bridge device stp: pcmciabus -attach stp at sbus +attach stp at sbus with stp_sbus file dev/sbus/stp4020.c stp diff --git a/sys/dev/sbus/stp4020.c b/sys/dev/sbus/stp4020.c index b8899480393..4f38f7e0412 100644 --- a/sys/dev/sbus/stp4020.c +++ b/sys/dev/sbus/stp4020.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stp4020.c,v 1.4 2002/06/21 07:55:26 fgsch Exp $ */ +/* $OpenBSD: stp4020.c,v 1.5 2003/06/23 09:28:00 miod Exp $ */ /* $NetBSD: stp4020.c,v 1.23 2002/06/01 23:51:03 lukem Exp $ */ /*- @@ -56,10 +56,9 @@ #include #include -#include -#include #include +#include /* * We use the three available windows per socket in a simple, fixed @@ -92,55 +91,11 @@ struct stp4020_event { #define STP4020_EVENT_INSERTION 0 #define STP4020_EVENT_REMOVAL 1 -/* - * Per socket data. - */ -struct stp4020_socket { - struct stp4020_softc *sc; /* Back link */ - int flags; -#define STP4020_SOCKET_BUSY 0x0001 -#define STP4020_SOCKET_SHUTDOWN 0x0002 - int sock; /* Socket number (0 or 1) */ - bus_space_tag_t tag; /* socket control space */ - bus_space_handle_t regs; /* */ - struct device *pcmcia; /* Associated PCMCIA device */ - int (*intrhandler) /* Card driver interrupt handler */ - (void *); - void *intrarg; /* Card interrupt handler argument */ - int ipl; /* Interrupt level suggested by card */ - struct { - bus_space_handle_t winaddr;/* this window's address */ - } windows[STP4020_NWIN]; - -}; - -struct stp4020_softc { - struct device sc_dev; /* Base device */ - struct sbusdev sc_sd; /* SBus device */ - bus_space_tag_t sc_bustag; - bus_dma_tag_t sc_dmatag; - pcmcia_chipset_tag_t sc_pct; /* Chipset methods */ - - struct proc *event_thread; /* event handling thread */ - SIMPLEQ_HEAD(, stp4020_event) events; /* Pending events for thread */ - - struct stp4020_socket sc_socks[STP4020_NSOCK]; -}; - - int stp4020print(void *, const char *); -int stpmatch(struct device *, void *, void *); -void stpattach(struct device *, struct device *, void *); -int stp4020_iointr(void *); -int stp4020_statintr(void *); void stp4020_map_window(struct stp4020_socket *, int, int); void stp4020_calc_speed(int, int, int *, int *); -struct cfattach stp_ca = { - sizeof(struct stp4020_softc), stpmatch, stpattach -}; - -struct cfdriver stp_cd = { +struct cfdriver stp_cd = { NULL, "stp", DV_DULL }; @@ -256,104 +211,13 @@ stp4020print(aux, busname) return (UNCONF); } -int -stpmatch(parent, match, aux) - struct device *parent; - void *match; - void *aux; -{ - struct sbus_attach_args *sa = aux; - - return (strcmp("SUNW,pcmcia", sa->sa_name) == 0); -} - /* * Attach all the sub-devices we can find */ void -stpattach(parent, self, aux) - struct device *parent, *self; - void *aux; +stpattach_common(struct stp4020_softc *sc, int clockfreq) { - struct sbus_attach_args *sa = aux; - struct stp4020_softc *sc = (void *)self; - int node, rev; - int i; - bus_space_handle_t bh; - - node = sa->sa_node; - - /* Transfer bus tags */ - sc->sc_bustag = sa->sa_bustag; - sc->sc_dmatag = sa->sa_dmatag; - - /* Set up per-socket static initialization */ - sc->sc_socks[0].sc = sc->sc_socks[1].sc = sc; - sc->sc_socks[0].tag = sc->sc_socks[1].tag = sa->sa_bustag; - - if (sa->sa_nreg < 8) { - printf(": only %d register sets\n", sa->sa_nreg); - return; - } - - if (sa->sa_nintr != 2) { - printf(": expect 2 interrupt Sbus levels; got %d\n", - sa->sa_nintr); - return; - } - -#define STP4020_BANK_PROM 0 -#define STP4020_BANK_CTRL 4 - for (i = 0; i < 8; i++) { - - /* - * STP4020 Register address map: - * bank 0: Forth PROM - * banks 1-3: socket 0, windows 0-2 - * bank 4: control registers - * banks 5-7: socket 1, windows 0-2 - */ - - if (i == STP4020_BANK_PROM) - /* Skip the PROM */ - continue; - - if (sbus_bus_map(sa->sa_bustag, sa->sa_reg[i].sbr_slot, - sa->sa_reg[i].sbr_offset, sa->sa_reg[i].sbr_size, - BUS_SPACE_MAP_LINEAR, 0, &bh) != 0) { - printf(": attach: cannot map registers\n"); - return; - } - - if (i == STP4020_BANK_CTRL) { - /* - * Copy tag and handle to both socket structures - * for easy access in control/status IO functions. - */ - sc->sc_socks[0].regs = sc->sc_socks[1].regs = bh; - } else if (i < STP4020_BANK_CTRL) { - /* banks 1-3 */ - sc->sc_socks[0].windows[i-1].winaddr = bh; - } else { - /* banks 5-7 */ - sc->sc_socks[1].windows[i-5].winaddr = bh; - } - } - - sbus_establish(&sc->sc_sd, &sc->sc_dev); - - /* - * We get to use two SBus interrupt levels. - * The higher level we use for status change interrupts; - * the lower level for PC card I/O. - */ - if (sa->sa_nintr != 0) { - bus_intr_establish(sa->sa_bustag, sa->sa_intr[1].sbi_pri, - IPL_NONE, 0, stp4020_statintr, sc); - - bus_intr_establish(sa->sa_bustag, sa->sa_intr[0].sbi_pri, - IPL_NONE, 0, stp4020_iointr, sc); - } + int i, rev; rev = stp4020_rd_sockctl(&sc->sc_socks[0], STP4020_ISR1_IDX) & STP4020_ISR1_REV_M; @@ -376,7 +240,7 @@ stpattach(parent, self, aux) if (stp4020_debug) stp4020_dump_regs(h); #endif - stp4020_attach_socket(h, sa->sa_frequency); + stp4020_attach_socket(h, clockfreq); } } @@ -650,6 +514,7 @@ stp4020_iointr(arg) (*h->intrhandler)(h->intrarg); } } + } return (r); diff --git a/sys/dev/sbus/stp4020var.h b/sys/dev/sbus/stp4020var.h new file mode 100644 index 00000000000..c4ad70f6a80 --- /dev/null +++ b/sys/dev/sbus/stp4020var.h @@ -0,0 +1,79 @@ +/* $OpenBSD: stp4020var.h,v 1.1 2003/06/23 09:28:00 miod Exp $ */ +/* $NetBSD: stp4020.c,v 1.23 2002/06/01 23:51:03 lukem Exp $ */ + +/*- + * Copyright (c) 1998 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Paul Kranenburg. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * STP4020: SBus/PCMCIA bridge supporting two Type-3 PCMCIA cards. + */ + +/* + * Per socket data. + */ +struct stp4020_socket { + struct stp4020_softc *sc; /* Back link */ + int flags; +#define STP4020_SOCKET_BUSY 0x0001 +#define STP4020_SOCKET_SHUTDOWN 0x0002 + int sock; /* Socket number (0 or 1) */ + bus_space_tag_t tag; /* socket control space */ + bus_space_handle_t regs; /* */ + struct device *pcmcia; /* Associated PCMCIA device */ + int (*intrhandler) /* Card driver interrupt handler */ + (void *); + void *intrarg; /* Card interrupt handler argument */ + int ipl; /* Interrupt level suggested by card */ + struct { + bus_space_handle_t winaddr;/* this window's address */ + } windows[STP4020_NWIN]; + +}; + +struct stp4020_softc { + struct device sc_dev; /* Base device */ + bus_space_tag_t sc_bustag; + pcmcia_chipset_tag_t sc_pct; /* Chipset methods */ + + struct proc *event_thread; /* event handling thread */ + SIMPLEQ_HEAD(, stp4020_event) events; /* Pending events for thread */ + + struct stp4020_socket sc_socks[STP4020_NSOCK]; +}; + +void stpattach_common(struct stp4020_softc *, int); +int stp4020_iointr(void *); +int stp4020_statintr(void *); -- cgit v1.2.3