mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 17:25:55 +00:00
Enabled -Wall and -Werror and fixed resulting bugs.
svn path=/trunk/; revision=6638
This commit is contained in:
parent
3145ec42fb
commit
97dc195d03
16 changed files with 451 additions and 398 deletions
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile,v 1.13 2001/08/21 20:13:10 chorns Exp $
|
||||
# $Id: makefile,v 1.14 2003/11/13 14:20:44 ekohl Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
|
@ -8,6 +8,8 @@ TARGET_NAME = beep
|
|||
|
||||
TARGET_OBJECTS = beep.o
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile,v 1.20 2003/04/05 09:37:41 chorns Exp $
|
||||
# $Id: makefile,v 1.21 2003/11/13 14:20:53 ekohl Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
|
@ -10,6 +10,8 @@ TARGET_NAME = blue
|
|||
|
||||
TARGET_OBJECTS = blue.o
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: Makefile,v 1.11 2003/04/05 09:37:42 chorns Exp $
|
||||
# $Id: Makefile,v 1.12 2003/11/13 14:22:03 ekohl Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
|
@ -13,6 +13,8 @@ TARGET_OBJECTS = \
|
|||
floppy.o \
|
||||
isr.o
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
|
|
@ -11,134 +11,180 @@
|
|||
|
||||
|
||||
VOID STDCALL
|
||||
FloppyDpc(PKDPC Dpc,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp,
|
||||
PVOID Context)
|
||||
FloppyDpc (PKDPC Dpc,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp,
|
||||
PVOID Context)
|
||||
{
|
||||
PCONTROLLER_OBJECT Controller = (PCONTROLLER_OBJECT)Context;
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Controller->ControllerExtension;
|
||||
ControllerExtension->DpcState( Dpc,
|
||||
DeviceObject,
|
||||
Irp,
|
||||
Context );
|
||||
PCONTROLLER_OBJECT Controller;
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension;
|
||||
|
||||
Controller = (PCONTROLLER_OBJECT)Context;
|
||||
ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Controller->ControllerExtension;
|
||||
|
||||
ControllerExtension->DpcState (Dpc,
|
||||
DeviceObject,
|
||||
Irp,
|
||||
Context);
|
||||
}
|
||||
|
||||
|
||||
VOID STDCALL
|
||||
FloppyDpcDetect(PKDPC Dpc,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp,
|
||||
PVOID Context)
|
||||
{
|
||||
PCONTROLLER_OBJECT Controller = (PCONTROLLER_OBJECT)Context;
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Controller->ControllerExtension;
|
||||
KeSetEvent( &ControllerExtension->Event, 0, FALSE );
|
||||
}
|
||||
|
||||
VOID STDCALL
|
||||
FloppyDpcFailIrp(PKDPC Dpc,
|
||||
FloppyDpcDetect (PKDPC Dpc,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp,
|
||||
PVOID Context)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_DEVICE_NOT_READY;
|
||||
CHECKPOINT;
|
||||
IoCompleteRequest( Irp, 0 );
|
||||
PCONTROLLER_OBJECT Controller;
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension;
|
||||
|
||||
Controller = (PCONTROLLER_OBJECT)Context;
|
||||
ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Controller->ControllerExtension;
|
||||
|
||||
KeSetEvent (&ControllerExtension->Event,
|
||||
0,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
VOID STDCALL
|
||||
FloppyMotorSpindownDpc(PKDPC Dpc,
|
||||
PVOID Context,
|
||||
PVOID Arg1,
|
||||
PVOID Arg2 )
|
||||
{
|
||||
PCONTROLLER_OBJECT Controller = (PCONTROLLER_OBJECT)Context;
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Controller->ControllerExtension;
|
||||
PFLOPPY_DEVICE_EXTENSION DeviceExtension = (PFLOPPY_DEVICE_EXTENSION)ControllerExtension->Device->DeviceExtension;
|
||||
|
||||
// queue call to turn off motor
|
||||
IoAllocateController( Controller,
|
||||
ControllerExtension->Device,
|
||||
FloppyExecuteSpindown,
|
||||
ControllerExtension );
|
||||
VOID STDCALL
|
||||
FloppyDpcFailIrp (PKDPC Dpc,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp,
|
||||
PVOID Context)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_DEVICE_NOT_READY;
|
||||
Irp->IoStatus.Information = 0;
|
||||
CHECKPOINT;
|
||||
IoCompleteRequest (Irp,
|
||||
IO_NO_INCREMENT);
|
||||
}
|
||||
|
||||
VOID STDCALL
|
||||
FloppyMotorSpinupDpc(PKDPC Dpc,
|
||||
PVOID Context,
|
||||
PVOID Arg1,
|
||||
PVOID Arg2)
|
||||
{
|
||||
PCONTROLLER_OBJECT Controller = (PCONTROLLER_OBJECT)Context;
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Controller->ControllerExtension;
|
||||
PFLOPPY_DEVICE_EXTENSION DeviceExtension = (PFLOPPY_DEVICE_EXTENSION)ControllerExtension->Device->DeviceExtension;
|
||||
LARGE_INTEGER Timeout;
|
||||
|
||||
Timeout.QuadPart = FLOPPY_MOTOR_SPINDOWN_TIME;
|
||||
// Motor has had time to spin up, mark motor as spun up and restart IRP
|
||||
// don't forget to set the spindown timer
|
||||
KeSetTimer( &ControllerExtension->SpinupTimer,
|
||||
Timeout,
|
||||
&ControllerExtension->MotorSpindownDpc );
|
||||
DPRINT( "Motor spun up, retrying operation\n" );
|
||||
ControllerExtension->MotorOn = DeviceExtension->DriveSelect;
|
||||
IoFreeController( Controller );
|
||||
IoAllocateController( Controller,
|
||||
ControllerExtension->Device,
|
||||
FloppyExecuteReadWrite,
|
||||
ControllerExtension->Irp );
|
||||
VOID STDCALL
|
||||
FloppyMotorSpindownDpc (PKDPC Dpc,
|
||||
PVOID Context,
|
||||
PVOID Arg1,
|
||||
PVOID Arg2)
|
||||
{
|
||||
PCONTROLLER_OBJECT Controller;
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension;
|
||||
|
||||
Controller = (PCONTROLLER_OBJECT)Context;
|
||||
ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Controller->ControllerExtension;
|
||||
|
||||
/* queue call to turn off motor */
|
||||
IoAllocateController (Controller,
|
||||
ControllerExtension->Device,
|
||||
FloppyExecuteSpindown,
|
||||
ControllerExtension);
|
||||
}
|
||||
|
||||
VOID STDCALL
|
||||
FloppySeekDpc(PKDPC Dpc,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp,
|
||||
PVOID Context)
|
||||
{
|
||||
PFLOPPY_DEVICE_EXTENSION DeviceExtension = (PFLOPPY_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)DeviceExtension->Controller->ControllerExtension;
|
||||
|
||||
// if the seek failed, fail the IRP
|
||||
if( ControllerExtension->St0 & FLOPPY_ST0_GDMASK )
|
||||
VOID STDCALL
|
||||
FloppyMotorSpinupDpc (PKDPC Dpc,
|
||||
PVOID Context,
|
||||
PVOID Arg1,
|
||||
PVOID Arg2)
|
||||
{
|
||||
PCONTROLLER_OBJECT Controller;
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension;
|
||||
PFLOPPY_DEVICE_EXTENSION DeviceExtension;
|
||||
LARGE_INTEGER Timeout;
|
||||
|
||||
Controller = (PCONTROLLER_OBJECT)Context;
|
||||
ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Controller->ControllerExtension;
|
||||
DeviceExtension = (PFLOPPY_DEVICE_EXTENSION)ControllerExtension->Device->DeviceExtension;
|
||||
Timeout.QuadPart = FLOPPY_MOTOR_SPINDOWN_TIME;
|
||||
|
||||
// Motor has had time to spin up, mark motor as spun up and restart IRP
|
||||
// don't forget to set the spindown timer
|
||||
KeSetTimer (&ControllerExtension->SpinupTimer,
|
||||
Timeout,
|
||||
&ControllerExtension->MotorSpindownDpc);
|
||||
DPRINT ("Motor spun up, retrying operation\n");
|
||||
|
||||
ControllerExtension->MotorOn = DeviceExtension->DriveSelect;
|
||||
|
||||
IoFreeController (Controller);
|
||||
IoAllocateController (Controller,
|
||||
ControllerExtension->Device,
|
||||
FloppyExecuteReadWrite,
|
||||
ControllerExtension->Irp);
|
||||
}
|
||||
|
||||
|
||||
VOID STDCALL
|
||||
FloppySeekDpc (PKDPC Dpc,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp,
|
||||
PVOID Context)
|
||||
{
|
||||
PFLOPPY_DEVICE_EXTENSION DeviceExtension;
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension;
|
||||
|
||||
DeviceExtension = (PFLOPPY_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)DeviceExtension->Controller->ControllerExtension;
|
||||
|
||||
/* If the seek failed, fail the IRP */
|
||||
if (ControllerExtension->St0 & FLOPPY_ST0_GDMASK)
|
||||
{
|
||||
ControllerExtension->Irp->IoStatus.Status = STATUS_DISK_CORRUPT_ERROR;
|
||||
ControllerExtension->Irp->IoStatus.Information = 0;
|
||||
DPRINT( "Failing IRP: St0 = %2x, St1 = %2x, St2 = %2x\n",
|
||||
DPRINT ("Failing IRP: St0 = %2x, St1 = %2x, St2 = %2x\n",
|
||||
ControllerExtension->St0,
|
||||
ControllerExtension->St1,
|
||||
ControllerExtension->St2 );
|
||||
for(;;);
|
||||
IoCompleteRequest( ControllerExtension->Irp, 0 );
|
||||
IoFreeController( DeviceExtension->Controller );
|
||||
ControllerExtension->St2);
|
||||
for (;;);
|
||||
IoCompleteRequest (ControllerExtension->Irp,
|
||||
IO_NO_INCREMENT);
|
||||
IoFreeController (DeviceExtension->Controller);
|
||||
return;
|
||||
}
|
||||
KeStallExecutionProcessor( 10000 );
|
||||
DPRINT( "Seek completed, now on cyl %2x\n", DeviceExtension->Cyl );
|
||||
// now that we are on the right cyl, restart the read
|
||||
if( FloppyExecuteReadWrite( DeviceObject,
|
||||
|
||||
KeStallExecutionProcessor (10000);
|
||||
|
||||
DPRINT ("Seek completed, now on cyl %2x\n", DeviceExtension->Cyl);
|
||||
|
||||
/* Now that we are on the right cyl, restart the read */
|
||||
if (FloppyExecuteReadWrite (DeviceObject,
|
||||
ControllerExtension->Irp,
|
||||
ControllerExtension->MapRegisterBase,
|
||||
ControllerExtension->Irp ) == DeallocateObject )
|
||||
IoFreeController( DeviceExtension->Controller );
|
||||
ControllerExtension->Irp) == DeallocateObject)
|
||||
{
|
||||
IoFreeController (DeviceExtension->Controller);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VOID STDCALL
|
||||
FloppyDpcReadWrite(PKDPC Dpc,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp,
|
||||
PVOID Context)
|
||||
FloppyDpcReadWrite (PKDPC Dpc,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp,
|
||||
PVOID Context)
|
||||
{
|
||||
PCONTROLLER_OBJECT Controller = (PCONTROLLER_OBJECT)Context;
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Controller->ControllerExtension;
|
||||
PFLOPPY_DEVICE_EXTENSION DeviceExtension = (PFLOPPY_DEVICE_EXTENSION)ControllerExtension->Device->DeviceExtension;
|
||||
DWORD SectorSize = 128 << ControllerExtension->SectorSizeCode;
|
||||
PIO_STACK_LOCATION Stk = IoGetCurrentIrpStackLocation( ControllerExtension->Irp );
|
||||
BOOLEAN WriteToDevice = Stk->MajorFunction == IRP_MJ_WRITE ? TRUE : FALSE;
|
||||
PCONTROLLER_OBJECT Controller;
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension;
|
||||
PFLOPPY_DEVICE_EXTENSION DeviceExtension;
|
||||
ULONG SectorSize;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
BOOLEAN WriteToDevice;
|
||||
|
||||
|
||||
Controller = (PCONTROLLER_OBJECT)Context;
|
||||
ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Controller->ControllerExtension;
|
||||
DeviceExtension = (PFLOPPY_DEVICE_EXTENSION)ControllerExtension->Device->DeviceExtension;
|
||||
|
||||
Irp = ControllerExtension->Irp;
|
||||
// if the IO failed, fail the IRP
|
||||
if( ControllerExtension->St0 & FLOPPY_ST0_GDMASK )
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation (Irp);
|
||||
|
||||
SectorSize = 128 << ControllerExtension->SectorSizeCode;
|
||||
|
||||
WriteToDevice = Stack->MajorFunction == IRP_MJ_WRITE ? TRUE : FALSE;
|
||||
|
||||
/* If the IO failed, fail the IRP */
|
||||
if (ControllerExtension->St0 & FLOPPY_ST0_GDMASK)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_DISK_CORRUPT_ERROR;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
@ -147,71 +193,86 @@ FloppyDpcReadWrite(PKDPC Dpc,
|
|||
ControllerExtension->St1,
|
||||
ControllerExtension->St2 );
|
||||
for(;;);
|
||||
IoCompleteRequest( Irp, 0 );
|
||||
IoFreeController( Controller );
|
||||
IoCompleteRequest (Irp,
|
||||
IO_NO_INCREMENT);
|
||||
IoFreeController (Controller);
|
||||
return;
|
||||
}
|
||||
// don't forget to flush the buffers
|
||||
|
||||
/* Don't forget to flush the buffers */
|
||||
IoFlushAdapterBuffers( ControllerExtension->AdapterObject,
|
||||
ControllerExtension->Irp->MdlAddress,
|
||||
ControllerExtension->MapRegisterBase,
|
||||
ControllerExtension->Irp->Tail.Overlay.DriverContext[0],
|
||||
ControllerExtension->TransferLength,
|
||||
WriteToDevice );
|
||||
DPRINT( "St0 = %2x, St1 %2x, St2 = %2x\n",
|
||||
WriteToDevice);
|
||||
DPRINT ("St0 = %2x St1 = %2x St2 = %2x\n",
|
||||
ControllerExtension->St0,
|
||||
ControllerExtension->St1,
|
||||
ControllerExtension->St2 );
|
||||
// update buffer info
|
||||
Stk->Parameters.Read.ByteOffset.u.LowPart += ControllerExtension->TransferLength;
|
||||
Stk->Parameters.Read.Length -= ControllerExtension->TransferLength;
|
||||
// drivercontext used for current va
|
||||
(DWORD)ControllerExtension->Irp->Tail.Overlay.DriverContext[0] += ControllerExtension->TransferLength;
|
||||
|
||||
DPRINT( "First dword: %x\n", *((DWORD *)ControllerExtension->MapRegisterBase) )
|
||||
ControllerExtension->St2);
|
||||
|
||||
// if there is more IO to be done, restart execute routine to issue next read
|
||||
if( Stk->Parameters.Read.Length )
|
||||
/* Update buffer info */
|
||||
Stack->Parameters.Read.ByteOffset.u.LowPart += ControllerExtension->TransferLength;
|
||||
Stack->Parameters.Read.Length -= ControllerExtension->TransferLength;
|
||||
|
||||
/* drivercontext used for current va */
|
||||
(ULONG)ControllerExtension->Irp->Tail.Overlay.DriverContext[0] += ControllerExtension->TransferLength;
|
||||
DPRINT ("First ulong: %x\n", *((PULONG)ControllerExtension->MapRegisterBase))
|
||||
|
||||
/* If there is more IO to be done, restart execute routine to issue next read */
|
||||
if (Stack->Parameters.Read.Length != 0)
|
||||
{
|
||||
if( FloppyExecuteReadWrite( DeviceObject,
|
||||
if (FloppyExecuteReadWrite (DeviceObject,
|
||||
Irp,
|
||||
ControllerExtension->MapRegisterBase,
|
||||
Irp ) == DeallocateObject )
|
||||
IoFreeController( Controller );
|
||||
Irp ) == DeallocateObject)
|
||||
{
|
||||
IoFreeController (Controller);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Otherwise, complete the IRP */
|
||||
IoCompleteRequest (Irp,
|
||||
IO_NO_INCREMENT);
|
||||
IoFreeController (Controller);
|
||||
}
|
||||
else {
|
||||
IoFreeController( Controller );
|
||||
// otherwise, complete the Irp
|
||||
IoCompleteRequest( Irp, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VOID STDCALL
|
||||
FloppyDpcDetectMedia(PKDPC Dpc,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp,
|
||||
PVOID Context)
|
||||
FloppyDpcDetectMedia (PKDPC Dpc,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp,
|
||||
PVOID Context)
|
||||
{
|
||||
PCONTROLLER_OBJECT Controller = (PCONTROLLER_OBJECT)Context;
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Controller->ControllerExtension;
|
||||
// If the read ID failed, fail the irp
|
||||
if( ControllerExtension->St1 != 0 )
|
||||
PCONTROLLER_OBJECT Controller;
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension;
|
||||
|
||||
Controller = (PCONTROLLER_OBJECT)Context;
|
||||
ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Controller->ControllerExtension;
|
||||
|
||||
/* If the read ID failed, fail the IRP */
|
||||
if (ControllerExtension->St1 != 0)
|
||||
{
|
||||
DPRINT1( "Read ID failed: ST1 = %2x\n", ControllerExtension->St1 );
|
||||
IoFreeController( Controller );
|
||||
DPRINT1 ("Read ID failed: ST1 = %2x\n", ControllerExtension->St1);
|
||||
IoFreeController (Controller);
|
||||
Irp->IoStatus.Information = 0;
|
||||
Irp->IoStatus.Status = STATUS_DEVICE_NOT_READY;
|
||||
IoCompleteRequest( Irp, 0 );
|
||||
IoCompleteRequest (Irp,
|
||||
IO_NO_INCREMENT);
|
||||
return;
|
||||
}
|
||||
// set media type, and restart the IRP from the beginning
|
||||
((PFLOPPY_DEVICE_EXTENSION)ControllerExtension->Device->DeviceExtension)->MediaType = 0;
|
||||
DPRINT( "Media detected, restarting IRP\n" );
|
||||
// don't forget to free the controller so that the now queued routine may execute
|
||||
IoFreeController( Controller );
|
||||
|
||||
IoAllocateController( Controller,
|
||||
/* Set media type, and restart the IRP from the beginning */
|
||||
((PFLOPPY_DEVICE_EXTENSION)ControllerExtension->Device->DeviceExtension)->MediaType = 0;
|
||||
DPRINT ("Media detected, restarting IRP\n");
|
||||
|
||||
/* Don't forget to free the controller so that the now queued routine may execute */
|
||||
IoFreeController (Controller);
|
||||
|
||||
IoAllocateController (Controller,
|
||||
DeviceObject,
|
||||
FloppyExecuteReadWrite,
|
||||
Irp );
|
||||
Irp);
|
||||
}
|
||||
|
|
|
@ -42,10 +42,10 @@ FloppyCreateController(PDRIVER_OBJECT DriverObject,
|
|||
UNICODE_STRING DeviceName;
|
||||
NTSTATUS Status;
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
PCONFIGURATION_INFORMATION ConfigInfo;
|
||||
// PCONFIGURATION_INFORMATION ConfigInfo;
|
||||
LARGE_INTEGER Timeout;
|
||||
BYTE Byte;
|
||||
int c;
|
||||
// BYTE Byte;
|
||||
// int c;
|
||||
PCONFIGURATION_INFORMATION Config;
|
||||
DEVICE_DESCRIPTION DeviceDescription;
|
||||
ULONG MaxMapRegs;
|
||||
|
@ -431,109 +431,138 @@ FloppyExecuteReadWrite(PDEVICE_OBJECT DeviceObject,
|
|||
return KeepObject;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
FloppyDispatchOpenClose(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
DPRINT("FloppyDispatchOpenClose\n");
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
FloppyDispatchReadWrite(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
FloppyDispatchOpenClose (PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
PFLOPPY_DEVICE_EXTENSION DeviceExtension = (PFLOPPY_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)DeviceExtension->Controller->ControllerExtension;
|
||||
PIO_STACK_LOCATION Stk = IoGetCurrentIrpStackLocation( Irp );
|
||||
DPRINT ("FloppyDispatchOpenClose\n");
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS STDCALL
|
||||
FloppyDispatchReadWrite (PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
PFLOPPY_DEVICE_EXTENSION DeviceExtension;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
KIRQL oldlvl;
|
||||
|
||||
if( Stk->Parameters.Read.ByteOffset.u.HighPart )
|
||||
|
||||
DeviceExtension = (PFLOPPY_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation (Irp);
|
||||
|
||||
if (Stack->Parameters.Read.ByteOffset.u.HighPart)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest( Irp, 1 );
|
||||
IoCompleteRequest (Irp, 1);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
// store currentva in drivercontext
|
||||
Irp->Tail.Overlay.DriverContext[0] = MmGetMdlVirtualAddress( Irp->MdlAddress );
|
||||
DPRINT( "FloppyDispatchReadWrite: offset = %x, length = %x, va = %x\n",
|
||||
Stk->Parameters.Read.ByteOffset.u.LowPart,
|
||||
Stk->Parameters.Read.Length,
|
||||
Irp->Tail.Overlay.DriverContext[0] );
|
||||
// Queue IRP
|
||||
|
||||
/* Store currentva in drivercontext */
|
||||
Irp->Tail.Overlay.DriverContext[0] = MmGetMdlVirtualAddress (Irp->MdlAddress);
|
||||
DPRINT ("FloppyDispatchReadWrite: offset = %x, length = %x, va = %x\n",
|
||||
Stack->Parameters.Read.ByteOffset.u.LowPart,
|
||||
Stack->Parameters.Read.Length,
|
||||
Irp->Tail.Overlay.DriverContext[0]);
|
||||
|
||||
/* Queue IRP */
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = Stk->Parameters.Read.Length;
|
||||
IoMarkIrpPending( Irp );
|
||||
KeRaiseIrql( DISPATCH_LEVEL, &oldlvl );
|
||||
IoAllocateController( ((PFLOPPY_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Controller,
|
||||
Irp->IoStatus.Information = Stack->Parameters.Read.Length;
|
||||
IoMarkIrpPending (Irp);
|
||||
|
||||
KeRaiseIrql (DISPATCH_LEVEL,
|
||||
&oldlvl);
|
||||
IoAllocateController (DeviceExtension->Controller,
|
||||
DeviceObject,
|
||||
FloppyExecuteReadWrite,
|
||||
Irp );
|
||||
KeLowerIrql( oldlvl );
|
||||
Irp);
|
||||
KeLowerIrql (oldlvl);
|
||||
|
||||
DPRINT( "oldlvl = %x\n", oldlvl );
|
||||
|
||||
return STATUS_PENDING;
|
||||
}
|
||||
|
||||
IO_ALLOCATION_ACTION STDCALL
|
||||
FloppyAdapterControl(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp,
|
||||
PVOID MapRegisterBase,
|
||||
PVOID Context)
|
||||
{
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Context;
|
||||
|
||||
// just set the event, and return KeepObject
|
||||
IO_ALLOCATION_ACTION STDCALL
|
||||
FloppyAdapterControl (PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp,
|
||||
PVOID MapRegisterBase,
|
||||
PVOID Context)
|
||||
{
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension;
|
||||
|
||||
ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Context;
|
||||
CHECKPOINT;
|
||||
|
||||
/* Just set the event, and return KeepObject */
|
||||
ControllerExtension->MapRegisterBase = MapRegisterBase;
|
||||
KeSetEvent( &ControllerExtension->Event, 0, FALSE );
|
||||
KeSetEvent (&ControllerExtension->Event,
|
||||
0,
|
||||
FALSE);
|
||||
|
||||
return KeepObject;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS STDCALL
|
||||
FloppyDispatchDeviceControl(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
FloppyDispatchDeviceControl (PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION IrpStack;
|
||||
ULONG ControlCode, InputLength, OutputLength;
|
||||
NTSTATUS Status;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
ULONG ControlCode;
|
||||
ULONG InputLength;
|
||||
ULONG OutputLength;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("FloppyDispatchDeviceControl\n");
|
||||
DPRINT ("FloppyDispatchDeviceControl\n");
|
||||
|
||||
IrpStack = IoGetCurrentIrpStackLocation(Irp);
|
||||
ControlCode = IrpStack->Parameters.DeviceIoControl.IoControlCode;
|
||||
InputLength = IrpStack->Parameters.DeviceIoControl.InputBufferLength;
|
||||
OutputLength = IrpStack->Parameters.DeviceIoControl.OutputBufferLength;
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
ControlCode = Stack->Parameters.DeviceIoControl.IoControlCode;
|
||||
InputLength = Stack->Parameters.DeviceIoControl.InputBufferLength;
|
||||
OutputLength = Stack->Parameters.DeviceIoControl.OutputBufferLength;
|
||||
|
||||
switch (ControlCode)
|
||||
{
|
||||
switch (ControlCode)
|
||||
{
|
||||
case IOCTL_DISK_GET_DRIVE_GEOMETRY:
|
||||
if (OutputLength < sizeof(DISK_GEOMETRY))
|
||||
{
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
else
|
||||
{
|
||||
PDISK_GEOMETRY Geometry = Irp->AssociatedIrp.SystemBuffer;
|
||||
// FIXME: read the first sector of the diskette
|
||||
Geometry->MediaType = F3_1Pt44_512;
|
||||
Geometry->Cylinders.QuadPart = 80;
|
||||
Geometry->TracksPerCylinder = 2 * 18;
|
||||
Geometry->SectorsPerTrack = 18;
|
||||
Geometry->BytesPerSector = 512;
|
||||
Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = sizeof(DISK_GEOMETRY);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||
}
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, NT_SUCCESS(Status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT);
|
||||
return Status;
|
||||
if (OutputLength < sizeof(DISK_GEOMETRY))
|
||||
{
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
else
|
||||
{
|
||||
PDISK_GEOMETRY Geometry = Irp->AssociatedIrp.SystemBuffer;
|
||||
|
||||
// FIXME: read the first sector of the diskette
|
||||
Geometry->MediaType = F3_1Pt44_512;
|
||||
Geometry->Cylinders.QuadPart = 80;
|
||||
Geometry->TracksPerCylinder = 2 * 18;
|
||||
Geometry->SectorsPerTrack = 18;
|
||||
Geometry->BytesPerSector = 512;
|
||||
Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = sizeof(DISK_GEOMETRY);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||
Irp->IoStatus.Information = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest (Irp,
|
||||
NT_SUCCESS(Status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* ModuleEntry
|
||||
|
||||
/*
|
||||
* DriverEntry
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* This function initializes the driver, locates and claims
|
||||
|
@ -550,31 +579,31 @@ FloppyDispatchDeviceControl(PDEVICE_OBJECT DeviceObject,
|
|||
* key
|
||||
*
|
||||
* RETURNS:
|
||||
* NTSTATUS
|
||||
* NTSTATUS
|
||||
*/
|
||||
NTSTATUS STDCALL
|
||||
DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
||||
IN PUNICODE_STRING RegistryPath)
|
||||
DriverEntry (IN PDRIVER_OBJECT DriverObject,
|
||||
IN PUNICODE_STRING RegistryPath)
|
||||
{
|
||||
DPRINT("Floppy driver\n");
|
||||
|
||||
/* Export other driver entry points... */
|
||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = (PDRIVER_DISPATCH)FloppyDispatchOpenClose;
|
||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = (PDRIVER_DISPATCH)FloppyDispatchOpenClose;
|
||||
DriverObject->MajorFunction[IRP_MJ_READ] = (PDRIVER_DISPATCH)FloppyDispatchReadWrite;
|
||||
DriverObject->MajorFunction[IRP_MJ_WRITE] = (PDRIVER_DISPATCH)FloppyDispatchReadWrite;
|
||||
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
|
||||
(PDRIVER_DISPATCH)FloppyDispatchDeviceControl;
|
||||
|
||||
/* Try to detect controller and abort if it fails */
|
||||
if (!FloppyCreateController(DriverObject,
|
||||
DPRINT ("Floppy driver\n");
|
||||
|
||||
/* Export other driver entry points... */
|
||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = (PDRIVER_DISPATCH)FloppyDispatchOpenClose;
|
||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = (PDRIVER_DISPATCH)FloppyDispatchOpenClose;
|
||||
DriverObject->MajorFunction[IRP_MJ_READ] = (PDRIVER_DISPATCH)FloppyDispatchReadWrite;
|
||||
DriverObject->MajorFunction[IRP_MJ_WRITE] = (PDRIVER_DISPATCH)FloppyDispatchReadWrite;
|
||||
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
|
||||
(PDRIVER_DISPATCH)FloppyDispatchDeviceControl;
|
||||
|
||||
/* Try to detect controller and abort if it fails */
|
||||
if (!FloppyCreateController (DriverObject,
|
||||
&ControllerParameters[0],
|
||||
0))
|
||||
{
|
||||
DPRINT("Could not find floppy controller\n");
|
||||
return STATUS_NO_SUCH_DEVICE;
|
||||
}
|
||||
|
||||
{
|
||||
DPRINT ("Could not find floppy controller\n");
|
||||
return STATUS_NO_SUCH_DEVICE;
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ BOOLEAN FloppyIsrUnexpected( PCONTROLLER_OBJECT Controller )
|
|||
BOOLEAN FloppyIsrDetectMedia( PCONTROLLER_OBJECT Controller )
|
||||
{
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Controller->ControllerExtension;
|
||||
BYTE SectorSize;
|
||||
UCHAR SectorSize;
|
||||
|
||||
DPRINT("FloppyIsrDetectMedia() called\n");
|
||||
|
||||
|
@ -128,10 +128,12 @@ BOOLEAN FloppyIsrReadWrite( PCONTROLLER_OBJECT Controller )
|
|||
{
|
||||
// read result registers from read or write command, and queue dpc to start next operation
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Controller->ControllerExtension;
|
||||
BYTE Cyl, Head, Sector;
|
||||
PFLOPPY_DEVICE_EXTENSION DeviceExtension = (PFLOPPY_DEVICE_EXTENSION)ControllerExtension->Device->DeviceExtension;
|
||||
PIO_STACK_LOCATION Stk = IoGetCurrentIrpStackLocation( ControllerExtension->Irp );
|
||||
BOOLEAN WriteToDevice = Stk->MajorFunction == IRP_MJ_WRITE ? TRUE : FALSE;
|
||||
UCHAR Cyl;
|
||||
UCHAR Head;
|
||||
UCHAR Sector;
|
||||
// PFLOPPY_DEVICE_EXTENSION DeviceExtension = (PFLOPPY_DEVICE_EXTENSION)ControllerExtension->Device->DeviceExtension;
|
||||
// PIO_STACK_LOCATION Stk = IoGetCurrentIrpStackLocation( ControllerExtension->Irp );
|
||||
// BOOLEAN WriteToDevice = Stk->MajorFunction == IRP_MJ_WRITE ? TRUE : FALSE;
|
||||
|
||||
|
||||
ControllerExtension->St0 = FloppyReadDATA( ControllerExtension->PortBase );
|
||||
|
@ -147,6 +149,7 @@ BOOLEAN FloppyIsrReadWrite( PCONTROLLER_OBJECT Controller )
|
|||
Sector = FloppyReadDATA( ControllerExtension->PortBase ); // sector
|
||||
KeStallExecutionProcessor( 100 );
|
||||
ControllerExtension->SectorSizeCode = FloppyReadDATA( ControllerExtension->PortBase );
|
||||
|
||||
// reprogam for next sector if we are not done reading track
|
||||
/* if( ( ControllerExtension->TransferLength -= ( 128 << ControllerExtension->SectorSizeCode ) ) )
|
||||
{
|
||||
|
@ -176,15 +179,19 @@ BOOLEAN FloppyIsrReadWrite( PCONTROLLER_OBJECT Controller )
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
// actual ISR, passes controll to handler for current state in state machine
|
||||
|
||||
BOOLEAN STDCALL
|
||||
FloppyIsr(PKINTERRUPT Interrupt,
|
||||
PVOID ServiceContext)
|
||||
FloppyIsr (PKINTERRUPT Interrupt,
|
||||
PVOID ServiceContext)
|
||||
{
|
||||
PCONTROLLER_OBJECT Controller = (PCONTROLLER_OBJECT)ServiceContext;
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Controller->ControllerExtension;
|
||||
BYTE Byte;
|
||||
PCONTROLLER_OBJECT Controller;
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension;
|
||||
UCHAR Byte;
|
||||
|
||||
Controller = (PCONTROLLER_OBJECT)ServiceContext;
|
||||
ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Controller->ControllerExtension;
|
||||
|
||||
// need to make sure interrupt is for us, and add some delay for the damn FDC
|
||||
// without the delay, even though the thing has interrupted, it's still not ready
|
||||
|
@ -200,4 +207,4 @@ FloppyIsr(PKINTERRUPT Interrupt,
|
|||
return ControllerExtension->IsrState( Controller );
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: atapi.c,v 1.44 2003/08/22 13:50:39 ekohl Exp $
|
||||
/* $Id: atapi.c,v 1.45 2003/11/13 14:17:51 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS ATAPI miniport driver
|
||||
|
@ -200,22 +200,16 @@ AtapiIdentifyDevice(IN ULONG CommandPort,
|
|||
OUT PIDE_DRIVE_IDENTIFY DrvParms);
|
||||
|
||||
static BOOLEAN
|
||||
IDEResetController(IN ULONG CommandPort,
|
||||
IN ULONG ControlPort);
|
||||
|
||||
static int
|
||||
AtapiPolledRead(IN ULONG CommandPort,
|
||||
IN ULONG ControlPort,
|
||||
IN BYTE PreComp,
|
||||
IN BYTE SectorCnt,
|
||||
IN BYTE SectorNum,
|
||||
IN BYTE CylinderLow,
|
||||
IN BYTE CylinderHigh,
|
||||
IN BYTE DrvHead,
|
||||
IN BYTE Command,
|
||||
OUT BYTE *Buffer);
|
||||
|
||||
|
||||
IN UCHAR PreComp,
|
||||
IN UCHAR SectorCnt,
|
||||
IN UCHAR SectorNum,
|
||||
IN UCHAR CylinderLow,
|
||||
IN UCHAR CylinderHigh,
|
||||
IN UCHAR DrvHead,
|
||||
IN UCHAR Command,
|
||||
OUT PUCHAR Buffer);
|
||||
|
||||
static ULONG
|
||||
AtapiSendAtapiCommand(IN PATAPI_MINIPORT_EXTENSION DeviceExtension,
|
||||
|
@ -1170,7 +1164,8 @@ AtapiFindDevices(PATAPI_MINIPORT_EXTENSION DeviceExtension,
|
|||
ULONG ControlPortBase;
|
||||
ULONG UnitNumber;
|
||||
ULONG Retries;
|
||||
BYTE High, Low;
|
||||
UCHAR High;
|
||||
UCHAR Low;
|
||||
|
||||
DPRINT("AtapiFindDevices() called\n");
|
||||
|
||||
|
@ -1203,10 +1198,10 @@ AtapiFindDevices(PATAPI_MINIPORT_EXTENSION DeviceExtension,
|
|||
IDEWriteCylinderLow(CommandPortBase, 0);
|
||||
|
||||
if (Low != 0x55 || High != 0xaa)
|
||||
{
|
||||
DPRINT("No Drive found. UnitNumber %d CommandPortBase %x\n", UnitNumber, CommandPortBase);
|
||||
continue;
|
||||
}
|
||||
{
|
||||
DPRINT("No Drive found. UnitNumber %d CommandPortBase %x\n", UnitNumber, CommandPortBase);
|
||||
continue;
|
||||
}
|
||||
|
||||
IDEWriteCommand(CommandPortBase, IDE_CMD_RESET);
|
||||
|
||||
|
@ -1302,56 +1297,6 @@ AtapiFindDevices(PATAPI_MINIPORT_EXTENSION DeviceExtension,
|
|||
}
|
||||
|
||||
|
||||
// AtapiResetController
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// Reset the controller and report completion status
|
||||
//
|
||||
// RUN LEVEL:
|
||||
// PASSIVE_LEVEL
|
||||
//
|
||||
// ARGUMENTS:
|
||||
// IN WORD CommandPort The address of the command port
|
||||
// IN WORD ControlPort The address of the control port
|
||||
//
|
||||
// RETURNS:
|
||||
//
|
||||
|
||||
static BOOLEAN
|
||||
AtapiResetController(IN ULONG CommandPort,
|
||||
IN ULONG ControlPort)
|
||||
{
|
||||
int Retries;
|
||||
|
||||
/* Assert drive reset line */
|
||||
IDEWriteDriveControl(ControlPort, IDE_DC_SRST);
|
||||
|
||||
/* Wait for min. 25 microseconds */
|
||||
ScsiPortStallExecution(IDE_RESET_PULSE_LENGTH);
|
||||
|
||||
/* Negate drive reset line */
|
||||
IDEWriteDriveControl(ControlPort, 0);
|
||||
|
||||
/* Wait for BUSY negation */
|
||||
for (Retries = 0; Retries < IDE_RESET_BUSY_TIMEOUT * 1000; Retries++)
|
||||
{
|
||||
if (!(IDEReadStatus(CommandPort) & IDE_SR_BUSY))
|
||||
{
|
||||
break;
|
||||
}
|
||||
ScsiPortStallExecution(10);
|
||||
}
|
||||
|
||||
if (Retries >= IDE_RESET_BUSY_TIMEOUT * 1000)
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
// return TRUE if controller came back to life. and
|
||||
// the registers are initialized correctly
|
||||
return(IDEReadError(CommandPort) == 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* AtapiIdentifyDevice
|
||||
*
|
||||
|
@ -1397,10 +1342,10 @@ AtapiIdentifyDevice(IN ULONG CommandPort,
|
|||
0,
|
||||
(DriveNum ? IDE_DH_DRV1 : 0),
|
||||
(Atapi ? IDE_CMD_IDENT_ATAPI_DRV : IDE_CMD_IDENT_ATA_DRV),
|
||||
(BYTE *)DrvParms) != 0)
|
||||
(PUCHAR)DrvParms) == FALSE)
|
||||
{
|
||||
DPRINT("IDEPolledRead() failed\n");
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Report on drive parameters if debug mode */
|
||||
|
@ -1467,7 +1412,7 @@ AtapiIdentifyDevice(IN ULONG CommandPort,
|
|||
}
|
||||
DPRINT("BytesPerSector %d\n", DrvParms->BytesPerSector);
|
||||
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1480,38 +1425,38 @@ AtapiIdentifyDevice(IN ULONG CommandPort,
|
|||
// PASSIVE_LEVEL
|
||||
//
|
||||
// ARGUMENTS:
|
||||
// IN WORD Address Address of command port for drive
|
||||
// IN BYTE PreComp Value to write to precomp register
|
||||
// IN BYTE SectorCnt Value to write to sectorCnt register
|
||||
// IN BYTE SectorNum Value to write to sectorNum register
|
||||
// IN BYTE CylinderLow Value to write to CylinderLow register
|
||||
// IN BYTE CylinderHigh Value to write to CylinderHigh register
|
||||
// IN BYTE DrvHead Value to write to Drive/Head register
|
||||
// IN BYTE Command Value to write to Command register
|
||||
// OUT BYTE *Buffer Buffer for output data
|
||||
// IN ULONG CommandPort Address of command port for drive
|
||||
// IN ULONG ControlPort Address of control port for drive
|
||||
// IN UCHAR PreComp Value to write to precomp register
|
||||
// IN UCHAR SectorCnt Value to write to sectorCnt register
|
||||
// IN UCHAR SectorNum Value to write to sectorNum register
|
||||
// IN UCHAR CylinderLow Value to write to CylinderLow register
|
||||
// IN UCHAR CylinderHigh Value to write to CylinderHigh register
|
||||
// IN UCHAR DrvHead Value to write to Drive/Head register
|
||||
// IN UCHAR Command Value to write to Command register
|
||||
// OUT PUCHAR Buffer Buffer for output data
|
||||
//
|
||||
// RETURNS:
|
||||
// int 0 is success, non 0 is an error code
|
||||
// BOOLEAN: TRUE success, FALSE error
|
||||
//
|
||||
|
||||
static int
|
||||
static BOOLEAN
|
||||
AtapiPolledRead(IN ULONG CommandPort,
|
||||
IN ULONG ControlPort,
|
||||
IN BYTE PreComp,
|
||||
IN BYTE SectorCnt,
|
||||
IN BYTE SectorNum,
|
||||
IN BYTE CylinderLow,
|
||||
IN BYTE CylinderHigh,
|
||||
IN BYTE DrvHead,
|
||||
IN BYTE Command,
|
||||
OUT BYTE *Buffer)
|
||||
IN UCHAR PreComp,
|
||||
IN UCHAR SectorCnt,
|
||||
IN UCHAR SectorNum,
|
||||
IN UCHAR CylinderLow,
|
||||
IN UCHAR CylinderHigh,
|
||||
IN UCHAR DrvHead,
|
||||
IN UCHAR Command,
|
||||
OUT PUCHAR Buffer)
|
||||
{
|
||||
ULONG SectorCount = 0;
|
||||
ULONG RetryCount;
|
||||
BOOLEAN Junk = FALSE;
|
||||
UCHAR Status;
|
||||
|
||||
//#if 0
|
||||
/* Wait for BUSY to clear */
|
||||
for (RetryCount = 0; RetryCount < IDE_MAX_BUSY_RETRIES; RetryCount++)
|
||||
{
|
||||
|
@ -1527,9 +1472,8 @@ AtapiPolledRead(IN ULONG CommandPort,
|
|||
if (RetryCount >= IDE_MAX_BUSY_RETRIES)
|
||||
{
|
||||
DPRINT("Drive is BUSY for too long\n");
|
||||
return(IDE_ER_ABRT);
|
||||
return FALSE;
|
||||
}
|
||||
//#endif
|
||||
|
||||
/* Write Drive/Head to select drive */
|
||||
IDEWriteDriveHead(CommandPort, IDE_DH_FIXED | DrvHead);
|
||||
|
@ -1552,7 +1496,7 @@ AtapiPolledRead(IN ULONG CommandPort,
|
|||
}
|
||||
if (RetryCount >= IDE_MAX_BUSY_RETRIES)
|
||||
{
|
||||
return IDE_ER_ABRT;
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1601,8 +1545,9 @@ AtapiPolledRead(IN ULONG CommandPort,
|
|||
ScsiPortStallExecution(50);
|
||||
IDEReadStatus(CommandPort);
|
||||
|
||||
return(IDE_ER_ABRT);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (Status & IDE_SR_DRQ)
|
||||
{
|
||||
break;
|
||||
|
@ -1613,7 +1558,7 @@ AtapiPolledRead(IN ULONG CommandPort,
|
|||
ScsiPortStallExecution(50);
|
||||
IDEReadStatus(CommandPort);
|
||||
|
||||
return(IDE_ER_ABRT);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
ScsiPortStallExecution(10);
|
||||
|
@ -1626,7 +1571,7 @@ AtapiPolledRead(IN ULONG CommandPort,
|
|||
ScsiPortStallExecution(50);
|
||||
IDEReadStatus(CommandPort);
|
||||
|
||||
return(IDE_ER_ABRT);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
while (1)
|
||||
|
@ -1656,7 +1601,7 @@ AtapiPolledRead(IN ULONG CommandPort,
|
|||
ScsiPortStallExecution(50);
|
||||
IDEReadStatus(CommandPort);
|
||||
|
||||
return(IDE_ER_ABRT);
|
||||
return FALSE;
|
||||
}
|
||||
if (Status & IDE_SR_DRQ)
|
||||
{
|
||||
|
@ -1678,7 +1623,7 @@ AtapiPolledRead(IN ULONG CommandPort,
|
|||
ScsiPortStallExecution(50);
|
||||
IDEReadStatus(CommandPort);
|
||||
|
||||
return(0);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1822,7 +1767,7 @@ AtapiSendAtapiCommand(IN PATAPI_MINIPORT_EXTENSION DeviceExtension,
|
|||
break;
|
||||
}
|
||||
|
||||
CdbSize = (DeviceExtension->DeviceParams[Srb->TargetId].ConfigBits & 0x3 == 1) ? 16 : 12;
|
||||
CdbSize = ((DeviceExtension->DeviceParams[Srb->TargetId].ConfigBits & 0x3) == 1) ? 16 : 12;
|
||||
DPRINT("CdbSize: %lu\n", CdbSize);
|
||||
|
||||
/* Write command packet */
|
||||
|
@ -2281,7 +2226,7 @@ AtapiFlushCache(PATAPI_MINIPORT_EXTENSION DeviceExtension,
|
|||
/* Wait for controller ready */
|
||||
for (Retries = 0; Retries < IDE_MAX_WRITE_RETRIES; Retries++)
|
||||
{
|
||||
BYTE Status = IDEReadStatus(DeviceExtension->CommandPortBase);
|
||||
Status = IDEReadStatus(DeviceExtension->CommandPortBase);
|
||||
if (!(Status & IDE_SR_BUSY) || (Status & IDE_SR_ERR))
|
||||
{
|
||||
break;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile,v 1.2 2003/04/05 09:37:43 chorns Exp $
|
||||
# $Id: makefile,v 1.3 2003/11/13 14:17:51 ekohl Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
|
@ -12,6 +12,8 @@ TARGET_DDKLIBS = scsiport.a
|
|||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
TARGET_CFLAGS = -Werror -Wall
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: cdrom.c,v 1.25 2003/11/10 18:09:54 ekohl Exp $
|
||||
/* $Id: cdrom.c,v 1.26 2003/11/13 14:18:26 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -437,16 +437,15 @@ CdromClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
|
|||
IN PCLASS_INIT_DATA InitializationData)
|
||||
{
|
||||
PDEVICE_EXTENSION DiskDeviceExtension; /* defined in class2.h */
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING UnicodeDeviceDirName;
|
||||
PDEVICE_OBJECT DiskDeviceObject;
|
||||
SCSI_REQUEST_BLOCK Srb;
|
||||
PCDROM_DATA CdromData;
|
||||
CHAR NameBuffer[80];
|
||||
HANDLE Handle;
|
||||
#if 0
|
||||
SCSI_REQUEST_BLOCK Srb;
|
||||
PUCHAR Buffer;
|
||||
ULONG Length;
|
||||
PCDB Cdb;
|
||||
#endif
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("CdromClassCreateDeviceObject() called\n");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile,v 1.2 2003/04/05 09:37:43 chorns Exp $
|
||||
# $Id: makefile,v 1.3 2003/11/13 14:18:26 ekohl Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
|
@ -12,6 +12,8 @@ TARGET_DDKLIBS = class2.a
|
|||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
TARGET_CFLAGS = -Werror -Wall
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: class2.c,v 1.45 2003/11/11 15:31:31 ekohl Exp $
|
||||
/* $Id: class2.c,v 1.46 2003/11/13 14:18:53 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -729,7 +729,6 @@ ScsiClassFindUnclaimedDevices(IN PCLASS_INIT_DATA InitializationData,
|
|||
PUCHAR Buffer;
|
||||
ULONG Bus;
|
||||
ULONG UnclaimedDevices = 0;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("ScsiClassFindUnclaimedDevices() called\n");
|
||||
|
||||
|
@ -1028,7 +1027,6 @@ ScsiClassInterpretSenseInfo(IN PDEVICE_OBJECT DeviceObject,
|
|||
PIO_ERROR_LOG_PACKET LogPacket;
|
||||
#endif
|
||||
PSENSE_DATA SenseData;
|
||||
NTSTATUS LogStatus;
|
||||
BOOLEAN LogError;
|
||||
BOOLEAN Retry;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile,v 1.4 2003/04/05 09:37:43 chorns Exp $
|
||||
# $Id: makefile,v 1.5 2003/11/13 14:18:53 ekohl Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
|
@ -10,6 +10,8 @@ TARGET_NAME = class2
|
|||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
TARGET_CFLAGS = -Werror -Wall
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: disk.c,v 1.32 2003/07/23 18:45:08 ekohl Exp $
|
||||
/* $Id: disk.c,v 1.33 2003/11/13 14:19:23 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -1714,7 +1714,9 @@ ScsiDiskUpdateFixedDiskGeometry(IN PDEVICE_EXTENSION DeviceExtension)
|
|||
HANDLE BusKey;
|
||||
ULONG DiskNumber;
|
||||
ULONG Length;
|
||||
#if 0
|
||||
ULONG i;
|
||||
#endif
|
||||
ULONG Cylinders;
|
||||
ULONG Sectors;
|
||||
ULONG SectorsPerTrack;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile,v 1.3 2003/04/05 09:37:43 chorns Exp $
|
||||
# $Id: makefile,v 1.4 2003/11/13 14:19:23 ekohl Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
|
@ -12,6 +12,8 @@ TARGET_DDKLIBS = class2.a
|
|||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
TARGET_CFLAGS = -Werror -Wall
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile,v 1.5 2003/04/05 09:37:44 chorns Exp $
|
||||
# $Id: makefile,v 1.6 2003/11/13 14:20:03 ekohl Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
|
@ -10,6 +10,8 @@ TARGET_NAME = scsiport
|
|||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
TARGET_CFLAGS = -Werror -Wall
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: scsiport.c,v 1.43 2003/11/01 10:42:32 hbirr Exp $
|
||||
/* $Id: scsiport.c,v 1.44 2003/11/13 14:20:03 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -73,12 +73,6 @@ static VOID STDCALL
|
|||
ScsiPortStartIo(IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
static IO_ALLOCATION_ACTION STDCALL
|
||||
ScsiPortAllocateController(IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp,
|
||||
IN PVOID MapRegisterBase,
|
||||
IN PVOID Context);
|
||||
|
||||
static BOOLEAN STDCALL
|
||||
ScsiPortStartPacket(IN OUT PVOID Context);
|
||||
|
||||
|
@ -127,6 +121,9 @@ static PSCSI_REQUEST_BLOCK
|
|||
ScsiPortInitSenseRequestSrb(PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
|
||||
PSCSI_REQUEST_BLOCK OriginalSrb);
|
||||
|
||||
static VOID
|
||||
ScsiPortFreeSenseRequestSrb(PSCSI_PORT_DEVICE_EXTENSION DeviceExtension);
|
||||
|
||||
static NTSTATUS
|
||||
SpiBuildDeviceMap (PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
|
||||
PUNICODE_STRING RegistryPath);
|
||||
|
@ -471,6 +468,7 @@ ScsiPortGetSrb(IN PVOID DeviceExtension,
|
|||
{
|
||||
DPRINT1("ScsiPortGetSrb()\n");
|
||||
UNIMPLEMENTED;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -610,7 +608,7 @@ ScsiPortInitialize(IN PVOID Argument1,
|
|||
IN PVOID HwContext)
|
||||
{
|
||||
PDRIVER_OBJECT DriverObject = (PDRIVER_OBJECT)Argument1;
|
||||
PUNICODE_STRING RegistryPath = (PUNICODE_STRING)Argument2;
|
||||
// PUNICODE_STRING RegistryPath = (PUNICODE_STRING)Argument2;
|
||||
PSCSI_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||
PCONFIGURATION_INFORMATION SystemConfig;
|
||||
PPORT_CONFIGURATION_INFORMATION PortConfig;
|
||||
|
@ -1544,7 +1542,6 @@ ScsiPortStartIo(IN PDEVICE_OBJECT DeviceObject,
|
|||
PIO_STACK_LOCATION IrpStack;
|
||||
PSCSI_REQUEST_BLOCK Srb;
|
||||
KIRQL oldIrql;
|
||||
BOOLEAN Result;
|
||||
|
||||
DPRINT("ScsiPortStartIo() called!\n");
|
||||
|
||||
|
@ -1563,16 +1560,16 @@ ScsiPortStartIo(IN PDEVICE_OBJECT DeviceObject,
|
|||
IoCompleteRequest (Irp,
|
||||
IO_NO_INCREMENT);
|
||||
if (oldIrql < DISPATCH_LEVEL)
|
||||
{
|
||||
KeRaiseIrql (DISPATCH_LEVEL,
|
||||
&oldIrql);
|
||||
IoStartNextPacket (DeviceObject,
|
||||
FALSE);
|
||||
KeLowerIrql(oldIrql);
|
||||
{
|
||||
KeRaiseIrql (DISPATCH_LEVEL,
|
||||
&oldIrql);
|
||||
IoStartNextPacket (DeviceObject,
|
||||
FALSE);
|
||||
KeLowerIrql (oldIrql);
|
||||
}
|
||||
else
|
||||
{
|
||||
IoStartNextPacket (DeviceObject,
|
||||
{
|
||||
IoStartNextPacket (DeviceObject,
|
||||
FALSE);
|
||||
}
|
||||
return;
|
||||
|
@ -1592,16 +1589,16 @@ ScsiPortStartIo(IN PDEVICE_OBJECT DeviceObject,
|
|||
IoCompleteRequest (Irp,
|
||||
IO_NO_INCREMENT);
|
||||
if (oldIrql < DISPATCH_LEVEL)
|
||||
{
|
||||
KeRaiseIrql (DISPATCH_LEVEL,
|
||||
&oldIrql);
|
||||
IoStartNextPacket (DeviceObject,
|
||||
FALSE);
|
||||
KeLowerIrql(oldIrql);
|
||||
{
|
||||
KeRaiseIrql (DISPATCH_LEVEL,
|
||||
&oldIrql);
|
||||
IoStartNextPacket (DeviceObject,
|
||||
FALSE);
|
||||
KeLowerIrql (oldIrql);
|
||||
}
|
||||
else
|
||||
{
|
||||
IoStartNextPacket (DeviceObject,
|
||||
{
|
||||
IoStartNextPacket (DeviceObject,
|
||||
FALSE);
|
||||
}
|
||||
return;
|
||||
|
@ -1644,16 +1641,16 @@ ScsiPortStartIo(IN PDEVICE_OBJECT DeviceObject,
|
|||
IoCompleteRequest(Irp,
|
||||
IO_NO_INCREMENT);
|
||||
if (oldIrql < DISPATCH_LEVEL)
|
||||
{
|
||||
KeRaiseIrql (DISPATCH_LEVEL,
|
||||
&oldIrql);
|
||||
IoStartNextPacket (DeviceObject,
|
||||
FALSE);
|
||||
KeLowerIrql(oldIrql);
|
||||
{
|
||||
KeRaiseIrql (DISPATCH_LEVEL,
|
||||
&oldIrql);
|
||||
IoStartNextPacket (DeviceObject,
|
||||
FALSE);
|
||||
KeLowerIrql (oldIrql);
|
||||
}
|
||||
else
|
||||
{
|
||||
IoStartNextPacket (DeviceObject,
|
||||
{
|
||||
IoStartNextPacket (DeviceObject,
|
||||
FALSE);
|
||||
}
|
||||
}
|
||||
|
@ -1866,7 +1863,6 @@ SpiScanAdapter (IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension)
|
|||
ULONG Bus;
|
||||
ULONG Target;
|
||||
ULONG Lun;
|
||||
BOOLEAN Result;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT ("SpiScanAdapter() called\n");
|
||||
|
@ -2093,7 +2089,7 @@ ScsiPortDpcForIsr(IN PKDPC Dpc,
|
|||
RtlZeroMemory(&DeviceExtension->InternalSenseData, sizeof(SENSE_DATA));
|
||||
|
||||
IrpStack->Parameters.Scsi.Srb = DeviceExtension->OriginalSrb;
|
||||
DeviceExtension->OriginalSrb = NULL;
|
||||
ScsiPortFreeSenseRequestSrb (DeviceExtension);
|
||||
}
|
||||
else if ((SRB_STATUS(Srb->SrbStatus) != SRB_STATUS_SUCCESS) &&
|
||||
(Srb->ScsiStatus == SCSISTAT_CHECK_CONDITION))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue