mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Fix boot problems and make it work under VMware
svn path=/trunk/; revision=4228
This commit is contained in:
parent
ad0f593f37
commit
8690cad211
3 changed files with 23 additions and 10 deletions
|
@ -31,7 +31,6 @@ const FLOPPY_MEDIA_TYPE MediaTypes[] = {
|
|||
{ 0x02, 80, 2, 18, 512 },
|
||||
{ 0, 0, 0, 0, 0 } };
|
||||
|
||||
|
||||
static BOOLEAN
|
||||
FloppyCreateController(PDRIVER_OBJECT DriverObject,
|
||||
PFLOPPY_CONTROLLER_PARAMETERS ControllerParameters,
|
||||
|
@ -179,7 +178,6 @@ FloppyCreateController(PDRIVER_OBJECT DriverObject,
|
|||
}
|
||||
// set for high speed mode
|
||||
// FloppyWriteCCNTL( ControllerExtension->PortBase, FLOPPY_CCNTL_1MBIT );
|
||||
|
||||
// ok, so we have an FDC, now check for drives
|
||||
// aparently the sense drive status command does not work on any FDC I can find
|
||||
// so instead we will just have to assume a 1.44 meg 3.5 inch floppy. At some
|
||||
|
@ -209,7 +207,7 @@ FloppyCreateController(PDRIVER_OBJECT DriverObject,
|
|||
if( ControllerExtension->St0 != FLOPPY_ST0_SEEKGD )
|
||||
{
|
||||
DbgPrint( "Floppy: error recalibrating drive, ST0: %2x\n", (DWORD)ControllerExtension->St0 );
|
||||
goto interruptcleanup;
|
||||
goto devicecleanup;
|
||||
}
|
||||
DeviceExtension->Cyl = 0;
|
||||
// drive is good, and it is now on track 0, turn off the motor
|
||||
|
@ -231,7 +229,7 @@ FloppyCreateController(PDRIVER_OBJECT DriverObject,
|
|||
if( !NT_SUCCESS( Status ) )
|
||||
{
|
||||
DPRINT1( "Error: IoAllocateAdapterChannel returned %x\n", Status );
|
||||
goto interruptcleanup;
|
||||
goto devicecleanup;
|
||||
}
|
||||
CHECKPOINT;
|
||||
Status = KeWaitForSingleObject( &ControllerExtension->Event,
|
||||
|
@ -243,7 +241,7 @@ FloppyCreateController(PDRIVER_OBJECT DriverObject,
|
|||
if( Status != STATUS_WAIT_0 )
|
||||
{
|
||||
DPRINT1( "Error: KeWaitForSingleObject returned: %x\n", Status );
|
||||
goto interruptcleanup;
|
||||
goto devicecleanup;
|
||||
}
|
||||
// Ok, we own the adapter object, from now on we can just IoMapTransfer, and not
|
||||
// bother releasing the adapter ever.
|
||||
|
@ -259,7 +257,6 @@ FloppyCreateController(PDRIVER_OBJECT DriverObject,
|
|||
// turn off controller
|
||||
FloppyWriteDOR( ControllerExtension->PortBase, 0 );
|
||||
IoDeleteController(ControllerObject);
|
||||
for(;;);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -324,16 +321,18 @@ FloppyExecuteReadWrite(PDEVICE_OBJECT DeviceObject,
|
|||
Timeout,
|
||||
&ControllerExtension->MotorSpindownDpc );
|
||||
}
|
||||
// verify media content
|
||||
#if 0
|
||||
/* Handle disk change, doesn't work correctly */
|
||||
if( FloppyReadDIR( ControllerExtension->PortBase ) & FLOPPY_DI_DSKCHNG )
|
||||
{
|
||||
// No disk is in the drive
|
||||
DPRINT( "No disk is in the drive\n" );
|
||||
Irp->IoStatus.Status = STATUS_NO_MEDIA;
|
||||
Irp->IoStatus.Status = STATUS_MEDIA_CHANGED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest( Irp, 0 );
|
||||
return DeallocateObject;
|
||||
}
|
||||
#endif
|
||||
if( DeviceExtension->MediaType == ~0 )
|
||||
{
|
||||
// media is in disk, but we have not yet detected what kind it is,
|
||||
|
@ -562,4 +561,3 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
|||
}
|
||||
|
||||
/* EOF */
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#define FLOPPY_MS_FDCBUSY 0x10
|
||||
#define FLOPPY_MS_DMAMODE 0x20
|
||||
#define FLOPPY_MS_DATADIR 0x40
|
||||
#define FLOPPY_MS_RDYMASK 0xF0
|
||||
#define FLOPPY_MS_RDYMASK 0xC0
|
||||
#define FLOPPY_MS_DATARDYW 0x80
|
||||
#define FLOPPY_MS_DATARDYR 0xC0
|
||||
#define FLOPPY_REG_DATA 0x0005
|
||||
|
|
|
@ -23,6 +23,14 @@ BOOLEAN FloppyIsrDetect( PCONTROLLER_OBJECT Controller )
|
|||
ControllerExtension->St0 = FloppyReadDATA( ControllerExtension->PortBase );
|
||||
KeStallExecutionProcessor( 100 );
|
||||
DeviceExtension->Cyl = FloppyReadDATA( ControllerExtension->PortBase );
|
||||
KeStallExecutionProcessor( 100 );
|
||||
if (FLOPPY_MS_DATARDYR ==
|
||||
(FloppyReadMSTAT( ControllerExtension->PortBase ) & FLOPPY_MS_RDYMASK))
|
||||
{
|
||||
/* There's something still to be read (what is it???? only happens on some
|
||||
controllers). Ignore it. */
|
||||
(void) FloppyReadDATA( ControllerExtension->PortBase );
|
||||
}
|
||||
// now queue DPC to set the event
|
||||
IoRequestDpc( ControllerExtension->Device,
|
||||
0,
|
||||
|
@ -78,6 +86,13 @@ BOOLEAN FloppyIsrRecal( PCONTROLLER_OBJECT Controller )
|
|||
ControllerExtension->St0 = FloppyReadDATA( ControllerExtension->PortBase );
|
||||
KeStallExecutionProcessor( 1000 );
|
||||
FloppyReadDATA( ControllerExtension->PortBase ); // ignore cyl number
|
||||
if (FLOPPY_MS_DATARDYR ==
|
||||
(FloppyReadMSTAT( ControllerExtension->PortBase ) & FLOPPY_MS_RDYMASK))
|
||||
{
|
||||
/* There's something still to be read (what is it???? only happens on some
|
||||
controllers). Ignore it. */
|
||||
(void) FloppyReadDATA( ControllerExtension->PortBase );
|
||||
}
|
||||
DPRINT( "Recal St0: %2x\n", ControllerExtension->St0 );
|
||||
|
||||
// If recalibrate worked, issue read ID for each media type untill one works
|
||||
|
|
Loading…
Reference in a new issue