17#include <l4/sys/cxx/ipc_legacy>
21template<
typename ICU >
25 ICU
const *this_icu()
const {
return static_cast<ICU
const *
>(
this); }
26 ICU *this_icu() {
return static_cast<ICU*
>(
this); }
29 L4_RPC_LEGACY_DISPATCH(L4::Icu);
32 L4::Ipc::Snd_fpage irq_fp);
34 L4::Ipc::Snd_fpage irq_fp);
35 int op_info(L4::Icu::Rights, L4::Icu::_Info &info);
36 int op_msi_info(L4::Icu::Rights,
l4_umword_t irqnum,
44template<
typename ICU>
inline
46Icu_svr<ICU>::op_bind(L4::Icu::Rights,
l4_umword_t irqnum,
47 L4::Ipc::Snd_fpage irq_fp)
49 typename ICU::Irq *irq = this_icu()->icu_get_irq(irqnum);
53 return irq->bind(this_icu(), irq_fp);
56template<
typename ICU>
inline
58Icu_svr<ICU>::op_unbind(L4::Icu::Rights,
l4_umword_t irqnum,
59 L4::Ipc::Snd_fpage irq_fp)
61 typename ICU::Irq *irq = this_icu()->icu_get_irq(irqnum);
65 return irq->unbind(this_icu(), irq_fp);
68template<
typename ICU>
inline
70Icu_svr<ICU>::op_info(L4::Icu::Rights, L4::Icu::_Info &info)
73 this_icu()->icu_get_info(&i);
80template<
typename ICU>
inline
82Icu_svr<ICU>::op_msi_info(L4::Icu::Rights,
l4_umword_t irqnum,
85 typename ICU::Irq *irq = this_icu()->icu_get_irq(irqnum);
88 return irq->msi_info(source, &info);
91template<
typename ICU>
inline
93Icu_svr<ICU>::op_mask(L4::Icu::Rights,
l4_umword_t irqnum)
95 typename ICU::Irq *irq = this_icu()->icu_get_irq(irqnum);
101template<
typename ICU>
inline
103Icu_svr<ICU>::op_unmask(L4::Icu::Rights,
l4_umword_t irqnum)
105 typename ICU::Irq *irq = this_icu()->icu_get_irq(irqnum);
112template<
typename ICU >
113class Icu_cap_array_svr :
public Icu_svr<ICU>
116 static void free_irq_cap(L4::Cap<L4::Irq> &cap)
130 ~Irq() { ICU::free_irq_cap(_cap); }
138 int bind(ICU *, L4::Ipc::Snd_fpage
const &irq_fp);
139 int unbind(ICU *, L4::Ipc::Snd_fpage
const &irq_fp);
140 void mask(
bool )
const
146 L4::Cap<L4::Irq> cap()
const {
return _cap; }
149 L4::Cap<L4::Irq> _cap;
158 Icu_cap_array_svr(
unsigned nr_irqs, Irq *irqs)
159 : _irqs(irqs), _nr_irqs(nr_irqs)
164 if (irqnum >= _nr_irqs)
167 return _irqs + irqnum;
178template<
typename ICU >
180Icu_cap_array_svr<ICU>::Irq::bind(ICU *cfb, L4::Ipc::Snd_fpage
const &irq_fp)
185 L4::Cap<L4::Irq> irq = cfb->server_iface()->template rcv_cap<L4::Irq>(0);
189 int r = cfb->server_iface()->realloc_rcv_cap(0);
193 ICU::free_irq_cap(_cap);
198template<
typename ICU >
200Icu_cap_array_svr<ICU>::Irq::unbind(ICU *, L4::Ipc::Snd_fpage
const &)
202 ICU::free_irq_cap(_cap);
void free(L4::Cap< void > cap, l4_cap_idx_t task=L4_INVALID_CAP, unsigned unmap_flags=L4_FP_ALL_SPACES) noexcept override
Free a capability.
void invalidate() noexcept
Set this capability to invalid (L4_INVALID_CAP).
@ Invalid
Invalid capability selector.
bool cap_received() const noexcept
(Defined for return items only.) Check if at least one object capability has been mapped for this ite...
unsigned long l4_umword_t
Unsigned machine word.
unsigned long long l4_uint64_t
Unsigned 64bit value.
@ L4_EINVAL
Invalid argument.
struct l4_icu_info_t l4_icu_info_t
Info structure for an ICU.
_Cap_alloc & cap_alloc
Capability allocator.
struct l4_icu_msi_info_t l4_icu_msi_info_t
Info to use for a specific MSI.
Common L4 ABI Data Types.
Documentation of the L4 Runtime Environment utility functionality in C++.
unsigned nr_msis
The number of MSI vectors supported by the ICU,.
unsigned nr_irqs
The number of IRQ lines supported by the ICU,.
unsigned features
Feature flags.
Common task related definitions.