xref: /openbsd/sys/dev/sbus/stp4020var.h (revision 2496ba0d)
1 /*	$OpenBSD: stp4020var.h,v 1.5 2009/04/10 20:54:59 miod 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 	int		int_enable;	/* ICR0 value for interrupt enabled */
50 	int		int_disable;	/* ICR0 value for interrupt disabled */
51 	bus_space_tag_t	tag;		/* socket control space */
52 	bus_space_handle_t	regs;	/* 			*/
53 	struct device	*pcmcia;	/* Associated PCMCIA device */
54 	int		(*intrhandler)	/* Card driver interrupt handler */
55 			    (void *);
56 	void		*intrarg;	/* Card interrupt handler argument */
57 	void		*softint;	/* softintr cookie */
58 	bus_space_tag_t	wintag;		/* windows access tag */
59 	struct {
60 		bus_space_handle_t	winaddr;/* this window's address */
61 	} windows[STP4020_NWIN];
62 
63 };
64 
65 struct stp4020_softc {
66 	struct device	sc_dev;		/* Base device */
67 	bus_space_tag_t	sc_bustag;
68 	pcmcia_chipset_tag_t	sc_pct;	/* Chipset methods */
69 
70 	struct proc	*event_thread;	/* event handling thread */
71 	unsigned int	events;		/* sockets with pending events */
72 
73 	struct stp4020_socket sc_socks[STP4020_NSOCK];
74 };
75 
76 void	stpattach_common(struct stp4020_softc *, int);
77 int	stp4020_iointr(void *);
78 int	stp4020_statintr(void *);
79