1 /* $NetBSD: bus_space.c,v 1.2 2000/01/10 03:24:36 simonb Exp $ */ 2 3 /*- 4 * Copyright (c) 1998 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 9 * NASA Ames Research Center. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the distribution. 19 * 3. All advertising materials mentioning features or use of this software 20 * must display the following acknowledgement: 21 * This product includes software developed by the NetBSD 22 * Foundation, Inc. and its contributors. 23 * 4. Neither the name of The NetBSD Foundation nor the names of its 24 * contributors may be used to endorse or promote products derived 25 * from this software without specific prior written permission. 26 * 27 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 28 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 29 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 30 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 31 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 37 * POSSIBILITY OF SUCH DAMAGE. 38 */ 39 40 /* 41 * Implementation of bus_space mapping for the DECstation. 42 */ 43 44 #include <sys/param.h> 45 #include <sys/systm.h> 46 47 #include <machine/bus.h> 48 49 /* ARGSUSED */ 50 int 51 bus_space_map(t, bpa, size, flags, bshp) 52 bus_space_tag_t t; 53 bus_addr_t bpa; 54 bus_size_t size; 55 int flags; 56 bus_space_handle_t *bshp; 57 { 58 int cacheable = flags & BUS_SPACE_MAP_CACHEABLE; 59 60 /* Mappings on the DECstation are always linear. */ 61 if (cacheable) 62 *bshp = MIPS_PHYS_TO_KSEG0(bpa); 63 else 64 *bshp = MIPS_PHYS_TO_KSEG1(bpa); 65 return (0); 66 } 67 68 /* ARGSUSED */ 69 int 70 bus_space_alloc(t, rstart, rend, size, alignment, boundary, flags, 71 bpap, bshp) 72 bus_space_tag_t t; 73 bus_addr_t rstart, rend; 74 bus_size_t size, alignment, boundary; 75 int flags; 76 bus_addr_t *bpap; 77 bus_space_handle_t *bshp; 78 { 79 80 /* 81 * Not meaningful on any currently-supported DECstation bus. 82 */ 83 return (EINVAL); 84 } 85 86 /* ARGSUSED */ 87 void 88 bus_space_free(t, bsh, size) 89 bus_space_tag_t t; 90 bus_space_handle_t bsh; 91 bus_size_t size; 92 { 93 94 /* 95 * Not meaningful on any currently-supported DECstation bus. 96 */ 97 panic("bus_space_free: shouldn't be here"); 98 } 99 100 void 101 bus_space_unmap(t, bsh, size) 102 bus_space_tag_t t; 103 bus_space_handle_t bsh; 104 bus_size_t size; 105 { 106 107 /* Nothing to do. */ 108 } 109 110 /* ARGSUSED */ 111 int 112 bus_space_subregion(t, bsh, offset, size, nbshp) 113 bus_space_tag_t t; 114 bus_space_handle_t bsh; 115 bus_size_t offset, size; 116 bus_space_handle_t *nbshp; 117 { 118 119 *nbshp = bsh + offset; 120 return (0); 121 } 122