Author: cgutman
Date: Sat Oct 29 14:19:30 2011
New Revision: 54267
URL: http://svn.reactos.org/svn/reactos?rev=54267&view=rev
Log:
[FLOPPY]
- Prevent a deadlock on very old controllers by sending the configure and version commands before resetting the controller
Modified:
trunk/reactos/drivers/storage/floppy/floppy.c
Modified: trunk/reactos/drivers/storage/floppy/floppy.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/floppy/flo…
==============================================================================
--- trunk/reactos/drivers/storage/floppy/floppy.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/storage/floppy/floppy.c [iso-8859-1] Sat Oct 29 14:19:30 2011
@@ -666,15 +666,22 @@
UCHAR HeadLoadTime;
UCHAR HeadUnloadTime;
UCHAR StepRateTime;
+ UCHAR ControllerVersion;
PAGED_CODE();
ASSERT(ControllerInfo);
TRACE_(FLOPPY, "InitController called with Controller 0x%p\n", ControllerInfo);
+ /* Get controller in a known state */
+ HwConfigure(ControllerInfo, FALSE, TRUE, TRUE, 0, 0);
+
+ /* Get the controller version */
+ ControllerVersion = HwGetVersion(ControllerInfo);
+
KeClearEvent(&ControllerInfo->SynchEvent);
- /* Reset the controller to avoid interrupt garbage on certain controllers */
+ /* Reset the controller */
if(HwReset(ControllerInfo) != STATUS_SUCCESS)
{
WARN_(FLOPPY, "InitController: unable to reset controller\n");
@@ -701,10 +708,10 @@
INFO_(FLOPPY, "InitController: done sensing interrupts\n");
/* Next, see if we have the right version to do implied seek */
- if(HwGetVersion(ControllerInfo) == VERSION_ENHANCED)
+ if(ControllerVersion == VERSION_ENHANCED)
{
/* If so, set that up -- all defaults below except first TRUE for EIS */
- if(HwConfigure(ControllerInfo, TRUE, TRUE, FALSE, 0, 0) != STATUS_SUCCESS)
+ if(HwConfigure(ControllerInfo, TRUE, TRUE, TRUE, 0, 0) != STATUS_SUCCESS)
{
WARN_(FLOPPY, "InitController: unable to set up implied seek\n");
ControllerInfo->ImpliedSeeks = FALSE;
Author: cgutman
Date: Sat Oct 29 13:22:18 2011
New Revision: 54266
URL: http://svn.reactos.org/svn/reactos?rev=54266&view=rev
Log:
[FLOPPY]
- Improve the floppy controller initialization code to fix several cases where the controller could deadlock or otherwise malfunction on us
Modified:
trunk/reactos/drivers/storage/floppy/floppy.c
Modified: trunk/reactos/drivers/storage/floppy/floppy.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/floppy/flo…
==============================================================================
--- trunk/reactos/drivers/storage/floppy/floppy.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/storage/floppy/floppy.c [iso-8859-1] Sat Oct 29 13:22:18 2011
@@ -674,38 +674,10 @@
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 */
if(HwReset(ControllerInfo) != STATUS_SUCCESS)
{
- WARN_(FLOPPY, "InitController: unable to reset controller #2\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");
+ WARN_(FLOPPY, "InitController: unable to reset controller\n");
return STATUS_IO_DEVICE_ERROR;
}
@@ -776,6 +748,15 @@
HeadLoadTime = SPECIFY_HLT_500K;
HeadUnloadTime = SPECIFY_HUT_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");
@@ -850,7 +831,7 @@
}
/* 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 */
/* FIXME: Implement me. */
@@ -994,7 +975,7 @@
INFO_(FLOPPY, "AddControllers: --------------------------------------------> finished adding controllers\n");
- return TRUE;
+ return (IoGetConfigurationInformation()->FloppyCount != 0);
}
Author: cgutman
Date: Sat Oct 29 12:18:25 2011
New Revision: 54265
URL: http://svn.reactos.org/svn/reactos?rev=54265&view=rev
Log:
[NTOSKRNL]
- Fix handling of HAL returning a different address space than we thought
Modified:
trunk/reactos/ntoskrnl/io/pnpmgr/pnpres.c
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpres.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpres.…
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnpres.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpres.c [iso-8859-1] Sat Oct 29 12:18:25 2011
@@ -783,9 +783,12 @@
if (AddressSpace == 0)
{
- /* This is actually a memory resource */
- DescriptorRaw->Type = CmResourceTypeMemory;
- DescriptorTranslated->Type = CmResourceTypeMemory;
+ DPRINT1("Guessed incorrect address space: 1 -> 0\n");
+
+ /* FIXME: I think all other CM_RESOURCE_PORT_XXX flags are
+ * invalid for this state but I'm not 100% sure */
+ DescriptorRaw->Flags =
+ DescriptorTranslated->Flags = CM_RESOURCE_PORT_MEMORY;
}
break;
}
@@ -825,9 +828,10 @@
if (AddressSpace != 0)
{
- /* This is actually an I/O port resource */
- DescriptorRaw->Type = CmResourceTypePort;
- DescriptorTranslated->Type = CmResourceTypePort;
+ DPRINT1("Guessed incorrect address space: 0 -> 1\n");
+
+ /* This should never happen for memory space */
+ ASSERT(FALSE);
}
}