isavar.h revision 1.17 1 1.17 mycroft /* $NetBSD: isavar.h,v 1.17 1995/12/24 02:31:38 mycroft 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.15 cgd
45 1.15 cgd /*
46 1.7 mycroft * ISA driver attach arguments
47 1.7 mycroft */
48 1.7 mycroft struct isa_attach_args {
49 1.12 mycroft int ia_iobase; /* base i/o address */
50 1.12 mycroft int ia_iosize; /* span of ports used */
51 1.12 mycroft int ia_irq; /* interrupt request */
52 1.12 mycroft int ia_drq; /* DMA request */
53 1.13 mycroft int ia_maddr; /* physical i/o mem addr */
54 1.7 mycroft u_int ia_msize; /* size of i/o memory */
55 1.7 mycroft void *ia_aux; /* driver specific */
56 1.7 mycroft };
57 1.7 mycroft
58 1.12 mycroft #define IOBASEUNK -1 /* i/o address is unknown */
59 1.12 mycroft #define IRQUNK -1 /* interrupt request line is unknown */
60 1.12 mycroft #define DRQUNK -1 /* DMA request line is unknown */
61 1.13 mycroft #define MADDRUNK -1 /* shared memory address is unknown */
62 1.7 mycroft
63 1.7 mycroft /*
64 1.15 cgd * Per-device ISA variables
65 1.7 mycroft */
66 1.7 mycroft struct isadev {
67 1.7 mycroft struct device *id_dev; /* back pointer to generic */
68 1.15 cgd TAILQ_ENTRY(isadev)
69 1.15 cgd id_bchain; /* bus chain */
70 1.7 mycroft };
71 1.7 mycroft
72 1.7 mycroft /*
73 1.15 cgd * ISA master bus
74 1.7 mycroft */
75 1.7 mycroft struct isa_softc {
76 1.7 mycroft struct device sc_dev; /* base device */
77 1.15 cgd TAILQ_HEAD(, isadev)
78 1.15 cgd sc_subdevs; /* list of all children */
79 1.7 mycroft };
80 1.7 mycroft
81 1.7 mycroft #define cf_iobase cf_loc[0]
82 1.7 mycroft #define cf_iosize cf_loc[1]
83 1.7 mycroft #define cf_maddr cf_loc[2]
84 1.7 mycroft #define cf_msize cf_loc[3]
85 1.7 mycroft #define cf_irq cf_loc[4]
86 1.7 mycroft #define cf_drq cf_loc[5]
87 1.7 mycroft
88 1.7 mycroft /*
89 1.15 cgd * ISA interrupt handler manipulation.
90 1.15 cgd *
91 1.15 cgd * To establish an ISA interrupt handler, a driver calls isa_intr_establish()
92 1.15 cgd * with the interrupt number, type, level, function, and function argument of
93 1.15 cgd * the interrupt it wants to handle. Isa_intr_establish() returns an opaque
94 1.15 cgd * handle to an event descriptor if it succeeds, and invokes panic() if it
95 1.15 cgd * fails. (XXX It should return NULL, then drivers should handle that, but
96 1.15 cgd * what should they do?) Interrupt handlers should return 0 for "interrupt
97 1.15 cgd * not for me", 1 for "I took care of it", or -1 for "I guess it was mine,
98 1.15 cgd * but I wasn't expecting it."
99 1.15 cgd *
100 1.15 cgd * To remove an interrupt handler, the driver calls isa_intr_disestablish()
101 1.15 cgd * with the handle returned by isa_intr_establish() for that handler.
102 1.15 cgd */
103 1.15 cgd
104 1.15 cgd /* ISA interrupt sharing types */
105 1.16 cgd void isascan __P((struct device *parent, void *match));
106 1.17 mycroft void *isa_intr_establish __P((int intr, int type, int level,
107 1.17 mycroft int (*ih_fun)(void *), void *ih_arg));
108 1.16 cgd void isa_intr_disestablish __P((void *handler));
109 1.17 mycroft char *isa_intr_typename __P((int type));
110 1.7 mycroft
111 1.15 cgd #ifdef NEWCONFIG
112 1.15 cgd /*
113 1.15 cgd * Establish a device as being on the ISA bus (XXX NOT IMPLEMENTED).
114 1.15 cgd */
115 1.7 mycroft void isa_establish __P((struct isadev *, struct device *));
116 1.15 cgd #endif
117 1.7 mycroft
118 1.7 mycroft /*
119 1.7 mycroft * software conventions
120 1.7 mycroft */
121 1.15 cgd typedef enum { BUS_ISA, BUS_EISA } isa_type;
122 1.7 mycroft
123 1.15 cgd extern isa_type isa_bustype; /* type of bus; XXX should be in softc */
124