dde_linux: update 'fec' driver to version 4.16.3

Fixes #3432
This commit is contained in:
Christian Prochaska 2019-06-21 15:04:03 +02:00 committed by Christian Helmuth
parent 949130d80e
commit 4dafdbd5b7
15 changed files with 906 additions and 278 deletions

View File

@ -2,8 +2,13 @@ linux-x.x.x/drivers/net/ethernet/freescale/fec.h
linux-x.x.x/drivers/net/ethernet/freescale/fec_main.c
linux-x.x.x/drivers/net/ethernet/freescale/fec_ptp.c
linux-x.x.x/drivers/net/phy/mdio_bus.c
linux-x.x.x/drivers/net/phy/mdio_device.c
linux-x.x.x/drivers/net/phy/mdio-boardinfo.c
linux-x.x.x/drivers/net/phy/mdio-boardinfo.h
linux-x.x.x/drivers/net/phy/phy_device.c
linux-x.x.x/drivers/net/phy/phy.c
linux-x.x.x/drivers/net/phy/phy-c45.c
linux-x.x.x/drivers/net/phy/phy-core.c
linux-x.x.x/drivers/net/phy/at803x.c
linux-x.x.x/net/core/skbuff.c
linux-x.x.x/net/ethernet/eth.c
@ -14,21 +19,26 @@ linux-x.x.x/include/asm-generic/bitops/__fls.h
linux-x.x.x/include/asm-generic/bitops/ffs.h
linux-x.x.x/include/asm-generic/bitops/fls.h
linux-x.x.x/include/asm-generic/bitops/fls64.h
linux-x.x.x/include/linux/cgroup-defs.h
linux-x.x.x/include/linux/errqueue.h
linux-x.x.x/include/linux/ethtool.h
linux-x.x.x/include/linux/fec.h
linux-x.x.x/include/linux/gpio/consumer.h
linux-x.x.x/include/linux/if_ether.h
linux-x.x.x/include/linux/list.h
linux-x.x.x/include/linux/list_nulls.h
linux-x.x.x/include/linux/log2.h
linux-x.x.x/include/linux/mdio.h
linux-x.x.x/include/linux/mii.h
linux-x.x.x/include/linux/mod_devicetable.h
linux-x.x.x/include/linux/net.h
linux-x.x.x/include/linux/netdev_features.h
linux-x.x.x/include/linux/phy.h
linux-x.x.x/include/linux/ptp_clock_kernel.h
linux-x.x.x/include/linux/rbtree.h
linux-x.x.x/include/linux/rculist.h
linux-x.x.x/include/linux/rculist_nulls.h
linux-x.x.x/include/linux/refcount.h
linux-x.x.x/include/linux/skbuff.h
linux-x.x.x/include/linux/socket.h
linux-x.x.x/include/linux/timecounter.h

View File

