From d0694b3e0bb7b1109662235475c3eaa5e810e955 Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Wed, 27 Apr 2022 15:55:24 +0200 Subject: [PATCH] platform_drv: separate devices info from config Fix genodelabs/genode#4491 --- repos/base/board/pbxa9/devices | 25 ++++++++ .../recipes/pkg/drivers_nic-imx53_qsb/README | 3 - .../pkg/drivers_nic-imx53_qsb/archives | 3 - .../recipes/pkg/drivers_nic-imx53_qsb/hash | 1 - .../pkg/drivers_nic-imx6q_sabrelite/README | 3 - .../pkg/drivers_nic-imx6q_sabrelite/archives | 3 - .../pkg/drivers_nic-imx6q_sabrelite/hash | 1 - .../pkg/drivers_nic-imx7d_sabre/README | 3 - .../pkg/drivers_nic-imx7d_sabre/archives | 3 - .../recipes/pkg/drivers_nic-imx7d_sabre/hash | 1 - .../raw/drivers_nic-imx53_qsb/content.mk | 4 -- .../raw/drivers_nic-imx53_qsb/drivers.config | 47 --------------- .../recipes/raw/drivers_nic-imx53_qsb/hash | 1 - .../drivers_nic-imx6q_sabrelite/content.mk | 4 -- .../drivers.config | 48 ---------------- .../raw/drivers_nic-imx6q_sabrelite/hash | 1 - .../raw/drivers_nic-imx7d_sabre/content.mk | 4 -- .../drivers_nic-imx7d_sabre/drivers.config | 57 ------------------- .../recipes/raw/drivers_nic-imx7d_sabre/hash | 1 - .../pkg/drivers_interactive-pbxa9/archives | 1 + .../os/recipes/pkg/drivers_nic-pbxa9/archives | 1 + .../drivers_interactive-pbxa9/drivers.config | 22 +------ .../drivers.config | 22 +++---- .../raw/drivers_nic-pbxa9/drivers.config | 13 +---- .../raw/drivers_nic-virt_qemu/drivers.config | 12 ++-- repos/os/recipes/raw/pbxa9-devices/content.mk | 4 ++ repos/os/recipes/raw/pbxa9-devices/hash | 1 + repos/os/run/i2c_mcp9808.run | 26 ++------- repos/os/run/platform_drv.run | 8 ++- repos/os/run/sd_card.run | 10 ++-- repos/os/run/sd_card_bench.run | 45 +-------------- repos/os/src/drivers/platform/main.cc | 32 ++++++----- repos/os/src/drivers/virtdev_rom/main.cc | 11 +--- repos/os/src/test/platform_drv/main.cc | 37 ++++++------ 34 files changed, 111 insertions(+), 347 deletions(-) create mode 100644 repos/base/board/pbxa9/devices delete mode 100644 repos/dde_linux/recipes/pkg/drivers_nic-imx53_qsb/README delete mode 100644 repos/dde_linux/recipes/pkg/drivers_nic-imx53_qsb/archives delete mode 100644 repos/dde_linux/recipes/pkg/drivers_nic-imx53_qsb/hash delete mode 100644 repos/dde_linux/recipes/pkg/drivers_nic-imx6q_sabrelite/README delete mode 100644 repos/dde_linux/recipes/pkg/drivers_nic-imx6q_sabrelite/archives delete mode 100644 repos/dde_linux/recipes/pkg/drivers_nic-imx6q_sabrelite/hash delete mode 100644 repos/dde_linux/recipes/pkg/drivers_nic-imx7d_sabre/README delete mode 100644 repos/dde_linux/recipes/pkg/drivers_nic-imx7d_sabre/archives delete mode 100644 repos/dde_linux/recipes/pkg/drivers_nic-imx7d_sabre/hash delete mode 100644 repos/dde_linux/recipes/raw/drivers_nic-imx53_qsb/content.mk delete mode 100644 repos/dde_linux/recipes/raw/drivers_nic-imx53_qsb/drivers.config delete mode 100644 repos/dde_linux/recipes/raw/drivers_nic-imx53_qsb/hash delete mode 100644 repos/dde_linux/recipes/raw/drivers_nic-imx6q_sabrelite/content.mk delete mode 100644 repos/dde_linux/recipes/raw/drivers_nic-imx6q_sabrelite/drivers.config delete mode 100644 repos/dde_linux/recipes/raw/drivers_nic-imx6q_sabrelite/hash delete mode 100644 repos/dde_linux/recipes/raw/drivers_nic-imx7d_sabre/content.mk delete mode 100644 repos/dde_linux/recipes/raw/drivers_nic-imx7d_sabre/drivers.config delete mode 100644 repos/dde_linux/recipes/raw/drivers_nic-imx7d_sabre/hash create mode 100644 repos/os/recipes/raw/pbxa9-devices/content.mk create mode 100644 repos/os/recipes/raw/pbxa9-devices/hash diff --git a/repos/base/board/pbxa9/devices b/repos/base/board/pbxa9/devices new file mode 100644 index 0000000000..d5672c872e --- /dev/null +++ b/repos/base/board/pbxa9/devices @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/repos/dde_linux/recipes/pkg/drivers_nic-imx53_qsb/README b/repos/dde_linux/recipes/pkg/drivers_nic-imx53_qsb/README deleted file mode 100644 index b9ad938515..0000000000 --- a/repos/dde_linux/recipes/pkg/drivers_nic-imx53_qsb/README +++ /dev/null @@ -1,3 +0,0 @@ - - Device drivers needed for scenarios - using one network interface diff --git a/repos/dde_linux/recipes/pkg/drivers_nic-imx53_qsb/archives b/repos/dde_linux/recipes/pkg/drivers_nic-imx53_qsb/archives deleted file mode 100644 index d7b0ebe621..0000000000 --- a/repos/dde_linux/recipes/pkg/drivers_nic-imx53_qsb/archives +++ /dev/null @@ -1,3 +0,0 @@ -_/src/platform_drv -_/src/fec_nic_drv -_/raw/drivers_nic-imx53_qsb diff --git a/repos/dde_linux/recipes/pkg/drivers_nic-imx53_qsb/hash b/repos/dde_linux/recipes/pkg/drivers_nic-imx53_qsb/hash deleted file mode 100644 index 7b199f03e7..0000000000 --- a/repos/dde_linux/recipes/pkg/drivers_nic-imx53_qsb/hash +++ /dev/null @@ -1 +0,0 @@ -2022-04-27 629b3de99e3dcfc2cffc12a203ecd680b57587fa diff --git a/repos/dde_linux/recipes/pkg/drivers_nic-imx6q_sabrelite/README b/repos/dde_linux/recipes/pkg/drivers_nic-imx6q_sabrelite/README deleted file mode 100644 index b9ad938515..0000000000 --- a/repos/dde_linux/recipes/pkg/drivers_nic-imx6q_sabrelite/README +++ /dev/null @@ -1,3 +0,0 @@ - - Device drivers needed for scenarios - using one network interface diff --git a/repos/dde_linux/recipes/pkg/drivers_nic-imx6q_sabrelite/archives b/repos/dde_linux/recipes/pkg/drivers_nic-imx6q_sabrelite/archives deleted file mode 100644 index c35977c8e4..0000000000 --- a/repos/dde_linux/recipes/pkg/drivers_nic-imx6q_sabrelite/archives +++ /dev/null @@ -1,3 +0,0 @@ -_/src/platform_drv -_/src/fec_nic_drv -_/raw/drivers_nic-imx6q_sabrelite diff --git a/repos/dde_linux/recipes/pkg/drivers_nic-imx6q_sabrelite/hash b/repos/dde_linux/recipes/pkg/drivers_nic-imx6q_sabrelite/hash deleted file mode 100644 index cd5b46aaa8..0000000000 --- a/repos/dde_linux/recipes/pkg/drivers_nic-imx6q_sabrelite/hash +++ /dev/null @@ -1 +0,0 @@ -2022-04-27 a1f05fd7b161e366564a8fe8d6a80e1c462f515b diff --git a/repos/dde_linux/recipes/pkg/drivers_nic-imx7d_sabre/README b/repos/dde_linux/recipes/pkg/drivers_nic-imx7d_sabre/README deleted file mode 100644 index b9ad938515..0000000000 --- a/repos/dde_linux/recipes/pkg/drivers_nic-imx7d_sabre/README +++ /dev/null @@ -1,3 +0,0 @@ - - Device drivers needed for scenarios - using one network interface diff --git a/repos/dde_linux/recipes/pkg/drivers_nic-imx7d_sabre/archives b/repos/dde_linux/recipes/pkg/drivers_nic-imx7d_sabre/archives deleted file mode 100644 index 6021f84d7a..0000000000 --- a/repos/dde_linux/recipes/pkg/drivers_nic-imx7d_sabre/archives +++ /dev/null @@ -1,3 +0,0 @@ -_/src/platform_drv -_/src/fec_nic_drv -_/raw/drivers_nic-imx7d_sabre diff --git a/repos/dde_linux/recipes/pkg/drivers_nic-imx7d_sabre/hash b/repos/dde_linux/recipes/pkg/drivers_nic-imx7d_sabre/hash deleted file mode 100644 index f55e8a82d0..0000000000 --- a/repos/dde_linux/recipes/pkg/drivers_nic-imx7d_sabre/hash +++ /dev/null @@ -1 +0,0 @@ -2022-04-27 4c1644619411b84a4e455f51655310312d3f28bb diff --git a/repos/dde_linux/recipes/raw/drivers_nic-imx53_qsb/content.mk b/repos/dde_linux/recipes/raw/drivers_nic-imx53_qsb/content.mk deleted file mode 100644 index b3044e4e60..0000000000 --- a/repos/dde_linux/recipes/raw/drivers_nic-imx53_qsb/content.mk +++ /dev/null @@ -1,4 +0,0 @@ -content: drivers.config - -drivers.config: - cp $(REP_DIR)/recipes/raw/drivers_nic-imx53_qsb/$@ $@ diff --git a/repos/dde_linux/recipes/raw/drivers_nic-imx53_qsb/drivers.config b/repos/dde_linux/recipes/raw/drivers_nic-imx53_qsb/drivers.config deleted file mode 100644 index 2bef3e4d9a..0000000000 --- a/repos/dde_linux/recipes/raw/drivers_nic-imx53_qsb/drivers.config +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/repos/dde_linux/recipes/raw/drivers_nic-imx53_qsb/hash b/repos/dde_linux/recipes/raw/drivers_nic-imx53_qsb/hash deleted file mode 100644 index dda1a50821..0000000000 --- a/repos/dde_linux/recipes/raw/drivers_nic-imx53_qsb/hash +++ /dev/null @@ -1 +0,0 @@ -2022-02-14 f111c3360c1e1096321676990f0a52099d0cd087 diff --git a/repos/dde_linux/recipes/raw/drivers_nic-imx6q_sabrelite/content.mk b/repos/dde_linux/recipes/raw/drivers_nic-imx6q_sabrelite/content.mk deleted file mode 100644 index 760cdbf2f4..0000000000 --- a/repos/dde_linux/recipes/raw/drivers_nic-imx6q_sabrelite/content.mk +++ /dev/null @@ -1,4 +0,0 @@ -content: drivers.config - -drivers.config: - cp $(REP_DIR)/recipes/raw/drivers_nic-imx6q_sabrelite/$@ $@ diff --git a/repos/dde_linux/recipes/raw/drivers_nic-imx6q_sabrelite/drivers.config b/repos/dde_linux/recipes/raw/drivers_nic-imx6q_sabrelite/drivers.config deleted file mode 100644 index 39c24d8c68..0000000000 --- a/repos/dde_linux/recipes/raw/drivers_nic-imx6q_sabrelite/drivers.config +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/repos/dde_linux/recipes/raw/drivers_nic-imx6q_sabrelite/hash b/repos/dde_linux/recipes/raw/drivers_nic-imx6q_sabrelite/hash deleted file mode 100644 index 2c2ee4c0b9..0000000000 --- a/repos/dde_linux/recipes/raw/drivers_nic-imx6q_sabrelite/hash +++ /dev/null @@ -1 +0,0 @@ -2022-02-14 244d2052fccea67ddcd69b469bc3ce45fbc8836c diff --git a/repos/dde_linux/recipes/raw/drivers_nic-imx7d_sabre/content.mk b/repos/dde_linux/recipes/raw/drivers_nic-imx7d_sabre/content.mk deleted file mode 100644 index 91a38338dd..0000000000 --- a/repos/dde_linux/recipes/raw/drivers_nic-imx7d_sabre/content.mk +++ /dev/null @@ -1,4 +0,0 @@ -content: drivers.config - -drivers.config: - cp $(REP_DIR)/recipes/raw/drivers_nic-imx7d_sabre/$@ $@ diff --git a/repos/dde_linux/recipes/raw/drivers_nic-imx7d_sabre/drivers.config b/repos/dde_linux/recipes/raw/drivers_nic-imx7d_sabre/drivers.config deleted file mode 100644 index 3054c117cc..0000000000 --- a/repos/dde_linux/recipes/raw/drivers_nic-imx7d_sabre/drivers.config +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/repos/dde_linux/recipes/raw/drivers_nic-imx7d_sabre/hash b/repos/dde_linux/recipes/raw/drivers_nic-imx7d_sabre/hash deleted file mode 100644 index a6fa04931b..0000000000 --- a/repos/dde_linux/recipes/raw/drivers_nic-imx7d_sabre/hash +++ /dev/null @@ -1 +0,0 @@ -2022-02-14 3cbc613660074678d90613ecc44ebf9744d2541a diff --git a/repos/os/recipes/pkg/drivers_interactive-pbxa9/archives b/repos/os/recipes/pkg/drivers_interactive-pbxa9/archives index e676445e82..8d16d4080d 100644 --- a/repos/os/recipes/pkg/drivers_interactive-pbxa9/archives +++ b/repos/os/recipes/pkg/drivers_interactive-pbxa9/archives @@ -2,3 +2,4 @@ _/src/pbxa9_drivers _/src/platform_drv _/src/event_filter _/raw/drivers_interactive-pbxa9 +_/raw/pbxa9-devices diff --git a/repos/os/recipes/pkg/drivers_nic-pbxa9/archives b/repos/os/recipes/pkg/drivers_nic-pbxa9/archives index c9527b2727..17a890723c 100644 --- a/repos/os/recipes/pkg/drivers_nic-pbxa9/archives +++ b/repos/os/recipes/pkg/drivers_nic-pbxa9/archives @@ -1,3 +1,4 @@ _/src/lan9118_nic_drv _/src/platform_drv _/raw/drivers_nic-pbxa9 +_/raw/pbxa9-devices diff --git a/repos/os/recipes/raw/drivers_interactive-pbxa9/drivers.config b/repos/os/recipes/raw/drivers_interactive-pbxa9/drivers.config index a15d4a446d..41bb675b91 100644 --- a/repos/os/recipes/raw/drivers_interactive-pbxa9/drivers.config +++ b/repos/os/recipes/raw/drivers_interactive-pbxa9/drivers.config @@ -13,31 +13,11 @@ - + - - - - - - - - - - - - - - - - - - - - diff --git a/repos/os/recipes/raw/drivers_interactive-virt_qemu/drivers.config b/repos/os/recipes/raw/drivers_interactive-virt_qemu/drivers.config index bb9ca7bb9e..125579c6d2 100644 --- a/repos/os/recipes/raw/drivers_interactive-virt_qemu/drivers.config +++ b/repos/os/recipes/raw/drivers_interactive-virt_qemu/drivers.config @@ -17,6 +17,17 @@ + + + + + + + + + + + @@ -30,17 +41,6 @@ - - - - - - - - - - - diff --git a/repos/os/recipes/raw/drivers_nic-pbxa9/drivers.config b/repos/os/recipes/raw/drivers_nic-pbxa9/drivers.config index 9193f1bf39..ea3fcb2fb3 100644 --- a/repos/os/recipes/raw/drivers_nic-pbxa9/drivers.config +++ b/repos/os/recipes/raw/drivers_nic-pbxa9/drivers.config @@ -13,21 +13,11 @@ - + - - - - - - - - - - @@ -37,7 +27,6 @@ - diff --git a/repos/os/recipes/raw/drivers_nic-virt_qemu/drivers.config b/repos/os/recipes/raw/drivers_nic-virt_qemu/drivers.config index f0d2288642..5c9d0f1d2d 100644 --- a/repos/os/recipes/raw/drivers_nic-virt_qemu/drivers.config +++ b/repos/os/recipes/raw/drivers_nic-virt_qemu/drivers.config @@ -17,22 +17,22 @@ - - - - - - + + + + + + diff --git a/repos/os/recipes/raw/pbxa9-devices/content.mk b/repos/os/recipes/raw/pbxa9-devices/content.mk new file mode 100644 index 0000000000..3461975f3a --- /dev/null +++ b/repos/os/recipes/raw/pbxa9-devices/content.mk @@ -0,0 +1,4 @@ +content: devices + +devices: + cp $(GENODE_DIR)/repos/base/board/pbxa9/$@ $@ diff --git a/repos/os/recipes/raw/pbxa9-devices/hash b/repos/os/recipes/raw/pbxa9-devices/hash new file mode 100644 index 0000000000..1e57d5002f --- /dev/null +++ b/repos/os/recipes/raw/pbxa9-devices/hash @@ -0,0 +1 @@ +2022-05-13 c5053878eefb4b84eff0f0d51b3c4150fac6b7cb diff --git a/repos/os/run/i2c_mcp9808.run b/repos/os/run/i2c_mcp9808.run index f09c2c71ae..1ff7ac5f16 100644 --- a/repos/os/run/i2c_mcp9808.run +++ b/repos/os/run/i2c_mcp9808.run @@ -1,4 +1,3 @@ - assert_spec arm_v8a create_boot_directory @@ -7,18 +6,14 @@ import_from_depot [depot_user]/src/[base_src] import_from_depot [depot_user]/src/init import_from_depot [depot_user]/src/platform_drv -set build_components { +build { core timer drivers/i2c test/i2c_mcp9808 } -source ${genode_dir}/repos/base/run/platform_drv.inc - -build $build_components - -set config { +install_config { @@ -50,16 +45,6 @@ set config { - - - - - - - - - @@ -92,15 +77,12 @@ set config { } -install_config $config - -set boot_modules { +file copy [select_from_repositories board/[board]/devices] [run_dir]/genode/devices +build_boot_image { core timer imx8q_evk_i2c_drv i2c_mcp9808 } -build_boot_image $boot_modules - run_genode_until forever diff --git a/repos/os/run/platform_drv.run b/repos/os/run/platform_drv.run index 6bdaadce94..e1c9502297 100644 --- a/repos/os/run/platform_drv.run +++ b/repos/os/run/platform_drv.run @@ -46,6 +46,8 @@ install_config { + + @@ -78,6 +80,7 @@ install_config { + @@ -85,7 +88,10 @@ install_config { - + + + + diff --git a/repos/os/run/sd_card.run b/repos/os/run/sd_card.run index 0c6fbc70a9..e996f5b06e 100644 --- a/repos/os/run/sd_card.run +++ b/repos/os/run/sd_card.run @@ -6,7 +6,8 @@ if {![have_board pbxa9]} { create_boot_directory import_from_depot [depot_user]/src/[base_src] \ [depot_user]/src/init \ - [depot_user]/src/platform_drv + [depot_user]/src/platform_drv \ + [depot_user]/raw/pbxa9-devices build { drivers/sd_card app/block_tester } @@ -23,15 +24,12 @@ install_config { - + - - - - + diff --git a/repos/os/run/sd_card_bench.run b/repos/os/run/sd_card_bench.run index 683499b441..9e239a5fdb 100644 --- a/repos/os/run/sd_card_bench.run +++ b/repos/os/run/sd_card_bench.run @@ -26,45 +26,6 @@ proc sd_card_drv {} { exit 0; } -proc platform_drv {} { - return platform_drv -} - -proc device {} { - if {[have_board pbxa9]} { - return { - - - - } - } - if {[have_board imx6q_sabrelite]} { - return { - - - - - } - } - if {[have_board imx53_qsb] || [have_board imx53_qsb_tz]} { - return { - - - - - } - } - if {[have_board rpi]} { - return { - - - - } - } - puts "\n Run script is not supported on this platform. \n"; - exit 0; -} - create_boot_directory import_from_depot [depot_user]/src/[base_src] \ [depot_user]/src/init \ @@ -84,11 +45,10 @@ install_config { - - } [device] { - + + @@ -116,6 +76,7 @@ install_config { } +file copy [select_from_repositories board/[board]/devices] [run_dir]/genode/devices build { drivers/sd_card } build_boot_image [sd_card_drv] diff --git a/repos/os/src/drivers/platform/main.cc b/repos/os/src/drivers/platform/main.cc index 71c3b0442f..1747cb71a0 100644 --- a/repos/os/src/drivers/platform/main.cc +++ b/repos/os/src/drivers/platform/main.cc @@ -1,5 +1,5 @@ /* - * \brief Platform driver for ARM + * \brief Platform driver * \author Stefan Kalkowski * \date 2020-04-12 */ @@ -18,31 +18,35 @@ namespace Driver { struct Main; }; struct Driver::Main { - void update_config(); + void update(); Env & env; - Heap heap { env.ram(), env.rm() }; - Sliced_heap sliced_heap { env.ram(), env.rm() }; - Attached_rom_dataspace config { env, "config" }; - Device_model devices { heap }; - Signal_handler
config_handler { env.ep(), *this, - &Main::update_config }; - Driver::Root root { env, sliced_heap, config, devices }; + Heap heap { env.ram(), env.rm() }; + Sliced_heap sliced_heap { env.ram(), env.rm() }; + Attached_rom_dataspace config_rom { env, "config" }; + Attached_rom_dataspace devices_rom { env, "devices" }; + Device_model devices { heap }; + Signal_handler
handler { env.ep(), *this, + &Main::update }; + Driver::Root root { env, sliced_heap, + config_rom, devices }; Main(Genode::Env & e) : env(e) { - devices.update(config.xml()); - config.sigh(config_handler); + update(); + config_rom.sigh(handler); + devices_rom.sigh(handler); env.parent().announce(env.ep().manage(root)); } }; -void Driver::Main::update_config() +void Driver::Main::update() { - config.update(); - devices.update(config.xml()); + config_rom.update(); + devices_rom.update(); + devices.update(devices_rom.xml()); root.update_policy(); } diff --git a/repos/os/src/drivers/virtdev_rom/main.cc b/repos/os/src/drivers/virtdev_rom/main.cc index af83faa9f7..4ffe0ca69f 100644 --- a/repos/os/src/drivers/virtdev_rom/main.cc +++ b/repos/os/src/drivers/virtdev_rom/main.cc @@ -1,5 +1,5 @@ /* - * \brief Virt Qemu device config generator for ARM platform driver + * \brief Virt Qemu device ROM generator for platform driver * \author Piotr Tworek * \date 2020-07-01 */ @@ -137,9 +137,8 @@ struct Virtdev_rom::Main void _probe_devices() { Attached_dataspace ds(_env.rm(), _ds); - Attached_rom_dataspace config { _env, "config" }; - Xml_generator xml(ds.local_addr(), ds.size(), "config", [&] () + Xml_generator xml(ds.local_addr(), ds.size(), "devices", [&] () { uint8_t device_type_idx[Device::Id::MAX_VAL] = { 0 }; @@ -148,7 +147,7 @@ struct Virtdev_rom::Main Device device { _env, BASE_ADDRESS + idx * DEVICE_SIZE, DEVICE_SIZE }; if (device.read() != VIRTIO_MMIO_MAGIC) { - warning("Found non VirrtIO MMIO device @ ", addr); + warning("Found non VirtIO MMIO device @ ", addr); continue; } @@ -171,10 +170,6 @@ struct Virtdev_rom::Main }); }); } - - config.xml().with_raw_content([&] (char const *txt, size_t sz) { - xml.append(txt, sz); - }); }); } diff --git a/repos/os/src/test/platform_drv/main.cc b/repos/os/src/test/platform_drv/main.cc index 1990dc5867..ceeefa04b8 100644 --- a/repos/os/src/test/platform_drv/main.cc +++ b/repos/os/src/test/platform_drv/main.cc @@ -56,7 +56,8 @@ struct Main }; Env & env; - Reporter config_reporter { env, "config" }; + Reporter config_reporter { env, "config" }; + Reporter device_reporter { env, "devices" }; Reconstructible platform { env }; Constructible platform_2 { }; @@ -72,36 +73,39 @@ struct Main { state++; - Reporter::Xml_generator xml(config_reporter, [&] () + Reporter::Xml_generator devs(device_reporter, [&] () { for (unsigned idx = 0; idx < total; idx++) { - xml.node("device", [&] + devs.node("device", [&] { - xml.attribute("name", idx); - xml.attribute("type", "dummy-device"); - xml.node("io_mem", [&] + devs.attribute("name", idx); + devs.attribute("type", "dummy-device"); + devs.node("io_mem", [&] { - xml.attribute("address", + devs.attribute("address", String<16>(Hex(iomem_base + idx*0x1000UL))); - xml.attribute("size", String<16>(Hex(0x1000UL))); + devs.attribute("size", String<16>(Hex(0x1000UL))); }); - xml.node("irq", [&] + devs.node("irq", [&] { - xml.attribute("number", irq_base + idx); + devs.attribute("number", irq_base + idx); }); }); } + }); - xml.node("policy", [&] + Reporter::Xml_generator cfg(config_reporter, [&] () + { + cfg.node("policy", [&] { - xml.attribute("label", "test-platform_drv -> "); - xml.attribute("info", true); - xml.attribute("version", state); + cfg.attribute("label", "test-platform_drv -> "); + cfg.attribute("info", true); + cfg.attribute("version", state); for (unsigned idx = 0; idx < assigned; idx++) { - xml.node("device", [&] + cfg.node("device", [&] { - xml.attribute("name", idx); + cfg.attribute("name", idx); }); }; }); @@ -221,6 +225,7 @@ struct Main { platform->sigh(device_rom_handler); config_reporter.enabled(true); + device_reporter.enabled(true); step(); } };