mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 08:27:36 +00:00
Kernel: Wait for the ATA busy bit to clear after switching channels
This is a speculative fix for a flaky boot crash that shows up every now and then on CI. Fixes #10177. Hopefully.
This commit is contained in:
parent
8177e7eb22
commit
05ed8d1738
1 changed files with 5 additions and 4 deletions
|
@ -304,10 +304,11 @@ UNMAP_AFTER_INIT void IDEChannel::detect_disks()
|
||||||
|
|
||||||
// There are only two possible disks connected to a channel
|
// There are only two possible disks connected to a channel
|
||||||
for (auto i = 0; i < 2; i++) {
|
for (auto i = 0; i < 2; i++) {
|
||||||
// We need to select the drive and then we wait 20 microseconds... and it doesn't hurt anything so let's just do it.
|
|
||||||
IO::delay(20);
|
if (!select_device_and_wait_until_not_busy(i == 0 ? DeviceType::Master : DeviceType::Slave, 32000)) {
|
||||||
m_io_group.io_base().offset(ATA_REG_HDDEVSEL).out<u8>(0xA0 | (i << 4)); // First, we need to select the drive itself
|
dbgln("IDEChannel: Timeout waiting for busy flag to clear during {} {} detection", channel_type_string(), channel_string(i));
|
||||||
IO::delay(20);
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
auto status = m_io_group.control_base().in<u8>();
|
auto status = m_io_group.control_base().in<u8>();
|
||||||
if (status == 0x0) {
|
if (status == 0x0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue