drivers/ahci: clean exit when no controllers are found

Fix #2402
This commit is contained in:
Emery Hemingway 2017-05-03 08:01:42 -05:00 committed by Christian Helmuth
parent aac0ac7c63
commit f7d80a9bf9
3 changed files with 13 additions and 3 deletions

View File

@ -43,6 +43,8 @@ namespace Ahci_driver {
Block::Driver *claim_port(long device_num);
void free_port(long device_num);
struct Missing_controller { };
}

View File

@ -182,7 +182,16 @@ struct Block::Main
{
Genode::log("--- Starting AHCI driver ---");
bool support_atapi = config.xml().attribute_value("atapi", false);
Ahci_driver::init(env, heap, root, support_atapi);
try { Ahci_driver::init(env, heap, root, support_atapi); }
catch (Ahci_driver::Missing_controller) {
Genode::error("no AHCI controller found");
env.parent().exit(~0);
}
catch (Genode::Parent::Service_denied) {
Genode::error("hardware access denied");
env.parent().exit(~0);
}
}
};

View File

@ -49,8 +49,7 @@ struct X86_hba : Platform::Hba
[&] () { pci.upgrade_ram(4096); });
if (!pci_device_cap.valid()) {
Genode::error("no AHCI controller found");
throw -1;
throw Ahci_driver::Missing_controller();
}
/* construct pci client */