mirror of
https://github.com/reactos/reactos.git
synced 2025-01-04 05:20:54 +00:00
[FLOPPY]
When discovering floppy controlers, immediately probe controlers to check whether they have a disk and if so, what's its geometry. This avoids waiting for the first read, which will obviously never happen because FSD will try other operations depending on not set geometry. This implies a modification in RWDetermineMediaType() to avoid infinite wait, in case there's no disk at all in the controler. Addendum to r70725 svn path=/trunk/; revision=70746
This commit is contained in:
parent
9a468d30e5
commit
78eb31503a
3 changed files with 17 additions and 6 deletions
|
@ -987,6 +987,11 @@ AddControllers(PDRIVER_OBJECT DriverObject)
|
|||
|
||||
/* 3k: Clear the DO_DEVICE_INITIALIZING flag */
|
||||
gControllerInfo[i].DriveInfo[j].DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
|
||||
/* 3l: Attempt to get drive info - if a floppy is already present */
|
||||
StartMotor(&gControllerInfo[i].DriveInfo[j]);
|
||||
RWDetermineMediaType(&gControllerInfo[i].DriveInfo[j], TRUE);
|
||||
StopMotor(gControllerInfo[i].DriveInfo[j].ControllerInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -149,8 +149,8 @@ RWFreeAdapterChannel(PADAPTER_OBJECT AdapterObject)
|
|||
}
|
||||
|
||||
|
||||
static NTSTATUS NTAPI
|
||||
RWDetermineMediaType(PDRIVE_INFO DriveInfo)
|
||||
NTSTATUS NTAPI
|
||||
RWDetermineMediaType(PDRIVE_INFO DriveInfo, BOOLEAN OneShot)
|
||||
/*
|
||||
* FUNCTION: Determine the media type of the disk in the drive and fill in the geometry
|
||||
* ARGUMENTS:
|
||||
|
@ -177,8 +177,8 @@ RWDetermineMediaType(PDRIVE_INFO DriveInfo)
|
|||
|
||||
/*
|
||||
* This algorithm assumes that a 1.44MB floppy is in the drive. If it's not,
|
||||
* it works backwards until the read works. Note that only 1.44 has been tested
|
||||
* at all.
|
||||
* it works backwards until the read works unless OneShot try is asked.
|
||||
* Note that only 1.44 has been tested at all.
|
||||
*/
|
||||
|
||||
do
|
||||
|
@ -249,7 +249,10 @@ RWDetermineMediaType(PDRIVE_INFO DriveInfo)
|
|||
if(HwReadIdResult(DriveInfo->ControllerInfo, NULL, NULL) != STATUS_SUCCESS)
|
||||
{
|
||||
WARN_(FLOPPY, "RWDetermineMediaType(): ReadIdResult failed; continuing\n");
|
||||
continue;
|
||||
if (OneShot)
|
||||
break;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Found the media; populate the geometry now */
|
||||
|
@ -492,7 +495,7 @@ ReadWritePassive(PDRIVE_INFO DriveInfo, PIRP Irp)
|
|||
*/
|
||||
if(DriveInfo->DiskGeometry.MediaType == Unknown)
|
||||
{
|
||||
if(RWDetermineMediaType(DriveInfo) != STATUS_SUCCESS)
|
||||
if(RWDetermineMediaType(DriveInfo, FALSE) != STATUS_SUCCESS)
|
||||
{
|
||||
WARN_(FLOPPY, "ReadWritePassive(): unable to determine media type; completing with STATUS_UNSUCCESSFUL\n");
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
|
|
@ -33,3 +33,6 @@ ReadWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp);
|
|||
|
||||
VOID NTAPI
|
||||
ReadWritePassive(PDRIVE_INFO DriveInfo, PIRP Irp);
|
||||
|
||||
NTSTATUS NTAPI
|
||||
RWDetermineMediaType(PDRIVE_INFO DriveInfo, BOOLEAN OneShot);
|
||||
|
|
Loading…
Reference in a new issue