os: introduce device type in platform driver

* Move "compatible" property value to "type" attribute
* Turn device_by_property helper in Platform::Connection into device_by_type

Fix #4074
This commit is contained in:
Stefan Kalkowski 2021-04-15 14:30:15 +02:00 committed by Norman Feske
parent 46ca576eac
commit d1cf9c86b8
29 changed files with 112 additions and 138 deletions

View File

@ -68,7 +68,7 @@
<irq number="67"/>
</device>
<device name="usb_host_2">
<device name="usb_host_2" type="snps,dwc3">
<io_mem address="0x38200000" size="0x10000"/>
<irq number="73"/>
<power-domain name="usb_otg_2"/>
@ -84,12 +84,11 @@
rate="500000000"/>
<clock name="usb_ctrl2_gate"/>
<clock name="usb_phy2_gate"/>
<property name="compatible" value="snps,dwc3"/>
<property name="dr_mode" value="host"/>
<property name="snps,dis_u2_susphy_quirk"/>
</device>
<device name="dcss">
<device name="dcss" type="nxp,imx8mq-dcss">
<io_mem address="0x32e00000" size="0x30000"/>
<irq number="50"/>
<clock name="display_apb_clk_root"
@ -111,7 +110,6 @@
parent="video_pll1_clk"
rate="120000000"
driver_name="pix"/>
<property name="compatible" value="nxp,imx8mq-dcss"/>
<property name="disp-dev" value="hdmi_disp"/>
</device>
@ -121,7 +119,7 @@
<io_mem address="0x30390000" size="0x10000"/>
</device>
<device name="mipi_dsi">
<device name="mipi_dsi" type="fsl,imx8mq-mipi-dsi_drm">
<io_mem address="0x30a00000" size="0x1000"/>
<irq number="66"/>
<power-domain name="mipi"/>
@ -137,16 +135,14 @@
parent="system_pll1_div3"
rate="266000000"
driver_name="core"/>
<property name="compatible" value="fsl,imx8mq-mipi-dsi_drm"/>
</device>
<device name="hdmi">
<device name="hdmi" type="fsl,imx8mq-hdmi">
<io_mem address="0x32c00000" size="0x100000"/>
<io_mem address="0x32e40000" size="0x40000"/>
<io_mem address="0x32e2f000" size="0x10"/>
<irq number="48"/>
<irq number="57"/>
<property name="compatible" value="fsl,imx8mq-hdmi"/>
</device>
<policy label="usb_drv -> "> <device name="usb_host_2"/> </policy>

View File

@ -20,10 +20,9 @@
<resource name="RAM" quantum="1M"/>
<provides> <service name="Platform"/> </provides>
<config>
<device name="fec">
<device name="fec" type="fsl,imx25-fec">
<io_mem address="0x63fec000" size="0x4000"/>
<irq number="87"/>
<property name="compatible" value="fsl,imx25-fec"/>
<property name="mii" value="rmii"/>
</device>
<policy label="nic_drv -> "> <device name="fec"/> </policy>

View File

@ -20,11 +20,10 @@
<resource name="RAM" quantum="1M"/>
<provides> <service name="Platform"/> </provides>
<config>
<device name="fec">
<device name="fec" type="fsl,imx6q-fec">
<io_mem address="0x2188000" size="0x4000"/>
<irq number="150"/>
<irq number="151"/>
<property name="compatible" value="fsl,imx6q-fec"/>
<property name="mii" value="rgmii"/>
</device>
<policy label="nic_drv -> "> <device name="fec"/> </policy>

View File

@ -18,18 +18,16 @@
<resource name="RAM" quantum="1M"/>
<provides> <service name="Platform"/> </provides>
<config>
<device name="fec0">
<device name="fec0" type="fsl,imx6sx-fec">
<io_mem address="0x30be0000" size="0x4000"/>
<irq number="152"/>
<irq number="153"/>
<property name="compatible" value="fsl,imx6sx-fec"/>
<property name="mii" value="rgmii"/>
</device>
<device name="fec1">
<device name="fec1" type="fsl,imx6sx-fec">
<io_mem address="0x30bf0000" size="0x4000"/>
<irq number="134"/>
<irq number="135"/>
<property name="compatible" value="fsl,imx6sx-fec"/>
<property name="mii" value="rgmii"/>
</device>
<policy label="nic_drv -> ">

View File

