1 /*-
2 * Copyright (c) 1991 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * from: @(#)isa_device.h 7.1 (Berkeley) 5/9/91
34 * $FreeBSD: src/sys/i386/isa/isa_device.h,v 1.33.2.4 1999/09/05 08:13:04 peter Exp $
35 */
36
37 #ifndef _I386_ISA_ISA_DEVICE_H_
38 #define _I386_ISA_ISA_DEVICE_H_
39
40 /*
41 * ISA Bus Autoconfiguration
42 */
43
44 #define IDTVEC(name) __CONCAT(X,name)
45
46 /*
47 * Type of the first (asm) part of an interrupt handler.
48 */
49 typedef void inthand_t __P((u_int cs, u_int ef, u_int esp, u_int ss));
50
51 /*
52 * Usual type of the second (C) part of an interrupt handler. Some bogus
53 * ones need the arg to be the interrupt frame (and not a copy of it, which
54 * is all that is possible in C).
55 */
56 typedef void inthand2_t __P((int unit));
57
58 /*
59 * Per device structure.
60 *
61 * XXX Note: id_conflicts should either become an array of things we're
62 * specifically allowed to conflict with or be subsumed into some
63 * more powerful mechanism for detecting and dealing with multiple types
64 * of non-fatal conflict. -jkh XXX
65 */
66 struct isa_device {
67 int id_id; /* device id */
68 struct isa_driver *id_driver;
69 int id_iobase; /* base i/o address */
70 u_short id_irq; /* interrupt request */
71 short id_drq; /* DMA request */
72 caddr_t id_maddr; /* physical i/o memory address on bus (if any)*/
73 int id_msize; /* size of i/o memory */
74 inthand2_t *id_intr; /* interrupt interface routine */
75 int id_unit; /* unit number */
76 int id_flags; /* flags */
77 int id_scsiid; /* scsi id if needed */
78 int id_alive; /* device is present */
79 #define RI_FAST 1 /* fast interrupt handler */
80 u_int id_ri_flags; /* flags for register_intr() */
81 int id_reconfig; /* hot eject device support (such as PCMCIA) */
82 int id_enabled; /* is device enabled */
83 int id_conflicts; /* we're allowed to conflict with things */
84 struct isa_device *id_next; /* used in isa_devlist in userconfig() */
85 };
86
87 /*
88 * Bits to specify the type and amount of conflict checking.
89 */
90 #define CC_ATTACH (1 << 0)
91 #define CC_DRQ (1 << 1)
92 #define CC_IOADDR (1 << 2)
93 #define CC_IRQ (1 << 3)
94 #define CC_MEMADDR (1 << 4)
95
96 /*
97 * Per-driver structure.
98 *
99 * Each device driver defines entries for a set of routines
100 * as well as an array of types which are acceptable to it.
101 * These are used at boot time by the configuration program.
102 */
103 struct isa_driver {
104 int (*probe) __P((struct isa_device *idp));
105 /* test whether device is present */
106 int (*attach) __P((struct isa_device *idp));
107 /* setup driver for a device */
108 char *name; /* device name */
109 int sensitive_hw; /* true if other probes confuse us */
110 };
111
112 #define ISA_EXTERNALLEN (sizeof(struct isa_device))
113
114 #ifdef KERNEL
115
116 extern char eintrnames[]; /* end of intrnames[] */
117 extern u_long intrcnt[]; /* counts for for each device and stray */
118 extern char intrnames[]; /* string table containing device names */
119 extern u_long *intr_countp[]; /* pointers into intrcnt[] */
120 extern inthand2_t *intr_handler[]; /* C entry points of intr handlers */
121 extern u_int intr_mask[]; /* sets of intrs masked during handling of 1 */
122 extern int intr_unit[]; /* cookies to pass to intr handlers */
123
124 extern struct isa_device isa_biotab_fdc[];
125 extern struct isa_device isa_biotab_wdc[];
126 extern struct isa_device isa_devtab_bio[];
127 extern struct isa_device isa_devtab_cam[];
128 extern struct isa_device isa_devtab_net[];
129 extern struct isa_device isa_devtab_null[];
130 extern struct isa_device isa_devtab_tty[];
131
132 inthand_t
133 IDTVEC(fastintr0), IDTVEC(fastintr1),
134 IDTVEC(fastintr2), IDTVEC(fastintr3),
135 IDTVEC(fastintr4), IDTVEC(fastintr5),
136 IDTVEC(fastintr6), IDTVEC(fastintr7),
137 IDTVEC(fastintr8), IDTVEC(fastintr9),
138 IDTVEC(fastintr10), IDTVEC(fastintr11),
139 IDTVEC(fastintr12), IDTVEC(fastintr13),
140 IDTVEC(fastintr14), IDTVEC(fastintr15);
141 inthand_t
142 IDTVEC(intr0), IDTVEC(intr1), IDTVEC(intr2), IDTVEC(intr3),
143 IDTVEC(intr4), IDTVEC(intr5), IDTVEC(intr6), IDTVEC(intr7),
144 IDTVEC(intr8), IDTVEC(intr9), IDTVEC(intr10), IDTVEC(intr11),
145 IDTVEC(intr12), IDTVEC(intr13), IDTVEC(intr14), IDTVEC(intr15);
146 struct isa_device *
147 find_display __P((void));
148 struct isa_device *
149 find_isadev __P((struct isa_device *table, struct isa_driver *driverp,
150 int unit));
151 int haveseen_isadev __P((struct isa_device *dvp, u_int checkbits));
152 void isa_configure __P((void));
153 void isa_defaultirq __P((void));
154 void isa_dmacascade __P((int chan));
155 void isa_dmadone __P((int flags, caddr_t addr, int nbytes, int chan));
156 void isa_dmainit __P((int chan, u_int bouncebufsize));
157 void isa_dmastart __P((int flags, caddr_t addr, u_int nbytes, int chan));
158 int isa_dma_acquire __P((int chan));
159 void isa_dma_release __P((int chan));
160 int isa_dmastatus __P((int chan));
161 int isa_dmastop __P((int chan));
162 u_int isa_irq_pending __P((void));
163 int isa_nmi __P((int cd));
164 void reconfig_isadev __P((struct isa_device *isdp, u_int *mp));
165 int register_intr __P((int intr, int device_id, u_int flags,
166 inthand2_t *handler, u_int *maskptr, int unit));
167 int unregister_intr __P((int intr, inthand2_t *handler));
168 int update_intr_masks __P((void));
169
170 #endif /* KERNEL */
171
172 #endif /* !_I386_ISA_ISA_DEVICE_H_ */
Cache object: 2d49203954e4288fac3763f6df80d7f0
|