436 ULONG DiskByteOffset;
445 TRACE_(FLOPPY,
"ReadWritePassive called to %s 0x%x bytes from offset 0x%x\n",
449 Stack->Parameters.Write.ByteOffset.u.LowPart));
453 Irp->IoStatus.Information = 0;
461 INFO_(FLOPPY,
"ReadWritePassive(): DO_VERIFY_VOLUME set; Completing with STATUS_VERIFY_REQUIRED\n");
473 WARN_(FLOPPY,
"ReadWritePassive(): unable to detect disk change; Completing with STATUS_UNSUCCESSFUL\n");
481 INFO_(FLOPPY,
"ReadWritePhase1(): signalling media changed; Completing with STATUS_MEDIA_CHANGED\n");
504 WARN_(FLOPPY,
"ReadWritePassive(): unable to determine media type; completing with STATUS_UNSUCCESSFUL\n");
512 WARN_(FLOPPY,
"ReadWritePassive(): Unknown media in drive; completing with STATUS_UNRECOGNIZED_MEDIA\n");
524 DiskByteOffset =
Stack->Parameters.Read.ByteOffset.u.LowPart;
530 DiskByteOffset =
Stack->Parameters.Write.ByteOffset.u.LowPart;
612 WARN_(FLOPPY,
"ReadWritePassive(): unable allocate an adapter channel; completing with STATUS_UNSUCCESSFUL\n");
625 TransferByteOffset = 0;
626 while(TransferByteOffset <
Length)
631 ULONG CurrentTransferBytes;
632 UCHAR CurrentTransferSectors;
634 INFO_(FLOPPY,
"ReadWritePassive(): iterating in while (TransferByteOffset = 0x%x of 0x%x total) - allocating %d registers\n",
644 WARN_(FLOPPY,
"ReadWritePassive(): unable to compute CHS; completing with STATUS_UNSUCCESSFUL\n");
658 WARN_(FLOPPY,
"ReadWritePassive(): unable to seek; completing with STATUS_UNSUCCESSFUL\n");
672 INFO_(FLOPPY,
"ReadWritePassive(): computing number of sectors to transfer (StartSector 0x%x): ", StartSector);
685 INFO_(FLOPPY,
"0x%x\n", CurrentTransferSectors);
693 INFO_(FLOPPY,
"ReadWritePassive(): Trying to transfer 0x%x bytes\n", CurrentTransferBytes);
695 ASSERT(CurrentTransferBytes);
704 INFO_(FLOPPY,
"ReadWritePassive: limiting transfer to 0x%x bytes (0x%x sectors) due to map registers\n",
705 CurrentTransferBytes, CurrentTransferSectors);
726 WARN_(FLOPPY,
"ReadWritePassive(): HwReadWriteData returned failure; unable to read; completing with STATUS_UNSUCCESSFUL\n");
733 INFO_(FLOPPY,
"ReadWritePassive(): HwReadWriteData returned -- waiting on event\n");
750 WARN_(FLOPPY,
"ReadWritePassive(): HwReadWriteResult returned failure; unable to read; completing with STATUS_UNSUCCESSFUL\n");
758 TransferByteOffset += CurrentTransferBytes;
764 INFO_(FLOPPY,
"ReadWritePassive(): success; Completing with STATUS_SUCCESS\n");
#define STATUS_NO_MEDIA_IN_DEVICE
#define KeRaiseIrql(irql, oldIrql)
#define KeLowerIrql(oldIrql)
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define MmGetMdlVirtualAddress(_Mdl)
PHYSICAL_ADDRESS NTAPI IoMapTransfer(IN PADAPTER_OBJECT AdapterObject, IN PMDL Mdl, IN PVOID MapRegisterBase, IN PVOID CurrentVa, IN OUT PULONG Length, IN BOOLEAN WriteToDevice)
VOID NTAPI StartMotor(PDRIVE_INFO DriveInfo)
#define STATUS_VERIFY_REQUIRED
VOID NTAPI StopMotor(PCONTROLLER_INFO ControllerInfo)
struct _CONTROLLER_INFO * ControllerInfo
#define STATUS_UNRECOGNIZED_MEDIA
NTSTATUS NTAPI HwReadWriteResult(PCONTROLLER_INFO ControllerInfo)
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
static VOID NTAPI RWFreeAdapterChannel(PADAPTER_OBJECT AdapterObject)
PDEVICE_OBJECT DeviceObject
_In_ PDEVICE_OBJECT DeviceObject
#define IO_DISK_INCREMENT
#define IoCompleteRequest
#define SL_OVERRIDE_VERIFY_VOLUME
static NTSTATUS NTAPI RWSeekToCylinder(PDRIVE_INFO DriveInfo, UCHAR Cylinder)
VOID NTAPI SignalMediaChanged(PDEVICE_OBJECT DeviceObject, PIRP Irp)
static IO_ALLOCATION_ACTION NTAPI MapRegisterCallback(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID MapRegisterBase, PVOID Context)
NTSTATUS NTAPI IoAllocateAdapterChannel(IN PADAPTER_OBJECT AdapterObject, IN PDEVICE_OBJECT DeviceObject, IN ULONG NumberOfMapRegisters, IN PDRIVER_CONTROL ExecutionRoutine, IN PVOID Context)
BOOLEAN NTAPI IoFlushAdapterBuffers(IN PADAPTER_OBJECT AdapterObject, IN PMDL Mdl, IN PVOID MapRegisterBase, IN PVOID CurrentVa, IN ULONG Length, IN BOOLEAN WriteToDevice)
VOID NTAPI HwDumpRegisters(PCONTROLLER_INFO ControllerInfo)
#define STATUS_UNSUCCESSFUL
#define BYTES_TO_PAGES(Size)
CM_FLOPPY_DEVICE_DATA FloppyDeviceData
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
NTSTATUS NTAPI HwReadWriteData(PCONTROLLER_INFO ControllerInfo, BOOLEAN Read, UCHAR Unit, UCHAR Cylinder, UCHAR Head, UCHAR Sector, UCHAR BytesPerSector, UCHAR EndOfTrack, UCHAR Gap3Length, UCHAR DataLength)
DISK_GEOMETRY DiskGeometry
NTSTATUS NTAPI HwDiskChanged(PDRIVE_INFO DriveInfo, PBOOLEAN DiskChanged)
_In_ PSCSI_REQUEST_BLOCK _In_opt_ PVOID _In_ ULONG _In_ BOOLEAN WriteToDevice
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
#define KeFlushIoBuffers(_Mdl, _ReadOperation, _DmaOperation)
static NTSTATUS NTAPI RWComputeCHS(PDRIVE_INFO IN DriveInfo, ULONG IN DiskByteOffset, PUCHAR OUT Cylinder, PUCHAR OUT Head, PUCHAR OUT Sector)
NTSTATUS NTAPI RWDetermineMediaType(PDRIVE_INFO DriveInfo, BOOLEAN OneShot)
NTSTATUS NTAPI ResetChangeFlag(PDRIVE_INFO DriveInfo)
VOID NTAPI KeClearEvent(IN PKEVENT Event)
NTSTATUS NTAPI WaitForControllerInterrupt(PCONTROLLER_INFO ControllerInfo, PLARGE_INTEGER Timeout)