@ -18,12 +18,11 @@
<resource name="RAM" quantum="1M"/>
<provides> <service name="Platform"/> </provides>
<config>
<device name="fec">
<device name="fec" type="fsl,imx6sx-fec">
<io_mem address="0x30be0000" size="0x4000"/>
<irq number="152"/>
<irq number="151"/>
<irq number="150"/>
<property name="compatible" value="fsl,imx6sx-fec"/>
<property name="mii" value="rgmii-id"/>
</device>
<policy label="nic_drv -> "> <device name="fec"/> </policy>

View File

@ -60,7 +60,7 @@ if { [get_cmd_switch --autopilot] &&
proc platform_drv_config_non_x86 {} {
if {[have_board imx8q_evk]} {
return {
<device name="usb_host_2">
<device name="usb_host_2" type="snps,dwc3">
<io_mem address="0x38200000" size="0x10000"/>
<irq number="73"/>
<power-domain name="usb_otg_2"/>
@ -76,7 +76,6 @@ proc platform_drv_config_non_x86 {} {
rate="500000000"/>
<clock name="usb_ctrl2_gate"/>
<clock name="usb_phy2_gate"/>
<property name="compatible" value="snps,dwc3"/>
<property name="dr_mode" value="host"/>
<property name="snps,dis_u2_susphy_quirk"/>
</device>
@ -85,20 +84,17 @@ proc platform_drv_config_non_x86 {} {
}
if {[have_board imx6q_sabrelite]} {
return {
<device name="mxs_phy">
<device name="mxs_phy" type="fsl,imx6q-usbphy">
<io_mem address="0x020ca000" size="0xfff"/>
<irq number="77"/>
<property name="compatible" value="fsl,imx6q-usbphy"/>
<property name="fsl,anatop" value="0xdeaddead"/>
</device>
<device name="usbmisc_imx">
<device name="usbmisc_imx" type="fsl,imx6q-usbmisc">
<io_mem address="0x02184800" size="0x1ff"/>
<property name="compatible" value="fsl,imx6q-usbmisc"/>
</device>
<device name="imx_usb">
<device name="imx_usb" type="fsl,imx6q-usb">
<io_mem address="0x02184200" size="0x1ff"/>
<irq number="72"/>
<property name="compatible" value="fsl,imx6q-usb"/>
<property name="fsl,usbmisc" value="usbmisc_imx"/>
<property name="dr_mode" value="host"/>
</device>
@ -111,11 +107,10 @@ proc platform_drv_config_non_x86 {} {
}
if {[have_board rpi]} {
return {
<device name="dwc_otg">
<device name="dwc_otg" type="brcm,bcm2835-usb">
<io_mem address="0x20980000" size="0x10000"/>
<irq number="9"/>
<power-domain name="usb"/>
<property name="compatible" value="brcm,bcm2835-usb"/>
</device>
<policy label="usb_drv -> "> <device name="dwc_otg"/> </policy>
}

View File

@ -74,22 +74,19 @@ Platform::Device_client & Lx_kit::platform_device(Device_id id)
{
if (id == DCSS) {
static Platform::Device_client dcss {
platform_connection().device_by_property("compatible",
"nxp,imx8mq-dcss") };
platform_connection().device_by_type("nxp,imx8mq-dcss") };
return dcss;
}
if (id == HDMI) {
static Platform::Device_client hdmi {
platform_connection().device_by_property("compatible",
"fsl,imx8mq-hdmi") };
platform_connection().device_by_type("fsl,imx8mq-hdmi") };
return hdmi;
}
if (id == MIPI) {
static Platform::Device_client mipi {
platform_connection().device_by_property("compatible",
"fsl,imx8mq-mipi-dsi_drm") };
platform_connection().device_by_type("fsl,imx8mq-mipi-dsi_drm") };
static bool update = true;
if (update) {
platform_connection().update();

View File

@ -249,9 +249,8 @@ struct Fec : public Genode::List<Fec>::Element
{
using namespace Genode;
phy_driver = xml.attribute_value("type", String());
xml.for_each_sub_node("property", [&] (Xml_node node) {
if (String("compatible") == node.attribute_value("name", String())) {
phy_driver = node.attribute_value("value", String()); }
if (String("mdio_bus") == node.attribute_value("name", String())) {
mdio_bus = node.attribute_value("value", String()); }
if (String("mdio_reg") == node.attribute_value("name", String())) {
@ -292,9 +291,8 @@ struct Fec : public Genode::List<Fec>::Element
{
using namespace Genode;
type = xml.attribute_value("type", String());
xml.for_each_sub_node("property", [&] (Xml_node node) {
if (String("compatible") == node.attribute_value("name", String())) {
type = node.attribute_value("value", String()); }
if (String("mii") == node.attribute_value("name", String())) {
phy_mode = node.attribute_value("value", String()); }
if (String("phy") == node.attribute_value("name", String())) {
@ -376,14 +374,11 @@ int platform_driver_register(struct platform_driver * drv)
xml.for_each_sub_node("device", [&] (Xml_node node) {
String name = node.attribute_value("name", String());
String compatible;
node.for_each_sub_node("property", [&] (Xml_node node) {
if (String("compatible") == node.attribute_value("name", String())) {
compatible = node.attribute_value("value", String()); }});
String type = node.attribute_value("type", String());
if (compatible == "fsl,imx6q-fec" ||
compatible == "fsl,imx6sx-fec" ||
compatible == "fsl,imx25-fec") {
if (type == "fsl,imx6q-fec" ||
type == "fsl,imx6sx-fec" ||
type == "fsl,imx25-fec") {
Fec * f = new (Lx_kit::env().heap())
Fec(name, node, platform_connection().acquire_device(name.string()));
@ -396,7 +391,7 @@ int platform_driver_register(struct platform_driver * drv)
return;
}
if (compatible == "ethernet-phy-ieee802.3-c22") {
if (type == "ethernet-phy-ieee802.3-c22") {
Fec::Mdio::Phy * p = new (Lx_kit::env().heap())
Fec::Mdio::Phy(name, node, platform_connection().acquire_device(name.string()));
for (Fec * f = fec_devices().first(); f; f = f->next()) {

View File

@ -94,6 +94,7 @@ void lx_platform_device_init()
xml.for_each_sub_node("device", [&] (Xml_node node)
{
Device::Name name = node.attribute_value("name", Device::Name());
Device::Name type = node.attribute_value("type", Device::Name());
Platform::Device_client device {
resource_env().platform.acquire_device(name.string()) };
@ -138,6 +139,12 @@ void lx_platform_device_init()
pdev->dev.of_node->dev = &pdev->dev;
property ** prop = &pdev->dev.of_node->properties;
*prop = (property*) kzalloc(sizeof(property), 0);
(*prop)->name = "compatible";
(*prop)->value = kzalloc(64,0);
copy_cstring((char*)(*prop)->value, type.string(), 64);
prop = &(*prop)->next;
node.for_each_sub_node("property", [&] (Xml_node node) {
*prop = (property*) kzalloc(sizeof(property), 0);
(*prop)->name = (char*)kzalloc(64,0);

View File

@ -103,7 +103,7 @@
<irq number="67"/>
</device>
<device name="usb_host_2">
<device name="usb_host_2" type="snps,dwc3">
<io_mem address="0x38200000" size="0x10000"/>
<irq number="73"/>
<power-domain name="usb_otg_2"/>
@ -119,12 +119,11 @@
rate="500000000"/>
<clock name="usb_ctrl2_gate"/>
<clock name="usb_phy2_gate"/>
<property name="compatible" value="snps,dwc3"/>
<property name="dr_mode" value="host"/>
<property name="snps,dis_u2_susphy_quirk"/>
</device>
<device name="dcss">
<device name="dcss" type="nxp,imx8mq-dcss">
<io_mem address="0x32e00000" size="0x30000"/>
<irq number="50"/>
<clock name="display_apb_clk_root"
@ -146,7 +145,6 @@
parent="video_pll1_clk"
rate="120000000"
driver_name="pix"/>
<property name="compatible" value="nxp,imx8mq-dcss"/>
<property name="disp-dev" value="hdmi_disp"/>
</device>
@ -156,7 +154,7 @@
<io_mem address="0x30390000" size="0x10000"/>
</device>
<device name="mipi_dsi">
<device name="mipi_dsi" type="fsl,imx8mq-mipi-dsi_drm">
<io_mem address="0x30a00000" size="0x1000"/>
<irq number="66"/>
<power-domain name="mipi"/>
@ -172,33 +170,29 @@
parent="system_pll1_div3"
rate="266000000"
driver_name="core"/>
<property name="compatible" value="fsl,imx8mq-mipi-dsi_drm"/>
</device>
<device name="hdmi">
<device name="hdmi" value="fsl,imx8mq-hdmi">
<io_mem address="0x32c00000" size="0x100000"/>
<io_mem address="0x32e40000" size="0x40000"/>
<io_mem address="0x32e2f000" size="0x10"/>
<irq number="48"/>
<irq number="57"/>
<property name="compatible" value="fsl,imx8mq-hdmi"/>
</device>
<device name="sdhc2">
<device name="sdhc2" type="fsl,imx8mq-usdhc">
<io_mem address="0x30b50000" size="0x10000"/>
<irq number="55"/>
<clock name="nand_usdhc_bus_clk_root"/>
<clock name="usdhc2_clk_root"/>
<clock name="usdhc2_gate"/>
<property name="compatible" value="fsl,imx8mq-usdhc"/>
</device>
<device name="fec">
<device name="fec" type="fsl,imx6sx-fec">
<io_mem address="0x30be0000" size="0x4000"/>
<irq number="152"/>
<irq number="151"/>
<irq number="150"/>
<property name="compatible" value="fsl,imx6sx-fec"/>
<property name="mii" value="rgmii-id"/>
</device>

View File

@ -18,13 +18,11 @@
<provides> <service name="Platform"/> </provides>
<config>
<device name="dwc_otg">
<device name="dwc_otg" type="brcm,bcm2835-usb">
<io_mem address="0x20980000" size="0x10000"/>
<irq number="9"/>
<property name="compatible" value="brcm,bcm2835-usb"/>
<power-domain name="usb"/>
</device>
<policy label_prefix="rpi_usb_host_drv">
<device name="dwc_otg"/>
</policy>

View File

@ -100,12 +100,11 @@ append_if $use_sd_card_drv config {
<resource name="RAM" quantum="1M"/>
<provides><service name="Platform"/></provides>
<config>
<device name="">
<device name="pl180" type="arm,pl18x">
<io_mem address="0x10005000" size="0x1000"/>
<property name="compatible" value="arm,pl18x"/>
</device>
<policy label="pl180_sd_card_drv -> ">
<device name=""/>
<device name="pl180"/>
</policy>
</config>
<route>

View File

@ -84,12 +84,11 @@ append_if $use_sd_card_drv config {
<resource name="RAM" quantum="1M"/>
<provides><service name="Platform"/></provides>
<config>
<device name="">
<device name="pl180" type="arm,pl18x">
<io_mem address="0x10005000" size="0x1000"/>
<property name="compatible" value="arm,pl18x"/>
</device>
<policy label="pl180_sd_card_drv -> ">
<device name=""/>
<device name="pl180"/>
</policy>
</config>
<route>

View File

@ -121,12 +121,11 @@ append_if $use_sd_card_drv config {
<resource name="RAM" quantum="1M"/>
<provides><service name="Platform"/></provides>
<config>
<device name="">
<device name="pl180" type="arm,pl18x">
<io_mem address="0x10005000" size="0x1000"/>
<property name="compatible" value="arm,pl18x"/>
</device>
<policy label="pl180_sd_card_drv -> ">
<device name=""/>
<device name="pl180"/>
</policy>
</config>
<route>

View File

@ -128,12 +128,11 @@ append_if $use_sd_card_drv config {
<resource name="RAM" quantum="1M"/>
<provides><service name="Platform"/></provides>
<config>
<device name="">
<device name="pl180" type="arm,pl18x">
<io_mem address="0x10005000" size="0x1000"/>
<property name="compatible" value="arm,pl18x"/>
</device>
<policy label="pl180_sd_card_drv -> ">
<device name=""/>
<device name="pl180"/>
</policy>
</config>
<route>

View File

@ -104,12 +104,11 @@ append_if $use_sd_card_drv config {
<resource name="RAM" quantum="1M"/>
<provides><service name="Platform"/></provides>
<config>
<device name="">
<device name="pl180" type="arm,pl18x">
<io_mem address="0x10005000" size="0x1000"/>
<property name="compatible" value="arm,pl18x"/>
</device>
<policy label="pl180_sd_card_drv -> ">
<device name=""/>
<device name="pl180"/>
</policy>
</config>
<route>

View File

@ -101,8 +101,7 @@ class Platform::Connection : public Genode::Connection<Session>,
return cap;
}
Device_capability device_by_property(char const * property,
char const * value)
Device_capability device_by_type(char const * type)
{
using String = Genode::String<64>;
@ -113,23 +112,15 @@ class Platform::Connection : public Genode::Connection<Session>,
/* already found a device? */
if (cap.valid()) { return; }
bool found = false;
node.for_each_sub_node("property", [&] (Xml_node node) {
if ((node.attribute_value("name", String()) == property) &&
(node.attribute_value("value", String()) == value)) {
found = true;
}
});
if (node.attribute_value("type", String()) != type) {
return; }
if (found) {
Device::Name name = node.attribute_value("name",
Device::Name());
cap = acquire_device(name.string());
}
});
if (!cap.valid()) {
error(__func__, ": property=", property, " value=",
value, " not found!");
error(__func__, ": type=", type, " not found!");
error("device ROM content: ", xml);
}
});

View File

@ -21,26 +21,22 @@
<!-- device resource declarations -->
<device name="clcd">
<device name="clcd" type="arm,pl111">
<io_mem address="0x10020000" size="0x1000"/>
<property name="compatible" value="arm,pl111"/>
</device>
<device name="sp810_syscon0">
<device name="sp810_syscon0" type="arm,sp810">
<io_mem address="0x10001000" size="0x1000"/>
<property name="compatible" value="arm,sp810"/>
</device>
<device name="kmi0">
<device name="kmi0" type="arm,pl050">
<io_mem address="0x10006000" size="0x1000"/>
<irq number="52"/>
<property name="compatible" value="arm,pl050"/>
</device>
<device name="kmi1">
<device name="kmi1" type="arm,pl050">
<io_mem address="0x10007000" size="0x1000"/>
<irq number="53"/>
<property name="compatible" value="arm,pl050"/>
</device>
<!-- policy part, who owns which devices -->

View File

@ -21,10 +21,9 @@
<!-- device resource declarations -->
<device name="ethernet">
<device name="ethernet" type="smsc,lan9118">
<io_mem address="0x4e000000" size="0x1000"/>
<irq number="60"/>
<property name="compatible" value="smsc,lan9118"/>
</device>
<!-- policy part, who owns which devices -->

View File

@ -24,9 +24,8 @@ install_config {
<resource name="RAM" quantum="1M"/>
<provides><service name="Platform"/></provides>
<config>
<device name="card">
<device name="card" type="arm,pl18x">
<io_mem address="0x10005000" size="0x1000"/>
<property name="compatible" value="arm,pl18x"/>
</device>
<policy label="pl180_sd_card_drv -> ">
<device name="card"/>

View File

@ -33,41 +33,46 @@ proc platform_drv {} {
return platform_drv
}
proc device_resources {} {
proc device {} {
if {[have_board pbxa9]} {
return {
<device name="card" type="arm,pl18x">
<io_mem address="0x10005000" size="0x1000"/>
<property name="compatible" value="arm,pl18x"/>
</device>
}
}
if {[have_board imx8q_evk]} {
return {
<device name="card" type="fsl,imx8mq-usdhc">
<io_mem address="0x30b50000" size="0x10000"/>
<irq number="55"/>
<clock name="nand_usdhc_bus_clk_root"/>
<clock name="usdhc2_clk_root"/>
<clock name="usdhc2_gate"/>
<property name="compatible" value="fsl,imx8mq-usdhc"/>
</device>
}
}
if {[have_board imx6q_sabrelite]} {
return {
<device name="card" type="fsl,imx6q-usdhc">
<io_mem address="0x0219c000" size="0x4000"/>
<irq number="57"/>
<property name="compatible" value="fsl,imx6q-usdhc"/>
</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"/>
<property name="compatible" value="fsl,imx53-esdhc"/>
</device>
}
}
if {[have_board rpi]} {
return {
<device name="card" type="brcm,bcm2835-sdhci">
<io_mem address="0x20300000" size="0x100"/>
<property name="compatible" value="brcm,bcm2835-sdhci"/>
</device>
}
}
puts "\n Run script is not supported on this platform. \n";
@ -96,8 +101,7 @@ install_config {
<binary name="} [platform_drv] {"/>
<resource name="RAM" quantum="1M"/>
<provides><service name="Platform"/></provides>
<config>
<device name="card">} [device_resources] {</device>
<config>} [device] {
<policy label="sd_card_drv -> "> <device name="card"/> </policy>
</config>
<route> <any-service> <parent/> </any-service> </route>

View File

@ -85,10 +85,8 @@ struct Pl11x_driver::Main
*/
Platform::Connection _platform { _env };
Platform::Device_client _pl11x_dev {
_platform.device_by_property("compatible", "arm,pl111") };
Platform::Device_client _sp810_dev {
_platform.device_by_property("compatible", "arm,sp810") };
Platform::Device_client _pl11x_dev { _platform.device_by_type("arm,pl111") };
Platform::Device_client _sp810_dev { _platform.device_by_type("arm,sp810") };
Attached_dataspace _lcd_io_mem { _env.rm(),
_pl11x_dev.io_mem_dataspace() };
Attached_dataspace _sys_mem { _env.rm(),

View File

@ -54,7 +54,8 @@ void Device_model::destroy_element(Device & dev)
Device & Device_model::create_element(Genode::Xml_node node)
{
Device::Name name = node.attribute_value("name", Device::Name());
return *(new (_env.heap) Imx_device(name));
Device::Type type = node.attribute_value("type", Device::Type());
return *(new (_env.heap) Imx_device(name, type));
}

View File

@ -58,7 +58,8 @@ class Driver::Imx_device : public Driver::Device
bool acquire(Session_component &) override;
void release(Session_component &) override;
Imx_device(Device::Name name) : Device(name) {}
Imx_device(Device::Name name, Device::Type type)
: Device(name, type) {}
protected:

View File

@ -49,7 +49,8 @@ void Device_model::destroy_element(Device & dev)
Device & Device_model::create_element(Genode::Xml_node node)
{
Device::Name name = node.attribute_value("name", Device::Name());
return *(new (_env.heap) Rpi_device(name));
Device::Type type = node.attribute_value("type", Device::Type());
return *(new (_env.heap) Rpi_device(name, type));
}

View File

@ -42,7 +42,8 @@ class Driver::Rpi_device : public Driver::Device
bool acquire(Session_component &) override;
void release(Session_component &) override;
Rpi_device(Device::Name name) : Device(name) {}
Rpi_device(Device::Name name, Device::Type type)
: Device(name, type) {}
protected:

View File

@ -17,6 +17,9 @@
Driver::Device::Name Driver::Device::name() const { return _name; }
Driver::Device::Type Driver::Device::type() const { return _type; }
bool Driver::Device::acquire(Session_component & sc)
{
if (_session.valid() && _session != sc.label()) { return false; }
@ -125,6 +128,7 @@ void Driver::Device::report(Xml_generator & xml, Session_component & sc)
xml.node("device", [&] () {
xml.attribute("name", name());
xml.attribute("type", type());
_io_mem_list.for_each([&] (Io_mem & io_mem) {
xml.node("io_mem", [&] () {
xml.attribute("id", io_mem_id++);
@ -166,8 +170,8 @@ Genode::size_t Driver::Device::_ram_quota_required()
}
Driver::Device::Device(Name name)
: _name(name) { }
Driver::Device::Device(Name name, Type type)
: _name(name), _type(type) { }
Driver::Device::~Device()

View File

@ -71,11 +71,13 @@ class Driver::Device : private List_model<Device>::Element
};
using Name = Genode::String<64>;
using Type = Genode::String<64>;
Device(Name name);
Device(Name name, Type type);
virtual ~Device();
Name name() const;
Type type() const;
virtual bool acquire(Session_component &);
virtual void release(Session_component &);
@ -100,6 +102,7 @@ class Driver::Device : private List_model<Device>::Element
friend class List<Device>;
Name _name;
Type _type;
Platform::Session::Label _session {};
List_model<Io_mem> _io_mem_list {};
List_model<Irq> _irq_list {};
@ -145,8 +148,11 @@ class Driver::Device_model :
Device & create_element(Xml_node node);
void update_element(Device & device, Xml_node node);
static bool element_matches_xml_node(Device const & dev,
Genode::Xml_node n) {
return dev.name() == n.attribute_value("name", Device::Name()); }
Genode::Xml_node n)
{
return dev.name() == n.attribute_value("name", Device::Name()) &&
dev.type() == n.attribute_value("type", Device::Type());
}
static bool node_is_element(Genode::Xml_node node) {
return node.has_type("device"); }

View File

@ -41,7 +41,8 @@ void Device_model::destroy_element(Device & device)
Device & Device_model::create_element(Genode::Xml_node node)
{
Device::Name name = node.attribute_value("name", Device::Name());
return *(new (_env.heap) Device(name));
Device::Type type = node.attribute_value("type", Device::Type());
return *(new (_env.heap) Device(name, type));
}