platform_drv: separate devices info from config

Fix genodelabs/genode#4491
This commit is contained in:
Stefan Kalkowski 2022-04-27 15:55:24 +02:00 committed by Christian Helmuth
parent f032bdf81c
commit d0694b3e0b
34 changed files with 111 additions and 347 deletions

View File

@ -0,0 +1,25 @@
<devices>
<device name="sp810_syscon0" type="arm,sp810">
<io_mem address="0x10001000" size="0x1000"/>
</device>
<device name="clcd" type="arm,pl111">
<io_mem address="0x10020000" size="0x1000"/>
</device>
<device name="mmc0" type="arm,pl18x">
<io_mem address="0x10005000" size="0x1000"/>
</device>
<device name="pl050" type="arm,pl050">
<io_mem address="0x10006000" size="0x1000"/>
<io_mem address="0x10007000" size="0x1000"/>
<irq number="52"/>
<irq number="53"/>
</device>
<device name="ethernet" type="smsc,lan9118">
<io_mem address="0x4e000000" size="0x1000"/>
<irq number="60"/>
</device>
</devices>

View File

@ -1,3 +0,0 @@
Device drivers needed for scenarios
using one network interface

View File

@ -1,3 +0,0 @@
_/src/platform_drv
_/src/fec_nic_drv
_/raw/drivers_nic-imx53_qsb

View File

@ -1 +0,0 @@
2022-04-27 629b3de99e3dcfc2cffc12a203ecd680b57587fa

View File

@ -1,3 +0,0 @@
Device drivers needed for scenarios
using one network interface

View File

@ -1,3 +0,0 @@
_/src/platform_drv
_/src/fec_nic_drv
_/raw/drivers_nic-imx6q_sabrelite

View File

@ -1 +0,0 @@
2022-04-27 a1f05fd7b161e366564a8fe8d6a80e1c462f515b

View File

@ -1,3 +0,0 @@
Device drivers needed for scenarios
using one network interface

View File

@ -1,3 +0,0 @@
_/src/platform_drv
_/src/fec_nic_drv
_/raw/drivers_nic-imx7d_sabre

View File

@ -1 +0,0 @@
2022-04-27 4c1644619411b84a4e455f51655310312d3f28bb

View File

@ -1,4 +0,0 @@
content: drivers.config
drivers.config:
cp $(REP_DIR)/recipes/raw/drivers_nic-imx53_qsb/$@ $@

View File

@ -1,47 +0,0 @@
<config>
<parent-provides>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="ROM"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
<service name="Timer"/>
<service name="Uplink"/>
</parent-provides>
<default caps="100"/>
<service name="Nic">
<default-policy> <child name="nic_drv"/> </default-policy> </service>
<start name="platform_drv" caps="150" managing_system="yes">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Platform"/> </provides>
<config>
<device name="fec" type="fsl,imx25-fec">
<io_mem address="0x63fec000" size="0x4000"/>
<irq number="87"/>
<property name="mii" value="rmii"/>
</device>
<policy label="nic_drv -> " info="yes"> <device name="fec"/> </policy>
</config>
<route> <any-service> <parent/> </any-service> </route>
</start>
<start name="nic_drv" caps="130">
<binary name="fec_nic_drv"/>
<resource name="RAM" quantum="20M"/>
<route>
<service name="Uplink"><parent/> </service>
<service name="ROM"> <parent/> </service>
<service name="PD"> <parent/> </service>
<service name="RM"> <parent/> </service>
<service name="CPU"> <parent/> </service>
<service name="LOG"> <parent/> </service>
<service name="Timer"> <parent/> </service>
<service name="Platform"> <child name="platform_drv"/> </service>
</route>
</start>
</config>

View File

@ -1 +0,0 @@
2022-02-14 f111c3360c1e1096321676990f0a52099d0cd087

View File

@ -1,4 +0,0 @@
content: drivers.config
drivers.config:
cp $(REP_DIR)/recipes/raw/drivers_nic-imx6q_sabrelite/$@ $@

