1 /* $NetBSD: mainbus_io.c,v 1.13 2003/07/15 00:24:47 lukem Exp $ */
4 * Copyright (c) 1997 Mark Brinicombe.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Mark Brinicombe.
18 * 4. The name of the company nor the name of the author may be used to
19 * endorse or promote products derived from this software without specific
20 * prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
26 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * bus_space I/O functions for mainbus
39 #include <sys/cdefs.h>
40 __FBSDID("$FreeBSD$");
42 #include <sys/param.h>
43 #include <sys/systm.h>
44 #include <sys/queue.h>
47 #include <sys/mutex.h>
50 #include <vm/vm_extern.h>
53 #include <machine/bus.h>
54 #include <machine/pmap.h>
56 /* Proto types for all the bus_space structure functions */
59 /* Declare the mainbus bus space tag */
61 struct bus_space mainbus_bs_tag = {
65 /* mapping/unmapping */
70 /* allocation/deallocation */
131 /* bus space functions */
134 nexus_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int cacheable,
135 bus_space_handle_t *bshp)
141 nexus_bs_alloc(t, rstart, rend, size, alignment, boundary, cacheable,
144 bus_addr_t rstart, rend;
145 bus_size_t size, alignment, boundary;
148 bus_space_handle_t *bshp;
150 panic("mainbus_bs_alloc(): Help!");
155 nexus_bs_unmap(void *t, bus_space_handle_t h, bus_size_t size)
158 * Temporary implementation
163 nexus_bs_free(t, bsh, size)
165 bus_space_handle_t bsh;
169 panic("mainbus_bs_free(): Help!");
170 /* mainbus_bs_unmap() does all that we need to do. */
171 /* mainbus_bs_unmap(t, bsh, size);*/
175 nexus_bs_subregion(t, bsh, offset, size, nbshp)
177 bus_space_handle_t bsh;
178 bus_size_t offset, size;
179 bus_space_handle_t *nbshp;
182 *nbshp = bsh + offset;
187 nexus_bs_mmap(struct cdev *dev, vm_offset_t off, vm_paddr_t *addr, int prot)
194 nexus_bs_barrier(t, bsh, offset, len, flags)
196 bus_space_handle_t bsh;
197 bus_size_t offset, len;
202 /* End of mainbus_io.c */