From 87a233ab3fb2cf7652efba7c8760348f4fd04008 Mon Sep 17 00:00:00 2001 From: "Sijmen J. Mulder" Date: Thu, 11 Oct 2018 23:00:03 +0200 Subject: [PATCH] Check for floating bus Fixes #1056: Does not boot if there is no IDE Secondary Master (VirtualBox) --- source/Cosmos.HAL2/BlockDevice/AtaPio.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/Cosmos.HAL2/BlockDevice/AtaPio.cs b/source/Cosmos.HAL2/BlockDevice/AtaPio.cs index 36bfda339b..028b4c42ce 100644 --- a/source/Cosmos.HAL2/BlockDevice/AtaPio.cs +++ b/source/Cosmos.HAL2/BlockDevice/AtaPio.cs @@ -163,6 +163,14 @@ public AtaPio(Core.IOGroup.ATA aIO, Ata.ControllerIdEnum aControllerId, Ata.BusP public SpecLevel DiscoverDrive() { SelectDrive(0); + + // Read status before sending command. If 0xFF, it's a floating + // bus (nothing connected) + if (IO.Status.Byte == 0xFF) + { + return SpecLevel.Null; + } + var xIdentifyStatus = SendCmd(Cmd.Identify, false); // No drive found, go to next if (xIdentifyStatus == Status.None)