isavar.h revision 1.17 1 /* $NetBSD: isavar.h,v 1.17 1995/12/24 02:31:38 mycroft Exp $ */
2
3 /*
4 * Copyright (c) 1995 Chris G. Demetriou
5 * Copyright (c) 1992 Berkeley Software Design, Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by Berkeley Software
19 * Design, Inc.
20 * 4. The name of Berkeley Software Design must not be used to endorse
21 * or promote products derived from this software without specific
22 * prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN, INC. ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN, INC. BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * BSDI Id: isavar.h,v 1.5 1992/12/01 18:06:00 karels Exp
37 */
38
39 /*
40 * Definitions for ISA autoconfiguration.
41 */
42
43 #include <sys/queue.h>
44
45 /*
46 * ISA driver attach arguments
47 */
48 struct isa_attach_args {
49 int ia_iobase; /* base i/o address */
50 int ia_iosize; /* span of ports used */
51 int ia_irq; /* interrupt request */
52 int ia_drq; /* DMA request */
53 int ia_maddr; /* physical i/o mem addr */
54 u_int ia_msize; /* size of i/o memory */
55 void *ia_aux; /* driver specific */
56 };
57
58 #define IOBASEUNK -1 /* i/o address is unknown */
59 #define IRQUNK -1 /* interrupt request line is unknown */
60 #define DRQUNK -1 /* DMA request line is unknown */
61 #define MADDRUNK -1 /* shared memory address is unknown */
62
63 /*
64 * Per-device ISA variables
65 */
66 struct isadev {
67 struct device *id_dev; /* back pointer to generic */
68 TAILQ_ENTRY(isadev)
69 id_bchain; /* bus chain */
70 };
71
72 /*
73 * ISA master bus
74 */
75 struct isa_softc {
76 struct device sc_dev; /* base device */
77 TAILQ_HEAD(, isadev)
78 sc_subdevs; /* list of all children */
79 };
80
81 #define cf_iobase cf_loc[0]
82 #define cf_iosize cf_loc[1]
83 #define cf_maddr cf_loc[2]
84 #define cf_msize cf_loc[3]
85 #define cf_irq cf_loc[4]
86 #define cf_drq cf_loc[5]
87
88 /*
89 * ISA interrupt handler manipulation.
90 *
91 * To establish an ISA interrupt handler, a driver calls isa_intr_establish()
92 * with the interrupt number, type, level, function, and function argument of
93 * the interrupt it wants to handle. Isa_intr_establish() returns an opaque
94 * handle to an event descriptor if it succeeds, and invokes panic() if it
95 * fails. (XXX It should return NULL, then drivers should handle that, but
96 * what should they do?) Interrupt handlers should return 0 for "interrupt
97 * not for me", 1 for "I took care of it", or -1 for "I guess it was mine,
98 * but I wasn't expecting it."
99 *
100 * To remove an interrupt handler, the driver calls isa_intr_disestablish()
101 * with the handle returned by isa_intr_establish() for that handler.
102 */
103
104 /* ISA interrupt sharing types */
105 void isascan __P((struct device *parent, void *match));
106 void *isa_intr_establish __P((int intr, int type, int level,
107 int (*ih_fun)(void *), void *ih_arg));
108 void isa_intr_disestablish __P((void *handler));
109 char *isa_intr_typename __P((int type));
110
111 #ifdef NEWCONFIG
112 /*
113 * Establish a device as being on the ISA bus (XXX NOT IMPLEMENTED).
114 */
115 void isa_establish __P((struct isadev *, struct device *));
116 #endif
117
118 /*
119 * software conventions
120 */
121 typedef enum { BUS_ISA, BUS_EISA } isa_type;
122
123 extern isa_type isa_bustype; /* type of bus; XXX should be in softc */
124