mirror of
https://github.com/reactos/reactos.git
synced 2025-08-01 22:13:04 +00:00
[FLOPPY]
Formatting only, no code changes. svn path=/trunk/; revision=51410
This commit is contained in:
parent
057f42a554
commit
1e27c057e4
10 changed files with 1936 additions and 1884 deletions
|
@ -56,9 +56,9 @@ KSEMAPHORE QueueSemaphore;
|
|||
* CSQ Callbacks
|
||||
*/
|
||||
|
||||
|
||||
VOID NTAPI CsqRemoveIrp(PIO_CSQ UnusedCsq,
|
||||
PIRP Irp)
|
||||
|
||||
VOID NTAPI
|
||||
CsqRemoveIrp(PIO_CSQ UnusedCsq, PIRP Irp)
|
||||
/*
|
||||
* FUNCTION: Remove an IRP from the queue
|
||||
* ARGUMENTS:
|
||||
|
@ -68,15 +68,14 @@ VOID NTAPI CsqRemoveIrp(PIO_CSQ UnusedCsq,
|
|||
* - Called under the protection of the queue lock
|
||||
*/
|
||||
{
|
||||
UNREFERENCED_PARAMETER(UnusedCsq);
|
||||
TRACE_(FLOPPY, "CSQ: Removing IRP 0x%p\n", Irp);
|
||||
RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
|
||||
UNREFERENCED_PARAMETER(UnusedCsq);
|
||||
TRACE_(FLOPPY, "CSQ: Removing IRP 0x%p\n", Irp);
|
||||
RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
|
||||
}
|
||||
|
||||
|
||||
PIRP NTAPI CsqPeekNextIrp(PIO_CSQ UnusedCsq,
|
||||
PIRP Irp,
|
||||
PVOID PeekContext)
|
||||
|
||||
PIRP NTAPI
|
||||
CsqPeekNextIrp(PIO_CSQ UnusedCsq, PIRP Irp, PVOID PeekContext)
|
||||
/*
|
||||
* FUNCTION: Find the next matching IRP in the queue
|
||||
* ARGUMENTS:
|
||||
|
@ -90,22 +89,22 @@ PIRP NTAPI CsqPeekNextIrp(PIO_CSQ UnusedCsq,
|
|||
* - Called under the protection of the queue lock
|
||||
*/
|
||||
{
|
||||
UNREFERENCED_PARAMETER(UnusedCsq);
|
||||
UNREFERENCED_PARAMETER(PeekContext);
|
||||
TRACE_(FLOPPY, "CSQ: Peeking for next IRP\n");
|
||||
UNREFERENCED_PARAMETER(UnusedCsq);
|
||||
UNREFERENCED_PARAMETER(PeekContext);
|
||||
TRACE_(FLOPPY, "CSQ: Peeking for next IRP\n");
|
||||
|
||||
if(Irp)
|
||||
return CONTAINING_RECORD(&Irp->Tail.Overlay.ListEntry.Flink, IRP, Tail.Overlay.ListEntry);
|
||||
if(Irp)
|
||||
return CONTAINING_RECORD(&Irp->Tail.Overlay.ListEntry.Flink, IRP, Tail.Overlay.ListEntry);
|
||||
|
||||
if(IsListEmpty(&IrpQueue))
|
||||
return NULL;
|
||||
if(IsListEmpty(&IrpQueue))
|
||||
return NULL;
|
||||
|
||||
return CONTAINING_RECORD(IrpQueue.Flink, IRP, Tail.Overlay.ListEntry);
|
||||
return CONTAINING_RECORD(IrpQueue.Flink, IRP, Tail.Overlay.ListEntry);
|
||||
}
|
||||
|
||||
|
||||
VOID NTAPI CsqAcquireLock(PIO_CSQ UnusedCsq,
|
||||
PKIRQL Irql)
|
||||
|
||||
VOID NTAPI
|
||||
CsqAcquireLock(PIO_CSQ UnusedCsq, PKIRQL Irql)
|
||||
/*
|
||||
* FUNCTION: Acquire the queue lock
|
||||
* ARGUMENTS:
|
||||
|
@ -113,14 +112,14 @@ VOID NTAPI CsqAcquireLock(PIO_CSQ UnusedCsq,
|
|||
* Irql: Pointer to a variable to store the old irql into
|
||||
*/
|
||||
{
|
||||
UNREFERENCED_PARAMETER(UnusedCsq);
|
||||
INFO_(FLOPPY, "CSQ: Acquiring spin lock\n");
|
||||
KeAcquireSpinLock(&IrpQueueLock, Irql);
|
||||
UNREFERENCED_PARAMETER(UnusedCsq);
|
||||
INFO_(FLOPPY, "CSQ: Acquiring spin lock\n");
|
||||
KeAcquireSpinLock(&IrpQueueLock, Irql);
|
||||
}
|
||||
|
||||
|
||||
VOID NTAPI CsqReleaseLock(PIO_CSQ UnusedCsq,
|
||||
KIRQL Irql)
|
||||
|
||||
VOID NTAPI
|
||||
CsqReleaseLock(PIO_CSQ UnusedCsq, KIRQL Irql)
|
||||
/*
|
||||
* FUNCTION: Release the queue lock
|
||||
* ARGUMENTS:
|
||||
|
@ -128,14 +127,14 @@ VOID NTAPI CsqReleaseLock(PIO_CSQ UnusedCsq,
|
|||
* Irql: IRQL to lower to on release
|
||||
*/
|
||||
{
|
||||
UNREFERENCED_PARAMETER(UnusedCsq);
|
||||
INFO_(FLOPPY, "CSQ: Releasing spin lock\n");
|
||||
KeReleaseSpinLock(&IrpQueueLock, Irql);
|
||||
UNREFERENCED_PARAMETER(UnusedCsq);
|
||||
INFO_(FLOPPY, "CSQ: Releasing spin lock\n");
|
||||
KeReleaseSpinLock(&IrpQueueLock, Irql);
|
||||
}
|
||||
|
||||
|
||||
VOID NTAPI CsqCompleteCanceledIrp(PIO_CSQ UnusedCsq,
|
||||
PIRP Irp)
|
||||
|
||||
VOID NTAPI
|
||||
CsqCompleteCanceledIrp(PIO_CSQ UnusedCsq, PIRP Irp)
|
||||
/*
|
||||
* FUNCTION: Complete a canceled IRP
|
||||
* ARGUMENTS:
|
||||
|
@ -146,16 +145,16 @@ VOID NTAPI CsqCompleteCanceledIrp(PIO_CSQ UnusedCsq,
|
|||
* - MS misspelled CANCELLED... sigh...
|
||||
*/
|
||||
{
|
||||
UNREFERENCED_PARAMETER(UnusedCsq);
|
||||
TRACE_(FLOPPY, "CSQ: Canceling irp 0x%p\n", Irp);
|
||||
Irp->IoStatus.Status = STATUS_CANCELLED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
UNREFERENCED_PARAMETER(UnusedCsq);
|
||||
TRACE_(FLOPPY, "CSQ: Canceling irp 0x%p\n", Irp);
|
||||
Irp->IoStatus.Status = STATUS_CANCELLED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
}
|
||||
|
||||
|
||||
VOID NTAPI CsqInsertIrp(PIO_CSQ UnusedCsq,
|
||||
PIRP Irp)
|
||||
|
||||
VOID NTAPI
|
||||
CsqInsertIrp(PIO_CSQ UnusedCsq, PIRP Irp)
|
||||
/*
|
||||
* FUNCTION: Queue an IRP
|
||||
* ARGUMENTS:
|
||||
|
@ -171,9 +170,9 @@ VOID NTAPI CsqInsertIrp(PIO_CSQ UnusedCsq,
|
|||
* that at least one IRP is canceled at some point
|
||||
*/
|
||||
{
|
||||
UNREFERENCED_PARAMETER(UnusedCsq);
|
||||
TRACE_(FLOPPY, "CSQ: Inserting IRP 0x%p\n", Irp);
|
||||
InsertTailList(&IrpQueue, &Irp->Tail.Overlay.ListEntry);
|
||||
KeReleaseSemaphore(&QueueSemaphore, 0, 1, FALSE);
|
||||
UNREFERENCED_PARAMETER(UnusedCsq);
|
||||
TRACE_(FLOPPY, "CSQ: Inserting IRP 0x%p\n", Irp);
|
||||
InsertTailList(&IrpQueue, &Irp->Tail.Overlay.ListEntry);
|
||||
KeReleaseSemaphore(&QueueSemaphore, 0, 1, FALSE);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,22 +38,21 @@ extern LIST_ENTRY IrpQueue;
|
|||
extern KSPIN_LOCK IrpQueueLock;
|
||||
extern KSEMAPHORE QueueSemaphore;
|
||||
|
||||
VOID NTAPI CsqInsertIrp(PIO_CSQ Csq,
|
||||
PIRP Irp);
|
||||
VOID NTAPI
|
||||
CsqInsertIrp(PIO_CSQ Csq, PIRP Irp);
|
||||
|
||||
VOID NTAPI CsqRemoveIrp(PIO_CSQ Csq,
|
||||
PIRP Irp);
|
||||
VOID NTAPI
|
||||
CsqRemoveIrp(PIO_CSQ Csq, PIRP Irp);
|
||||
|
||||
PIRP NTAPI CsqPeekNextIrp(PIO_CSQ Csq,
|
||||
PIRP Irp,
|
||||
PVOID PeekContext);
|
||||
PIRP NTAPI
|
||||
CsqPeekNextIrp(PIO_CSQ Csq, PIRP Irp, PVOID PeekContext);
|
||||
|
||||
VOID NTAPI CsqAcquireLock(PIO_CSQ Csq,
|
||||
PKIRQL Irql);
|
||||
VOID NTAPI
|
||||
CsqAcquireLock(PIO_CSQ Csq, PKIRQL Irql);
|
||||
|
||||
VOID NTAPI CsqReleaseLock(PIO_CSQ Csq,
|
||||
KIRQL Irql);
|
||||
VOID NTAPI
|
||||
CsqReleaseLock(PIO_CSQ Csq, KIRQL Irql);
|
||||
|
||||
VOID NTAPI CsqCompleteCanceledIrp(PIO_CSQ Csq,
|
||||
PIRP Irp);
|
||||
VOID NTAPI
|
||||
CsqCompleteCanceledIrp(PIO_CSQ Csq, PIRP Irp);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -39,64 +39,68 @@ struct _CONTROLLER_INFO;
|
|||
|
||||
typedef struct _DRIVE_INFO
|
||||
{
|
||||
struct _CONTROLLER_INFO *ControllerInfo;
|
||||
UCHAR UnitNumber; /* 0,1,2,3 */
|
||||
LARGE_INTEGER MotorStartTime;
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
CM_FLOPPY_DEVICE_DATA FloppyDeviceData;
|
||||
DISK_GEOMETRY DiskGeometry;
|
||||
UCHAR BytesPerSectorCode;
|
||||
WCHAR SymLinkBuffer[MAX_DEVICE_NAME];
|
||||
WCHAR ArcPathBuffer[MAX_ARC_PATH_LEN];
|
||||
ULONG DiskChangeCount;
|
||||
BOOLEAN Initialized;
|
||||
struct _CONTROLLER_INFO *ControllerInfo;
|
||||
UCHAR UnitNumber; /* 0,1,2,3 */
|
||||
LARGE_INTEGER MotorStartTime;
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
CM_FLOPPY_DEVICE_DATA FloppyDeviceData;
|
||||
DISK_GEOMETRY DiskGeometry;
|
||||
UCHAR BytesPerSectorCode;
|
||||
WCHAR SymLinkBuffer[MAX_DEVICE_NAME];
|
||||
WCHAR ArcPathBuffer[MAX_ARC_PATH_LEN];
|
||||
ULONG DiskChangeCount;
|
||||
BOOLEAN Initialized;
|
||||
} DRIVE_INFO, *PDRIVE_INFO;
|
||||
|
||||
typedef struct _CONTROLLER_INFO
|
||||
{
|
||||
BOOLEAN Populated;
|
||||
BOOLEAN Initialized;
|
||||
ULONG ControllerNumber;
|
||||
INTERFACE_TYPE InterfaceType;
|
||||
ULONG BusNumber;
|
||||
ULONG Level;
|
||||
KIRQL MappedLevel;
|
||||
ULONG Vector;
|
||||
ULONG MappedVector;
|
||||
KINTERRUPT_MODE InterruptMode;
|
||||
PUCHAR BaseAddress;
|
||||
ULONG Dma;
|
||||
ULONG MapRegisters;
|
||||
PVOID MapRegisterBase;
|
||||
BOOLEAN Master;
|
||||
KEVENT SynchEvent;
|
||||
KDPC Dpc;
|
||||
PKINTERRUPT InterruptObject;
|
||||
PADAPTER_OBJECT AdapterObject;
|
||||
UCHAR NumberOfDrives;
|
||||
BOOLEAN ImpliedSeeks;
|
||||
DRIVE_INFO DriveInfo[MAX_DRIVES_PER_CONTROLLER];
|
||||
PDRIVE_INFO CurrentDrive;
|
||||
BOOLEAN Model30;
|
||||
KEVENT MotorStoppedEvent;
|
||||
KTIMER MotorTimer;
|
||||
KDPC MotorStopDpc;
|
||||
BOOLEAN StopDpcQueued;
|
||||
BOOLEAN Populated;
|
||||
BOOLEAN Initialized;
|
||||
ULONG ControllerNumber;
|
||||
INTERFACE_TYPE InterfaceType;
|
||||
ULONG BusNumber;
|
||||
ULONG Level;
|
||||
KIRQL MappedLevel;
|
||||
ULONG Vector;
|
||||
ULONG MappedVector;
|
||||
KINTERRUPT_MODE InterruptMode;
|
||||
PUCHAR BaseAddress;
|
||||
ULONG Dma;
|
||||
ULONG MapRegisters;
|
||||
PVOID MapRegisterBase;
|
||||
BOOLEAN Master;
|
||||
KEVENT SynchEvent;
|
||||
KDPC Dpc;
|
||||
PKINTERRUPT InterruptObject;
|
||||
PADAPTER_OBJECT AdapterObject;
|
||||
UCHAR NumberOfDrives;
|
||||
BOOLEAN ImpliedSeeks;
|
||||
DRIVE_INFO DriveInfo[MAX_DRIVES_PER_CONTROLLER];
|
||||
PDRIVE_INFO CurrentDrive;
|
||||
BOOLEAN Model30;
|
||||
KEVENT MotorStoppedEvent;
|
||||
KTIMER MotorTimer;
|
||||
KDPC MotorStopDpc;
|
||||
BOOLEAN StopDpcQueued;
|
||||
} CONTROLLER_INFO, *PCONTROLLER_INFO;
|
||||
|
||||
NTSTATUS NTAPI DriverEntry(PDRIVER_OBJECT DriverObject,
|
||||
PUNICODE_STRING RegistryPath);
|
||||
NTSTATUS NTAPI
|
||||
DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath);
|
||||
|
||||
VOID NTAPI SignalMediaChanged(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp);
|
||||
VOID NTAPI
|
||||
SignalMediaChanged(PDEVICE_OBJECT DeviceObject, PIRP Irp);
|
||||
|
||||
VOID NTAPI WaitForControllerInterrupt(PCONTROLLER_INFO ControllerInfo);
|
||||
VOID NTAPI
|
||||
WaitForControllerInterrupt(PCONTROLLER_INFO ControllerInfo);
|
||||
|
||||
NTSTATUS NTAPI ResetChangeFlag(PDRIVE_INFO DriveInfo);
|
||||
NTSTATUS NTAPI
|
||||
ResetChangeFlag(PDRIVE_INFO DriveInfo);
|
||||
|
||||
VOID NTAPI StartMotor(PDRIVE_INFO DriveInfo);
|
||||
VOID NTAPI
|
||||
StartMotor(PDRIVE_INFO DriveInfo);
|
||||
|
||||
VOID NTAPI StopMotor(PCONTROLLER_INFO ControllerInfo);
|
||||
VOID NTAPI
|
||||
StopMotor(PCONTROLLER_INFO ControllerInfo);
|
||||
|
||||
/*
|
||||
* MEDIA TYPES
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -260,76 +260,94 @@
|
|||
/*
|
||||
* FUNCTIONS
|
||||
*/
|
||||
NTSTATUS NTAPI HwTurnOnMotor(PDRIVE_INFO DriveInfo);
|
||||
NTSTATUS NTAPI
|
||||
HwTurnOnMotor(PDRIVE_INFO DriveInfo);
|
||||
|
||||
NTSTATUS NTAPI HwSenseDriveStatus(PDRIVE_INFO DriveInfo);
|
||||
NTSTATUS NTAPI
|
||||
HwSenseDriveStatus(PDRIVE_INFO DriveInfo);
|
||||
|
||||
NTSTATUS NTAPI HwReadWriteData(PCONTROLLER_INFO ControllerInfo,
|
||||
BOOLEAN Read,
|
||||
UCHAR Unit,
|
||||
UCHAR Cylinder,
|
||||
UCHAR Head,
|
||||
UCHAR Sector,
|
||||
UCHAR BytesPerSector,
|
||||
UCHAR EndOfTrack,
|
||||
UCHAR Gap3Length,
|
||||
UCHAR DataLength);
|
||||
NTSTATUS NTAPI
|
||||
HwReadWriteData(PCONTROLLER_INFO ControllerInfo,
|
||||
BOOLEAN Read,
|
||||
UCHAR Unit,
|
||||
UCHAR Cylinder,
|
||||
UCHAR Head,
|
||||
UCHAR Sector,
|
||||
UCHAR BytesPerSector,
|
||||
UCHAR EndOfTrack,
|
||||
UCHAR Gap3Length,
|
||||
UCHAR DataLength);
|
||||
|
||||
NTSTATUS NTAPI HwRecalibrate(PDRIVE_INFO DriveInfo);
|
||||
NTSTATUS NTAPI
|
||||
HwRecalibrate(PDRIVE_INFO DriveInfo);
|
||||
|
||||
NTSTATUS NTAPI HwSenseInterruptStatus(PCONTROLLER_INFO ControllerInfo);
|
||||
NTSTATUS NTAPI
|
||||
HwSenseInterruptStatus(PCONTROLLER_INFO ControllerInfo);
|
||||
|
||||
NTSTATUS NTAPI HwReadId(PDRIVE_INFO DriveInfo,
|
||||
UCHAR Head);
|
||||
NTSTATUS NTAPI
|
||||
HwReadId(PDRIVE_INFO DriveInfo, UCHAR Head);
|
||||
|
||||
NTSTATUS NTAPI HwFormatTrack(PCONTROLLER_INFO ControllerInfo,
|
||||
UCHAR Unit,
|
||||
UCHAR Head,
|
||||
UCHAR BytesPerSector,
|
||||
UCHAR SectorsPerTrack,
|
||||
UCHAR Gap3Length,
|
||||
UCHAR FillerPattern);
|
||||
NTSTATUS NTAPI
|
||||
HwFormatTrack(PCONTROLLER_INFO ControllerInfo,
|
||||
UCHAR Unit,
|
||||
UCHAR Head,
|
||||
UCHAR BytesPerSector,
|
||||
UCHAR SectorsPerTrack,
|
||||
UCHAR Gap3Length,
|
||||
UCHAR FillerPattern);
|
||||
|
||||
NTSTATUS NTAPI HwSeek(PDRIVE_INFO DriveInfo,
|
||||
UCHAR Cylinder);
|
||||
NTSTATUS NTAPI
|
||||
HwSeek(PDRIVE_INFO DriveInfo, UCHAR Cylinder);
|
||||
|
||||
NTSTATUS NTAPI HwReadWriteResult(PCONTROLLER_INFO ControllerInfo);
|
||||
NTSTATUS NTAPI
|
||||
HwReadWriteResult(PCONTROLLER_INFO ControllerInfo);
|
||||
|
||||
NTSTATUS NTAPI HwGetVersion(PCONTROLLER_INFO ControllerInfo);
|
||||
NTSTATUS NTAPI
|
||||
HwGetVersion(PCONTROLLER_INFO ControllerInfo);
|
||||
|
||||
NTSTATUS NTAPI HwConfigure(PCONTROLLER_INFO ControllerInfo,
|
||||
BOOLEAN EIS,
|
||||
BOOLEAN EFIFO,
|
||||
BOOLEAN POLL,
|
||||
UCHAR FIFOTHR,
|
||||
UCHAR PRETRK) ;
|
||||
NTSTATUS NTAPI
|
||||
HwConfigure(PCONTROLLER_INFO ControllerInfo,
|
||||
BOOLEAN EIS,
|
||||
BOOLEAN EFIFO,
|
||||
BOOLEAN POLL,
|
||||
UCHAR FIFOTHR,
|
||||
UCHAR PRETRK) ;
|
||||
|
||||
NTSTATUS NTAPI HwRecalibrateResult(PCONTROLLER_INFO ControllerInfo);
|
||||
NTSTATUS NTAPI
|
||||
HwRecalibrateResult(PCONTROLLER_INFO ControllerInfo);
|
||||
|
||||
NTSTATUS NTAPI HwDiskChanged(PDRIVE_INFO DriveInfo,
|
||||
PBOOLEAN DiskChanged);
|
||||
NTSTATUS NTAPI
|
||||
HwDiskChanged(PDRIVE_INFO DriveInfo,
|
||||
PBOOLEAN DiskChanged);
|
||||
|
||||
NTSTATUS NTAPI HwSenseDriveStatusResult(PCONTROLLER_INFO ControllerInfo,
|
||||
PUCHAR Status);
|
||||
NTSTATUS NTAPI
|
||||
HwSenseDriveStatusResult(PCONTROLLER_INFO ControllerInfo,
|
||||
PUCHAR Status);
|
||||
|
||||
NTSTATUS NTAPI HwSpecify(PCONTROLLER_INFO ControllerInfo,
|
||||
UCHAR HeadLoadTime,
|
||||
UCHAR HeadUnloadTime,
|
||||
UCHAR StepRateTime,
|
||||
BOOLEAN NonDma);
|
||||
NTSTATUS NTAPI
|
||||
HwSpecify(PCONTROLLER_INFO ControllerInfo,
|
||||
UCHAR HeadLoadTime,
|
||||
UCHAR HeadUnloadTime,
|
||||
UCHAR StepRateTime,
|
||||
BOOLEAN NonDma);
|
||||
|
||||
NTSTATUS NTAPI HwReadIdResult(PCONTROLLER_INFO ControllerInfo,
|
||||
PUCHAR CurCylinder,
|
||||
PUCHAR CurHead);
|
||||
NTSTATUS NTAPI
|
||||
HwReadIdResult(PCONTROLLER_INFO ControllerInfo,
|
||||
PUCHAR CurCylinder,
|
||||
PUCHAR CurHead);
|
||||
|
||||
NTSTATUS NTAPI HwSetDataRate(PCONTROLLER_INFO ControllerInfo,
|
||||
UCHAR DataRate);
|
||||
NTSTATUS NTAPI
|
||||
HwSetDataRate(PCONTROLLER_INFO ControllerInfo, UCHAR DataRate);
|
||||
|
||||
NTSTATUS NTAPI HwReset(PCONTROLLER_INFO Controller);
|
||||
NTSTATUS NTAPI
|
||||
HwReset(PCONTROLLER_INFO Controller);
|
||||
|
||||
NTSTATUS NTAPI HwPowerOff(PCONTROLLER_INFO ControllerInfo);
|
||||
NTSTATUS NTAPI
|
||||
HwPowerOff(PCONTROLLER_INFO ControllerInfo);
|
||||
|
||||
VOID NTAPI HwDumpRegisters(PCONTROLLER_INFO ControllerInfo);
|
||||
VOID NTAPI
|
||||
HwDumpRegisters(PCONTROLLER_INFO ControllerInfo);
|
||||
|
||||
NTSTATUS NTAPI HwTurnOffMotor(PCONTROLLER_INFO ControllerInfo);
|
||||
NTSTATUS NTAPI
|
||||
HwTurnOffMotor(PCONTROLLER_INFO ControllerInfo);
|
||||
|
||||
|
|
|
@ -39,9 +39,9 @@
|
|||
#include "csqrtns.h"
|
||||
#include "ioctl.h"
|
||||
|
||||
|
||||
NTSTATUS NTAPI DeviceIoctl(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
|
||||
NTSTATUS NTAPI
|
||||
DeviceIoctl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||
/*
|
||||
* FUNCTION: Queue IOCTL IRPs
|
||||
* ARGUMENTS:
|
||||
|
@ -55,18 +55,18 @@ NTSTATUS NTAPI DeviceIoctl(PDEVICE_OBJECT DeviceObject,
|
|||
* read/write or ioctl irps.
|
||||
*/
|
||||
{
|
||||
ASSERT(DeviceObject);
|
||||
ASSERT(Irp);
|
||||
ASSERT(DeviceObject);
|
||||
ASSERT(Irp);
|
||||
|
||||
Irp->Tail.Overlay.DriverContext[0] = DeviceObject;
|
||||
IoCsqInsertIrp(&Csq, Irp, NULL);
|
||||
Irp->Tail.Overlay.DriverContext[0] = DeviceObject;
|
||||
IoCsqInsertIrp(&Csq, Irp, NULL);
|
||||
|
||||
return STATUS_PENDING;
|
||||
return STATUS_PENDING;
|
||||
}
|
||||
|
||||
|
||||
VOID NTAPI DeviceIoctlPassive(PDRIVE_INFO DriveInfo,
|
||||
PIRP Irp)
|
||||
|
||||
VOID NTAPI
|
||||
DeviceIoctlPassive(PDRIVE_INFO DriveInfo, PIRP Irp)
|
||||
/*
|
||||
* FUNCTION: Handlees IOCTL requests at PASSIVE_LEVEL
|
||||
* ARGUMENTS:
|
||||
|
@ -74,108 +74,108 @@ VOID NTAPI DeviceIoctlPassive(PDRIVE_INFO DriveInfo,
|
|||
* Irp: IRP with the request in it
|
||||
*/
|
||||
{
|
||||
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
ULONG OutputLength = Stack->Parameters.DeviceIoControl.OutputBufferLength;
|
||||
PVOID OutputBuffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
ULONG Code = Stack->Parameters.DeviceIoControl.IoControlCode;
|
||||
BOOLEAN DiskChanged;
|
||||
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
ULONG OutputLength = Stack->Parameters.DeviceIoControl.OutputBufferLength;
|
||||
PVOID OutputBuffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
ULONG Code = Stack->Parameters.DeviceIoControl.IoControlCode;
|
||||
BOOLEAN DiskChanged;
|
||||
|
||||
TRACE_(FLOPPY, "DeviceIoctl called\n");
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
TRACE_(FLOPPY, "DeviceIoctl called\n");
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
/*
|
||||
* First the non-change-sensitive ioctls
|
||||
*/
|
||||
if(Code == IOCTL_DISK_GET_MEDIA_TYPES)
|
||||
/*
|
||||
* First the non-change-sensitive ioctls
|
||||
*/
|
||||
if(Code == IOCTL_DISK_GET_MEDIA_TYPES)
|
||||
{
|
||||
PDISK_GEOMETRY Geometry = OutputBuffer;
|
||||
INFO_(FLOPPY, "IOCTL_DISK_GET_MEDIA_TYPES Called\n");
|
||||
PDISK_GEOMETRY Geometry = OutputBuffer;
|
||||
INFO_(FLOPPY, "IOCTL_DISK_GET_MEDIA_TYPES Called\n");
|
||||
|
||||
if(OutputLength < sizeof(DISK_GEOMETRY))
|
||||
if(OutputLength < sizeof(DISK_GEOMETRY))
|
||||
{
|
||||
INFO_(FLOPPY, "IOCTL_DISK_GET_MEDIA_TYPES: insufficient buffer; returning STATUS_INVALID_PARAMETER\n");
|
||||
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return;
|
||||
INFO_(FLOPPY, "IOCTL_DISK_GET_MEDIA_TYPES: insufficient buffer; returning STATUS_INVALID_PARAMETER\n");
|
||||
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* for now, this driver only supports 3.5" HD media
|
||||
*/
|
||||
Geometry->MediaType = F3_1Pt44_512;
|
||||
Geometry->Cylinders.QuadPart = 80;
|
||||
Geometry->TracksPerCylinder = 2 * 18;
|
||||
Geometry->SectorsPerTrack = 18;
|
||||
Geometry->BytesPerSector = 512;
|
||||
/*
|
||||
* for now, this driver only supports 3.5" HD media
|
||||
*/
|
||||
Geometry->MediaType = F3_1Pt44_512;
|
||||
Geometry->Cylinders.QuadPart = 80;
|
||||
Geometry->TracksPerCylinder = 2 * 18;
|
||||
Geometry->SectorsPerTrack = 18;
|
||||
Geometry->BytesPerSector = 512;
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = sizeof(DISK_GEOMETRY);
|
||||
INFO_(FLOPPY, "Ioctl: completing with STATUS_SUCCESS\n");
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = sizeof(DISK_GEOMETRY);
|
||||
INFO_(FLOPPY, "Ioctl: completing with STATUS_SUCCESS\n");
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now, check to see if the volume needs to be verified. If so,
|
||||
* return STATUS_VERIFY_REQUIRED.
|
||||
*
|
||||
* NOTE: This code, which is outside of the switch and if/else blocks,
|
||||
* will implicity catch and correctly service IOCTL_DISK_CHECK_VERIFY.
|
||||
* Therefore if we see one below in the switch, we can return STATUS_SUCCESS
|
||||
* immediately.
|
||||
*/
|
||||
if(DriveInfo->DeviceObject->Flags & DO_VERIFY_VOLUME && !(DriveInfo->DeviceObject->Flags & SL_OVERRIDE_VERIFY_VOLUME))
|
||||
/*
|
||||
* Now, check to see if the volume needs to be verified. If so,
|
||||
* return STATUS_VERIFY_REQUIRED.
|
||||
*
|
||||
* NOTE: This code, which is outside of the switch and if/else blocks,
|
||||
* will implicity catch and correctly service IOCTL_DISK_CHECK_VERIFY.
|
||||
* Therefore if we see one below in the switch, we can return STATUS_SUCCESS
|
||||
* immediately.
|
||||
*/
|
||||
if(DriveInfo->DeviceObject->Flags & DO_VERIFY_VOLUME && !(DriveInfo->DeviceObject->Flags & SL_OVERRIDE_VERIFY_VOLUME))
|
||||
{
|
||||
INFO_(FLOPPY, "DeviceIoctl(): completing with STATUS_VERIFY_REQUIRED\n");
|
||||
Irp->IoStatus.Status = STATUS_VERIFY_REQUIRED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return;
|
||||
INFO_(FLOPPY, "DeviceIoctl(): completing with STATUS_VERIFY_REQUIRED\n");
|
||||
Irp->IoStatus.Status = STATUS_VERIFY_REQUIRED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Start the drive to see if the disk has changed
|
||||
*/
|
||||
StartMotor(DriveInfo);
|
||||
/*
|
||||
* Start the drive to see if the disk has changed
|
||||
*/
|
||||
StartMotor(DriveInfo);
|
||||
|
||||
/*
|
||||
* Check the change line, and if it's set, return
|
||||
*/
|
||||
if(HwDiskChanged(DriveInfo, &DiskChanged) != STATUS_SUCCESS)
|
||||
/*
|
||||
* Check the change line, and if it's set, return
|
||||
*/
|
||||
if(HwDiskChanged(DriveInfo, &DiskChanged) != STATUS_SUCCESS)
|
||||
{
|
||||
WARN_(FLOPPY, "DeviceIoctl(): unable to sense disk change; completing with STATUS_UNSUCCESSFUL\n");
|
||||
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
StopMotor(DriveInfo->ControllerInfo);
|
||||
return;
|
||||
WARN_(FLOPPY, "DeviceIoctl(): unable to sense disk change; completing with STATUS_UNSUCCESSFUL\n");
|
||||
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
StopMotor(DriveInfo->ControllerInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
if(DiskChanged)
|
||||
if(DiskChanged)
|
||||
{
|
||||
INFO_(FLOPPY, "DeviceIoctl(): detected disk changed; signalling media change and completing\n");
|
||||
SignalMediaChanged(DriveInfo->DeviceObject, Irp);
|
||||
INFO_(FLOPPY, "DeviceIoctl(): detected disk changed; signalling media change and completing\n");
|
||||
SignalMediaChanged(DriveInfo->DeviceObject, Irp);
|
||||
|
||||
/*
|
||||
* Just guessing here - I have a choice of returning NO_MEDIA or VERIFY_REQUIRED. If there's
|
||||
* really no disk in the drive, I'm thinking I can save time by just reporting that fact, rather
|
||||
* than forcing windows to ask me twice. If this doesn't work, we'll need to split this up and
|
||||
* handle the CHECK_VERIFY IOCTL separately.
|
||||
*/
|
||||
if(ResetChangeFlag(DriveInfo) == STATUS_NO_MEDIA_IN_DEVICE)
|
||||
Irp->IoStatus.Status = STATUS_NO_MEDIA_IN_DEVICE;
|
||||
/*
|
||||
* Just guessing here - I have a choice of returning NO_MEDIA or VERIFY_REQUIRED. If there's
|
||||
* really no disk in the drive, I'm thinking I can save time by just reporting that fact, rather
|
||||
* than forcing windows to ask me twice. If this doesn't work, we'll need to split this up and
|
||||
* handle the CHECK_VERIFY IOCTL separately.
|
||||
*/
|
||||
if(ResetChangeFlag(DriveInfo) == STATUS_NO_MEDIA_IN_DEVICE)
|
||||
Irp->IoStatus.Status = STATUS_NO_MEDIA_IN_DEVICE;
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
StopMotor(DriveInfo->ControllerInfo);
|
||||
return;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
StopMotor(DriveInfo->ControllerInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
switch(Code)
|
||||
switch(Code)
|
||||
{
|
||||
case IOCTL_DISK_IS_WRITABLE:
|
||||
{
|
||||
{
|
||||
UCHAR Status;
|
||||
|
||||
INFO_(FLOPPY, "IOCTL_DISK_IS_WRITABLE Called\n");
|
||||
|
@ -184,93 +184,93 @@ VOID NTAPI DeviceIoctlPassive(PDRIVE_INFO DriveInfo,
|
|||
Irp->IoStatus.Information = 0;
|
||||
|
||||
if(HwSenseDriveStatus(DriveInfo) != STATUS_SUCCESS)
|
||||
{
|
||||
WARN_(FLOPPY, "IoctlDiskIsWritable(): unable to sense drive status\n");
|
||||
Irp->IoStatus.Status = STATUS_IO_DEVICE_ERROR;
|
||||
break;
|
||||
}
|
||||
{
|
||||
WARN_(FLOPPY, "IoctlDiskIsWritable(): unable to sense drive status\n");
|
||||
Irp->IoStatus.Status = STATUS_IO_DEVICE_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Now, read the drive's status back */
|
||||
if(HwSenseDriveStatusResult(DriveInfo->ControllerInfo, &Status) != STATUS_SUCCESS)
|
||||
{
|
||||
WARN_(FLOPPY, "IoctlDiskIsWritable(): unable to read drive status result\n");
|
||||
Irp->IoStatus.Status = STATUS_IO_DEVICE_ERROR;
|
||||
break;
|
||||
}
|
||||
/* Now, read the drive's status back */
|
||||
if(HwSenseDriveStatusResult(DriveInfo->ControllerInfo, &Status) != STATUS_SUCCESS)
|
||||
{
|
||||
WARN_(FLOPPY, "IoctlDiskIsWritable(): unable to read drive status result\n");
|
||||
Irp->IoStatus.Status = STATUS_IO_DEVICE_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check to see if the write flag is set. */
|
||||
if(Status & SR3_WRITE_PROTECT_STATUS_SIGNAL)
|
||||
{
|
||||
{
|
||||
INFO_(FLOPPY, "IOCTL_DISK_IS_WRITABLE: disk is write protected\n");
|
||||
Irp->IoStatus.Status = STATUS_MEDIA_WRITE_PROTECTED;
|
||||
}
|
||||
}
|
||||
else
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
|
||||
case IOCTL_DISK_CHECK_VERIFY:
|
||||
INFO_(FLOPPY, "IOCTL_DISK_CHECK_VERIFY called\n");
|
||||
if (OutputLength != 0)
|
||||
INFO_(FLOPPY, "IOCTL_DISK_CHECK_VERIFY called\n");
|
||||
if (OutputLength != 0)
|
||||
{
|
||||
if (OutputLength < sizeof(ULONG))
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
|
||||
Irp->IoStatus.Information = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*((PULONG)OutputBuffer) = DriveInfo->DiskChangeCount;
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = sizeof(ULONG);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (OutputLength < sizeof(ULONG))
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
|
||||
Irp->IoStatus.Information = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*((PULONG)OutputBuffer) = DriveInfo->DiskChangeCount;
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = sizeof(ULONG);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
}
|
||||
break;
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case IOCTL_DISK_GET_DRIVE_GEOMETRY:
|
||||
{
|
||||
{
|
||||
INFO_(FLOPPY, "IOCTL_DISK_GET_DRIVE_GEOMETRY Called\n");
|
||||
if(OutputLength < sizeof(DISK_GEOMETRY))
|
||||
{
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* This still works right even if DriveInfo->DiskGeometry->MediaType = Unknown */
|
||||
memcpy(OutputBuffer, &DriveInfo->DiskGeometry, sizeof(DISK_GEOMETRY));
|
||||
/* This still works right even if DriveInfo->DiskGeometry->MediaType = Unknown */
|
||||
memcpy(OutputBuffer, &DriveInfo->DiskGeometry, sizeof(DISK_GEOMETRY));
|
||||
Irp->IoStatus.Information = sizeof(DISK_GEOMETRY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
case IOCTL_DISK_FORMAT_TRACKS:
|
||||
case IOCTL_DISK_FORMAT_TRACKS_EX:
|
||||
ERR_(FLOPPY, "Format called; not supported yet\n");
|
||||
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
break;
|
||||
ERR_(FLOPPY, "Format called; not supported yet\n");
|
||||
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
break;
|
||||
|
||||
case IOCTL_DISK_GET_PARTITION_INFO:
|
||||
INFO_(FLOPPY, "IOCTL_DISK_GET_PARTITION_INFO Called; not supported by a floppy driver\n");
|
||||
Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||
Irp->IoStatus.Information = 0;
|
||||
break;
|
||||
INFO_(FLOPPY, "IOCTL_DISK_GET_PARTITION_INFO Called; not supported by a floppy driver\n");
|
||||
Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||
Irp->IoStatus.Information = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
ERR_(FLOPPY, "UNKNOWN IOCTL CODE: 0x%x\n", Code);
|
||||
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
break;
|
||||
ERR_(FLOPPY, "UNKNOWN IOCTL CODE: 0x%x\n", Code);
|
||||
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
INFO_(FLOPPY, "ioctl: completing with status 0x%x\n", Irp->IoStatus.Status);
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
INFO_(FLOPPY, "ioctl: completing with status 0x%x\n", Irp->IoStatus.Status);
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
StopMotor(DriveInfo->ControllerInfo);
|
||||
return;
|
||||
StopMotor(DriveInfo->ControllerInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,9 +25,10 @@
|
|||
*/
|
||||
|
||||
DRIVER_DISPATCH DeviceIoctl;
|
||||
NTSTATUS NTAPI DeviceIoctl(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp);
|
||||
|
||||
VOID NTAPI DeviceIoctlPassive(PDRIVE_INFO DriveInfo,
|
||||
PIRP Irp);
|
||||
NTSTATUS NTAPI
|
||||
DeviceIoctl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
|
||||
|
||||
VOID NTAPI
|
||||
DeviceIoctlPassive(PDRIVE_INFO DriveInfo, PIRP Irp);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -25,8 +25,10 @@
|
|||
*/
|
||||
|
||||
DRIVER_DISPATCH ReadWrite;
|
||||
NTSTATUS NTAPI ReadWrite(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp);
|
||||
|
||||
VOID NTAPI ReadWritePassive(PDRIVE_INFO DriveInfo, PIRP Irp);
|
||||
NTSTATUS NTAPI
|
||||
ReadWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp);
|
||||
|
||||
VOID NTAPI
|
||||
ReadWritePassive(PDRIVE_INFO DriveInfo, PIRP Irp);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue