ahci: disable atapi support by default

If needed it has to be enabled explicitly as documented in the README.

Related to issue #1906
This commit is contained in:
Alexander Boettcher 2016-05-24 09:54:03 +02:00 committed by Christian Helmuth
parent 16adc852a5
commit 46a7b2ea66
4 changed files with 13 additions and 9 deletions

View File

@ -17,7 +17,7 @@ which client can access a certain device:
! <route>
! <any-service> <parent /> <any-child /> </any-service>
! </route>
! <config>
! <config atapi="no">
! <!-- use model and serial number -->
! <policy label="test-ahci" model="QEMU HARDDISK" serial="QM00005" />
! <!-- use controller port number -->
@ -27,4 +27,5 @@ which client can access a certain device:
In the example above, a session request labeled with "test-ahci" gains access to
a device with certain model and serial numbers, while "bench" gains access to
device at port 1.
device at port 1. ATAPI support is by default disabled and can be enabled by
setting the config attribute "atapi" to "yes".

View File

@ -49,10 +49,12 @@ struct Ahci
Signal_rpc_member<Ahci> irq;
Signal_rpc_member<Ahci> device_ready;
unsigned ready_count = 0;
bool enable_atapi;
Ahci(Ahci_root &root)
Ahci(Ahci_root &root, bool support_atapi)
: root(root), irq(root.entrypoint(), *this, &Ahci::handle_irq),
device_ready(root.entrypoint(), *this, &Ahci::ready)
device_ready(root.entrypoint(), *this, &Ahci::ready),
enable_atapi(support_atapi)
{
info();
@ -68,7 +70,7 @@ struct Ahci
bool atapi(unsigned sig)
{
return sig == ATAPI_SIG_QEMU || sig == ATAPI_SIG;
return enable_atapi && (sig == ATAPI_SIG_QEMU || sig == ATAPI_SIG);
}
bool ata(unsigned sig)
@ -208,9 +210,9 @@ static Ahci *sata_ahci(Ahci *ahci = 0)
}
void Ahci_driver::init(Ahci_root &root)
void Ahci_driver::init(Ahci_root &root, bool support_atapi)
{
static Ahci ahci(root);
static Ahci ahci(root, support_atapi);
sata_ahci(&ahci);
}

View File

@ -36,7 +36,7 @@ struct Ahci_root
namespace Ahci_driver {
void init(Ahci_root &ep);
void init(Ahci_root &ep, bool support_atapi);
bool avail(long device_num);
long device_number(char const *model_num, char const *serial_num);

View File

@ -155,7 +155,8 @@ struct Main
: root(ep, Genode::env()->heap())
{
PINF("--- Starting AHCI driver -> done right .-) --\n");
Ahci_driver::init(root);
bool support_atapi = Genode::config()->xml_node().attribute_value("atapi", false);
Ahci_driver::init(root, support_atapi);
}
};