2015-03-25 14:51:42 +01:00
|
|
|
/*
|
2015-06-08 09:05:32 +02:00
|
|
|
* \brief Implementation of shared IRQs in platform driver
|
2015-03-25 14:51:42 +01:00
|
|
|
* \author Alexander Boettcher
|
|
|
|
* \date 2015-03-27
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 13:23:52 +01:00
|
|
|
* Copyright (C) 2015-2017 Genode Labs GmbH
|
2015-03-25 14:51:42 +01:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
2017-02-20 13:23:52 +01:00
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
2015-03-25 14:51:42 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Genode includes */
|
2016-03-11 17:32:43 +01:00
|
|
|
#include <util/bit_allocator.h>
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 19:07:09 +02:00
|
|
|
#include <base/log.h>
|
2015-03-25 14:51:42 +01:00
|
|
|
#include <irq_session/connection.h>
|
|
|
|
|
2015-06-08 09:05:32 +02:00
|
|
|
/* Platform driver include */
|
2015-03-25 14:51:42 +01:00
|
|
|
#include "irq.h"
|
2015-05-26 20:12:17 +02:00
|
|
|
#include "pci_session_component.h"
|
2015-03-25 14:51:42 +01:00
|
|
|
|
|
|
|
|
2015-06-08 09:05:32 +02:00
|
|
|
namespace Platform {
|
2015-03-25 14:51:42 +01:00
|
|
|
class Irq_component;
|
|
|
|
class Irq_allocator;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-04-27 11:59:58 +02:00
|
|
|
using Genode::size_t;
|
|
|
|
using Genode::addr_t;
|
2015-03-25 14:51:42 +01:00
|
|
|
|
|
|
|
/**
|
2017-01-02 14:23:03 +01:00
|
|
|
* A simple allocator implementation used by the Irq_proxy
|
2015-03-25 14:51:42 +01:00
|
|
|
*/
|
2017-01-02 14:23:03 +01:00
|
|
|
class Platform::Irq_allocator
|
2015-03-25 14:51:42 +01:00
|
|
|
{
|
2015-04-27 11:59:58 +02:00
|
|
|
private:
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We partition the IRQ space (128 GSIs) into 40 legacy IRQs and 64 MSIs (and
|
|
|
|
* hope the partitions will never overlap on any bizarre platform.)
|
|
|
|
*/
|
|
|
|
enum { LEGACY = 40, MSI = 64, LEGACY_ARRAY = 64 };
|
|
|
|
|
Follow practices suggested by "Effective C++"
The patch adjust the code of the base, base-<kernel>, and os repository.
To adapt existing components to fix violations of the best practices
suggested by "Effective C++" as reported by the -Weffc++ compiler
argument. The changes follow the patterns outlined below:
* A class with virtual functions can no longer publicly inherit base
classed without a vtable. The inherited object may either be moved
to a member variable, or inherited privately. The latter would be
used for classes that inherit 'List::Element' or 'Avl_node'. In order
to enable the 'List' and 'Avl_tree' to access the meta data, the
'List' must become a friend.
* Instead of adding a virtual destructor to abstract base classes,
we inherit the new 'Interface' class, which contains a virtual
destructor. This way, single-line abstract base classes can stay
as compact as they are now. The 'Interface' utility resides in
base/include/util/interface.h.
* With the new warnings enabled, all member variables must be explicitly
initialized. Basic types may be initialized with '='. All other types
are initialized with braces '{ ... }' or as class initializers. If
basic types and non-basic types appear in a row, it is nice to only
use the brace syntax (also for basic types) and align the braces.
* If a class contains pointers as members, it must now also provide a
copy constructor and assignment operator. In the most cases, one
would make them private, effectively disallowing the objects to be
copied. Unfortunately, this warning cannot be fixed be inheriting
our existing 'Noncopyable' class (the compiler fails to detect that
the inheriting class cannot be copied and still gives the error).
For now, we have to manually add declarations for both the copy
constructor and assignment operator as private class members. Those
declarations should be prepended with a comment like this:
/*
* Noncopyable
*/
Thread(Thread const &);
Thread &operator = (Thread const &);
In the future, we should revisit these places and try to replace
the pointers with references. In the presence of at least one
reference member, the compiler would no longer implicitly generate
a copy constructor. So we could remove the manual declaration.
Issue #465
2017-12-21 15:42:15 +01:00
|
|
|
Genode::Bit_array<LEGACY_ARRAY> _legacy { };
|
|
|
|
Genode::Bit_allocator<MSI> _msi { };
|
2015-04-27 11:59:58 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
Irq_allocator()
|
|
|
|
{
|
|
|
|
/* reserve the last 24 legacy IRQs - 40 IRQs remaining */
|
|
|
|
_legacy.set(LEGACY, LEGACY_ARRAY - LEGACY);
|
2015-03-25 14:51:42 +01:00
|
|
|
}
|
|
|
|
|
2015-04-27 11:59:58 +02:00
|
|
|
unsigned alloc_msi()
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
return _msi.alloc();
|
|
|
|
} catch (Genode::Bit_allocator<MSI>::Out_of_indices) { return ~0U; }
|
|
|
|
}
|
|
|
|
|
|
|
|
void free_msi(unsigned msi) { _msi.free(msi); }
|
|
|
|
|
2017-01-02 14:23:03 +01:00
|
|
|
bool alloc_irq(addr_t addr)
|
2015-04-27 11:59:58 +02:00
|
|
|
{
|
|
|
|
try {
|
2017-01-02 14:23:03 +01:00
|
|
|
_legacy.set(addr, 1);
|
|
|
|
return true;
|
2015-04-27 11:59:58 +02:00
|
|
|
} catch (...) {
|
2017-01-02 14:23:03 +01:00
|
|
|
return false;
|
2015-03-25 14:51:42 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* One allocator for managing in use IRQ numbers and one IRQ thread waiting
|
|
|
|
* for Genode signals of all hardware IRQs.
|
|
|
|
*/
|
2015-06-08 09:05:32 +02:00
|
|
|
static Platform::Irq_allocator irq_alloc;
|
2015-03-25 14:51:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Irq_proxy interface implementation
|
|
|
|
*/
|
2017-01-02 14:23:03 +01:00
|
|
|
class Platform::Irq_component : public Platform::Irq_proxy
|
2015-03-25 14:51:42 +01:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
|
|
|
Genode::Irq_connection _irq;
|
2017-01-02 14:23:03 +01:00
|
|
|
Genode::Signal_handler<Platform::Irq_component> _irq_dispatcher;
|
2015-03-25 14:51:42 +01:00
|
|
|
|
|
|
|
bool _associated;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
void _ack_irq() {
|
|
|
|
/*
|
|
|
|
* Associate handler only when required, because our partner may
|
|
|
|
* also implement shared irq and would expect to get ack_irq()
|
|
|
|
* form us even if we have no client ...
|
|
|
|
*/
|
|
|
|
if (!_associated) {
|
|
|
|
_associated = true;
|
|
|
|
/* register signal handler on irq_session */
|
|
|
|
_irq.sigh(_irq_dispatcher);
|
|
|
|
}
|
|
|
|
|
|
|
|
_irq.ack_irq();
|
|
|
|
}
|
|
|
|
|
2017-01-02 14:23:03 +01:00
|
|
|
virtual bool remove_sharer(Platform::Irq_sigh *s) override {
|
|
|
|
if (!Irq_proxy::remove_sharer(s))
|
2015-03-25 14:51:42 +01:00
|
|
|
return false;
|
|
|
|
|
|
|
|
/* De-associate handler. */
|
|
|
|
_associated = false;
|
|
|
|
_irq.sigh(Genode::Signal_context_capability());
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2017-01-02 14:23:03 +01:00
|
|
|
Irq_component(Genode::Env &env, unsigned gsi,
|
|
|
|
Genode::Irq_session::Trigger trigger,
|
2015-05-26 20:12:17 +02:00
|
|
|
Genode::Irq_session::Polarity polarity)
|
2015-03-25 14:51:42 +01:00
|
|
|
:
|
2017-01-02 14:23:03 +01:00
|
|
|
Irq_proxy(gsi),
|
|
|
|
_irq(env, gsi, trigger, polarity),
|
|
|
|
_irq_dispatcher(env.ep(), *this, &Platform::Irq_proxy::notify_about_irq),
|
2015-03-25 14:51:42 +01:00
|
|
|
_associated(false)
|
|
|
|
{ }
|
2017-01-02 14:23:03 +01:00
|
|
|
|
|
|
|
static Irq_component *get_irq_proxy(unsigned irq_number,
|
|
|
|
Irq_allocator *irq_alloc = nullptr,
|
|
|
|
Genode::Irq_session::Trigger trigger = Genode::Irq_session::TRIGGER_UNCHANGED,
|
|
|
|
Genode::Irq_session::Polarity polarity = Genode::Irq_session::POLARITY_UNCHANGED,
|
|
|
|
Genode::Env *env = nullptr,
|
|
|
|
Genode::Allocator *heap = nullptr)
|
|
|
|
{
|
|
|
|
static Genode::List<Irq_proxy> proxies;
|
2020-02-20 15:47:08 +01:00
|
|
|
static Genode::Mutex proxies_mutex;
|
2017-01-02 14:23:03 +01:00
|
|
|
|
2020-02-20 15:47:08 +01:00
|
|
|
Genode::Mutex::Guard mutex_guard(proxies_mutex);
|
2017-01-02 14:23:03 +01:00
|
|
|
|
|
|
|
/* lookup proxy in database */
|
|
|
|
for (Irq_proxy *p = proxies.first(); p; p = p->next())
|
|
|
|
if (p->irq_number() == irq_number)
|
|
|
|
return static_cast<Irq_component *>(p);
|
|
|
|
|
|
|
|
/* try to create proxy */
|
|
|
|
if (!irq_alloc || !env || !heap || !irq_alloc->alloc_irq(irq_number))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
Irq_component *new_proxy = new (heap) Irq_component(*env, irq_number, trigger,
|
|
|
|
polarity);
|
|
|
|
proxies.insert(new_proxy);
|
|
|
|
return new_proxy;
|
|
|
|
}
|
2015-03-25 14:51:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************
|
|
|
|
** PCI IRQ session component **
|
|
|
|
*******************************/
|
|
|
|
|
2015-06-08 09:05:32 +02:00
|
|
|
void Platform::Irq_session_component::ack_irq()
|
2015-03-25 14:51:42 +01:00
|
|
|
{
|
2015-04-27 11:59:58 +02:00
|
|
|
if (msi()) {
|
2016-11-06 14:19:47 +01:00
|
|
|
_irq_conn->ack_irq();
|
2015-04-27 11:59:58 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* shared irq handling */
|
2017-01-02 14:23:03 +01:00
|
|
|
Irq_component *irq_obj = Irq_component::get_irq_proxy(_gsi);
|
2015-03-25 14:51:42 +01:00
|
|
|
if (!irq_obj) {
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 19:07:09 +02:00
|
|
|
Genode::error("expected to find IRQ proxy for IRQ ", Genode::Hex(_gsi));
|
2015-03-25 14:51:42 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (irq_obj->ack_irq())
|
|
|
|
irq_obj->_ack_irq();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-08 09:05:32 +02:00
|
|
|
Platform::Irq_session_component::Irq_session_component(unsigned irq,
|
2017-01-02 14:23:03 +01:00
|
|
|
addr_t pci_config_space,
|
|
|
|
Genode::Env &env,
|
|
|
|
Genode::Allocator &heap)
|
2015-04-27 11:59:58 +02:00
|
|
|
:
|
|
|
|
_gsi(irq)
|
2015-03-25 14:51:42 +01:00
|
|
|
{
|
2015-04-27 11:59:58 +02:00
|
|
|
if (pci_config_space != ~0UL) {
|
|
|
|
/* msi way */
|
|
|
|
unsigned msi = irq_alloc.alloc_msi();
|
|
|
|
if (msi != ~0U) {
|
|
|
|
try {
|
|
|
|
using namespace Genode;
|
|
|
|
|
2017-01-02 14:23:03 +01:00
|
|
|
_irq_conn.construct(env, msi, Irq_session::TRIGGER_UNCHANGED,
|
2015-04-27 11:59:58 +02:00
|
|
|
Irq_session::POLARITY_UNCHANGED,
|
|
|
|
pci_config_space);
|
|
|
|
|
2016-11-06 14:19:47 +01:00
|
|
|
_msi_info = _irq_conn->info();
|
2015-04-27 11:59:58 +02:00
|
|
|
if (_msi_info.type == Irq_session::Info::Type::MSI) {
|
2016-11-06 14:19:47 +01:00
|
|
|
_gsi = msi;
|
2015-04-27 11:59:58 +02:00
|
|
|
return;
|
|
|
|
}
|
Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.
Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.
This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-07 22:03:22 +02:00
|
|
|
} catch (Genode::Service_denied) { }
|
2015-04-27 11:59:58 +02:00
|
|
|
|
|
|
|
irq_alloc.free_msi(msi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-15 13:43:51 +01:00
|
|
|
/* invalid irq number for pci_devices */
|
|
|
|
if (_gsi >= INVALID_IRQ)
|
|
|
|
return;
|
|
|
|
|
2015-05-26 20:12:17 +02:00
|
|
|
Genode::Irq_session::Trigger trigger;
|
|
|
|
Genode::Irq_session::Polarity polarity;
|
|
|
|
|
2015-06-08 09:05:32 +02:00
|
|
|
_gsi = Platform::Irq_override::irq_override(_gsi, trigger, polarity);
|
2015-05-26 20:12:17 +02:00
|
|
|
if (_gsi != irq || trigger != Genode::Irq_session::TRIGGER_UNCHANGED ||
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 19:07:09 +02:00
|
|
|
polarity != POLARITY_UNCHANGED) {
|
|
|
|
|
|
|
|
Genode::log("IRQ override ", irq, "->", _gsi, ", "
|
|
|
|
"trigger mode: ", trigger, ", ", "polarity: ", polarity);
|
|
|
|
}
|
2015-05-26 20:12:17 +02:00
|
|
|
|
2015-03-25 14:51:42 +01:00
|
|
|
try {
|
2015-04-27 11:59:58 +02:00
|
|
|
/* check if shared IRQ object was used before */
|
2017-01-02 14:23:03 +01:00
|
|
|
if (Irq_component::get_irq_proxy(_gsi, &irq_alloc, trigger,
|
|
|
|
polarity, &env, &heap))
|
2015-04-27 11:59:58 +02:00
|
|
|
return;
|
Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.
Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.
This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-07 22:03:22 +02:00
|
|
|
} catch (Genode::Service_denied) { }
|
2015-03-25 14:51:42 +01:00
|
|
|
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 19:07:09 +02:00
|
|
|
Genode::error("unavailable IRQ ", Genode::Hex(_gsi), " requested");
|
2015-03-25 14:51:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-08 09:05:32 +02:00
|
|
|
Platform::Irq_session_component::~Irq_session_component()
|
2015-03-25 14:51:42 +01:00
|
|
|
{
|
2015-04-27 11:59:58 +02:00
|
|
|
if (msi()) {
|
2016-11-06 14:19:47 +01:00
|
|
|
_irq_conn->sigh(Genode::Signal_context_capability());
|
2015-04-27 11:59:58 +02:00
|
|
|
|
|
|
|
irq_alloc.free_msi(_gsi);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* shared irq handling */
|
2017-01-02 14:23:03 +01:00
|
|
|
Irq_component *irq_obj = Irq_component::get_irq_proxy(_gsi);
|
2015-03-25 14:51:42 +01:00
|
|
|
if (!irq_obj) return;
|
|
|
|
|
|
|
|
if (_irq_sigh.valid())
|
|
|
|
irq_obj->remove_sharer(&_irq_sigh);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-08 09:05:32 +02:00
|
|
|
void Platform::Irq_session_component::sigh(Genode::Signal_context_capability sigh)
|
2015-03-25 14:51:42 +01:00
|
|
|
{
|
2016-11-06 14:19:47 +01:00
|
|
|
if (_irq_conn.constructed()) {
|
2015-04-27 11:59:58 +02:00
|
|
|
/* register signal handler for msi directly at parent */
|
2016-11-06 14:19:47 +01:00
|
|
|
_irq_conn->sigh(sigh);
|
2015-04-27 11:59:58 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* shared irq handling */
|
2017-01-02 14:23:03 +01:00
|
|
|
Irq_component *irq_obj = Irq_component::get_irq_proxy(_gsi);
|
2015-03-25 14:51:42 +01:00
|
|
|
if (!irq_obj) {
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 19:07:09 +02:00
|
|
|
Genode::error("signal handler got not registered - irq object unavailable");
|
2015-03-25 14:51:42 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Genode::Signal_context_capability old = _irq_sigh;
|
|
|
|
|
|
|
|
if (old.valid() && !sigh.valid())
|
|
|
|
irq_obj->remove_sharer(&_irq_sigh);
|
|
|
|
|
|
|
|
_irq_sigh = sigh;
|
|
|
|
|
|
|
|
if (!old.valid() && sigh.valid())
|
|
|
|
irq_obj->add_sharer(&_irq_sigh);
|
|
|
|
}
|
2015-05-26 20:12:17 +02:00
|
|
|
|
|
|
|
|
2015-06-08 09:05:32 +02:00
|
|
|
unsigned short Platform::Irq_routing::rewrite(unsigned char bus, unsigned char dev,
|
2018-05-03 13:51:13 +02:00
|
|
|
unsigned char, unsigned char pin)
|
2015-05-26 20:12:17 +02:00
|
|
|
{
|
2018-05-03 13:51:13 +02:00
|
|
|
unsigned const bridge_bdf_bus = Platform::bridge_bdf(bus);
|
|
|
|
|
|
|
|
for (Irq_routing *i = list()->first(); i; i = i->next()) {
|
2015-05-26 20:12:17 +02:00
|
|
|
if ((dev == i->_device) && (pin - 1 == i->_device_pin) &&
|
2018-05-03 13:51:13 +02:00
|
|
|
(i->_bridge_bdf == bridge_bdf_bus))
|
2015-05-26 20:12:17 +02:00
|
|
|
return i->_gsi;
|
2018-05-03 13:51:13 +02:00
|
|
|
}
|
2015-05-26 20:12:17 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|