mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-21 22:47:50 +00:00
parent
df71cecc66
commit
672b03f553
@ -71,34 +71,16 @@ struct Irq_override : List_model<Irq_override>::Element
|
||||
if (mode == Mode::LEVEL)
|
||||
generator.attribute("mode", "level");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct Irq_override_policy : List_model<Irq_override>::Update_policy
|
||||
{
|
||||
Heap & heap;
|
||||
|
||||
void destroy_element(Irq_override & irq) {
|
||||
destroy(heap, &irq); }
|
||||
|
||||
Irq_override & create_element(Xml_node node)
|
||||
bool matches(Xml_node const &node) const
|
||||
{
|
||||
return *(new (heap)
|
||||
Irq_override(node.attribute_value<uint8_t>("irq", 0xff),
|
||||
node.attribute_value<uint8_t>("gsi", 0xff),
|
||||
node.attribute_value<uint8_t>("flags", 0)));
|
||||
return (from == node.attribute_value("irq", ~0U));
|
||||
}
|
||||
|
||||
void update_element(Irq_override &, Xml_node) {}
|
||||
|
||||
static bool element_matches_xml_node(Irq_override const & irq,
|
||||
Genode::Xml_node node) {
|
||||
return irq.from == node.attribute_value("irq", ~0U); }
|
||||
|
||||
static bool node_is_element(Genode::Xml_node node) {
|
||||
return node.has_type("irq_override"); }
|
||||
|
||||
Irq_override_policy(Heap & heap) : heap(heap) {}
|
||||
static bool type_matches(Xml_node const &node)
|
||||
{
|
||||
return node.has_type("irq_override");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -127,39 +109,17 @@ struct Irq_routing : List_model<Irq_routing>::Element
|
||||
|
||||
irq = to;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct Irq_routing_policy : List_model<Irq_routing>::Update_policy
|
||||
{
|
||||
Heap & heap;
|
||||
|
||||
void destroy_element(Irq_routing & irq) {
|
||||
destroy(heap, &irq); }
|
||||
|
||||
Irq_routing & create_element(Xml_node node)
|
||||
bool matches(Xml_node const &node) const
|
||||
{
|
||||
rid_t bridge_bdf = node.attribute_value<rid_t>("bridge_bdf", 0xff);
|
||||
return *(new (heap)
|
||||
Irq_routing(Bdf::bdf(bridge_bdf),
|
||||
node.attribute_value<uint8_t>("device", 0xff),
|
||||
node.attribute_value<uint8_t>("device_pin", 0xff),
|
||||
node.attribute_value<uint8_t>("gsi", 0xff)));
|
||||
rid_t const bdf = node.attribute_value<rid_t>("bridge_bdf", 0xff);
|
||||
return bridge_bdf == Bdf::bdf(bdf) &&
|
||||
dev == node.attribute_value<uint8_t>("device", 0xff) &&
|
||||
pin == node.attribute_value<uint8_t>("device_pin", 0xff);
|
||||
}
|
||||
|
||||
void update_element(Irq_routing &, Xml_node) {}
|
||||
|
||||
static bool element_matches_xml_node(Irq_routing const & ir,
|
||||
Genode::Xml_node node)
|
||||
static bool type_matches(Xml_node const &node)
|
||||
{
|
||||
rid_t bridge_bdf = node.attribute_value<rid_t>("bridge_bdf", 0xff);
|
||||
return ir.bridge_bdf == Bdf::bdf(bridge_bdf) &&
|
||||
ir.dev == node.attribute_value<uint8_t>("device", 0xff) &&
|
||||
ir.pin == node.attribute_value<uint8_t>("device_pin", 0xff);
|
||||
return node.has_type("routing");
|
||||
}
|
||||
|
||||
static bool node_is_element(Genode::Xml_node node) {
|
||||
return node.has_type("routing"); }
|
||||
|
||||
Irq_routing_policy(Heap & heap) : heap(heap) {}
|
||||
};
|
||||
|
@ -490,19 +490,74 @@ Main::Main(Env & env) : env(env)
|
||||
Xml_node xml = sys_rom.xml();
|
||||
|
||||
if (apic_capable) {
|
||||
Irq_override_policy policy(heap);
|
||||
irq_override_list.update_from_xml(policy, xml);
|
||||
|
||||
update_list_model_from_xml(irq_override_list, xml,
|
||||
|
||||
/* create */
|
||||
[&] (Xml_node const &node) -> Irq_override &
|
||||
{
|
||||
return *new (heap)
|
||||
Irq_override(node.attribute_value<uint8_t>("irq", 0xff),
|
||||
node.attribute_value<uint8_t>("gsi", 0xff),
|
||||
node.attribute_value<uint8_t>("flags", 0));
|
||||
},
|
||||
|
||||
/* destroy */
|
||||
[&] (Irq_override &irq_override) { destroy(heap, &irq_override); },
|
||||
|
||||
/* update */
|
||||
[&] (Irq_override &, Xml_node const &) { }
|
||||
);
|
||||
|
||||
update_list_model_from_xml(irq_routing_list, xml,
|
||||
|
||||
/* create */
|
||||
[&] (Xml_node const &node) -> Irq_routing &
|
||||
{
|
||||
rid_t bridge_bdf = node.attribute_value<rid_t>("bridge_bdf", 0xff);
|
||||
return *new (heap)
|
||||
Irq_routing(Bdf::bdf(bridge_bdf),
|
||||
node.attribute_value<uint8_t>("device", 0xff),
|
||||
node.attribute_value<uint8_t>("device_pin", 0xff),
|
||||
node.attribute_value<uint8_t>("gsi", 0xff));
|
||||
},
|
||||
|
||||
/* destroy */
|
||||
[&] (Irq_routing &irq_routing) { destroy(heap, &irq_routing); },
|
||||
|
||||
/* update */
|
||||
[&] (Irq_routing &, Xml_node const &) { }
|
||||
);
|
||||
}
|
||||
|
||||
if (apic_capable) {
|
||||
Irq_routing_policy policy(heap);
|
||||
irq_routing_list.update_from_xml(policy, xml);
|
||||
}
|
||||
update_list_model_from_xml(reserved_memory_list, xml,
|
||||
|
||||
{
|
||||
Rmrr_policy policy(heap);
|
||||
reserved_memory_list.update_from_xml(policy, xml);
|
||||
}
|
||||
/* create */
|
||||
[&] (Xml_node const &node) -> Rmrr &
|
||||
{
|
||||
bus_t bus = 0;
|
||||
dev_t dev = 0;
|
||||
func_t fn = 0;
|
||||
addr_t start = node.attribute_value("start", 0UL);
|
||||
addr_t end = node.attribute_value("end", 0UL);
|
||||
|
||||
node.with_optional_sub_node("scope", [&] (Xml_node node) {
|
||||
bus = node.attribute_value<uint8_t>("bus_start", 0U);
|
||||
node.with_optional_sub_node("path", [&] (Xml_node node) {
|
||||
dev = node.attribute_value<uint8_t>("dev", 0);
|
||||
fn = node.attribute_value<uint8_t>("func", 0);
|
||||
});
|
||||
});
|
||||
|
||||
return *new (heap) Rmrr({bus, dev, fn}, start, (end-start+1));
|
||||
},
|
||||
|
||||
/* destroy */
|
||||
[&] (Rmrr &rmrr) { destroy(heap, &rmrr); },
|
||||
|
||||
/* update */
|
||||
[&] (Rmrr &, Xml_node const &) { }
|
||||
);
|
||||
|
||||
pci_reporter.generate([&] (Xml_generator & generator)
|
||||
{
|
||||
|
@ -28,48 +28,17 @@ struct Rmrr : List_model<Rmrr>::Element
|
||||
|
||||
Rmrr(Bdf bdf, addr_t addr, size_t size)
|
||||
: bdf(bdf), addr(addr), size(size) {}
|
||||
};
|
||||
|
||||
|
||||
struct Rmrr_policy : List_model<Rmrr>::Update_policy
|
||||
{
|
||||
Heap & heap;
|
||||
|
||||
void destroy_element(Rmrr & rmrr) {
|
||||
destroy(heap, &rmrr); }
|
||||
|
||||
Rmrr & create_element(Xml_node node)
|
||||
{
|
||||
bus_t bus = 0;
|
||||
dev_t dev = 0;
|
||||
func_t fn = 0;
|
||||
addr_t start = node.attribute_value("start", 0UL);
|
||||
addr_t end = node.attribute_value("end", 0UL);
|
||||
|
||||
node.with_optional_sub_node("scope", [&] (Xml_node node) {
|
||||
bus = node.attribute_value<uint8_t>("bus_start", 0U);
|
||||
node.with_optional_sub_node("path", [&] (Xml_node node) {
|
||||
dev = node.attribute_value<uint8_t>("dev", 0);
|
||||
fn = node.attribute_value<uint8_t>("func", 0);
|
||||
});
|
||||
});
|
||||
|
||||
return *(new (heap) Rmrr({bus, dev, fn}, start, (end-start+1)));
|
||||
}
|
||||
|
||||
void update_element(Rmrr &, Xml_node) {}
|
||||
|
||||
static bool element_matches_xml_node(Rmrr const & rmrr,
|
||||
Genode::Xml_node node)
|
||||
bool matches(Xml_node const &node) const
|
||||
{
|
||||
addr_t start = node.attribute_value("start", 0UL);
|
||||
addr_t end = node.attribute_value("end", 0UL);
|
||||
return rmrr.addr == start &&
|
||||
rmrr.size == (end-start+1);
|
||||
return addr == start &&
|
||||
size == (end-start+1);
|
||||
}
|
||||
|
||||
static bool node_is_element(Genode::Xml_node node) {
|
||||
return node.has_type("rmrr"); }
|
||||
|
||||
Rmrr_policy(Heap & heap) : heap(heap) {}
|
||||
static bool type_matches(Xml_node const &node)
|
||||
{
|
||||
return node.has_type("rmrr");
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user