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(): detected disk changed: signalling media change and completing\n");
499 WARN_(FLOPPY,
"ReadWritePassive(): unable to determine media type; completing with STATUS_UNSUCCESSFUL\n");
507 WARN_(FLOPPY,
"ReadWritePassive(): Unknown media in drive; completing with STATUS_UNRECOGNIZED_MEDIA\n");
519 DiskByteOffset =
Stack->Parameters.Read.ByteOffset.u.LowPart;
525 DiskByteOffset =
Stack->Parameters.Write.ByteOffset.u.LowPart;
607 WARN_(FLOPPY,
"ReadWritePassive(): unable allocate an adapter channel; completing with STATUS_UNSUCCESSFUL\n");
620 TransferByteOffset = 0;
621 while(TransferByteOffset <
Length)
626 ULONG CurrentTransferBytes;
627 UCHAR CurrentTransferSectors;
629 INFO_(FLOPPY,
"ReadWritePassive(): iterating in while (TransferByteOffset = 0x%x of 0x%x total) - allocating %d registers\n",
639 WARN_(FLOPPY,
"ReadWritePassive(): unable to compute CHS; completing with STATUS_UNSUCCESSFUL\n");
653 WARN_(FLOPPY,
"ReadWritePassive(): unable to seek; completing with STATUS_UNSUCCESSFUL\n");
667 INFO_(FLOPPY,
"ReadWritePassive(): computing number of sectors to transfer (StartSector 0x%x): ", StartSector);
680 INFO_(FLOPPY,
"0x%x\n", CurrentTransferSectors);
688 INFO_(FLOPPY,
"ReadWritePassive(): Trying to transfer 0x%x bytes\n", CurrentTransferBytes);
690 ASSERT(CurrentTransferBytes);
699 INFO_(FLOPPY,
"ReadWritePassive: limiting transfer to 0x%x bytes (0x%x sectors) due to map registers\n",
700 CurrentTransferBytes, CurrentTransferSectors);
721 WARN_(FLOPPY,
"ReadWritePassive(): HwReadWriteData returned failure; unable to read; completing with STATUS_UNSUCCESSFUL\n");
728 INFO_(FLOPPY,
"ReadWritePassive(): HwReadWriteData returned -- waiting on event\n");
745 WARN_(FLOPPY,
"ReadWritePassive(): HwReadWriteResult returned failure; unable to read; completing with STATUS_UNSUCCESSFUL\n");
753 TransferByteOffset += CurrentTransferBytes;
759 INFO_(FLOPPY,
"ReadWritePassive(): success; Completing with STATUS_SUCCESS\n");
NTSTATUS NTAPI WaitForControllerInterrupt(PCONTROLLER_INFO ControllerInfo, PLARGE_INTEGER Timeout)
_In_ ULONG _In_ ULONG _In_ ULONG Length
VOID NTAPI StopMotor(PCONTROLLER_INFO ControllerInfo)
#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)
#define STATUS_VERIFY_REQUIRED
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)
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
NTSTATUS NTAPI ResetChangeFlag(PDRIVE_INFO DriveInfo)
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
VOID NTAPI StartMotor(PDRIVE_INFO DriveInfo)
#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)
VOID NTAPI KeRaiseIrql(KIRQL NewIrql, PKIRQL OldIrql)
VOID NTAPI SignalMediaChanged(PDEVICE_OBJECT DeviceObject, PIRP Irp)
NTSTATUS NTAPI RWDetermineMediaType(PDRIVE_INFO DriveInfo, BOOLEAN OneShot)
VOID NTAPI KeLowerIrql(KIRQL NewIrql)
VOID NTAPI KeClearEvent(IN PKEVENT Event)