View File

@ -1,48 +0,0 @@
<config>
<parent-provides>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="ROM"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
<service name="Timer"/>
<service name="Uplink"/>
</parent-provides>
<default caps="100"/>
<service name="Nic">
<default-policy> <child name="nic_drv"/> </default-policy> </service>
<start name="platform_drv" caps="150" managing_system="yes">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Platform"/> </provides>
<config>
<device name="fec" type="fsl,imx6q-fec">
<io_mem address="0x2188000" size="0x4000"/>
<irq number="150"/>
<irq number="151"/>
<property name="mii" value="rgmii"/>
</device>
<policy label="nic_drv -> " info="yes"> <device name="fec"/> </policy>
</config>
<route> <any-service> <parent/> </any-service> </route>
</start>
<start name="nic_drv" caps="180">
<binary name="fec_nic_drv"/>
<resource name="RAM" quantum="20M"/>
<route>
<service name="Uplink"><parent/> </service>
<service name="ROM"> <parent/> </service>
<service name="PD"> <parent/> </service>
<service name="RM"> <parent/> </service>
<service name="CPU"> <parent/> </service>
<service name="LOG"> <parent/> </service>
<service name="Timer"> <parent/> </service>
<service name="Platform"> <child name="platform_drv"/> </service>
</route>
</start>
</config>

View File

@ -1 +0,0 @@
2022-02-14 244d2052fccea67ddcd69b469bc3ce45fbc8836c

View File

@ -1,4 +0,0 @@
content: drivers.config
drivers.config:
cp $(REP_DIR)/recipes/raw/drivers_nic-imx7d_sabre/$@ $@

View File

@ -1,57 +0,0 @@
<config>
<parent-provides>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="ROM"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
<service name="Timer"/>
<service name="Uplink"/>
</parent-provides>
<default caps="100"/>
<start name="platform_drv" caps="150" managing_system="yes">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Platform"/> </provides>
<config>
<device name="fec0" type="fsl,imx6sx-fec">
<io_mem address="0x30be0000" size="0x4000"/>
<irq number="152"/>
<irq number="153"/>
<property name="mii" value="rgmii"/>
</device>
<device name="fec1" type="fsl,imx6sx-fec">
<io_mem address="0x30bf0000" size="0x4000"/>
<irq number="134"/>
<irq number="135"/>
<property name="mii" value="rgmii"/>
</device>
<policy label="nic_drv -> " info="yes">
<device name="fec0"/>
<device name="fec1"/>
</policy>
</config>
<route> <any-service> <parent/> </any-service> </route>
</start>
<start name="nic_drv" caps="180">
<binary name="fec_nic_drv"/>
<resource name="RAM" quantum="20M"/>
<config uplink_label="fec0"/>
<route>
<service name="Uplink"> <parent/> </service>
<service name="ROM"> <parent/> </service>
<service name="PD"> <parent/> </service>
<service name="RM"> <parent/> </service>
<service name="CPU"> <parent/> </service>
<service name="LOG"> <parent/> </service>
<service name="Timer"> <parent/> </service>
<service name="Platform"> <child name="platform_drv"/> </service>
</route>
</start>
</config>

View File

@ -1 +0,0 @@
2022-02-14 3cbc613660074678d90613ecc44ebf9744d2541a

View File

@ -2,3 +2,4 @@ _/src/pbxa9_drivers
_/src/platform_drv
_/src/event_filter
_/raw/drivers_interactive-pbxa9
_/raw/pbxa9-devices

View File

@ -1,3 +1,4 @@
_/src/lan9118_nic_drv
_/src/platform_drv
_/raw/drivers_nic-pbxa9
_/raw/pbxa9-devices

View File