@ -0,0 +1,34 @@
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 74664a6..38cc18a 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -944,7 +944,10 @@ EXPORT_SYMBOL(phy_attached_print);
int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
u32 flags, phy_interface_t interface)
{
+#if 0
+ /* 'driver' has not been set yet on Genode */
struct module *ndev_owner = dev->dev.parent->driver->owner;
+#endif
struct mii_bus *bus = phydev->mdio.bus;
struct device *d = &phydev->mdio.dev;
bool using_genphy = false;
@@ -955,7 +958,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
* our own module->refcnt here, otherwise we would not be able to
* unload later on.
*/
- if (ndev_owner != bus->owner && !try_module_get(bus->owner)) {
+ if (/*ndev_owner != bus->owner &&*/ !try_module_get(bus->owner)) {
dev_err(&dev->dev, "failed to get the bus module\n");
return -EIO;
}
@@ -1060,7 +1063,9 @@ error_module_put:
module_put(d->driver->owner);
error_put_device:
put_device(d);
+#if 0
if (ndev_owner != bus->owner)
+#endif
module_put(bus->owner);
return err;
}

View File

@ -1,28 +0,0 @@
diff --git a/include/net/sock.h b/include/net/sock.h
index 14d3c07..818a1d1 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2148,8 +2148,8 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
*/
if (sock_flag(sk, SOCK_RCVTSTAMP) ||
(sk->sk_tsflags & SOF_TIMESTAMPING_RX_SOFTWARE) ||
- (kt.tv64 && sk->sk_tsflags & SOF_TIMESTAMPING_SOFTWARE) ||
- (hwtstamps->hwtstamp.tv64 &&
+ (kt && sk->sk_tsflags & SOF_TIMESTAMPING_SOFTWARE) ||
+ (hwtstamps->hwtstamp &&
(sk->sk_tsflags & SOF_TIMESTAMPING_RAW_HARDWARE)))
__sock_recv_timestamp(msg, sk, skb);
else
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index b2df375..02c065f 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4212,7 +4212,7 @@ EXPORT_SYMBOL(skb_try_coalesce);
*/
void skb_scrub_packet(struct sk_buff *skb, bool xnet)
{
- skb->tstamp.tv64 = 0;
+ skb->tstamp = 0;
skb->pkt_type = PACKET_HOST;
skb->skb_iif = 0;
skb->ignore_df = 0;

View File

@ -1,11 +1,11 @@
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index b2a3220..18629c6 100644
index d4604bc..3f72629 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -2825,7 +2825,7 @@ fec_enet_alloc_txq_buffers(struct net_device *ndev, unsigned int queue)
@@ -2798,7 +2798,7 @@ fec_enet_alloc_txq_buffers(struct net_device *ndev, unsigned int queue)
txq = fep->tx_queue[queue];
bdp = txq->tx_bd_base;
for (i = 0; i < txq->tx_ring_size; i++) {
bdp = txq->bd.base;
for (i = 0; i < txq->bd.ring_size; i++) {
- txq->tx_bounce[i] = kmalloc(FEC_ENET_TX_FRSIZE, GFP_KERNEL);
+ txq->tx_bounce[i] = kmalloc(FEC_ENET_TX_FRSIZE, GFP_KERNEL | GFP_LX_DMA);
if (!txq->tx_bounce[i])

View File

@ -1 +1 @@
4832c9de27d57c6e6eb3c04a6ff6be61b0237216
aa28d681fc4c5c74f8e287608db1aedcb5cc35fc

View File

@ -109,9 +109,9 @@ HASH_INPUT += $(REP_DIR)/lxip.list
# Freescale Ethernet controller
#
SRC_DIR_FEC := src/drivers/nic/fec
VERSION_FEC := 4.4.3
VERSION_FEC := 4.16.3
URL(fec) := https://www.kernel.org/pub/linux/kernel/v4.x/linux-$(VERSION_FEC).tar.xz
SHA(fec) := 0b379cb19bbd7e38fc5a9a000ea927db55cce519a7400ec7fa705c581a6491dd
SHA(fec) := 0d6971a81da97e38b974c5eba31a74803bfe41aabc46d406c3acda56306c81a3
DIR(fec) := $(SRC_DIR_FEC)
TAR_OPT(fec) := --strip-components=1 --files-from - < <(sed 's/-x.x.x/-$(VERSION_FEC)/g' $(REP_DIR)/fec.list)
HASH_INPUT += $(REP_DIR)/fec.list
@ -209,6 +209,6 @@ PATCH_OPT(patches/intel_fb_hotplug.patch) := -p1 -d$(SRC_DIR_INTEL_FB)
# Freescale NIC
PATCH_OPT(patches/fec_skbuff_cast.patch) := -p1 -d$(SRC_DIR_FEC)
PATCH_OPT(patches/fec_tx_bounce_dma.patch) := -p1 -d$(SRC_DIR_FEC)
PATCH_OPT(patches/fec_tv64.patch) := -p1 -d$(SRC_DIR_FEC)
PATCH_OPT(patches/fec_ndev_owner.patch) := -p1 -d$(SRC_DIR_FEC)
# vi: set ft=make :

View File

@ -5,6 +5,16 @@
#include <linux/timecounter.h>
#include <net/tso.h>
void bus_unregister(struct bus_type *bus)
{
TRACE_AND_STOP;
}
void class_unregister(struct class *cls)
{
TRACE_AND_STOP;
}
size_t copy_from_user(void *to, void const *from, size_t len)
{
TRACE_AND_STOP;
@ -45,6 +55,11 @@ void dma_free_coherent(struct device * d, size_t size, void *vaddr, dma_addr_t b
TRACE_AND_STOP;
}
void driver_unregister(struct device_driver *drv)
{
TRACE_AND_STOP;
}
void dst_release(struct dst_entry *dst)
{
TRACE_AND_STOP;
@ -61,6 +76,17 @@ void eth_hw_addr_random(struct net_device *dev)
TRACE_AND_STOP;
}
void ethtool_convert_legacy_u32_to_link_mode(unsigned long *dst, u32 legacy_u32)
{
TRACE_AND_STOP;
}
bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32,
const unsigned long *src)
{
TRACE_AND_STOP;
}
u32 ethtool_op_get_link(struct net_device * d)
{
TRACE_AND_STOP;
@ -89,12 +115,22 @@ void free_netdev(struct net_device * d)
TRACE_AND_STOP;
}
void free_uid(struct user_struct *dummy)
{
TRACE_AND_STOP;
}
bool gfp_pfmemalloc_allowed(gfp_t g)
{
TRACE_AND_STOP;
return -1;
}
bool gfpflags_allow_blocking(const gfp_t gfp_flags)
{
TRACE_AND_STOP;
}
int in_irq(void)
{
TRACE_AND_STOP;
@ -113,11 +149,31 @@ void *kmap_atomic(struct page *page)
return NULL;
}
const char *kobject_name(const struct kobject *kobj)
{
TRACE_AND_STOP;
}
void kunmap_atomic(void *addr)
{
TRACE_AND_STOP;
}
void might_sleep()
{
TRACE_AND_STOP;
}
void mm_unaccount_pinned_pages(struct mmpin *mmp)
{
TRACE_AND_STOP;
}
void module_put(struct module *mod)
{
TRACE_AND_STOP;
}
void netif_tx_disable(struct net_device *dev)
{
TRACE_AND_STOP;
@ -158,18 +214,53 @@ struct timespec64 ns_to_timespec64(const s64 nsec)
return ret;
}
int of_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env)
{
TRACE_AND_STOP;
}
int of_mdio_parse_addr(struct device *dev, const struct device_node *np)
{
TRACE_AND_STOP;
}
struct device_node *of_node_get(struct device_node *node)
{
TRACE_AND_STOP;
return NULL;
}
void of_phy_deregister_fixed_link(struct device_node *np)
{
TRACE_AND_STOP;
}
int of_phy_register_fixed_link(struct device_node *np)
{
TRACE_AND_STOP;
return -1;
}
bool of_property_read_bool(const struct device_node *np, const char *propname)
{
TRACE_AND_STOP;
}
void phy_led_triggers_unregister(struct phy_device *phy)
{
TRACE_AND_STOP;
}
void pm_runtime_disable(struct device *dev)
{
TRACE_AND_STOP;
}
int pm_runtime_put(struct device *dev)
{
TRACE_AND_STOP;
}
void ptp_clock_event(struct ptp_clock *ptp, struct ptp_clock_event *event)
{
TRACE_AND_STOP;
@ -187,12 +278,6 @@ int ptp_clock_unregister(struct ptp_clock *ptp)
return -1;
}
int regulator_disable(struct regulator *r)
{
TRACE_AND_STOP;
return -1;
}
bool page_is_pfmemalloc(struct page *page)
{
TRACE_AND_STOP;
@ -214,6 +299,52 @@ void read_unlock_bh(rwlock_t * l)
TRACE_AND_STOP;
}
int regulator_disable(struct regulator *r)
{
TRACE_AND_STOP;
return -1;
}
int request_threaded_irq(unsigned int irq, irq_handler_t handler,
irq_handler_t thread_fn,
unsigned long flags, const char *name, void *dev)
{
TRACE_AND_STOP;
}
void sk_free(struct sock *sk)
{
TRACE_AND_STOP;
}
void sock_efree(struct sk_buff *skb)
{
TRACE_AND_STOP;
}
int strcmp(const char *s1, const char *s2)
{
TRACE_AND_STOP;
return -1;
}
char *strncpy(char *dst, const char *src, size_t s)
{
TRACE_AND_STOP;
}
int sysfs_create_link_nowarn(struct kobject *kobj,
struct kobject *target,
const char *name)
{
TRACE_AND_STOP;
}
void sysfs_remove_link(struct kobject *kobj, const char *name)
{
TRACE_AND_STOP;
}
unsigned int tcp_hdrlen(const struct sk_buff *skb)
{
TRACE_AND_STOP;
@ -252,42 +383,15 @@ void unregister_netdev(struct net_device * d)
TRACE_AND_STOP;
}
void usleep_range(unsigned long min, unsigned long max)
{
TRACE_AND_STOP;
}
void __vlan_hwaccel_put_tag(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci)
{
TRACE_AND_STOP;
}
void module_put(struct module *mod)
{
TRACE_AND_STOP;
}
void put_device(struct device *dev)
{
TRACE_AND_STOP;
}
int strcmp(const char *s1, const char *s2)
{
TRACE_AND_STOP;
return -1;
}
void class_unregister(struct class *cls)
{
TRACE_AND_STOP;
}
void bus_unregister(struct bus_type *bus)
{
TRACE_AND_STOP;
}
void driver_unregister(struct device_driver *drv)
{
TRACE_AND_STOP;
}
struct user_namespace init_user_ns;
int sysctl_tstamp_allow_data;

View File

@ -436,6 +436,7 @@ const struct of_device_id *of_match_device(const struct of_device_id *matches,
return nullptr;
}
void * devm_ioremap_resource(struct device *dev, struct resource *res)
{
Fec * fec = (Fec*) dev->plat_dev->dev.of_node;
@ -674,15 +675,15 @@ struct page *alloc_pages(gfp_t gfp_mask, unsigned int order)
}
void *__alloc_page_frag(struct page_frag_cache *, unsigned int const fragsz,
gfp_t const gfp_mask)
void *page_frag_alloc(struct page_frag_cache *, unsigned int const fragsz,
gfp_t const gfp_mask)
{
struct page *page = allocate_pages(gfp_mask, fragsz);
return page ? page->addr : page;
}
void __free_page_frag(void *addr)
void page_frag_free(void *addr)
{
struct page *page = Addr_to_page_mapping::remove((unsigned long)addr);
@ -693,6 +694,7 @@ void __free_page_frag(void *addr)
kfree(page);
}
int driver_register(struct device_driver *drv)
{
new (Lx::Malloc::mem()) Driver(drv);
@ -899,9 +901,10 @@ bool napi_schedule_prep(struct napi_struct *n)
}
void napi_complete(struct napi_struct *n)
bool napi_complete_done(struct napi_struct *n, int work_done)
{
clear_bit(NAPI_STATE_SCHED, &n->state);
return true;
}
@ -982,7 +985,7 @@ static int of_mdiobus_register_phy(Fec::Mdio::Phy & ph, struct mii_bus *mdio)
if (!phy || IS_ERR(phy)) return 1;
phy->irq = ph.gpio_irq;
phy->dev.of_node = (device_node*) &ph;
phy->mdio.dev.of_node = (device_node*) &ph;
/* All data is now stored in the phy struct;
* register it */
@ -1129,10 +1132,23 @@ u64 timecounter_read(struct timecounter *tc)
return nsec;
}
/*********************
** DUMMY FUNCTIONS **
*********************/
int bus_register(struct bus_type *bus)
{
TRACE;
return 0;
}
int class_register(struct class_ *cls)
{
TRACE;
return 0;
}
void clk_disable_unprepare(struct clk * c)
{
TRACE;
@ -1144,6 +1160,12 @@ int clk_prepare_enable(struct clk * c)
return 0;
}
int device_bind_driver(struct device *dev)
{
TRACE;
return 0;
}
void device_initialize(struct device *dev)
{
TRACE;
@ -1155,107 +1177,46 @@ int device_init_wakeup(struct device *dev, bool val)
return 0;
}
int device_set_wakeup_enable(struct device *dev, bool enable)
{
TRACE;
return 0;
}
struct regulator *__must_check devm_regulator_get(struct device *dev, const char *id)
{
TRACE;
return nullptr;
}
struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev, unsigned int index)
{
TRACE;
return nullptr;
}
bool of_phy_is_fixed_link(struct device_node *np)
{
TRACE;
return 0;
}
int pinctrl_pm_select_default_state(struct device *dev)
{
TRACE;
return -1;
}
int pinctrl_pm_select_sleep_state(struct device *dev)
{
TRACE;
return -1;
}
struct resource *platform_get_resource(struct platform_device * d, unsigned r1, unsigned r2)
{
TRACE;
return nullptr;
}
void pm_runtime_enable(struct device *dev)
void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr, size_t size,
enum dma_data_direction dir)
{
TRACE;
}
void pm_runtime_get_noresume(struct device *dev)
void dma_sync_single_for_device(struct device *dev, dma_addr_t addr,
size_t size, enum dma_data_direction dir)
{
TRACE;
}
int pm_runtime_set_active(struct device *dev)
{
TRACE;
return 0;
}
void pm_runtime_set_autosuspend_delay(struct device *dev, int delay)
{
TRACE;
}
void pm_runtime_use_autosuspend(struct device *dev)
{
TRACE;
}
struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, struct device *parent)
{
TRACE;
return (ptp_clock*)0xdeadbeef;
}
int regulator_enable(struct regulator * d)
{
TRACE;
return 0;
}
int class_register(struct class_ *cls)
{
TRACE;
return 0;
}
int try_module_get(struct module *mod)
{
TRACE;
return -1;
}
struct device *get_device(struct device *dev)
{
TRACE;
return dev;
}
int device_bind_driver(struct device *dev)
struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev, unsigned int index)
{
TRACE;
return 0;
return nullptr;
}
void netif_tx_start_all_queues(struct net_device *dev)
bool netdev_uses_dsa(struct net_device *dev)
{
TRACE;
return false;
}
void netif_tx_lock_bh(struct net_device *dev)
@ -1263,18 +1224,7 @@ void netif_tx_lock_bh(struct net_device *dev)
TRACE;
}
int device_set_wakeup_enable(struct device *dev, bool enable)
{
TRACE;
return 0;
}
void trace_consume_skb(struct sk_buff * sb)
{
TRACE;
}
void trace_kfree_skb(struct sk_buff * sb, void * p)
void netif_tx_start_all_queues(struct net_device *dev)
{
TRACE;
}
@ -1289,22 +1239,17 @@ void netif_wake_queue(struct net_device * d)
TRACE;
}
bool netdev_uses_dsa(struct net_device *dev)
const void *of_get_mac_address(struct device_node *np)
{
TRACE;
return false;
return nullptr;
}
void dma_sync_single_for_device(struct device *dev, dma_addr_t addr,
size_t size, enum dma_data_direction dir)
{
TRACE;
}
int of_machine_is_compatible(const char *compat)
void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr, size_t size,
enum dma_data_direction dir)
{
TRACE;
return 0;
}
void of_node_put(struct device_node *node)
@ -1312,12 +1257,102 @@ void of_node_put(struct device_node *node)
TRACE;
}
const void *of_get_mac_address(struct device_node *np)
bool of_phy_is_fixed_link(struct device_node *np)
{
TRACE;
return 0;
}
void phy_led_trigger_change_speed(struct phy_device *phy)
{
TRACE;
}
int phy_led_triggers_register(struct phy_device *phy)
{
TRACE;
return -1;
}
int pinctrl_pm_select_default_state(struct device *dev)
{
TRACE;
return -1;
}
int pinctrl_pm_select_sleep_state(struct device *dev)
{
TRACE;
return -1;
}
int platform_get_irq_byname(struct platform_device *dev, const char *name)
{
TRACE;
return -1;
}
struct resource *platform_get_resource(struct platform_device * d, unsigned r1, unsigned r2)
{
TRACE;
return nullptr;
}
int platform_irq_count(struct platform_device *dev)
{
TRACE;
return 0;
}
void pm_runtime_enable(struct device *dev)
{
TRACE;
}
void pm_runtime_get_noresume(struct device *dev)
{
TRACE;
}
int pm_runtime_set_active(struct device *dev)
{
TRACE;
return 0;
}
void pm_runtime_use_autosuspend(struct device *dev)
{
TRACE;
}
void pm_runtime_set_autosuspend_delay(struct device *dev, int delay)
{
TRACE;
}
struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, struct device *parent)
{
TRACE;
return (ptp_clock*)0xdeadbeef;
}
void put_device(struct device *dev)
{
TRACE;
}
int regulator_enable(struct regulator * d)
{
TRACE;
return 0;
}
int request_module(const char *fmt, ...)
{
TRACE;
return 0;
}
void rtnl_lock(void)
{
TRACE;
@ -1328,16 +1363,36 @@ void rtnl_unlock(void)
TRACE;
}
int request_module(const char *fmt, ...)
void secpath_reset(struct sk_buff *skb)
{
TRACE;
return 0;
}
int bus_register(struct bus_type *bus)
int sysfs_create_link(struct kobject *kobj, struct kobject *target, const char *name)
{
TRACE;
return 0;
return -1;
}
void trace_consume_skb(struct sk_buff * sb)
{
TRACE;
}
void trace_kfree_skb(struct sk_buff * sb, void * p)
{
TRACE;
}
void trace_mdio_access(void *dummy, ...)
{
TRACE;
}
int try_module_get(struct module *mod)
{
TRACE;
return -1;
}
}

