bus_space.c revision 248557
1/*- 2 * Copyright (C) 2012 FreeBSD Foundation 3 * All rights reserved. 4 * 5 * This software was developed by Oleksandr Tymoshenko under sponsorship 6 * from the FreeBSD Foundation. 7 * Portions of this software were developed by Oleksandr Rybalko 8 * under sponsorship from the FreeBSD Foundation. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. Neither the name of MARVELL nor the names of contributors 19 * may be used to endorse or promote products derived from this software 20 * without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR 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 32 * SUCH DAMAGE. 33 */ 34 35#include <sys/cdefs.h> 36__FBSDID("$FreeBSD: head/sys/arm/freescale/imx/bus_space.c 248557 2013-03-20 15:39:27Z ray $"); 37 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/bus.h> 41#include <sys/kernel.h> 42#include <sys/malloc.h> 43 44#include <machine/bus.h> 45 46/* Prototypes for all the bus_space structure functions */ 47bs_protos(generic); 48bs_protos(generic_armv4); 49 50struct bus_space _base_tag = { 51 /* cookie */ 52 .bs_cookie = (void *) 0, 53 54 /* mapping/unmapping */ 55 .bs_map = generic_bs_map, 56 .bs_unmap = generic_bs_unmap, 57 .bs_subregion = generic_bs_subregion, 58 59 /* allocation/deallocation */ 60 .bs_alloc = generic_bs_alloc, 61 .bs_free = generic_bs_free, 62 63 /* barrier */ 64 .bs_barrier = generic_bs_barrier, 65 66 /* read (single) */ 67 .bs_r_1 = generic_bs_r_1, 68 .bs_r_2 = generic_armv4_bs_r_2, 69 .bs_r_4 = generic_bs_r_4, 70 .bs_r_8 = NULL, 71 72 /* read multiple */ 73 .bs_rm_1 = generic_bs_rm_1, 74 .bs_rm_2 = generic_armv4_bs_rm_2, 75 .bs_rm_4 = generic_bs_rm_4, 76 .bs_rm_8 = NULL, 77 78 /* read region */ 79 .bs_rr_1 = generic_bs_rr_1, 80 .bs_rr_2 = generic_armv4_bs_rr_2, 81 .bs_rr_4 = generic_bs_rr_4, 82 .bs_rr_8 = NULL, 83 84 /* write (single) */ 85 .bs_w_1 = generic_bs_w_1, 86 .bs_w_2 = generic_armv4_bs_w_2, 87 .bs_w_4 = generic_bs_w_4, 88 .bs_w_8 = NULL, 89 90 /* write multiple */ 91 .bs_wm_1 = generic_bs_wm_1, 92 .bs_wm_2 = generic_armv4_bs_wm_2, 93 .bs_wm_4 = generic_bs_wm_4, 94 .bs_wm_8 = NULL, 95 96 /* write region */ 97 .bs_wr_1 = generic_bs_wr_1, 98 .bs_wr_2 = generic_armv4_bs_wr_2, 99 .bs_wr_4 = generic_bs_wr_4, 100 .bs_wr_8 = NULL, 101 102 /* read multiple stream */ 103 .bs_rm_1_s = generic_bs_rm_1, 104 .bs_rm_2_s = generic_armv4_bs_rm_2, 105 .bs_rm_4_s = generic_bs_rm_4, 106 .bs_rm_8_s = NULL, 107 108 /* write multiple stream */ 109 .bs_wm_1_s = generic_bs_wm_1, 110 .bs_wm_2_s = generic_armv4_bs_wm_2, 111 .bs_wm_4_s = generic_bs_wm_4, 112 .bs_wm_8_s = NULL, 113 114 /* set multiple */ 115 /* XXX not implemented */ 116 117 /* set region */ 118 .bs_sr_1 = NULL, 119 .bs_sr_2 = generic_armv4_bs_sr_2, 120 .bs_sr_4 = generic_bs_sr_4, 121 .bs_sr_8 = NULL, 122 123 /* copy */ 124 .bs_c_1 = NULL, 125 .bs_c_2 = generic_armv4_bs_c_2, 126 .bs_c_4 = NULL, 127 .bs_c_8 = NULL, 128}; 129 130bus_space_tag_t fdtbus_bs_tag = &_base_tag; 131