@ -13,31 +13,11 @@
<default caps="100"/>
<start name="platform_drv">
<start name="platform_drv" managing_system="yes">
<resource name="RAM" quantum="2M"/>
<provides> <service name="Platform"/> </provides>
<route> <any-service> <parent/> </any-service> </route>
<config>
<!-- device resource declarations -->
<device name="clcd" type="arm,pl111">
<io_mem address="0x10020000" size="0x1000"/>
</device>
<device name="sp810_syscon0" type="arm,sp810">
<io_mem address="0x10001000" size="0x1000"/>
</device>
<device name="pl050" type="arm,pl050">
<io_mem address="0x10006000" size="0x1000"/>
<io_mem address="0x10007000" size="0x1000"/>
<irq number="52"/>
<irq number="53"/>
</device>
<!-- policy part, who owns which devices -->
<policy label="fb_drv -> " info="yes">
<device name="clcd"/>
<device name="sp810_syscon0"/>

View File

@ -17,6 +17,17 @@
<resource name="RAM" quantum="640K"/>
<provides> <service name="ROM"/> </provides>
<route> <any-service> <parent/> </any-service> </route>
</start>
<start name="platform_drv" managing_system="yes">
<resource name="RAM" quantum="2M"/>
<provides> <service name="Platform"/> </provides>
<route>
<service name="ROM" label="devices">
<child name="virtdev_rom"/>
</service>
<any-service> <parent/> </any-service>
</route>
<config>
<policy label_prefix="virtio_fb_drv" info="yes">
<device name="gpu0"/>
@ -30,17 +41,6 @@
</config>
</start>
<start name="platform_drv" managing_system="yes">
<resource name="RAM" quantum="2M"/>
<provides> <service name="Platform"/> </provides>
<route>
<service name="ROM" label="config">
<child name="virtdev_rom"/>
</service>
<any-service> <parent/> </any-service>
</route>
</start>
<start name="event_filter" caps="90">
<resource name="RAM" quantum="1280K"/>
<provides> <service name="Event"/> </provides>

View File

@ -13,21 +13,11 @@
<default caps="100"/>
<start name="platform_drv">
<start name="platform_drv" managing_system="yes">
<resource name="RAM" quantum="2M"/>
<provides> <service name="Platform"/> </provides>
<route> <any-service> <parent/> </any-service> </route>
<config>
<!-- device resource declarations -->
<device name="ethernet" type="smsc,lan9118">
<io_mem address="0x4e000000" size="0x1000"/>
<irq number="60"/>
</device>
<!-- policy part, who owns which devices -->
<policy label="nic_drv -> ">
<device name="ethernet"/>
</policy>
@ -37,7 +27,6 @@
<start name="nic_drv">
<binary name="lan9118_nic_drv"/>
<resource name="RAM" quantum="4M"/>
<config mmio_base="0x4e000000" irq="60" />
<route>
<service name="Platform">
<child name="platform_drv"/>

View File

@ -17,22 +17,22 @@
<resource name="RAM" quantum="640K"/>
<provides> <service name="ROM"/> </provides>
<route> <any-service> <parent/> </any-service> </route>
<config>
<policy label_prefix="virtio_mmio_nic" info="yes">
<device name="nic0"/>
</policy>
</config>
</start>
<start name="platform_drv" managing_system="yes">
<resource name="RAM" quantum="2M"/>
<provides> <service name="Platform"/> </provides>
<route>
<service name="ROM" label="config">
<service name="ROM" label="devices">
<child name="virtdev_rom"/>
</service>
<any-service> <parent/> </any-service>
</route>
<config>
<policy label_prefix="virtio_mmio_nic" info="yes">
<device name="nic0"/>
</policy>
</config>
</start>
<start name="virtio_mmio_nic">

View File

@ -0,0 +1,4 @@
content: devices
devices:
cp $(GENODE_DIR)/repos/base/board/pbxa9/$@ $@

View File

@ -0,0 +1 @@
2022-05-13 c5053878eefb4b84eff0f0d51b3c4150fac6b7cb

View File

