80 TRACE_(FLOPPY,
"MapRegisterCallback Called\n");
106 TRACE_(FLOPPY,
"ReadWrite called\n");
113 WARN_(FLOPPY,
"ReadWrite(): MDL not found in IRP - Completing with STATUS_INVALID_PARAMETER\n");
115 Irp->IoStatus.Information = 0;
171 UCHAR HeadUnloadTime;
177 TRACE_(FLOPPY,
"RWDetermineMediaType called\n");
195 WARN_(FLOPPY,
"RWDetermineMediaType(): unable to set data rate\n");
207 WARN_(FLOPPY,
"RWDetermineMediaType(): specify failed\n");
221 WARN_(FLOPPY,
"RWDetermineMediaType(): Recalibrate failed\n");
235 WARN_(FLOPPY,
"RWDetermineMediaType(): RecalibrateResult failed\n");
246 WARN_(FLOPPY,
"RWDetermineMediaType(): ReadId failed\n");
255 WARN_(FLOPPY,
"RWDetermineMediaType(): ReadIdResult failed; continuing\n");
263 WARN_(FLOPPY,
"Hardcoded media type!\n");
264 INFO_(FLOPPY,
"RWDetermineMediaType(): Found 1.44 media; returning success\n");
275 TRACE_(FLOPPY,
"RWDetermineMediaType(): failed to find media\n");
298 TRACE_(FLOPPY,
"RWSeekToCylinder called drive 0x%p cylinder %d\n", DriveInfo, Cylinder);
306 WARN_(FLOPPY,
"RWSeekToTrack(): unable to seek\n");
314 WARN_(FLOPPY,
"RWSeekToTrack(): unable to get seek results\n");
321 WARN_(FLOPPY,
"RWSeekToTrack(): unable to queue ReadId\n");
329 WARN_(FLOPPY,
"RWSeekToTrack(): unable to get ReadId result\n");
333 if(CurCylinder != Cylinder)
335 WARN_(FLOPPY,
"RWSeekToTrack(): Seek to track failed; current cylinder is 0x%x\n", CurCylinder);
339 INFO_(FLOPPY,
"RWSeekToCylinder: returning successfully, now on cyl %d\n", Cylinder);
368 ULONG AbsoluteSector;
369 UCHAR SectorsPerCylinder = (
UCHAR)DriveInfo->DiskGeometry.SectorsPerTrack * (
UCHAR)DriveInfo->DiskGeometry.TracksPerCylinder;
371 TRACE_(FLOPPY,
"RWComputeCHS: Called with offset 0x%x\n", DiskByteOffset);
374 ASSERT(!(DiskByteOffset % DriveInfo->DiskGeometry.BytesPerSector));
377 AbsoluteSector = DiskByteOffset / DriveInfo->DiskGeometry.BytesPerSector;
380 *Cylinder = (
CHAR)(AbsoluteSector / SectorsPerCylinder);
383 *Head = AbsoluteSector % SectorsPerCylinder < DriveInfo->DiskGeometry.SectorsPerTrack ? 0 : 1;
389 *Sector = ((
UCHAR)(AbsoluteSector % SectorsPerCylinder) + 1) - ((*Head) * (
UCHAR)DriveInfo->DiskGeometry.SectorsPerTrack);
391 INFO_(FLOPPY,
"RWComputeCHS: offset 0x%x is c:0x%x h:0x%x s:0x%x\n", DiskByteOffset, *Cylinder, *Head, *Sector);
394 ASSERT(*Cylinder <= DriveInfo->DiskGeometry.Cylinders.QuadPart);
395 ASSERT(*Head <= DriveInfo->DiskGeometry.TracksPerCylinder);
396 ASSERT(*Sector <= DriveInfo->DiskGeometry.SectorsPerTrack);
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");
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
_In_ PSCSI_REQUEST_BLOCK _In_opt_ PVOID _In_ ULONG _In_ BOOLEAN WriteToDevice
NTKERNELAPI VOID NTAPI IoCsqInsertIrp(_Inout_ PIO_CSQ Csq, _Inout_ PIRP Irp, _Out_opt_ PIO_CSQ_IRP_CONTEXT Context)
Insert an IRP into the CSQ.
struct _CONTROLLER_INFO * PCONTROLLER_INFO
NTSTATUS NTAPI HwReadWriteResult(PCONTROLLER_INFO ControllerInfo)
NTSTATUS NTAPI HwRecalibrateResult(PCONTROLLER_INFO ControllerInfo)
VOID NTAPI HwDumpRegisters(PCONTROLLER_INFO ControllerInfo)
NTSTATUS NTAPI HwSeek(PDRIVE_INFO DriveInfo, UCHAR Cylinder)
NTSTATUS NTAPI HwSetDataRate(PCONTROLLER_INFO ControllerInfo, UCHAR DataRate)
NTSTATUS NTAPI HwRecalibrate(PDRIVE_INFO DriveInfo)
NTSTATUS NTAPI HwSpecify(PCONTROLLER_INFO ControllerInfo, UCHAR HeadLoadTime, UCHAR HeadUnloadTime, UCHAR StepRateTime, BOOLEAN NonDma)
NTSTATUS NTAPI HwReadId(PDRIVE_INFO DriveInfo, UCHAR Head)
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 HwSenseInterruptStatus(PCONTROLLER_INFO ControllerInfo)
NTSTATUS NTAPI HwDiskChanged(PDRIVE_INFO DriveInfo, PBOOLEAN DiskChanged)
NTSTATUS NTAPI HwReadIdResult(PCONTROLLER_INFO ControllerInfo, PUCHAR CurCylinder, PUCHAR CurHead)
#define HW_512_BYTES_PER_SECTOR
#define DRSR_DSEL_500KBPS
static IO_ALLOCATION_ACTION NTAPI MapRegisterCallback(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID MapRegisterBase, PVOID Context)
static NTSTATUS NTAPI RWComputeCHS(PDRIVE_INFO IN DriveInfo, ULONG IN DiskByteOffset, PUCHAR OUT Cylinder, PUCHAR OUT Head, PUCHAR OUT Sector)
VOID NTAPI ReadWritePassive(PDRIVE_INFO DriveInfo, PIRP Irp)
static VOID NTAPI RWFreeAdapterChannel(PADAPTER_OBJECT AdapterObject)
NTSTATUS NTAPI RWDetermineMediaType(PDRIVE_INFO DriveInfo, BOOLEAN OneShot)
static NTSTATUS NTAPI RWSeekToCylinder(PDRIVE_INFO DriveInfo, UCHAR Cylinder)
#define KeRaiseIrql(irql, oldIrql)
#define KeLowerIrql(oldIrql)
#define KeSetEvent(pEvt, foo, foo2)
#define KeGetCurrentIrql()
VOID NTAPI KeClearEvent(IN PKEVENT Event)
NTSTATUS NTAPI WaitForControllerInterrupt(PCONTROLLER_INFO ControllerInfo, PLARGE_INTEGER Timeout)
NTSTATUS NTAPI ResetChangeFlag(PDRIVE_INFO DriveInfo)
VOID NTAPI SignalMediaChanged(PDEVICE_OBJECT DeviceObject, PIRP Irp)
VOID NTAPI StartMotor(PDRIVE_INFO DriveInfo)
VOID NTAPI StopMotor(PCONTROLLER_INFO ControllerInfo)
#define GEOMETRY_144_SECTORSPERTRACK
#define GEOMETRY_144_MEDIATYPE
#define GEOMETRY_144_CYLINDERS
#define GEOMETRY_144_TRACKSPERCYLINDER
#define GEOMETRY_144_BYTESPERSECTOR
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
BOOLEAN NTAPI IoFlushAdapterBuffers(IN PADAPTER_OBJECT AdapterObject, IN PMDL Mdl, IN PVOID MapRegisterBase, IN PVOID CurrentVa, IN ULONG Length, IN BOOLEAN WriteToDevice)
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 IoFreeAdapterChannel(IN PADAPTER_OBJECT AdapterObject)
#define UNREFERENCED_PARAMETER(P)
_In_ ULONG _In_ ULONG _In_ ULONG Length
NTSTATUS NTAPI IoAllocateAdapterChannel(IN PADAPTER_OBJECT AdapterObject, IN PDEVICE_OBJECT DeviceObject, IN ULONG NumberOfMapRegisters, IN PDRIVER_CONTROL ExecutionRoutine, IN PVOID Context)
#define IoCompleteRequest
DRIVER_DISPATCH ReadWrite
#define KeFlushIoBuffers(_Mdl, _ReadOperation, _DmaOperation)
struct _CONTROLLER_INFO * ControllerInfo
PDEVICE_OBJECT DeviceObject
CM_FLOPPY_DEVICE_DATA FloppyDeviceData
DISK_GEOMETRY DiskGeometry
#define STATUS_UNRECOGNIZED_MEDIA
#define STATUS_INVALID_PARAMETER
#define STATUS_UNSUCCESSFUL
#define STATUS_VERIFY_REQUIRED
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
#define SL_OVERRIDE_VERIFY_VOLUME
_Inout_ struct _IRP _In_ PVOID MapRegisterBase
enum _IO_ALLOCATION_ACTION IO_ALLOCATION_ACTION
#define IO_DISK_INCREMENT
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
#define MmGetMdlVirtualAddress(_Mdl)
#define BYTES_TO_PAGES(Size)