mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-05 01:55:21 +03:00
Kernel: Change the timings when initiating AHCI port reset
The intention is to make the boot to be faster, therefore we should decrease the time deltas in timeout loops to allow earlier break from these. Also, there's no need to wait 10 milliseconds before setting the interface state to "no action request" during the reset sequence.
This commit is contained in:
parent
800dca3834
commit
2929dc6bd7
Notes:
sideshowbarker
2024-07-18 21:27:10 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/2929dc6bd7d Pull-request: https://github.com/SerenityOS/serenity/pull/5734
@ -606,39 +606,39 @@ bool AHCIPort::initiate_sata_reset()
|
||||
full_memory_barrier();
|
||||
size_t retry = 0;
|
||||
// Try to wait 1 second for HBA to clear Command List Running
|
||||
while (retry < 500) {
|
||||
while (retry < 5000) {
|
||||
if (!(m_port_registers.cmd & (1 << 15)))
|
||||
break;
|
||||
// The AHCI specification says to wait now a 500 milliseconds
|
||||
IO::delay(1000);
|
||||
IO::delay(100);
|
||||
retry++;
|
||||
}
|
||||
full_memory_barrier();
|
||||
spin_up();
|
||||
full_memory_barrier();
|
||||
set_interface_state(AHCI::DeviceDetectionInitialization::PerformInterfaceInitializationSequence);
|
||||
// The AHCI specification says to wait now a 1 millisecond, we wait 2 ms
|
||||
IO::delay(10000);
|
||||
// The AHCI specification says to wait now a 1 millisecond
|
||||
IO::delay(1000);
|
||||
full_memory_barrier();
|
||||
set_interface_state(AHCI::DeviceDetectionInitialization::NoActionRequested);
|
||||
full_memory_barrier();
|
||||
|
||||
retry = 0;
|
||||
while (retry < 5) {
|
||||
while (retry < 5000) {
|
||||
if (!((m_port_registers.ssts & 0xf) == 0))
|
||||
break;
|
||||
|
||||
IO::delay(10000);
|
||||
IO::delay(10);
|
||||
retry++;
|
||||
}
|
||||
|
||||
// If device presence detected and Phy communication established, wait for signature to update
|
||||
if ((m_port_registers.ssts & 0xf) == 3) {
|
||||
retry = 0;
|
||||
while (retry < 30) {
|
||||
while (retry < 30000) {
|
||||
if (!(m_port_registers.tfd & (ATA_SR_BSY | ATA_SR_DRQ)) && m_port_registers.sig != 0xffffffff)
|
||||
break;
|
||||
IO::delay(10000);
|
||||
IO::delay(10);
|
||||
retry++;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user