obio_space.c revision 1.1
1/*	$NetBSD: obio_space.c,v 1.1 2002/03/27 21:51:30 thorpej Exp $	*/
2
3/*
4 * Copyright (c) 2001 Wasabi Systems, Inc.
5 * All rights reserved.
6 *
7 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 *    notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 *    notice, this list of conditions and the following disclaimer in the
16 *    documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 *    must display the following acknowledgement:
19 *	This product includes software developed for the NetBSD Project by
20 *	Wasabi Systems, Inc.
21 * 4. The name of Wasabi Systems, Inc. may not be used to endorse
22 *    or promote products derived from this software without specific prior
23 *    written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38/*
39 * bus_space functions for IQ80321 on-board devices
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44
45#include <uvm/uvm_extern.h>
46
47#include <machine/bus.h>
48
49/* Prototypes for all the bus_space structure functions */
50bs_protos(obio);
51bs_protos(bs_notimpl);
52
53/*
54 * The obio bus space tag.  This is constant for all instances, so
55 * we never have to explicitly "create" it.
56 */
57struct bus_space obio_bs_tag = {
58	/* cookie */
59	(void *) 0,
60
61	/* mapping/unmapping */
62	obio_bs_map,
63	obio_bs_unmap,
64	obio_bs_subregion,
65
66	/* allocation/deallocation */
67	obio_bs_alloc,
68	obio_bs_free,
69
70	/* get kernel virtual address */
71	obio_bs_vaddr,
72
73	/* mmap */
74	bs_notimpl_bs_mmap,
75
76	/* barrier */
77	obio_bs_barrier,
78
79	/* read (single) */
80	obio_bs_r_1,
81	bs_notimpl_bs_r_2,
82	obio_bs_r_4,
83	bs_notimpl_bs_r_8,
84
85	/* read multiple */
86	obio_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	obio_bs_w_1,
99	bs_notimpl_bs_w_2,
100	obio_bs_w_4,
101	bs_notimpl_bs_w_8,
102
103	/* write multiple */
104	obio_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	/* set multiple */
116	bs_notimpl_bs_sm_1,
117	bs_notimpl_bs_sm_2,
118	bs_notimpl_bs_sm_4,
119	bs_notimpl_bs_sm_8,
120
121	/* set region */
122	bs_notimpl_bs_sr_1,
123	bs_notimpl_bs_sr_2,
124	bs_notimpl_bs_sr_4,
125	bs_notimpl_bs_sr_8,
126
127	/* copy */
128	bs_notimpl_bs_c_1,
129	bs_notimpl_bs_c_2,
130	bs_notimpl_bs_c_4,
131	bs_notimpl_bs_c_8,
132};
133
134int
135obio_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags,
136    bus_space_handle_t *bshp)
137{
138
139	/*
140	 * IQ80321 on-board devices are mapped VA==PA.  All addresses
141	 * we're provided, therefore, don't need any additional mapping.
142	 */
143	*bshp = bpa;
144
145	return 0;
146}
147
148int
149obio_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend, bus_size_t size,
150    bus_size_t alignment, bus_size_t boundary, int flags, bus_addr_t *bpap,
151    bus_space_handle_t *bshp)
152{
153
154	panic("obio_bs_alloc(): not implemented\n");
155}
156
157
158void
159obio_bs_unmap(void *t, bus_space_handle_t bsh, bus_size_t size)
160{
161
162	/* Nothing to do. */
163}
164
165void
166obio_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size)
167{
168
169	panic("obio_bs_free(): not implemented\n");
170}
171
172int
173obio_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,
174    bus_size_t size, bus_space_handle_t *nbshp)
175{
176
177	*nbshp = bsh + offset;
178	return (0);
179}
180
181void *
182obio_bs_vaddr(void *t, bus_space_handle_t bsh)
183{
184
185	return ((void *)bsh);
186}
187
188void
189obio_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset,
190    bus_size_t len, int flags)
191{
192
193	/* Nothing to do. */
194}
195