mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-21 02:01:38 +00:00
parent
6bfd4f4276
commit
ff800af820
@ -95,6 +95,19 @@ struct Ahci
|
||||
platform_hba.ack_irq();
|
||||
}
|
||||
|
||||
/*
|
||||
* Least significant bit
|
||||
*/
|
||||
unsigned lsb(unsigned bits) const
|
||||
{
|
||||
for (unsigned i = 0; i < 32; i++)
|
||||
if (bits & (1u << i)) {
|
||||
return i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void info()
|
||||
{
|
||||
using Genode::log;
|
||||
@ -116,38 +129,39 @@ struct Ahci
|
||||
for (unsigned i = 0; i < hba.port_count(); i++) {
|
||||
|
||||
/* check if port is implemented */
|
||||
if (!(available & (1U << i)))
|
||||
continue;
|
||||
if (!available) break;
|
||||
unsigned index = lsb(available);
|
||||
available ^= (1u << index);
|
||||
|
||||
bool enabled = false;
|
||||
|
||||
switch (Port_base(i, hba).read<Port_base::Sig>()) {
|
||||
switch (Port_base(index, hba).read<Port_base::Sig>()) {
|
||||
case ATA_SIG:
|
||||
try {
|
||||
ports[i] = new (&alloc)
|
||||
ports[index] = new (&alloc)
|
||||
Ata_driver(alloc, ram, root, ready_count, rm, hba,
|
||||
platform_hba, i, device_identified);
|
||||
platform_hba, index, device_identified);
|
||||
enabled = true;
|
||||
} catch (...) { }
|
||||
|
||||
log("\t\t#", i, ":", enabled ? " ATA" : " off (ATA)");
|
||||
log("\t\t#", index, ":", enabled ? " ATA" : " off (ATA)");
|
||||
break;
|
||||
|
||||
case ATAPI_SIG:
|
||||
case ATAPI_SIG_QEMU:
|
||||
if (enable_atapi)
|
||||
try {
|
||||
ports[i] = new (&alloc)
|
||||
ports[index] = new (&alloc)
|
||||
Atapi_driver(ram, root, ready_count, rm, hba,
|
||||
platform_hba, i);
|
||||
platform_hba, index);
|
||||
enabled = true;
|
||||
} catch (...) { }
|
||||
|
||||
log("\t\t#", i, ":", enabled ? " ATAPI" : " off (ATAPI)");
|
||||
log("\t\t#", index, ":", enabled ? " ATAPI" : " off (ATAPI)");
|
||||
break;
|
||||
|
||||
default:
|
||||
log("\t\t#", i, ": off (unknown device signature)");
|
||||
log("\t\t#", index, ": off (unknown device signature)");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user