xref: /openbsd/sys/dev/sbus/stp4020var.h (revision 7b36286a)
1 /*	$OpenBSD: stp4020var.h,v 1.4 2008/06/26 05:42:18 ray Exp $	*/
2 /*	$NetBSD: stp4020.c,v 1.23 2002/06/01 23:51:03 lukem Exp $	*/
3 
4 /*-
5  * Copyright (c) 1998 The NetBSD Foundation, Inc.
6  * All rights reserved.
7  *
8  * This code is derived from software contributed to The NetBSD Foundation
9  * by Paul Kranenburg.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 /*
34  * STP4020: SBus/PCMCIA bridge supporting one Type-3 PCMCIA card, or up to
35  * two Type-1 and Type-2 PCMCIA cards..
36  */
37 
38 /*
39  * Per socket data.
40  */
41 struct stp4020_socket {
42 	struct stp4020_softc	*sc;	/* Back link */
43 	int		flags;
44 #define STP4020_SOCKET_BUSY	0x0001
45 #define STP4020_SOCKET_SHUTDOWN	0x0002
46 #define	STP4020_SOCKET_ENABLING	0x0004
47 	int		sense;
48 	int		sock;		/* Socket number (0 or 1) */
49 	bus_space_tag_t	tag;		/* socket control space */
50 	bus_space_handle_t	regs;	/* 			*/
51 	struct device	*pcmcia;	/* Associated PCMCIA device */
52 	int		(*intrhandler)	/* Card driver interrupt handler */
53 			    (void *);
54 	void		*intrarg;	/* Card interrupt handler argument */
55 	int		ipl;		/* Interrupt level suggested by card */
56 	bus_space_tag_t	wintag;		/* windows access tag */
57 	struct {
58 		bus_space_handle_t	winaddr;/* this window's address */
59 	} windows[STP4020_NWIN];
60 
61 };
62 
63 struct stp4020_softc {
64 	struct device	sc_dev;		/* Base device */
65 	bus_space_tag_t	sc_bustag;
66 	pcmcia_chipset_tag_t	sc_pct;	/* Chipset methods */
67 
68 	struct proc	*event_thread;	/* event handling thread */
69 	unsigned int	events;		/* sockets with pending events */
70 
71 	struct stp4020_socket sc_socks[STP4020_NSOCK];
72 };
73 
74 void	stpattach_common(struct stp4020_softc *, int);
75 int	stp4020_iointr(void *);
76 int	stp4020_statintr(void *);
77