mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-21 22:47:50 +00:00
parent
3f1e1323f0
commit
1f1437747c
@ -114,7 +114,7 @@ void Device_pd::remove_range(Io_mmu::Range const & range)
|
|||||||
|
|
||||||
|
|
||||||
void Device_pd::enable_pci_device(Io_mem_dataspace_capability const io_mem_cap,
|
void Device_pd::enable_pci_device(Io_mem_dataspace_capability const io_mem_cap,
|
||||||
Pci::Bdf const bdf)
|
Pci::Bdf const & bdf)
|
||||||
{
|
{
|
||||||
addr_t addr = _address_space.attach(io_mem_cap, 0x1000);
|
addr_t addr = _address_space.attach(io_mem_cap, 0x1000);
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ void Device_pd::enable_pci_device(Io_mem_dataspace_capability const io_mem_cap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Device_pd::disable_pci_device(Pci::Bdf const)
|
void Device_pd::disable_pci_device(Pci::Bdf const &)
|
||||||
{
|
{
|
||||||
warning("Cannot unassign PCI device from device PD (not implemented by kernel).");
|
warning("Cannot unassign PCI device from device PD (not implemented by kernel).");
|
||||||
}
|
}
|
||||||
|
@ -93,8 +93,8 @@ class Driver::Device_pd : public Io_mmu::Domain
|
|||||||
void remove_range(Io_mmu::Range const &) override;
|
void remove_range(Io_mmu::Range const &) override;
|
||||||
|
|
||||||
void enable_pci_device(Io_mem_dataspace_capability const,
|
void enable_pci_device(Io_mem_dataspace_capability const,
|
||||||
Pci::Bdf const) override;
|
Pci::Bdf const &) override;
|
||||||
void disable_pci_device(Pci::Bdf const) override;
|
void disable_pci_device(Pci::Bdf const &) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,8 +79,8 @@ class Driver::Io_mmu : private Io_mmu_devices::Element
|
|||||||
|
|
||||||
/* interface for (un)assigning a pci device */
|
/* interface for (un)assigning a pci device */
|
||||||
virtual void enable_pci_device(Io_mem_dataspace_capability const,
|
virtual void enable_pci_device(Io_mem_dataspace_capability const,
|
||||||
Pci::Bdf const) = 0;
|
Pci::Bdf const &) = 0;
|
||||||
virtual void disable_pci_device(Pci::Bdf const) = 0;
|
virtual void disable_pci_device(Pci::Bdf const &) = 0;
|
||||||
|
|
||||||
/* interface for adding/removing DMA buffers */
|
/* interface for adding/removing DMA buffers */
|
||||||
virtual void add_range(Range const &,
|
virtual void add_range(Range const &,
|
||||||
@ -138,7 +138,7 @@ class Driver::Io_mmu : private Io_mmu_devices::Element
|
|||||||
virtual void add_default_range(Range const &, addr_t) { }
|
virtual void add_default_range(Range const &, addr_t) { }
|
||||||
|
|
||||||
/* interface for activating default mappings for certain device */
|
/* interface for activating default mappings for certain device */
|
||||||
virtual void enable_default_mappings(Pci::Bdf) { }
|
virtual void enable_default_mappings(Pci::Bdf const &) { }
|
||||||
|
|
||||||
/* interface for completing default mappings (enabled IOMMU) */
|
/* interface for completing default mappings (enabled IOMMU) */
|
||||||
virtual void default_mappings_complete() { }
|
virtual void default_mappings_complete() { }
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include <intel/default_mappings.h>
|
#include <intel/default_mappings.h>
|
||||||
|
|
||||||
void Intel::Default_mappings::_insert_context(Managed_root_table & root,
|
void Intel::Default_mappings::_insert_context(Managed_root_table & root,
|
||||||
Pci::Bdf bdf,
|
Pci::Bdf const & bdf,
|
||||||
addr_t paddr,
|
addr_t paddr,
|
||||||
Domain_id domain_id)
|
Domain_id domain_id)
|
||||||
{
|
{
|
||||||
@ -60,14 +60,15 @@ void Intel::Default_mappings::insert_translation(addr_t va, addr_t pa,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Intel::Default_mappings::enable_device(Pci::Bdf bdf, Domain_id domain_id)
|
void Intel::Default_mappings::enable_device(Pci::Bdf const & bdf,
|
||||||
|
Domain_id domain_id)
|
||||||
{
|
{
|
||||||
_insert_context(_root_table, bdf, _default_table_phys, domain_id);
|
_insert_context(_root_table, bdf, _default_table_phys, domain_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Intel::Default_mappings::copy_stage2(Managed_root_table & dst_root,
|
void Intel::Default_mappings::copy_stage2(Managed_root_table & dst_root,
|
||||||
Pci::Bdf bdf)
|
Pci::Bdf const & bdf)
|
||||||
{
|
{
|
||||||
_root_table.with_stage2_pointer(bdf, [&] (addr_t phys_addr, Domain_id domain) {
|
_root_table.with_stage2_pointer(bdf, [&] (addr_t phys_addr, Domain_id domain) {
|
||||||
_insert_context(dst_root, bdf, phys_addr, domain); });
|
_insert_context(dst_root, bdf, phys_addr, domain); });
|
||||||
@ -77,7 +78,7 @@ void Intel::Default_mappings::copy_stage2(Managed_root_table & dst_root,
|
|||||||
void Intel::Default_mappings::copy_stage2(Managed_root_table & dst_root)
|
void Intel::Default_mappings::copy_stage2(Managed_root_table & dst_root)
|
||||||
{
|
{
|
||||||
_root_table.for_each_stage2_pointer(
|
_root_table.for_each_stage2_pointer(
|
||||||
[&] (Pci::Bdf bdf, addr_t phys_addr, Domain_id domain) {
|
[&] (Pci::Bdf const & bdf, addr_t phys_addr, Domain_id domain) {
|
||||||
_insert_context(dst_root, bdf, phys_addr, domain); });
|
_insert_context(dst_root, bdf, phys_addr, domain); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,15 +59,15 @@ class Intel::Default_mappings
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _insert_context(Managed_root_table &, Pci::Bdf, addr_t, Domain_id);
|
void _insert_context(Managed_root_table &, Pci::Bdf const &, addr_t, Domain_id);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void insert_translation(addr_t, addr_t, size_t, Page_flags, uint32_t);
|
void insert_translation(addr_t, addr_t, size_t, Page_flags, uint32_t);
|
||||||
|
|
||||||
void enable_device(Pci::Bdf, Domain_id);
|
void enable_device(Pci::Bdf const &, Domain_id);
|
||||||
|
|
||||||
void copy_stage2(Managed_root_table &, Pci::Bdf);
|
void copy_stage2(Managed_root_table &, Pci::Bdf const &);
|
||||||
void copy_stage2(Managed_root_table &);
|
void copy_stage2(Managed_root_table &);
|
||||||
|
|
||||||
Default_mappings(Env & env,
|
Default_mappings(Env & env,
|
||||||
|
@ -52,7 +52,7 @@ void Intel::Io_mmu::Domain<TABLE>::enable_pci_device(Io_mem_dataspace_capability
|
|||||||
|
|
||||||
|
|
||||||
template <typename TABLE>
|
template <typename TABLE>
|
||||||
void Intel::Io_mmu::Domain<TABLE>::disable_pci_device(Pci::Bdf const bdf)
|
void Intel::Io_mmu::Domain<TABLE>::disable_pci_device(Pci::Bdf const & bdf)
|
||||||
{
|
{
|
||||||
_intel_iommu.root_table().remove_context(bdf, _translation_table_phys);
|
_intel_iommu.root_table().remove_context(bdf, _translation_table_phys);
|
||||||
|
|
||||||
|
@ -545,10 +545,10 @@ class Intel::Io_mmu : private Attached_mmio,
|
|||||||
*/
|
*/
|
||||||
void add_default_range(Range const &, addr_t) override;
|
void add_default_range(Range const &, addr_t) override;
|
||||||
void default_mappings_complete() override;
|
void default_mappings_complete() override;
|
||||||
void enable_default_mappings(Pci::Bdf bdf) override {
|
void enable_default_mappings(Pci::Bdf const & bdf) override {
|
||||||
_default_mappings.enable_device(bdf, _default_domain); }
|
_default_mappings.enable_device(bdf, _default_domain); }
|
||||||
|
|
||||||
void apply_default_mappings(Pci::Bdf bdf) {
|
void apply_default_mappings(Pci::Bdf const & bdf) {
|
||||||
_default_mappings.copy_stage2(_managed_root_table, bdf); }
|
_default_mappings.copy_stage2(_managed_root_table, bdf); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
/* local includes */
|
/* local includes */
|
||||||
#include <intel/managed_root_table.h>
|
#include <intel/managed_root_table.h>
|
||||||
|
|
||||||
void Intel::Managed_root_table::remove_context(Pci::Bdf bdf,
|
void Intel::Managed_root_table::remove_context(Pci::Bdf const & bdf,
|
||||||
addr_t phys_addr)
|
addr_t phys_addr)
|
||||||
{
|
{
|
||||||
_with_context_table(bdf.bus, [&] (Context_table & ctx) {
|
_with_context_table(bdf.bus, [&] (Context_table & ctx) {
|
||||||
|
@ -100,7 +100,7 @@ class Intel::Managed_root_table : public Registered_translation_table
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename FN>
|
template <typename FN>
|
||||||
void with_stage2_pointer(Pci::Bdf bdf, FN && fn)
|
void with_stage2_pointer(Pci::Bdf const & bdf, FN && fn)
|
||||||
{
|
{
|
||||||
_with_context_table(bdf.bus, [&] (Context_table & ctx) {
|
_with_context_table(bdf.bus, [&] (Context_table & ctx) {
|
||||||
Pci::rid_t rid = Pci::Bdf::rid(bdf);
|
Pci::rid_t rid = Pci::Bdf::rid(bdf);
|
||||||
@ -112,7 +112,7 @@ class Intel::Managed_root_table : public Registered_translation_table
|
|||||||
|
|
||||||
/* add second-stage table */
|
/* add second-stage table */
|
||||||
template <unsigned ADDRESS_WIDTH>
|
template <unsigned ADDRESS_WIDTH>
|
||||||
Domain_id insert_context(Pci::Bdf bdf, addr_t phys_addr, Domain_id domain)
|
Domain_id insert_context(Pci::Bdf const & bdf, addr_t phys_addr, Domain_id domain)
|
||||||
{
|
{
|
||||||
Domain_id cur_domain { };
|
Domain_id cur_domain { };
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ class Intel::Managed_root_table : public Registered_translation_table
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* remove second-stage table for particular device */
|
/* remove second-stage table for particular device */
|
||||||
void remove_context(Pci::Bdf, addr_t);
|
void remove_context(Pci::Bdf const &, addr_t);
|
||||||
|
|
||||||
/* remove second-stage table for all devices */
|
/* remove second-stage table for all devices */
|
||||||
void remove_context(addr_t);
|
void remove_context(addr_t);
|
||||||
|
Loading…
Reference in New Issue
Block a user