diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-10-09 22:42:09 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-10-10 09:06:58 +0200 |
commit | bceabc95c1c85d793200446fa85f1ddc6313ea29 (patch) | |
tree | 973c8bd8deca9fd69913f2895cc91e0e6114d46c /rtemsbsd/include/machine | |
parent | Add FreeBSD sources as a submodule (diff) | |
download | rtems-libbsd-bceabc95c1c85d793200446fa85f1ddc6313ea29.tar.bz2 |
Move files to match FreeBSD layout
Diffstat (limited to 'rtemsbsd/include/machine')
29 files changed, 3980 insertions, 0 deletions
diff --git a/rtemsbsd/include/machine/_bus.h b/rtemsbsd/include/machine/_bus.h new file mode 100644 index 00000000..436fb584 --- /dev/null +++ b/rtemsbsd/include/machine/_bus.h @@ -0,0 +1 @@ +#include <freebsd/machine/bus.h> diff --git a/rtemsbsd/include/machine/_limits.h b/rtemsbsd/include/machine/_limits.h new file mode 100644 index 00000000..46cac302 --- /dev/null +++ b/rtemsbsd/include/machine/_limits.h @@ -0,0 +1,30 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + */ + +/* + * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef _RTEMS_BSD_MACHINE__LIMITS_H_ +#define _RTEMS_BSD_MACHINE__LIMITS_H_ + +#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ +#error "the header file <freebsd/machine/rtems-bsd-config.h> must be included first" +#endif + +#endif /* _RTEMS_BSD_MACHINE__LIMITS_H_ */ diff --git a/rtemsbsd/include/machine/atomic.h b/rtemsbsd/include/machine/atomic.h new file mode 100644 index 00000000..3e63ef2d --- /dev/null +++ b/rtemsbsd/include/machine/atomic.h @@ -0,0 +1,367 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + */ + +/* + * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef _RTEMS_BSD_MACHINE_ATOMIC_H_ +#define _RTEMS_BSD_MACHINE_ATOMIC_H_ + +#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ +#error "the header file <freebsd/machine/rtems-bsd-config.h> must be included first" +#endif + +#define mb() RTEMS_COMPILER_MEMORY_BARRIER() +#define wmb() RTEMS_COMPILER_MEMORY_BARRIER() +#define rmb() RTEMS_COMPILER_MEMORY_BARRIER() + +static inline void +atomic_add_int(volatile int *p, int v) +{ + rtems_interrupt_level level; + + rtems_interrupt_disable(level); + *p += v; + rtems_interrupt_enable(level); +} + +#define atomic_add_acq_int atomic_add_int +#define atomic_add_rel_int atomic_add_int + +static inline void +atomic_subtract_int(volatile int *p, int v) +{ + rtems_interrupt_level level; + + rtems_interrupt_disable(level); + *p -= v; + rtems_interrupt_enable(level); +} + +#define atomic_subtract_acq_int atomic_subtract_int +#define atomic_subtract_rel_int atomic_subtract_int + +static inline void +atomic_set_int(volatile int *p, int v) +{ + rtems_interrupt_level level; + + rtems_interrupt_disable(level); + *p |= v; + rtems_interrupt_enable(level); +} + +#define atomic_set_acq_int atomic_set_int +#define atomic_set_rel_int atomic_set_int + +static inline void +atomic_clear_int(volatile int *p, int v) +{ + rtems_interrupt_level level; + + rtems_interrupt_disable(level); + *p &= ~v; + rtems_interrupt_enable(level); +} + +#define atomic_clear_acq_int atomic_clear_int +#define atomic_clear_rel_int atomic_clear_int + +static inline int +atomic_cmpset_int(volatile int *p, int cmp, int set) +{ + rtems_interrupt_level level; + int rv; + + rtems_interrupt_disable(level); + rv = *p == cmp; + if (rv) { + *p = set; + } + rtems_interrupt_enable(level); + + return rv; +} + +#define atomic_cmpset_acq_int atomic_cmpset_int +#define atomic_cmpset_rel_int atomic_cmpset_int + +static inline int +atomic_fetchadd_int(volatile int *p, int v) +{ + rtems_interrupt_level level; + int tmp; + + rtems_interrupt_disable(level); + tmp = *p; + *p += v; + rtems_interrupt_enable(level); + + return tmp; +} + +static inline int +atomic_readandclear_int(volatile int *p) +{ + rtems_interrupt_level level; + int tmp; + + rtems_interrupt_disable(level); + tmp = *p; + *p = 0; + rtems_interrupt_enable(level); + + return tmp; +} + +static inline int +atomic_load_acq_int(volatile int *p) +{ + return *p; +} + +static inline void +atomic_store_rel_int(volatile int *p, int v) +{ + *p = v; +} + +static inline void +atomic_add_32(volatile uint32_t *p, uint32_t v) +{ + rtems_interrupt_level level; + + rtems_interrupt_disable(level); + *p += v; + rtems_interrupt_enable(level); +} + +#define atomic_add_acq_32 atomic_add_32 +#define atomic_add_rel_32 atomic_add_32 + +static inline void +atomic_subtract_32(volatile uint32_t *p, uint32_t v) +{ + rtems_interrupt_level level; + + rtems_interrupt_disable(level); + *p -= v; + rtems_interrupt_enable(level); +} + +#define atomic_subtract_acq_32 atomic_subtract_32 +#define atomic_subtract_rel_32 atomic_subtract_32 + +static inline void +atomic_set_32(volatile uint32_t *p, uint32_t v) +{ + rtems_interrupt_level level; + + rtems_interrupt_disable(level); + *p |= v; + rtems_interrupt_enable(level); +} + +#define atomic_set_acq_32 atomic_set_32 +#define atomic_set_rel_32 atomic_set_32 + +static inline void +atomic_clear_32(volatile uint32_t *p, uint32_t v) +{ + rtems_interrupt_level level; + + rtems_interrupt_disable(level); + *p &= ~v; + rtems_interrupt_enable(level); +} + +#define atomic_clear_acq_32 atomic_clear_32 +#define atomic_clear_rel_32 atomic_clear_32 + +static inline int +atomic_cmpset_32(volatile uint32_t *p, uint32_t cmp, uint32_t set) +{ + rtems_interrupt_level level; + int rv; + + rtems_interrupt_disable(level); + rv = *p == cmp; + if (rv) { + *p = set; + } + rtems_interrupt_enable(level); + + return rv; +} + +#define atomic_cmpset_acq_32 atomic_cmpset_32 +#define atomic_cmpset_rel_32 atomic_cmpset_32 + +static inline uint32_t +atomic_fetchadd_32(volatile uint32_t *p, uint32_t v) +{ + rtems_interrupt_level level; + uint32_t tmp; + + rtems_interrupt_disable(level); + tmp = *p; + *p += v; + rtems_interrupt_enable(level); + + return tmp; +} + +static inline uint32_t +atomic_readandclear_32(volatile uint32_t *p) +{ + rtems_interrupt_level level; + uint32_t tmp; + + rtems_interrupt_disable(level); + tmp = *p; + *p = 0; + rtems_interrupt_enable(level); + + return tmp; +} + +static inline uint32_t +atomic_load_acq_32(volatile uint32_t *p) +{ + return *p; +} + +static inline void +atomic_store_rel_32(volatile uint32_t *p, uint32_t v) +{ + *p = v; +} + +static inline void +atomic_add_long(volatile long *p, long v) +{ + rtems_interrupt_level level; + + rtems_interrupt_disable(level); + *p += v; + rtems_interrupt_enable(level); +} + +#define atomic_add_acq_long atomic_add_long +#define atomic_add_rel_long atomic_add_long + +static inline void +atomic_subtract_long(volatile long *p, long v) +{ + rtems_interrupt_level level; + + rtems_interrupt_disable(level); + *p -= v; + rtems_interrupt_enable(level); +} + +#define atomic_subtract_acq_long atomic_subtract_long +#define atomic_subtract_rel_long atomic_subtract_long + +static inline void +atomic_set_long(volatile long *p, long v) +{ + rtems_interrupt_level level; + + rtems_interrupt_disable(level); + *p |= v; + rtems_interrupt_enable(level); +} + +#define atomic_set_acq_long atomic_set_long +#define atomic_set_rel_long atomic_set_long + +static inline void +atomic_clear_long(volatile long *p, long v) +{ + rtems_interrupt_level level; + + rtems_interrupt_disable(level); + *p &= ~v; + rtems_interrupt_enable(level); +} + +#define atomic_clear_acq_long atomic_clear_long +#define atomic_clear_rel_long atomic_clear_long + +static inline int +atomic_cmpset_long(volatile long *p, long cmp, long set) +{ + rtems_interrupt_level level; + int rv; + + rtems_interrupt_disable(level); + rv = *p == cmp; + if (rv) { + *p = set; + } + rtems_interrupt_enable(level); + + return rv; +} + +#define atomic_cmpset_acq_long atomic_cmpset_long +#define atomic_cmpset_rel_long atomic_cmpset_long + +static inline long +atomic_fetchadd_long(volatile long *p, long v) +{ + rtems_interrupt_level level; + long tmp; + + rtems_interrupt_disable(level); + tmp = *p; + *p += v; + rtems_interrupt_enable(level); + + return tmp; +} + +static inline long +atomic_readandclear_long(volatile long *p) +{ + rtems_interrupt_level level; + long tmp; + + rtems_interrupt_disable(level); + tmp = *p; + *p = 0; + rtems_interrupt_enable(level); + + return tmp; +} + +static inline long +atomic_load_acq_long(volatile long *p) +{ + return *p; +} + +static inline void +atomic_store_rel_long(volatile long *p, long v) +{ + *p = v; +} + +#endif /* _RTEMS_BSD_MACHINE_ATOMIC_H_ */ diff --git a/rtemsbsd/include/machine/bus.h b/rtemsbsd/include/machine/bus.h new file mode 100644 index 00000000..18689dec --- /dev/null +++ b/rtemsbsd/include/machine/bus.h @@ -0,0 +1,227 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + * + * File origin from FreeBSD 'sys/amd64/include/bus.h'. + */ + +/*- + * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * Copyright (c) KATO Takenori, 1999. + * + * All rights reserved. Unpublished rights reserved under the copyright + * laws of Japan. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer as + * the first lines of this file unmodified. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/*- + * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, + * NASA Ames Research Center. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/*- + * Copyright (c) 1996 Charles M. Hannum. All rights reserved. + * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Christopher G. Demetriou + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _RTEMS_BSD_MACHINE_BUS_H_ +#define _RTEMS_BSD_MACHINE_BUS_H_ + +#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ +#error "the header file <freebsd/machine/rtems-bsd-config.h> must be included first" +#endif + +/* + * Bus address alignment. + */ +#define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t) + +/* + * Bus address maxima. + */ +#define BUS_SPACE_MAXADDR_24BIT 0xffffffU +#define BUS_SPACE_MAXADDR_32BIT 0xffffffffU +#define BUS_SPACE_MAXADDR 0xffffffffU +#define BUS_SPACE_MAXSIZE_24BIT 0xffffffU +#define BUS_SPACE_MAXSIZE_32BIT 0xffffffffU +#define BUS_SPACE_MAXSIZE 0xffffffffU + +/* + * Bus access. + */ +#define BUS_SPACE_UNRESTRICTED (~0U) + +/* + * Bus read/write barrier method. + */ +#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */ +#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */ + +/* + * Bus address and size types + */ +typedef unsigned int bus_addr_t; +typedef unsigned int bus_size_t; + +/* + * Access methods for bus resources and address space. + */ +typedef int bus_space_tag_t; +typedef unsigned int bus_space_handle_t; + +/* + * Map a region of device bus space into CPU virtual address space. + */ + +static __inline int +bus_space_map(bus_space_tag_t t __unused, bus_addr_t addr, + bus_size_t size __unused, int flags __unused, + bus_space_handle_t *bshp) +{ + *bshp = addr; + return (0); +} + +/* + * Unmap a region of device bus space. + */ +static __inline void +bus_space_unmap(bus_space_tag_t bst __unused, bus_space_handle_t bsh __unused, + bus_size_t size __unused) +{ + /* Do nothing */ +} + + +/* + * Get a new handle for a subregion of an already-mapped area of bus space. + */ +static __inline int +bus_space_subregion(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, bus_size_t size, bus_space_handle_t *nbshp) +{ + *nbshp = bsh + ofs; + return (0); +} + + +/* + * Allocate a region of memory that is accessible to devices in bus space. + */ +int +bus_space_alloc(bus_space_tag_t bst __unused, bus_addr_t rstart, bus_addr_t rend, + bus_size_t size, bus_size_t align, bus_size_t boundary, int flags, + bus_addr_t *addrp, bus_space_handle_t *bshp); + + +/* + * Free a region of bus space accessible memory. + */ +void +bus_space_free(bus_space_tag_t bst __unused, bus_space_handle_t bsh, bus_size_t size); + + +#if defined(__i386__) + #include <freebsd/machine/bus_space-i386.h> +#elif defined(__ppc__) + #include <freebsd/machine/bus_space-simple_memory.h> +#else + #warning "Bus space routines not implemented for this architecture!!" + #warning "Defaulting to simple-memory Bus space routines!!" + #include <freebsd/machine/bus_space-simple_memory.h> +#endif + +#include <freebsd/machine/bus_dma.h> + +#endif /* _RTEMS_BSD_MACHINE_BUS_H_ */ diff --git a/rtemsbsd/include/machine/bus_dma.h b/rtemsbsd/include/machine/bus_dma.h new file mode 100644 index 00000000..44ed7762 --- /dev/null +++ b/rtemsbsd/include/machine/bus_dma.h @@ -0,0 +1,32 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + */ + +/* + * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef _RTEMS_BSD_MACHINE_BUS_DMA_H_ +#define _RTEMS_BSD_MACHINE_BUS_DMA_H_ + +#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ +#error "the header file <freebsd/machine/rtems-bsd-config.h> must be included first" +#endif + +#include <freebsd/sys/bus_dma.h> + +#endif /* _RTEMS_BSD_MACHINE_BUS_DMA_H_ */ diff --git a/rtemsbsd/include/machine/bus_space-i386.h b/rtemsbsd/include/machine/bus_space-i386.h new file mode 100644 index 00000000..748d883d --- /dev/null +++ b/rtemsbsd/include/machine/bus_space-i386.h @@ -0,0 +1,1092 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + * + * File origin from FreeBSD 'sys/i386/include/bus.h'. + */ + +/*- + * Copyright (c) KATO Takenori, 1999. + * + * All rights reserved. Unpublished rights reserved under the copyright + * laws of Japan. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer as + * the first lines of this file unmodified. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* $NetBSD: bus.h,v 1.12 1997/10/01 08:25:15 fvdl Exp $ */ + +/*- + * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, + * NASA Ames Research Center. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/*- + * Copyright (c) 1996 Charles M. Hannum. All rights reserved. + * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Christopher G. Demetriou + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _RTEMS_BSD_MACHINE_BUS_I386_H_ +#define _RTEMS_BSD_MACHINE_BUS_I386_H_ + +#include <freebsd/machine/_bus.h> +#include <freebsd/machine/cpufunc.h> +#include <freebsd/machine/resource.h> + +#if 0 +#define I386_BUS_SPACE_IO SYS_RES_IOPORT +#else +#define I386_BUS_SPACE_IO 0 /* space is i/o space */ +#define I386_BUS_SPACE_MEM 1 /* space is mem space */ +#endif + +/* + * Read a 1, 2, 4, or 8 byte quantity from bus space + * described by tag/handle/offset. + */ +static __inline u_int8_t bus_space_read_1(bus_space_tag_t tag, + bus_space_handle_t handle, + bus_size_t offset); + +static __inline u_int16_t bus_space_read_2(bus_space_tag_t tag, + bus_space_handle_t handle, + bus_size_t offset); + +static __inline u_int32_t bus_space_read_4(bus_space_tag_t tag, + bus_space_handle_t handle, + bus_size_t offset); + +static __inline u_int8_t +bus_space_read_1(bus_space_tag_t tag, bus_space_handle_t handle, + bus_size_t offset) +{ + + if (tag == I386_BUS_SPACE_IO) + return (inb(handle + offset)); + return (*(volatile u_int8_t *)(handle + offset)); +} + +static __inline u_int16_t +bus_space_read_2(bus_space_tag_t tag, bus_space_handle_t handle, + bus_size_t offset) +{ + + if (tag == I386_BUS_SPACE_IO) + return (inw(handle + offset)); + return (*(volatile u_int16_t *)(handle + offset)); +} + +static __inline u_int32_t +bus_space_read_4(bus_space_tag_t tag, bus_space_handle_t handle, + bus_size_t offset) +{ + + if (tag == I386_BUS_SPACE_IO) + return (inl(handle + offset)); + return (*(volatile u_int32_t *)(handle + offset)); +} + +#if 0 /* Cause a link error for bus_space_read_8 */ +#define bus_space_read_8(t, h, o) !!! bus_space_read_8 unimplemented !!! +#endif + +/* + * Read `count' 1, 2, 4, or 8 byte quantities from bus space + * described by tag/handle/offset and copy into buffer provided. + */ +static __inline void bus_space_read_multi_1(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, u_int8_t *addr, + size_t count); + +static __inline void bus_space_read_multi_2(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, u_int16_t *addr, + size_t count); + +static __inline void bus_space_read_multi_4(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, u_int32_t *addr, + size_t count); + +static __inline void +bus_space_read_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, u_int8_t *addr, size_t count) +{ + + if (tag == I386_BUS_SPACE_IO) + insb(bsh + offset, addr, count); + else { +#ifdef __GNUCLIKE_ASM + __asm __volatile(" \n\ + cld \n\ + 1: movb (%2),%%al \n\ + stosb \n\ + loop 1b" : + "=D" (addr), "=c" (count) : + "r" (bsh + offset), "0" (addr), "1" (count) : + "%eax", "memory"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif +#endif + } +} + +static __inline void +bus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, u_int16_t *addr, size_t count) +{ + + if (tag == I386_BUS_SPACE_IO) + insw(bsh + offset, addr, count); + else { +#ifdef __GNUCLIKE_ASM + __asm __volatile(" \n\ + cld \n\ + 1: movw (%2),%%ax \n\ + stosw \n\ + loop 1b" : + "=D" (addr), "=c" (count) : + "r" (bsh + offset), "0" (addr), "1" (count) : + "%eax", "memory"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif +#endif + } +} + +static __inline void +bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, u_int32_t *addr, size_t count) +{ + + if (tag == I386_BUS_SPACE_IO) + insl(bsh + offset, addr, count); + else { +#ifdef __GNUCLIKE_ASM + __asm __volatile(" \n\ + cld \n\ + 1: movl (%2),%%eax \n\ + stosl \n\ + loop 1b" : + "=D" (addr), "=c" (count) : + "r" (bsh + offset), "0" (addr), "1" (count) : + "%eax", "memory"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif +#endif + } +} + +#if 0 /* Cause a link error for bus_space_read_multi_8 */ +#define bus_space_read_multi_8 !!! bus_space_read_multi_8 unimplemented !!! +#endif + +/* + * Read `count' 1, 2, 4, or 8 byte quantities from bus space + * described by tag/handle and starting at `offset' and copy into + * buffer provided. + */ +static __inline void bus_space_read_region_1(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, u_int8_t *addr, + size_t count); + +static __inline void bus_space_read_region_2(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, u_int16_t *addr, + size_t count); + +static __inline void bus_space_read_region_4(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, u_int32_t *addr, + size_t count); + + +static __inline void +bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, u_int8_t *addr, size_t count) +{ + + if (tag == I386_BUS_SPACE_IO) { + int _port_ = bsh + offset; +#ifdef __GNUCLIKE_ASM + __asm __volatile(" \n\ + cld \n\ + 1: inb %w2,%%al \n\ + stosb \n\ + incl %2 \n\ + loop 1b" : + "=D" (addr), "=c" (count), "=d" (_port_) : + "0" (addr), "1" (count), "2" (_port_) : + "%eax", "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif +#endif + } else { + int _port_ = bsh + offset; +#ifdef __GNUCLIKE_ASM + __asm __volatile(" \n\ + cld \n\ + repne \n\ + movsb" : + "=D" (addr), "=c" (count), "=S" (_port_) : + "0" (addr), "1" (count), "2" (_port_) : + "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif +#endif + } +} + +static __inline void +bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, u_int16_t *addr, size_t count) +{ + + if (tag == I386_BUS_SPACE_IO) { + int _port_ = bsh + offset; +#ifdef __GNUCLIKE_ASM + __asm __volatile(" \n\ + cld \n\ + 1: inw %w2,%%ax \n\ + stosw \n\ + addl $2,%2 \n\ + loop 1b" : + "=D" (addr), "=c" (count), "=d" (_port_) : + "0" (addr), "1" (count), "2" (_port_) : + "%eax", "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif +#endif + } else { + int _port_ = bsh + offset; +#ifdef __GNUCLIKE_ASM + __asm __volatile(" \n\ + cld \n\ + repne \n\ + movsw" : + "=D" (addr), "=c" (count), "=S" (_port_) : + "0" (addr), "1" (count), "2" (_port_) : + "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif +#endif + } +} + +static __inline void +bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, u_int32_t *addr, size_t count) +{ + + if (tag == I386_BUS_SPACE_IO) { + int _port_ = bsh + offset; +#ifdef __GNUCLIKE_ASM + __asm __volatile(" \n\ + cld \n\ + 1: inl %w2,%%eax \n\ + stosl \n\ + addl $4,%2 \n\ + loop 1b" : + "=D" (addr), "=c" (count), "=d" (_port_) : + "0" (addr), "1" (count), "2" (_port_) : + "%eax", "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif +#endif + } else { + int _port_ = bsh + offset; +#ifdef __GNUCLIKE_ASM + __asm __volatile(" \n\ + cld \n\ + repne \n\ + movsl" : + "=D" (addr), "=c" (count), "=S" (_port_) : + "0" (addr), "1" (count), "2" (_port_) : + "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif +#endif + } +} + +#if 0 /* Cause a link error for bus_space_read_region_8 */ +#define bus_space_read_region_8 !!! bus_space_read_region_8 unimplemented !!! +#endif + +/* + * Write the 1, 2, 4, or 8 byte value `value' to bus space + * described by tag/handle/offset. + */ + +static __inline void bus_space_write_1(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, u_int8_t value); + +static __inline void bus_space_write_2(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, u_int16_t value); + +static __inline void bus_space_write_4(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, u_int32_t value); + +static __inline void +bus_space_write_1(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, u_int8_t value) +{ + + if (tag == I386_BUS_SPACE_IO) + outb(bsh + offset, value); + else + *(volatile u_int8_t *)(bsh + offset) = value; +} + +static __inline void +bus_space_write_2(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, u_int16_t value) +{ + + if (tag == I386_BUS_SPACE_IO) + outw(bsh + offset, value); + else + *(volatile u_int16_t *)(bsh + offset) = value; +} + +static __inline void +bus_space_write_4(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, u_int32_t value) +{ + + if (tag == I386_BUS_SPACE_IO) + outl(bsh + offset, value); + else + *(volatile u_int32_t *)(bsh + offset) = value; +} + +#if 0 /* Cause a link error for bus_space_write_8 */ +#define bus_space_write_8 !!! bus_space_write_8 not implemented !!! +#endif + +/* + * Write `count' 1, 2, 4, or 8 byte quantities from the buffer + * provided to bus space described by tag/handle/offset. + */ + +static __inline void bus_space_write_multi_1(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, + const u_int8_t *addr, + size_t count); +static __inline void bus_space_write_multi_2(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, + const u_int16_t *addr, + size_t count); + +static __inline void bus_space_write_multi_4(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, + const u_int32_t *addr, + size_t count); + +static __inline void +bus_space_write_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, const u_int8_t *addr, size_t count) +{ + + if (tag == I386_BUS_SPACE_IO) + outsb(bsh + offset, addr, count); + else { +#ifdef __GNUCLIKE_ASM + __asm __volatile(" \n\ + cld \n\ + 1: lodsb \n\ + movb %%al,(%2) \n\ + loop 1b" : + "=S" (addr), "=c" (count) : + "r" (bsh + offset), "0" (addr), "1" (count) : + "%eax", "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif +#endif + } +} + +static __inline void +bus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, const u_int16_t *addr, size_t count) +{ + + if (tag == I386_BUS_SPACE_IO) + outsw(bsh + offset, addr, count); + else { +#ifdef __GNUCLIKE_ASM + __asm __volatile(" \n\ + cld \n\ + 1: lodsw \n\ + movw %%ax,(%2) \n\ + loop 1b" : + "=S" (addr), "=c" (count) : + "r" (bsh + offset), "0" (addr), "1" (count) : + "%eax", "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif +#endif + } +} + +static __inline void +bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, const u_int32_t *addr, size_t count) +{ + + if (tag == I386_BUS_SPACE_IO) + outsl(bsh + offset, addr, count); + else { +#ifdef __GNUCLIKE_ASM + __asm __volatile(" \n\ + cld \n\ + 1: lodsl \n\ + movl %%eax,(%2) \n\ + loop 1b" : + "=S" (addr), "=c" (count) : + "r" (bsh + offset), "0" (addr), "1" (count) : + "%eax", "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif +#endif + } +} + +#if 0 /* Cause a link error for bus_space_write_multi_8 */ +#define bus_space_write_multi_8(t, h, o, a, c) \ + !!! bus_space_write_multi_8 unimplemented !!! +#endif + +/* + * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided + * to bus space described by tag/handle starting at `offset'. + */ + +static __inline void bus_space_write_region_1(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, + const u_int8_t *addr, + size_t count); +static __inline void bus_space_write_region_2(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, + const u_int16_t *addr, + size_t count); +static __inline void bus_space_write_region_4(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, + const u_int32_t *addr, + size_t count); + +static __inline void +bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, const u_int8_t *addr, size_t count) +{ + + if (tag == I386_BUS_SPACE_IO) { + int _port_ = bsh + offset; +#ifdef __GNUCLIKE_ASM + __asm __volatile(" \n\ + cld \n\ + 1: lodsb \n\ + outb %%al,%w0 \n\ + incl %0 \n\ + loop 1b" : + "=d" (_port_), "=S" (addr), "=c" (count) : + "0" (_port_), "1" (addr), "2" (count) : + "%eax", "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif +#endif + } else { + int _port_ = bsh + offset; +#ifdef __GNUCLIKE_ASM + __asm __volatile(" \n\ + cld \n\ + repne \n\ + movsb" : + "=D" (_port_), "=S" (addr), "=c" (count) : + "0" (_port_), "1" (addr), "2" (count) : + "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif +#endif + } +} + +static __inline void +bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, const u_int16_t *addr, size_t count) +{ + + if (tag == I386_BUS_SPACE_IO) { + int _port_ = bsh + offset; +#ifdef __GNUCLIKE_ASM + __asm __volatile(" \n\ + cld \n\ + 1: lodsw \n\ + outw %%ax,%w0 \n\ + addl $2,%0 \n\ + loop 1b" : + "=d" (_port_), "=S" (addr), "=c" (count) : + "0" (_port_), "1" (addr), "2" (count) : + "%eax", "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif +#endif + } else { + int _port_ = bsh + offset; +#ifdef __GNUCLIKE_ASM + __asm __volatile(" \n\ + cld \n\ + repne \n\ + movsw" : + "=D" (_port_), "=S" (addr), "=c" (count) : + "0" (_port_), "1" (addr), "2" (count) : + "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif +#endif + } +} + +static __inline void +bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, const u_int32_t *addr, size_t count) +{ + + if (tag == I386_BUS_SPACE_IO) { + int _port_ = bsh + offset; +#ifdef __GNUCLIKE_ASM + __asm __volatile(" \n\ + cld \n\ + 1: lodsl \n\ + outl %%eax,%w0 \n\ + addl $4,%0 \n\ + loop 1b" : + "=d" (_port_), "=S" (addr), "=c" (count) : + "0" (_port_), "1" (addr), "2" (count) : + "%eax", "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif +#endif + } else { + int _port_ = bsh + offset; +#ifdef __GNUCLIKE_ASM + __asm __volatile(" \n\ + cld \n\ + repne \n\ + movsl" : + "=D" (_port_), "=S" (addr), "=c" (count) : + "0" (_port_), "1" (addr), "2" (count) : + "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif +#endif + } +} + +#if 0 /* Cause a link error for bus_space_write_region_8 */ +#define bus_space_write_region_8 \ + !!! bus_space_write_region_8 unimplemented !!! +#endif + +/* + * Write the 1, 2, 4, or 8 byte value `val' to bus space described + * by tag/handle/offset `count' times. + */ + +static __inline void bus_space_set_multi_1(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, + u_int8_t value, size_t count); +static __inline void bus_space_set_multi_2(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, + u_int16_t value, size_t count); +static __inline void bus_space_set_multi_4(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, + u_int32_t value, size_t count); + +static __inline void +bus_space_set_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, u_int8_t value, size_t count) +{ + bus_space_handle_t addr = bsh + offset; + + if (tag == I386_BUS_SPACE_IO) + while (count--) + outb(addr, value); + else + while (count--) + *(volatile u_int8_t *)(addr) = value; +} + +static __inline void +bus_space_set_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, u_int16_t value, size_t count) +{ + bus_space_handle_t addr = bsh + offset; + + if (tag == I386_BUS_SPACE_IO) + while (count--) + outw(addr, value); + else + while (count--) + *(volatile u_int16_t *)(addr) = value; +} + +static __inline void +bus_space_set_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, u_int32_t value, size_t count) +{ + bus_space_handle_t addr = bsh + offset; + + if (tag == I386_BUS_SPACE_IO) + while (count--) + outl(addr, value); + else + while (count--) + *(volatile u_int32_t *)(addr) = value; +} + +#if 0 /* Cause a link error for bus_space_set_multi_8 */ +#define bus_space_set_multi_8 !!! bus_space_set_multi_8 unimplemented !!! +#endif + +/* + * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described + * by tag/handle starting at `offset'. + */ + +static __inline void bus_space_set_region_1(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, u_int8_t value, + size_t count); +static __inline void bus_space_set_region_2(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, u_int16_t value, + size_t count); +static __inline void bus_space_set_region_4(bus_space_tag_t tag, + bus_space_handle_t bsh, + bus_size_t offset, u_int32_t value, + size_t count); + +static __inline void +bus_space_set_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, u_int8_t value, size_t count) +{ + bus_space_handle_t addr = bsh + offset; + + if (tag == I386_BUS_SPACE_IO) + for (; count != 0; count--, addr++) + outb(addr, value); + else + for (; count != 0; count--, addr++) + *(volatile u_int8_t *)(addr) = value; +} + +static __inline void +bus_space_set_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, u_int16_t value, size_t count) +{ + bus_space_handle_t addr = bsh + offset; + + if (tag == I386_BUS_SPACE_IO) + for (; count != 0; count--, addr += 2) + outw(addr, value); + else + for (; count != 0; count--, addr += 2) + *(volatile u_int16_t *)(addr) = value; +} + +static __inline void +bus_space_set_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, u_int32_t value, size_t count) +{ + bus_space_handle_t addr = bsh + offset; + + if (tag == I386_BUS_SPACE_IO) + for (; count != 0; count--, addr += 4) + outl(addr, value); + else + for (; count != 0; count--, addr += 4) + *(volatile u_int32_t *)(addr) = value; +} + +#if 0 /* Cause a link error for bus_space_set_region_8 */ +#define bus_space_set_region_8 !!! bus_space_set_region_8 unimplemented !!! +#endif + +/* + * Copy `count' 1, 2, 4, or 8 byte values from bus space starting + * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2. + */ + +static __inline void bus_space_copy_region_1(bus_space_tag_t tag, + bus_space_handle_t bsh1, + bus_size_t off1, + bus_space_handle_t bsh2, + bus_size_t off2, size_t count); + +static __inline void bus_space_copy_region_2(bus_space_tag_t tag, + bus_space_handle_t bsh1, + bus_size_t off1, + bus_space_handle_t bsh2, + bus_size_t off2, size_t count); + +static __inline void bus_space_copy_region_4(bus_space_tag_t tag, + bus_space_handle_t bsh1, + bus_size_t off1, + bus_space_handle_t bsh2, + bus_size_t off2, size_t count); + +static __inline void +bus_space_copy_region_1(bus_space_tag_t tag, bus_space_handle_t bsh1, + bus_size_t off1, bus_space_handle_t bsh2, + bus_size_t off2, size_t count) +{ + bus_space_handle_t addr1 = bsh1 + off1; + bus_space_handle_t addr2 = bsh2 + off2; + + if (tag == I386_BUS_SPACE_IO) { + if (addr1 >= addr2) { + /* src after dest: copy forward */ + for (; count != 0; count--, addr1++, addr2++) + outb(addr2, inb(addr1)); + } else { + /* dest after src: copy backwards */ + for (addr1 += (count - 1), addr2 += (count - 1); + count != 0; count--, addr1--, addr2--) + outb(addr2, inb(addr1)); + } + } else { + if (addr1 >= addr2) { + /* src after dest: copy forward */ + for (; count != 0; count--, addr1++, addr2++) + *(volatile u_int8_t *)(addr2) = + *(volatile u_int8_t *)(addr1); + } else { + /* dest after src: copy backwards */ + for (addr1 += (count - 1), addr2 += (count - 1); + count != 0; count--, addr1--, addr2--) + *(volatile u_int8_t *)(addr2) = + *(volatile u_int8_t *)(addr1); + } + } +} + +static __inline void +bus_space_copy_region_2(bus_space_tag_t tag, bus_space_handle_t bsh1, + bus_size_t off1, bus_space_handle_t bsh2, + bus_size_t off2, size_t count) +{ + bus_space_handle_t addr1 = bsh1 + off1; + bus_space_handle_t addr2 = bsh2 + off2; + + if (tag == I386_BUS_SPACE_IO) { + if (addr1 >= addr2) { + /* src after dest: copy forward */ + for (; count != 0; count--, addr1 += 2, addr2 += 2) + outw(addr2, inw(addr1)); + } else { + /* dest after src: copy backwards */ + for (addr1 += 2 * (count - 1), addr2 += 2 * (count - 1); + count != 0; count--, addr1 -= 2, addr2 -= 2) + outw(addr2, inw(addr1)); + } + } else { + if (addr1 >= addr2) { + /* src after dest: copy forward */ + for (; count != 0; count--, addr1 += 2, addr2 += 2) + *(volatile u_int16_t *)(addr2) = + *(volatile u_int16_t *)(addr1); + } else { + /* dest after src: copy backwards */ + for (addr1 += 2 * (count - 1), addr2 += 2 * (count - 1); + count != 0; count--, addr1 -= 2, addr2 -= 2) + *(volatile u_int16_t *)(addr2) = + *(volatile u_int16_t *)(addr1); + } + } +} + +static __inline void +bus_space_copy_region_4(bus_space_tag_t tag, bus_space_handle_t bsh1, + bus_size_t off1, bus_space_handle_t bsh2, + bus_size_t off2, size_t count) +{ + bus_space_handle_t addr1 = bsh1 + off1; + bus_space_handle_t addr2 = bsh2 + off2; + + if (tag == I386_BUS_SPACE_IO) { + if (addr1 >= addr2) { + /* src after dest: copy forward */ + for (; count != 0; count--, addr1 += 4, addr2 += 4) + outl(addr2, inl(addr1)); + } else { + /* dest after src: copy backwards */ + for (addr1 += 4 * (count - 1), addr2 += 4 * (count - 1); + count != 0; count--, addr1 -= 4, addr2 -= 4) + outl(addr2, inl(addr1)); + } + } else { + if (addr1 >= addr2) { + /* src after dest: copy forward */ + for (; count != 0; count--, addr1 += 4, addr2 += 4) + *(volatile u_int32_t *)(addr2) = + *(volatile u_int32_t *)(addr1); + } else { + /* dest after src: copy backwards */ + for (addr1 += 4 * (count - 1), addr2 += 4 * (count - 1); + count != 0; count--, addr1 -= 4, addr2 -= 4) + *(volatile u_int32_t *)(addr2) = + *(volatile u_int32_t *)(addr1); + } + } +} + +#if 0 /* Cause a link error for bus_space_copy_8 */ +#define bus_space_copy_region_8 !!! bus_space_copy_region_8 unimplemented !!! +#endif + +/* + * Bus read/write barrier methods. + * + * void bus_space_barrier(bus_space_tag_t tag, bus_space_handle_t bsh, + * bus_size_t offset, bus_size_t len, int flags); + * + * + * Note that BUS_SPACE_BARRIER_WRITE doesn't do anything other than + * prevent reordering by the compiler; all Intel x86 processors currently + * retire operations outside the CPU in program order. + */ +#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */ +#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */ + +static __inline void +bus_space_barrier(bus_space_tag_t tag __unused, bus_space_handle_t bsh __unused, + bus_size_t offset __unused, bus_size_t len __unused, int flags) +{ +#ifdef __GNUCLIKE_ASM + if (flags & BUS_SPACE_BARRIER_READ) + __asm __volatile("lock; addl $0,0(%%esp)" : : : "memory"); + else + __asm __volatile("" : : : "memory"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif +#endif +} + +#ifdef BUS_SPACE_NO_LEGACY +#undef inb +#undef outb +#define inb(a) compiler_error +#define inw(a) compiler_error +#define inl(a) compiler_error +#define outb(a, b) compiler_error +#define outw(a, b) compiler_error +#define outl(a, b) compiler_error +#endif + +#ifndef __rtems__ +#include <machine/bus_dma.h> +#endif + +/* + * Stream accesses are the same as normal accesses on i386/pc98; there are no + * supported bus systems with an endianess different from the host one. + */ +#define bus_space_read_stream_1(t, h, o) bus_space_read_1((t), (h), (o)) +#define bus_space_read_stream_2(t, h, o) bus_space_read_2((t), (h), (o)) +#define bus_space_read_stream_4(t, h, o) bus_space_read_4((t), (h), (o)) + +#define bus_space_read_multi_stream_1(t, h, o, a, c) \ + bus_space_read_multi_1((t), (h), (o), (a), (c)) +#define bus_space_read_multi_stream_2(t, h, o, a, c) \ + bus_space_read_multi_2((t), (h), (o), (a), (c)) +#define bus_space_read_multi_stream_4(t, h, o, a, c) \ + bus_space_read_multi_4((t), (h), (o), (a), (c)) + +#define bus_space_write_stream_1(t, h, o, v) \ + bus_space_write_1((t), (h), (o), (v)) +#define bus_space_write_stream_2(t, h, o, v) \ + bus_space_write_2((t), (h), (o), (v)) +#define bus_space_write_stream_4(t, h, o, v) \ + bus_space_write_4((t), (h), (o), (v)) + +#define bus_space_write_multi_stream_1(t, h, o, a, c) \ + bus_space_write_multi_1((t), (h), (o), (a), (c)) +#define bus_space_write_multi_stream_2(t, h, o, a, c) \ + bus_space_write_multi_2((t), (h), (o), (a), (c)) +#define bus_space_write_multi_stream_4(t, h, o, a, c) \ + bus_space_write_multi_4((t), (h), (o), (a), (c)) + +#define bus_space_set_multi_stream_1(t, h, o, v, c) \ + bus_space_set_multi_1((t), (h), (o), (v), (c)) +#define bus_space_set_multi_stream_2(t, h, o, v, c) \ + bus_space_set_multi_2((t), (h), (o), (v), (c)) +#define bus_space_set_multi_stream_4(t, h, o, v, c) \ + bus_space_set_multi_4((t), (h), (o), (v), (c)) + +#define bus_space_read_region_stream_1(t, h, o, a, c) \ + bus_space_read_region_1((t), (h), (o), (a), (c)) +#define bus_space_read_region_stream_2(t, h, o, a, c) \ + bus_space_read_region_2((t), (h), (o), (a), (c)) +#define bus_space_read_region_stream_4(t, h, o, a, c) \ + bus_space_read_region_4((t), (h), (o), (a), (c)) + +#define bus_space_write_region_stream_1(t, h, o, a, c) \ + bus_space_write_region_1((t), (h), (o), (a), (c)) +#define bus_space_write_region_stream_2(t, h, o, a, c) \ + bus_space_write_region_2((t), (h), (o), (a), (c)) +#define bus_space_write_region_stream_4(t, h, o, a, c) \ + bus_space_write_region_4((t), (h), (o), (a), (c)) + +#define bus_space_set_region_stream_1(t, h, o, v, c) \ + bus_space_set_region_1((t), (h), (o), (v), (c)) +#define bus_space_set_region_stream_2(t, h, o, v, c) \ + bus_space_set_region_2((t), (h), (o), (v), (c)) +#define bus_space_set_region_stream_4(t, h, o, v, c) \ + bus_space_set_region_4((t), (h), (o), (v), (c)) + +#define bus_space_copy_region_stream_1(t, h1, o1, h2, o2, c) \ + bus_space_copy_region_1((t), (h1), (o1), (h2), (o2), (c)) +#define bus_space_copy_region_stream_2(t, h1, o1, h2, o2, c) \ + bus_space_copy_region_2((t), (h1), (o1), (h2), (o2), (c)) +#define bus_space_copy_region_stream_4(t, h1, o1, h2, o2, c) \ + bus_space_copy_region_4((t), (h1), (o1), (h2), (o2), (c)) + +#endif /* _RTEMS_BSD_MACHINE_BUS_I386_H_ */ diff --git a/rtemsbsd/include/machine/bus_space-simple_memory.h b/rtemsbsd/include/machine/bus_space-simple_memory.h new file mode 100644 index 00000000..559294e6 --- /dev/null +++ b/rtemsbsd/include/machine/bus_space-simple_memory.h @@ -0,0 +1,684 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + * + * File origin from FreeBSD 'sys/amd64/include/bus.h'. + */ + +/*- + * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * Copyright (c) KATO Takenori, 1999. + * + * All rights reserved. Unpublished rights reserved under the copyright + * laws of Japan. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer as + * the first lines of this file unmodified. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/*- + * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, + * NASA Ames Research Center. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/*- + * Copyright (c) 1996 Charles M. Hannum. All rights reserved. + * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Christopher G. Demetriou + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _RTEMS_BSD_MACHINE_BUS_SIMPLE_MEMORY_H_ +#define _RTEMS_BSD_MACHINE_BUS_SIMPLE_MEMORY_H_ + +static __inline void +bus_space_barrier(bus_space_tag_t bst __unused, bus_space_handle_t bsh, bus_size_t ofs, + bus_size_t size, int flags) +{ + /* Do nothing */ +} + +/* + * Read 1 unit of data from bus space described by the tag, handle and ofs + * tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The + * data is returned. + */ +static __inline uint8_t +bus_space_read_1(bus_space_tag_t bst __unused, bus_space_handle_t bsh, bus_size_t ofs) +{ + uint8_t __volatile *bsp = (uint8_t __volatile *)(bsh + ofs); + return (*bsp); +} + +static __inline uint16_t +bus_space_read_2(bus_space_tag_t bst __unused, bus_space_handle_t bsh, bus_size_t ofs) +{ + uint16_t __volatile *bsp = (uint16_t __volatile *)(bsh + ofs); + return (*bsp); +} + +static __inline uint32_t +bus_space_read_4(bus_space_tag_t bst __unused, bus_space_handle_t bsh, bus_size_t ofs) +{ + uint32_t __volatile *bsp = (uint32_t __volatile *)(bsh + ofs); + return (*bsp); +} + +static __inline uint64_t +bus_space_read_8(bus_space_tag_t bst __unused, bus_space_handle_t bsh, bus_size_t ofs) +{ + uint64_t __volatile *bsp = (uint64_t __volatile *)(bsh + ofs); + return (*bsp); +} + + +/* + * Write 1 unit of data to bus space described by the tag, handle and ofs + * tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The + * data is passed by value. + */ +static __inline void +bus_space_write_1(bus_space_tag_t bst __unused, bus_space_handle_t bsh, bus_size_t ofs, + uint8_t val) +{ + uint8_t __volatile *bsp = (uint8_t __volatile *)(bsh + ofs); + *bsp = val; +} + +static __inline void +bus_space_write_2(bus_space_tag_t bst __unused, bus_space_handle_t bsh, bus_size_t ofs, + uint16_t val) +{ + uint16_t __volatile *bsp = (uint16_t __volatile *)(bsh + ofs); + *bsp = val; +} + +static __inline void +bus_space_write_4(bus_space_tag_t bst __unused, bus_space_handle_t bsh, bus_size_t ofs, + uint32_t val) +{ + uint32_t __volatile *bsp = (uint32_t __volatile *)(bsh + ofs); + *bsp = val; +} + +static __inline void +bus_space_write_8(bus_space_tag_t bst __unused, bus_space_handle_t bsh, bus_size_t ofs, + uint64_t val) +{ + uint64_t __volatile *bsp = (uint64_t __volatile *)(bsh + ofs); + *bsp = val; +} + + +/* + * Read count units of data from bus space described by the tag, handle and + * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The + * data is returned in the buffer passed by reference. + */ +static __inline void +bus_space_read_multi_1(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, uint8_t *bufp, bus_size_t count) +{ + uint8_t __volatile *bsp = (uint8_t __volatile *)(bsh + ofs); + while (count-- > 0) { + *bufp++ = *bsp; + } +} + +static __inline void +bus_space_read_multi_2(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, uint16_t *bufp, bus_size_t count) +{ + uint16_t __volatile *bsp = (uint16_t __volatile *)(bsh + ofs); + while (count-- > 0) { + *bufp++ = *bsp; + } +} + +static __inline void +bus_space_read_multi_4(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, uint32_t *bufp, bus_size_t count) +{ + uint32_t __volatile *bsp = (uint32_t __volatile *)(bsh + ofs); + while (count-- > 0) { + *bufp++ = *bsp; + } +} + +static __inline void +bus_space_read_multi_8(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, uint64_t *bufp, bus_size_t count) +{ + uint64_t __volatile *bsp = (uint64_t __volatile *)(bsh + ofs); + while (count-- > 0) { + *bufp++ = *bsp; + } +} + + +/* + * Write count units of data to bus space described by the tag, handle and + * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The + * data is read from the buffer passed by reference. + */ +static __inline void +bus_space_write_multi_1(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, const uint8_t *bufp, bus_size_t count) +{ + uint8_t __volatile *bsp = (uint8_t __volatile *)(bsh + ofs); + while (count-- > 0) { + *bsp = *bufp++; + } +} + +static __inline void +bus_space_write_multi_2(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, const uint16_t *bufp, bus_size_t count) +{ + uint16_t __volatile *bsp = (uint16_t __volatile *)(bsh + ofs); + while (count-- > 0) { + *bsp = *bufp++; + } +} + +static __inline void +bus_space_write_multi_4(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, const uint32_t *bufp, bus_size_t count) +{ + uint32_t __volatile *bsp = (uint32_t __volatile *)(bsh + ofs); + while (count-- > 0) { + *bsp = *bufp++; + } +} + +static __inline void +bus_space_write_multi_8(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, const uint64_t *bufp, bus_size_t count) +{ + uint64_t __volatile *bsp = (uint64_t __volatile *)(bsh + ofs); + while (count-- > 0) { + *bsp = *bufp++; + } +} + + +/* + * Read count units of data from bus space described by the tag, handle and + * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The + * data is written to the buffer passed by reference and read from successive + * bus space addresses. Access is unordered. + */ +static __inline void +bus_space_read_region_1(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, uint8_t *bufp, bus_size_t count) +{ + while (count-- > 0) { + uint8_t __volatile *bsp = (uint8_t __volatile *)(bsh + ofs); + *bufp++ = *bsp; + ofs += 1; + } +} + +static __inline void +bus_space_read_region_2(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, uint16_t *bufp, bus_size_t count) +{ + while (count-- > 0) { + uint16_t __volatile *bsp = (uint16_t __volatile *)(bsh + ofs); + *bufp++ = *bsp; + ofs += 2; + } +} + +static __inline void +bus_space_read_region_4(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, uint32_t *bufp, bus_size_t count) +{ + while (count-- > 0) { + uint32_t __volatile *bsp = (uint32_t __volatile *)(bsh + ofs); + *bufp++ = *bsp; + ofs += 4; + } +} + +static __inline void +bus_space_read_region_8(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, uint64_t *bufp, bus_size_t count) +{ + while (count-- > 0) { + uint64_t __volatile *bsp = (uint64_t __volatile *)(bsh + ofs); + *bufp++ = *bsp; + ofs += 8; + } +} + + +/* + * Write count units of data from bus space described by the tag, handle and + * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The + * data is read from the buffer passed by reference and written to successive + * bus space addresses. Access is unordered. + */ +static __inline void +bus_space_write_region_1(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, const uint8_t *bufp, bus_size_t count) +{ + while (count-- > 0) { + uint8_t __volatile *bsp = (uint8_t __volatile *)(bsh + ofs); + *bsp = *bufp++; + ofs += 1; + } +} + +static __inline void +bus_space_write_region_2(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, const uint16_t *bufp, bus_size_t count) +{ + while (count-- > 0) { + uint16_t __volatile *bsp = (uint16_t __volatile *)(bsh + ofs); + *bsp = *bufp++; + ofs += 2; + } +} + +static __inline void +bus_space_write_region_4(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, const uint32_t *bufp, bus_size_t count) +{ + while (count-- > 0) { + uint32_t __volatile *bsp = (uint32_t __volatile *)(bsh + ofs); + *bsp = *bufp++; + ofs += 4; + } +} + +static __inline void +bus_space_write_region_8(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, const uint64_t *bufp, bus_size_t count) +{ + while (count-- > 0) { + uint64_t __volatile *bsp = (uint64_t __volatile *)(bsh + ofs); + *bsp = *bufp++; + ofs += 8; + } +} + + +/* + * Write count units of data from bus space described by the tag, handle and + * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The + * data is passed by value. Writes are unordered. + */ +static __inline void +bus_space_set_multi_1(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, uint8_t val, bus_size_t count) +{ + uint8_t __volatile *bsp = (uint8_t __volatile *)(bsh + ofs); + while (count-- > 0) { + *bsp = val; + } +} + +static __inline void +bus_space_set_multi_2(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, uint16_t val, bus_size_t count) +{ + uint16_t __volatile *bsp = (uint16_t __volatile *)(bsh + ofs); + while (count-- > 0) { + *bsp = val; + } +} + +static __inline void +bus_space_set_multi_4(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, uint32_t val, bus_size_t count) +{ + uint32_t __volatile *bsp = (uint32_t __volatile *)(bsh + ofs); + while (count-- > 0) { + *bsp = val; + } +} + +static __inline void +bus_space_set_multi_8(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, uint64_t val, bus_size_t count) +{ + uint64_t __volatile *bsp = (uint64_t __volatile *)(bsh + ofs); + while (count-- > 0) { + *bsp = val; + } +} + + +/* + * Write count units of data from bus space described by the tag, handle and + * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The + * data is passed by value and written to successive bus space addresses. + * Writes are unordered. + */ +static __inline void +bus_space_set_region_1(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, uint8_t val, bus_size_t count) +{ + while (count-- > 0) { + uint8_t __volatile *bsp = (uint8_t __volatile *)(bsh + ofs); + *bsp = val; + ofs += 1; + } +} + +static __inline void +bus_space_set_region_2(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, uint16_t val, bus_size_t count) +{ + while (count-- > 0) { + uint16_t __volatile *bsp = (uint16_t __volatile *)(bsh + ofs); + *bsp = val; + ofs += 2; + } +} + +static __inline void +bus_space_set_region_4(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, uint32_t val, bus_size_t count) +{ + while (count-- > 0) { + uint32_t __volatile *bsp = (uint32_t __volatile *)(bsh + ofs); + *bsp = val; + ofs += 4; + } +} + +static __inline void +bus_space_set_region_8(bus_space_tag_t bst __unused, bus_space_handle_t bsh, + bus_size_t ofs, uint64_t val, bus_size_t count) +{ + while (count-- > 0) { + uint64_t __volatile *bsp = (uint64_t __volatile *)(bsh + ofs); + *bsp = val; + ofs += 8; + } +} + + +/* + * Copy count units of data from bus space described by the tag and the first + * handle and ofs pair to bus space described by the tag and the second handle + * and ofs pair. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. + * The data is read from successive bus space addresses and also written to + * successive bus space addresses. Both reads and writes are unordered. + */ +static __inline void +bus_space_copy_region_1(bus_space_tag_t bst __unused, bus_space_handle_t bsh1, + bus_size_t ofs1, bus_space_handle_t bsh2, bus_size_t ofs2, bus_size_t count) +{ + bus_addr_t dst = bsh1 + ofs1; + bus_addr_t src = bsh2 + ofs2; + uint8_t __volatile *dstp = (uint8_t __volatile *) dst; + uint8_t __volatile *srcp = (uint8_t __volatile *) src; + if (dst > src) { + src += count - 1; + dst += count - 1; + while (count-- > 0) { + *dstp = *srcp; + src -= 1; + dst -= 1; + } + } else { + while (count-- > 0) { + *dstp = *srcp; + src += 1; + dst += 1; + } + } +} + +static __inline void +bus_space_copy_region_2(bus_space_tag_t bst __unused, bus_space_handle_t bsh1, + bus_size_t ofs1, bus_space_handle_t bsh2, bus_size_t ofs2, bus_size_t count) +{ + bus_addr_t dst = bsh1 + ofs1; + bus_addr_t src = bsh2 + ofs2; + uint16_t __volatile *dstp = (uint16_t __volatile *) dst; + uint16_t __volatile *srcp = (uint16_t __volatile *) src; + if (dst > src) { + src += (count - 1) << 1; + dst += (count - 1) << 1; + while (count-- > 0) { + *dstp = *srcp; + src -= 2; + dst -= 2; + } + } else { + while (count-- > 0) { + *dstp = *srcp; + src += 2; + dst += 2; + } + } +} + +static __inline void +bus_space_copy_region_4(bus_space_tag_t bst __unused, bus_space_handle_t bsh1, + bus_size_t ofs1, bus_space_handle_t bsh2, bus_size_t ofs2, bus_size_t count) +{ + bus_addr_t dst = bsh1 + ofs1; + bus_addr_t src = bsh2 + ofs2; + uint32_t __volatile *dstp = (uint32_t __volatile *) dst; + uint32_t __volatile *srcp = (uint32_t __volatile *) src; + if (dst > src) { + src += (count - 1) << 2; + dst += (count - 1) << 2; + while (count-- > 0) { + *dstp = *srcp; + src -= 4; + dst -= 4; + } + } else { + while (count-- > 0) { + *dstp = *srcp; + src += 4; + dst += 4; + } + } +} + +static __inline void +bus_space_copy_region_8(bus_space_tag_t bst __unused, bus_space_handle_t bsh1, + bus_size_t ofs1, bus_space_handle_t bsh2, bus_size_t ofs2, bus_size_t count) +{ + bus_addr_t dst = bsh1 + ofs1; + bus_addr_t src = bsh2 + ofs2; + uint64_t __volatile *dstp = (uint64_t __volatile *) dst; + uint64_t __volatile *srcp = (uint64_t __volatile *) src; + if (dst > src) { + src += (count - 1) << 3; + dst += (count - 1) << 3; + while (count-- > 0) { + *dstp = *srcp; + src -= 8; + dst -= 8; + } + } else { + while (count-- > 0) { + *dstp = *srcp; + src += 8; + dst += 8; + } + } +} + + +/* + * Stream accesses are the same as normal accesses on RTEMS; there are no + * supported bus systems with an endianess different from the host one. + */ +#define bus_space_read_stream_1(t, h, o) \ + bus_space_read_1(t, h, o) +#define bus_space_read_stream_2(t, h, o) \ + bus_space_read_2(t, h, o) +#define bus_space_read_stream_4(t, h, o) \ + bus_space_read_4(t, h, o) +#define bus_space_read_stream_8(t, h, o) \ + bus_space_read_8(t, h, o) + +#define bus_space_read_multi_stream_1(t, h, o, a, c) \ + bus_space_read_multi_1(t, h, o, a, c) +#define bus_space_read_multi_stream_2(t, h, o, a, c) \ + bus_space_read_multi_2(t, h, o, a, c) +#define bus_space_read_multi_stream_4(t, h, o, a, c) \ + bus_space_read_multi_4(t, h, o, a, c) +#define bus_space_read_multi_stream_8(t, h, o, a, c) \ + bus_space_read_multi_8(t, h, o, a, c) + +#define bus_space_write_stream_1(t, h, o, v) \ + bus_space_write_1(t, h, o, v) +#define bus_space_write_stream_2(t, h, o, v) \ + bus_space_write_2(t, h, o, v) +#define bus_space_write_stream_4(t, h, o, v) \ + bus_space_write_4(t, h, o, v) +#define bus_space_write_stream_8(t, h, o, v) \ + bus_space_write_8(t, h, o, v) + +#define bus_space_write_multi_stream_1(t, h, o, a, c) \ + bus_space_write_multi_1(t, h, o, a, c) +#define bus_space_write_multi_stream_2(t, h, o, a, c) \ + bus_space_write_multi_2(t, h, o, a, c) +#define bus_space_write_multi_stream_4(t, h, o, a, c) \ + bus_space_write_multi_4(t, h, o, a, c) +#define bus_space_write_multi_stream_8(t, h, o, a, c) \ + bus_space_write_multi_8(t, h, o, a, c) + +#define bus_space_set_multi_stream_1(t, h, o, v, c) \ + bus_space_set_multi_1(t, h, o, v, c) +#define bus_space_set_multi_stream_2(t, h, o, v, c) \ + bus_space_set_multi_2(t, h, o, v, c) +#define bus_space_set_multi_stream_4(t, h, o, v, c) \ + bus_space_set_multi_4(t, h, o, v, c) +#define bus_space_set_multi_stream_8(t, h, o, v, c) \ + bus_space_set_multi_8(t, h, o, v, c) + +#define bus_space_read_region_stream_1(t, h, o, a, c) \ + bus_space_read_region_1(t, h, o, a, c) +#define bus_space_read_region_stream_2(t, h, o, a, c) \ + bus_space_read_region_2(t, h, o, a, c) +#define bus_space_read_region_stream_4(t, h, o, a, c) \ + bus_space_read_region_4(t, h, o, a, c) +#define bus_space_read_region_stream_8(t, h, o, a, c) \ + bus_space_read_region_8(t, h, o, a, c) + +#define bus_space_write_region_stream_1(t, h, o, a, c) \ + bus_space_write_region_1(t, h, o, a, c) +#define bus_space_write_region_stream_2(t, h, o, a, c) \ + bus_space_write_region_2(t, h, o, a, c) +#define bus_space_write_region_stream_4(t, h, o, a, c) \ + bus_space_write_region_4(t, h, o, a, c) +#define bus_space_write_region_stream_8(t, h, o, a, c) \ + bus_space_write_region_8(t, h, o, a, c) + +#define bus_space_set_region_stream_1(t, h, o, v, c) \ + bus_space_set_region_1(t, h, o, v, c) +#define bus_space_set_region_stream_2(t, h, o, v, c) \ + bus_space_set_region_2(t, h, o, v, c) +#define bus_space_set_region_stream_4(t, h, o, v, c) \ + bus_space_set_region_4(t, h, o, v, c) +#define bus_space_set_region_stream_8(t, h, o, v, c) \ + bus_space_set_region_8(t, h, o, v, c) + +#define bus_space_copy_region_stream_1(t, h1, o1, h2, o2, c) \ + bus_space_copy_region_1(t, h1, o1, h2, o2, c) +#define bus_space_copy_region_stream_2(t, h1, o1, h2, o2, c) \ + bus_space_copy_region_2(t, h1, o1, h2, o2, c) +#define bus_space_copy_region_stream_4(t, h1, o1, h2, o2, c) \ + bus_space_copy_region_4(t, h1, o1, h2, o2, c) +#define bus_space_copy_region_stream_8(t, h1, o1, h2, o2, c) \ + bus_space_copy_region_8(t, h1, o1, h2, o2, c) + +#endif /* _RTEMS_BSD_MACHINE_BUS_SIMPLE_MEMORY_H_ */ diff --git a/rtemsbsd/include/machine/clock.h b/rtemsbsd/include/machine/clock.h new file mode 100644 index 00000000..9f40d413 --- /dev/null +++ b/rtemsbsd/include/machine/clock.h @@ -0,0 +1,35 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + */ + +/* + * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef _RTEMS_BSD_MACHINE_CLOCK_H_ +#define _RTEMS_BSD_MACHINE_CLOCK_H_ + +#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ +#error "the header file <freebsd/machine/rtems-bsd-config.h> must be included first" +#endif + +#ifdef _KERNEL + + +#endif /* _KERNEL */ + +#endif diff --git a/rtemsbsd/include/machine/cpu.h b/rtemsbsd/include/machine/cpu.h new file mode 100644 index 00000000..eafeca93 --- /dev/null +++ b/rtemsbsd/include/machine/cpu.h @@ -0,0 +1,31 @@ +/** + * @file + * + * @ingroup rtems_bsd_rtems + * + * @brief TODO. + */ + +/* + * COPYRIGHT (c) 2012. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef _RTEMS_BSD_MACHINE_CPU_H_ +#define _RTEMS_BSD_MACHINE_CPU_H_ + +#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ +#error "the header file <freebsd/machine/rtems-bsd-config.h> must be included first" +#endif + +static __inline uint64_t +get_cyclecount(void) +{ + return rtems_clock_get_ticks_since_boot(); +} + +#endif /* _RTEMS_BSD_MACHINE_CPU_H_ */ diff --git a/rtemsbsd/include/machine/cpufunc.h b/rtemsbsd/include/machine/cpufunc.h new file mode 100644 index 00000000..fa882cb5 --- /dev/null +++ b/rtemsbsd/include/machine/cpufunc.h @@ -0,0 +1 @@ +/* empty file */ diff --git a/rtemsbsd/include/machine/elf.h b/rtemsbsd/include/machine/elf.h new file mode 100644 index 00000000..936ffd88 --- /dev/null +++ b/rtemsbsd/include/machine/elf.h @@ -0,0 +1 @@ +/* EMPTY */ diff --git a/rtemsbsd/include/machine/mutex.h b/rtemsbsd/include/machine/mutex.h new file mode 100644 index 00000000..8ab14405 --- /dev/null +++ b/rtemsbsd/include/machine/mutex.h @@ -0,0 +1,30 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + */ + +/* + * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef _RTEMS_BSD_MACHINE_MUTEX_H_ +#define _RTEMS_BSD_MACHINE_MUTEX_H_ + +#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ +#error "the header file <freebsd/machine/rtems-bsd-config.h> must be included first" +#endif + +#endif /* _RTEMS_BSD_MACHINE_MUTEX_H_ */ diff --git a/rtemsbsd/include/machine/pcb.h b/rtemsbsd/include/machine/pcb.h new file mode 100644 index 00000000..936ffd88 --- /dev/null +++ b/rtemsbsd/include/machine/pcb.h @@ -0,0 +1 @@ +/* EMPTY */ diff --git a/rtemsbsd/include/machine/pcpu.h b/rtemsbsd/include/machine/pcpu.h new file mode 100644 index 00000000..caf1385f --- /dev/null +++ b/rtemsbsd/include/machine/pcpu.h @@ -0,0 +1,41 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + */ + +/* + * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef _RTEMS_BSD_MACHINE_PCPU_H_ +#define _RTEMS_BSD_MACHINE_PCPU_H_ + +#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ +#error "the header file <freebsd/machine/rtems-bsd-config.h> must be included first" +#endif + +#define curthread (( struct thread * )(( RTEMS_API_Control * )_Thread_Executing->API_Extensions[THREAD_API_RTEMS] )->Notepads[RTEMS_NOTEPAD_0] ) + +extern struct pcpu *pcpup; + +#define PCPU_MD_FIELDS +#define PCPU_GET(member) (0) +#define PCPU_SET(member, val) + +//#define PCPU_GET(member) (pcpup->pc_ ## member) +//#define PCPU_SET(member, val) (pcpup->pc_ ## member = (val)) + +#endif /* _RTEMS_BSD_MACHINE_PCPU_H_ */ diff --git a/rtemsbsd/include/machine/proc.h b/rtemsbsd/include/machine/proc.h new file mode 100644 index 00000000..6873e087 --- /dev/null +++ b/rtemsbsd/include/machine/proc.h @@ -0,0 +1,38 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + */ + +/* + * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef _RTEMS_BSD_MACHINE_PROC_H_ +#define _RTEMS_BSD_MACHINE_PROC_H_ + +#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ +#error "the header file <freebsd/machine/rtems-bsd-config.h> must be included first" +#endif + +struct mdthread { + int dummy; +}; + +struct mdproc { + int dummy; +}; + +#endif /* _RTEMS_BSD_MACHINE_PROC_H_ */ diff --git a/rtemsbsd/include/machine/resource.h b/rtemsbsd/include/machine/resource.h new file mode 100644 index 00000000..9b143810 --- /dev/null +++ b/rtemsbsd/include/machine/resource.h @@ -0,0 +1,10 @@ +#ifndef _MACHINE_RESOURCE_H_ +#define _MACHINE_RESOURCE_H_ 1 + +#define SYS_RES_IRQ 1 /* interrupt lines */ +#define SYS_RES_DRQ 2 /* isa dma lines */ +#define SYS_RES_MEMORY 3 /* i/o memory */ +#define SYS_RES_IOPORT 4 /* i/o ports */ +#define SYS_RES_GPIO 5 /* general purpose i/o */ + +#endif /* !_MACHINE_RESOURCE_H_ */ diff --git a/rtemsbsd/include/machine/rtems-bsd-bus-dma.h b/rtemsbsd/include/machine/rtems-bsd-bus-dma.h new file mode 100644 index 00000000..e9115e42 --- /dev/null +++ b/rtemsbsd/include/machine/rtems-bsd-bus-dma.h @@ -0,0 +1,85 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + * + * File origin from FreeBSD "sys/powerpc/powerpc/busdma_machdep.c". + */ + +/*- + * Copyright (c) 2009-2012 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * Copyright (c) 2004 Olivier Houchard + * Copyright (c) 2002 Peter Grehan + * Copyright (c) 1997, 1998 Justin T. Gibbs. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification, immediately at the beginning of the file. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_BUS_DMA_H_ +#define _RTEMS_BSD_MACHINE_RTEMS_BSD_BUS_DMA_H_ + +#include <freebsd/sys/param.h> +#include <freebsd/sys/types.h> +#include <freebsd/sys/lock.h> +#include <freebsd/sys/mutex.h> +#include <freebsd/sys/systm.h> +#include <freebsd/machine/bus.h> + +struct bus_dma_tag { + bus_dma_tag_t parent; + bus_size_t alignment; + bus_size_t boundary; + bus_addr_t lowaddr; + bus_addr_t highaddr; + bus_dma_filter_t *filter; + void *filterarg; + bus_size_t maxsize; + int nsegments; + bus_size_t maxsegsz; + int flags; + int ref_count; + int map_count; + bus_dma_lock_t *lockfunc; + void *lockfuncarg; +}; + +struct bus_dmamap { + void *buffer_begin; + bus_size_t buffer_size; +}; + +int +bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dma_segment_t segs[], + void *buf, bus_size_t buflen, struct thread *td, int flags, + vm_offset_t *lastaddrp, int *segp, int first); + +#endif /* _RTEMS_BSD_MACHINE_RTEMS_BSD_BUS_DMA_H_ */ diff --git a/rtemsbsd/include/machine/rtems-bsd-cache.h b/rtemsbsd/include/machine/rtems-bsd-cache.h new file mode 100644 index 00000000..77cc0794 --- /dev/null +++ b/rtemsbsd/include/machine/rtems-bsd-cache.h @@ -0,0 +1,37 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + */ + +/* + * Copyright (c) 2010 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_CACHE_H_ +#define _RTEMS_BSD_MACHINE_RTEMS_BSD_CACHE_H_ + +#include <bsp.h> + +#if defined(LIBBSP_ARM_LPC24XX_BSP_H) + /* No cache */ +#elif defined(LIBBSP_ARM_LPC32XX_BSP_H) + /* With cache, no coherency support in hardware */ + #include <libcpu/cache.h> +#elif defined(__GEN83xx_BSP_h) + /* With cache, coherency support in hardware */ +#endif + +#endif /* _RTEMS_BSD_MACHINE_RTEMS_BSD_CACHE_H_ */ diff --git a/rtemsbsd/include/machine/rtems-bsd-config.h.in b/rtemsbsd/include/machine/rtems-bsd-config.h.in new file mode 100644 index 00000000..655d319a --- /dev/null +++ b/rtemsbsd/include/machine/rtems-bsd-config.h.in @@ -0,0 +1,281 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + */ + +/* + * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ +#define _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ + +/* We compile for RTEMS and FreeBSD */ +#define __rtems__ 1 +#define __FreeBSD__ 1 +#define __BSD_VISIBLE 1 + +/* XXX hack so /opt.../machine/param.h can disable MSIZE and use this one */ +#define __NEW_RTEMS_BSD__ + +#include <sys/cdefs.h> + +#ifndef _RTEMS_BSD_BSD_HH_ +/* General defines to activate BSD kernel parts */ +#define _KERNEL 1 + +/* Disable standard system headers */ +#undef _SYS_UNISTD_H +#define _SYS_UNISTD_H 1 +#undef _SYS_TTYCOM_H_ +#define _SYS_TTYCOM_H_ 1 + +/* Disable some quirks in the standard headers */ +#define _POSIX_SOURCE 1 + +/* We need POSIX threads */ +#define _POSIX_THREADS 1 + +#endif /* !_RTEMS_BSD_BSD_HH_ */ + +/* Type set from the C standard */ +#include <stdarg.h> +#include <stddef.h> +#include <stdint.h> +#include <limits.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#include <sys/types.h> + +/* Ensure that we are RTEMS compatible and can use RTEMS */ +#include <rtems.h> +#include <rtems/error.h> +#include <rtems/chain.h> +#include <rtems/libio.h> + +#ifndef _RTEMS_BSD_BSD_HH_ +/* Ensure that we can use POSIX threads */ +#include <pthread.h> + +/* The BSD kernel is not a POSIX source */ +#undef _POSIX_SOURCE + +/* Symbol undefines */ +#undef MAXPATHLEN + +#endif /* !_RTEMS_BSD_BSD_HH_ */ + +/* Networking */ +#define IPSEC 1 +#define INET 1 +#define INET6 1 +#define TCP_SIGNATURE 1 + +/* Integer type definitions */ + +#define __INT_MAX INT_MAX +#define GID_MAX UINT_MAX /* max value for a gid_t */ +#define UID_MAX UINT_MAX /* max value for a uid_t */ + +#define __int8_t int8_t +#define __int16_t int16_t +#define __int32_t int32_t +#define __int64_t int64_t + +#define __int_least8_t int_least8_t +#define __int_least16_t int_least16_t +#define __int_least32_t int_least32_t +#define __int_least64_t int_least64_t + +#define __int_fast8_t int_fast8_t +#define __int_fast16_t int_fast16_t +#define __int_fast32_t int_fast32_t +#define __int_fast64_t int_fast64_t + +#define __uint8_t uint8_t +#define __uint16_t uint16_t +#define __uint32_t uint32_t +#define __uint64_t uint64_t + +#define __uint_least8_t uint_least8_t +#define __uint_least16_t uint_least16_t +#define __uint_least32_t uint_least32_t +#define __uint_least64_t uint_least64_t + +#define __uint_fast8_t uint_fast8_t +#define __uint_fast16_t uint_fast16_t +#define __uint_fast32_t uint_fast32_t +#define __uint_fast64_t uint_fast64_t + +#define __intfptr_t intptr_t +#define __uintfptr_t uintptr_t + +#define __intptr_t intptr_t +#define __uintptr_t uintptr_t + +#define __intmax_t intmax_t +#define __uintmax_t uintmax_t + +#define __register_t int +#define __u_register_t unsigned int + +#define __float_t float +#define __double_t double + +#define __vm_offset_t uintptr_t +#define __vm_ooffset_t uint64_t +#define __vm_paddr_t uintptr_t +#define __vm_pindex_t uint64_t +#define __vm_size_t uintptr_t + +#define __clock_t clock_t +#define __cpumask_t unsigned int +#define __critical_t intptr_t +#define __ptrdiff_t ptrdiff_t +#define __segsz_t intptr_t +#define __time_t time_t + +#define __va_list va_list + +#undef __size_t +#define __size_t size_t + +#define _CLOCKID_T_DECLARED 1 +#define _DEV_T_DECLARED 1 +#define _GID_T_DECLARED 1 +#define _MODE_T_DECLARED 1 +#define _OFF_T_DECLARED 1 +#define _PID_T_DECLARED 1 +#define _SSIZE_T_DECLARED 1 +#define _TIMER_T_DECLARED 1 +#define _TIME_T_DECLARED 1 +#define _UID_T_DECLARED 1 +#define _USECONDS_T_DECLARED 1 +#define _FSBLKCNT_T_DECLARED 1 +#define _BLKSIZE_T_DECLARED 1 +#define _BLKCNT_T_DECLARED 1 + +#define __dev_t _bsd_dev_t +#define __gid_t _bsd_gid_t +#define __off_t _bsd_off_t +#define __pid_t _bsd_pid_t +#define __uid_t _bsd_uid_t + +/* Missing error number */ +//#define ENOIOCTL EINVAL + +/* multiple user space methods and commands use this */ +#ifndef _PATH_DEVNULL +#define _PATH_DEVNULL "/dev/null" +#endif + +/* used by some user space code */ +#ifndef SIZE_T_MAX +#define SIZE_T_MAX SIZE_MAX +#endif + +/* used by some user space code */ +#ifndef O_EXLOCK +#define O_EXLOCK O_EXCL +#endif + +/* used by some user space code */ +#if !defined O_NOFOLLOW +#define O_NOFOLLOW 0 +#endif + +/* used by some user space code */ +#ifndef O_SHLOCK +#define O_SHLOCK 0 +#endif + +/* from limits.h on FreeBSD */ +#ifndef _POSIX_HOST_NAME_MAX +#define _POSIX_HOST_NAME_MAX 255 +#endif + +#ifndef _RTEMS_BSD_BSD_HH_ +/* Symbol rename */ + +#include <freebsd/machine/rtems-bsd-symbols.h> + +#define gets _bsd_gets +#define realloc _bsd_realloc +#define reallocf _bsd_reallocf +#define setenv _bsd_setenv +#define abs _bsd_abs +#define labs _bsd_labs + +#include <rtems/score/watchdogimpl.h> +#define ticks _Watchdog_Ticks_since_boot + +/* Debug */ + +void rtems_bsd_assert_func(const char *file, int line, const char *func, const char *expr); + +#define BSD_PRINTF(fmt, ...) printf("%s: " fmt, __func__, ##__VA_ARGS__) + +#define BSD_PANIC(fmt, ...) panic("%s: " fmt "\n", __func__, ##__VA_ARGS__) + +#ifdef NDEBUG +# define BSD_ASSERT(expr) ((void) 0) +#else +# define BSD_ASSERT(expr) ((expr) ? (void) 0 : rtems_bsd_assert_func(__FILE__, __LINE__, __func__, #expr)) +#endif + +#define BSD_ASSERT_SC(sc) BSD_ASSERT((sc) == RTEMS_SUCCESSFUL) + +#define BSD_ASSERT_RV(rv) BSD_ASSERT((rv) == 0) + +/* General definitions */ + +#define BSD_TASK_PRIORITY_NORMAL 120 + +#define BSD_TASK_PRIORITY_TIMER 110 + +#define BSD_TASK_PRIORITY_INTERRUPT 100 + +#define BSD_TASK_PRIORITY_RESOURCE_OWNER 100 + +/* FIXME */ +#define BSD_MINIMUM_TASK_STACK_SIZE ((size_t) 32 * 1024) + +#define M_RTEMS_HEAP 0 + +#define BSD_MAXIMUM_SLEEP_QUEUES 32 + +extern rtems_chain_control rtems_bsd_lock_chain; + +extern rtems_chain_control rtems_bsd_mtx_chain; + +extern rtems_chain_control rtems_bsd_sx_chain; + +extern rtems_chain_control rtems_bsd_condvar_chain; + +extern rtems_chain_control rtems_bsd_callout_chain; + +extern rtems_chain_control rtems_bsd_thread_chain; + +extern rtems_chain_control rtems_bsd_malloc_chain; + +/* CPU definitions */ +#define cpu_spinwait() /* nothing */ + +#endif /* !_RTEMS_BSD_BSD_HH_ */ + +#endif /* _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ */ diff --git a/rtemsbsd/include/machine/rtems-bsd-devicet.h b/rtemsbsd/include/machine/rtems-bsd-devicet.h new file mode 100644 index 00000000..2db95850 --- /dev/null +++ b/rtemsbsd/include/machine/rtems-bsd-devicet.h @@ -0,0 +1,73 @@ +/** + * @file + * + * @ingroup rtems_bsd_rtems + * + * @brief This file describes the divice structure. It was derived + * from the libbsdport source. + */ + +/* + * COPYRIGHT (c) 2012. On-Line Applications Research Corporation (OAR). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_DEVICET_H_ +#define _RTEMS_BSD_MACHINE_RTEMS_BSD_DEVICET_H_ + +#include <rtems.h> +#include <rtems/bspIo.h> +#include <stdarg.h> +#include <stdio.h> + +#include <freebsd/sys/queue.h> + +typedef struct device *device_t; + +typedef struct _pcidev_t { + unsigned short bus; + unsigned char dev; + unsigned char fun; +} pcidev_t; + +#define DEVICE_SOFTC_ALIGNMENT 16 + +struct device { + union { + pcidev_t pci; + } bushdr; + int type; + STAILQ_ENTRY(device) list; + const char *name; + char nameunit[16]; /* NEVER use knowledge about the size of this -- we may change it */ + int unit; + char *desc; + driver_t *drv; + int attached; + void *rawmem; /* back pointer */ + struct rtems_bsdnet_ifconfig *ifconfig; + char softc[] __attribute__ ((aligned(DEVICE_SOFTC_ALIGNMENT), may_alias)); + /* a pointer to back to the device is installed past the 'softc' */ +}; +#endif diff --git a/rtemsbsd/include/machine/rtems-bsd-symbols.h b/rtemsbsd/include/machine/rtems-bsd-symbols.h new file mode 100644 index 00000000..4c3be853 --- /dev/null +++ b/rtemsbsd/include/machine/rtems-bsd-symbols.h @@ -0,0 +1,568 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + */ + +/* + * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_SYMBOLS_H_ +#define _RTEMS_BSD_MACHINE_RTEMS_BSD_SYMBOLS_H_ + +#define bootverbose _bsd_bootverbose +#define bus_activate_resource _bsd_bus_activate_resource +#define bus_activate_resource _bsd_bus_activate_resource +#define bus_activate_resource_desc _bsd_bus_activate_resource_desc +#define bus_activate_resource_method_default _bsd_bus_activate_resource_method_default +#define bus_add_child_desc _bsd_bus_add_child_desc +#define bus_add_child_method_default _bsd_bus_add_child_method_default +#define bus_alloc_resource _bsd_bus_alloc_resource +#define bus_alloc_resource_desc _bsd_bus_alloc_resource_desc +#define bus_alloc_resource_method_default _bsd_bus_alloc_resource_method_default +#define bus_alloc_resources _bsd_bus_alloc_resources +#define bus_bind_intr _bsd_bus_bind_intr +#define bus_bind_intr_desc _bsd_bus_bind_intr_desc +#define bus_bind_intr_method_default _bsd_bus_bind_intr_method_default +#define bus_child_detached_desc _bsd_bus_child_detached_desc +#define bus_child_detached_method_default _bsd_bus_child_detached_method_default +#define bus_child_location_str _bsd_bus_child_location_str +#define bus_child_location_str_desc _bsd_bus_child_location_str_desc +#define bus_child_location_str_method_default _bsd_bus_child_location_str_method_default +#define bus_child_pnpinfo_str _bsd_bus_child_pnpinfo_str +#define bus_child_pnpinfo_str_desc _bsd_bus_child_pnpinfo_str_desc +#define bus_child_pnpinfo_str_method_default _bsd_bus_child_pnpinfo_str_method_default +#define bus_child_present _bsd_bus_child_present +#define bus_child_present_desc _bsd_bus_child_present_desc +#define bus_child_present_method_default _bsd_bus_child_present_method_default +#define bus_config_intr_desc _bsd_bus_config_intr_desc +#define bus_config_intr_method_default _bsd_bus_config_intr_method_default +#define bus_current_pass _bsd_bus_current_pass +#define bus_data_generation_check _bsd_bus_data_generation_check +#define bus_data_generation_update _bsd_bus_data_generation_update +#define bus_deactivate_resource _bsd_bus_deactivate_resource +#define bus_deactivate_resource_desc _bsd_bus_deactivate_resource_desc +#define bus_deactivate_resource_method_default _bsd_bus_deactivate_resource_method_default +#define bus_delete_resource _bsd_bus_delete_resource +#define bus_delete_resource_desc _bsd_bus_delete_resource_desc +#define bus_delete_resource_method_default _bsd_bus_delete_resource_method_default +#define bus_describe_intr _bsd_bus_describe_intr +#define bus_describe_intr_desc _bsd_bus_describe_intr_desc +#define bus_describe_intr_method_default _bsd_bus_describe_intr_method_default +#define busdma_lock_mutex _bsd_busdma_lock_mutex +#define bus_dmamap_create _bsd_bus_dmamap_create +#define bus_dmamap_destroy _bsd_bus_dmamap_destroy +#define bus_dmamap_load _bsd_bus_dmamap_load +#define _bus_dmamap_sync _bsd__bus_dmamap_sync +#define _bus_dmamap_unload _bsd__bus_dmamap_unload +#define bus_dmamem_alloc _bsd_bus_dmamem_alloc +#define bus_dmamem_free _bsd_bus_dmamem_free +#define bus_dma_tag_create _bsd_bus_dma_tag_create +#define bus_dma_tag_destroy _bsd_bus_dma_tag_destroy +#define bus_driver_added_desc _bsd_bus_driver_added_desc +#define bus_driver_added_method_default _bsd_bus_driver_added_method_default +#define bus_generic_add_child _bsd_bus_generic_add_child +#define bus_generic_attach _bsd_bus_generic_attach +#define bus_generic_bind_intr _bsd_bus_generic_bind_intr +#define bus_generic_child_present _bsd_bus_generic_child_present +#define bus_generic_config_intr _bsd_bus_generic_config_intr +#define bus_generic_describe_intr _bsd_bus_generic_describe_intr +#define bus_generic_detach _bsd_bus_generic_detach +#define bus_generic_driver_added _bsd_bus_generic_driver_added +#define bus_generic_get_dma_tag _bsd_bus_generic_get_dma_tag +#define bus_generic_get_resource_list _bsd_bus_generic_get_resource_list +#define bus_generic_new_pass _bsd_bus_generic_new_pass +#define bus_generic_print_child _bsd_bus_generic_print_child +#define bus_generic_probe _bsd_bus_generic_probe +#define bus_generic_read_ivar _bsd_bus_generic_read_ivar +#define bus_generic_resume _bsd_bus_generic_resume +#define bus_generic_setup_intr _bsd_bus_generic_setup_intr +#define bus_generic_shutdown _bsd_bus_generic_shutdown +#define bus_generic_suspend _bsd_bus_generic_suspend +#define bus_generic_teardown_intr _bsd_bus_generic_teardown_intr +#define bus_generic_write_ivar _bsd_bus_generic_write_ivar +#define bus_get_dma_tag _bsd_bus_get_dma_tag +#define bus_get_dma_tag_desc _bsd_bus_get_dma_tag_desc +#define bus_get_dma_tag_method_default _bsd_bus_get_dma_tag_method_default +#define bus_get_resource _bsd_bus_get_resource +#define bus_get_resource_count _bsd_bus_get_resource_count +#define bus_get_resource_desc _bsd_bus_get_resource_desc +#define bus_get_resource_list_desc _bsd_bus_get_resource_list_desc +#define bus_get_resource_list_method_default _bsd_bus_get_resource_list_method_default +#define bus_get_resource_method_default _bsd_bus_get_resource_method_default +#define bus_get_resource_start _bsd_bus_get_resource_start +#define bus_hint_device_unit_desc _bsd_bus_hint_device_unit_desc +#define bus_hint_device_unit_method_default _bsd_bus_hint_device_unit_method_default +#define bus_hinted_child_desc _bsd_bus_hinted_child_desc +#define bus_hinted_child_method_default _bsd_bus_hinted_child_method_default +#define bus_new_pass_desc _bsd_bus_new_pass_desc +#define bus_new_pass_method_default _bsd_bus_new_pass_method_default +#define bus_print_child_desc _bsd_bus_print_child_desc +#define bus_print_child_footer _bsd_bus_print_child_footer +#define bus_print_child_header _bsd_bus_print_child_header +#define bus_print_child_method_default _bsd_bus_print_child_method_default +#define bus_probe_nomatch_desc _bsd_bus_probe_nomatch_desc +#define bus_probe_nomatch_method_default _bsd_bus_probe_nomatch_method_default +#define bus_read_ivar_desc _bsd_bus_read_ivar_desc +#define bus_read_ivar_method_default _bsd_bus_read_ivar_method_default +#define bus_release_resource _bsd_bus_release_resource +#define bus_release_resource_desc _bsd_bus_release_resource_desc +#define bus_release_resource_method_default _bsd_bus_release_resource_method_default +#define bus_release_resources _bsd_bus_release_resources +#define bus_remap_intr_desc _bsd_bus_remap_intr_desc +#define bus_remap_intr_method_default _bsd_bus_remap_intr_method_default +#define bus_set_pass _bsd_bus_set_pass +#define bus_set_resource _bsd_bus_set_resource +#define bus_set_resource_desc _bsd_bus_set_resource_desc +#define bus_set_resource_method_default _bsd_bus_set_resource_method_default +#define bus_setup_intr _bsd_bus_setup_intr +#define bus_setup_intr_desc _bsd_bus_setup_intr_desc +#define bus_setup_intr_method_default _bsd_bus_setup_intr_method_default +#define bus_teardown_intr _bsd_bus_teardown_intr +#define bus_teardown_intr_desc _bsd_bus_teardown_intr_desc +#define bus_teardown_intr_method_default _bsd_bus_teardown_intr_method_default +#define bus_write_ivar_desc _bsd_bus_write_ivar_desc +#define bus_write_ivar_method_default _bsd_bus_write_ivar_method_default +#define cam_fetch_status_entry _bsd_cam_fetch_status_entry +#define cam_quirkmatch _bsd_cam_quirkmatch +#define cam_sim_alloc _bsd_cam_sim_alloc +#define cam_sim_free _bsd_cam_sim_free +#define cam_simq_alloc _bsd_cam_simq_alloc +#define cam_simq_free _bsd_cam_simq_free +#define cam_status_table _bsd_cam_status_table +#define cam_strmatch _bsd_cam_strmatch +#define cam_strvis _bsd_cam_strvis +#define cold _bsd_cold +#define copyin _bsd_copyin +#define copyout _bsd_copyout +#define critical_enter _bsd_critical_enter +#define critical_exit _bsd_critical_exit +#define cv_broadcastpri _bsd_cv_broadcastpri +#define cv_destroy _bsd_cv_destroy +#define cv_init _bsd_cv_init +#define cv_signal _bsd_cv_signal +#define _cv_timedwait _bsd__cv_timedwait +#define _cv_wait _bsd__cv_wait +#define _cv_wait_unlock _bsd__cv_wait_unlock +#define DELAY _bsd_DELAY +#define devclass_create _bsd_devclass_create +#define devclass_find _bsd_devclass_find +#define devclass_find_free_unit _bsd_devclass_find_free_unit +#define devclass_get_count _bsd_devclass_get_count +#define devclass_get_device _bsd_devclass_get_device +#define devclass_get_devices _bsd_devclass_get_devices +#define devclass_get_drivers _bsd_devclass_get_drivers +#define devclass_get_maxunit _bsd_devclass_get_maxunit +#define devclass_get_name _bsd_devclass_get_name +#define devclass_get_parent _bsd_devclass_get_parent +#define devclass_get_softc _bsd_devclass_get_softc +#define devclass_set_parent _bsd_devclass_set_parent +#define devctl_notify _bsd_devctl_notify +#define devctl_notify_f _bsd_devctl_notify_f +#define devctl_queue_data _bsd_devctl_queue_data +#define devctl_queue_data_f _bsd_devctl_queue_data_f +#define device_add_child _bsd_device_add_child +#define device_add_child_ordered _bsd_device_add_child_ordered +#define device_attach _bsd_device_attach +#define device_attach_desc _bsd_device_attach_desc +#define device_attach_method_default _bsd_device_attach_method_default +#define device_busy _bsd_device_busy +#define device_delete_all_children _bsd_device_delete_all_children +#define device_delete_child _bsd_device_delete_child +#define device_detach _bsd_device_detach +#define device_detach_desc _bsd_device_detach_desc +#define device_detach_method_default _bsd_device_detach_method_default +#define device_disable _bsd_device_disable +#define device_enable _bsd_device_enable +#define device_find_child _bsd_device_find_child +#define device_get_children _bsd_device_get_children +#define device_get_desc _bsd_device_get_desc +#define device_get_devclass _bsd_device_get_devclass +#define device_get_driver _bsd_device_get_driver +#define device_get_flags _bsd_device_get_flags +#define device_get_ivars _bsd_device_get_ivars +#define device_get_name _bsd_device_get_name +#define device_get_nameunit _bsd_device_get_nameunit +#define device_get_parent _bsd_device_get_parent +#define device_get_softc _bsd_device_get_softc +#define device_get_state _bsd_device_get_state +#define device_get_unit _bsd_device_get_unit +#define device_identify_desc _bsd_device_identify_desc +#define device_identify_method_default _bsd_device_identify_method_default +#define device_is_alive _bsd_device_is_alive +#define device_is_attached _bsd_device_is_attached +#define device_is_enabled _bsd_device_is_enabled +#define device_is_quiet _bsd_device_is_quiet +#define device_printf _bsd_device_printf +#define device_print_prettyname _bsd_device_print_prettyname +#define device_probe _bsd_device_probe +#define device_probe_and_attach _bsd_device_probe_and_attach +#define device_probe_child _bsd_device_probe_child +#define device_probe_desc _bsd_device_probe_desc +#define device_probe_method_default _bsd_device_probe_method_default +#define device_quiesce _bsd_device_quiesce +#define device_quiesce_desc _bsd_device_quiesce_desc +#define device_quiesce_method_default _bsd_device_quiesce_method_default +#define device_quiet _bsd_device_quiet +#define device_resume_desc _bsd_device_resume_desc +#define device_resume_method_default _bsd_device_resume_method_default +#define device_set_desc _bsd_device_set_desc +#define device_set_desc_copy _bsd_device_set_desc_copy +#define device_set_devclass _bsd_device_set_devclass +#define device_set_driver _bsd_device_set_driver +#define device_set_flags _bsd_device_set_flags +#define device_set_ivars _bsd_device_set_ivars +#define device_set_softc _bsd_device_set_softc +#define device_set_unit _bsd_device_set_unit +#define device_set_usb_desc _bsd_device_set_usb_desc +#define device_shutdown _bsd_device_shutdown +#define device_shutdown_desc _bsd_device_shutdown_desc +#define device_shutdown_method_default _bsd_device_shutdown_method_default +#define device_suspend_desc _bsd_device_suspend_desc +#define device_suspend_method_default _bsd_device_suspend_method_default +#define device_unbusy _bsd_device_unbusy +#define device_verbose _bsd_device_verbose +#define driver_module_handler _bsd_driver_module_handler +#define dpcpu_off _bsd_dpcpu_off +#define ehci_bus_methods _bsd_ehci_bus_methods +#define ehci_detach _bsd_ehci_detach +#define ehci_device_bulk_methods _bsd_ehci_device_bulk_methods +#define ehci_device_ctrl_methods _bsd_ehci_device_ctrl_methods +#define ehci_device_intr_methods _bsd_ehci_device_intr_methods +#define ehci_device_isoc_fs_methods _bsd_ehci_device_isoc_fs_methods +#define ehci_device_isoc_hs_methods _bsd_ehci_device_isoc_hs_methods +#define ehci_init _bsd_ehci_init +#define ehci_interrupt _bsd_ehci_interrupt +#define ehci_iterate_hw_softc _bsd_ehci_iterate_hw_softc +#define ehci_reset _bsd_ehci_reset +#define ehci_resume _bsd_ehci_resume +#define ehci_shutdown _bsd_ehci_shutdown +#define ehci_suspend _bsd_ehci_suspend +#define free _bsd_free +#define hid_end_parse _bsd_hid_end_parse +#define hid_get_data _bsd_hid_get_data +#define hid_get_data_unsigned _bsd_hid_get_data_unsigned +#define hid_get_descriptor_from_usb _bsd_hid_get_descriptor_from_usb +#define hid_get_item _bsd_hid_get_item +#define hid_is_collection _bsd_hid_is_collection +#define hid_locate _bsd_hid_locate +#define hid_report_size _bsd_hid_report_size +#define hid_start_parse _bsd_hid_start_parse +#define hogticks _bsd_hogticks +#define ipsec_set_policy _bsd_ipsec_set_policy +#define kernel_sysctl _bsd_kernel_sysctl +#define kobj_class_compile _bsd_kobj_class_compile +#define kobj_class_compile_static _bsd_kobj_class_compile_static +#define kobj_class_free _bsd_kobj_class_free +#define kobj_create _bsd_kobj_create +#define kobj_delete _bsd_kobj_delete +#define kobj_error_method _bsd_kobj_error_method +#define kobj_init _bsd_kobj_init +#define kobj_lookup_method _bsd_kobj_lookup_method +#define kproc_create _bsd_kproc_create +#define kproc_exit _bsd_kproc_exit +#define kproc_kthread_add _bsd_kproc_kthread_add +#define kproc_start _bsd_kproc_start +#define kthread_add _bsd_kthread_add +#define kthread_exit _bsd_kthread_exit +#define kthread_start _bsd_kthread_start +#define kthread_suspend _bsd_kthread_suspend +#define malloc _bsd_malloc +#define malloc_init _bsd_malloc_init +#define malloc_uninit _bsd_malloc_uninit +#define maxproc _bsd_maxproc +#define maxfilesperproc _bsd_maxfilesperproc +#define M_CAMSIM _bsd_M_CAMSIM +#define M_DEVBUF _bsd_M_DEVBUF +#define M_SOCKET _bsd_M_SOCKET +#define mi_startup _bsd_mi_startup +#define module_lookupbyname _bsd_module_lookupbyname +#define module_register _bsd_module_register +#define module_register_init _bsd_module_register_init +#define module_release _bsd_module_release +#define M_TEMP _bsd_M_TEMP +#define mtx_destroy _bsd_mtx_destroy +#define mtx_init _bsd_mtx_init +#define _mtx_lock_flags _bsd__mtx_lock_flags +#define mtx_owned _bsd_mtx_owned +#define mtx_recursed _bsd_mtx_recursed +#define mtx_sysinit _bsd_mtx_sysinit +#define _mtx_trylock _bsd__mtx_trylock +#define _mtx_unlock_flags _bsd__mtx_unlock_flags +#define M_USB _bsd_M_USB +#define M_USBDEV _bsd_M_USBDEV +#define M_USBHC _bsd_M_USBHC +#define mutex_init _bsd_mutex_init +#define ngroups_max _bsd_ngroups_max +#define null_class _bsd_null_class +#define num_cam_status_entries _bsd_num_cam_status_entries +#define ohci_bus_methods _bsd_ohci_bus_methods +#define ohci_detach _bsd_ohci_detach +#define ohci_device_bulk_methods _bsd_ohci_device_bulk_methods +#define ohci_device_ctrl_methods _bsd_ohci_device_ctrl_methods +#define ohci_device_intr_methods _bsd_ohci_device_intr_methods +#define ohci_device_isoc_methods _bsd_ohci_device_isoc_methods +#define ohci_init _bsd_ohci_init +#define ohci_interrupt _bsd_ohci_interrupt +#define ohci_iterate_hw_softc _bsd_ohci_iterate_hw_softc +#define ohci_resume _bsd_ohci_resume +#define ohci_suspend _bsd_ohci_suspend +#define panic _bsd_panic +#define pause _bsd_pause +#define psignal _bsd_psignal +#define root_bus_configure _bsd_root_bus_configure +#define scsi_inquiry _bsd_scsi_inquiry +#define scsi_print_inquiry _bsd_scsi_print_inquiry +#define scsi_read_capacity _bsd_scsi_read_capacity +#define scsi_read_write _bsd_scsi_read_write +#define scsi_test_unit_ready _bsd_scsi_test_unit_ready +#define selrecord _bsd_selrecord +#define seltdfini _bsd_seltdfini +#define selwakeup _bsd_selwakeup +#define selwakeuppri _bsd_selwakeuppri +#define strdup _bsd_strdup +#define sx_destroy _bsd_sx_destroy +#define _sx_downgrade _bsd__sx_downgrade +#define sx_init_flags _bsd_sx_init_flags +#define sx_sysinit _bsd_sx_sysinit +#define _sx_try_upgrade _bsd__sx_try_upgrade +#define _sx_try_xlock _bsd__sx_try_xlock +#define _sx_xlock _bsd__sx_xlock +#define sx_xlocked _bsd_sx_xlocked +#define _sx_xunlock _bsd__sx_xunlock +#define sysctl_add_oid _bsd_sysctl_add_oid +#define sysctl_ctx_entry_add _bsd_sysctl_ctx_entry_add +#define sysctl_ctx_entry_del _bsd_sysctl_ctx_entry_del +#define sysctl_ctx_entry_find _bsd_sysctl_ctx_entry_find +#define sysctl_ctx_free _bsd_sysctl_ctx_free +#define sysctl_ctx_init _bsd_sysctl_ctx_init +#define sysctl_find_oid _bsd_sysctl_find_oid +#define sysctl_handle_int _bsd_sysctl_handle_int +#define sysctl_handle_long _bsd_sysctl_handle_long +#define sysctl_handle_opaque _bsd_sysctl_handle_opaque +#define sysctl_handle_quad _bsd_sysctl_handle_quad +#define sysctl_handle_string _bsd_sysctl_handle_string +#define sysctl_lock _bsd_sysctl_lock +#define sysctl_move_oid _bsd_sysctl_move_oid +#define sysctl_msec_to_ticks _bsd_sysctl_msec_to_ticks +#define sysctlnametomib _bsd_sysctlnametomib +#define sysctl_register_oid _bsd_sysctl_register_oid +#define sysctl_remove_oid _bsd_sysctl_remove_oid +#define sysctl_rename_oid _bsd_sysctl_rename_oid +#define sysctl_unlock _bsd_sysctl_unlock +#define sysctl_unregister_oid _bsd_sysctl_unregister_oid +#define uhub_root_intr _bsd_uhub_root_intr +#define usb_alloc_device _bsd_usb_alloc_device +#define usb_alloc_mbufs _bsd_usb_alloc_mbufs +#define usb_bdma_done_event _bsd_usb_bdma_done_event +#define usb_bdma_post_sync _bsd_usb_bdma_post_sync +#define usb_bdma_pre_sync _bsd_usb_bdma_pre_sync +#define usb_bdma_work_loop _bsd_usb_bdma_work_loop +#define usb_bus_mem_alloc_all _bsd_usb_bus_mem_alloc_all +#define usb_bus_mem_flush_all _bsd_usb_bus_mem_flush_all +#define usb_bus_mem_free_all _bsd_usb_bus_mem_free_all +#define usb_bus_port_get_device _bsd_usb_bus_port_get_device +#define usb_bus_port_set_device _bsd_usb_bus_port_set_device +#define usb_bus_powerd _bsd_usb_bus_powerd +#define usb_bus_power_update _bsd_usb_bus_power_update +#define usb_bus_unload _bsd_usb_bus_unload +#define usb_command_wrapper _bsd_usb_command_wrapper +#define usb_config_parse _bsd_usb_config_parse +#define usbd_clear_data_toggle _bsd_usbd_clear_data_toggle +#define usbd_clear_stall_callback _bsd_usbd_clear_stall_callback +#define usbd_copy_in _bsd_usbd_copy_in +#define usbd_copy_out _bsd_usbd_copy_out +#define usbd_ctrl_transfer_setup _bsd_usbd_ctrl_transfer_setup +#define usbd_device_attached _bsd_usbd_device_attached +#define usbd_do_request_callback _bsd_usbd_do_request_callback +#define usbd_do_request_flags _bsd_usbd_do_request_flags +#define usbd_do_request_proc _bsd_usbd_do_request_proc +#define usb_debug _bsd_usb_debug +#define usbd_enum_is_locked _bsd_usbd_enum_is_locked +#define usbd_enum_lock _bsd_usbd_enum_lock +#define usbd_enum_unlock _bsd_usbd_enum_unlock +#define usbd_errstr _bsd_usbd_errstr +#define usb_desc_foreach _bsd_usb_desc_foreach +#define usb_detach_device _bsd_usb_detach_device +#define usb_devclass_ptr _bsd_usb_devclass_ptr +#define usb_devinfo _bsd_usb_devinfo +#define usbd_filter_power_mode _bsd_usbd_filter_power_mode +#define usbd_find_descriptor _bsd_usbd_find_descriptor +#define usbd_frame_zero _bsd_usbd_frame_zero +#define usbd_fs_isoc_schedule_alloc _bsd_usbd_fs_isoc_schedule_alloc +#define usbd_fs_isoc_schedule_init_all _bsd_usbd_fs_isoc_schedule_init_all +#define usbd_fs_isoc_schedule_isoc_time_expand _bsd_usbd_fs_isoc_schedule_isoc_time_expand +#define usbd_get_bus_index _bsd_usbd_get_bus_index +#define usbd_get_config_descriptor _bsd_usbd_get_config_descriptor +#define usbd_get_device_descriptor _bsd_usbd_get_device_descriptor +#define usbd_get_device_index _bsd_usbd_get_device_index +#define usbd_get_dma_delay _bsd_usbd_get_dma_delay +#define usbd_get_endpoint _bsd_usbd_get_endpoint +#define usbd_get_ep_by_addr _bsd_usbd_get_ep_by_addr +#define usbd_get_iface _bsd_usbd_get_iface +#define usbd_get_interface_altindex _bsd_usbd_get_interface_altindex +#define usbd_get_interface_descriptor _bsd_usbd_get_interface_descriptor +#define usbd_get_isoc_fps _bsd_usbd_get_isoc_fps +#define usbd_get_mode _bsd_usbd_get_mode +#define usbd_get_no_alts _bsd_usbd_get_no_alts +#define usbd_get_no_descriptors _bsd_usbd_get_no_descriptors +#define usbd_get_page _bsd_usbd_get_page +#define usbd_get_speed _bsd_usbd_get_speed +#define usbd_interface_count _bsd_usbd_interface_count +#define usbd_lookup_id_by_info _bsd_usbd_lookup_id_by_info +#define usbd_lookup_id_by_uaa _bsd_usbd_lookup_id_by_uaa +#define usb_dma_tag_find _bsd_usb_dma_tag_find +#define usb_dma_tag_setup _bsd_usb_dma_tag_setup +#define usb_dma_tag_unsetup _bsd_usb_dma_tag_unsetup +#define usb_do_clear_stall_callback _bsd_usb_do_clear_stall_callback +#define usbd_pipe_enter _bsd_usbd_pipe_enter +#define usbd_pipe_start _bsd_usbd_pipe_start +#define usbd_req_clear_device_feature _bsd_usbd_req_clear_device_feature +#define usbd_req_clear_hub_feature _bsd_usbd_req_clear_hub_feature +#define usbd_req_clear_port_feature _bsd_usbd_req_clear_port_feature +#define usbd_req_get_alt_interface_no _bsd_usbd_req_get_alt_interface_no +#define usbd_req_get_config _bsd_usbd_req_get_config +#define usbd_req_get_config_desc _bsd_usbd_req_get_config_desc +#define usbd_req_get_config_desc_full _bsd_usbd_req_get_config_desc_full +#define usbd_req_get_desc _bsd_usbd_req_get_desc +#define usbd_req_get_descriptor_ptr _bsd_usbd_req_get_descriptor_ptr +#define usbd_req_get_device_desc _bsd_usbd_req_get_device_desc +#define usbd_req_get_device_status _bsd_usbd_req_get_device_status +#define usbd_req_get_hid_desc _bsd_usbd_req_get_hid_desc +#define usbd_req_get_hub_descriptor _bsd_usbd_req_get_hub_descriptor +#define usbd_req_get_hub_status _bsd_usbd_req_get_hub_status +#define usbd_req_get_port_status _bsd_usbd_req_get_port_status +#define usbd_req_get_report _bsd_usbd_req_get_report +#define usbd_req_get_report_descriptor _bsd_usbd_req_get_report_descriptor +#define usbd_req_get_string_any _bsd_usbd_req_get_string_any +#define usbd_req_get_string_desc _bsd_usbd_req_get_string_desc +#define usbd_req_re_enumerate _bsd_usbd_req_re_enumerate +#define usbd_req_reset_port _bsd_usbd_req_reset_port +#define usbd_req_set_address _bsd_usbd_req_set_address +#define usbd_req_set_alt_interface_no _bsd_usbd_req_set_alt_interface_no +#define usbd_req_set_config _bsd_usbd_req_set_config +#define usbd_req_set_device_feature _bsd_usbd_req_set_device_feature +#define usbd_req_set_hub_feature _bsd_usbd_req_set_hub_feature +#define usbd_req_set_idle _bsd_usbd_req_set_idle +#define usbd_req_set_port_feature _bsd_usbd_req_set_port_feature +#define usbd_req_set_protocol _bsd_usbd_req_set_protocol +#define usbd_req_set_report _bsd_usbd_req_set_report +#define usbd_set_alt_interface_index _bsd_usbd_set_alt_interface_index +#define usbd_set_config_index _bsd_usbd_set_config_index +#define usbd_set_endpoint_stall _bsd_usbd_set_endpoint_stall +#define usbd_set_parent_iface _bsd_usbd_set_parent_iface +#define usbd_set_power_mode _bsd_usbd_set_power_mode +#define usbd_sr_lock _bsd_usbd_sr_lock +#define usbd_sr_unlock _bsd_usbd_sr_unlock +#define usbd_transfer_clear_stall _bsd_usbd_transfer_clear_stall +#define usbd_transfer_dequeue _bsd_usbd_transfer_dequeue +#define usbd_transfer_done _bsd_usbd_transfer_done +#define usbd_transfer_drain _bsd_usbd_transfer_drain +#define usbd_transfer_enqueue _bsd_usbd_transfer_enqueue +#define usbd_transfer_pending _bsd_usbd_transfer_pending +#define usbd_transfer_poll _bsd_usbd_transfer_poll +#define usbd_transfer_power_ref _bsd_usbd_transfer_power_ref +#define usbd_transfer_setup _bsd_usbd_transfer_setup +#define usbd_transfer_setup_sub _bsd_usbd_transfer_setup_sub +#define usbd_transfer_setup_sub_malloc _bsd_usbd_transfer_setup_sub_malloc +#define usbd_transfer_start _bsd_usbd_transfer_start +#define usbd_transfer_stop _bsd_usbd_transfer_stop +#define usbd_transfer_submit _bsd_usbd_transfer_submit +#define usbd_transfer_timeout_ms _bsd_usbd_transfer_timeout_ms +#define usbd_transfer_unsetup _bsd_usbd_transfer_unsetup +#define usb_dump_device _bsd_usb_dump_device +#define usb_dump_endpoint _bsd_usb_dump_endpoint +#define usb_dump_iface _bsd_usb_dump_iface +#define usb_dump_queue _bsd_usb_dump_queue +#define usb_dump_xfer _bsd_usb_dump_xfer +#define usbd_xfer_clr_flag _bsd_usbd_xfer_clr_flag +#define usbd_xfer_frame_data _bsd_usbd_xfer_frame_data +#define usbd_xfer_frame_len _bsd_usbd_xfer_frame_len +#define usbd_xfer_get_fps_shift _bsd_usbd_xfer_get_fps_shift +#define usbd_xfer_get_frame _bsd_usbd_xfer_get_frame +#define usbd_xfer_get_priv _bsd_usbd_xfer_get_priv +#define usbd_xfer_get_timestamp _bsd_usbd_xfer_get_timestamp +#define usbd_xfer_is_stalled _bsd_usbd_xfer_is_stalled +#define usbd_xfer_max_framelen _bsd_usbd_xfer_max_framelen +#define usbd_xfer_max_frames _bsd_usbd_xfer_max_frames +#define usbd_xfer_max_len _bsd_usbd_xfer_max_len +#define usbd_xfer_set_flag _bsd_usbd_xfer_set_flag +#define usbd_xfer_set_frame_data _bsd_usbd_xfer_set_frame_data +#define usbd_xfer_set_frame_len _bsd_usbd_xfer_set_frame_len +#define usbd_xfer_set_frame_offset _bsd_usbd_xfer_set_frame_offset +#define usbd_xfer_set_frames _bsd_usbd_xfer_set_frames +#define usbd_xfer_set_interval _bsd_usbd_xfer_set_interval +#define usbd_xfer_set_priv _bsd_usbd_xfer_set_priv +#define usbd_xfer_set_stall _bsd_usbd_xfer_set_stall +#define usbd_xfer_set_timeout _bsd_usbd_xfer_set_timeout +#define usbd_xfer_softc _bsd_usbd_xfer_softc +#define usbd_xfer_state _bsd_usbd_xfer_state +#define usbd_xfer_status _bsd_usbd_xfer_status +#define usb_edesc_foreach _bsd_usb_edesc_foreach +#define usb_endpoint_foreach _bsd_usb_endpoint_foreach +#define usb_free_device _bsd_usb_free_device +#define usb_get_manufacturer _bsd_usb_get_manufacturer +#define usb_get_product _bsd_usb_get_product +#define usb_get_serial _bsd_usb_get_serial +#define usb_handle_request_callback _bsd_usb_handle_request_callback +#define usb_handle_request_desc _bsd_usb_handle_request_desc +#define usb_handle_request_method_default _bsd_usb_handle_request_method_default +#define usb_hs_bandwidth_alloc _bsd_usb_hs_bandwidth_alloc +#define usb_hs_bandwidth_free _bsd_usb_hs_bandwidth_free +#define usb_idesc_foreach _bsd_usb_idesc_foreach +#define usb_iface_is_cdrom _bsd_usb_iface_is_cdrom +#define usb_isoc_time_expand _bsd_usb_isoc_time_expand +#define usb_make_str_desc _bsd_usb_make_str_desc +#define usb_msc_eject _bsd_usb_msc_eject +#define usb_needs_explore _bsd_usb_needs_explore +#define usb_needs_explore_all _bsd_usb_needs_explore_all +#define usb_pause_mtx _bsd_usb_pause_mtx +#define usb_pc_alloc_mem _bsd_usb_pc_alloc_mem +#define usb_pc_cpu_flush _bsd_usb_pc_cpu_flush +#define usb_pc_cpu_invalidate _bsd_usb_pc_cpu_invalidate +#define usb_pc_dmamap_create _bsd_usb_pc_dmamap_create +#define usb_pc_dmamap_destroy _bsd_usb_pc_dmamap_destroy +#define usb_pc_free_mem _bsd_usb_pc_free_mem +#define usb_pc_load_mem _bsd_usb_pc_load_mem +#define usb_peer_can_wakeup _bsd_usb_peer_can_wakeup +#define usb_printbcd _bsd_usb_printbcd +#define usb_probe_and_attach _bsd_usb_probe_and_attach +#define usb_proc_create _bsd_usb_proc_create +#define usb_proc_drain _bsd_usb_proc_drain +#define usb_proc_free _bsd_usb_proc_free +#define usb_proc_is_gone _bsd_usb_proc_is_gone +#define usb_proc_msignal _bsd_usb_proc_msignal +#define usb_proc_mwait _bsd_usb_proc_mwait +#define usb_proc_rewakeup _bsd_usb_proc_rewakeup +#define usb_quirk_ioctl_p _bsd_usb_quirk_ioctl_p +#define usb_quirk_unload _bsd_usb_quirk_unload +#define usb_reset_iface_endpoints _bsd_usb_reset_iface_endpoints +#define usb_set_device_state _bsd_usb_set_device_state +#define usb_statestr _bsd_usb_statestr +#define usb_suspend_resume _bsd_usb_suspend_resume +#define usb_temp_get_desc_p _bsd_usb_temp_get_desc_p +#define usb_template _bsd_usb_template +#define usb_temp_setup_by_index_p _bsd_usb_temp_setup_by_index_p +#define usb_temp_unload _bsd_usb_temp_unload +#define usb_temp_unsetup_p _bsd_usb_temp_unsetup_p +#define usb_test_quirk _bsd_usb_test_quirk +#define usb_test_quirk_p _bsd_usb_test_quirk_p +#define usb_trim_spaces _bsd_usb_trim_spaces +#define xpt_bus_deregister _bsd_xpt_bus_deregister +#define xpt_bus_register _bsd_xpt_bus_register +#define xpt_done _bsd_xpt_done + +#endif /* _RTEMS_BSD_MACHINE_RTEMS_BSD_SYMBOLS_H_ */ diff --git a/rtemsbsd/include/machine/rtems-bsd-sysinit.h b/rtemsbsd/include/machine/rtems-bsd-sysinit.h new file mode 100644 index 00000000..0e31d3ec --- /dev/null +++ b/rtemsbsd/include/machine/rtems-bsd-sysinit.h @@ -0,0 +1,96 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + */ + +/* + * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_SYSINIT_H_ +#define _RTEMS_BSD_MACHINE_RTEMS_BSD_SYSINIT_H_ + +#include <freebsd/sys/cdefs.h> +#include <freebsd/sys/queue.h> +#include <freebsd/sys/kernel.h> + +#define SYSINIT_NEED_FREEBSD_CORE \ + SYSINIT_REFERENCE(configure1); \ + SYSINIT_REFERENCE(module); \ + SYSINIT_REFERENCE(kobj); \ + SYSINIT_REFERENCE(linker_kernel); \ + SYSINIT_MODULE_REFERENCE(rootbus); \ + SYSINIT_DRIVER_REFERENCE(nexus, root) + +#define SYSINIT_NEED_USB_CORE \ + SYSINIT_REFERENCE(usb_quirk_init); \ + SYSINIT_DRIVER_REFERENCE(uhub, usbus) + +#define SYSINIT_NEED_USB_OHCI \ + SYSINIT_DRIVER_REFERENCE(ohci, nexus); \ + SYSINIT_DRIVER_REFERENCE(usbus, ohci) + +#define SYSINIT_NEED_USB_EHCI \ + SYSINIT_DRIVER_REFERENCE(ehci, nexus); \ + SYSINIT_DRIVER_REFERENCE(usbus, ehci) + +#define SYSINIT_NEED_USB_MASS_STORAGE \ + SYSINIT_DRIVER_REFERENCE(umass, uhub) + +#define SYSINIT_NEED_USB_MOUSE \ + SYSINIT_DRIVER_REFERENCE(umass, uhub) + +#define SYSINIT_NEED_SDHC \ + SYSINIT_DRIVER_REFERENCE(sdhci, nexus); \ + SYSINIT_DRIVER_REFERENCE(mmc, sdhci); \ + SYSINIT_DRIVER_REFERENCE(mmcsd, mmc) + +#define SYSINIT_NEED_PCIB \ + SYSINIT_DRIVER_REFERENCE(legacy, nexus); \ + SYSINIT_DRIVER_REFERENCE(pcib, legacy); \ + SYSINIT_DRIVER_REFERENCE(pci, pcib); + +#define SYSINIT_NEED_NET_IF_BFE \ + SYSINIT_DRIVER_REFERENCE(bfe, pci) + +#define SYSINIT_NEED_NET_IF_RE \ + SYSINIT_DRIVER_REFERENCE(re, pci) + +#define SYSINIT_NEED_NET_IF_EM \ + SYSINIT_DRIVER_REFERENCE(em, pci) + +#define SYSINIT_NEED_NET_IF_IGB \ + SYSINIT_DRIVER_REFERENCE(igb, pci) + +#define SYSINIT_NEED_NET_IF_LEM \ + SYSINIT_DRIVER_REFERENCE(lem, pci) + +#define SYSINIT_NEED_NET_IF_BCE \ + SYSINIT_DRIVER_REFERENCE(bce, pci) + +#define SYSINIT_NEED_NET_IF_BGE \ + SYSINIT_DRIVER_REFERENCE(bge, pci) + +#define SYSINIT_NEED_NET_IF_FXP \ + SYSINIT_DRIVER_REFERENCE(fxp, pci) + +#define SYSINIT_NEED_NET_IF_DC \ + SYSINIT_DRIVER_REFERENCE(dc, pci) + +/* FIXME */ +extern const char *const _bsd_nexus_devices []; + +#endif /* _RTEMS_BSD_MACHINE_RTEMS_BSD_SYSINIT_H_ */ diff --git a/rtemsbsd/include/machine/rtems-bsd-taskqueue.h b/rtemsbsd/include/machine/rtems-bsd-taskqueue.h new file mode 100644 index 00000000..39c6f6e9 --- /dev/null +++ b/rtemsbsd/include/machine/rtems-bsd-taskqueue.h @@ -0,0 +1,84 @@ +/** + * @file + * + * @ingroup rtems_bsd_rtems + * + * @brief TODO. + */ + +/* + * COPYRIGHT (c) 1989-2012. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef RTEMS_TASKQUEUE_H +#define RTEMS_TASKQUEUE_H + +#include <stdarg.h> + +#ifdef __cplusplus +extern "C" { +#endif + +struct taskqueue; + +typedef void (*task_fn)(void *ctxt, int pending); + +/* forwarded 'ctxt' that was passed to taskqueue_create() */ +typedef void (*tq_enq_fn)(void *ctxt); + +struct task { + struct task *ta_next; + int ta_pending; + int ta_priority; + task_fn ta_fn; + void *ta_fn_arg; +}; + +struct taskqueue * +taskqueue_create(const char *name, int mflags, tq_enq_fn, void *ctxt); + +struct taskqueue * +taskqueue_create_fast(const char *name, int mflags, tq_enq_fn, void *ctxt); + +int +taskqueue_enqueue(struct taskqueue *tq, struct task *ta); + +void +taskqueue_thread_enqueue(void *ctxt); + +#define PI_NET 150 +/* Returns 0 on success */ +int +taskqueue_start_threads(struct taskqueue **ptq, int count, int prio, const char *fmt, ...); + +void +taskqueue_drain(struct taskqueue *tq, struct task *ta); + +void +taskqueue_free(struct taskqueue *tq); + +#define TASK_INIT(task, pri, fn, arg) \ + do { \ + (task)->ta_next = 0; \ + (task)->ta_priority = (pri); \ + (task)->ta_pending = 0; \ + (task)->ta_fn = (fn); \ + (task)->ta_fn_arg = (arg); \ + } while (0) + +extern struct taskqueue *taskqueue_fast; + +/* Initialize taskqueue facility [networking must have been initialized already] */ +rtems_id +rtems_taskqueue_initialize(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/rtemsbsd/include/machine/runq.h b/rtemsbsd/include/machine/runq.h new file mode 100644 index 00000000..affc070d --- /dev/null +++ b/rtemsbsd/include/machine/runq.h @@ -0,0 +1,41 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + */ + +/* + * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef _RTEMS_BSD_MACHINE_RUNQ_H_ +#define _RTEMS_BSD_MACHINE_RUNQ_H_ + +#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ +#error "the header file <freebsd/machine/rtems-bsd-config.h> must be included first" +#endif + +#define RQB_LEN 0 +#define RQB_L2BPW 0 +#define RQB_BPW 0 + +#define RQB_BIT(pri) 0 +#define RQB_WORD(pri) 0 + +#define RQB_FFS(word) 0 + +typedef uintptr_t rqb_word_t; + +#endif /* _RTEMS_BSD_MACHINE_RUNQ_H_ */ diff --git a/rtemsbsd/include/machine/signal.h b/rtemsbsd/include/machine/signal.h new file mode 100644 index 00000000..0e71cabb --- /dev/null +++ b/rtemsbsd/include/machine/signal.h @@ -0,0 +1,30 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + */ + +/* + * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef _RTEMS_BSD_MACHINE_SIGNAL_H_ +#define _RTEMS_BSD_MACHINE_SIGNAL_H_ + +#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ +#error "the header file <freebsd/machine/rtems-bsd-config.h> must be included first" +#endif + +#endif /* _RTEMS_BSD_MACHINE_SIGNAL_H_ */ diff --git a/rtemsbsd/include/machine/smp.h b/rtemsbsd/include/machine/smp.h new file mode 100644 index 00000000..936ffd88 --- /dev/null +++ b/rtemsbsd/include/machine/smp.h @@ -0,0 +1 @@ +/* EMPTY */ diff --git a/rtemsbsd/include/machine/stdarg.h b/rtemsbsd/include/machine/stdarg.h new file mode 100644 index 00000000..7535272e --- /dev/null +++ b/rtemsbsd/include/machine/stdarg.h @@ -0,0 +1,30 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + */ + +/* + * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef _RTEMS_BSD_MACHINE_STDARG_H_ +#define _RTEMS_BSD_MACHINE_STDARG_H_ + +#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ +#error "the header file <freebsd/machine/rtems-bsd-config.h> must be included first" +#endif + +#endif /* _RTEMS_BSD_MACHINE_STDARG_H_ */ diff --git a/rtemsbsd/include/machine/ucontext.h b/rtemsbsd/include/machine/ucontext.h new file mode 100644 index 00000000..92d2b5d2 --- /dev/null +++ b/rtemsbsd/include/machine/ucontext.h @@ -0,0 +1,32 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + */ + +/* + * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef _RTEMS_BSD_MACHINE_UCONTEXT_H_ +#define _RTEMS_BSD_MACHINE_UCONTEXT_H_ + +#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ +#error "the header file <freebsd/machine/rtems-bsd-config.h> must be included first" +#endif + +typedef int mcontext_t; + +#endif /* _RTEMS_BSD_MACHINE_UCONTEXT_H_ */ diff --git a/rtemsbsd/include/machine/vm.h b/rtemsbsd/include/machine/vm.h new file mode 100644 index 00000000..936ffd88 --- /dev/null +++ b/rtemsbsd/include/machine/vm.h @@ -0,0 +1 @@ +/* EMPTY */ |