mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:05:41 +00:00
[FLOPPY] Don't wait forever while trying to determine media type.
This should fix some virtual machines and real hardware machine with empty floopy drive not being able to boot ReactOS (stuck while initializing floppy.sys). This fixes a regression introduced in r70746. It could be generalized to other interrupts, floppy controllers not being reliable. For more information: http://wiki.osdev.org/Floppy_Disk_Controller CORE-7935 CORE-12908 CORE-13080
This commit is contained in:
parent
8f98574e1d
commit
4b34e44782
3 changed files with 24 additions and 15 deletions
|
@ -170,6 +170,7 @@ RWDetermineMediaType(PDRIVE_INFO DriveInfo, BOOLEAN OneShot)
|
|||
UCHAR HeadLoadTime;
|
||||
UCHAR HeadUnloadTime;
|
||||
UCHAR StepRateTime;
|
||||
LARGE_INTEGER Timeout;
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
|
@ -181,9 +182,12 @@ RWDetermineMediaType(PDRIVE_INFO DriveInfo, BOOLEAN OneShot)
|
|||
* Note that only 1.44 has been tested at all.
|
||||
*/
|
||||
|
||||
Timeout.QuadPart = -10000000; /* 1 second. Is that enough? */
|
||||
|
||||
do
|
||||
{
|
||||
int i;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Program data rate */
|
||||
if(HwSetDataRate(DriveInfo->ControllerInfo, DRSR_DSEL_500KBPS) != STATUS_SUCCESS)
|
||||
|
@ -219,7 +223,7 @@ RWDetermineMediaType(PDRIVE_INFO DriveInfo, BOOLEAN OneShot)
|
|||
}
|
||||
|
||||
/* Wait for the recalibrate to finish */
|
||||
WaitForControllerInterrupt(DriveInfo->ControllerInfo);
|
||||
WaitForControllerInterrupt(DriveInfo->ControllerInfo, NULL);
|
||||
|
||||
RecalStatus = HwRecalibrateResult(DriveInfo->ControllerInfo);
|
||||
|
||||
|
@ -244,9 +248,9 @@ RWDetermineMediaType(PDRIVE_INFO DriveInfo, BOOLEAN OneShot)
|
|||
}
|
||||
|
||||
/* Wait for the ReadID to finish */
|
||||
WaitForControllerInterrupt(DriveInfo->ControllerInfo);
|
||||
Status = WaitForControllerInterrupt(DriveInfo->ControllerInfo, &Timeout);
|
||||
|
||||
if(HwReadIdResult(DriveInfo->ControllerInfo, NULL, NULL) != STATUS_SUCCESS)
|
||||
if(Status == STATUS_TIMEOUT || HwReadIdResult(DriveInfo->ControllerInfo, NULL, NULL) != STATUS_SUCCESS)
|
||||
{
|
||||
WARN_(FLOPPY, "RWDetermineMediaType(): ReadIdResult failed; continuing\n");
|
||||
if (OneShot)
|
||||
|
@ -303,7 +307,7 @@ RWSeekToCylinder(PDRIVE_INFO DriveInfo, UCHAR Cylinder)
|
|||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
WaitForControllerInterrupt(DriveInfo->ControllerInfo);
|
||||
WaitForControllerInterrupt(DriveInfo->ControllerInfo, NULL);
|
||||
|
||||
if(HwSenseInterruptStatus(DriveInfo->ControllerInfo) != STATUS_SUCCESS)
|
||||
{
|
||||
|
@ -318,7 +322,7 @@ RWSeekToCylinder(PDRIVE_INFO DriveInfo, UCHAR Cylinder)
|
|||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
WaitForControllerInterrupt(DriveInfo->ControllerInfo);
|
||||
WaitForControllerInterrupt(DriveInfo->ControllerInfo, NULL);
|
||||
|
||||
if(HwReadIdResult(DriveInfo->ControllerInfo, &CurCylinder, NULL) != STATUS_SUCCESS)
|
||||
{
|
||||
|
@ -732,7 +736,7 @@ ReadWritePassive(PDRIVE_INFO DriveInfo, PIRP Irp)
|
|||
* At this point, we block and wait for an interrupt
|
||||
* FIXME: this seems to take too long
|
||||
*/
|
||||
WaitForControllerInterrupt(DriveInfo->ControllerInfo);
|
||||
WaitForControllerInterrupt(DriveInfo->ControllerInfo, NULL);
|
||||
|
||||
/* Read is complete; flush & free adapter channel */
|
||||
IoFlushAdapterBuffers(DriveInfo->ControllerInfo->AdapterObject, Irp->MdlAddress,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue