source: rtems-libbsd/rtemsbsd/include/machine/bus.h @ 57bfdf7

4.1155-freebsd-126-freebsd-12freebsd-9.3
Last change on this file since 57bfdf7 was e2ab984, checked in by Sebastian Huber <sebastian.huber@…>, on 11/15/13 at 14:21:45

machine/bus.h: Support for PowerPC

  • Property mode set to 100644
File size: 8.2 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup rtems_bsd_machine
5 *
6 * @brief TODO.
7 *
8 * File origin from FreeBSD 'sys/amd64/include/bus.h'.
9 */
10
11/*-
12 * Copyright (c) 2009, 2010 embedded brains GmbH.  All rights reserved.
13 *
14 *  embedded brains GmbH
15 *  Obere Lagerstr. 30
16 *  82178 Puchheim
17 *  Germany
18 *  <rtems@embedded-brains.de>
19 *
20 * Copyright (c) KATO Takenori, 1999.
21 *
22 * All rights reserved.  Unpublished rights reserved under the copyright
23 * laws of Japan.
24 *
25 * Redistribution and use in source and binary forms, with or without
26 * modification, are permitted provided that the following conditions
27 * are met:
28 *
29 * 1. Redistributions of source code must retain the above copyright
30 *    notice, this list of conditions and the following disclaimer as
31 *    the first lines of this file unmodified.
32 * 2. Redistributions in binary form must reproduce the above copyright
33 *    notice, this list of conditions and the following disclaimer in the
34 *    documentation and/or other materials provided with the distribution.
35 * 3. The name of the author may not be used to endorse or promote products
36 *    derived from this software without specific prior written permission.
37 *
38 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
39 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
40 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
41 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
42 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
43 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
44 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
45 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
46 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
47 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48 */
49
50/*-
51 * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
52 * All rights reserved.
53 *
54 * This code is derived from software contributed to The NetBSD Foundation
55 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
56 * NASA Ames Research Center.
57 *
58 * Redistribution and use in source and binary forms, with or without
59 * modification, are permitted provided that the following conditions
60 * are met:
61 * 1. Redistributions of source code must retain the above copyright
62 *    notice, this list of conditions and the following disclaimer.
63 * 2. Redistributions in binary form must reproduce the above copyright
64 *    notice, this list of conditions and the following disclaimer in the
65 *    documentation and/or other materials provided with the distribution.
66 * 3. All advertising materials mentioning features or use of this software
67 *    must display the following acknowledgement:
68 *      This product includes software developed by the NetBSD
69 *      Foundation, Inc. and its contributors.
70 * 4. Neither the name of The NetBSD Foundation nor the names of its
71 *    contributors may be used to endorse or promote products derived
72 *    from this software without specific prior written permission.
73 *
74 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
75 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
76 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
77 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
78 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
79 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
80 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
81 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
82 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
83 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
84 * POSSIBILITY OF SUCH DAMAGE.
85 */
86
87/*-
88 * Copyright (c) 1996 Charles M. Hannum.  All rights reserved.
89 * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
90 *
91 * Redistribution and use in source and binary forms, with or without
92 * modification, are permitted provided that the following conditions
93 * are met:
94 * 1. Redistributions of source code must retain the above copyright
95 *    notice, this list of conditions and the following disclaimer.
96 * 2. Redistributions in binary form must reproduce the above copyright
97 *    notice, this list of conditions and the following disclaimer in the
98 *    documentation and/or other materials provided with the distribution.
99 * 3. All advertising materials mentioning features or use of this software
100 *    must display the following acknowledgement:
101 *      This product includes software developed by Christopher G. Demetriou
102 *      for the NetBSD Project.
103 * 4. The name of the author may not be used to endorse or promote products
104 *    derived from this software without specific prior written permission
105 *
106 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
107 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
108 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
109 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
110 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
111 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
112 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
113 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
114 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
115 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
116 */
117
118#ifndef _RTEMS_BSD_MACHINE_BUS_H_
119#define _RTEMS_BSD_MACHINE_BUS_H_
120
121#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_KERNEL_SPACE_H_
122#error "the header file <machine/rtems-bsd-kernel-space.h> must be included first"
123#endif
124
125/*
126 * Bus address alignment.
127 */
128#define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t)
129
130/*
131 * Bus address maxima.
132 */
133#define BUS_SPACE_MAXADDR_24BIT 0xffffffU
134#define BUS_SPACE_MAXADDR_32BIT 0xffffffffU
135#define BUS_SPACE_MAXADDR       0xffffffffU
136#define BUS_SPACE_MAXSIZE_24BIT 0xffffffU
137#define BUS_SPACE_MAXSIZE_32BIT 0xffffffffU
138#define BUS_SPACE_MAXSIZE       0xffffffffU
139
140/*
141 * Bus access.
142 */
143#define BUS_SPACE_UNRESTRICTED  (~0U)
144
145/*
146 * Bus read/write barrier method.
147 */
148#define BUS_SPACE_BARRIER_READ  0x01            /* force read barrier */
149#define BUS_SPACE_BARRIER_WRITE 0x02            /* force write barrier */
150
151/*
152 * Bus address and size types
153 */
154typedef unsigned int bus_addr_t;
155typedef unsigned int bus_size_t;
156
157/*
158 * Access methods for bus resources and address space.
159 */
160typedef int bus_space_tag_t;
161typedef unsigned int bus_space_handle_t;
162
163/*
164 * Map a region of device bus space into CPU virtual address space.
165 */
166
167static __inline int
168bus_space_map(bus_space_tag_t t __unused, bus_addr_t addr,
169              bus_size_t size __unused, int flags __unused,
170              bus_space_handle_t *bshp)
171{
172        *bshp = addr;
173        return (0);
174}
175
176/*
177 * Unmap a region of device bus space.
178 */
179static __inline void
180bus_space_unmap(bus_space_tag_t bst __unused, bus_space_handle_t bsh __unused,
181    bus_size_t size __unused)
182{
183        /* Do nothing */
184}
185
186
187/*
188 * Get a new handle for a subregion of an already-mapped area of bus space.
189 */
190static __inline int
191bus_space_subregion(bus_space_tag_t bst __unused, bus_space_handle_t bsh,
192    bus_size_t ofs, bus_size_t size, bus_space_handle_t *nbshp)
193{
194        *nbshp = bsh + ofs;
195        return (0);
196}
197
198
199/*
200 * Allocate a region of memory that is accessible to devices in bus space.
201 */
202int
203bus_space_alloc(bus_space_tag_t bst __unused, bus_addr_t rstart, bus_addr_t rend,
204    bus_size_t size, bus_size_t align, bus_size_t boundary, int flags,
205    bus_addr_t *addrp, bus_space_handle_t *bshp);
206
207
208/*
209 * Free a region of bus space accessible memory.
210 */
211void
212bus_space_free(bus_space_tag_t bst __unused, bus_space_handle_t bsh, bus_size_t size);
213
214
215#if defined(__i386__)
216  #include <machine/bus_space-i386.h>
217#elif defined(__PPC__) || defined(__arm__)
218  #include <machine/bus_space-simple_memory.h>
219#else
220  #warning "Bus space routines not implemented for this architecture!!"
221  #warning "Defaulting to simple-memory Bus space routines!!"
222  #include <machine/bus_space-simple_memory.h>
223#endif
224
225#include <machine/bus_dma.h>
226
227#endif /* _RTEMS_BSD_MACHINE_BUS_H_ */
Note: See TracBrowser for help on using the repository browser.