isa_machdep.h revision 1.6.4.2 1 1.6.4.2 bouyer /* $NetBSD: isa_machdep.h,v 1.6.4.2 2000/11/20 20:00:36 bouyer Exp $ */
2 1.6.4.2 bouyer /* $OpenBSD: isa_machdep.h,v 1.5 1997/04/19 17:20:00 pefo Exp $ */
3 1.6.4.2 bouyer
4 1.6.4.2 bouyer /*
5 1.6.4.2 bouyer * Copyright (c) 1996 Per Fogelstrom
6 1.6.4.2 bouyer * All rights reserved.
7 1.6.4.2 bouyer *
8 1.6.4.2 bouyer * Redistribution and use in source and binary forms, with or without
9 1.6.4.2 bouyer * modification, are permitted provided that the following conditions
10 1.6.4.2 bouyer * are met:
11 1.6.4.2 bouyer * 1. Redistributions of source code must retain the above copyright
12 1.6.4.2 bouyer * notice, this list of conditions and the following disclaimer.
13 1.6.4.2 bouyer * 2. Redistributions in binary form must reproduce the above copyright
14 1.6.4.2 bouyer * notice, this list of conditions and the following disclaimer in the
15 1.6.4.2 bouyer * documentation and/or other materials provided with the distribution.
16 1.6.4.2 bouyer * 3. All advertising materials mentioning features or use of this software
17 1.6.4.2 bouyer * must display the following acknowledgement:
18 1.6.4.2 bouyer * This product includes software developed by Per Fogelstrom
19 1.6.4.2 bouyer * 4. The name of the author may not be used to endorse or promote products
20 1.6.4.2 bouyer * derived from this software without specific prior written permission
21 1.6.4.2 bouyer *
22 1.6.4.2 bouyer * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 1.6.4.2 bouyer * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 1.6.4.2 bouyer * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 1.6.4.2 bouyer * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 1.6.4.2 bouyer * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 1.6.4.2 bouyer * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 1.6.4.2 bouyer * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 1.6.4.2 bouyer * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 1.6.4.2 bouyer * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 1.6.4.2 bouyer * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 1.6.4.2 bouyer */
33 1.6.4.2 bouyer #ifndef _ISA_MACHDEP_H_
34 1.6.4.2 bouyer #define _ISA_MACHDEP_H_
35 1.6.4.2 bouyer
36 1.6.4.2 bouyer #include <dev/isa/isadmavar.h>
37 1.6.4.2 bouyer
38 1.6.4.2 bouyer typedef struct arc_isa_bus *isa_chipset_tag_t;
39 1.6.4.2 bouyer
40 1.6.4.2 bouyer /*
41 1.6.4.2 bouyer * I/O macros to access isa bus ports/memory.
42 1.6.4.2 bouyer * At the first glance theese macros may seem inefficient.
43 1.6.4.2 bouyer * However, the cpu executes an instruction every 7.5ns
44 1.6.4.2 bouyer * so the bus is much slower so it doesn't matter, really.
45 1.6.4.2 bouyer */
46 1.6.4.2 bouyer #define isa_outb(x,y) outb(arc_bus_io.bs_vbase + (x)- arc_bus_io.bs_start, y)
47 1.6.4.2 bouyer #define isa_inb(x) inb(arc_bus_io.bs_vbase + (x) - arc_bus_io.bs_start)
48 1.6.4.2 bouyer
49 1.6.4.2 bouyer struct arc_isa_bus {
50 1.6.4.2 bouyer void *ic_data;
51 1.6.4.2 bouyer
52 1.6.4.2 bouyer struct isa_dma_state ic_dmastate;
53 1.6.4.2 bouyer
54 1.6.4.2 bouyer void (*ic_attach_hook)(struct device *, struct device *,
55 1.6.4.2 bouyer struct isabus_attach_args *);
56 1.6.4.2 bouyer const struct evcnt *(*ic_intr_evcnt)(isa_chipset_tag_t, int);
57 1.6.4.2 bouyer void *(*ic_intr_establish)(isa_chipset_tag_t, int, int, int,
58 1.6.4.2 bouyer int (*)(void *), void *);
59 1.6.4.2 bouyer void (*ic_intr_disestablish)(isa_chipset_tag_t, void *);
60 1.6.4.2 bouyer };
61 1.6.4.2 bouyer
62 1.6.4.2 bouyer
63 1.6.4.2 bouyer /*
64 1.6.4.2 bouyer * Functions provided to machine-independent ISA code.
65 1.6.4.2 bouyer */
66 1.6.4.2 bouyer #define isa_attach_hook(p, s, a) /* \
67 1.6.4.2 bouyer (*(a)->iba_ic->ic_attach_hook)((p), (s), (a)) */
68 1.6.4.2 bouyer #define isa_intr_evcnt(c, i) \
69 1.6.4.2 bouyer (*(c)->ic_intr_evcnt)((c)->ic_data, (i))
70 1.6.4.2 bouyer #define isa_intr_establish(c, i, t, l, f, a) \
71 1.6.4.2 bouyer (*(c)->ic_intr_establish)((c)->ic_data, (i), (t), (l), (f), (a))
72 1.6.4.2 bouyer #define isa_intr_disestablish(c, h) \
73 1.6.4.2 bouyer (*(c)->ic_intr_disestablish)((c)->ic_data, (h))
74 1.6.4.2 bouyer
75 1.6.4.2 bouyer #define isa_dmainit(ic, bst, dmat, d) \
76 1.6.4.2 bouyer _isa_dmainit(&(ic)->ic_dmastate, (bst), (dmat), (d))
77 1.6.4.2 bouyer #define isa_dmacascade(ic, c) \
78 1.6.4.2 bouyer _isa_dmacascade(&(ic)->ic_dmastate, (c))
79 1.6.4.2 bouyer #define isa_dmamaxsize(ic, c) \
80 1.6.4.2 bouyer _isa_dmamaxsize(&(ic)->ic_dmastate, (c))
81 1.6.4.2 bouyer #define isa_dmamap_create(ic, c, s, f) \
82 1.6.4.2 bouyer _isa_dmamap_create(&(ic)->ic_dmastate, (c), (s), (f))
83 1.6.4.2 bouyer #define isa_dmamap_destroy(ic, c) \
84 1.6.4.2 bouyer _isa_dmamap_destroy(&(ic)->ic_dmastate, (c))
85 1.6.4.2 bouyer #define isa_dmastart(ic, c, a, n, p, f, bf) \
86 1.6.4.2 bouyer _isa_dmastart(&(ic)->ic_dmastate, (c), (a), (n), (p), (f), (bf))
87 1.6.4.2 bouyer #define isa_dmaabort(ic, c) \
88 1.6.4.2 bouyer _isa_dmaabort(&(ic)->ic_dmastate, (c))
89 1.6.4.2 bouyer #define isa_dmacount(ic, c) \
90 1.6.4.2 bouyer _isa_dmacount(&(ic)->ic_dmastate, (c))
91 1.6.4.2 bouyer #define isa_dmafinished(ic, c) \
92 1.6.4.2 bouyer _isa_dmafinished(&(ic)->ic_dmastate, (c))
93 1.6.4.2 bouyer #define isa_dmadone(ic, c) \
94 1.6.4.2 bouyer _isa_dmadone(&(ic)->ic_dmastate, (c))
95 1.6.4.2 bouyer #define isa_dmafreeze(ic) \
96 1.6.4.2 bouyer _isa_dmafreeze(&(ic)->ic_dmastate)
97 1.6.4.2 bouyer #define isa_dmathaw(ic) \
98 1.6.4.2 bouyer _isa_dmathaw(&(ic)->ic_dmastate)
99 1.6.4.2 bouyer #define isa_dmamem_alloc(ic, c, s, ap, f) \
100 1.6.4.2 bouyer _isa_dmamem_alloc(&(ic)->ic_dmastate, (c), (s), (ap), (f))
101 1.6.4.2 bouyer #define isa_dmamem_free(ic, c, a, s) \
102 1.6.4.2 bouyer _isa_dmamem_free(&(ic)->ic_dmastate, (c), (a), (s))
103 1.6.4.2 bouyer #define isa_dmamem_map(ic, c, a, s, kp, f) \
104 1.6.4.2 bouyer _isa_dmamem_map(&(ic)->ic_dmastate, (c), (a), (s), (kp), (f))
105 1.6.4.2 bouyer #define isa_dmamem_unmap(ic, c, k, s) \
106 1.6.4.2 bouyer _isa_dmamem_unmap(&(ic)->ic_dmastate, (c), (k), (s))
107 1.6.4.2 bouyer #define isa_dmamem_mmap(ic, c, a, s, o, p, f) \
108 1.6.4.2 bouyer _isa_dmamem_mmap(&(ic)->ic_dmastate, (c), (a), (s), (o), (p), (f))
109 1.6.4.2 bouyer #define isa_drq_isfree(ic, c) \
110 1.6.4.2 bouyer _isa_drq_isfree(&(ic)->ic_dmastate, (c))
111 1.6.4.2 bouyer #define isa_malloc(ic, c, s, p, f) \
112 1.6.4.2 bouyer _isa_malloc(&(ic)->ic_dmastate, (c), (s), (p), (f))
113 1.6.4.2 bouyer #define isa_free(a, p) \
114 1.6.4.2 bouyer _isa_free((a), (p))
115 1.6.4.2 bouyer #define isa_mappage(m, o, p) \
116 1.6.4.2 bouyer _isa_mappage((m), (o), (p))
117 1.6.4.2 bouyer
118 1.6.4.2 bouyer void sysbeepstop(void *);
119 1.6.4.2 bouyer void sysbeep(int, int);
120 1.6.4.2 bouyer
121 1.6.4.2 bouyer
122 1.6.4.2 bouyer /*
123 1.6.4.2 bouyer * Interrupt control struct used to control the ICU setup.
124 1.6.4.2 bouyer */
125 1.6.4.2 bouyer
126 1.6.4.2 bouyer struct intrhand {
127 1.6.4.2 bouyer struct intrhand *ih_next;
128 1.6.4.2 bouyer int (*ih_fun)(void *);
129 1.6.4.2 bouyer void *ih_arg;
130 1.6.4.2 bouyer u_long ih_count;
131 1.6.4.2 bouyer int ih_level;
132 1.6.4.2 bouyer int ih_irq;
133 1.6.4.2 bouyer char *ih_what;
134 1.6.4.2 bouyer };
135 1.6.4.2 bouyer
136 1.6.4.2 bouyer #endif /* _ISA_MACHDEP_H_ */
137