footbridge_com_io.c revision 1.4
1/*	$NetBSD: footbridge_com_io.c,v 1.4 2002/09/27 15:35:44 provos 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
51bs_protos(fcomcons);
52bs_protos(generic);
53bs_protos(bs_notimpl);
54
55/* Declare the fcomcons bus space tag */
56
57struct bus_space fcomcons_bs_tag = {
58	/* cookie */
59	NULL,
60
61	/* mapping/unmapping */
62	fcomcons_bs_map,
63	fcomcons_bs_unmap,
64	fcomcons_bs_subregion,
65
66	/* allocation/deallocation */
67	fcomcons_bs_alloc,
68	fcomcons_bs_free,
69
70	/* get kernel virtual address */
71	0, /* never used */
72
73	/* Mmap bus space for user */
74	bs_notimpl_bs_mmap,
75
76	/* barrier */
77	fcomcons_bs_barrier,
78
79	/* read (single) */
80	bs_notimpl_bs_r_1,
81	bs_notimpl_bs_r_2,
82	generic_bs_r_4,
83	bs_notimpl_bs_r_8,
84
85	/* read multiple */
86	bs_notimpl_bs_rm_1,
87	bs_notimpl_bs_rm_2,
88	bs_notimpl_bs_rm_4,
89	bs_notimpl_bs_rm_8,
90
91	/* read region */
92	bs_notimpl_bs_rr_1,
93	bs_notimpl_bs_rr_2,
94	bs_notimpl_bs_rr_4,
95	bs_notimpl_bs_rr_8,
96
97	/* write (single) */
98	bs_notimpl_bs_w_1,
99	bs_notimpl_bs_w_2,
100	generic_bs_w_4,
101	bs_notimpl_bs_w_8,
102
103	/* write multiple */
104	bs_notimpl_bs_wm_1,
105	bs_notimpl_bs_wm_2,
106	bs_notimpl_bs_wm_4,
107	bs_notimpl_bs_wm_8,
108
109	/* write region */
110	bs_notimpl_bs_wr_1,
111	bs_notimpl_bs_wr_2,
112	bs_notimpl_bs_wr_4,
113	bs_notimpl_bs_wr_8,
114
115	bs_notimpl_bs_sm_1,
116	bs_notimpl_bs_sm_2,
117	bs_notimpl_bs_sm_4,
118	bs_notimpl_bs_sm_8,
119
120	/* set region */
121	bs_notimpl_bs_sr_1,
122	bs_notimpl_bs_sr_2,
123	bs_notimpl_bs_sr_4,
124	bs_notimpl_bs_sr_8,
125
126	/* copy */
127	bs_notimpl_bs_c_1,
128	bs_notimpl_bs_c_2,
129	bs_notimpl_bs_c_4,
130	bs_notimpl_bs_c_8,
131};
132
133/* bus space functions */
134
135int
136fcomcons_bs_map(t, bpa, size, cacheable, bshp)
137	void *t;
138	bus_addr_t bpa;
139	bus_size_t size;
140	int cacheable;
141	bus_space_handle_t *bshp;
142{
143	/*
144	 * Temporary implementation as all I/O is already mapped etc.
145	 *
146	 * Eventually this function will do the mapping check for multiple maps
147	 */
148	*bshp = bpa;
149	return(0);
150	}
151
152int
153fcomcons_bs_alloc(t, rstart, rend, size, alignment, boundary, cacheable,
154    bpap, bshp)
155	void *t;
156	bus_addr_t rstart, rend;
157	bus_size_t size, alignment, boundary;
158	int cacheable;
159	bus_addr_t *bpap;
160	bus_space_handle_t *bshp;
161{
162	panic("fcomcons_alloc(): Help!");
163}
164
165
166void
167fcomcons_bs_unmap(t, bsh, size)
168	void *t;
169	bus_space_handle_t bsh;
170	bus_size_t size;
171{
172	/*
173	 * Temporary implementation
174	 */
175}
176
177void
178fcomcons_bs_free(t, bsh, size)
179	void *t;
180	bus_space_handle_t bsh;
181	bus_size_t size;
182{
183
184	panic("fcomcons_free(): Help!");
185	/* fcomcons_unmap() does all that we need to do. */
186/*	fcomcons_unmap(t, bsh, size);*/
187}
188
189int
190fcomcons_bs_subregion(t, bsh, offset, size, nbshp)
191	void *t;
192	bus_space_handle_t bsh;
193	bus_size_t offset, size;
194	bus_space_handle_t *nbshp;
195{
196
197	*nbshp = bsh + offset;
198	return (0);
199}
200
201void
202fcomcons_bs_barrier(t, bsh, offset, len, flags)
203	void *t;
204	bus_space_handle_t bsh;
205	bus_size_t offset, len;
206	int flags;
207{
208}
209
210/* End of footbridge_com_io.c */
211