View File

@ -19,10 +19,43 @@
#include <lx_emul/extern_c_begin.h>
#include <lx_emul/barrier.h>
#include <lx_emul/compiler.h>
#include <lx_emul/printf.h>
#include <lx_emul/types.h>
static inline void __read_once_size(const volatile void *p, void *res, int size)
{
switch (size) {
case 1: *(__u8 *)res = *(volatile __u8 *)p; break;
case 2: *(__u16 *)res = *(volatile __u16 *)p; break;
case 4: *(__u32 *)res = *(volatile __u32 *)p; break;
case 8: *(__u64 *)res = *(volatile __u64 *)p; break;
default:
barrier();
__builtin_memcpy((void *)res, (const void *)p, size);
barrier();
}
}
#ifdef __cplusplus
#define READ_ONCE(x) \
({ \
barrier(); \
x; \
})
#else
#define READ_ONCE(x) \
({ \
union { typeof(x) __val; char __c[1]; } __u; \
__read_once_size(&(x), __u.__c, sizeof(x)); \
__u.__val; \
})
#endif
#include <lx_emul/list.h>
void lx_backtrace(void);
#define DEBUG_LINUX_PRINTK 0
@ -59,8 +92,6 @@ typedef int clockid_t;
enum { PAGE_SHIFT = 12 };
enum { HZ = 100UL, };
struct list_head;
typedef __u16 __le16;
typedef __u32 __le32;
typedef __u64 __le64;
@ -129,7 +160,6 @@ enum {
__GFP_REPEAT = 0x00000400u,
};
#include <lx_emul/barrier.h>
#include <uapi/linux/swab.h>
#include <lx_emul/byteorder.h>
#include <lx_emul/completion.h>
@ -138,6 +168,7 @@ enum {
#include <uapi/linux/ptp_clock.h>
#include <lx_emul/pm.h>
#include <lx_emul/scatterlist.h>
#include <lx_emul/kobject.h>
enum {
ETH_HLEN = 14,
@ -206,11 +237,6 @@ static inline s64 timespec64_to_ns(const struct timespec64 *ts)
ktime_t ns_to_ktime(u64 ns);
struct device_node
{
const char * full_name;
};
struct device;
struct device_driver;
@ -220,6 +246,7 @@ struct bus_type
const struct attribute_group **dev_groups;
int (*match)(struct device *dev, struct device_driver *drv);
int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
int (*probe)(struct device *dev);
const struct dev_pm_ops *pm;
@ -255,6 +282,7 @@ struct platform_device;
struct device {
char name[32];
struct device * parent;
struct kobject kobj;
struct device_driver *driver;
void * platform_data;
void * driver_data;
@ -263,7 +291,8 @@ struct device {
struct bus_type *bus;
struct class *class;
struct device_node *of_node;
struct platform_device * plat_dev;
struct fwnode_handle *fwnode;
struct platform_device *plat_dev;
};
struct platform_device {
@ -358,6 +387,7 @@ struct net_device
netdev_features_t features;
struct net_device_stats stats;
netdev_features_t hw_features;
int ifindex;
const struct net_device_ops *netdev_ops;
const struct ethtool_ops *ethtool_ops;
const struct header_ops *header_ops;
@ -365,7 +395,10 @@ struct net_device
unsigned int priv_flags;
unsigned short hard_header_len;
unsigned long mtu;
unsigned int min_mtu;
unsigned long max_mtu;
unsigned short type;
unsigned char min_header_len;
unsigned char addr_len;
struct netdev_hw_addr_list mc;
unsigned char *dev_addr;
@ -373,7 +406,7 @@ struct net_device
unsigned long tx_queue_len;
int watchdog_timeo;
struct timer_list watchdog_timer;
struct device dev;
struct device dev;
u16 gso_max_segs;
struct phy_device *phydev;
};
@ -427,8 +460,6 @@ static inline int rcu_read_lock_bh_held(void) { return 1; }
unsigned int jiffies_to_usecs(const unsigned long j);
struct rb_node {};
#define __aligned(x) __attribute__((aligned(x)))
#define kmemcheck_bitfield_begin(name)
@ -602,7 +633,10 @@ bool netif_queue_stopped(const struct net_device *dev);
#define CONFIG_ARM 1
#define CONFIG_ARCH_MXC 1
#define CONFIG_DEBUG_LOCK_ALLOC 1
#define CONFIG_MDIO_DEVICE 1
#define CONFIG_OF_MDIO 1
#define CONFIG_PHYLIB 1
#define CONFIG_PTP_1588_CLOCK 1
void rtnl_lock(void);
@ -617,26 +651,7 @@ void netif_tx_unlock_bh(struct net_device *dev);
void napi_enable(struct napi_struct *n);
void napi_disable(struct napi_struct *n);
static inline void __read_once_size(const volatile void *p, void *res, int size)
{
switch (size) {
case 1: *(__u8 *)res = *(volatile __u8 *)p; break;
case 2: *(__u16 *)res = *(volatile __u16 *)p; break;
case 4: *(__u32 *)res = *(volatile __u32 *)p; break;
case 8: *(__u64 *)res = *(volatile __u64 *)p; break;
default:
barrier();
__builtin_memcpy((void *)res, (const void *)p, size);
barrier();
}
}
#define READ_ONCE(x) \
({ \
union { typeof(x) __val; char __c[1]; } __u; \
__read_once_size(&(x), __u.__c, sizeof(x)); \
__u.__val; \
})
#define __randomize_layout
extern unsigned long find_next_bit(const unsigned long *addr, unsigned long
size, unsigned long offset);
@ -669,12 +684,6 @@ gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb);
void dma_sync_single_for_device(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir);
bool napi_schedule_prep(struct napi_struct *n);
void __napi_schedule(struct napi_struct *n);
void napi_complete(struct napi_struct *n);
void *dev_get_platdata(const struct device *dev);
int is_valid_ether_addr(const u8 *);
@ -710,6 +719,473 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np);
struct resource *platform_get_resource(struct platform_device *, unsigned, unsigned);
/*******************************
** asm-generic/atomic-long.h **
*******************************/
static inline int atomic_long_cmpxchg(atomic_long_t *v, long old, long n) {
return cmpxchg(&v->counter, old, n); }
/************************
** linux/capability.h **
************************/
bool capable(int);
/*************************
** linux/cgroup-defs.h **
*************************/
struct cgroup;
/******************
** linux/cred.h **
******************/
struct user_struct *current_user();
/*******************
** linux/delay.h **
*******************/
void usleep_range(unsigned long min, unsigned long max);
/*************************
** linux/etherdevice.h **
*************************/
static inline void ether_addr_copy(u8 *dst, const u8 *src)
{
*(u32 *)dst = *(const u32 *)src;
*(u16 *)(dst+ 4) = *(const u16 *)(src + 4);
}
/*********************
** linux/ethtool.h **
*********************/
struct ethtool_link_ksettings;
/****************
** linux/fs.h **
****************/
typedef struct {
size_t written;
size_t count;
union {
char __user *buf;
void *data;
} arg;
int error;
} read_descriptor_t;
/********************
** linux/fwnode.h **
********************/
struct fwnode_handle { int dummy; };
/**********************
** linux/mm_types.h **
**********************/
struct page_frag_cache
{
bool pfmemalloc;
};
/*****************
** linux/gfp.h **
*****************/
void *page_frag_alloc(struct page_frag_cache *nc,
unsigned int fragsz, gfp_t gfp_mask);
void page_frag_free(void *addr);
/*********************
** linux/if_vlan.h **
*********************/
static inline bool eth_type_vlan(__be16 ethertype) { return false; }
/***********************
** linux/interrupt.h **
***********************/
#define IRQF_SHARED 0x00000080
#define IRQF_ONESHOT 0x00002000
int request_threaded_irq(unsigned int irq, irq_handler_t handler,
irq_handler_t thread_fn,
unsigned long flags, const char *name, void *dev);
/*********************
** linux/lockdep.h **
*********************/
struct lockdep_map { };
#define mutex_release(l, n, i)
/*****************************
** linux/mod_devicetable.h **
*****************************/
#define MDIO_NAME_SIZE 32
/************************
** linux/memcontrol.h **
************************/
struct mem_cgroup;
#define mem_cgroup_sockets_enabled 0
static inline bool mem_cgroup_under_socket_pressure(struct mem_cgroup *memcg) {
return false; }
/***********************
** linux/netdevice.h **
***********************/
void __napi_schedule(struct napi_struct *n);
typedef struct sk_buff **(*gro_receive_t)(struct sk_buff **, struct sk_buff *);
struct sk_buff **call_gro_receive(gro_receive_t cb, struct sk_buff **head, struct sk_buff *skb);
void dev_consume_skb_any(struct sk_buff *skb);
bool napi_complete_done(struct napi_struct *n, int work_done);
bool napi_schedule_prep(struct napi_struct *n);
void skb_gro_flush_final(struct sk_buff *skb, struct sk_buff **pp, int flush);
/****************
** linux/of.h **
****************/
struct device_node
{
const char * full_name;
struct fwnode_handle fwnode;
};
#define of_fwnode_handle(node) \
({ \
typeof(node) __of_fwnode_handle_node = (node); \
\
__of_fwnode_handle_node ? \
&__of_fwnode_handle_node->fwnode : NULL; \
})
int of_machine_is_compatible(const char *compat);
bool of_property_read_bool(const struct device_node *np, const char *propname);
/***********************
** linux/of_device.h **
***********************/
int of_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env);
/*********************
** linux/of_mdio.h **
*********************/
int of_mdio_parse_addr(struct device *dev, const struct device_node *np);
void of_phy_deregister_fixed_link(struct device_node *np);
/*****************
** linux/pci.h **
*****************/
int dev_is_pci(struct device *dev);
struct pci_dev;
struct device_node * pci_device_to_OF_node(const struct pci_dev *pdev);
#define to_pci_dev(n) NULL
/******************************
** linux/phy_led_triggers.h **
******************************/
void phy_led_trigger_change_speed(struct phy_device *phy);
int phy_led_triggers_register(struct phy_device *phy);
void phy_led_triggers_unregister(struct phy_device *phy);
/*****************************
** linux/platform_device.h **
*****************************/
int platform_get_irq_byname(struct platform_device *dev, const char *name);
int platform_irq_count(struct platform_device *);
/************************
** linux/pm_runtime.h **
************************/
void pm_runtime_disable(struct device *dev);
int pm_runtime_put(struct device *dev);
/*********************
** linux/preempt.h **
*********************/
#define in_task() (1)
/**********************
** linux/rcupdate.h **
**********************/
#define rcu_assign_pointer(p, v) (p = v);
#define rcu_dereference_protected(p, c) p
/*************************
** linux/scatterlist.h **
*************************/
#define sg_is_last(sg) ((sg)->page_link & 0x02)
/**************************
** linux/sched/signal.h **
**************************/
unsigned long rlimit(unsigned int limit);
/************************
** linux/sched/user.h **
************************/
struct user_struct
{
atomic_long_t locked_vm;
};
void free_uid(struct user_struct *);
struct user_struct *get_uid(struct user_struct *u);
/******************
** linux/sctp.h **
******************/
struct sctphdr
{
unsigned unused;
};
struct kmem_cache *kmem_cache_create_usercopy(const char *name, size_t size,
size_t align, slab_flags_t flags,
size_t useroffset, size_t usersize,
void (*ctor)(void *));
/******************
** linux/slab.h **
******************/
void *kcalloc(size_t n, size_t size, gfp_t flags);
void kmem_cache_free_bulk(struct kmem_cache *, size_t, void **);
/**********************
** linux/spinlock.h **
**********************/
int spin_is_locked(spinlock_t *lock);
/********************
** linux/stddef.h **
********************/
#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
/*******************
** linux/sysfs.h **
*******************/
int sysfs_create_link(struct kobject *kobj, struct kobject *target, const char *name);
int sysfs_create_link_nowarn(struct kobject *kobj, struct kobject *target, const char *name);
void sysfs_remove_link(struct kobject *kobj, const char *name);
/*************************
** linux/thread_info.h **
*************************/
static inline void check_object_size(const void *ptr, unsigned long n,
bool to_user) { }
void __bad_copy_from(void);
void __bad_copy_to(void);
static inline void copy_overflow(int size, unsigned long count)
{
WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count);
}
static __always_inline bool
check_copy_size(const void *addr, size_t bytes, bool is_source)
{
int sz = __compiletime_object_size(addr);
if (unlikely(sz >= 0 && sz < bytes)) {
if (!__builtin_constant_p(bytes))
copy_overflow(sz, bytes);
else if (is_source)
__bad_copy_from();
else
__bad_copy_to();
return false;
}
check_object_size(addr, bytes, is_source);
return true;
}
/****************************
** linux/user_namespace.h **
****************************/
struct user_namespace { };
/********************
** linux/uidgid.h **
********************/
kuid_t make_kuid(struct user_namespace *from, uid_t uid);
/*****************
** linux/uio.h **
*****************/
struct kvec
{
void *iov_base;
size_t iov_len;
};
bool _copy_from_iter_full(void *addr, size_t bytes, struct iov_iter *i);
static __always_inline __must_check
bool copy_from_iter_full(void *addr, size_t bytes, struct iov_iter *i)
{
if (unlikely(!check_copy_size(addr, bytes, false)))
return false;
else
return _copy_from_iter_full(addr, bytes, i);
}
bool copy_from_iter_full_nocache(void *addr, size_t bytes, struct iov_iter *i);
bool csum_and_copy_from_iter_full(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i);
/******************
** linux/wait.h **
******************/
bool wq_has_sleeper(struct wait_queue_head *wq_head);
/********************
** net/checksum.h **
********************/
static inline __wsum
csum_block_sub(__wsum csum, __wsum csum2, int offset)
{
return csum_block_add(csum, ~csum2, offset);
}
static inline __wsum csum_unfold(__sum16 n)
{
return (__force __wsum)n;
}
/**************************
** net/flow_dissector.h **
**************************/
#define FLOW_DISSECTOR_F_PARSE_1ST_FRAG BIT(0)
/*************************
** net/net_namespace.h **
*************************/
struct net;
/******************
** net/l3mdev.h **
******************/
int l3mdev_master_ifindex_by_index(struct net *net, int ifindex);
/*********************
** net/pkt_sched.h **
*********************/
#define DEFAULT_TX_QUEUE_LEN 1000
/***********************
** soc/imx/cpuidle.h **
***********************/
static inline void imx6q_cpuidle_fec_irqs_used(void) { }
static inline void imx6q_cpuidle_fec_irqs_unused(void) { }
/*************************
** trace/events/mdio.h **
*************************/
void trace_mdio_access(void *dummy, ...);
/*********************************
** uapi/asm-generic/resource.h **
*********************************/
# define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */
/*****************************
** uapi/linux/capability.h **
*****************************/
#define CAP_IPC_LOCK 14
/*************************
** uapi/linux/kernel.h **
*************************/
#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
/******************************
** uapi/linux/libc-compat.h **
******************************/
#define __UAPI_DEF_IF_IFMAP 1
#define __UAPI_DEF_IF_IFNAMSIZ 1
#define __UAPI_DEF_IF_IFREQ 1
#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1
/************************
** uapi/linux/types.h **
************************/
typedef unsigned __poll_t;
/************************/
#define DECLARE_BITMAP(name,bits) \
unsigned long name[BITS_TO_LONGS(bits)]
#include <uapi/linux/if_ether.h>
#include <uapi/linux/if_packet.h>
#include <uapi/linux/ethtool.h>
@ -727,30 +1203,6 @@ bool device_may_wakeup(struct device *dev);
int enable_irq_wake(unsigned int irq);
int disable_irq_wake(unsigned int irq);
struct ethtool_ops {
int(*get_settings)(struct net_device *, struct ethtool_cmd *);
int(*set_settings)(struct net_device *, struct ethtool_cmd *);
void(*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
int(*get_regs_len)(struct net_device *);
void(*get_regs)(struct net_device *, struct ethtool_regs *, void *);
void(*get_wol)(struct net_device *, struct ethtool_wolinfo *);
int(*set_wol)(struct net_device *, struct ethtool_wolinfo *);
int(*nway_reset)(struct net_device *);
u32(*get_link)(struct net_device *);
int(*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
int(*set_coalesce)(struct net_device *, struct ethtool_coalesce *);
void(*get_pauseparam)(struct net_device *, struct ethtool_pauseparam*);
int(*set_pauseparam)(struct net_device *, struct ethtool_pauseparam*);
void(*get_strings)(struct net_device *, u32 stringset, u8 *);
void(*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *);
int(*get_sset_count)(struct net_device *, int);
int(*get_ts_info)(struct net_device *, struct ethtool_ts_info *);
int(*get_tunable)(struct net_device *,
const struct ethtool_tunable *, void *);
int(*set_tunable)(struct net_device *,
const struct ethtool_tunable *, const void *);
};
u32 ethtool_op_get_link(struct net_device *);
void *dma_alloc_coherent(struct device *, size_t, dma_addr_t *, gfp_t);
@ -764,10 +1216,6 @@ int pinctrl_pm_select_sleep_state(struct device *dev);
void netif_tx_disable(struct net_device *dev);
#include <lx_emul/list.h>
#define rcu_assign_pointer(p, v) (p = v);
#include <linux/rculist.h>
#define netdev_hw_addr_list_for_each(ha, l) \
@ -899,8 +1347,6 @@ typedef int rwlock_t;
bool gfp_pfmemalloc_allowed(gfp_t);
struct user_namespace {};
struct cred {
struct user_namespace * user_ns;
};
@ -909,7 +1355,10 @@ struct file {
const struct cred * f_cred;
};
struct net;
struct net
{
struct user_namespace * user_ns;
};
struct percpu_counter {
s64 count;
@ -975,9 +1424,6 @@ struct net *dev_net(const struct net_device *dev);
#define read_pnet(pnet) (&init_net)
#define DECLARE_BITMAP(name,bits) \
unsigned long name[BITS_TO_LONGS(bits)]
void bitmap_fill(unsigned long *dst, int nbits);
void bitmap_zero(unsigned long *dst, int nbits);
@ -1041,7 +1487,10 @@ void page_counter_uncharge(struct page_counter *counter, unsigned long nr_pages)
enum { UNDER_LIMIT, SOFT_LIMIT, OVER_LIMIT };
struct inode {};
struct inode
{
kuid_t i_uid;
};
struct vm_area_struct;
@ -1097,11 +1546,6 @@ struct page *virt_to_head_page(const void *x);
typeof(type) name
#define this_cpu_ptr(ptr) ptr
struct page_frag_cache
{
bool pfmemalloc;
};
void *__alloc_page_frag(struct page_frag_cache *nc, unsigned int fragsz, gfp_t gfp_mask);
unsigned long local_irq_save(unsigned long flags);
@ -1170,7 +1614,10 @@ void sg_mark_end(struct scatterlist *sg);
void sg_set_buf(struct scatterlist *, const void *, unsigned int);
void sg_set_page(struct scatterlist *, struct page *, unsigned int, unsigned int);
struct inet_skb_parm { };
struct inet_skb_parm
{
int iif;
};
enum {
IPPROTO_IP = 0,
@ -1374,10 +1821,6 @@ struct device_node *of_get_next_available_child(const struct device_node *node,
for (child = of_get_next_available_child(parent, NULL); child != NULL; \
child = of_get_next_available_child(parent, child))
u32 mmd_eee_cap_to_ethtool_sup_t(u16 eee_cap);
u32 mmd_eee_adv_to_ethtool_adv_t(u16 eee_adv);
u16 ethtool_adv_to_mmd_eee_adv_t(u32 adv);
int driver_register(struct device_driver *drv);
void driver_unregister(struct device_driver *drv);
@ -1401,9 +1844,10 @@ static inline bool is_multicast_ether_addr_64bits(const u8 addr[6+2])
static inline bool ether_addr_equal_64bits(const u8 addr1[6+2], const u8 addr2[6+2])
{
u64 fold = (*(const u64 *)addr1) ^ (*(const u64 *)addr2);
const u16 *a = (const u16 *)addr1;
const u16 *b = (const u16 *)addr2;
return (fold << 16) == 0;
return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) == 0;
}
static inline bool eth_proto_is_802_3(__be16 proto)
@ -1483,6 +1927,7 @@ void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp);
struct pm_qos_request {};
#define dma_wmb() __asm__ __volatile__ ("dmb oshst" : : : "memory")
#include <lx_emul/extern_c_end.h>
#endif /* _SRC__DRIVERS__NIC__FEC__LX_EMUL_H_ */

View File

@ -29,16 +29,17 @@ CC_C_OPT += -std=gnu89
#
# Reduce build noise of compiling contrib code
#
CC_OPT_fec_ptp = -Wno-unused-but-set-variable -Wno-unused-variable \
-Wno-maybe-uninitialized -Wno-uninitialized
CC_OPT_fec_main = -Wno-unused-but-set-variable -Wno-unused-variable \
-Wno-pointer-sign -Wno-int-conversion -Wno-unused-function \
-Wno-uninitialized
CC_OPT_skbuff = -Wno-pointer-sign -Wno-int-conversion -Wno-uninitialized
CC_OPT_mdio_bus = -Wno-implicit-int -Wno-unused-function -Wno-pointer-sign
CC_OPT_eth = -Wno-pointer-sign -Wno-unused-function
CC_OPT_phy = -Wno-unused-function -Wno-unused-but-set-variable
CC_OPT_at803x = -Wno-unused-variable
CC_OPT_fec_ptp = -Wno-unused-but-set-variable -Wno-unused-variable \
-Wno-maybe-uninitialized -Wno-uninitialized
CC_OPT_fec_main = -Wno-unused-but-set-variable -Wno-unused-variable \
-Wno-pointer-sign -Wno-int-conversion -Wno-unused-function \
-Wno-uninitialized
CC_OPT_skbuff = -Wno-pointer-sign -Wno-int-conversion -Wno-uninitialized
CC_OPT_mdio_bus = -Wno-implicit-int -Wno-unused-function -Wno-pointer-sign
CC_OPT_eth = -Wno-pointer-sign -Wno-unused-function
CC_OPT_phy = -Wno-unused-function -Wno-unused-but-set-variable
CC_OPT_phy_device = -Wno-unused-function
CC_OPT_at803x = -Wno-unused-variable
vpath %.c $(LX_CONTRIB_DIR)/drivers/net/ethernet/freescale
vpath %.c $(LX_CONTRIB_DIR)/drivers/net/phy

View File

@ -258,7 +258,7 @@ int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh,
*********************/
int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...) { TRACE; return 0; }
char *kobject_name(const struct kobject *kobj) { TRACE; return 0; }
const char *kobject_name(const struct kobject *kobj) { TRACE; return 0; }
char *kobject_get_path(struct kobject *kobj, gfp_t gfp_mask) { TRACE; return 0; }

View File

@ -231,7 +231,7 @@ int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh,
*********************/
int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...) { TRACE; return 0; }
char *kobject_name(const struct kobject *kobj) { TRACE; return 0; }
const char *kobject_name(const struct kobject *kobj) { TRACE; return 0; }
char *kobject_get_path(struct kobject *kobj, gfp_t gfp_mask) { TRACE; return 0; }

View File

@ -70,6 +70,10 @@
#define smp_read_barrier_depends() do { } while (0)
#define smp_store_mb(var, value) do { WRITE_ONCE(var, value); barrier(); } while (0)
#ifndef __compiletime_object_size
# define __compiletime_object_size(obj) -1
#endif
/**************************
** linux/compiler-gcc.h **
**************************/
@ -78,6 +82,8 @@
#define __packed __attribute__((packed))
#endif
#define __weak __attribute__((weak))
#define __aligned(x) __attribute__((aligned(x)))
#define uninitialized_var(x) x = x

View File

@ -26,6 +26,7 @@
#define __is_defined(x) ___is_defined(x)
#define IS_BUILTIN(option) __is_defined(option)
#define IS_ENABLED(option) IS_BUILTIN(option)
#define IS_REACHABLE(option) IS_BUILTIN(option)
/********************
** linux/kernel.h **

View File

@ -52,6 +52,6 @@ struct kobj_uevent_env;
int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...);
void kobject_put(struct kobject *);
char *kobject_name(const struct kobject *kobj);
const char *kobject_name(const struct kobject *kobj);
char *kobject_get_path(struct kobject *kobj, gfp_t gfp_mask);
struct kobject * kobject_create_and_add(const char *, struct kobject *);