mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
Issue SPECIFY command upon initialization.
svn path=/trunk/; revision=6529
This commit is contained in:
parent
f1259f48fe
commit
3911ce2391
3 changed files with 61 additions and 42 deletions
|
@ -185,6 +185,16 @@ FloppyCreateController(PDRIVER_OBJECT DriverObject,
|
|||
// point we should get the bios disk parameters passed in to the kernel at boot
|
||||
// and stored in the HARDWARE registry key for us to pick up here.
|
||||
|
||||
// Issue SPECIFY command
|
||||
FloppyWriteDATA (ControllerExtension->PortBase, FLOPPY_CMD_SPEC_CHARS);
|
||||
KeStallExecutionProcessor (100);
|
||||
FloppyWriteDATA (ControllerExtension->PortBase, 0xD1);
|
||||
KeStallExecutionProcessor (100);
|
||||
FloppyWriteDATA (ControllerExtension->PortBase, 0x02);
|
||||
KeStallExecutionProcessor (10000);
|
||||
FloppyWriteMSTAT (ControllerExtension->PortBase, 0x00);
|
||||
|
||||
|
||||
// turn on motor, wait for spinup time, and recalibrate the drive
|
||||
FloppyWriteDOR( ControllerExtension->PortBase, FLOPPY_DRIVE0_ON );
|
||||
Timeout.QuadPart = FLOPPY_MOTOR_SPINUP_TIME;
|
||||
|
@ -292,15 +302,16 @@ FloppyExecuteReadWrite(PDEVICE_OBJECT DeviceObject,
|
|||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)DeviceExtension->Controller->ControllerExtension;
|
||||
LARGE_INTEGER Timeout;
|
||||
BOOLEAN WriteToDevice;
|
||||
DWORD Cyl, Sector, Head;
|
||||
ULONG Cyl, Sector, Head;
|
||||
PIO_STACK_LOCATION Stk;
|
||||
DWORD Length;
|
||||
ULONG Length;
|
||||
|
||||
DPRINT( "FloppyExecuteReadWrite()\n" );
|
||||
|
||||
ControllerExtension->Irp = Irp = (PIRP)Context;
|
||||
Stk = IoGetCurrentIrpStackLocation( Irp );
|
||||
ControllerExtension->Device = DeviceObject;
|
||||
Timeout.QuadPart = FLOPPY_MOTOR_SPINUP_TIME;
|
||||
DPRINT( "FloppyExecuteReadWrite()\n" );
|
||||
CHECKPOINT;
|
||||
WriteToDevice = Stk->MajorFunction == IRP_MJ_WRITE ? TRUE : FALSE;
|
||||
// verify drive is spun up and selected
|
||||
|
@ -319,7 +330,8 @@ FloppyExecuteReadWrite(PDEVICE_OBJECT DeviceObject,
|
|||
&ControllerExtension->MotorSpinupDpc );
|
||||
return KeepObject;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Timeout.QuadPart = FLOPPY_MOTOR_SPINDOWN_TIME;
|
||||
// motor is already spinning, so reset the spindown timer
|
||||
KeCancelTimer( &ControllerExtension->SpinupTimer );
|
||||
|
|
|
@ -85,6 +85,7 @@
|
|||
//
|
||||
#define FloppyWriteDOR(A, V) (WRITE_PORT_UCHAR((PVOID)(A) + FLOPPY_REG_DOR, (V)))
|
||||
#define FloppyReadMSTAT(A) (READ_PORT_UCHAR((PVOID)(A) + FLOPPY_REG_MSTAT))
|
||||
#define FloppyWriteMSTAT(A, V) (WRITE_PORT_UCHAR((PVOID)(A) + FLOPPY_REG_MSTAT, (V)))
|
||||
#define FloppyReadDATA(A) (READ_PORT_UCHAR((PVOID)(A) + FLOPPY_REG_DATA))
|
||||
#define FloppyWriteDATA(A, V) (WRITE_PORT_UCHAR((PVOID)(A) + FLOPPY_REG_DATA, (V)))
|
||||
#define FloppyReadDIR(A) (READ_PORT_UCHAR((PVOID)(A) + FLOPPY_REG_DIR))
|
||||
|
|
|
@ -49,6 +49,9 @@ BOOLEAN FloppyIsrDetectMedia( PCONTROLLER_OBJECT Controller )
|
|||
{
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Controller->ControllerExtension;
|
||||
BYTE SectorSize;
|
||||
|
||||
DPRINT("FloppyIsrDetectMedia() called\n");
|
||||
|
||||
// media detect in progress, read ID command already issued
|
||||
// first, read result registers
|
||||
KeStallExecutionProcessor( 1000 );
|
||||
|
@ -81,6 +84,8 @@ BOOLEAN FloppyIsrRecal( PCONTROLLER_OBJECT Controller )
|
|||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Controller->ControllerExtension;
|
||||
// issue sense interrupt status, and read St0 and cyl
|
||||
|
||||
DPRINT("FloppyIsrRecal() called\n");
|
||||
|
||||
FloppyWriteDATA( ControllerExtension->PortBase, FLOPPY_CMD_SNS_INTR );
|
||||
KeStallExecutionProcessor( 1000 );
|
||||
ControllerExtension->St0 = FloppyReadDATA( ControllerExtension->PortBase );
|
||||
|
@ -96,7 +101,7 @@ BOOLEAN FloppyIsrRecal( PCONTROLLER_OBJECT Controller )
|
|||
DPRINT( "Recal St0: %2x\n", ControllerExtension->St0 );
|
||||
|
||||
// If recalibrate worked, issue read ID for each media type untill one works
|
||||
if( ControllerExtension->St0 != FLOPPY_ST0_SEEKGD )
|
||||
if ( ControllerExtension->St0 != FLOPPY_ST0_SEEKGD )
|
||||
{
|
||||
DPRINT( "Recalibrate failed, ST0 = %2x\n", ControllerExtension->St0 );
|
||||
// queue DPC to fail IRP
|
||||
|
@ -105,7 +110,8 @@ BOOLEAN FloppyIsrRecal( PCONTROLLER_OBJECT Controller )
|
|||
ControllerExtension->Irp,
|
||||
Controller );
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
// issue first read id, FloppyIsrDetectMedia will handle
|
||||
DPRINT( "Recalibrate worked, issuing read ID mark command\n" );
|
||||
ControllerExtension->IsrState = FloppyIsrDetectMedia;
|
||||
|
|
Loading…
Reference in a new issue