mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
os/include/nic: API transition (fix 'deprecated' warnings)
...and adaptation of the users of 'Nic::Root' and 'Nic::Session_component' to the modified interface. Issue #1987
This commit is contained in:
parent
a63217b216
commit
9be07d2244
@ -6,23 +6,24 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
* Copyright (C) 2011-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode */
|
||||
#include <base/component.h>
|
||||
#include <base/env.h>
|
||||
#include <base/heap.h>
|
||||
#include <base/sleep.h>
|
||||
#include <base/log.h>
|
||||
#include <cap_session/connection.h>
|
||||
#include <nic/component.h>
|
||||
#include <nic/root.h>
|
||||
#include <os/server.h>
|
||||
|
||||
#include <dde_ipxe/nic.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
class Ipxe_session_component : public Nic::Session_component
|
||||
{
|
||||
@ -101,8 +102,10 @@ class Ipxe_session_component : public Nic::Session_component
|
||||
Genode::size_t const rx_buf_size,
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Ram_session &ram_session,
|
||||
Genode::Region_map ®ion_map,
|
||||
Server::Entrypoint &ep)
|
||||
: Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc, ram_session, ep)
|
||||
: Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc,
|
||||
ram_session, region_map, ep)
|
||||
{
|
||||
instance = this;
|
||||
|
||||
@ -137,29 +140,23 @@ Ipxe_session_component *Ipxe_session_component::instance;
|
||||
|
||||
struct Main
|
||||
{
|
||||
Server::Entrypoint &ep;
|
||||
Env &_env;
|
||||
|
||||
Nic::Root<Ipxe_session_component> root {ep, *Genode::env()->heap() };
|
||||
Heap _heap { _env.ram(), _env.rm() };
|
||||
|
||||
Main(Server::Entrypoint &ep) : ep(ep)
|
||||
Nic::Root<Ipxe_session_component> root {_env, _heap };
|
||||
|
||||
Main(Env &env) : _env(env)
|
||||
{
|
||||
Genode::log("--- iPXE NIC driver started ---");
|
||||
|
||||
Genode::log("-- init iPXE NIC");
|
||||
int cnt = dde_ipxe_nic_init(&ep);
|
||||
int cnt = dde_ipxe_nic_init(&_env.ep());
|
||||
Genode::log(" number of devices: ", cnt);
|
||||
|
||||
Genode::env()->parent()->announce(ep.manage(root));
|
||||
_env.parent().announce(_env.ep().manage(root));
|
||||
}
|
||||
};
|
||||
|
||||
void Component::construct(Genode::Env &env) { static Main main(env); }
|
||||
|
||||
/************
|
||||
** Server **
|
||||
************/
|
||||
|
||||
namespace Server {
|
||||
char const *name() { return "nic_drv_ep"; }
|
||||
size_t stack_size() { return 16*1024*sizeof(long); }
|
||||
void construct(Entrypoint &ep) { static Main server(ep); }
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
TARGET = nic_drv
|
||||
LIBS = base server dde_ipxe_nic
|
||||
LIBS = base dde_ipxe_nic
|
||||
SRC_CC = main.cc
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012-2013 Genode Labs GmbH
|
||||
* Copyright (C) 2012-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -180,9 +180,11 @@ class Usb_nic::Session_component : public Nic::Session_component
|
||||
Genode::size_t const rx_buf_size,
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Ram_session &ram_session,
|
||||
Genode::Region_map ®ion_map,
|
||||
Genode::Entrypoint &ep,
|
||||
Device *device)
|
||||
: Nic::Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc, ram_session, ep),
|
||||
: Nic::Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc,
|
||||
ram_session, region_map, ep),
|
||||
_device(device)
|
||||
{ _device->session(this); }
|
||||
|
||||
@ -257,7 +259,7 @@ class Root : public Root_component
|
||||
return new (Root::md_alloc())
|
||||
Usb_nic::Session_component(tx_buf_size, rx_buf_size,
|
||||
Lx::Malloc::mem(),
|
||||
_env.ram(),
|
||||
_env.ram(), _env.rm(),
|
||||
_env.ep(), _device);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012-2016 Genode Labs GmbH
|
||||
* Copyright (C) 2012-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -92,8 +92,10 @@ class Wifi_session_component : public Nic::Session_component
|
||||
Genode::size_t const rx_buf_size,
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Ram_session &ram_session,
|
||||
Genode::Region_map ®ion_map,
|
||||
Server::Entrypoint &ep, net_device *ndev)
|
||||
: Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc, ram_session, ep),
|
||||
: Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc,
|
||||
ram_session, region_map, ep),
|
||||
_ndev(ndev)
|
||||
{
|
||||
_ndev->lx_nic_device = this;
|
||||
@ -198,7 +200,7 @@ class Root : public Genode::Root_component<Wifi_session_component,
|
||||
session = new (md_alloc())
|
||||
Wifi_session_component(tx_buf_size, rx_buf_size,
|
||||
*md_alloc(),
|
||||
_env.ram(),
|
||||
_env.ram(), _env.rm(),
|
||||
_env.ep(), device);
|
||||
return session;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2015 Genode Labs GmbH
|
||||
* Copyright (C) 2015-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -34,13 +34,15 @@ class Nic::Communication_buffers
|
||||
Nic::Packet_allocator _rx_packet_alloc;
|
||||
Genode::Attached_ram_dataspace _tx_ds, _rx_ds;
|
||||
|
||||
Communication_buffers(Genode::Allocator &rx_block_md_alloc,
|
||||
Communication_buffers(Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Ram_session &ram_session,
|
||||
Genode::size_t tx_size, Genode::size_t rx_size)
|
||||
Genode::Region_map ®ion_map,
|
||||
Genode::size_t tx_size,
|
||||
Genode::size_t rx_size)
|
||||
:
|
||||
_rx_packet_alloc(&rx_block_md_alloc),
|
||||
_tx_ds(&ram_session, tx_size),
|
||||
_rx_ds(&ram_session, rx_size)
|
||||
_tx_ds(ram_session, region_map, tx_size),
|
||||
_rx_ds(ram_session, region_map, rx_size)
|
||||
{ }
|
||||
};
|
||||
|
||||
@ -90,11 +92,13 @@ class Nic::Session_component : Communication_buffers, public Session_rpc_object
|
||||
Genode::size_t const rx_buf_size,
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Ram_session &ram_session,
|
||||
Genode::Region_map ®ion_map,
|
||||
Server::Entrypoint &ep)
|
||||
:
|
||||
Communication_buffers(rx_block_md_alloc, ram_session,
|
||||
Communication_buffers(rx_block_md_alloc, ram_session, region_map,
|
||||
tx_buf_size, rx_buf_size),
|
||||
Session_rpc_object(_tx_ds.cap(),
|
||||
Session_rpc_object(region_map,
|
||||
_tx_ds.cap(),
|
||||
_rx_ds.cap(),
|
||||
&_rx_packet_alloc, ep.rpc_ep()),
|
||||
_ep(ep)
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2015 Genode Labs GmbH
|
||||
* Copyright (C) 2015-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -18,6 +18,7 @@
|
||||
#include <root/component.h>
|
||||
|
||||
namespace Nic {
|
||||
using namespace Genode;
|
||||
|
||||
template <class SESSION_COMPONENT> class Root;
|
||||
};
|
||||
@ -29,7 +30,8 @@ class Nic::Root : public Genode::Root_component<SESSION_COMPONENT,
|
||||
{
|
||||
private:
|
||||
|
||||
Server::Entrypoint &_ep;
|
||||
Env &_env;
|
||||
Allocator &_md_alloc;
|
||||
|
||||
protected:
|
||||
|
||||
@ -59,16 +61,17 @@ class Nic::Root : public Genode::Root_component<SESSION_COMPONENT,
|
||||
|
||||
return new (Root::md_alloc())
|
||||
SESSION_COMPONENT(tx_buf_size, rx_buf_size,
|
||||
*env()->heap(),
|
||||
*env()->ram_session(),
|
||||
_ep);
|
||||
_md_alloc,
|
||||
_env.ram(),
|
||||
_env.rm(),
|
||||
_env.ep());
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Root(Server::Entrypoint &ep, Genode::Allocator &md_alloc)
|
||||
: Genode::Root_component<SESSION_COMPONENT, Genode::Single_client>(&ep.rpc_ep(), &md_alloc),
|
||||
_ep(ep)
|
||||
Root(Genode::Env &env, Genode::Allocator &md_alloc)
|
||||
: Genode::Root_component<SESSION_COMPONENT, Genode::Single_client>(&env.ep().rpc_ep(), &md_alloc),
|
||||
_env(env), _md_alloc(md_alloc)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2015 Genode Labs GmbH
|
||||
* Copyright (C) 2015-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -460,11 +460,13 @@ namespace Genode
|
||||
Genode::size_t const rx_buf_size,
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Ram_session &ram_session,
|
||||
Genode::Region_map ®ion_map,
|
||||
Server::Entrypoint &ep,
|
||||
addr_t const base, size_t const size, const int irq)
|
||||
:
|
||||
Genode::Attached_mmio(base, size),
|
||||
Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc, ram_session, ep),
|
||||
Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc,
|
||||
ram_session, region_map, ep),
|
||||
_irq(irq),
|
||||
_irq_handler(ep, *this, &Cadence_gem::_handle_irq),
|
||||
_phy(*this)
|
||||
|
@ -5,17 +5,17 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2015 Genode Labs GmbH
|
||||
* Copyright (C) 2015-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/component.h>
|
||||
#include <base/heap.h>
|
||||
#include <base/sleep.h>
|
||||
#include <cap_session/connection.h>
|
||||
#include <drivers/board_base.h>
|
||||
#include <os/server.h>
|
||||
#include <nic/xml_node.h>
|
||||
#include <nic/root.h>
|
||||
|
||||
@ -23,7 +23,14 @@
|
||||
|
||||
#include "cadence_gem.h"
|
||||
|
||||
class Gem_session_component
|
||||
namespace Server {
|
||||
using namespace Genode;
|
||||
|
||||
class Gem_session_component;
|
||||
struct Main;
|
||||
}
|
||||
|
||||
class Server::Gem_session_component
|
||||
:
|
||||
public Cadence_gem
|
||||
{
|
||||
@ -32,9 +39,11 @@ class Gem_session_component
|
||||
Genode::size_t const rx_buf_size,
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Ram_session &ram_session,
|
||||
Genode::Region_map ®ion_map,
|
||||
Server::Entrypoint &ep)
|
||||
:
|
||||
Cadence_gem(tx_buf_size, rx_buf_size, rx_block_md_alloc, ram_session, ep,
|
||||
Cadence_gem(tx_buf_size, rx_buf_size, rx_block_md_alloc,
|
||||
ram_session, region_map, ep,
|
||||
Board_base::EMAC_0_MMIO_BASE,
|
||||
Board_base::EMAC_0_MMIO_SIZE,
|
||||
Board_base::EMAC_0_IRQ)
|
||||
@ -61,20 +70,19 @@ class Gem_session_component
|
||||
}
|
||||
};
|
||||
|
||||
namespace Server { struct Main; }
|
||||
|
||||
struct Server::Main
|
||||
{
|
||||
Entrypoint &ep;
|
||||
Nic::Root<Gem_session_component> nic_root{ ep, *Genode::env()->heap() };
|
||||
Env &_env;
|
||||
Heap _heap { _env.ram(), _env.rm() };
|
||||
|
||||
Main(Entrypoint &ep) : ep(ep)
|
||||
Nic::Root<Gem_session_component> nic_root{ _env, *Genode::env()->heap() };
|
||||
|
||||
Main(Env &env) : _env(env)
|
||||
{
|
||||
Genode::env()->parent()->announce(ep.manage(nic_root));
|
||||
_env.parent().announce(_env.ep().manage(nic_root));
|
||||
}
|
||||
};
|
||||
|
||||
void Component::construct(Genode::Env &env) { static Server::Main main(env); }
|
||||
|
||||
char const * Server::name() { return "nic_ep"; }
|
||||
size_t Server::stack_size() { return 16*1024*sizeof(long); }
|
||||
void Server::construct(Entrypoint &ep) { static Main main(ep); }
|
||||
|
@ -1,5 +1,5 @@
|
||||
REQUIRES = cadence_gem
|
||||
TARGET = nic_drv
|
||||
SRC_CC = main.cc
|
||||
LIBS = base server config
|
||||
LIBS = base config
|
||||
INC_DIR += $(PRG_DIR)
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2016 Genode Labs GmbH
|
||||
* Copyright (C) 2011-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -304,7 +304,7 @@ class Lan9118 : public Nic::Session_component
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Env &env)
|
||||
: Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc,
|
||||
env.ram(), env.ep()),
|
||||
env.ram(), env.rm(), env.ep()),
|
||||
_mmio(env, mmio_base, mmio_size),
|
||||
_reg_base(_mmio.local_addr<Genode::uint32_t>()),
|
||||
_irq(env, irq),
|
||||
|
@ -17,13 +17,15 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
* Copyright (C) 2011-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode */
|
||||
#include <base/component.h>
|
||||
#include <base/heap.h>
|
||||
#include <base/thread.h>
|
||||
#include <base/log.h>
|
||||
#include <nic/root.h>
|
||||
@ -38,7 +40,11 @@
|
||||
#include <net/if.h>
|
||||
#include <linux/if_tun.h>
|
||||
|
||||
namespace Server { struct Main; }
|
||||
namespace Server {
|
||||
using namespace Genode;
|
||||
|
||||
struct Main;
|
||||
}
|
||||
|
||||
|
||||
class Linux_session_component : public Nic::Session_component
|
||||
@ -193,9 +199,11 @@ class Linux_session_component : public Nic::Session_component
|
||||
Genode::size_t const rx_buf_size,
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Ram_session &ram_session,
|
||||
Genode::Region_map ®ion_map,
|
||||
Server::Entrypoint &ep)
|
||||
:
|
||||
Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc, ram_session, ep),
|
||||
Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc,
|
||||
ram_session, region_map, ep),
|
||||
_tap_fd(_setup_tap_fd()), _rx_thread(_tap_fd, _packet_stream_dispatcher)
|
||||
{
|
||||
/* try using configured MAC address */
|
||||
@ -223,16 +231,15 @@ class Linux_session_component : public Nic::Session_component
|
||||
|
||||
struct Server::Main
|
||||
{
|
||||
Entrypoint &ep;
|
||||
Nic::Root<Linux_session_component> nic_root{ ep, *Genode::env()->heap() };
|
||||
Env &_env;
|
||||
Heap _heap { _env.ram(), _env.rm() };
|
||||
|
||||
Main(Entrypoint &ep) : ep(ep)
|
||||
Nic::Root<Linux_session_component> nic_root { _env, _heap };
|
||||
|
||||
Main(Env &env) : _env(env)
|
||||
{
|
||||
Genode::env()->parent()->announce(ep.manage(nic_root));
|
||||
_env.parent().announce(_env.ep().manage(nic_root));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
char const * Server::name() { return "nic_ep"; }
|
||||
Genode::size_t Server::stack_size() { return 16*1024*sizeof(long); }
|
||||
void Server::construct(Entrypoint &ep) { static Main main(ep); }
|
||||
void Component::construct(Genode::Env &env) { static Server::Main main(env); }
|
||||
|
@ -1,4 +1,4 @@
|
||||
TARGET = nic_drv
|
||||
REQUIRES = linux
|
||||
LIBS = lx_hybrid config server
|
||||
LIBS = lx_hybrid config
|
||||
SRC_CC = main.cc
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009-2013 Genode Labs GmbH
|
||||
* Copyright (C) 2009-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -49,10 +49,11 @@ class Nic_loopback::Session_component : public Nic::Session_component
|
||||
size_t const rx_buf_size,
|
||||
Allocator &rx_block_md_alloc,
|
||||
Ram_session &ram_session,
|
||||
Region_map ®ion_map,
|
||||
Entrypoint &ep)
|
||||
:
|
||||
Nic::Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc,
|
||||
ram_session, ep)
|
||||
ram_session, region_map, ep)
|
||||
{ }
|
||||
|
||||
Nic::Mac_address mac_address() override
|
||||
@ -146,6 +147,7 @@ class Nic_loopback::Root : public Root_component<Session_component>
|
||||
|
||||
Entrypoint &_ep;
|
||||
Ram_session &_ram;
|
||||
Region_map &_rm;
|
||||
|
||||
protected:
|
||||
|
||||
@ -172,15 +174,18 @@ class Nic_loopback::Root : public Root_component<Session_component>
|
||||
}
|
||||
|
||||
return new (md_alloc()) Session_component(tx_buf_size, rx_buf_size,
|
||||
*md_alloc(), _ram, _ep);
|
||||
*md_alloc(), _ram, _rm, _ep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Root(Entrypoint &ep, Ram_session &ram, Allocator &md_alloc)
|
||||
Root(Entrypoint &ep,
|
||||
Ram_session &ram,
|
||||
Region_map &rm,
|
||||
Allocator &md_alloc)
|
||||
:
|
||||
Root_component<Session_component>(&ep.rpc_ep(), &md_alloc),
|
||||
_ep(ep), _ram(ram)
|
||||
_ep(ep), _ram(ram), _rm(rm)
|
||||
{ }
|
||||
};
|
||||
|
||||
@ -191,7 +196,7 @@ struct Nic_loopback::Main
|
||||
|
||||
Heap _heap { _env.ram(), _env.rm() };
|
||||
|
||||
Nic_loopback::Root _root { _env.ep(), _env.ram(), _heap };
|
||||
Nic_loopback::Root _root { _env.ep(), _env.ram(), _env.rm(), _heap };
|
||||
|
||||
Main(Env &env) : _env(env)
|
||||
{
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2014-2015 Genode Labs GmbH
|
||||
* Copyright (C) 2014-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -134,8 +134,10 @@ class Openvpn_component : public Tuntap_device,
|
||||
Genode::size_t const rx_buf_size,
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Ram_session &ram_session,
|
||||
Genode::Region_map ®ion_map,
|
||||
Genode::Entrypoint &ep)
|
||||
: Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc, ram_session, ep)
|
||||
: Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc,
|
||||
ram_session, region_map, ep)
|
||||
{
|
||||
char buf[] = { 0x02, 0x00, 0x00, 0x00, 0x00, 0x01 };
|
||||
_mac_addr = Nic::Mac_address((void*)buf);
|
||||
@ -236,7 +238,7 @@ class Root : public Genode::Root_component<Openvpn_component, Genode::Single_cli
|
||||
Openvpn_component *component = new (Root::md_alloc())
|
||||
Openvpn_component(tx_buf_size, rx_buf_size,
|
||||
_heap,
|
||||
_env.ram(),
|
||||
_env.ram(), _env.rm(),
|
||||
_env.ep());
|
||||
/**
|
||||
* Setting the pointer in this manner is quite hackish but it has
|
||||
|
Loading…
Reference in New Issue
Block a user