usb: transition to the new base API

* remove all 'Genode::env()' calls
* use attached roms to read configuration
* use compoenent framework
* remove all PDBG, PINF, PWRN macros

Issue #1987
Fixes #2019
This commit is contained in:
Sebastian Sumpf 2016-06-21 12:59:11 +02:00 committed by Christian Helmuth
parent 58ef6e3695
commit d48219138c
25 changed files with 241 additions and 229 deletions

View File

@ -38,7 +38,7 @@ MOD_SUFFIX =
CC_OPT += -DMOD_SUFFIX=$(MOD_SUFFIX)
# lx_kit
SRC_CC += printf.cc work.cc timer.cc scheduler.cc irq.cc malloc.cc
SRC_CC += printf.cc work.cc timer.cc scheduler.cc irq.cc malloc.cc env.cc
# common lib
SRC_C += lib/int_sqrt.c

View File

@ -659,11 +659,6 @@ unsigned int jiffies_to_usecs(const unsigned long j)
return -1;
}
void kmem_cache_destroy(struct kmem_cache *cache)
{
TRACE_AND_STOP;
}
int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, char *envp[])
{
TRACE_AND_STOP;

View File

@ -11,12 +11,13 @@
* under the terms of the GNU General Public License version 2.
*/
#include <os/server.h>
#include <base/component.h>
extern void start_usb_driver(Server::Entrypoint &e);
extern void start_usb_driver(Genode::Env &env);
namespace Server {
char const *name() { return "usb_drv_ep"; }
size_t stack_size() { return 4*1024*sizeof(long); }
void construct(Entrypoint &e) { start_usb_driver(e); }
}
Genode::size_t Component::stack_size() {
return 4*1024*sizeof(long); }
void Component::construct(Genode::Env &env) { start_usb_driver(env); }

View File

@ -1,3 +1,3 @@
TARGET = usb_drv
SRC_CC = main.cc
LIBS = base usb server
LIBS = base usb

View File

@ -307,7 +307,6 @@ DUMMY(-1, ipv4_is_local_multicast)
DUMMY(-1, irqs_disabled)
DUMMY(-1, is_vlan_dev)
DUMMY(-1, kernel_sendmsg)
DUMMY(-1, kmem_cache_destroy)
DUMMY(-1, kobject_put)
DUMMY(-1, kobject_uevent)
DUMMY(-1, krealloc)

View File

@ -16,14 +16,18 @@
#ifndef _PLATFORM_H_
#define _PLATFORM_H_
#include <base/printf.h>
#include <os/config.h>
#include <base/log.h>
#include <util/xml_node.h>
#include <os/signal_rpc_dispatcher.h>
#include <irq_session/capability.h>
#include <lx_kit/env.h>
struct Services
{
Genode::Env &env;
/* USB profiles */
bool hid = false;
bool stor = false;
@ -46,12 +50,13 @@ struct Services
/* report generation */
bool raw_report_device_list = false;
Services()
Services(Genode::Env &env) : env(env)
{
using namespace Genode;
Genode::Xml_node config_node = Lx_kit::env().config_rom().xml();
try {
Genode::Xml_node node_hid = config()->xml_node().sub_node("hid");
Genode::Xml_node node_hid = config_node.sub_node("hid");
hid = true;
try {
@ -61,28 +66,28 @@ struct Services
multitouch = node_screen.attribute_value("multitouch", false);
} catch (...) {
screen_width = screen_height = 0;
PDBG("Could not read screen resolution in config node");
log("Could not read screen resolution in config node");
}
} catch (Xml_node::Nonexistent_sub_node) {
PDBG("No <hid> config node found - not starting the USB HID (Input) service");
log("No <hid> config node found - not starting the USB HID (Input) service");
}
try {
config()->xml_node().sub_node("storage");
config_node.sub_node("storage");
stor = true;
} catch (Xml_node::Nonexistent_sub_node) {
PDBG("No <storage> config node found - not starting the USB Storage (Block) service");
log("No <storage> config node found - not starting the USB Storage (Block) service");
}
try {
config()->xml_node().sub_node("nic");
config_node.sub_node("nic");
nic = true;
} catch (Xml_node::Nonexistent_sub_node) {
PDBG("No <nic> config node found - not starting the USB Nic (Network) service");
log("No <nic> config node found - not starting the USB Nic (Network) service");
}
try {
Genode::Xml_node node_raw = config()->xml_node().sub_node("raw");
Genode::Xml_node node_raw = config_node.sub_node("raw");
raw = true;
try {
@ -90,27 +95,27 @@ struct Services
raw_report_device_list = node_report.attribute_value("devices", false);
} catch (...) { }
} catch (Xml_node::Nonexistent_sub_node) {
PDBG("No <raw> config node found - not starting external USB service");
log("No <raw> config node found - not starting external USB service");
}
if (config()->xml_node().attribute_value("uhci", false)) {
if (config_node.attribute_value("uhci", false)) {
uhci = true;
PINF("Enabled UHCI (USB 1.0/1.1) support");
log("Enabled UHCI (USB 1.0/1.1) support");
}
if (config()->xml_node().attribute_value("ehci", false)) {
if (config_node.attribute_value("ehci", false)) {
ehci = true;
PINF("Enabled EHCI (USB 2.0) support");
log("Enabled EHCI (USB 2.0) support");
}
if (config()->xml_node().attribute_value("xhci", false)) {
if (config_node.attribute_value("xhci", false)) {
xhci = true;
PINF("Enabled XHCI (USB 3.0) support");
log("Enabled XHCI (USB 3.0) support");
}
if (!(uhci | ehci | xhci))
PWRN("Warning: No USB controllers enabled.\n"
"Use <config (u/e/x)hci=\"yes\"> in your 'usb_drv' configuration");
warning("Warning: No USB controllers enabled.\n"
"Use <config (u/e/x)hci=\"yes\"> in your 'usb_drv' configuration");
}
};

View File

@ -14,10 +14,9 @@
#ifndef _SIGNAL_H_
#define _SIGNAL_H_
#include <base/env.h>
#include <base/printf.h>
#include <platform.h>
#include <base/signal.h>
#include <os/server.h>
static bool const verbose = false;
@ -28,32 +27,34 @@ class Signal_helper
{
private:
Server::Entrypoint &_ep;
Genode::Signal_transmitter _sender;
Genode::Env &_env;
Genode::Signal_transmitter _sender;
public:
Signal_helper(Server::Entrypoint &ep) : _ep(ep) { }
Signal_helper(Genode::Env &env) : _env(env) { }
Server::Entrypoint &ep() { return _ep; }
Genode::Signal_transmitter &sender() { return _sender; }
Genode::Entrypoint &ep() { return _env.ep(); }
Genode::Signal_transmitter &sender() { return _sender; }
Genode::Parent &parent() { return _env.parent(); }
Genode::Env &env() { return _env; }
};
namespace Storage
{
void init(Server::Entrypoint &ep);
void init(Genode::Env &env);
}
namespace Nic
{
void init(Server::Entrypoint &ep);
void init(Genode::Env &env);
}
namespace Raw
{
void init(Server::Entrypoint &ep, bool report_device_list);
void init(Genode::Env &env, bool report_device_list);
}
#endif /* _SIGNAL_H_ */

View File

@ -17,6 +17,12 @@
#ifndef _ARM__PLATFORM_DEVICE__PLATFORM_DEVICE_H_
#define _ARM__PLATFORM_DEVICE__PLATFORM_DEVICE_H_
#include <lx_emul/extern_c_begin.h>
#include <lx_emul/printf.h>
#include <lx_emul/extern_c_end.h>
#include <lx_kit/malloc.h>
#include <platform_device/device.h>
#include <irq_session/connection.h>
@ -46,7 +52,7 @@ struct Platform::Device : Platform::Abstract_device, Genode::List<Device>::Eleme
Genode::Cache_attribute,
Genode::addr_t, Genode::size_t) override
{
PERR("%s: not implemented", __PRETTY_FUNCTION__);
lx_printf("%s: not implemented\n", __PRETTY_FUNCTION__);
return Genode::Io_mem_session_capability();
}
@ -63,7 +69,7 @@ struct Platform::Device : Platform::Abstract_device, Genode::List<Device>::Eleme
if (d->irq_num == irq_num)
return *d;
d = new (Genode::env()->heap()) Device(irq_num);
d = new (Lx::Malloc::mem()) Device(irq_num);
list().insert(d);
return *d;

View File

@ -14,6 +14,7 @@
#ifndef _USB_NIC_COMPONENT_H_
#define _USB_NIC_COMPONENT_H_
#include <base/log.h>
#include <nic/component.h>
#include <root/component.h>
@ -148,7 +149,7 @@ class Usb_nic::Session_component : public Nic::Session_component
Genode::Packet_descriptor packet = _tx.sink()->get_packet();
if (!packet.size()) {
PWRN("Invalid tx packet");
Genode::warning("Invalid tx packet");
return true;
}
@ -178,7 +179,7 @@ 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,
Server::Entrypoint &ep,
Genode::Entrypoint &ep,
Device *device)
: Nic::Session_component(tx_buf_size, rx_buf_size, rx_block_md_alloc, ram_session, ep),
_device(device)
@ -222,7 +223,7 @@ class Root : public Root_component
{
private:
Server::Entrypoint &_ep;
Genode::Env &_env;
Usb_nic::Device *_device;
protected:
@ -246,24 +247,24 @@ class Root : public Root_component
*/
if (tx_buf_size + rx_buf_size < tx_buf_size ||
tx_buf_size + rx_buf_size > ram_quota - session_size) {
PERR("insufficient 'ram_quota', got %zd, need %zd",
ram_quota, tx_buf_size + rx_buf_size + session_size);
Genode::error("insufficient 'ram_quota', got ", ram_quota, " need %zd",
tx_buf_size + rx_buf_size + session_size);
throw Genode::Root::Quota_exceeded();
}
return new (Root::md_alloc())
Usb_nic::Session_component(tx_buf_size, rx_buf_size,
*env()->heap(),
*env()->ram_session(),
_ep, _device);
Lx::Malloc::mem(),
_env.ram(),
_env.ep(), _device);
}
public:
Root(Server::Entrypoint &ep, Genode::Allocator &md_alloc,
Root(Genode::Env &env, Genode::Allocator &md_alloc,
Usb_nic::Device *device)
: Root_component(&ep.rpc_ep(), &md_alloc),
_ep(ep), _device(device)
: Root_component(&env.ep().rpc_ep(), &md_alloc),
_env(env), _device(device)
{ }
};

View File

@ -13,7 +13,6 @@
* under the terms of the GNU General Public License version 2.
*/
#include <base/printf.h>
#include <base/rpc_server.h>
#include <input/root.h>
#include <os/ring_buffer.h>
@ -77,8 +76,9 @@ void start_input_service(void *ep_ptr, void * service_ptr)
{
Rpc_entrypoint *ep = static_cast<Rpc_entrypoint *>(ep_ptr);
Services *service = static_cast<Services *>(service_ptr);
Env &env = service->env;
env()->parent()->announce(ep->manage(&input_root(ep)));
env.parent().announce(ep->manage(&input_root(ep)));
genode_input_register(input_callback, service->screen_width,
service->screen_height, service->multitouch);

View File

@ -82,24 +82,20 @@ void dma_free(void *ptr)
void *vzalloc(unsigned long size)
{
size_t real_size = size + sizeof(size_t);
size_t *addr;
try { addr = (size_t *)Genode::env()->heap()->alloc(real_size); }
try { addr = (size_t *)Lx::Malloc::mem().alloc_large(size); }
catch (...) { return 0; }
*addr = real_size;
memset(addr + 1, 0, size);
memset(addr, 0, size);
return addr + 1;
return addr;
}
void vfree(void *addr)
{
if (!addr) return;
size_t size = *(((size_t *)addr) - 1);
Genode::env()->heap()->free(const_cast<void *>(addr), size);
Lx::Malloc::mem().free_large(addr);
}
@ -266,17 +262,13 @@ int ilog2(u32 n) { return Genode::log2(n); }
** linux/slab.h **
********************/
void kmem_cache_destroy(struct kmem_cache *cache)
{
destroy(Genode::env()->heap(), cache);
}
void *kmem_cache_zalloc(struct kmem_cache *cache, gfp_t flags)
{
void *ret;
ret = kmem_cache_alloc(cache, flags);
memset(ret, 0, cache->size());
return ret;
}
@ -361,7 +353,7 @@ class Driver : public Genode::List<Driver>::Element
int driver_register(struct device_driver *drv)
{
lx_log(DEBUG_DRIVER, "%s at %p", drv->name, drv);
new (Genode::env()->heap()) Driver(drv);
new (Lx::Malloc::mem()) Driver(drv);
return 0;
}
@ -438,7 +430,7 @@ long find_next_zero_bit_le(const void *addr,
static unsigned cnt = 0;
unsigned long max_size = sizeof(long) * 8;
if (offset >= max_size) {
PWRN("Offset greater max size");
Genode::warning("Offset greater max size");
return offset + size;
}
@ -446,7 +438,7 @@ long find_next_zero_bit_le(const void *addr,
if (!(*(unsigned long*)addr & (1L << offset)))
return offset;
lx_log(DEBUG_TRACE, "No zero bit findable %u", cnt++);
Genode::warning("No zero bit findable");
return offset + size;
}
@ -551,7 +543,7 @@ struct dma_pool *dma_pool_create(const char *name, struct device *d, size_t size
if (align & (align - 1))
return 0;
dma_pool *pool = new(Genode::env()->heap()) dma_pool;
dma_pool *pool = new(Lx::Malloc::mem()) dma_pool;
pool->align = Genode::log2((int)align);
pool->size = size;
return pool;
@ -561,7 +553,7 @@ struct dma_pool *dma_pool_create(const char *name, struct device *d, size_t size
void dma_pool_destroy(struct dma_pool *d)
{
lx_log(DEBUG_DMA, "close");
destroy(Genode::env()->heap(), d);
destroy(Lx::Malloc::mem(), d);
}
@ -615,7 +607,7 @@ dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr,
dma_addr_t phys = (dma_addr_t)Lx::Malloc::dma().phys_addr(ptr);
if (phys == ~0UL)
PERR("translation virt->phys %p->%lx failed, return ip %p", ptr, phys,
Genode::error("translation virt->phys ", ptr, "->", Genode::Hex(phys), "failed, return ip ",
__builtin_return_address(0));
lx_log(DEBUG_DMA, "virt: %p phys: %lx", ptr, phys);
@ -649,9 +641,9 @@ struct task_struct *kthread_run(int (*fn)(void *), void *arg, const char *n, ...
*/
lx_log(DEBUG_THREAD, "Run %s", n);
new (Genode::env()->heap()) Lx::Task((void (*)(void *))fn, arg, n,
Lx::Task::PRIORITY_2,
Lx::scheduler());
new (Lx::Malloc::mem()) Lx::Task((void (*)(void *))fn, arg, n,
Lx::Task::PRIORITY_2,
Lx::scheduler());
return 0;
}
@ -728,7 +720,7 @@ int smp_call_function_single(int cpu, smp_call_func_t func, void *info,
struct net_device *alloc_etherdev(int sizeof_priv)
{
net_device *dev = new (Genode::env()->heap()) net_device();
net_device *dev = new (Lx::Malloc::mem()) net_device();
dev->mtu = 1500;
dev->hard_header_len = 0;
@ -1009,7 +1001,7 @@ void tasklet_hi_schedule(struct tasklet_struct *tasklet)
struct workqueue_struct *create_singlethread_workqueue(char const *name)
{
workqueue_struct *wq = (workqueue_struct *)kzalloc(sizeof(workqueue_struct), 0);
Lx::Work *work = Lx::Work::alloc_work_queue(Genode::env()->heap(), name);
Lx::Work *work = Lx::Work::alloc_work_queue(&Lx::Malloc::mem(), name);
wq->task = (void *)work;
return wq;

View File

@ -16,17 +16,17 @@
/* Genode */
#include <base/printf.h>
#include <base/sleep.h>
#include <os/server.h>
#include <nic_session/nic_session.h>
/* Local */
#include <platform.h>
#include <signal.h>
#include <lx_emul.h>
#include <lx_kit/env.h>
#include <lx_kit/irq.h>
#include <lx_kit/malloc.h>
#include <lx_kit/scheduler.h>
#include <lx_kit/timer.h>
#include <lx_kit/work.h>
@ -53,7 +53,7 @@ struct workqueue_struct *system_power_efficient_wq;
struct workqueue_struct *system_wq;
struct workqueue_struct *tasklet_wq;
void breakpoint() { PDBG("BREAK"); }
void breakpoint() { Genode::log("BREAK"); }
extern "C" int stdout_write(const char *);
@ -103,25 +103,26 @@ static void run_linux(void *s)
}
void start_usb_driver(Server::Entrypoint &ep)
void start_usb_driver(Genode::Env &env)
{
static Services services;
/* initialize USB env */
Lx_kit::construct_env(env);
static Services services(env);
if (services.hid)
start_input_service(&ep.rpc_ep(), &services);
start_input_service(&env.ep().rpc_ep(), &services);
Storage::init(ep);
Nic::init(ep);
Storage::init(env);
Nic::init(env);
if (services.raw)
Raw::init(ep, services.raw_report_device_list);
Raw::init(env, services.raw_report_device_list);
Lx::Scheduler &sched = Lx::scheduler();
Lx::Timer &timer = Lx::timer(&ep, &jiffies);
Lx::Irq::irq(&ep, Genode::env()->heap());
Lx::Work::work_queue(Genode::env()->heap());
Lx::Timer &timer = Lx::timer(&env.ep(), &jiffies);
Lx::Irq::irq(&env.ep(), &Lx_kit::env().heap());
Lx::Work::work_queue(&Lx_kit::env().heap());
static Lx::Task linux(run_linux, &services, "linux", Lx::Task::PRIORITY_0,
Lx::scheduler());

View File

@ -17,7 +17,6 @@
#include <cap_session/connection.h>
#include <nic/xml_node.h>
#include <util/xml_node.h>
#include <os/config.h>
#include <lx_emul.h>
#include <lx_emul/extern_c_begin.h>
@ -25,6 +24,9 @@
#include <linux/usb/usbnet.h>
#include <lx_emul/extern_c_end.h>
#include <lx_kit/env.h>
#include <lx_kit/malloc.h>
#include <usb_nic_component.h>
#include "signal.h"
@ -176,7 +178,7 @@ class Nic_device : public Usb_nic::Device
* Add device
*/
static Nic_device *add(struct net_device *ndev) {
return new (Genode::env()->heap()) Nic_device(ndev); }
return new (Lx::Malloc::mem()) Nic_device(ndev); }
/**
* Report link state
@ -244,7 +246,7 @@ class Nic_device : public Usb_nic::Device
_ndev->netdev_ops->ndo_start_xmit(skb, _ndev);
if (dropped < dev->net->stats.tx_dropped)
PWRN("Dropped SKB");
Genode::warning("Dropped SKB");
}
/**
@ -254,7 +256,7 @@ class Nic_device : public Usb_nic::Device
{
struct usbnet *dev = (usbnet *)netdev_priv(_ndev);
if(!_tx_fixup || !_tx_fixup(dev, skb, 0))
PERR("Tx fixup error");
Genode::error("Tx fixup error");
}
@ -302,8 +304,8 @@ class Nic_device : public Usb_nic::Device
static Nic_device *_nic = 0;
void Nic::init(Server::Entrypoint &ep) {
_signal = new (Genode::env()->heap()) Signal_helper(ep); }
void Nic::init(Genode::Env &env) {
_signal = new (Lx::Malloc::mem()) Signal_helper(env); }
/***********************
@ -320,7 +322,7 @@ int register_netdev(struct net_device *ndev)
/* XXX: move to 'main' */
if (!announce) {
static ::Root root(_signal->ep(), *env()->heap(), nic);
static ::Root root(_signal->env(), Lx::Malloc::mem(), nic);
announce = true;
@ -334,7 +336,7 @@ int register_netdev(struct net_device *ndev)
ndev->netdev_ops->ndo_set_rx_mode(ndev);
_nic = nic;
env()->parent()->announce(_signal->ep().rpc_ep().manage(&root));
_signal->parent().announce(_signal->ep().rpc_ep().manage(&root));
}
return err;
@ -387,7 +389,7 @@ int netif_rx(struct sk_buff *skb)
try {
_stat.data(new (skb->data) Net::Ethernet_frame(skb->len), skb->len);
} catch(Net::Ethernet_frame::No_ethernet_frame) {
PWRN("No ether frame");
Genode::warning("No ether frame");
}
}
#endif
@ -441,7 +443,7 @@ struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev, unsigned int l
void dev_kfree_skb(struct sk_buff *skb)
{
lx_log(DEBUG_SKB, "free skb: %p start: %p cloned: %d",
skb, skb->start, skb->cloned);
skb, skb->start, skb->cloned);
if (skb->cloned) {
skb->start = skb->clone;
@ -466,8 +468,8 @@ void kfree_skb(struct sk_buff *skb) { dev_kfree_skb(skb); }
void skb_reserve(struct sk_buff *skb, int len)
{
if ((skb->data + len) > skb->end) {
PERR("Error resevring SKB data: skb: %p data: %p end: %p len: %d",
skb, skb->data, skb->end, skb->len);
Genode::error("Error resevring SKB data: skb: ", skb, " data: ", skb->data,
" end: ", skb->end, "len: ", skb->len);
return;
}
skb->data += len;
@ -481,8 +483,8 @@ void skb_reserve(struct sk_buff *skb, int len)
unsigned char *skb_push(struct sk_buff *skb, unsigned int len)
{
if((skb->data - len) < skb->start) {
PERR("Error SKB head room too small: %p data: %p start: %p len: %u",
skb, skb->data, skb->start, len);
Genode::error("Error SKB head room too small: ", skb, " data: ", skb->data,
" start: ", skb->start, " len: ", len);
return 0;
}
@ -500,8 +502,8 @@ unsigned char *skb_push(struct sk_buff *skb, unsigned int len)
unsigned char *skb_put(struct sk_buff *skb, unsigned int len)
{
if ((skb->data + len > skb->end)) {
PERR("Error increasing SKB length: skb: %p data: %p end: %p len: %u",
skb, skb->data, skb->end, len);
Genode::error("Error increasing SKB length: skb: ", skb, " data: ", skb->data,
" end: ", skb->end, " len: ", len);
return 0;
}
@ -535,8 +537,8 @@ int skb_tailroom(const struct sk_buff *skb)
unsigned char *skb_pull(struct sk_buff *skb, unsigned int len)
{
if (len > skb->len) {
PERR("Error try to pull too much: skb: %p len: %u pull len: %u",
skb, skb->len, len);
Genode::error("Error try to pull too much: skb: ", skb, " len: ", skb->len,
" pull len: ", len);
return 0;
}
skb->len -= len;
@ -551,8 +553,8 @@ unsigned char *skb_pull(struct sk_buff *skb, unsigned int len)
void skb_trim(struct sk_buff *skb, unsigned int len)
{
if (skb->len <= len) {
PERR("Error trimming to %u bytes skb: %p data: %p start: %p len %u ret: %p",
len, skb, skb->data, skb->start, skb->len, __builtin_return_address((0)));
Genode::error("Error trimming to ", len, " bytes skb: ", skb, " data: ",
skb->data, " start: ", skb->start, " len ", skb->len);
return;
}
@ -708,16 +710,17 @@ void random_ether_addr(u8 *addr)
u8 fallback[] = { 0x2e, 0x60, 0x90, 0x0c, 0x4e, 0x01 };
Nic::Mac_address mac;
Xml_node config_node = Lx_kit::env().config_rom().xml();
/* try using configured mac */
try {
Xml_node nic_config = config()->xml_node().sub_node("nic");
Xml_node nic_config = config_node.sub_node("nic");
Xml_node::Attribute mac_node = nic_config.attribute("mac");
mac_node.value(&mac);
} catch (...) {
/* use fallback mac */
snprint_mac(str, fallback);
PWRN("No mac address or wrong format attribute in <nic> - using fallback (%s)",
str);
Genode::warning("No mac address or wrong format attribute in <nic> - using fallback (", str, ")");
Genode::memcpy(addr, fallback, ETH_ALEN);
return;
@ -726,7 +729,7 @@ void random_ether_addr(u8 *addr)
/* use configured mac*/
Genode::memcpy(addr, mac.addr, ETH_ALEN);
snprint_mac(str, (u8 *)mac.addr);
PINF("Using configured mac: %s", str);
Genode::log("Using configured mac: ", str);
#ifdef GENODE_NET_STAT
_stat.set_mac(mac.addr);

View File

@ -11,8 +11,7 @@
* under the terms of the GNU General Public License version 2.
*/
#include <base/env.h>
#include <base/printf.h>
#include <base/log.h>
#include <os/reporter.h>
#include <os/session_policy.h>
#include <root/component.h>
@ -26,6 +25,7 @@
#include <lx_emul/extern_c_end.h>
#include <signal.h>
#include <lx_kit/malloc.h>
#include <lx_kit/scheduler.h>
using namespace Genode;
@ -183,7 +183,7 @@ class Usb::Worker
int length;
if ((length = usb_string(_device->udev, p.string.index, buffer, p.size())) < 0) {
PWRN("Could not read string descriptor index: %u", p.string.index);
warning("Could not read string descriptor index: ", (unsigned)p.string.index);
p.string.length = 0;
} else {
/* returned length is in bytes (char) */
@ -296,7 +296,7 @@ class Usb::Worker
urb *bulk_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!bulk_urb) {
PERR("Failed to allocate bulk URB");
error("Failed to allocate bulk URB");
kfree(buf);
return false;
}
@ -309,7 +309,7 @@ class Usb::Worker
_async_complete, data);
if (usb_submit_urb(bulk_urb, GFP_KERNEL))
PERR("Failed to submit URB");
error("Failed to submit URB");
return true;
}
@ -331,7 +331,7 @@ class Usb::Worker
urb *irq_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!irq_urb) {
PERR("Failed to allocate interrupt URB");
error("Failed to allocate interrupt URB");
kfree(buf);
return false;
}
@ -344,7 +344,7 @@ class Usb::Worker
_async_complete, data, p.transfer.timeout);
if (usb_submit_urb(irq_urb, GFP_KERNEL))
PERR("Failed to submit URB");
error("Failed to submit URB");
return true;
}
@ -372,7 +372,7 @@ class Usb::Worker
for (unsigned i = 0; i < config->desc.bNumInterfaces; i++) {
if (usb_interface_claimed(config->interface[i])) {
PERR("There are interfaces claimed, won't set configuration");
error("There are interfaces claimed, won't set configuration");
return;
}
}
@ -411,7 +411,7 @@ class Usb::Worker
Packet_descriptor p = _sink->get_packet();
if (verbose_raw)
PDBG("PACKET: %u first value: %x", p.type, p.number);
log("PACKET: ", (unsigned)p.type, " first value: ", Hex(p.number));
_p_in_flight++;
@ -500,7 +500,7 @@ class Usb::Worker
void start()
{
if (!_task) {
_task = new (Genode::env()->heap()) Lx::Task(run, this, "raw_worker",
_task = new (Lx::Malloc::mem()) Lx::Task(run, this, "raw_worker",
Lx::Task::PRIORITY_2,
Lx::scheduler());
if (!Lx::scheduler().active()) {
@ -513,7 +513,7 @@ class Usb::Worker
{
if (_task) {
Lx::scheduler().remove(_task);
destroy(Genode::env()->heap(), _task);
destroy(Lx::Malloc::mem(), _task);
_task = nullptr;
}
}
@ -539,7 +539,7 @@ class Usb::Session_component : public Session_rpc_object,
{
private:
Server::Entrypoint &_ep;
Genode::Entrypoint &_ep;
unsigned long _vendor;
unsigned long _product;
long _bus = 0;
@ -571,7 +571,7 @@ class Usb::Session_component : public Session_rpc_object,
DEVICE_REMOVE,
};
Session_component(Genode::Ram_dataspace_capability tx_ds, Server::Entrypoint &ep,
Session_component(Genode::Ram_dataspace_capability tx_ds, Genode::Entrypoint &ep,
unsigned long vendor, unsigned long product,
long bus, long dev)
: Session_rpc_object(tx_ds, ep.rpc_ep()),
@ -700,9 +700,10 @@ class Usb::Session_component : public Session_rpc_object,
return false;
if (_device)
PWRN("Device type already present (vendor: %x product: %x). Overwrite!",
device->udev->descriptor.idVendor,
device->udev->descriptor.idProduct);
warning("Device type already present (vendor: ",
Hex(device->udev->descriptor.idVendor),
" product: ", Hex(device->udev->descriptor.idProduct),
") Overwrite!");
_device = device;
_worker.device(_device, _sigh_state_change);
@ -754,18 +755,18 @@ class Usb::Root : public Genode::Root_component<Session_component>
{
private:
Server::Entrypoint &_ep;
Genode::Env &_env;
Genode::Signal_rpc_member<Usb::Root> _config_dispatcher = {
_ep, *this, &Usb::Root::_handle_config };
_env.ep(), *this, &Usb::Root::_handle_config };
Genode::Reporter _config_reporter { "config" };
void _handle_config(unsigned)
{
Genode::config()->reload();
Lx_kit::env().config_rom().update();
Genode::Xml_node config = Genode::config()->xml_node();
Genode::Xml_node config = Lx_kit::env().config_rom().xml();
if (!_config_reporter.enabled())
_config_reporter.enabled(true);
@ -790,7 +791,8 @@ class Usb::Root : public Genode::Root_component<Session_component>
using namespace Genode;
try {
Xml_node raw = Genode::config()->xml_node().sub_node("raw");
Xml_node config_node = Lx_kit::env().config_rom().xml();
Xml_node raw = config_node.sub_node("raw");
Genode::Session_label label(args);
Genode::Session_policy policy(label, raw);
@ -808,19 +810,19 @@ class Usb::Root : public Genode::Root_component<Session_component>
throw Root::Quota_exceeded();
if (tx_buf_size > ram_quota - session_size) {
PERR("Insufficient 'ram_quota',got %zu, need %zu",
ram_quota, tx_buf_size + session_size);
error("Insufficient 'ram_quota',got ", ram_quota, " need ",
tx_buf_size + session_size);
throw Root::Quota_exceeded();
}
Ram_dataspace_capability tx_ds = env()->ram_session()->alloc(tx_buf_size);
Ram_dataspace_capability tx_ds = _env.ram().alloc(tx_buf_size);
Session_component *session = new (md_alloc())
Session_component(tx_ds, _ep, vendor, product, bus, dev);
Session_component(tx_ds, _env.ep(), vendor, product, bus, dev);
::Session::list()->insert(session);
return session;
} catch (Genode::Session_policy::No_policy_defined) {
PERR("Invalid session request, no matching policy for '%s'",
Genode::Session_label(args).string());
error("Invalid session request, no matching policy for '",
Genode::Session_label(args).string(), "'");
throw Genode::Root::Unavailable();
}
}
@ -832,26 +834,26 @@ class Usb::Root : public Genode::Root_component<Session_component>
::Session::list()->remove(session);
Genode::Root_component<Session_component>::_destroy_session(session);
Genode::env()->ram_session()->free(tx_ds);
_env.ram().free(tx_ds);
}
public:
Root(Server::Entrypoint &session_ep,
Root(Genode::Env &env,
Genode::Allocator *md_alloc)
: Genode::Root_component<Session_component>(&session_ep.rpc_ep(), md_alloc),
_ep(session_ep)
: Genode::Root_component<Session_component>(&env.ep().rpc_ep(), md_alloc),
_env(env)
{
Genode::config()->sigh(_config_dispatcher);
Lx_kit::env().config_rom().sigh(_config_dispatcher);
}
};
void Raw::init(Server::Entrypoint &ep, bool report_device_list)
void Raw::init(Genode::Env &env, bool report_device_list)
{
Device::device_list_reporter().enabled(report_device_list);
static Usb::Root root(ep, env()->heap());
Genode::env()->parent()->announce(ep.rpc_ep().manage(&root));
static Usb::Root root(env, &Lx::Malloc::mem());
env.parent().announce(env.ep().rpc_ep().manage(&root));
}
@ -864,9 +866,9 @@ int raw_notify(struct notifier_block *nb, unsigned long action, void *data)
struct usb_device *udev = (struct usb_device*)data;
if (verbose_raw)
PDBG("RAW: %s vendor: %04x product: %04x\n",
action == USB_DEVICE_ADD ? "Add" : "Remove",
udev->descriptor.idVendor, udev->descriptor.idProduct);
log("RAW: ",action == USB_DEVICE_ADD ? "Add" : "Remove",
" vendor: ", Hex(udev->descriptor.idVendor),
" product: ", Hex(udev->descriptor.idProduct));
switch (action) {
@ -874,7 +876,7 @@ int raw_notify(struct notifier_block *nb, unsigned long action, void *data)
case USB_DEVICE_ADD:
{
::Session::list()->state_change(Usb::Session_component::DEVICE_ADD,
new (env()->heap()) Device(udev));
new (Lx::Malloc::mem()) Device(udev));
break;
}
@ -884,7 +886,7 @@ int raw_notify(struct notifier_block *nb, unsigned long action, void *data)
udev->devnum);
if (dev) {
::Session::list()->state_change(Usb::Session_component::DEVICE_REMOVE, dev);
destroy(env()->heap(), dev);
destroy(Lx::Malloc::mem(), dev);
}
break;
}

View File

@ -14,6 +14,7 @@
#include <os/attached_io_mem_dataspace.h>
#include <lx_emul.h>
#include <lx_kit/malloc.h>
#define to_platform_driver(drv) (container_of((drv), struct platform_driver, \
driver))
@ -197,7 +198,7 @@ void platform_set_drvdata(struct platform_device *pdev, void *data)
void *_ioremap(phys_addr_t phys_addr, unsigned long size, int wc)
{
try {
Genode::Attached_io_mem_dataspace *ds = new(Genode::env()->heap())
Genode::Attached_io_mem_dataspace *ds = new(Lx::Malloc::mem())
Genode::Attached_io_mem_dataspace(phys_addr, size, !!wc);
return ds->local_addr<void>();
} catch (...) {

View File

@ -11,11 +11,10 @@
* under the terms of the GNU General Public License version 2.
*/
#include <base/env.h>
#include <lx_emul/irq.h>
#include <base/env.h>
#include <lx_kit/backend_alloc.h>
#include <lx_kit/env.h>
#include <lx_kit/irq.h>
@ -25,11 +24,11 @@
Genode::Ram_dataspace_capability
Lx::backend_alloc(Genode::addr_t size, Genode::Cache_attribute cached) {
return Genode::env()->ram_session()->alloc(size, cached); }
return Lx_kit::env().env().ram().alloc(size, cached); }
void Lx::backend_free(Genode::Ram_dataspace_capability cap) {
return Genode::env()->ram_session()->free(cap); }
return Lx_kit::env().env().ram().free(cap); }
/***********************

View File

@ -116,7 +116,7 @@ static void gpio_direction_output(Gpio_bank *bank, int gpio, int en)
}
static void arndale_ehci_init()
static void arndale_ehci_init(Genode::Env &env)
{
enum Gpio_offset { D1 = 0x180, X3 = 0xc60 };
@ -128,8 +128,8 @@ static void arndale_ehci_init()
reg_pwr.state(true);
/* reset hub via GPIO */
Io_mem_connection io_gpio(GPIO_BASE, 0x1000);
addr_t gpio_base = (addr_t)env()->rm_session()->attach(io_gpio.dataspace());
Io_mem_connection io_gpio(env, GPIO_BASE, 0x1000);
addr_t gpio_base = (addr_t)env.rm().attach(io_gpio.dataspace());
Gpio_bank *d1 = reinterpret_cast<Gpio_bank *>(gpio_base + D1);
Gpio_bank *x3 = reinterpret_cast<Gpio_bank *>(gpio_base + X3);
@ -142,14 +142,14 @@ static void arndale_ehci_init()
gpio_direction_output(x3, 5, 1);
gpio_direction_output(d1, 7, 1);
env()->rm_session()->detach(gpio_base);
env.rm().detach(gpio_base);
/* reset ehci controller */
Io_mem_connection io_ehci(EHCI_BASE, 0x1000);
addr_t ehci_base = (addr_t)env()->rm_session()->attach(io_ehci.dataspace());
Io_mem_connection io_ehci(env, EHCI_BASE, 0x1000);
addr_t ehci_base = (addr_t)env.rm().attach(io_ehci.dataspace());
Ehci ehci(ehci_base);
env()->rm_session()->detach(ehci_base);
env.rm().detach(ehci_base);
}
@ -267,7 +267,7 @@ struct Phy_usb3 : Genode::Mmio
};
static void arndale_xhci_init()
static void arndale_xhci_init(Genode::Env &env)
{
/* enable USB3 clock and power up */
static Regulator::Connection reg_clk(Regulator::CLK_USB30);
@ -277,7 +277,7 @@ static void arndale_xhci_init()
reg_pwr.state(true);
/* setup PHY */
Attached_io_mem_dataspace io_phy(DWC3_PHY_BASE, 0x1000);
Attached_io_mem_dataspace io_phy(env, DWC3_PHY_BASE, 0x1000);
Phy_usb3 phy((addr_t)io_phy.local_addr<addr_t>());
}
@ -300,7 +300,7 @@ void ehci_setup(Services *services)
module_ehci_exynos_init();
/* setup controller */
arndale_ehci_init();
arndale_ehci_init(services->env);
/* setup EHCI-controller platform device */
platform_device *pdev = (platform_device *)kzalloc(sizeof(platform_device), 0);
@ -326,7 +326,7 @@ void xhci_setup(Services *services)
module_dwc3_driver_init();
module_xhci_plat_init();
arndale_xhci_init();
arndale_xhci_init(services->env);
/* setup DWC3-controller platform device */
platform_device *pdev = (platform_device *)kzalloc(sizeof(platform_device), 0);

View File

@ -130,18 +130,18 @@ static void clock_pwr_init()
reg_pwr.state(true);
}
static void usb_phy_init()
static void usb_phy_init(Genode::Env &env)
{
Io_mem_connection io_usbotg(USBOTG, 0x1000);
addr_t usbotg_base = (addr_t)env()->rm_session()->attach(io_usbotg.dataspace());
Io_mem_connection io_usbotg(env, USBOTG, 0x1000);
addr_t usbotg_base = (addr_t)env.rm().attach(io_usbotg.dataspace());
Usb_Otg usbotg(usbotg_base);
env()->rm_session()->detach(usbotg_base);
env.rm().detach(usbotg_base);
}
static void odroidx2_ehci_init()
static void odroidx2_ehci_init(Genode::Env &env)
{
clock_pwr_init();
usb_phy_init();
usb_phy_init(env);
/* reset hub via GPIO */
enum { X30 = 294, X34 = 298, X35 = 299 };
@ -161,12 +161,12 @@ static void odroidx2_ehci_init()
gpio_x34.write(true);
/* reset ehci controller */
Io_mem_connection io_ehci(EHCI_BASE, 0x1000);
addr_t ehci_base = (addr_t)env()->rm_session()->attach(io_ehci.dataspace());
Io_mem_connection io_ehci(env, EHCI_BASE, 0x1000);
addr_t ehci_base = (addr_t)env.rm().attach(io_ehci.dataspace());
Ehci ehci(ehci_base);
env()->rm_session()->detach(ehci_base);
env.rm().detach(ehci_base);
}
extern "C" void module_ehci_exynos_init();
@ -187,7 +187,7 @@ void ehci_setup(Services *services)
module_ehci_exynos_init();
/* setup controller */
odroidx2_ehci_init();
odroidx2_ehci_init(services->env);
/* setup EHCI-controller platform device */
platform_device *pdev = (platform_device *)kzalloc(sizeof(platform_device), 0);

View File

@ -224,14 +224,14 @@ struct Ehci : Genode::Mmio
* Initialize the USB controller from scratch, since the boot loader might not
* do it or even disable USB.
*/
static void omap_ehci_init()
static void omap_ehci_init(Genode::Env &env)
{
/* taken from the Panda board manual */
enum { HUB_POWER = 1, HUB_NRESET = 62, ULPI_PHY_TYPE = 182 };
/* SCRM */
Io_mem_connection io_scrm(SCRM_BASE, 0x1000);
addr_t scrm_base = (addr_t)env()->rm_session()->attach(io_scrm.dataspace());
Io_mem_connection io_scrm(env, SCRM_BASE, 0x1000);
addr_t scrm_base = (addr_t)env.rm().attach(io_scrm.dataspace());
/* enable reference clock */
Aux3 aux3(scrm_base);
@ -247,18 +247,18 @@ static void omap_ehci_init()
gpio_reset.write(true);
/* enable clocks */
Io_mem_connection io_clock(CAM_BASE, 0x1000);
addr_t clock_base = (addr_t)env()->rm_session()->attach(io_clock.dataspace());
Io_mem_connection io_clock(env, CAM_BASE, 0x1000);
addr_t clock_base = (addr_t)env.rm().attach(io_clock.dataspace());
Clocks c(clock_base);
/* reset TLL */
Io_mem_connection io_tll(TLL_BASE, 0x1000);
addr_t tll_base = (addr_t)env()->rm_session()->attach(io_tll.dataspace());
Io_mem_connection io_tll(env, TLL_BASE, 0x1000);
addr_t tll_base = (addr_t)env.rm().attach(io_tll.dataspace());
Tll t(tll_base);
/* reset host */
Io_mem_connection io_uhh(UHH_BASE, 0x1000);
addr_t uhh_base = (addr_t)env()->rm_session()->attach(io_uhh.dataspace());
Io_mem_connection io_uhh(env, UHH_BASE, 0x1000);
addr_t uhh_base = (addr_t)env.rm().attach(io_uhh.dataspace());
Uhh uhh(uhh_base);
/* enable hub power */
@ -270,7 +270,7 @@ static void omap_ehci_init()
addr_t base[] = { scrm_base, clock_base, tll_base, uhh_base, 0 };
for (int i = 0; base[i]; i++)
env()->rm_session()->detach(base[i]);
env.rm().detach(base[i]);
}
@ -293,7 +293,7 @@ void platform_hcd_init(Services *services)
module_ehci_omap_init();
/* initialize EHCI */
omap_ehci_init();
omap_ehci_init(services->env);
/* setup EHCI-controller platform device */
platform_device *pdev = (platform_device *)kzalloc(sizeof(platform_device), 0);
@ -314,7 +314,7 @@ void platform_hcd_init(Services *services)
static u64 dma_mask = ~(u64)0;
pdev->dev.dma_mask = &dma_mask;
pdev->dev.coherent_dma_mask = ~0;
PDBG("register platform device");
platform_device_register(pdev);
}

View File

@ -204,7 +204,7 @@ extern "C" long name() { return retval; }
int in_irq()
{
TRACE; PDBG("called by %p", __builtin_return_address(0));
TRACE;
return 0;
}

View File

@ -16,13 +16,14 @@
#include <base/entrypoint.h>
#include <base/lock.h>
#include <base/signal.h>
#include <os/config.h>
#include <util/misc_math.h>
#include <lx_emul.h>
#include <lx_kit/env.h>
#include <lx_kit/irq.h>
#include <lx_kit/pci_dev_registry.h>
#include <lx_kit/malloc.h>
#include <lx_kit/mapped_io_mem_range.h>
#include <lx_emul/impl/io.h>
@ -60,8 +61,8 @@ class Pci_dev_list
* 'Out_of_metadata' exception.
*/
auto handler = [&] () {
Genode::env()->parent()->upgrade(Lx::pci()->cap(),
"ram_quota=4096"); };
Lx_kit::env().env().parent().upgrade(Lx::pci()->cap(),
"ram_quota=4096"); };
/*
* Obtain first device, the operation may exceed the session quota.
@ -76,7 +77,7 @@ class Pci_dev_list
*/
while (cap.valid()) {
_pci_caps.insert(new (Genode::env()->heap()) Element(cap));
_pci_caps.insert(new (Lx::Malloc::mem()) Element(cap));
/* try next one. Upgrade session * quota on demand.*/
auto attempt = [&] () {
@ -144,7 +145,7 @@ extern "C" int pci_register_driver(struct pci_driver *driver)
return false;
/* create 'pci_dev' struct for matching device */
Lx::Pci_dev *pci_dev = new (env()->heap()) Lx::Pci_dev(cap);
Lx::Pci_dev *pci_dev = new (Lx::Malloc::mem()) Lx::Pci_dev(cap);
/* enable ioremap to work */
Lx::pci_dev_registry()->insert(pci_dev);
@ -157,7 +158,7 @@ extern "C" int pci_register_driver(struct pci_driver *driver)
* access the USB controller after bootup. For this the ext cap register of
* the PCI config space is checked
*/
if (config()->xml_node().attribute_value("bios_handoff", true))
if (Lx_kit::env().config_rom().xml().attribute_value("bios_handoff", true))
__pci_fixup_quirk_usb_early_handoff(pci_dev);
/* call probe function of the Linux driver */

View File

@ -11,6 +11,7 @@
* under the terms of the GNU General Public License version 2.
*/
#include <base/log.h>
#include <base/rpc_server.h>
#include <block/component.h>
#include <cap_session/connection.h>
@ -19,6 +20,7 @@
#include <lx_emul.h>
#include <lx_kit/malloc.h>
#include <lx_kit/backend_alloc.h>
#include <lx_kit/scheduler.h>
@ -75,7 +77,7 @@ class Storage_device : public Genode::List<Storage_device>::Element,
_block_count++;
if (verbose)
PDBG("block size: %zu block count: %llu", _block_size, _block_count);
Genode::log("block size: ", _block_size, " block count", _block_count);
scsi_free_buffer(cmnd);
_scsi_free_command(cmnd);
@ -89,8 +91,8 @@ class Storage_device : public Genode::List<Storage_device>::Element,
throw Io_error();
if (verbose)
PDBG("PACKET: phys: %lx block: %llu count: %zu %s",
phys, block_nr, block_count, read ? "read" : "write");
log("PACKET: phys: ", Genode::Hex(phys), " block: ", block_nr, "count: ", block_count,
read ? " read" : " write");
/* check if we can call queuecommand */
struct us_data *us = (struct us_data *) _sdev->host->hostdata;
@ -105,7 +107,7 @@ class Storage_device : public Genode::List<Storage_device>::Element,
cmnd->sc_data_direction = read ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
cmnd->scsi_done = _async_done;
Block::Packet_descriptor *p = new (Genode::env()->heap()) Block::Packet_descriptor();
Block::Packet_descriptor *p = new (Lx::Malloc::mem()) Block::Packet_descriptor();
*p = packet;
cmnd->packet = (void *)p;
@ -176,8 +178,8 @@ class Storage_device : public Genode::List<Storage_device>::Element,
};
void Storage::init(Server::Entrypoint &ep) {
_signal = new (Genode::env()->heap()) Signal_helper(ep); }
void Storage::init(Genode::Env &env) {
_signal = new (Lx::Malloc::mem()) Signal_helper(env); }
struct Factory : Block::Driver_factory
@ -201,10 +203,10 @@ extern "C" void ack_packet(work_struct *work)
(Block::Packet_descriptor *)(work->data);
if (verbose)
PDBG("ACK packet for block: %llu", packet->block_number());
Genode::log("ACK packet for block: ", packet->block_number());
device->ack_packet(*packet);
Genode::destroy(Genode::env()->heap(), packet);
Genode::destroy(Lx::Malloc::mem(), packet);
}
@ -221,8 +223,8 @@ void scsi_add_device(struct scsi_device *sdev)
*/
if (!announce) {
PREPARE_WORK(&delayed, ack_packet);
static Block::Root root(_signal->ep(), env()->heap(), factory);
env()->parent()->announce(_signal->ep().rpc_ep().manage(&root));
static Block::Root root(_signal->ep(), &Lx::Malloc::mem(), factory);
_signal->parent().announce(_signal->ep().rpc_ep().manage(&root));
announce = true;
}
}

View File

@ -209,7 +209,6 @@ DUMMY(0, ipv6_hdr)
DUMMY(0, irqs_disabled)
DUMMY(0, isalpha)
DUMMY(0, jhash_2words)
DUMMY(0, kmem_cache_destroy)
DUMMY(0, kobject_uevent)
DUMMY(0, kobject_uevent_env)
DUMMY(0, kstrtoul)

View File

@ -24,8 +24,13 @@ class Usb::Packet_handler
private:
Usb::Connection &_connection;
Signal_rpc_member<Packet_handler> _rpc_ack_avail;
Signal_rpc_member<Packet_handler> _rpc_ready_submit;
Genode::Entrypoint &_ep;
Signal_rpc_member<Packet_handler> _rpc_ack_avail =
{_ep, *this, &Packet_handler::_packet_handler };
Signal_rpc_member<Packet_handler> _rpc_ready_submit =
{ _ep, *this, &Packet_handler::_ready_handler };
bool _ready_submit = true;
@ -51,10 +56,8 @@ class Usb::Packet_handler
public:
Packet_handler(Connection &connection, Server::Entrypoint &ep)
: _connection(connection),
_rpc_ack_avail(ep, *this, &Packet_handler::_packet_handler),
_rpc_ready_submit(ep, *this, &Packet_handler::_ready_handler)
Packet_handler(Connection &connection, Genode::Entrypoint &ep)
: _connection(connection), _ep(ep)
{
/* connect 'ack_avail' to our rpc member */
_connection.tx_channel()->sigh_ack_avail(_rpc_ack_avail);
@ -73,7 +76,7 @@ class Usb::Packet_handler
void wait_for_packet()
{
packet_avail() ? _packet_handler(0) : Server::wait_and_dispatch_one_signal();
packet_avail() ? _packet_handler(0) : _ep.wait_and_dispatch_one_signal();
}
Packet_descriptor alloc(size_t size)
@ -104,7 +107,7 @@ class Usb::Packet_handler
/* wait for ready_to_submit signal */
while (!_ready_submit)
Server::wait_and_dispatch_one_signal();
_ep.wait_and_dispatch_one_signal();
}
_connection.source()->submit_packet(p);

View File

@ -14,6 +14,7 @@
#define _INCLUDE__USB__USB_H_
#include <base/allocator.h>
#include <base/entrypoint.h>
#include <usb/types.h>
#include <usb/packet_handler.h>
#include <usb_session/connection.h>
@ -451,7 +452,7 @@ class Usb::Device : public Meta_data
String serial_number_string;
Device(Genode::Allocator * const md_alloc, Connection &connection,
Server::Entrypoint &ep)
Genode::Entrypoint &ep)
: Meta_data(md_alloc, connection, _handler), _handler(connection, ep)
{ }