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