isa_machdep.h revision 1.1.1.2 1 /* $OpenBSD: isa_machdep.h,v 1.5 1997/04/19 17:20:00 pefo Exp $ */
2
3 /*
4 * Copyright (c) 1996 Per Fogelstrom
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Per Fogelstrom
18 * 4. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32 #ifndef _ISA_MACHDEP_H_
33 #define _ISA_MACHDEP_H_
34
35 typedef struct arc_isa_bus *isa_chipset_tag_t;
36
37 /*
38 * I/O macros to access isa bus ports/memory.
39 * At the first glance theese macros may seem inefficient.
40 * However, the cpu executes an instruction every 7.5ns
41 * so the bus is much slower so it doesn't matter, really.
42 */
43 #define isa_outb(x,y) outb(arc_bus_io.bus_base + (x), y)
44 #define isa_inb(x) inb(arc_bus_io.bus_base + (x))
45
46 struct arc_isa_bus {
47 void *ic_data;
48
49 void (*ic_attach_hook) __P((struct device *, struct device *,
50 struct isabus_attach_args *));
51 void *(*ic_intr_establish) __P((isa_chipset_tag_t, int, int, int,
52 int (*)(void *), void *, char *));
53 void (*ic_intr_disestablish) __P((isa_chipset_tag_t, void *));
54 };
55
56
57 /*
58 * Functions provided to machine-independent ISA code.
59 */
60 #define isa_attach_hook(p, s, a) /* \
61 (*(a)->iba_ic->ic_attach_hook)((p), (s), (a)) */
62 #define isa_intr_establish(c, i, t, l, f, a, w) \
63 (*(c)->ic_intr_establish)((c)->ic_data, (i), (t), (l), (f), (a), (w))
64 #define isa_intr_disestablish(c, h) \
65 (*(c)->ic_intr_disestablish)((c)->ic_data, (h))
66
67 void sysbeepstop __P((void *));
68 void sysbeep __P((int, int));
69
70
71 /*
72 * Interrupt control struct used to control the ICU setup.
73 */
74
75 struct intrhand {
76 struct intrhand *ih_next;
77 int (*ih_fun) __P((void *));
78 void *ih_arg;
79 u_long ih_count;
80 int ih_level;
81 int ih_irq;
82 char *ih_what;
83 };
84
85 #endif /* _ISA_MACHDEP_H_ */
86