1239280Sgonzo/*-
2239280Sgonzo * Copyright (c) 2012 Damjan Marion <damjan.marion@gmail.com>
3239280Sgonzo * All rights reserved.
4239280Sgonzo *
5239280Sgonzo * Redistribution and use in source and binary forms, with or without
6239280Sgonzo * modification, are permitted provided that the following conditions
7239280Sgonzo * are met:
8239280Sgonzo * 1. Redistributions of source code must retain the above copyright
9239280Sgonzo *    notice, this list of conditions and the following disclaimer.
10239280Sgonzo * 2. Redistributions in binary form must reproduce the above copyright
11239280Sgonzo *    notice, this list of conditions and the following disclaimer in the
12239280Sgonzo *    documentation and/or other materials provided with the distribution.
13239280Sgonzo *
14239280Sgonzo * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15239280Sgonzo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16239280Sgonzo * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17239280Sgonzo * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18239280Sgonzo * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19239280Sgonzo * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20239280Sgonzo * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21239280Sgonzo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22239280Sgonzo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23239280Sgonzo * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24239280Sgonzo * SUCH DAMAGE.
25239280Sgonzo */
26239280Sgonzo
27239280Sgonzo#include <sys/cdefs.h>
28239280Sgonzo__FBSDID("$FreeBSD$");
29239280Sgonzo
30239280Sgonzo#include <sys/param.h>
31239280Sgonzo#include <sys/systm.h>
32239280Sgonzo#include <sys/bus.h>
33239280Sgonzo#include <sys/kernel.h>
34239280Sgonzo#include <sys/malloc.h>
35239280Sgonzo
36239280Sgonzo#include <machine/bus.h>
37239280Sgonzo
38239280Sgonzo/* Prototypes for all the bus_space structure functions */
39239280Sgonzobs_protos(generic);
40239280Sgonzobs_protos(generic_armv4);
41239280Sgonzo
42239280Sgonzo/*
43239280Sgonzo * The bus space tag.  This is constant for all instances, so
44239280Sgonzo * we never have to explicitly "create" it.
45239280Sgonzo */
46239280Sgonzostatic struct bus_space _base_tag = {
47239280Sgonzo	/* cookie */
48239280Sgonzo	(void *) 0,
49239280Sgonzo
50239280Sgonzo	/* mapping/unmapping */
51239280Sgonzo	generic_bs_map,
52239280Sgonzo	generic_bs_unmap,
53239280Sgonzo	generic_bs_subregion,
54239280Sgonzo
55239280Sgonzo	/* allocation/deallocation */
56239280Sgonzo	generic_bs_alloc,
57239280Sgonzo	generic_bs_free,
58239280Sgonzo
59239280Sgonzo	/* barrier */
60239280Sgonzo	generic_bs_barrier,
61239280Sgonzo
62239280Sgonzo	/* read (single) */
63239280Sgonzo	generic_bs_r_1,
64239280Sgonzo	generic_armv4_bs_r_2,
65239280Sgonzo	generic_bs_r_4,
66239280Sgonzo	NULL,
67239280Sgonzo
68239280Sgonzo	/* read multiple */
69239280Sgonzo	generic_bs_rm_1,
70239280Sgonzo	generic_armv4_bs_rm_2,
71239280Sgonzo	generic_bs_rm_4,
72239280Sgonzo	NULL,
73239280Sgonzo
74239280Sgonzo	/* read region */
75239280Sgonzo	generic_bs_rr_1,
76239280Sgonzo	generic_armv4_bs_rr_2,
77239280Sgonzo	generic_bs_rr_4,
78239280Sgonzo	NULL,
79239280Sgonzo
80239280Sgonzo	/* write (single) */
81239280Sgonzo	generic_bs_w_1,
82239280Sgonzo	generic_armv4_bs_w_2,
83239280Sgonzo	generic_bs_w_4,
84239280Sgonzo	NULL,
85239280Sgonzo
86239280Sgonzo	/* write multiple */
87239280Sgonzo	generic_bs_wm_1,
88239280Sgonzo	generic_armv4_bs_wm_2,
89239280Sgonzo	generic_bs_wm_4,
90239280Sgonzo	NULL,
91239280Sgonzo
92239280Sgonzo	/* write region */
93239280Sgonzo	NULL,
94239280Sgonzo	NULL,
95239280Sgonzo	NULL,
96239280Sgonzo	NULL,
97239280Sgonzo
98239280Sgonzo	/* set multiple */
99239280Sgonzo	NULL,
100239280Sgonzo	NULL,
101239280Sgonzo	NULL,
102239280Sgonzo	NULL,
103239280Sgonzo
104239280Sgonzo	/* set region */
105239280Sgonzo	NULL,
106239280Sgonzo	NULL,
107239280Sgonzo	NULL,
108239280Sgonzo	NULL,
109239280Sgonzo
110239280Sgonzo	/* copy */
111239280Sgonzo	NULL,
112239280Sgonzo	NULL,
113239280Sgonzo	NULL,
114239280Sgonzo	NULL,
115239280Sgonzo
116239280Sgonzo	/* read stream (single) */
117239280Sgonzo	NULL,
118239280Sgonzo	NULL,
119239280Sgonzo	NULL,
120239280Sgonzo	NULL,
121239280Sgonzo
122239280Sgonzo	/* read multiple stream */
123239280Sgonzo	NULL,
124239280Sgonzo	generic_armv4_bs_rm_2,		/* bus_space_read_multi_stream_2 */
125239280Sgonzo	NULL,
126239280Sgonzo	NULL,
127239280Sgonzo
128239280Sgonzo	/* read region stream */
129239280Sgonzo	NULL,
130239280Sgonzo	NULL,
131239280Sgonzo	NULL,
132239280Sgonzo	NULL,
133239280Sgonzo
134239280Sgonzo	/* write stream (single) */
135239280Sgonzo	NULL,
136239280Sgonzo	NULL,
137239280Sgonzo	NULL,
138239280Sgonzo	NULL,
139239280Sgonzo
140239280Sgonzo	/* write multiple stream */
141239280Sgonzo	NULL,
142239280Sgonzo	generic_armv4_bs_wm_2,		/* bus_space_write_multi_stream_2 */
143239280Sgonzo	NULL,
144239280Sgonzo	NULL,
145239280Sgonzo
146239280Sgonzo	/* write region stream */
147239280Sgonzo	NULL,
148239280Sgonzo	NULL,
149239280Sgonzo	NULL,
150239280Sgonzo	NULL
151239280Sgonzo};
152239280Sgonzo
153239280Sgonzobus_space_tag_t fdtbus_bs_tag = &_base_tag;
154