mirror of
https://github.com/reactos/reactos.git
synced 2024-07-06 20:55:16 +00:00
[FLOPPY]
- Improve the floppy controller initialization code to fix several cases where the controller could deadlock or otherwise malfunction on us svn path=/trunk/; revision=54266
This commit is contained in:
parent
fabd252d70
commit
9267b63627
|
@ -674,38 +674,10 @@ InitController(PCONTROLLER_INFO ControllerInfo)
|
||||||
|
|
||||||
KeClearEvent(&ControllerInfo->SynchEvent);
|
KeClearEvent(&ControllerInfo->SynchEvent);
|
||||||
|
|
||||||
INFO_(FLOPPY, "InitController: resetting the controller\n");
|
|
||||||
|
|
||||||
/* Reset the controller */
|
|
||||||
if(HwReset(ControllerInfo) != STATUS_SUCCESS)
|
|
||||||
{
|
|
||||||
WARN_(FLOPPY, "InitController: unable to reset controller\n");
|
|
||||||
return STATUS_IO_DEVICE_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* All controllers should support this so
|
|
||||||
* if we get something strange back then we
|
|
||||||
* know that this isn't a floppy controller
|
|
||||||
*/
|
|
||||||
if (HwGetVersion(ControllerInfo) <= 0)
|
|
||||||
{
|
|
||||||
WARN_(FLOPPY, "InitController: unable to contact controller\n");
|
|
||||||
return STATUS_NO_SUCH_DEVICE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Reset the controller to avoid interrupt garbage on certain controllers */
|
/* Reset the controller to avoid interrupt garbage on certain controllers */
|
||||||
if(HwReset(ControllerInfo) != STATUS_SUCCESS)
|
if(HwReset(ControllerInfo) != STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
WARN_(FLOPPY, "InitController: unable to reset controller #2\n");
|
WARN_(FLOPPY, "InitController: unable to reset controller\n");
|
||||||
return STATUS_IO_DEVICE_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
INFO_(FLOPPY, "InitController: setting data rate\n");
|
|
||||||
|
|
||||||
/* Set data rate */
|
|
||||||
if(HwSetDataRate(ControllerInfo, DRSR_DSEL_500KBPS) != STATUS_SUCCESS)
|
|
||||||
{
|
|
||||||
WARN_(FLOPPY, "InitController: unable to set data rate\n");
|
|
||||||
return STATUS_IO_DEVICE_ERROR;
|
return STATUS_IO_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -777,6 +749,15 @@ InitController(PCONTROLLER_INFO ControllerInfo)
|
||||||
HeadUnloadTime = SPECIFY_HUT_500K;
|
HeadUnloadTime = SPECIFY_HUT_500K;
|
||||||
StepRateTime = SPECIFY_SRT_500K;
|
StepRateTime = SPECIFY_SRT_500K;
|
||||||
|
|
||||||
|
INFO_(FLOPPY, "InitController: setting data rate\n");
|
||||||
|
|
||||||
|
/* Set data rate */
|
||||||
|
if(HwSetDataRate(ControllerInfo, DRSR_DSEL_500KBPS) != STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
WARN_(FLOPPY, "InitController: unable to set data rate\n");
|
||||||
|
return STATUS_IO_DEVICE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
INFO_(FLOPPY, "InitController: issuing specify command to controller\n");
|
INFO_(FLOPPY, "InitController: issuing specify command to controller\n");
|
||||||
|
|
||||||
/* Don't disable DMA --> enable dma (dumb & confusing) */
|
/* Don't disable DMA --> enable dma (dumb & confusing) */
|
||||||
|
@ -850,7 +831,7 @@ AddControllers(PDRIVER_OBJECT DriverObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now that we have a controller, set it up with the system */
|
/* Now that we have a controller, set it up with the system */
|
||||||
for(i = 0; i < gNumberOfControllers; i++)
|
for(i = 0; i < gNumberOfControllers && gControllerInfo[i].NumberOfDrives > 0; i++)
|
||||||
{
|
{
|
||||||
/* 0: Report resource usage to the kernel, to make sure they aren't assigned to anyone else */
|
/* 0: Report resource usage to the kernel, to make sure they aren't assigned to anyone else */
|
||||||
/* FIXME: Implement me. */
|
/* FIXME: Implement me. */
|
||||||
|
@ -994,7 +975,7 @@ AddControllers(PDRIVER_OBJECT DriverObject)
|
||||||
|
|
||||||
INFO_(FLOPPY, "AddControllers: --------------------------------------------> finished adding controllers\n");
|
INFO_(FLOPPY, "AddControllers: --------------------------------------------> finished adding controllers\n");
|
||||||
|
|
||||||
return TRUE;
|
return (IoGetConfigurationInformation()->FloppyCount != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue