mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
ahci: add port count vs. ports implemented check
Check if controllers port count matches number of ports found in the port implemented register. In case counts don't match print a diagnostic message for debugging purposes. issue #4081
This commit is contained in:
parent
4a1a162c09
commit
f86cd6899c
@ -166,6 +166,10 @@ struct Ahci::Hba : private Platform::Device::Mmio<0x28>
|
|||||||
return read<Hba::Pi>() & (1u << port);
|
return read<Hba::Pi>() & (1u << port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* for diagnostics */
|
||||||
|
unsigned pi_value() const { return read<Hba::Pi>(); }
|
||||||
|
unsigned cap_np_value() const { return read<Cap::Np>(); }
|
||||||
|
|
||||||
template <typename FN>
|
template <typename FN>
|
||||||
void handle_irq(FN const & fn)
|
void handle_irq(FN const & fn)
|
||||||
{
|
{
|
||||||
|
@ -72,9 +72,11 @@ class Ahci::Driver : Noncopyable
|
|||||||
|
|
||||||
bool _enable_atapi;
|
bool _enable_atapi;
|
||||||
|
|
||||||
void _scan_ports(Region_map &rm)
|
unsigned _scan_ports(Region_map &rm)
|
||||||
{
|
{
|
||||||
log("number of ports: ", _hba.port_count());
|
log("port scan:");
|
||||||
|
|
||||||
|
unsigned port_count = 0;
|
||||||
|
|
||||||
for (unsigned index = 0; index < MAX_PORTS; index++) {
|
for (unsigned index = 0; index < MAX_PORTS; index++) {
|
||||||
|
|
||||||
@ -106,7 +108,11 @@ class Ahci::Driver : Noncopyable
|
|||||||
log("\t\t#", index, ":", port.atapi() ? " off (ATAPI)"
|
log("\t\t#", index, ":", port.atapi() ? " off (ATAPI)"
|
||||||
: " off (unknown device signature)");
|
: " off (unknown device signature)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
port_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return port_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -115,7 +121,11 @@ class Ahci::Driver : Noncopyable
|
|||||||
: _env(env), _dispatch(dispatch), _enable_atapi(support_atapi)
|
: _env(env), _dispatch(dispatch), _enable_atapi(support_atapi)
|
||||||
{
|
{
|
||||||
/* search for devices */
|
/* search for devices */
|
||||||
_scan_ports(env.rm());
|
unsigned port_count = _scan_ports(env.rm());
|
||||||
|
|
||||||
|
if (port_count != _hba.port_count())
|
||||||
|
log("controller port count differs from detected ports (CAP.NP=",
|
||||||
|
Hex(_hba.cap_np_value()), ",PI=", Hex(_hba.pi_value()), ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user