diff --git a/repos/os/src/drivers/platform/README b/repos/os/src/drivers/platform/README
index 0caac1d721..2b00642c61 100644
--- a/repos/os/src/drivers/platform/README
+++ b/repos/os/src/drivers/platform/README
@@ -5,7 +5,7 @@ Devices ROM
The platform driver knows which devices exist, as well as what resources
they need by parsing XML information from a devices ROM. This ROM might be
-a boot module written by a system integrator, or is dynamically produced
+a boot module, written by a system integrator, or is dynamically produced
after investigating ACPI and PCI(*) information. The devices ROM name can be
defined by setting the "devices_rom" attribute in the config of the
platform driver:
@@ -20,11 +20,11 @@ If the attribute isn't set, the platform driver asks for a ROM called
Behavior
--------
-Per client a policy must be configured that states which client can
+Per client a policy must be configured that states, which client can
access certain devices to form a virtual bus per client. The client may
iterate through the virtual bus using the devices_rom() function of
the platform_session interface to discover all available devices of the virtual
-bus. When identified a specific device its device capability can be obtained
+bus. When identified a specific device, its device capability can be obtained
via its unique name. Simple device drivers that drive exactly one device do
not need the devices ROM, but can simply obtain their device capability via
the acquire_single_device() function of the platform session interface.
@@ -48,20 +48,20 @@ A policy may contain several nodes describing several devices.
!
! ...
-The managing_system attribute is evaluated by init. If set to "yes" it
+The managing_system attribute is evaluated by init. If set to "yes", it
permits a component, the platform driver, to restrict the allocation of memory to
specific physical RAM ranges. The platform driver uses this feature to ensure that
the allocation of DMA capable memory consider several restrictions. For
example, some drivers, as the UHCI controller, requires a
-physical memory address below 4G. Another example is that on 32bit hosts
-physical to virtual identical mappings of DMA memory for the device_pd
+physical memory address below 4G. Another example is: on 32bit hosts
+physical to virtual identical mappings of DMA memory for the device PD
(required when IOMMU is used) must be below the kernel memory boundary (3G).
On some systems, e.g., base-hw kernel on certain ARM platforms, it allows the
platform driver to call system management firmware via kernel syscalls.
The 'info' attribute in a policy node describe, whether the client's devices
ROM will contain detailed information about physical resources of the devices
-of its virtual bus. This is only useful when using ported legacy drivers, which
+of its virtual bus. This is only useful, when using ported legacy drivers, which
operate with global names of physical resources.
Policy for PCI devices
@@ -87,11 +87,11 @@ By default the platform driver does not report anything. But when adding a
report node:
!
-!
! ...
!
it is possible to enable either a devices and/or config report. The first will
-open up a Report session to dynamically report all accessible devices and its
+open up a Report session to dynamically report all accessible devices, and its
state. Whereby the second report states the currently active configuration of
the platform driver.
diff --git a/repos/os/src/drivers/platform/common.h b/repos/os/src/drivers/platform/common.h
index 354e63cd10..04beb3e3dd 100644
--- a/repos/os/src/drivers/platform/common.h
+++ b/repos/os/src/drivers/platform/common.h
@@ -22,8 +22,6 @@ class Driver::Common
Env & _env;
String<64> _rom_name;
Attached_rom_dataspace _devices_rom { _env, _rom_name.string() };
- Reporter _cfg_reporter { _env, "config" };
- Reporter _dev_reporter { _env, "devices" };
Heap _heap { _env.ram(), _env.rm() };
Sliced_heap _sliced_heap { _env.ram(), _env.rm() };
Device_model _devices { _heap, _dev_reporter };
@@ -31,6 +29,9 @@ class Driver::Common
&Common::_handle_devices };
Driver::Root _root;
+ Constructible _cfg_reporter { };
+ Constructible _dev_reporter { };
+
void _handle_devices();
public:
@@ -41,8 +42,8 @@ class Driver::Common
void handle_config(Xml_node config);
void announce_service();
- Common(Genode::Env & env,
- Attached_rom_dataspace & config_rom);
+ Common(Genode::Env & env,
+ Attached_rom_dataspace const & config_rom);
};
@@ -57,19 +58,20 @@ void Driver::Common::_handle_devices()
void Driver::Common::handle_config(Xml_node config)
{
config.for_each_sub_node("report", [&] (Xml_node const node) {
- _dev_reporter.enabled(node.attribute_value("devices", false));
- _cfg_reporter.enabled(node.attribute_value("config", false));
+ _dev_reporter.conditional(node.attribute_value("devices", false),
+ _env, "devices", "devices");
+ _cfg_reporter.conditional(node.attribute_value("config", false),
+ _env, "config", "config");
});
_root.update_policy();
- if (_cfg_reporter.enabled()) {
- Reporter::Xml_generator xml(_cfg_reporter, [&] () {
+ if (_cfg_reporter.constructed())
+ _cfg_reporter->generate([&] (Xml_generator & xml) {
config.with_raw_content([&] (char const *src, size_t len) {
xml.append(src, len);
});
});
- }
}
@@ -79,14 +81,14 @@ void Driver::Common::announce_service()
}
-Driver::Common::Common(Genode::Env & env,
- Attached_rom_dataspace & config_rom)
+Driver::Common::Common(Genode::Env & env,
+ Attached_rom_dataspace const & config_rom)
:
_env(env),
_rom_name(config_rom.xml().attribute_value("devices_rom",
String<64>("devices"))),
_root(_env, _sliced_heap, config_rom, _devices)
{
- _handle_devices();
_devices_rom.sigh(_dev_handler);
+ _handle_devices();
}
diff --git a/repos/os/src/drivers/platform/device.cc b/repos/os/src/drivers/platform/device.cc
index 1581795e47..c661a7807b 100644
--- a/repos/os/src/drivers/platform/device.cc
+++ b/repos/os/src/drivers/platform/device.cc
@@ -186,12 +186,11 @@ Driver::Device::~Device()
void Driver::Device_model::update_report()
{
- if (_reporter.enabled()) {
- Reporter::Xml_generator xml(_reporter, [&] () {
+ if (_reporter.constructed())
+ _reporter->generate([&] (Xml_generator & xml) {
for_each([&] (Device & device) {
device.report(xml, *this, true); });
});
- }
}
diff --git a/repos/os/src/drivers/platform/device.h b/repos/os/src/drivers/platform/device.h
index 9981675f24..ca32ef8aff 100644
--- a/repos/os/src/drivers/platform/device.h
+++ b/repos/os/src/drivers/platform/device.h
@@ -257,19 +257,21 @@ class Driver::Device_model :
{
private:
- Heap & _heap;
- Reporter & _reporter;
- List_model _model { };
- Clocks _clocks { };
- Resets _resets { };
- Powers _powers { };
+ Heap & _heap;
+ List_model _model { };
+ Clocks _clocks { };
+ Resets _resets { };
+ Powers _powers { };
+
+ Constructible & _reporter;
public:
void update_report();
void update(Xml_node const & node);
- Device_model(Heap & heap, Reporter & reporter)
+ Device_model(Heap & heap,
+ Constructible & reporter)
: _heap(heap), _reporter(reporter) { }
~Device_model() {
diff --git a/repos/os/src/drivers/platform/main.cc b/repos/os/src/drivers/platform/main.cc
index 9ae9f2ffdf..9d844edf37 100644
--- a/repos/os/src/drivers/platform/main.cc
+++ b/repos/os/src/drivers/platform/main.cc
@@ -29,8 +29,8 @@ struct Driver::Main
Main(Genode::Env & e)
: _env(e)
{
- _handle_config();
_config_rom.sigh(_config_handler);
+ _handle_config();
_common.announce_service();
}
};
diff --git a/repos/os/src/drivers/platform/root.cc b/repos/os/src/drivers/platform/root.cc
index ccd18bebc9..db1bb1b62c 100644
--- a/repos/os/src/drivers/platform/root.cc
+++ b/repos/os/src/drivers/platform/root.cc
@@ -67,9 +67,9 @@ void Driver::Root::_upgrade_session(Session_component * sc, const char * args)
}
-Driver::Root::Root(Env & env,
- Sliced_heap & sliced_heap,
- Attached_rom_dataspace & config,
- Device_model & devices)
+Driver::Root::Root(Env & env,
+ Sliced_heap & sliced_heap,
+ Attached_rom_dataspace const & config,
+ Device_model & devices)
: Root_component(env.ep(), sliced_heap),
_env(env), _config(config), _devices(devices) { }
diff --git a/repos/os/src/drivers/platform/root.h b/repos/os/src/drivers/platform/root.h
index a2db38f0cc..93d8ed0983 100644
--- a/repos/os/src/drivers/platform/root.h
+++ b/repos/os/src/drivers/platform/root.h
@@ -27,10 +27,10 @@ class Driver::Root : public Root_component
{
public:
- Root(Env & env,
- Sliced_heap & sliced_heap,
- Attached_rom_dataspace & config,
- Device_model & devices);
+ Root(Env & env,
+ Sliced_heap & sliced_heap,
+ Attached_rom_dataspace const & config,
+ Device_model & devices);
void update_policy();
@@ -40,10 +40,10 @@ class Driver::Root : public Root_component
void _upgrade_session(Session_component *, const char *) override;
- Env & _env;
- Attached_rom_dataspace & _config;
- Device_model & _devices;
- Registry _sessions {};
+ Env & _env;
+ Attached_rom_dataspace const & _config;
+ Device_model & _devices;
+ Registry _sessions {};
};
#endif /* _SRC__DRIVERS__PLATFORM__ROOT_H_ */
diff --git a/repos/os/src/drivers/platform/session_component.cc b/repos/os/src/drivers/platform/session_component.cc
index 5f70d56e02..bd9e220ea1 100644
--- a/repos/os/src/drivers/platform/session_component.cc
+++ b/repos/os/src/drivers/platform/session_component.cc
@@ -225,15 +225,15 @@ Genode::addr_t Session_component::dma_addr(Ram_dataspace_capability ram_cap)
}
-Session_component::Session_component(Env & env,
- Attached_rom_dataspace & config,
- Device_model & devices,
- Session_registry & registry,
- Label const & label,
- Resources const & resources,
- Diag const & diag,
- bool const info,
- Policy_version const version)
+Session_component::Session_component(Env & env,
+ Attached_rom_dataspace const & config,
+ Device_model & devices,
+ Session_registry & registry,
+ Label const & label,
+ Resources const & resources,
+ Diag const & diag,
+ bool const info,
+ Policy_version const version)
:
Session_object(env.ep(), resources, label, diag),
Session_registry::Element(registry, *this),
diff --git a/repos/os/src/drivers/platform/session_component.h b/repos/os/src/drivers/platform/session_component.h
index dc197e29bf..fa4f1d7fd6 100644
--- a/repos/os/src/drivers/platform/session_component.h
+++ b/repos/os/src/drivers/platform/session_component.h
@@ -44,15 +44,15 @@ class Driver::Session_component
using Session_registry = Registry;
using Policy_version = String<64>;
- Session_component(Env & env,
- Attached_rom_dataspace & config,
- Device_model & devices,
- Session_registry & registry,
- Label const & label,
- Resources const & resources,
- Diag const & diag,
- bool const info,
- Policy_version const version);
+ Session_component(Env & env,
+ Attached_rom_dataspace const & config,
+ Device_model & devices,
+ Session_registry & registry,
+ Label const & label,
+ Resources const & resources,
+ Diag const & diag,
+ bool const info,
+ Policy_version const version);
~Session_component();
@@ -98,23 +98,23 @@ class Driver::Session_component
: Registry::Element(registry, *this), cap(cap) {}
};
- Env & _env;
- Attached_rom_dataspace & _config;
- Device_model & _devices;
- Device::Owner _owner_id { *this };
- Constrained_ram_allocator _env_ram { _env.pd(),
- _ram_quota_guard(),
- _cap_quota_guard() };
- Heap _md_alloc { _env_ram, _env.rm() };
- Registry _device_registry { };
- Registry _buffer_registry { };
- Dynamic_rom_session _rom_session { _env.ep(), _env.ram(),
- _env.rm(), *this };
- bool _info;
- Policy_version _version;
- Device_pd _device_pd { _env,
- _ram_quota_guard(),
- _cap_quota_guard() };
+ Env & _env;
+ Attached_rom_dataspace const & _config;
+ Device_model & _devices;
+ Device::Owner _owner_id { *this };
+ Constrained_ram_allocator _env_ram { _env.pd(),
+ _ram_quota_guard(),
+ _cap_quota_guard() };
+ Heap _md_alloc { _env_ram, _env.rm() };
+ Registry _device_registry { };
+ Registry _buffer_registry { };
+ Dynamic_rom_session _rom_session { _env.ep(), _env.ram(),
+ _env.rm(), *this };
+ bool _info;
+ Policy_version _version;
+ Device_pd _device_pd { _env,
+ _ram_quota_guard(),
+ _cap_quota_guard() };
Device_capability _acquire(Device & device);
void _release_device(Device_component & dc);