mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-23 01:08:55 +00:00
lx_kit: adjust to 4.16.3
This commit is contained in:
committed by
Josef Söntgen
parent
bb8e532361
commit
2efc64ace7
@ -90,6 +90,8 @@ void Lx::pci_init(Genode::Env &env, Genode::Ram_session &ram,
|
||||
_global_pci.construct(env);
|
||||
_global_ram = &ram;
|
||||
_global_md_alloc = &md_alloc;
|
||||
|
||||
Lx::pci_dev_registry(&env);
|
||||
}
|
||||
|
||||
|
||||
@ -99,9 +101,9 @@ Platform::Connection *Lx::pci()
|
||||
}
|
||||
|
||||
|
||||
Lx::Pci_dev_registry *Lx::pci_dev_registry()
|
||||
Lx::Pci_dev_registry *Lx::pci_dev_registry(Genode::Env *env)
|
||||
{
|
||||
static Lx::Pci_dev_registry _pci_dev_registry;
|
||||
static Lx::Pci_dev_registry _pci_dev_registry(*env);
|
||||
return &_pci_dev_registry;
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ class Lx::Format_command
|
||||
if (!format[++consumed]) return;
|
||||
|
||||
/* check for %$x syntax */
|
||||
prefix = (format[consumed] == '#');
|
||||
prefix = (format[consumed] == '#') || (format[consumed] == '.');
|
||||
if (prefix && !format[++consumed]) return;
|
||||
|
||||
/* heading zero indicates zero-padding */
|
||||
|
@ -61,7 +61,7 @@ class Lx_kit::Timer : public Lx::Timer
|
||||
{
|
||||
timer_list *t = static_cast<timer_list *>(timer);
|
||||
if (t->function)
|
||||
t->function(t->data);
|
||||
t->function(t);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -36,6 +36,8 @@ class Lx_kit::Work : public Lx::Work
|
||||
*/
|
||||
struct Context : public Lx_kit::List<Context>::Element
|
||||
{
|
||||
Lx::Task *waiting_task { nullptr };
|
||||
|
||||
void *work;
|
||||
enum Type { NORMAL, DELAYED, TASKLET } type;
|
||||
|
||||
@ -86,6 +88,9 @@ class Lx_kit::Work : public Lx::Work
|
||||
|
||||
public:
|
||||
|
||||
Lx::Task *_waiting_task = nullptr;
|
||||
|
||||
|
||||
Work(Genode::Allocator &alloc, char const *name = "work_queue")
|
||||
: _task(Work::run_work, reinterpret_cast<void*>(this), name,
|
||||
Lx::Task::PRIORITY_2, Lx::scheduler()),
|
||||
@ -99,6 +104,12 @@ class Lx_kit::Work : public Lx::Work
|
||||
while (Context *c = _list.first()) {
|
||||
_list.remove(c);
|
||||
c->exec();
|
||||
|
||||
if (c->waiting_task) {
|
||||
c->waiting_task->unblock();
|
||||
c->waiting_task = nullptr;
|
||||
}
|
||||
|
||||
destroy(&_work_alloc, c);
|
||||
}
|
||||
}
|
||||
@ -108,6 +119,12 @@ class Lx_kit::Work : public Lx::Work
|
||||
Work *work_queue = reinterpret_cast<Work*>(wq);
|
||||
while (1) {
|
||||
work_queue->exec();
|
||||
|
||||
if (work_queue->_waiting_task) {
|
||||
work_queue->_waiting_task->unblock();
|
||||
work_queue->_waiting_task = nullptr;
|
||||
}
|
||||
|
||||
Lx::scheduler().current()->block_and_schedule();
|
||||
}
|
||||
}
|
||||
@ -116,15 +133,41 @@ class Lx_kit::Work : public Lx::Work
|
||||
** Lx::Work interface **
|
||||
************************/
|
||||
|
||||
void unblock() { _task.unblock(); }
|
||||
void unblock()
|
||||
{
|
||||
_task.unblock();
|
||||
}
|
||||
|
||||
void flush(Lx::Task &task)
|
||||
{
|
||||
_task.unblock();
|
||||
|
||||
_waiting_task = &task;
|
||||
}
|
||||
|
||||
void wakeup_for(void const * const work, Lx::Task &task)
|
||||
{
|
||||
Context *ctx = nullptr;
|
||||
|
||||
for (Context *c = _list.first(); c; c = c->next()) {
|
||||
if (c->work == work) {
|
||||
ctx = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ctx) {
|
||||
Genode::error("BUG: no work queued for wakeup_for call");
|
||||
Genode::sleep_forever();
|
||||
}
|
||||
|
||||
ctx->waiting_task = &task;
|
||||
_task.unblock();
|
||||
}
|
||||
|
||||
void schedule(struct work_struct *work) {
|
||||
_schedule(work); }
|
||||
|
||||
void schedule_delayed(struct delayed_work *work,
|
||||
unsigned long /*delay*/) {
|
||||
_schedule(work); }
|
||||
|
||||
void schedule_tasklet(struct tasklet_struct *tasklet) {
|
||||
_schedule(tasklet); }
|
||||
|
||||
@ -144,6 +187,17 @@ class Lx_kit::Work : public Lx::Work
|
||||
return false;
|
||||
}
|
||||
|
||||
bool work_queued(void const * const work)
|
||||
{
|
||||
for (Context *c = _list.first(); c; c = c->next()) {
|
||||
if (c->work == work) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
char const *task_name() override { return _task.name(); }
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user