@ -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 {
<config>
<parent-provides>
<service name="ROM"/>
@ -50,16 +45,6 @@ set config {
</provides>
<config>
<device name="i2c2">
<!-- I2C ctl register -->
<io_mem address="0x30a30000" size="0x10000"/>
<irq number="68"/>
<clock name="i2c2_clk_root"
driver_name="i2c2_root_clk" parent="system_pll3_clk"/>
<clock name="i2c2_gate"/>
</device>
<policy label_prefix="imx8q_evk_i2c_drv"> <device name="i2c2"/> </policy>
</config>
@ -92,15 +77,12 @@ set config {
</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

View File

@ -46,6 +46,8 @@ install_config {
<import>
<inline name="config"><config><default-policy/></config>
</inline>
<inline name="devices"><devices/>
</inline>
</import>
</vfs>
<policy label="fs_report -> " root="/" writeable="yes"/>
@ -78,6 +80,7 @@ install_config {
<provides> <service name="Platform"/> </provides>
<route>
<service name="ROM" label="config"> <child name="report_fs_rom"/> </service>
<service name="ROM" label="devices"><child name="report_fs_rom"/> </service>
<any-service> <parent/> </any-service>
</route>
</start>
@ -85,7 +88,10 @@ install_config {
<start name="test-platform_drv">
<resource name="RAM" quantum="1M"/>
<route>
<service name="Report"> <child name="fs_report" label="config"/> </service>
<service name="Report" label="config">
<child name="fs_report" label="config"/> </service>
<service name="Report" label="devices">
<child name="fs_report" label="devices"/> </service>
<service name="Platform"> <child name="platform_drv"/> </service>
<any-service> <parent/> </any-service>
</route>

View File

@ -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 {
</parent-provides>
<default caps="100"/>
<start name="platform_drv">
<start name="platform_drv" managing_system="yes">
<resource name="RAM" quantum="1M"/>
<provides><service name="Platform"/></provides>
<config>
<device name="card" type="arm,pl18x">
<io_mem address="0x10005000" size="0x1000"/>
</device>
<policy label="pl180_sd_card_drv -> ">
<device name="card"/>
<device name="mmc0"/>
</policy>
</config>
<route>

View File

@ -26,45 +26,6 @@ proc sd_card_drv {} {
exit 0;
}
proc platform_drv {} {
return platform_drv
}
proc device {} {
if {[have_board pbxa9]} {
return {
<device name="card" type="arm,pl18x">
<io_mem address="0x10005000" size="0x1000"/>
</device>
}
}
if {[have_board imx6q_sabrelite]} {
return {
<device name="card" type="fsl,imx6q-usdhc">
<io_mem address="0x0219c000" size="0x4000"/>
<irq number="57"/>
</device>
}
}
if {[have_board imx53_qsb] || [have_board imx53_qsb_tz]} {
return {
<device name="card" type="fsl,imx53-esdhc">
<io_mem address="0x50004000" size="0x4000"/>
<irq number="1"/>
</device>
}
}
if {[have_board rpi]} {
return {
<device name="card" type="brcm,bcm2835-sdhci">
<io_mem address="0x20300000" size="0x100"/>
</device>
}
}
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 {
<default caps="100"/>
<start name="platform_drv" managing_system="yes">
<binary name="} [platform_drv] {"/>
<resource name="RAM" quantum="1M"/>
<provides><service name="Platform"/></provides>
<config>} [device] {
<policy label="sd_card_drv -> "> <device name="card"/> </policy>
<config>
<policy label="sd_card_drv -> "> <device name="mmc0"/> </policy>
</config>
<route> <any-service> <parent/> </any-service> </route>
</start>
@ -116,6 +76,7 @@ install_config {
</config> }
file copy [select_from_repositories board/[board]/devices] [run_dir]/genode/devices
build { drivers/sd_card }
build_boot_image [sd_card_drv]

View File

@ -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<Main> 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<Main> 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();
}

View File

@ -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<char>(), ds.size(), "config", [&] ()
Xml_generator xml(ds.local_addr<char>(), 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<Device::Magic>() != 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);
});
});
}

View File

@ -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::Connection> platform { env };
Constructible<Platform::Connection> 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();
}
};