xref: /netbsd-src/sys/arch/arc/include/isa_machdep.h (revision 89c5a767f8fc7a4633b2d409966e2becbb98ff92)
1 /*	$NetBSD: isa_machdep.h,v 1.2 2000/01/23 21:01:56 soda Exp $	*/
2 /*      $OpenBSD: isa_machdep.h,v 1.5 1997/04/19 17:20:00 pefo Exp $  */
3 
4 /*
5  * Copyright (c) 1996 Per Fogelstrom
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 Per Fogelstrom
19  * 4. The name of the author may not be used to endorse or promote products
20  *    derived from this software without specific prior written permission
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 #ifndef _ISA_MACHDEP_H_
34 #define _ISA_MACHDEP_H_
35 
36 typedef struct arc_isa_bus *isa_chipset_tag_t;
37 
38 /*
39  *      I/O macros to access isa bus ports/memory.
40  *      At the first glance theese macros may seem inefficient.
41  *      However, the cpu executes an instruction every 7.5ns
42  *      so the bus is much slower so it doesn't matter, really.
43  */
44 #define isa_outb(x,y)   outb(arc_bus_io.bus_base + (x), y)
45 #define isa_inb(x)      inb(arc_bus_io.bus_base + (x))
46 
47 struct arc_isa_bus {
48         void    *ic_data;
49 
50         void    (*ic_attach_hook) __P((struct device *, struct device *,
51                     struct isabus_attach_args *));
52         void    *(*ic_intr_establish) __P((isa_chipset_tag_t, int, int, int,
53                     int (*)(void *), void *));
54         void    (*ic_intr_disestablish) __P((isa_chipset_tag_t, void *));
55 };
56 
57 
58 /*
59  * Functions provided to machine-independent ISA code.
60  */
61 #define isa_attach_hook(p, s, a)                             /*           \
62     (*(a)->iba_ic->ic_attach_hook)((p), (s), (a)) */
63 #define isa_intr_establish(c, i, t, l, f, a)                         \
64     (*(c)->ic_intr_establish)((c)->ic_data, (i), (t), (l), (f), (a))
65 #define isa_intr_disestablish(c, h)                                     \
66     (*(c)->ic_intr_disestablish)((c)->ic_data, (h))
67 
68 void sysbeepstop __P((void *));
69 void sysbeep __P((int, int));
70 
71 
72 /*
73  *	Interrupt control struct used to control the ICU setup.
74  */
75 
76 struct intrhand {
77 	struct	intrhand *ih_next;
78 	int	(*ih_fun) __P((void *));
79 	void    *ih_arg;
80 	u_long  ih_count;
81 	int     ih_level;
82 	int     ih_irq;
83 	char    *ih_what;
84 };
85 
86 #endif /* _ISA_MACHDEP_H_ */
87