1245450Sganbold/*-
2245455Sganbold * Copyright (C) 2012 FreeBSD Foundation
3245450Sganbold * All rights reserved.
4245450Sganbold *
5245450Sganbold * Redistribution and use in source and binary forms, with or without
6245450Sganbold * modification, are permitted provided that the following conditions
7245450Sganbold * are met:
8245450Sganbold * 1. Redistributions of source code must retain the above copyright
9245450Sganbold *    notice, this list of conditions and the following disclaimer.
10245450Sganbold * 2. Redistributions in binary form must reproduce the above copyright
11245450Sganbold *    notice, this list of conditions and the following disclaimer in the
12245450Sganbold *    documentation and/or other materials provided with the distribution.
13245455Sganbold * 3. Neither the name of MARVELL nor the names of contributors
14245455Sganbold *    may be used to endorse or promote products derived from this software
15245455Sganbold *    without specific prior written permission.
16245450Sganbold *
17245455Sganbold * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18245450Sganbold * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19245450Sganbold * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20245455Sganbold * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
21245450Sganbold * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22245450Sganbold * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23245450Sganbold * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24245450Sganbold * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25245450Sganbold * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26245450Sganbold * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27245450Sganbold * SUCH DAMAGE.
28245450Sganbold */
29245450Sganbold
30245450Sganbold#include <sys/cdefs.h>
31245450Sganbold__FBSDID("$FreeBSD$");
32245450Sganbold
33245450Sganbold#include <sys/param.h>
34245450Sganbold#include <sys/systm.h>
35245450Sganbold#include <sys/bus.h>
36245450Sganbold#include <sys/kernel.h>
37245450Sganbold#include <sys/malloc.h>
38245450Sganbold
39245450Sganbold#include <machine/bus.h>
40245450Sganbold
41245450Sganbold/* Prototypes for all the bus_space structure functions */
42245450Sganboldbs_protos(generic);
43245450Sganboldbs_protos(generic_armv4);
44245450Sganbold
45245450Sganboldstruct bus_space _base_tag = {
46245450Sganbold	/* cookie */
47245450Sganbold	.bs_cookie	= (void *) 0,
48245450Sganbold
49245450Sganbold	/* mapping/unmapping */
50245450Sganbold	.bs_map		= generic_bs_map,
51245450Sganbold	.bs_unmap	= generic_bs_unmap,
52245450Sganbold	.bs_subregion	= generic_bs_subregion,
53245450Sganbold
54245450Sganbold	/* allocation/deallocation */
55245450Sganbold	.bs_alloc	= generic_bs_alloc,
56245450Sganbold	.bs_free	= generic_bs_free,
57245450Sganbold
58245450Sganbold	/* barrier */
59245450Sganbold	.bs_barrier	= generic_bs_barrier,
60245450Sganbold
61245450Sganbold	/* read (single) */
62245450Sganbold	.bs_r_1		= generic_bs_r_1,
63245450Sganbold	.bs_r_2		= generic_armv4_bs_r_2,
64245450Sganbold	.bs_r_4		= generic_bs_r_4,
65245450Sganbold	.bs_r_8		= NULL,
66245450Sganbold
67245450Sganbold	/* read multiple */
68245450Sganbold	.bs_rm_1	= generic_bs_rm_1,
69245450Sganbold	.bs_rm_2	= generic_armv4_bs_rm_2,
70245450Sganbold	.bs_rm_4	= generic_bs_rm_4,
71245450Sganbold	.bs_rm_8	= NULL,
72245450Sganbold
73245450Sganbold	/* read region */
74245450Sganbold	.bs_rr_1	= generic_bs_rr_1,
75245450Sganbold	.bs_rr_2	= generic_armv4_bs_rr_2,
76245450Sganbold	.bs_rr_4	= generic_bs_rr_4,
77245450Sganbold	.bs_rr_8	= NULL,
78245450Sganbold
79245450Sganbold	/* write (single) */
80245450Sganbold	.bs_w_1		= generic_bs_w_1,
81245450Sganbold	.bs_w_2		= generic_armv4_bs_w_2,
82245450Sganbold	.bs_w_4		= generic_bs_w_4,
83245450Sganbold	.bs_w_8		= NULL,
84245450Sganbold
85245450Sganbold	/* write multiple */
86245450Sganbold	.bs_wm_1	= generic_bs_wm_1,
87245450Sganbold	.bs_wm_2	= generic_armv4_bs_wm_2,
88245450Sganbold	.bs_wm_4	= generic_bs_wm_4,
89245450Sganbold	.bs_wm_8	= NULL,
90245450Sganbold
91245450Sganbold	/* write region */
92245450Sganbold	.bs_wr_1	= generic_bs_wr_1,
93245450Sganbold	.bs_wr_2	= generic_armv4_bs_wr_2,
94245450Sganbold	.bs_wr_4	= generic_bs_wr_4,
95245450Sganbold	.bs_wr_8	= NULL,
96245450Sganbold
97245450Sganbold	/* set multiple */
98245450Sganbold	/* XXX not implemented */
99245450Sganbold
100245450Sganbold	/* set region */
101245450Sganbold	.bs_sr_1	= NULL,
102245450Sganbold	.bs_sr_2	= generic_armv4_bs_sr_2,
103245450Sganbold	.bs_sr_4	= generic_bs_sr_4,
104245450Sganbold	.bs_sr_8	= NULL,
105245450Sganbold
106245450Sganbold	/* copy */
107245450Sganbold	.bs_c_1		= NULL,
108245450Sganbold	.bs_c_2		= generic_armv4_bs_c_2,
109245450Sganbold	.bs_c_4		= NULL,
110245450Sganbold	.bs_c_8		= NULL,
111245450Sganbold};
112245450Sganbold
113245450Sganboldbus_space_tag_t fdtbus_bs_tag = &_base_tag;
114