mirror of
https://github.com/genodelabs/genode.git
synced 2025-05-31 06:31:10 +00:00
parent
018c562447
commit
f0315b2715
@ -1,30 +0,0 @@
|
||||
LIB_MK := lib/mk/fec_nic_include.mk \
|
||||
$(foreach SPEC,arm arm_64,lib/mk/spec/$(SPEC)/lx_kit_setjmp.mk)
|
||||
|
||||
PORT_DIR := $(call port_dir,$(REP_DIR)/ports/dde_linux)
|
||||
|
||||
MIRROR_FROM_REP_DIR := $(LIB_MK) \
|
||||
src/drivers/nic/linux_network_session_base.cc \
|
||||
src/drivers/nic/linux_network_session_base.h \
|
||||
lib/import/import-fec_nic_include.mk \
|
||||
src/include/legacy src/lib/legacy/lx_kit \
|
||||
src/lib/lx_kit/spec \
|
||||
$(foreach SPEC,arm arm_64 arm_v7,src/include/spec/$(SPEC)) \
|
||||
$(shell cd $(REP_DIR); find src/drivers/nic/fec -type f)
|
||||
|
||||
MIRROR_FROM_PORT_DIR := $(shell cd $(PORT_DIR); find src/drivers/nic/fec -type f | grep -v ".git")
|
||||
MIRROR_FROM_PORT_DIR := $(filter-out $(MIRROR_FROM_REP_DIR),$(MIRROR_FROM_PORT_DIR))
|
||||
|
||||
content: $(MIRROR_FROM_REP_DIR) $(MIRROR_FROM_PORT_DIR)
|
||||
|
||||
$(MIRROR_FROM_REP_DIR):
|
||||
$(mirror_from_rep_dir)
|
||||
|
||||
$(MIRROR_FROM_PORT_DIR):
|
||||
mkdir -p $(dir $@)
|
||||
cp $(PORT_DIR)/$@ $@
|
||||
|
||||
content: LICENSE
|
||||
LICENSE:
|
||||
( echo "GNU General Public License version 2, see:"; \
|
||||
echo "https://www.kernel.org/pub/linux/kernel/COPYING" ) > $@
|
@ -1 +0,0 @@
|
||||
2022-10-11 e74e1fd7ac8c83a3754e8b876ac480e19fadd01a
|
@ -1,8 +0,0 @@
|
||||
base
|
||||
os
|
||||
platform_session
|
||||
timer_session
|
||||
nic_session
|
||||
uplink_session
|
||||
nic_driver
|
||||
gpio_session
|
@ -1,385 +0,0 @@
|
||||
#include <lx_emul.h>
|
||||
#include <linux/phy.h>
|
||||
#include <linux/ptp_clock_kernel.h>
|
||||
#include <linux/skbuff.h>
|
||||
#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;
|
||||
return -1;
|
||||
}
|
||||
|
||||
size_t copy_to_user(void *dst, void const *src, size_t len)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool device_may_wakeup(struct device *dev)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void device_release_driver(struct device *dev)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
}
|
||||
|
||||
int disable_irq(unsigned int irq)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int disable_irq_wake(unsigned int irq)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void dma_free_coherent(struct device * d, size_t size, void *vaddr, dma_addr_t bus)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
}
|
||||
|
||||
void driver_unregister(struct device_driver *drv)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
}
|
||||
|
||||
void dst_release(struct dst_entry *dst)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
}
|
||||
|
||||
int enable_irq_wake(unsigned int irq)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
return -1;
|
||||
}
|
||||
|
||||
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;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ethtool_op_get_ts_info(struct net_device * d, struct ethtool_ts_info * i)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void free_irq(unsigned int irq, void *dev_id)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
}
|
||||
|
||||
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;
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct iphdr *ip_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *kmap_atomic(struct page *page)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
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;
|
||||
}
|
||||
|
||||
void netif_tx_stop_queue(struct netdev_queue *dev_queue)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
}
|
||||
|
||||
void netif_tx_wake_all_queues(struct net_device * d)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
}
|
||||
|
||||
void netif_tx_wake_queue(struct netdev_queue *dev_queue)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
}
|
||||
|
||||
int net_ratelimit(void)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ktime_t ns_to_ktime(u64 ns)
|
||||
{
|
||||
ktime_t ret;
|
||||
TRACE_AND_STOP;
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct timespec64 ns_to_timespec64(const s64 nsec)
|
||||
{
|
||||
struct timespec64 ret;
|
||||
TRACE_AND_STOP;
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
int ptp_clock_index(struct ptp_clock *ptp)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ptp_clock_unregister(struct ptp_clock *ptp)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool page_is_pfmemalloc(struct page *page)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void put_page(struct page *page)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
}
|
||||
|
||||
void read_lock_bh(rwlock_t * l)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
}
|
||||
|
||||
void read_unlock_bh(rwlock_t * l)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
}
|
||||
|
||||
int regulator_disable(struct regulator *r)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
return -1;
|
||||
}
|
||||
|
||||
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;
|
||||
return -1;
|
||||
}
|
||||
|
||||
u64 timecounter_cyc2time(struct timecounter *tc, cycle_t cycle_tstamp)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void tso_build_data(struct sk_buff *skb, struct tso_t *tso, int size)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
}
|
||||
|
||||
void tso_build_hdr(struct sk_buff *skb, char *hdr, struct tso_t *tso, int size, bool is_last)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
}
|
||||
|
||||
int tso_count_descs(struct sk_buff *skb)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void tso_start(struct sk_buff *skb, struct tso_t *tso)
|
||||
{
|
||||
TRACE_AND_STOP;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
struct user_namespace init_user_ns;
|
||||
int sysctl_tstamp_allow_data;
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,65 +0,0 @@
|
||||
/*
|
||||
* \brief Linux emulation code
|
||||
* \author Josef Soentgen
|
||||
* \date 2014-03-07
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2014-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
/* linux includes */
|
||||
#include <lx_emul.h>
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
/* local includes */
|
||||
#include <lxc.h>
|
||||
|
||||
|
||||
struct Skb skb_helper(struct sk_buff *skb)
|
||||
{
|
||||
struct Skb helper;
|
||||
|
||||
skb_push(skb, ETH_HLEN);
|
||||
|
||||
helper.packet = skb->data;
|
||||
helper.packet_size = skb->len;
|
||||
helper.frag = 0;
|
||||
helper.frag_size = 0;
|
||||
|
||||
/**
|
||||
* If received packets are too large (as of now 128 bytes) the actually
|
||||
* payload is put into a fragment. Otherwise the payload is stored directly
|
||||
* in the sk_buff.
|
||||
*/
|
||||
if (skb_shinfo(skb)->nr_frags) {
|
||||
if (skb_shinfo(skb)->nr_frags > 1)
|
||||
printk("more than 1 fragment in skb: %p nr_frags: %d", skb,
|
||||
skb_shinfo(skb)->nr_frags);
|
||||
|
||||
skb_frag_t *f = &skb_shinfo(skb)->frags[0];
|
||||
helper.frag = skb_frag_address(f);
|
||||
helper.frag_size = skb_frag_size(f);
|
||||
/* fragment contains payload but header is still found in packet */
|
||||
helper.packet_size = ETH_HLEN;
|
||||
}
|
||||
|
||||
return helper;
|
||||
}
|
||||
|
||||
|
||||
struct sk_buff *lxc_alloc_skb(size_t len, size_t headroom)
|
||||
{
|
||||
struct sk_buff *skb = alloc_skb(len + headroom, GFP_KERNEL | GFP_LX_DMA);
|
||||
skb_reserve(skb, headroom);
|
||||
return skb;
|
||||
}
|
||||
|
||||
|
||||
unsigned char *lxc_skb_put(struct sk_buff *skb, size_t len)
|
||||
{
|
||||
return skb_put(skb, len);
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* \brief Lx C env
|
||||
* \author Josef Soentgen
|
||||
* \date 2016-03-04
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
#ifndef _LXC_H_
|
||||
#define _LXC_H_
|
||||
|
||||
/*
|
||||
* The sk_buff struct contains empty array members whose
|
||||
* size differs between C and C++. Since we want to access
|
||||
* certain members of the sk_buff from C++ we have to use
|
||||
* a uniform format useable from both languages.W
|
||||
*
|
||||
* Note: we pull struct skb_buff as well as size_t from
|
||||
* headers included before this one.
|
||||
*/
|
||||
struct Skb
|
||||
{
|
||||
void *packet;
|
||||
size_t packet_size;
|
||||
void *frag;
|
||||
size_t frag_size;
|
||||
};
|
||||
|
||||
struct Skb skb_helper(struct sk_buff *skb);
|
||||
bool is_eapol(struct sk_buff *skb);
|
||||
|
||||
struct sk_buff *lxc_alloc_skb(size_t len, size_t headroom);
|
||||
unsigned char *lxc_skb_put(struct sk_buff *skb, size_t len);
|
||||
|
||||
#endif /* _LXC_H_ */
|
@ -1,120 +0,0 @@
|
||||
/*
|
||||
* \brief Freescale ethernet driver
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2017-10-19
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
#include <base/component.h>
|
||||
#include <base/heap.h>
|
||||
|
||||
/* local includes */
|
||||
#include <uplink_client.h>
|
||||
|
||||
/* Linux emulation environment includes */
|
||||
#include <lx_emul.h>
|
||||
#include <legacy/lx_kit/env.h>
|
||||
#include <legacy/lx_kit/malloc.h>
|
||||
#include <legacy/lx_kit/scheduler.h>
|
||||
#include <legacy/lx_kit/timer.h>
|
||||
#include <legacy/lx_kit/irq.h>
|
||||
#include <legacy/lx_kit/backend_alloc.h>
|
||||
#include <legacy/lx_kit/work.h>
|
||||
|
||||
/* Linux module functions */
|
||||
extern "C" int module_fec_driver_init();
|
||||
extern "C" int module_phy_module_init();
|
||||
extern "C" int subsys_phy_init();
|
||||
extern "C" void skb_init();
|
||||
|
||||
static void run_linux(void * m);
|
||||
|
||||
struct workqueue_struct *system_wq;
|
||||
struct workqueue_struct *system_power_efficient_wq;
|
||||
unsigned long jiffies;
|
||||
|
||||
struct Main
|
||||
{
|
||||
Genode::Env & env;
|
||||
Genode::Entrypoint & ep { env.ep() };
|
||||
Genode::Attached_rom_dataspace config_rom { env, "config" };
|
||||
Genode::Heap heap { env.ram(), env.rm() };
|
||||
Genode::Constructible<Genode::Uplink_client> uplink_client { };
|
||||
|
||||
/* Linux task that handles the initialization */
|
||||
Genode::Constructible<Lx::Task> linux;
|
||||
|
||||
Main(Genode::Env &env) : env(env)
|
||||
{
|
||||
Genode::log("--- freescale ethernet driver ---");
|
||||
|
||||
Lx_kit::construct_env(env);
|
||||
|
||||
LX_MUTEX_INIT(mdio_board_lock);
|
||||
LX_MUTEX_INIT(phy_fixup_lock);
|
||||
|
||||
/* init singleton Lx::Scheduler */
|
||||
Lx::scheduler(&env);
|
||||
|
||||
Lx::malloc_init(env, heap);
|
||||
|
||||
/* init singleton Lx::Timer */
|
||||
Lx::timer(&env, &ep, &heap, &jiffies);
|
||||
|
||||
/* init singleton Lx::Irq */
|
||||
Lx::Irq::irq(&ep, &heap);
|
||||
|
||||
/* init singleton Lx::Work */
|
||||
Lx::Work::work_queue(&heap);
|
||||
|
||||
linux.construct(run_linux, reinterpret_cast<void*>(this),
|
||||
"linux", Lx::Task::PRIORITY_0, Lx::scheduler());
|
||||
|
||||
/* give all task a first kick before returning */
|
||||
Lx::scheduler().schedule();
|
||||
}
|
||||
|
||||
void announce()
|
||||
{
|
||||
uplink_client.construct( env, heap,
|
||||
config_rom.xml().attribute_value(
|
||||
"uplink_label", Genode::Session_label::String { "" }));
|
||||
}
|
||||
|
||||
Lx::Task &linux_task() { return *linux; }
|
||||
};
|
||||
|
||||
|
||||
static void run_linux(void * m)
|
||||
{
|
||||
Main & main = *reinterpret_cast<Main*>(m);
|
||||
|
||||
system_wq = (workqueue_struct *)kzalloc(sizeof(workqueue_struct), 0);
|
||||
system_power_efficient_wq = (workqueue_struct *)kzalloc(sizeof(workqueue_struct), 0);
|
||||
|
||||
skb_init();
|
||||
subsys_phy_init();
|
||||
module_phy_module_init();
|
||||
module_fec_driver_init();
|
||||
|
||||
main.announce();
|
||||
while (1) Lx::scheduler().current()->block_and_schedule();
|
||||
}
|
||||
|
||||
|
||||
void Component::construct(Genode::Env &env)
|
||||
{
|
||||
/* XXX execute constructors of global statics */
|
||||
env.exec_static_constructors();
|
||||
|
||||
static Main m(env);
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
REQUIRES = arm_64
|
||||
|
||||
include $(REP_DIR)/src/drivers/nic/fec/target.inc
|
||||
|
||||
# lx_kit
|
||||
INC_DIR += $(REP_DIR)/src/include/spec/arm_64
|
@ -1,7 +0,0 @@
|
||||
REQUIRES = arm_v7
|
||||
|
||||
include $(REP_DIR)/src/drivers/nic/fec/target.inc
|
||||
|
||||
# lx_kit
|
||||
INC_DIR += $(REP_DIR)/src/include/spec/arm
|
||||
INC_DIR += $(REP_DIR)/src/include/spec/arm_v7
|
@ -1,50 +0,0 @@
|
||||
TARGET = fec_nic_drv
|
||||
LIBS = base lx_kit_setjmp fec_nic_include nic_driver
|
||||
SRC_CC += main.cc lx_emul.cc uplink_client.cc
|
||||
SRC_CC += linux_network_session_base.cc
|
||||
SRC_C += dummy.c lxc.c
|
||||
INC_DIR += $(PRG_DIR)/../..
|
||||
INC_DIR += $(REP_DIR)/src/drivers/nic
|
||||
|
||||
# lx_kit
|
||||
SRC_CC += env.cc irq.cc malloc.cc scheduler.cc timer.cc work.cc printf.cc bug.cc
|
||||
INC_DIR += $(REP_DIR)/src/include
|
||||
|
||||
# contrib code
|
||||
LX_CONTRIB_DIR := $(call select_from_ports,dde_linux)/src/drivers/nic/fec
|
||||
SRC_C += $(notdir $(wildcard $(LX_CONTRIB_DIR)/drivers/net/ethernet/freescale/*.c))
|
||||
SRC_C += $(notdir $(wildcard $(LX_CONTRIB_DIR)/drivers/net/phy/*.c))
|
||||
SRC_C += $(notdir $(wildcard $(LX_CONTRIB_DIR)/net/core/*.c))
|
||||
SRC_C += $(notdir $(wildcard $(LX_CONTRIB_DIR)/net/ethernet/*.c))
|
||||
INC_DIR += $(LX_CONTRIB_DIR)/include
|
||||
|
||||
#
|
||||
# Linux sources are C89 with GNU extensions
|
||||
#
|
||||
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_phy_device = -Wno-unused-function
|
||||
CC_OPT_at803x = -Wno-unused-variable
|
||||
|
||||
vpath linux_network_session_base.cc $(REP_DIR)/src/drivers/nic
|
||||
vpath %.c $(LX_CONTRIB_DIR)/drivers/net/ethernet/freescale
|
||||
vpath %.c $(LX_CONTRIB_DIR)/drivers/net/phy
|
||||
vpath %.c $(LX_CONTRIB_DIR)/net/core
|
||||
vpath %.c $(LX_CONTRIB_DIR)/net/ethernet
|
||||
vpath %.c $(PRG_DIR)/../..
|
||||
vpath %.cc $(PRG_DIR)/../..
|
||||
vpath %.cc $(REP_DIR)/src/lib/legacy/lx_kit
|
||||
|
||||
CC_CXX_WARN_STRICT =
|
@ -1,93 +0,0 @@
|
||||
/*
|
||||
* \brief Uplink session client role of the driver
|
||||
* \author Martin Stein
|
||||
* \date 2020-12-10
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2020 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
/* local include */
|
||||
#include <uplink_client.h>
|
||||
|
||||
#include <lx_emul.h>
|
||||
|
||||
extern "C" {
|
||||
#include <lxc.h>
|
||||
};
|
||||
|
||||
|
||||
Genode::Uplink_client::Transmit_result
|
||||
Genode::Uplink_client::_drv_transmit_pkt(const char *conn_rx_pkt_base,
|
||||
size_t conn_rx_pkt_size)
|
||||
{
|
||||
/*
|
||||
* We must not be called from another task, just from the
|
||||
* packet stream dispatcher.
|
||||
*/
|
||||
if (Lx::scheduler().active()) {
|
||||
warning("scheduler active");
|
||||
return Transmit_result::RETRY;
|
||||
}
|
||||
|
||||
struct sk_buff *skb {
|
||||
lxc_alloc_skb(conn_rx_pkt_size +
|
||||
HEAD_ROOM, HEAD_ROOM) };
|
||||
|
||||
unsigned char *data = lxc_skb_put(skb, conn_rx_pkt_size);
|
||||
memcpy(data, conn_rx_pkt_base, conn_rx_pkt_size);
|
||||
|
||||
_tx_data.ndev = _ndev;
|
||||
_tx_data.skb = skb;
|
||||
|
||||
_tx_task.unblock();
|
||||
Lx::scheduler().schedule();
|
||||
return Transmit_result::ACCEPTED;
|
||||
}
|
||||
|
||||
|
||||
Genode::Uplink_client::Uplink_client(Env &env,
|
||||
Allocator &alloc,
|
||||
Session_label const &label)
|
||||
:
|
||||
Linux_network_session_base { label },
|
||||
Uplink_client_base { env, alloc,
|
||||
Net::Mac_address(_ndev->dev_addr) }
|
||||
{
|
||||
_drv_handle_link_state(_read_link_state_from_ndev());
|
||||
}
|
||||
|
||||
|
||||
void Genode::Uplink_client::link_state(bool state)
|
||||
{
|
||||
_drv_handle_link_state(state);
|
||||
}
|
||||
|
||||
|
||||
void Genode::Uplink_client::receive(struct sk_buff *skb)
|
||||
{
|
||||
Skb skb_helpr { skb_helper(skb) };
|
||||
_drv_rx_handle_pkt(
|
||||
skb_helpr.packet_size + skb_helpr.frag_size,
|
||||
[&] (void *conn_tx_pkt_base,
|
||||
size_t &)
|
||||
{
|
||||
memcpy(
|
||||
conn_tx_pkt_base,
|
||||
skb_helpr.packet,
|
||||
skb_helpr.packet_size);
|
||||
|
||||
if (skb_helpr.frag_size) {
|
||||
|
||||
memcpy(
|
||||
(char *)conn_tx_pkt_base + skb_helpr.packet_size,
|
||||
skb_helpr.frag,
|
||||
skb_helpr.frag_size);
|
||||
}
|
||||
return Write_result::WRITE_SUCCEEDED;
|
||||
});
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* \brief Uplink session client role of the driver
|
||||
* \author Martin Stein
|
||||
* \date 2020-12-10
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2020 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
#ifndef _SRC__DRIVERS__NIC__FEC__UPLINK_CLIENT_H_
|
||||
#define _SRC__DRIVERS__NIC__FEC__UPLINK_CLIENT_H_
|
||||
|
||||
/* NIC driver includes */
|
||||
#include <drivers/nic/uplink_client_base.h>
|
||||
|
||||
/* local include */
|
||||
#include <linux_network_session_base.h>
|
||||
|
||||
namespace Genode {
|
||||
|
||||
class Uplink_client;
|
||||
}
|
||||
|
||||
|
||||
class Genode::Uplink_client : public Linux_network_session_base,
|
||||
public Uplink_client_base
|
||||
{
|
||||
private:
|
||||
|
||||
/************************
|
||||
** Uplink_client_base **
|
||||
************************/
|
||||
|
||||
Transmit_result
|
||||
_drv_transmit_pkt(const char *conn_rx_pkt_base,
|
||||
size_t conn_rx_pkt_size) override;
|
||||
|
||||
public:
|
||||
|
||||
Uplink_client(Env &env,
|
||||
Allocator &alloc,
|
||||
Session_label const &label);
|
||||
|
||||
|
||||
/********************************
|
||||
** Linux_network_session_base **
|
||||
********************************/
|
||||
|
||||
void link_state(bool state) override;
|
||||
|
||||
void receive(struct sk_buff *skb) override;
|
||||
};
|
||||
|
||||
#endif /* _SRC__DRIVERS__NIC__FEC__UPLINK_CLIENT_H_ */
|
Loading…
x
Reference in New Issue
Block a user