From 312499a1efb3dc9fbddba3ae3e2bec904c9fa9af Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Fri, 12 Apr 2019 20:01:30 +0200 Subject: [PATCH] os: name lan9118 nic driver explicitly * it is not dependent on pbxa9 anymore, but configureable * rename it to lan9118_nic_drv Ref #2190 --- repos/base/include/drivers/defs/pbxa9.h | 3 -- .../nic/{spec/pbxa9 => lan9118}/lan9118.h | 0 .../nic/{spec/pbxa9 => lan9118}/main.cc | 34 +++++++++++-------- .../nic/{spec/pbxa9 => lan9118}/target.mk | 4 +-- 4 files changed, 22 insertions(+), 19 deletions(-) rename repos/os/src/drivers/nic/{spec/pbxa9 => lan9118}/lan9118.h (100%) rename repos/os/src/drivers/nic/{spec/pbxa9 => lan9118}/main.cc (72%) rename repos/os/src/drivers/nic/{spec/pbxa9 => lan9118}/target.mk (55%) diff --git a/repos/base/include/drivers/defs/pbxa9.h b/repos/base/include/drivers/defs/pbxa9.h index 86bb12796a..87ca2365cc 100644 --- a/repos/base/include/drivers/defs/pbxa9.h +++ b/repos/base/include/drivers/defs/pbxa9.h @@ -71,9 +71,6 @@ namespace Pbxa9 { KMI_0_IRQ = 52, KMI_1_IRQ = 53, - /* LAN */ - ETHERNET_IRQ = 60, - /* SD card */ PL180_IRQ_0 = 49, PL180_IRQ_1 = 50, diff --git a/repos/os/src/drivers/nic/spec/pbxa9/lan9118.h b/repos/os/src/drivers/nic/lan9118/lan9118.h similarity index 100% rename from repos/os/src/drivers/nic/spec/pbxa9/lan9118.h rename to repos/os/src/drivers/nic/lan9118/lan9118.h diff --git a/repos/os/src/drivers/nic/spec/pbxa9/main.cc b/repos/os/src/drivers/nic/lan9118/main.cc similarity index 72% rename from repos/os/src/drivers/nic/spec/pbxa9/main.cc rename to repos/os/src/drivers/nic/lan9118/main.cc index 587fc5643e..ee1bfc1f66 100644 --- a/repos/os/src/drivers/nic/spec/pbxa9/main.cc +++ b/repos/os/src/drivers/nic/lan9118/main.cc @@ -16,12 +16,12 @@ */ /* Genode includes */ +#include #include #include #include #include #include -#include /* driver code */ #include @@ -33,25 +33,25 @@ class Root : public Genode::Root_component enum { /** - * Base address of MMIO resource + * If no resource addresses are given, we take these Realview + * platform addresses as default ones. */ - LAN9118_PHYS = 0x4e000000, + REALVIEW_MMIO_BASE = 0x4e000000, + REALVIEW_IRQ = 60, /** * Size of MMIO resource * - * On the RealView platform, the device spans actually a much larger - * resource. However, only the first page is used. + * The device spans actually a much larger + * resource. However, only the first page is needed. */ - LAN9118_SIZE = 0x1000, - - /** - * Interrupt line - */ - LAN9118_IRQ = Pbxa9::ETHERNET_IRQ, + LAN9118_MMIO_SIZE = 0x1000, }; - Genode::Env &_env; + Genode::Env &_env; + Genode::Attached_rom_dataspace _config { _env, "config" }; + Genode::addr_t _mmio_base { REALVIEW_MMIO_BASE }; + unsigned _irq { REALVIEW_IRQ }; protected: @@ -80,7 +80,7 @@ class Root : public Genode::Root_component } return new (Root::md_alloc()) - Lan9118(LAN9118_PHYS, LAN9118_SIZE, LAN9118_IRQ, + Lan9118(_mmio_base, LAN9118_MMIO_SIZE, _irq, tx_buf_size, rx_buf_size, *md_alloc(), _env); } @@ -89,7 +89,13 @@ class Root : public Genode::Root_component Root(Genode::Env &env, Genode::Allocator &md_alloc) : Genode::Root_component(env.ep(), md_alloc), - _env(env) { } + _env(env) + { + _mmio_base = + _config.xml().attribute_value("mmio_base", + (Genode::addr_t)REALVIEW_MMIO_BASE); + _irq = _config.xml().attribute_value("irq", REALVIEW_IRQ); + } }; diff --git a/repos/os/src/drivers/nic/spec/pbxa9/target.mk b/repos/os/src/drivers/nic/lan9118/target.mk similarity index 55% rename from repos/os/src/drivers/nic/spec/pbxa9/target.mk rename to repos/os/src/drivers/nic/lan9118/target.mk index 8f14e68cea..25fcba4e77 100644 --- a/repos/os/src/drivers/nic/spec/pbxa9/target.mk +++ b/repos/os/src/drivers/nic/lan9118/target.mk @@ -1,5 +1,5 @@ -REQUIRES = pbxa9 -TARGET = nic_drv +REQUIRES = arm_v7 +TARGET = lan9118_nic_drv SRC_CC = main.cc LIBS = base INC_DIR += $(PRG_DIR)