1257738Sray/*- 2259202Sjhb * Copyright (C) 2008 MARVELL INTERNATIONAL LTD. 3257738Sray * All rights reserved. 4257738Sray * 5259202Sjhb * Developed by Semihalf. 6259202Sjhb * 7257738Sray * Redistribution and use in source and binary forms, with or without 8257738Sray * modification, are permitted provided that the following conditions 9257738Sray * are met: 10257738Sray * 1. Redistributions of source code must retain the above copyright 11257738Sray * notice, this list of conditions and the following disclaimer. 12257738Sray * 2. Redistributions in binary form must reproduce the above copyright 13257738Sray * notice, this list of conditions and the following disclaimer in the 14257738Sray * documentation and/or other materials provided with the distribution. 15259202Sjhb * 3. Neither the name of MARVELL nor the names of contributors 16259202Sjhb * may be used to endorse or promote products derived from this software 17259202Sjhb * without specific prior written permission. 18257738Sray * 19259202Sjhb * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 20257738Sray * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21257738Sray * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22259202Sjhb * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 23257738Sray * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24257738Sray * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25257738Sray * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26257738Sray * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27257738Sray * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28257738Sray * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29257738Sray * SUCH DAMAGE. 30257738Sray */ 31257738Sray 32257738Sray#include <sys/cdefs.h> 33257738Sray__FBSDID("$FreeBSD$"); 34257738Sray 35257738Sray#include <sys/param.h> 36257738Sray#include <sys/systm.h> 37257738Sray#include <machine/bus.h> 38257738Sray 39277472Sian#include "opt_platform.h" 40277472Sian 41257738Sray/* Prototypes for all the bus_space structure functions */ 42257738Sraybs_protos(generic); 43257738Sray 44257738Sray/* 45257738Sray * The bus space tag. This is constant for all instances, so 46257738Sray * we never have to explicitly "create" it. 47257738Sray */ 48277516Sianstatic struct bus_space arm_base_bus_space __aligned(CACHE_LINE_SIZE) = { 49277465Sian /* privdata is whatever the implementer wants; unused in base tag */ 50277465Sian .bs_privdata = NULL, 51257738Sray 52257738Sray /* mapping/unmapping */ 53277465Sian .bs_map = generic_bs_map, 54277465Sian .bs_unmap = generic_bs_unmap, 55277465Sian .bs_subregion = generic_bs_subregion, 56257738Sray 57257738Sray /* allocation/deallocation */ 58277465Sian .bs_alloc = generic_bs_alloc, 59277465Sian .bs_free = generic_bs_free, 60257738Sray 61257738Sray /* barrier */ 62277465Sian .bs_barrier = generic_bs_barrier, 63257738Sray 64257738Sray /* read (single) */ 65277465Sian .bs_r_1 = NULL, /* Use inline code in bus.h */ 66277465Sian .bs_r_2 = NULL, /* Use inline code in bus.h */ 67277465Sian .bs_r_4 = NULL, /* Use inline code in bus.h */ 68277465Sian .bs_r_8 = NULL, /* Use inline code in bus.h */ 69257738Sray 70257738Sray /* read multiple */ 71277465Sian .bs_rm_1 = generic_bs_rm_1, 72277467Sian .bs_rm_2 = generic_bs_rm_2, 73277465Sian .bs_rm_4 = generic_bs_rm_4, 74277465Sian .bs_rm_8 = BS_UNIMPLEMENTED, 75257738Sray 76257738Sray /* read region */ 77277465Sian .bs_rr_1 = generic_bs_rr_1, 78277467Sian .bs_rr_2 = generic_bs_rr_2, 79277465Sian .bs_rr_4 = generic_bs_rr_4, 80277465Sian .bs_rr_8 = BS_UNIMPLEMENTED, 81257738Sray 82257738Sray /* write (single) */ 83277465Sian .bs_w_1 = NULL, /* Use inline code in bus.h */ 84277465Sian .bs_w_2 = NULL, /* Use inline code in bus.h */ 85277465Sian .bs_w_4 = NULL, /* Use inline code in bus.h */ 86277465Sian .bs_w_8 = NULL, /* Use inline code in bus.h */ 87257738Sray 88257738Sray /* write multiple */ 89277465Sian .bs_wm_1 = generic_bs_wm_1, 90277467Sian .bs_wm_2 = generic_bs_wm_2, 91277465Sian .bs_wm_4 = generic_bs_wm_4, 92277465Sian .bs_wm_8 = BS_UNIMPLEMENTED, 93257738Sray 94257738Sray /* write region */ 95277465Sian .bs_wr_1 = generic_bs_wr_1, 96277467Sian .bs_wr_2 = generic_bs_wr_2, 97277465Sian .bs_wr_4 = generic_bs_wr_4, 98277465Sian .bs_wr_8 = BS_UNIMPLEMENTED, 99257738Sray 100257738Sray /* set multiple */ 101277465Sian .bs_sm_1 = BS_UNIMPLEMENTED, 102277465Sian .bs_sm_2 = BS_UNIMPLEMENTED, 103277465Sian .bs_sm_4 = BS_UNIMPLEMENTED, 104277465Sian .bs_sm_8 = BS_UNIMPLEMENTED, 105257738Sray 106257738Sray /* set region */ 107277465Sian .bs_sr_1 = generic_bs_sr_1, 108277467Sian .bs_sr_2 = generic_bs_sr_2, 109277465Sian .bs_sr_4 = generic_bs_sr_4, 110277465Sian .bs_sr_8 = BS_UNIMPLEMENTED, 111257738Sray 112257738Sray /* copy */ 113277465Sian .bs_c_1 = BS_UNIMPLEMENTED, 114277467Sian .bs_c_2 = generic_bs_c_2, 115277465Sian .bs_c_4 = BS_UNIMPLEMENTED, 116277465Sian .bs_c_8 = BS_UNIMPLEMENTED, 117257738Sray 118257738Sray /* read stream (single) */ 119283366Sandrew .bs_r_1_s = NULL, /* Use inline code in bus.h */ 120283366Sandrew .bs_r_2_s = NULL, /* Use inline code in bus.h */ 121283366Sandrew .bs_r_4_s = NULL, /* Use inline code in bus.h */ 122283366Sandrew .bs_r_8_s = NULL, /* Use inline code in bus.h */ 123257738Sray 124257738Sray /* read multiple stream */ 125277465Sian .bs_rm_1_s = generic_bs_rm_1, 126277467Sian .bs_rm_2_s = generic_bs_rm_2, 127277465Sian .bs_rm_4_s = generic_bs_rm_4, 128277465Sian .bs_rm_8_s = BS_UNIMPLEMENTED, 129257738Sray 130257738Sray /* read region stream */ 131277465Sian .bs_rr_1_s = generic_bs_rr_1, 132277467Sian .bs_rr_2_s = generic_bs_rr_2, 133277465Sian .bs_rr_4_s = generic_bs_rr_4, 134277465Sian .bs_rr_8_s = BS_UNIMPLEMENTED, 135257738Sray 136257738Sray /* write stream (single) */ 137283366Sandrew .bs_w_1_s = NULL, /* Use inline code in bus.h */ 138283366Sandrew .bs_w_2_s = NULL, /* Use inline code in bus.h */ 139283366Sandrew .bs_w_4_s = NULL, /* Use inline code in bus.h */ 140283366Sandrew .bs_w_8_s = NULL, /* Use inline code in bus.h */ 141257738Sray 142257738Sray /* write multiple stream */ 143277465Sian .bs_wm_1_s = generic_bs_wm_1, 144277467Sian .bs_wm_2_s = generic_bs_wm_2, 145277465Sian .bs_wm_4_s = generic_bs_wm_4, 146277465Sian .bs_wm_8_s = BS_UNIMPLEMENTED, 147257738Sray 148257738Sray /* write region stream */ 149277465Sian .bs_wr_1_s = generic_bs_wr_1, 150277467Sian .bs_wr_2_s = generic_bs_wr_2, 151277466Sian .bs_wr_4_s = generic_bs_wr_4, 152277465Sian .bs_wr_8_s = BS_UNIMPLEMENTED, 153277516Sian}; 154257738Sray 155277472Sian#ifdef FDT 156277473Sianbus_space_tag_t fdtbus_bs_tag = &arm_base_bus_space; 157277472Sian#endif 158277473Sian 159291131Sandrew#if __ARM_ARCH < 6 160277473Sianbus_space_tag_t arm_base_bs_tag = &arm_base_bus_space; 161291131Sandrew#endif 162