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