diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-05-05 08:47:39 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-10-23 09:23:59 +0200 |
commit | cd089b9e05aad31244059ba88988afbe1db02e5e (patch) | |
tree | 81d344bb292ff39e60f74ac4df5f1621eca77c05 /rtemsbsd/powerpc | |
parent | Import DPAA driver snapshot (diff) | |
download | rtems-libbsd-cd089b9e05aad31244059ba88988afbe1db02e5e.tar.bz2 |
Linux update to 4.11-rc5
Linux baseline a71c9a1c779f2499fb2afc0553e543f18aff6edf (4.11-rc5).
Diffstat (limited to 'rtemsbsd/powerpc')
26 files changed, 401 insertions, 35 deletions
diff --git a/rtemsbsd/powerpc/include/asm/cache.h b/rtemsbsd/powerpc/include/asm/cache.h index 9dd32cbe..ac4a277f 100644 --- a/rtemsbsd/powerpc/include/asm/cache.h +++ b/rtemsbsd/powerpc/include/asm/cache.h @@ -34,4 +34,6 @@ #define ____cacheline_aligned __cacheline_aligned #endif +#define L1_CACHE_BYTES PPC_DEFAULT_CACHE_LINE_SIZE + #endif /* __ASM_CACHE_H */ diff --git a/rtemsbsd/powerpc/include/linux/bitops.h b/rtemsbsd/powerpc/include/linux/bitops.h index bd712c99..6bed2dfc 100644 --- a/rtemsbsd/powerpc/include/linux/bitops.h +++ b/rtemsbsd/powerpc/include/linux/bitops.h @@ -45,7 +45,7 @@ #define BITS_TO_LONGS(n) howmany((n), BITS_PER_LONG) #define BIT_MASK(nr) (1UL << ((nr) & (BITS_PER_LONG - 1))) #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) -#define GENMASK(lo, hi) (((2UL << ((hi) - (lo))) - 1UL) << (lo)) +#define GENMASK(hi, lo) (((2UL << ((hi) - (lo))) - 1UL) << (lo)) #define BITS_PER_BYTE 8 static inline int diff --git a/rtemsbsd/powerpc/include/linux/compiler.h b/rtemsbsd/powerpc/include/linux/compiler.h index e1d11a47..300287db 100644 --- a/rtemsbsd/powerpc/include/linux/compiler.h +++ b/rtemsbsd/powerpc/include/linux/compiler.h @@ -67,7 +67,6 @@ #define typeof(x) __typeof(x) #define uninitialized_var(x) x = x -#define __read_mostly __attribute__((__section__(".data.read_mostly"))) #define __maybe_unused __unused #define __always_unused __unused #define __must_check __result_use_check diff --git a/rtemsbsd/powerpc/include/linux/cpu.h b/rtemsbsd/powerpc/include/linux/cpu.h new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/rtemsbsd/powerpc/include/linux/cpu.h diff --git a/rtemsbsd/powerpc/include/linux/cpumask.h b/rtemsbsd/powerpc/include/linux/cpumask.h new file mode 100644 index 00000000..b6bf679b --- /dev/null +++ b/rtemsbsd/powerpc/include/linux/cpumask.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2017 embedded brains GmbH + * 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 COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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 _LINUX_CPUMASK_H +#define _LINUX_CPUMASK_H + +#include <rtems.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* FIXME */ +#define for_each_cpu(cpu, mask) \ + for ((cpu) = 0; (cpu) < rtems_get_processor_count(); ++(cpu)) + +/* FIXME */ +#define for_each_cpu_not(cpu, mask) \ + for ((cpu) = 0; (cpu) < rtems_get_processor_count(); ++(cpu)) + +/* FIXME */ +#define for_each_cpu_and(cpu, mask, and) \ + for ((cpu) = 0; (cpu) < rtems_get_processor_count(); ++(cpu)) + +/* FIXME */ +#define for_each_possible_cpu(cpu) \ + for_each_cpu((cpu), 0) + +/* FIXME */ +#define for_each_online_cpu(cpu) \ + for_each_cpu((cpu), 0) + +/* FIXME */ +#define for_each_present_cpu(cpu) \ + for_each_cpu((cpu), 0) + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _LINUX_CPUMASK_H */ diff --git a/rtemsbsd/powerpc/include/fdt_phy.h b/rtemsbsd/powerpc/include/linux/crc32.h index 8d98e9ca..0edaaa07 100644 --- a/rtemsbsd/powerpc/include/fdt_phy.h +++ b/rtemsbsd/powerpc/include/linux/crc32.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 embedded brains GmbH + * Copyright (c) 2017 embedded brains GmbH * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -24,30 +24,25 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _FDT_PHY -#define _FDT_PHY +#ifndef _LINUX_CRC32_H +#define _LINUX_CRC32_H + +#include <linux/types.h> +#include <sys/libkern.h> #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -struct fdt_mdio_device { - int (*read)(struct fdt_mdio_device *dev, int phy, int reg); - int (*write)(struct fdt_mdio_device *dev, int phy, int reg, int val); -}; - -struct fdt_phy_device { - int phy; - struct fdt_mdio_device *mdio_dev; -}; - -struct fdt_phy_device *fdt_phy_obtain(int device_node); +static inline u32 +crc32_le(u32 crc, unsigned char const *buf, size_t size) +{ -void fdt_phy_release(struct fdt_phy_device *phy_dev); + return (crc32_raw(buf, size, crc)); +} #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* _FDT_PHY */ - +#endif /* _LINUX_CRC32_H */ diff --git a/rtemsbsd/powerpc/include/linux/device.h b/rtemsbsd/powerpc/include/linux/device.h index 5ba628ab..4a6bc301 100644 --- a/rtemsbsd/powerpc/include/linux/device.h +++ b/rtemsbsd/powerpc/include/linux/device.h @@ -48,7 +48,7 @@ enum irqreturn { IRQ_NONE = 0, IRQ_HANDLED, IRQ_WAKE_THREAD, }; typedef enum irqreturn irqreturn_t; -#include <stdio.h> +#include <sys/systm.h> #include <linux/ioport.h> #include <linux/of.h> @@ -85,14 +85,20 @@ devm_ioremap(struct device *dev, resource_size_t offset, resource_size_t size) #define devm_alloc_percpu(dev, type) \ devm_kzalloc(dev, sizeof(type) * rtems_get_processor_count(), GFP_KERNEL) +#define dev_crit(dev, fmt, ...) \ + do { (void)dev; printf(fmt, ##__VA_ARGS__); } while (0) + #define dev_err(dev, fmt, ...) \ - do { (void)dev; fprintf(stderr, fmt, ##__VA_ARGS__); } while (0) + do { (void)dev; printf(fmt, ##__VA_ARGS__); } while (0) + +#define dev_dbg(dev, fmt, ...) \ + do { (void)dev; printf(fmt, ##__VA_ARGS__); } while (0) #define dev_warn(dev, fmt, ...) \ - do { (void)dev; fprintf(stderr, fmt, ##__VA_ARGS__); } while (0) + do { (void)dev; printf(fmt, ##__VA_ARGS__); } while (0) #define dev_info(dev, fmt, ...) \ - do { (void)dev; fprintf(stderr, fmt, ##__VA_ARGS__); } while (0) + do { (void)dev; printf(fmt, ##__VA_ARGS__); } while (0) static inline struct device * get_device(struct device *dev) diff --git a/rtemsbsd/powerpc/include/linux/fsl/guts.h b/rtemsbsd/powerpc/include/linux/fsl/guts.h new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/rtemsbsd/powerpc/include/linux/fsl/guts.h diff --git a/rtemsbsd/powerpc/include/linux/genalloc.h b/rtemsbsd/powerpc/include/linux/genalloc.h new file mode 100644 index 00000000..9df0e430 --- /dev/null +++ b/rtemsbsd/powerpc/include/linux/genalloc.h @@ -0,0 +1,130 @@ +/************************************************************************** + +Copyright (c) 2007, 2008 Chelsio Inc. +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. Neither the name of the Chelsio Corporation 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 _LINUX_GENALLOC_H +#define _LINUX_GENALLOC_H + +#include <sys/blist.h> +#include <sys/malloc.h> + +struct gen_pool { + blist_t gen_list; + daddr_t gen_base; + int gen_chunk_shift; + struct mtx gen_lock; +}; + +static inline struct gen_pool * +gen_pool_create(int min_alloc_order, int nid) +{ + struct gen_pool *gp; + + gp = malloc(sizeof(*gp), M_DEVBUF, M_NOWAIT | M_ZERO); + if (gp == NULL) + return (NULL); + + gp->gen_chunk_shift = min_alloc_order; + mtx_init(&gp->gen_lock, "genpool", NULL, MTX_DEF); + return (gp); +} + +static inline int +gen_pool_add_virt(struct gen_pool *gp, daddr_t virt, daddr_t phys, + size_t size, int nid) +{ + + (void)phys; + (void)nid; + + if (gp->gen_base != 0) + return (-ENOMEM); + + gp->gen_list = blist_create(size >> gp->gen_chunk_shift, M_NOWAIT); + if (gp->gen_list == NULL) + return (-ENOMEM); + + gp->gen_base = virt; + blist_free(gp->gen_list, 0, size >> gp->gen_chunk_shift); + return (0); +} + +static inline int +gen_pool_add(struct gen_pool *gp, daddr_t addr, size_t size, int nid) +{ + + return (gen_pool_add_virt(gp, addr, -1, size, nid)); +} + +static inline daddr_t +gen_pool_alloc(struct gen_pool *gp, size_t size) +{ + int chunks; + daddr_t blkno; + + chunks = (size + (1 << gp->gen_chunk_shift) - 1) >> gp->gen_chunk_shift; + mtx_lock(&gp->gen_lock); + blkno = blist_alloc(gp->gen_list, chunks); + mtx_unlock(&gp->gen_lock); + + if (blkno == SWAPBLK_NONE) + return (0); + + return (gp->gen_base + ((1 << gp->gen_chunk_shift) * blkno)); +} + +static inline void +gen_pool_free(struct gen_pool *gp, daddr_t address, size_t size) +{ + int chunks; + daddr_t blkno; + + chunks = (size + (1<<gp->gen_chunk_shift) - 1) >> gp->gen_chunk_shift; + blkno = (address - gp->gen_base) / (1 << gp->gen_chunk_shift); + mtx_lock(&gp->gen_lock); + blist_free(gp->gen_list, blkno, chunks); + mtx_unlock(&gp->gen_lock); +} + +static __inline void +gen_pool_destroy(struct gen_pool *gp) +{ + blist_destroy(gp->gen_list); + free(gp, M_DEVBUF); +} + +static inline struct gen_pool * +devm_gen_pool_create(struct device *dev, int min_alloc_order, int nid, + const char *name) +{ + + (void)dev; + (void)name; + return (gen_pool_create(min_alloc_order, nid)); +} + +#endif /* _LINUX_GENALLOC_H */ diff --git a/rtemsbsd/powerpc/include/linux/ioport.h b/rtemsbsd/powerpc/include/linux/ioport.h index a47b9753..537498ea 100644 --- a/rtemsbsd/powerpc/include/linux/ioport.h +++ b/rtemsbsd/powerpc/include/linux/ioport.h @@ -41,6 +41,13 @@ struct resource { #define IORESOURCE_IRQ 0x00000400 #define IORESOURCE_MEM 0x00000420 +static inline resource_size_t +resource_size(const struct resource *res) +{ + + return (res->end - res->start + 1); +} + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/rtemsbsd/powerpc/include/linux/libfdt_env.h b/rtemsbsd/powerpc/include/linux/libfdt_env.h new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/rtemsbsd/powerpc/include/linux/libfdt_env.h diff --git a/rtemsbsd/powerpc/include/linux/list.h b/rtemsbsd/powerpc/include/linux/list.h index aa5b7e2c..ef2f6bd7 100644 --- a/rtemsbsd/powerpc/include/linux/list.h +++ b/rtemsbsd/powerpc/include/linux/list.h @@ -70,8 +70,6 @@ #include <vm/vm.h> #include <vm/vm_object.h> -#define prefetch(x) - struct list_head { struct list_head *next; struct list_head *prev; diff --git a/rtemsbsd/powerpc/include/linux/mii.h b/rtemsbsd/powerpc/include/linux/mii.h new file mode 100644 index 00000000..c41e9105 --- /dev/null +++ b/rtemsbsd/powerpc/include/linux/mii.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2017 embedded brains GmbH + * 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 COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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 _LINUX_MII_H +#define _LINUX_MII_H + +#include <dev/mii/mii.h> + +#define BMCR_SPEED1000 BMCR_SPEED1 +#define BMCR_SPEED100 BMCR_SPEED0 +#define BMCR_SPEED10 0 +#define BMCR_ANENABLE BMCR_AUTOEN +#define BMCR_ANRESTART BMCR_STARTNEG +#define BMCR_FULLDPLX BMCR_FDX + +#define MII_ADVERTISE MII_ANAR + +#endif /* _LINUX_MII_H */ diff --git a/rtemsbsd/powerpc/include/linux/netdevice.h b/rtemsbsd/powerpc/include/linux/netdevice.h index b96e2d92..19c4e34f 100644 --- a/rtemsbsd/powerpc/include/linux/netdevice.h +++ b/rtemsbsd/powerpc/include/linux/netdevice.h @@ -50,6 +50,8 @@ netdev_priv(struct net_device *net_dev) #define netdev_err(...) do { } while (0) #define netdev_dbg(...) do { } while (0) +#define netif_msg_drv(p) 1 + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/rtemsbsd/powerpc/include/linux/of.h b/rtemsbsd/powerpc/include/linux/of.h index 85a8887b..f7f6f6ec 100644 --- a/rtemsbsd/powerpc/include/linux/of.h +++ b/rtemsbsd/powerpc/include/linux/of.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 embedded brains GmbH + * Copyright (c) 2015, 2017 embedded brains GmbH * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,7 +27,7 @@ #ifndef _LINUX_OF_H #define _LINUX_OF_H -#include <stdbool.h> +#include <linux/types.h> #include <libfdt.h> @@ -59,6 +59,25 @@ of_node_put(struct device_node *dn) const void *of_get_property(const struct device_node *dn, const char *name, int *len); +/* FIXME: If we need the property, then more work is to do */ +#define of_find_property(dn, name, len) of_get_property(dn, name, len) + +int of_property_read_u32_array(const struct device_node *dn, const char *name, + u32 *vals, size_t nz); + +static inline int +of_property_read_u32(const struct device_node *dn, const char *name, u32 *val) +{ + + return (of_property_read_u32_array(dn, name, val, 1)); +} + +struct device_node *of_parse_phandle(struct device_node *dns, + struct device_node *dn, const char *phandle_name, int index); + +int of_count_phandle_with_args(struct device_node *dn, const char *list_name, + const char *cells_name); + bool of_device_is_available(const struct device_node *dn); int of_device_is_compatible(const struct device_node *dn, const char *name); diff --git a/rtemsbsd/powerpc/include/linux/of_mdio.h b/rtemsbsd/powerpc/include/linux/of_mdio.h index e69de29b..12ca3884 100644 --- a/rtemsbsd/powerpc/include/linux/of_mdio.h +++ b/rtemsbsd/powerpc/include/linux/of_mdio.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2017 embedded brains GmbH + * 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 COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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 _LINUX_OF_MDIO_H +#define _LINUX_OF_MDIO_H + +#include <linux/of.h> +#include <linux/phy.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +struct phy_device *of_phy_find_device(struct device_node *dn); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _LINUX_OF_MDIO_H */ diff --git a/rtemsbsd/powerpc/include/linux/of_net.h b/rtemsbsd/powerpc/include/linux/of_net.h index 92ba55e3..84008896 100644 --- a/rtemsbsd/powerpc/include/linux/of_net.h +++ b/rtemsbsd/powerpc/include/linux/of_net.h @@ -33,6 +33,8 @@ extern "C" { #endif /* __cplusplus */ +int of_get_phy_mode(struct device_node *dn); + const void *of_get_mac_address(struct device_node *dn); #ifdef __cplusplus diff --git a/rtemsbsd/powerpc/include/linux/percpu.h b/rtemsbsd/powerpc/include/linux/percpu.h index 73b15a1e..5a189bc2 100644 --- a/rtemsbsd/powerpc/include/linux/percpu.h +++ b/rtemsbsd/powerpc/include/linux/percpu.h @@ -27,6 +27,7 @@ #ifndef _LINUX_PERCPU_H #define _LINUX_PERCPU_H +#include <linux/cpumask.h> #include <linux/threads.h> #include <rtems/score/threaddispatch.h> @@ -41,8 +42,8 @@ extern "C" { #define per_cpu(_designator, _cpu) \ (_designator[_cpu]) -#define this_cpu_ptr(_ptr_designator) \ - (&(*_ptr_designator)[_CPU_SMP_Get_current_processor()]) +#define this_cpu_ptr(_designator) \ + (&_designator[_CPU_SMP_Get_current_processor()]) #define get_cpu_var(_designator) \ (*({ Per_CPU_Control *_cpu_self = _Thread_Dispatch_disable(); \ diff --git a/rtemsbsd/powerpc/include/linux/phy.h b/rtemsbsd/powerpc/include/linux/phy.h index 1ce8965a..0c1991ce 100644 --- a/rtemsbsd/powerpc/include/linux/phy.h +++ b/rtemsbsd/powerpc/include/linux/phy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 embedded brains GmbH + * Copyright (c) 2015, 2017 embedded brains GmbH * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,7 +27,10 @@ #ifndef _LINUX_PHY_H #define _LINUX_PHY_H +#include <sys/queue.h> +#include <linux/device.h> #include <linux/list.h> +#include <linux/netdevice.h> #ifdef __cplusplus extern "C" { @@ -66,6 +69,50 @@ typedef enum { #define SPEED_56000 56000 #define SPEED_100000 100000 +#define SUPPORTED_10000baseT_Full (1U << 0) +#define SUPPORTED_1000baseT_Full (1U << 1) +#define SUPPORTED_100baseT_Full (1U << 2) +#define SUPPORTED_100baseT_Half (1U << 3) +#define SUPPORTED_10baseT_Full (1U << 4) +#define SUPPORTED_10baseT_Half (1U << 5) +#define SUPPORTED_Asym_Pause (1U << 6) +#define SUPPORTED_Autoneg (1U << 7) +#define SUPPORTED_MII (1U << 8) +#define SUPPORTED_Pause (1U << 9) + +struct mdio_bus { + int (*read)(struct mdio_bus *bus, int phy, int reg); + int (*write)(struct mdio_bus *bus, int phy, int reg, int val); + SLIST_ENTRY(mdio_bus) next; + int node; +}; + +struct phy_device { + struct { + struct device dev; + int addr; + struct mdio_bus *bus; + } mdio; +}; + +static inline int +phy_read(struct phy_device *phy_dev, int reg) +{ + struct mdio_bus *mdio_dev; + + mdio_dev = phy_dev->mdio.bus; + return ((*mdio_dev->read)(mdio_dev, phy_dev->mdio.addr, (int)reg)); +} + +static inline int +phy_write(struct phy_device *phy_dev, int reg, int val) +{ + struct mdio_bus *mdio_dev; + + mdio_dev = phy_dev->mdio.bus; + return ((*mdio_dev->write)(mdio_dev, phy_dev->mdio.addr, reg, val)); +} + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/rtemsbsd/powerpc/include/linux/platform_device.h b/rtemsbsd/powerpc/include/linux/platform_device.h index d6374d47..7b65b3d0 100644 --- a/rtemsbsd/powerpc/include/linux/platform_device.h +++ b/rtemsbsd/powerpc/include/linux/platform_device.h @@ -38,11 +38,10 @@ struct platform_device { void *platform_data; }; -struct resource *platform_get_resource_impl(struct platform_device *dev, - unsigned int type, unsigned int num, struct resource *res); +struct resource *platform_get_resource(struct resource *res, + struct platform_device *dev, unsigned int type, unsigned int num); -#define platform_get_resource(dev, type, num) \ - platform_get_resource_impl(dev, type, num, &platform_resource) +int platform_get_irq(struct platform_device *dev, unsigned int num); #ifdef __cplusplus } diff --git a/rtemsbsd/powerpc/include/linux/prefetch.h b/rtemsbsd/powerpc/include/linux/prefetch.h new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/rtemsbsd/powerpc/include/linux/prefetch.h diff --git a/rtemsbsd/powerpc/include/linux/sched/signal.h b/rtemsbsd/powerpc/include/linux/sched/signal.h new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/rtemsbsd/powerpc/include/linux/sched/signal.h diff --git a/rtemsbsd/powerpc/include/linux/slab.h b/rtemsbsd/powerpc/include/linux/slab.h index 8455dc3e..bb849433 100644 --- a/rtemsbsd/powerpc/include/linux/slab.h +++ b/rtemsbsd/powerpc/include/linux/slab.h @@ -33,6 +33,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/kernel.h> #include <sys/malloc.h> #include <vm/uma.h> diff --git a/rtemsbsd/powerpc/include/linux/types.h b/rtemsbsd/powerpc/include/linux/types.h index e52dede6..6af16427 100644 --- a/rtemsbsd/powerpc/include/linux/types.h +++ b/rtemsbsd/powerpc/include/linux/types.h @@ -58,7 +58,7 @@ typedef unsigned gfp_t; typedef uint64_t loff_t; typedef uint64_t resource_size_t; -typedef u64 phys_addr_t; +typedef uint64_t phys_addr_t; #define DECLARE_BITMAP(n, bits) \ unsigned long n[howmany(bits, sizeof(long) * 8)] diff --git a/rtemsbsd/powerpc/include/linux/wait.h b/rtemsbsd/powerpc/include/linux/wait.h index a97f9801..4a60afa6 100644 --- a/rtemsbsd/powerpc/include/linux/wait.h +++ b/rtemsbsd/powerpc/include/linux/wait.h @@ -93,6 +93,7 @@ do { \ } \ } while (0) +#ifndef __rtems__ #define wait_event_interruptible(q, cond) \ ({ \ void *c = &(q).wchan; \ @@ -114,6 +115,13 @@ do { \ } \ -_error; \ }) +#else /* __rtems__ */ +#define wait_event_interruptible(q, cond) \ +({ \ + wait_event(q, cond); \ + 0; \ +}) +#endif /* __rtems__ */ static inline int waitqueue_active(wait_queue_head_t *q) diff --git a/rtemsbsd/powerpc/include/linux/workqueue.h b/rtemsbsd/powerpc/include/linux/workqueue.h index e9a6f5aa..cd1d9ff2 100644 --- a/rtemsbsd/powerpc/include/linux/workqueue.h +++ b/rtemsbsd/powerpc/include/linux/workqueue.h @@ -100,6 +100,8 @@ static inline int queue_work(struct workqueue_struct *q, struct work_struct *wor return !taskqueue_enqueue((q)->taskqueue, &(work)->work_task); } +#define queue_work_on(cpu, q, work) queue_work(q, work) + static inline void _delayed_work_fn(void *arg) { |