footbridge_com_io.c revision 1.2 1 /* $NetBSD: footbridge_com_io.c,v 1.2 2001/09/10 23:05:19 chris Exp $ */
2
3 /*
4 * Copyright (c) 1997 Mark Brinicombe.
5 * Copyright (c) 1997 Causality Limited.
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 Mark Brinicombe
19 * for the NetBSD Project.
20 * 4. The name of the company nor the name of the author may be used to
21 * endorse or promote products derived from this software without specific
22 * prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
25 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27 * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
28 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */
36
37 /*
38 * This file provides the bus space tag for the footbridge serial console
39 */
40
41 /*
42 * bus_space I/O functions for mainbus
43 */
44
45 #include <sys/param.h>
46 #include <sys/systm.h>
47 #include <machine/bus.h>
48
49 /* Proto types for all the bus_space structure functions */
50
51 bs_protos(fcomcons);
52 bs_protos(bs_notimpl);
53
54 /* Declare the fcomcons bus space tag */
55
56 struct bus_space fcomcons_bs_tag = {
57 /* cookie */
58 NULL,
59
60 /* mapping/unmapping */
61 fcomcons_bs_map,
62 fcomcons_bs_unmap,
63 fcomcons_bs_subregion,
64
65 /* allocation/deallocation */
66 fcomcons_bs_alloc,
67 fcomcons_bs_free,
68
69 /* get kernel virtual address */
70 0, /* never used */
71
72 /* Mmap bus space for user */
73 bs_notimpl_bs_mmap,
74
75 /* barrier */
76 fcomcons_bs_barrier,
77
78 /* read (single) */
79 bs_notimpl_bs_r_1,
80 bs_notimpl_bs_r_2,
81 fcomcons_bs_r_4,
82 bs_notimpl_bs_r_8,
83
84 /* read multiple */
85 bs_notimpl_bs_rm_1,
86 bs_notimpl_bs_rm_2,
87 bs_notimpl_bs_rm_4,
88 bs_notimpl_bs_rm_8,
89
90 /* read region */
91 bs_notimpl_bs_rr_1,
92 bs_notimpl_bs_rr_2,
93 bs_notimpl_bs_rr_4,
94 bs_notimpl_bs_rr_8,
95
96 /* write (single) */
97 bs_notimpl_bs_w_1,
98 bs_notimpl_bs_w_2,
99 fcomcons_bs_w_4,
100 bs_notimpl_bs_w_8,
101
102 /* write multiple */
103 bs_notimpl_bs_wm_1,
104 bs_notimpl_bs_wm_2,
105 bs_notimpl_bs_wm_4,
106 bs_notimpl_bs_wm_8,
107
108 /* write region */
109 bs_notimpl_bs_wr_1,
110 bs_notimpl_bs_wr_2,
111 bs_notimpl_bs_wr_4,
112 bs_notimpl_bs_wr_8,
113
114 bs_notimpl_bs_sm_1,
115 bs_notimpl_bs_sm_2,
116 bs_notimpl_bs_sm_4,
117 bs_notimpl_bs_sm_8,
118
119 /* set region */
120 bs_notimpl_bs_sr_1,
121 bs_notimpl_bs_sr_2,
122 bs_notimpl_bs_sr_4,
123 bs_notimpl_bs_sr_8,
124
125 /* copy */
126 bs_notimpl_bs_c_1,
127 bs_notimpl_bs_c_2,
128 bs_notimpl_bs_c_4,
129 bs_notimpl_bs_c_8,
130 };
131
132 /* bus space functions */
133
134 int
135 fcomcons_bs_map(t, bpa, size, cacheable, bshp)
136 void *t;
137 bus_addr_t bpa;
138 bus_size_t size;
139 int cacheable;
140 bus_space_handle_t *bshp;
141 {
142 /*
143 * Temporary implementation as all I/O is already mapped etc.
144 *
145 * Eventually this function will do the mapping check for multiple maps
146 */
147 *bshp = bpa;
148 return(0);
149 }
150
151 int
152 fcomcons_bs_alloc(t, rstart, rend, size, alignment, boundary, cacheable,
153 bpap, bshp)
154 void *t;
155 bus_addr_t rstart, rend;
156 bus_size_t size, alignment, boundary;
157 int cacheable;
158 bus_addr_t *bpap;
159 bus_space_handle_t *bshp;
160 {
161 panic("fcomcons_alloc(): Help!\n");
162 }
163
164
165 void
166 fcomcons_bs_unmap(t, bsh, size)
167 void *t;
168 bus_space_handle_t bsh;
169 bus_size_t size;
170 {
171 /*
172 * Temporary implementation
173 */
174 }
175
176 void
177 fcomcons_bs_free(t, bsh, size)
178 void *t;
179 bus_space_handle_t bsh;
180 bus_size_t size;
181 {
182
183 panic("fcomcons_free(): Help!\n");
184 /* fcomcons_unmap() does all that we need to do. */
185 /* fcomcons_unmap(t, bsh, size);*/
186 }
187
188 int
189 fcomcons_bs_subregion(t, bsh, offset, size, nbshp)
190 void *t;
191 bus_space_handle_t bsh;
192 bus_size_t offset, size;
193 bus_space_handle_t *nbshp;
194 {
195
196 *nbshp = bsh + offset;
197 return (0);
198 }
199
200 void
201 fcomcons_bs_barrier(t, bsh, offset, len, flags)
202 void *t;
203 bus_space_handle_t bsh;
204 bus_size_t offset, len;
205 int flags;
206 {
207 }
208
209 /* End of footbridge_com_io.c */
210