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