isa_machdep.h revision 1.2.4.2 1 1.2.4.2 bouyer /* $NetBSD: isa_machdep.h,v 1.2.4.2 2001/03/12 13:27:22 bouyer Exp $ */
2 1.2.4.2 bouyer
3 1.2.4.2 bouyer /*-
4 1.2.4.2 bouyer * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
5 1.2.4.2 bouyer * All rights reserved.
6 1.2.4.2 bouyer *
7 1.2.4.2 bouyer * This code is derived from software contributed to The NetBSD Foundation
8 1.2.4.2 bouyer * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 1.2.4.2 bouyer * NASA Ames Research Center.
10 1.2.4.2 bouyer *
11 1.2.4.2 bouyer * Redistribution and use in source and binary forms, with or without
12 1.2.4.2 bouyer * modification, are permitted provided that the following conditions
13 1.2.4.2 bouyer * are met:
14 1.2.4.2 bouyer * 1. Redistributions of source code must retain the above copyright
15 1.2.4.2 bouyer * notice, this list of conditions and the following disclaimer.
16 1.2.4.2 bouyer * 2. Redistributions in binary form must reproduce the above copyright
17 1.2.4.2 bouyer * notice, this list of conditions and the following disclaimer in the
18 1.2.4.2 bouyer * documentation and/or other materials provided with the distribution.
19 1.2.4.2 bouyer * 3. All advertising materials mentioning features or use of this software
20 1.2.4.2 bouyer * must display the following acknowledgement:
21 1.2.4.2 bouyer * This product includes software developed by the NetBSD
22 1.2.4.2 bouyer * Foundation, Inc. and its contributors.
23 1.2.4.2 bouyer * 4. Neither the name of The NetBSD Foundation nor the names of its
24 1.2.4.2 bouyer * contributors may be used to endorse or promote products derived
25 1.2.4.2 bouyer * from this software without specific prior written permission.
26 1.2.4.2 bouyer *
27 1.2.4.2 bouyer * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28 1.2.4.2 bouyer * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29 1.2.4.2 bouyer * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 1.2.4.2 bouyer * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31 1.2.4.2 bouyer * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 1.2.4.2 bouyer * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 1.2.4.2 bouyer * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 1.2.4.2 bouyer * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 1.2.4.2 bouyer * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 1.2.4.2 bouyer * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 1.2.4.2 bouyer * POSSIBILITY OF SUCH DAMAGE.
38 1.2.4.2 bouyer */
39 1.2.4.2 bouyer
40 1.2.4.2 bouyer #ifndef _ARM32_ISA_MACHDEP_H_
41 1.2.4.2 bouyer #define _ARM32_ISA_MACHDEP_H_
42 1.2.4.2 bouyer
43 1.2.4.2 bouyer #include <machine/bus.h>
44 1.2.4.2 bouyer #include <dev/isa/isadmavar.h>
45 1.2.4.2 bouyer
46 1.2.4.2 bouyer /*
47 1.2.4.2 bouyer * Types provided to machine-independent ISA code.
48 1.2.4.2 bouyer */
49 1.2.4.2 bouyer struct arm32_isa_chipset {
50 1.2.4.2 bouyer struct isa_dma_state ic_dmastate;
51 1.2.4.2 bouyer };
52 1.2.4.2 bouyer
53 1.2.4.2 bouyer typedef struct arm32_isa_chipset *isa_chipset_tag_t;
54 1.2.4.2 bouyer
55 1.2.4.2 bouyer struct device; /* XXX */
56 1.2.4.2 bouyer struct isabus_attach_args; /* XXX */
57 1.2.4.2 bouyer
58 1.2.4.2 bouyer /*
59 1.2.4.2 bouyer * Functions provided to machine-independent ISA code.
60 1.2.4.2 bouyer */
61 1.2.4.2 bouyer void isa_attach_hook(struct device *, struct device *,
62 1.2.4.2 bouyer struct isabus_attach_args *);
63 1.2.4.2 bouyer const struct evcnt *isa_intr_evcnt(isa_chipset_tag_t ic, int irq);
64 1.2.4.2 bouyer void *isa_intr_establish(isa_chipset_tag_t ic, int irq, int type,
65 1.2.4.2 bouyer int level, int (*ih_fun)(void *), void *ih_arg);
66 1.2.4.2 bouyer void isa_intr_disestablish(isa_chipset_tag_t ic, void *handler);
67 1.2.4.2 bouyer
68 1.2.4.2 bouyer #define isa_dmainit(ic, bst, dmat, d) \
69 1.2.4.2 bouyer _isa_dmainit(&(ic)->ic_dmastate, (bst), (dmat), (d))
70 1.2.4.2 bouyer #define isa_dmacascade(ic, c) \
71 1.2.4.2 bouyer _isa_dmacascade(&(ic)->ic_dmastate, (c))
72 1.2.4.2 bouyer #define isa_dmamaxsize(ic, c) \
73 1.2.4.2 bouyer _isa_dmamaxsize(&(ic)->ic_dmastate, (c))
74 1.2.4.2 bouyer #define isa_dmamap_create(ic, c, s, f) \
75 1.2.4.2 bouyer _isa_dmamap_create(&(ic)->ic_dmastate, (c), (s), (f))
76 1.2.4.2 bouyer #define isa_dmamap_destroy(ic, c) \
77 1.2.4.2 bouyer _isa_dmamap_destroy(&(ic)->ic_dmastate, (c))
78 1.2.4.2 bouyer #define isa_dmastart(ic, c, a, n, p, f, bf) \
79 1.2.4.2 bouyer _isa_dmastart(&(ic)->ic_dmastate, (c), (a), (n), (p), (f), (bf))
80 1.2.4.2 bouyer #define isa_dmaabort(ic, c) \
81 1.2.4.2 bouyer _isa_dmaabort(&(ic)->ic_dmastate, (c))
82 1.2.4.2 bouyer #define isa_dmacount(ic, c) \
83 1.2.4.2 bouyer _isa_dmacount(&(ic)->ic_dmastate, (c))
84 1.2.4.2 bouyer #define isa_dmafinished(ic, c) \
85 1.2.4.2 bouyer _isa_dmafinished(&(ic)->ic_dmastate, (c))
86 1.2.4.2 bouyer #define isa_dmadone(ic, c) \
87 1.2.4.2 bouyer _isa_dmadone(&(ic)->ic_dmastate, (c))
88 1.2.4.2 bouyer #define isa_dmafreeze(ic) \
89 1.2.4.2 bouyer _isa_dmafreeze(&(ic)->ic_dmastate)
90 1.2.4.2 bouyer #define isa_dmathaw(ic) \
91 1.2.4.2 bouyer _isa_dmathaw(&(ic)->ic_dmastate)
92 1.2.4.2 bouyer #define isa_dmamem_alloc(ic, c, s, ap, f) \
93 1.2.4.2 bouyer _isa_dmamem_alloc(&(ic)->ic_dmastate, (c), (s), (ap), (f))
94 1.2.4.2 bouyer #define isa_dmamem_free(ic, c, a, s) \
95 1.2.4.2 bouyer _isa_dmamem_free(&(ic)->ic_dmastate, (c), (a), (s))
96 1.2.4.2 bouyer #define isa_dmamem_map(ic, c, a, s, kp, f) \
97 1.2.4.2 bouyer _isa_dmamem_map(&(ic)->ic_dmastate, (c), (a), (s), (kp), (f))
98 1.2.4.2 bouyer #define isa_dmamem_unmap(ic, c, k, s) \
99 1.2.4.2 bouyer _isa_dmamem_unmap(&(ic)->ic_dmastate, (c), (k), (s))
100 1.2.4.2 bouyer #define isa_dmamem_mmap(ic, c, a, s, o, p, f) \
101 1.2.4.2 bouyer _isa_dmamem_mmap(&(ic)->ic_dmastate, (c), (a), (s), (o), (p), (f))
102 1.2.4.2 bouyer #define isa_drq_isfree(ic, c) \
103 1.2.4.2 bouyer _isa_drq_isfree(&(ic)->ic_dmastate, (c))
104 1.2.4.2 bouyer #define isa_malloc(ic, c, s, p, f) \
105 1.2.4.2 bouyer _isa_malloc(&(ic)->ic_dmastate, (c), (s), (p), (f))
106 1.2.4.2 bouyer #define isa_free(a, p) \
107 1.2.4.2 bouyer _isa_free((a), (p))
108 1.2.4.2 bouyer #define isa_mappage(m, o, p) \
109 1.2.4.2 bouyer _isa_mappage((m), (o), (p))
110 1.2.4.2 bouyer
111 1.2.4.2 bouyer /*
112 1.2.4.2 bouyer * ALL OF THE FOLLOWING ARE MACHINE-DEPENDENT, AND SHOULD NOT BE USED
113 1.2.4.2 bouyer * BY PORTABLE CODE.
114 1.2.4.2 bouyer */
115 1.2.4.2 bouyer
116 1.2.4.2 bouyer extern struct arm32_bus_dma_tag isa_bus_dma_tag;
117 1.2.4.2 bouyer
118 1.2.4.2 bouyer /*
119 1.2.4.2 bouyer * Cookie used by ISA DMA. A pointer to one of these is stashed in
120 1.2.4.2 bouyer * the DMA map.
121 1.2.4.2 bouyer */
122 1.2.4.2 bouyer struct arm32_isa_dma_cookie {
123 1.2.4.2 bouyer int id_flags; /* flags; see below */
124 1.2.4.2 bouyer
125 1.2.4.2 bouyer /*
126 1.2.4.2 bouyer * Information about the original buffer used during
127 1.2.4.2 bouyer * DMA map syncs. Note that origbuflen is only used
128 1.2.4.2 bouyer * for ID_BUFTYPE_LINEAR.
129 1.2.4.2 bouyer */
130 1.2.4.2 bouyer void *id_origbuf; /* pointer to orig buffer if
131 1.2.4.2 bouyer bouncing */
132 1.2.4.2 bouyer bus_size_t id_origbuflen; /* ...and size */
133 1.2.4.2 bouyer int id_buftype; /* type of buffer */
134 1.2.4.2 bouyer
135 1.2.4.2 bouyer void *id_bouncebuf; /* pointer to the bounce buffer */
136 1.2.4.2 bouyer bus_size_t id_bouncebuflen; /* ...and size */
137 1.2.4.2 bouyer int id_nbouncesegs; /* number of valid bounce segs */
138 1.2.4.2 bouyer bus_dma_segment_t id_bouncesegs[0]; /* array of bounce buffer
139 1.2.4.2 bouyer physical memory segments */
140 1.2.4.2 bouyer };
141 1.2.4.2 bouyer
142 1.2.4.2 bouyer /* id_flags */
143 1.2.4.2 bouyer #define ID_MIGHT_NEED_BOUNCE 0x01 /* map could need bounce buffers */
144 1.2.4.2 bouyer #define ID_HAS_BOUNCE 0x02 /* map currently has bounce buffers */
145 1.2.4.2 bouyer #define ID_IS_BOUNCING 0x04 /* map is bouncing current xfer */
146 1.2.4.2 bouyer
147 1.2.4.2 bouyer /* id_buftype */
148 1.2.4.2 bouyer #define ID_BUFTYPE_INVALID 0
149 1.2.4.2 bouyer #define ID_BUFTYPE_LINEAR 1
150 1.2.4.2 bouyer #define ID_BUFTYPE_MBUF 2
151 1.2.4.2 bouyer #define ID_BUFTYPE_UIO 3
152 1.2.4.2 bouyer #define ID_BUFTYPE_RAW 4
153 1.2.4.2 bouyer
154 1.2.4.2 bouyer /* bus space tags */
155 1.2.4.2 bouyer extern struct bus_space isa_io_bs_tag;
156 1.2.4.2 bouyer extern struct bus_space isa_mem_bs_tag;
157 1.2.4.2 bouyer
158 1.2.4.2 bouyer /* ISA chipset */
159 1.2.4.2 bouyer extern struct arm32_isa_chipset isa_chipset_tag;
160 1.2.4.2 bouyer
161 1.2.4.2 bouyer /* for pccons.c */
162 1.2.4.2 bouyer #define MONO_BASE 0x3B4
163 1.2.4.2 bouyer #define MONO_BUF 0x000B0000
164 1.2.4.2 bouyer #define CGA_BASE 0x3D4
165 1.2.4.2 bouyer #define CGA_BUF 0x000B8000
166 1.2.4.2 bouyer #define VGA_BUF 0xA0000
167 1.2.4.2 bouyer #define VGA_BUF_LEN (0xBFFFF - 0xA0000)
168 1.2.4.2 bouyer
169 1.2.4.2 bouyer void isa_init(vaddr_t, vaddr_t);
170 1.2.4.2 bouyer void isa_io_init(vaddr_t, vaddr_t);
171 1.2.4.2 bouyer void isa_dma_init(void);
172 1.2.4.2 bouyer vaddr_t isa_io_data_vaddr(void);
173 1.2.4.2 bouyer vaddr_t isa_mem_data_vaddr(void);
174 1.2.4.2 bouyer int isa_intr_alloc(isa_chipset_tag_t ic, int mask, int type, int *irq);
175 1.2.4.2 bouyer
176 1.2.4.2 bouyer /*
177 1.2.4.2 bouyer * Miscellanous functions.
178 1.2.4.2 bouyer */
179 1.2.4.2 bouyer void sysbeep(int, int); /* beep with the system speaker */
180 1.2.4.2 bouyer void isa_fillw(u_int val, void *addr, size_t len);
181 1.2.4.2 bouyer
182 1.2.4.2 bouyer #endif /* _ARM32_ISA_MACHDEP_H_ XXX */
183