ReactOS 0.4.17-dev-470-gf9e3448
floppy.c File Reference
#include "precomp.h"
#include <ntddk.h>
#include <debug.h>
#include "ioctl.h"
#include "readwrite.h"
Include dependency graph for floppy.c:

Go to the source code of this file.

Functions

NTSYSAPI NTSTATUS NTAPI ZwWaitForSingleObject (_In_ HANDLE Handle, _In_ BOOLEAN Alertable, _In_opt_ PLARGE_INTEGER Timeout)
 
static VOID Cleanup (PDRIVER_OBJECT DriverObject)
 
static VOID NTAPI MotorStopDpcFunc (PKDPC UnusedDpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2)
 
VOID NTAPI StartMotor (PDRIVE_INFO DriveInfo)
 
VOID NTAPI StopMotor (PCONTROLLER_INFO ControllerInfo)
 
NTSTATUS NTAPI WaitForControllerInterrupt (PCONTROLLER_INFO ControllerInfo, PLARGE_INTEGER Timeout)
 
static NTSTATUS NTAPI CreateClose (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
static NTSTATUS NTAPI Recalibrate (PDRIVE_INFO DriveInfo)
 
NTSTATUS NTAPI ResetChangeFlag (PDRIVE_INFO DriveInfo)
 
static VOID NTAPI Unload (PDRIVER_OBJECT DriverObject)
 
static NTSTATUS NTAPI ConfigCallback (PVOID Context, PUNICODE_STRING PathName, INTERFACE_TYPE BusType, ULONG BusNumber, PKEY_VALUE_FULL_INFORMATION *BusInformation, CONFIGURATION_TYPE ControllerType, ULONG ControllerNumber, PKEY_VALUE_FULL_INFORMATION *ControllerInformation, CONFIGURATION_TYPE PeripheralType, ULONG PeripheralNumber, PKEY_VALUE_FULL_INFORMATION *PeripheralInformation)
 
static BOOLEAN NTAPI Isr (PKINTERRUPT Interrupt, PVOID ServiceContext)
 
VOID NTAPI DpcForIsr (PKDPC UnusedDpc, PVOID Context, PVOID SystemArgument1, PVOID SystemArgument2)
 
static NTSTATUS NTAPI InitController (PCONTROLLER_INFO ControllerInfo)
 
static VOID NTAPI ReportToMountMgr (UCHAR ControlerId, UCHAR DriveId)
 
static BOOLEAN NTAPI AddControllers (PDRIVER_OBJECT DriverObject)
 
VOID NTAPI SignalMediaChanged (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
static VOID NTAPI QueueThread (PVOID Context)
 
NTSTATUS NTAPI DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
 

Variables

static CONTROLLER_INFO gControllerInfo [MAX_CONTROLLERS]
 
static ULONG gNumberOfControllers = 0
 
static KEVENT QueueThreadTerminate
 
static PVOID QueueThreadObject
 
static DRIVER_DISPATCH CreateClose
 

Function Documentation

◆ AddControllers()

static BOOLEAN NTAPI AddControllers ( PDRIVER_OBJECT  DriverObject)
static

Definition at line 932 of file floppy.c.

948{
950 CONFIGURATION_TYPE ControllerType = DiskController;
954 UCHAR i;
955 UCHAR j;
956
957 PAGED_CODE();
958
959 /* Find our controllers on all ISA buses */
961 NULL,
962 &ControllerType,
963 NULL,
964 &PeripheralType,
965 NULL,
967 NULL);
968
969 /*
970 * w2k breaks the return val from ConfigCallback, so we have to hack around it, rather than just
971 * looking for a return value from ConfigCallback. We expect at least one controller.
972 */
973 if(!gControllerInfo[0].Populated)
974 {
975 WARN_(FLOPPY, "AddControllers: failed to get controller info from registry\n");
976 return FALSE;
977 }
978
979 /* Now that we have a controller, set it up with the system */
981 {
982 /* 0: Report resource usage to the kernel, to make sure they aren't assigned to anyone else */
983 /* FIXME: Implement me. */
984
985 /* 1: Set up interrupt */
988 &gControllerInfo[i].MappedLevel, &Affinity);
989
990 /* Must set up the DPC before we connect the interrupt */
992
993 INFO_(FLOPPY, "Connecting interrupt %d to controller%d (object 0x%p)\n", gControllerInfo[i].MappedVector,
994 i, &gControllerInfo[i]);
995
996 /* NOTE: We cannot share our interrupt, even on level-triggered buses. See Isr() for details. */
998 gControllerInfo[i].MappedLevel, gControllerInfo[i].MappedLevel, gControllerInfo[i].InterruptMode,
1000 {
1001 WARN_(FLOPPY, "AddControllers: unable to connect interrupt\n");
1002 continue;
1003 }
1004
1005 /* 2: Set up DMA */
1008 DeviceDescription.DmaChannel = gControllerInfo[i].Dma;
1011 DeviceDescription.MaximumLength = 2*18*512; /* based on a 1.44MB floppy */
1012
1013 /* DMA 0,1,2,3 are 8-bit; 4,5,6,7 are 16-bit (4 is chain i think) */
1015
1017
1018 if(!gControllerInfo[i].AdapterObject)
1019 {
1020 WARN_(FLOPPY, "AddControllers: unable to allocate an adapter object\n");
1023 continue;
1024 }
1025
1026 /* 2b: Initialize the new controller */
1028 {
1029 WARN_(FLOPPY, "AddControllers(): Unable to set up controller %d - initialization failed\n", i);
1032 continue;
1033 }
1034
1035 /* 2c: Set the controller's initialized flag so we know to release stuff in Unload */
1037
1038 /* 3: per-drive setup */
1039 for(j = 0; j < gControllerInfo[i].NumberOfDrives; j++)
1040 {
1042 UNICODE_STRING ArcPath;
1043 UCHAR DriveNumber;
1044
1045 INFO_(FLOPPY, "AddControllers(): Configuring drive %d on controller %d\n", i, j);
1046
1047 /*
1048 * 3a: create a device object for the drive
1049 * Controllers and drives are 0-based, so the combos are:
1050 * 0: 0,0
1051 * 1: 0,1
1052 * 2: 0,2
1053 * 3: 0,3
1054 * 4: 1,0
1055 * 5: 1,1
1056 * ...
1057 * 14: 3,2
1058 * 15: 3,3
1059 */
1060
1061 DriveNumber = (UCHAR)(i*4 + j); /* loss of precision is OK; there are only 16 of 'em */
1062
1063 _swprintf(gControllerInfo[i].DriveInfo[j].DeviceNameBuffer, L"\\Device\\Floppy%d", DriveNumber);
1064 RtlInitUnicodeString(&DeviceName, gControllerInfo[i].DriveInfo[j].DeviceNameBuffer);
1065
1069 {
1070 WARN_(FLOPPY, "AddControllers: unable to register a Device object\n");
1073 continue; /* continue on to next drive */
1074 }
1075
1076 INFO_(FLOPPY, "AddControllers: New device: %S (0x%p)\n",
1077 gControllerInfo[i].DriveInfo[j].DeviceNameBuffer,
1078 gControllerInfo[i].DriveInfo[j].DeviceObject);
1079
1080 /* 3b.5: Create an ARC path in case we're booting from this drive */
1081 _swprintf(gControllerInfo[i].DriveInfo[j].ArcPathBuffer,
1082 L"\\ArcName\\multi(%d)disk(%d)fdisk(%d)", gControllerInfo[i].BusNumber, i, DriveNumber);
1083
1084 RtlInitUnicodeString(&ArcPath, gControllerInfo[i].DriveInfo[j].ArcPathBuffer);
1085 IoAssignArcName(&ArcPath, &DeviceName);
1086
1087 /* 3c: Set flags up */
1089
1090 /* 3d: Increase global floppy drives count */
1092
1093 /* 3e: Set up the DPC */
1095
1096 /* 3f: Point the device extension at our DriveInfo struct */
1098
1099 /* 3g: neat comic strip */
1100
1101 /* 3h: set the initial media type to unknown */
1102 memset(&gControllerInfo[i].DriveInfo[j].DiskGeometry, 0, sizeof(DISK_GEOMETRY));
1104
1105 /* 3i: Now that we're done, set the Initialized flag so we know to free this in Unload */
1107
1108 /* 3j: Clear the DO_DEVICE_INITIALIZING flag */
1109 gControllerInfo[i].DriveInfo[j].DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
1110
1111 /* 3k: Report to the MountMgr */
1113
1114 /* 3l: Attempt to get drive info - if a floppy is already present */
1115 StartMotor(&gControllerInfo[i].DriveInfo[j]);
1117 StopMotor(gControllerInfo[i].DriveInfo[j].ControllerInfo);
1118 }
1119 }
1120
1121 INFO_(FLOPPY, "AddControllers: --------------------------------------------> finished adding controllers\n");
1122
1123 return (IoGetConfigurationInformation()->FloppyCount != 0);
1124}
#define PAGED_CODE()
@ DiskController
Definition: arcname.c:68
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
ULONG_PTR KAFFINITY
Definition: compat.h:85
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:712
#define L(x)
Definition: resources.c:13
NTSTATUS NTAPI RWDetermineMediaType(PDRIVE_INFO DriveInfo, BOOLEAN OneShot)
Definition: readwrite.c:153
NTHALAPI ULONG NTAPI HalGetInterruptVector(INTERFACE_TYPE, ULONG, ULONG, ULONG, PKIRQL, PKAFFINITY)
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
static NTSTATUS NTAPI InitController(PCONTROLLER_INFO ControllerInfo)
Definition: floppy.c:691
static CONTROLLER_INFO gControllerInfo[MAX_CONTROLLERS]
Definition: floppy.c:56
static NTSTATUS NTAPI ConfigCallback(PVOID Context, PUNICODE_STRING PathName, INTERFACE_TYPE BusType, ULONG BusNumber, PKEY_VALUE_FULL_INFORMATION *BusInformation, CONFIGURATION_TYPE ControllerType, ULONG ControllerNumber, PKEY_VALUE_FULL_INFORMATION *ControllerInformation, CONFIGURATION_TYPE PeripheralType, ULONG PeripheralNumber, PKEY_VALUE_FULL_INFORMATION *PeripheralInformation)
Definition: floppy.c:456
static ULONG gNumberOfControllers
Definition: floppy.c:57
VOID NTAPI DpcForIsr(PKDPC UnusedDpc, PVOID Context, PVOID SystemArgument1, PVOID SystemArgument2)
Definition: floppy.c:658
VOID NTAPI StartMotor(PDRIVE_INFO DriveInfo)
Definition: floppy.c:159
VOID NTAPI StopMotor(PCONTROLLER_INFO ControllerInfo)
Definition: floppy.c:198
static VOID NTAPI ReportToMountMgr(UCHAR ControlerId, UCHAR DriveId)
Definition: floppy.c:840
static BOOLEAN NTAPI Isr(PKINTERRUPT Interrupt, PVOID ServiceContext)
Definition: floppy.c:609
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
Definition: glfuncs.h:248
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 GLint GLint j
Definition: glfuncs.h:250
PADAPTER_OBJECT NTAPI HalGetAdapter(IN PDEVICE_DESCRIPTION DeviceDescription, OUT PULONG NumberOfMapRegisters)
Definition: dma.c:22
@ Unknown
Definition: i8042prt.h:114
PCONFIGURATION_INFORMATION NTAPI IoGetConfigurationInformation(VOID)
Returns a pointer to the I/O manager's global configuration information structure.
Definition: iorsrce.c:998
NTSTATUS NTAPI IoQueryDeviceDescription(_In_opt_ PINTERFACE_TYPE BusType, _In_opt_ PULONG BusNumber, _In_opt_ PCONFIGURATION_TYPE ControllerType, _In_opt_ PULONG ControllerNumber, _In_opt_ PCONFIGURATION_TYPE PeripheralType, _In_opt_ PULONG PeripheralNumber, _In_ PIO_QUERY_DEVICE_ROUTINE CalloutRoutine, _In_opt_ PVOID Context)
Reads and returns Hardware information from the appropriate hardware registry key.
Definition: iorsrce.c:1213
#define _swprintf(buf, format,...)
Definition: sprintf.c:56
@ InterruptObject
Definition: ketypes.h:447
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define FILE_FLOPPY_DISKETTE
Definition: nt_native.h:809
#define FILE_REMOVABLE_MEDIA
Definition: nt_native.h:807
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1032
VOID NTAPI IoDisconnectInterrupt(PKINTERRUPT InterruptObject)
Definition: irq.c:142
NTSTATUS NTAPI IoConnectInterrupt(OUT PKINTERRUPT *InterruptObject, IN PKSERVICE_ROUTINE ServiceRoutine, IN PVOID ServiceContext, IN PKSPIN_LOCK SpinLock, IN ULONG Vector, IN KIRQL Irql, IN KIRQL SynchronizeIrql, IN KINTERRUPT_MODE InterruptMode, IN BOOLEAN ShareVector, IN KAFFINITY ProcessorEnableMask, IN BOOLEAN FloatingSave)
Definition: irq.c:23
_In_ ULONG BusNumber
Definition: pciidex.h:65
#define FILE_DEVICE_DISK
Definition: winioctl.h:52
@ Isa
Definition: restypes.h:122
enum _INTERFACE_TYPE INTERFACE_TYPE
@ Width16Bits
Definition: miniport.h:106
@ Width8Bits
Definition: miniport.h:105
@ FloppyDiskPeripheral
Definition: arc.h:139
enum _CONFIGURATION_TYPE CONFIGURATION_TYPE
#define INFO_(ch,...)
Definition: debug.h:159
#define WARN_(ch,...)
Definition: debug.h:157
#define memset(x, y, z)
Definition: compat.h:39
#define STATUS_SUCCESS
Definition: shellext.h:65
BOOLEAN Initialized
Definition: floppy.h:60
UCHAR NumberOfDrives
Definition: fdc.h:58
PADAPTER_OBJECT AdapterObject
Definition: floppy.h:77
ULONG MappedVector
Definition: floppy.h:67
INTERFACE_TYPE InterfaceType
Definition: floppy.h:62
DRIVE_INFO DriveInfo[MAX_DRIVES_PER_CONTROLLER]
Definition: fdc.h:60
ULONG BusNumber
Definition: floppy.h:63
PKINTERRUPT InterruptObject
Definition: floppy.h:76
PVOID DeviceExtension
Definition: env_spec_w32.h:418
MEDIA_TYPE MediaType
Definition: ntdddisk.h:401
PDEVICE_OBJECT DeviceObject
Definition: fdc.h:26
BOOLEAN Initialized
Definition: floppy.h:54
DISK_GEOMETRY DiskGeometry
Definition: floppy.h:49
unsigned char UCHAR
Definition: typedefs.h:53
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3281
_Must_inspect_result_ _In_ PWDF_DPC_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDPC * Dpc
Definition: wdfdpc.h:112
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID InterfaceType
Definition: wdffdo.h:463
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING DeviceDescription
Definition: wdfpdo.h:432
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:56
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
Definition: halfuncs.h:174
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG _In_ KIRQL _In_ KIRQL _In_ KINTERRUPT_MODE InterruptMode
Definition: iofuncs.h:806
FORCEINLINE VOID IoInitializeDpcRequest(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIO_DPC_ROUTINE DpcRoutine)
Definition: iofuncs.h:2840
#define IoAssignArcName(_ArcName, _DeviceName)
#define DEVICE_DESCRIPTION_VERSION
Definition: iotypes.h:2063
IO_DPC_ROUTINE * PIO_DPC_ROUTINE
Definition: iotypes.h:2849

Referenced by DriverEntry().

◆ Cleanup()

static VOID Cleanup ( PDRIVER_OBJECT  DriverObject)
static

Definition at line 72 of file floppy.c.

73{
74 ULONG i, j;
75
76 PAGED_CODE();
78
80 {
85 }
86
87 for (i = 0; i < gNumberOfControllers; i++)
88 {
89 for (j = 0; j < gControllerInfo[i].NumberOfDrives; j++)
90 {
91 if (!gControllerInfo[i].DriveInfo[j].Initialized)
92 continue;
93
94 if (gControllerInfo[i].DriveInfo[j].DeviceObject)
95 {
97
98 RtlInitUnicodeString(&Link, gControllerInfo[i].DriveInfo[j].ArcPathBuffer);
100
103 }
104
106 }
107
109 {
112 }
113
115 {
117 {
118 WARN_(FLOPPY, "cleanup: warning: HwPowerOff failed\n");
119 }
120
122 }
123 }
124}
NTSTATUS NTAPI HwPowerOff(PCONTROLLER_INFO ControllerInfo)
Definition: hardware.c:1010
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
static PVOID QueueThreadObject
Definition: floppy.c:69
static KEVENT QueueThreadTerminate
Definition: floppy.c:68
#define KernelMode
Definition: asm.h:38
@ Initialized
Definition: ketypes.h:407
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1252
uint32_t ULONG
Definition: typedefs.h:59
static int Link(const char **args)
Definition: vfdcmd.c:2414
#define IoDeassignArcName
@ Executive
Definition: ketypes.h:467
#define ObDereferenceObject
Definition: obfuncs.h:203

◆ ConfigCallback()

static NTSTATUS NTAPI ConfigCallback ( PVOID  Context,
PUNICODE_STRING  PathName,
INTERFACE_TYPE  BusType,
ULONG  BusNumber,
PKEY_VALUE_FULL_INFORMATION BusInformation,
CONFIGURATION_TYPE  ControllerType,
ULONG  ControllerNumber,
PKEY_VALUE_FULL_INFORMATION ControllerInformation,
CONFIGURATION_TYPE  PeripheralType,
ULONG  PeripheralNumber,
PKEY_VALUE_FULL_INFORMATION PeripheralInformation 
)
static

Definition at line 456 of file floppy.c.

497{
498 PKEY_VALUE_FULL_INFORMATION ControllerFullDescriptor = ControllerInformation[IoQueryDeviceConfigurationData];
499 PCM_FULL_RESOURCE_DESCRIPTOR ControllerResourceDescriptor = (PCM_FULL_RESOURCE_DESCRIPTOR)((PCHAR)ControllerFullDescriptor +
500 ControllerFullDescriptor->DataOffset);
501
502 PKEY_VALUE_FULL_INFORMATION PeripheralFullDescriptor = PeripheralInformation[IoQueryDeviceConfigurationData];
503 PCM_FULL_RESOURCE_DESCRIPTOR PeripheralResourceDescriptor = (PCM_FULL_RESOURCE_DESCRIPTOR)((PCHAR)PeripheralFullDescriptor +
504 PeripheralFullDescriptor->DataOffset);
505
506 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
507 PCM_FLOPPY_DEVICE_DATA FloppyDeviceData;
508 UCHAR i;
509
510 PAGED_CODE();
511 UNREFERENCED_PARAMETER(PeripheralType);
512 UNREFERENCED_PARAMETER(PeripheralNumber);
515 UNREFERENCED_PARAMETER(ControllerType);
516 UNREFERENCED_PARAMETER(PathName);
517
518
519 TRACE_(FLOPPY, "ConfigCallback called with ControllerNumber %d\n", ControllerNumber);
520
524
525 /* Get controller interrupt level/vector, dma channel, and port base */
526 for(i = 0; i < ControllerResourceDescriptor->PartialResourceList.Count; i++)
527 {
529
530 PartialDescriptor = &ControllerResourceDescriptor->PartialResourceList.PartialDescriptors[i];
531
532 if(PartialDescriptor->Type == CmResourceTypeInterrupt)
533 {
534 gControllerInfo[gNumberOfControllers].Level = PartialDescriptor->u.Interrupt.Level;
535 gControllerInfo[gNumberOfControllers].Vector = PartialDescriptor->u.Interrupt.Vector;
536
537 if(PartialDescriptor->Flags & CM_RESOURCE_INTERRUPT_LATCHED)
539 else
541 }
542
543 else if(PartialDescriptor->Type == CmResourceTypePort)
544 {
546 ULONG AddressSpace = 0x1; /* I/O Port Range */
547
548 if(!HalTranslateBusAddress(BusType, BusNumber, PartialDescriptor->u.Port.Start, &AddressSpace, &TranslatedAddress))
549 {
550 WARN_(FLOPPY, "HalTranslateBusAddress failed; returning\n");
552 }
553
554 if(AddressSpace == 0)
556 else
558 }
559
560 else if(PartialDescriptor->Type == CmResourceTypeDma)
561 gControllerInfo[gNumberOfControllers].Dma = PartialDescriptor->u.Dma.Channel;
562 }
563
564 /* Start with 0 drives, then go looking */
566
567 /* learn about drives attached to controller */
568 for(i = 0; i < PeripheralResourceDescriptor->PartialResourceList.Count; i++)
569 {
571
572 PartialDescriptor = &PeripheralResourceDescriptor->PartialResourceList.PartialDescriptors[i];
573
574 if(PartialDescriptor->Type != CmResourceTypeDeviceSpecific)
575 continue;
576
577 FloppyDeviceData = (PCM_FLOPPY_DEVICE_DATA)(PartialDescriptor + 1);
578
580 DriveInfo->UnitNumber = i;
581
582 DriveInfo->FloppyDeviceData.MaxDensity = FloppyDeviceData->MaxDensity;
583 DriveInfo->FloppyDeviceData.MountDensity = FloppyDeviceData->MountDensity;
585 DriveInfo->FloppyDeviceData.HeadLoadTime = FloppyDeviceData->HeadLoadTime;
586 DriveInfo->FloppyDeviceData.MotorOffTime = FloppyDeviceData->MotorOffTime;
587 DriveInfo->FloppyDeviceData.SectorLengthCode = FloppyDeviceData->SectorLengthCode;
588 DriveInfo->FloppyDeviceData.SectorPerTrack = FloppyDeviceData->SectorPerTrack;
589 DriveInfo->FloppyDeviceData.ReadWriteGapLength = FloppyDeviceData->ReadWriteGapLength;
590 DriveInfo->FloppyDeviceData.FormatGapLength = FloppyDeviceData->FormatGapLength;
591 DriveInfo->FloppyDeviceData.FormatFillCharacter = FloppyDeviceData->FormatFillCharacter;
592 DriveInfo->FloppyDeviceData.HeadSettleTime = FloppyDeviceData->HeadSettleTime;
593 DriveInfo->FloppyDeviceData.MotorSettleTime = FloppyDeviceData->MotorSettleTime;
594 DriveInfo->FloppyDeviceData.MaximumTrackValue = FloppyDeviceData->MaximumTrackValue;
595 DriveInfo->FloppyDeviceData.DataTransferLength = FloppyDeviceData->DataTransferLength;
596
597 /* Once it's all set up, acknowledge its existence in the controller info object */
599 }
600
603
604 return STATUS_SUCCESS;
605}
#define TRACE_(x)
Definition: compat.h:76
#define FDC_PORT_BYTES
Definition: hardware.h:40
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
BOOLEAN NTAPI HalTranslateBusAddress(IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber, IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress)
Definition: bus.c:140
PVOID NTAPI MmMapIoSpace(IN PHYSICAL_ADDRESS PhysicalAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
Definition: iosup.c:47
@ NotificationEvent
struct _CM_FULL_RESOURCE_DESCRIPTOR * PCM_FULL_RESOURCE_DESCRIPTOR
#define CmResourceTypeDma
Definition: restypes.h:107
#define CmResourceTypeDeviceSpecific
Definition: restypes.h:108
#define CmResourceTypePort
Definition: restypes.h:104
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: restypes.h:117
#define CmResourceTypeInterrupt
Definition: restypes.h:105
@ Latched
Definition: miniport.h:81
@ LevelSensitive
Definition: miniport.h:80
_In_ PVOID Context
Definition: storport.h:2269
UCHAR StepRateHeadUnloadTime
Definition: cmtypes.h:489
CM_PARTIAL_RESOURCE_LIST PartialResourceList
Definition: restypes.h:144
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@384::@390 Dma
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@384::@387 Interrupt
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@384 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@384::@386 Port
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: restypes.h:100
ULONG Level
Definition: floppy.h:64
KINTERRUPT_MODE InterruptMode
Definition: floppy.h:68
ULONG Vector
Definition: floppy.h:66
PUCHAR BaseAddress
Definition: fdc.h:49
BOOLEAN Populated
Definition: fdc.h:39
ULONG ControllerNumber
Definition: floppy.h:61
struct _CONTROLLER_INFO * ControllerInfo
Definition: fdc.h:23
CM_FLOPPY_DEVICE_DATA FloppyDeviceData
Definition: fdc.h:27
UCHAR UnitNumber
Definition: fdc.h:24
uint32_t ULONG_PTR
Definition: typedefs.h:65
unsigned char * PUCHAR
Definition: typedefs.h:53
char * PCHAR
Definition: typedefs.h:51
#define STATUS_IO_DEVICE_ERROR
Definition: udferr_usr.h:179
LONGLONG QuadPart
Definition: typedefs.h:114
_In_ WDFDEVICE _In_ PPNP_BUS_INFORMATION BusInformation
Definition: wdfdevice.h:3921
struct _CM_FLOPPY_DEVICE_DATA * PCM_FLOPPY_DEVICE_DATA
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE BusType
Definition: halfuncs.h:159
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
Definition: iofuncs.h:2275
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
Definition: iofuncs.h:2274
@ IoQueryDeviceConfigurationData
Definition: iotypes.h:4452
@ MmNonCached
Definition: mmtypes.h:129

Referenced by AddControllers().

◆ CreateClose()

static NTSTATUS NTAPI CreateClose ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)
static

Definition at line 252 of file floppy.c.

269{
271
272 TRACE_(FLOPPY, "CreateClose called\n");
273
274 Irp->IoStatus.Status = STATUS_SUCCESS;
275 Irp->IoStatus.Information = FILE_OPENED;
276
278
279 return STATUS_SUCCESS;
280}
_In_ PIRP Irp
Definition: csq.h:116
#define FILE_OPENED
Definition: nt_native.h:769
#define IoCompleteRequest
Definition: irp.c:1240
#define IO_DISK_INCREMENT
Definition: iotypes.h:600

◆ DpcForIsr()

VOID NTAPI DpcForIsr ( PKDPC  UnusedDpc,
PVOID  Context,
PVOID  SystemArgument1,
PVOID  SystemArgument2 
)

Definition at line 658 of file floppy.c.

675{
676 PCONTROLLER_INFO ControllerInfo = (PCONTROLLER_INFO)Context;
677
678 UNREFERENCED_PARAMETER(UnusedDpc);
681
682 ASSERT(ControllerInfo);
683
684 TRACE_(FLOPPY, "DpcForIsr called\n");
685
686 KeSetEvent(&ControllerInfo->SynchEvent, EVENT_INCREMENT, FALSE);
687}
struct _CONTROLLER_INFO * PCONTROLLER_INFO
#define ASSERT(a)
Definition: mode.c:44
KEVENT SynchEvent
Definition: floppy.h:74
#define EVENT_INCREMENT
Definition: iotypes.h:597
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:756
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:757

Referenced by AddControllers().

◆ DriverEntry()

NTSTATUS NTAPI DriverEntry ( PDRIVER_OBJECT  DriverObject,
PUNICODE_STRING  RegistryPath 
)

Definition at line 1240 of file floppy.c.

1251{
1252 HANDLE ThreadHandle;
1253
1255
1256 if (IsNEC_98)
1257 {
1259 }
1260
1261 /*
1262 * Set up dispatch routines
1263 */
1269
1270 DriverObject->DriverUnload = Unload;
1271
1272 /*
1273 * We depend on some zeroes in these structures. I know this is supposed to be
1274 * initialized to 0 by the complier but this makes me feel beter.
1275 */
1277
1278 /*
1279 * Set up queue. This routine cannot fail (trust me, I wrote it).
1280 */
1283
1284 /*
1285 * ...and its lock
1286 */
1288
1289 /*
1290 * ...and the queue list itself
1291 */
1293
1294 /*
1295 * The queue is counted by a semaphore. The queue management thread
1296 * blocks on this semaphore, so if requests come in faster than the queue
1297 * thread can handle them, the semaphore count goes up.
1298 */
1299 KeInitializeSemaphore(&QueueSemaphore, 0, 0x7fffffff);
1300
1301 /*
1302 * Event to terminate that thread
1303 */
1305
1306 /*
1307 * Create the queue processing thread. Save its handle in the global variable
1308 * ThreadHandle so we can wait on its termination during Unload.
1309 */
1310 if(PsCreateSystemThread(&ThreadHandle, THREAD_ALL_ACCESS, 0, 0, 0, QueueThread, 0) != STATUS_SUCCESS)
1311 {
1312 WARN_(FLOPPY, "Unable to create system thread; failing init\n");
1314 }
1315
1317 {
1318 WARN_(FLOPPY, "Unable to reference returned thread handle; failing init\n");
1320 ZwWaitForSingleObject(ThreadHandle, FALSE, NULL);
1321 ZwClose(ThreadHandle);
1322 return STATUS_UNSUCCESSFUL;
1323 }
1324
1325 /*
1326 * Close the handle, now that we have the object pointer and a reference of our own.
1327 * The handle will certainly not be valid in the context of the caller next time we
1328 * need it, as handles are process-specific.
1329 */
1330 ZwClose(ThreadHandle);
1331
1332 /*
1333 * Start the device discovery process. Returns STATUS_SUCCESS if
1334 * it finds even one drive attached to one controller.
1335 */
1337 {
1339 return STATUS_NO_SUCH_DEVICE;
1340 }
1341
1342 return STATUS_SUCCESS;
1343}
NTKERNELAPI NTSTATUS NTAPI IoCsqInitialize(_Out_ PIO_CSQ Csq, _In_ PIO_CSQ_INSERT_IRP CsqInsertIrp, _In_ PIO_CSQ_REMOVE_IRP CsqRemoveIrp, _In_ PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp, _In_ PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock, _In_ PIO_CSQ_RELEASE_LOCK CsqReleaseLock, _In_ PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp)
Set up a CSQ struct to initialize the queue.
Definition: csq.c:103
KSPIN_LOCK IrpQueueLock
Definition: csqrtns.c:50
KSEMAPHORE QueueSemaphore
Definition: csqrtns.c:51
LIST_ENTRY IrpQueue
Definition: csqrtns.c:49
IO_CSQ Csq
Definition: csqrtns.c:46
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
static const WCHAR Cleanup[]
Definition: register.c:80
DRIVER_DISPATCH DeviceIoctl
Definition: ioctl.h:29
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
static VOID NTAPI QueueThread(PVOID Context)
Definition: floppy.c:1172
static VOID NTAPI Unload(PDRIVER_OBJECT DriverObject)
Definition: floppy.c:440
static DRIVER_DISPATCH CreateClose
Definition: floppy.c:251
NTSYSAPI NTSTATUS NTAPI ZwWaitForSingleObject(_In_ HANDLE Handle, _In_ BOOLEAN Alertable, _In_opt_ PLARGE_INTEGER Timeout)
static BOOLEAN NTAPI AddControllers(PDRIVER_OBJECT DriverObject)
Definition: floppy.c:932
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define THREAD_ALL_ACCESS
Definition: nt_native.h:1342
#define STANDARD_RIGHTS_ALL
Definition: nt_native.h:69
POBJECT_TYPE PsThreadType
Definition: thread.c:20
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:602
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:493
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
DRIVER_DISPATCH ReadWrite
Definition: readwrite.h:29
VOID NTAPI KeInitializeSemaphore(IN PKSEMAPHORE Semaphore, IN LONG Count, IN LONG Limit)
Definition: semphobj.c:22
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_In_ PIO_CSQ_INSERT_IRP _In_ PIO_CSQ_REMOVE_IRP _In_ PIO_CSQ_PEEK_NEXT_IRP _In_ PIO_CSQ_ACQUIRE_LOCK _In_ PIO_CSQ_RELEASE_LOCK _In_ PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp
Definition: iofuncs.h:1893
_In_ PIO_CSQ_INSERT_IRP CsqInsertIrp
Definition: iofuncs.h:1888
_In_ PIO_CSQ_INSERT_IRP _In_ PIO_CSQ_REMOVE_IRP _In_ PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp
Definition: iofuncs.h:1890
_In_ PIO_CSQ_INSERT_IRP _In_ PIO_CSQ_REMOVE_IRP _In_ PIO_CSQ_PEEK_NEXT_IRP _In_ PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock
Definition: iofuncs.h:1891
_In_ PIO_CSQ_INSERT_IRP _In_ PIO_CSQ_REMOVE_IRP CsqRemoveIrp
Definition: iofuncs.h:1889
_In_ PIO_CSQ_INSERT_IRP _In_ PIO_CSQ_REMOVE_IRP _In_ PIO_CSQ_PEEK_NEXT_IRP _In_ PIO_CSQ_ACQUIRE_LOCK _In_ PIO_CSQ_RELEASE_LOCK CsqReleaseLock
Definition: iofuncs.h:1892
DRIVER_DISPATCH * PDRIVER_DISPATCH
Definition: iotypes.h:2264
#define IsNEC_98
Definition: ketypes.h:979

◆ InitController()

static NTSTATUS NTAPI InitController ( PCONTROLLER_INFO  ControllerInfo)
static

Definition at line 691 of file floppy.c.

700{
701 int i;
702 UCHAR HeadLoadTime;
703 UCHAR HeadUnloadTime;
704 UCHAR StepRateTime;
705 UCHAR ControllerVersion;
706
707 PAGED_CODE();
708 ASSERT(ControllerInfo);
709
710 TRACE_(FLOPPY, "InitController called with Controller 0x%p\n", ControllerInfo);
711
712 /* Get controller in a known state */
713 if(HwConfigure(ControllerInfo, FALSE, TRUE, TRUE, 0, 0) != STATUS_SUCCESS)
714 {
715 WARN_(FLOPPY, "InitController: unable to configure controller\n");
717 }
718
719 /* Get the controller version */
720 ControllerVersion = HwGetVersion(ControllerInfo);
721
722 KeClearEvent(&ControllerInfo->SynchEvent);
723
724 /* Reset the controller */
725 if(HwReset(ControllerInfo) != STATUS_SUCCESS)
726 {
727 WARN_(FLOPPY, "InitController: unable to reset controller\n");
729 }
730
731 INFO_(FLOPPY, "InitController: waiting for initial interrupt\n");
732
733 /* Wait for an interrupt */
734 WaitForControllerInterrupt(ControllerInfo, NULL);
735
736 /* Reset means you have to clear each of the four interrupts (one per drive) */
737 for(i = 0; i < MAX_DRIVES_PER_CONTROLLER; i++)
738 {
739 INFO_(FLOPPY, "InitController: Sensing interrupt %d\n", i);
740
741 if(HwSenseInterruptStatus(ControllerInfo) != STATUS_SUCCESS)
742 {
743 WARN_(FLOPPY, "InitController: Unable to clear interrupt 0x%x\n", i);
745 }
746 }
747
748 INFO_(FLOPPY, "InitController: done sensing interrupts\n");
749
750 /* Next, see if we have the right version to do implied seek */
751 if(ControllerVersion == VERSION_ENHANCED)
752 {
753 /* If so, set that up -- all defaults below except first TRUE for EIS */
754 if(HwConfigure(ControllerInfo, TRUE, TRUE, TRUE, 0, 0) != STATUS_SUCCESS)
755 {
756 WARN_(FLOPPY, "InitController: unable to set up implied seek\n");
757 ControllerInfo->ImpliedSeeks = FALSE;
758 }
759 else
760 {
761 INFO_(FLOPPY, "InitController: implied seeks set!\n");
762 ControllerInfo->ImpliedSeeks = TRUE;
763 }
764
765 /*
766 * FIXME: Figure out the answer to the below
767 *
768 * I must admit that I'm really confused about the Model 30 issue. At least one
769 * important bit (the disk change bit in the DIR) is flipped if this is a Model 30
770 * controller. However, at least one other floppy driver believes that there are only
771 * two computers that are guaranteed to have a Model 30 controller:
772 * - IBM Thinkpad 750
773 * - IBM PS2e
774 *
775 * ...and another driver only lists a config option for "thinkpad", that flips
776 * the change line. A third driver doesn't mention the Model 30 issue at all.
777 *
778 * What I can't tell is whether or not the average, run-of-the-mill computer now has
779 * a Model 30 controller. For the time being, I'm going to wire this to FALSE,
780 * and just not support the computers mentioned above, while I try to figure out
781 * how ubiquitous these newfangled 30 thingies are.
782 */
783 //ControllerInfo->Model30 = TRUE;
784 ControllerInfo->Model30 = FALSE;
785 }
786 else
787 {
788 INFO_(FLOPPY, "InitController: enhanced version not supported; disabling implied seeks\n");
789 ControllerInfo->ImpliedSeeks = FALSE;
790 ControllerInfo->Model30 = FALSE;
791 }
792
793 /* Specify */
794 WARN_(FLOPPY, "FIXME: Figure out speed\n");
795 HeadLoadTime = SPECIFY_HLT_500K;
796 HeadUnloadTime = SPECIFY_HUT_500K;
797 StepRateTime = SPECIFY_SRT_500K;
798
799 INFO_(FLOPPY, "InitController: setting data rate\n");
800
801 /* Set data rate */
802 if(HwSetDataRate(ControllerInfo, DRSR_DSEL_500KBPS) != STATUS_SUCCESS)
803 {
804 WARN_(FLOPPY, "InitController: unable to set data rate\n");
806 }
807
808 INFO_(FLOPPY, "InitController: issuing specify command to controller\n");
809
810 /* Don't disable DMA --> enable dma (dumb & confusing) */
811 if(HwSpecify(ControllerInfo, HeadLoadTime, HeadUnloadTime, StepRateTime, FALSE) != STATUS_SUCCESS)
812 {
813 WARN_(FLOPPY, "InitController: unable to specify options\n");
815 }
816
817 /* Init the stop stuff */
818 KeInitializeDpc(&ControllerInfo->MotorStopDpc, MotorStopDpcFunc, ControllerInfo);
819 KeInitializeTimer(&ControllerInfo->MotorTimer);
821 ControllerInfo->StopDpcQueued = FALSE;
822
823 /*
824 * Recalibrate each drive on the controller (depends on StartMotor, which depends on the timer stuff above)
825 * We don't even know if there is a disk in the drive, so this may not work, but that's OK.
826 */
827 for(i = 0; i < ControllerInfo->NumberOfDrives; i++)
828 {
829 INFO_(FLOPPY, "InitController: recalibrating drive 0x%x on controller 0x%p\n", i, ControllerInfo);
830 Recalibrate(&ControllerInfo->DriveInfo[i]);
831 }
832
833 INFO_(FLOPPY, "InitController: done initializing; returning STATUS_SUCCESS\n");
834
835 return STATUS_SUCCESS;
836}
#define MAX_DRIVES_PER_CONTROLLER
Definition: fdc.h:16
NTSTATUS NTAPI HwConfigure(PCONTROLLER_INFO ControllerInfo, BOOLEAN EIS, BOOLEAN EFIFO, BOOLEAN POLL, UCHAR FIFOTHR, UCHAR PRETRK)
Definition: hardware.c:703
NTSTATUS NTAPI HwGetVersion(PCONTROLLER_INFO ControllerInfo)
Definition: hardware.c:749
NTSTATUS NTAPI HwSetDataRate(PCONTROLLER_INFO ControllerInfo, UCHAR DataRate)
Definition: hardware.c:204
NTSTATUS NTAPI HwReset(PCONTROLLER_INFO ControllerInfo)
Definition: hardware.c:973
NTSTATUS NTAPI HwSpecify(PCONTROLLER_INFO ControllerInfo, UCHAR HeadLoadTime, UCHAR HeadUnloadTime, UCHAR StepRateTime, BOOLEAN NonDma)
Definition: hardware.c:925
NTSTATUS NTAPI HwSenseInterruptStatus(PCONTROLLER_INFO ControllerInfo)
Definition: hardware.c:539
#define VERSION_ENHANCED
Definition: hardware.h:239
#define SPECIFY_HLT_500K
Definition: hardware.h:219
#define SPECIFY_HUT_500K
Definition: hardware.h:223
#define DRSR_DSEL_500KBPS
Definition: hardware.h:106
#define SPECIFY_SRT_500K
Definition: hardware.h:227
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
static NTSTATUS NTAPI Recalibrate(PDRIVE_INFO DriveInfo)
Definition: floppy.c:284
NTSTATUS NTAPI WaitForControllerInterrupt(PCONTROLLER_INFO ControllerInfo, PLARGE_INTEGER Timeout)
Definition: floppy.c:226
static VOID NTAPI MotorStopDpcFunc(PKDPC UnusedDpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2)
Definition: floppy.c:128
BOOLEAN StopDpcQueued
Definition: floppy.h:86
BOOLEAN Model30
Definition: floppy.h:82
KTIMER MotorTimer
Definition: floppy.h:84
KEVENT MotorStoppedEvent
Definition: floppy.h:83
KDPC MotorStopDpc
Definition: floppy.h:85
BOOLEAN ImpliedSeeks
Definition: floppy.h:79
VOID NTAPI KeInitializeTimer(OUT PKTIMER Timer)
Definition: timerobj.c:233

Referenced by AddControllers().

◆ Isr()

static BOOLEAN NTAPI Isr ( PKINTERRUPT  Interrupt,
PVOID  ServiceContext 
)
static

Definition at line 609 of file floppy.c.

635{
637
639
640 ASSERT(ControllerInfo);
641
642 TRACE_(FLOPPY, "ISR called\n");
643
644 /*
645 * Due to the stupidity of the drive/controller relationship on the floppy drive, only one device object
646 * can have an active interrupt pending. Due to the nature of these IRPs, though, there will only ever
647 * be one thread expecting an interrupt at a time, and furthermore, Interrupts (outside of spurious ones)
648 * won't ever happen unless a thread is expecting them. Therefore, all we have to do is signal an event
649 * and we're done. Queue a DPC and leave.
650 */
651 KeInsertQueueDpc(&ControllerInfo->Dpc, NULL, NULL);
652
653 return TRUE;
654}
BOOLEAN NTAPI KeInsertQueueDpc(IN PKDPC Dpc, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: dpc.c:725
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFINTERRUPT * Interrupt
Definition: wdfinterrupt.h:379
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID ServiceContext
Definition: iofuncs.h:801

Referenced by _HalpDismissIrqGeneric(), _HalpDismissIrqLevel(), AddControllers(), HalpDismissIrq07(), HalpDismissIrq07Level(), HalpDismissIrq15(), HalpDismissIrq15Level(), and HDA_SetupDmaEngineWithBdl().

◆ MotorStopDpcFunc()

static VOID NTAPI MotorStopDpcFunc ( PKDPC  UnusedDpc,
PVOID  DeferredContext,
PVOID  SystemArgument1,
PVOID  SystemArgument2 
)
static

Definition at line 128 of file floppy.c.

140{
142
145 UNREFERENCED_PARAMETER(UnusedDpc);
146
148 ASSERT(ControllerInfo);
149
150 TRACE_(FLOPPY, "MotorStopDpcFunc called\n");
151
152 HwTurnOffMotor(ControllerInfo);
153 ControllerInfo->StopDpcQueued = FALSE;
155}
NTSTATUS NTAPI HwTurnOffMotor(PCONTROLLER_INFO ControllerInfo)
Definition: hardware.c:223
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
_In_opt_ PVOID DeferredContext
Definition: ketypes.h:755

Referenced by InitController().

◆ QueueThread()

static VOID NTAPI QueueThread ( PVOID  Context)
static

Definition at line 1172 of file floppy.c.

1178{
1179 PIRP Irp;
1182 PVOID Objects[2];
1183
1184 PAGED_CODE();
1186
1187 Objects[0] = &QueueSemaphore;
1188 Objects[1] = &QueueThreadTerminate;
1189
1190 for(;;)
1191 {
1193
1195 {
1196 INFO_(FLOPPY, "QueueThread terminating\n");
1197 return;
1198 }
1199
1200 INFO_(FLOPPY, "QueueThread: servicing an IRP\n");
1201
1202 Irp = IoCsqRemoveNextIrp(&Csq, 0);
1203
1204 /* we won't get an irp if it was canceled */
1205 if(!Irp)
1206 {
1207 INFO_(FLOPPY, "QueueThread: IRP queue empty\n");
1208 continue;
1209 }
1210
1211 DeviceObject = (PDEVICE_OBJECT)Irp->Tail.Overlay.DriverContext[0];
1212
1214
1216
1217 /* Decide what to do with the IRP */
1218 switch(Stack->MajorFunction)
1219 {
1220 case IRP_MJ_READ:
1221 case IRP_MJ_WRITE:
1222 ReadWritePassive(DeviceObject->DeviceExtension, Irp);
1223 break;
1224
1226 DeviceIoctlPassive(DeviceObject->DeviceExtension, Irp);
1227 break;
1228
1229 default:
1230 WARN_(FLOPPY, "QueueThread(): Unrecognized irp: mj: 0x%x\n", Stack->MajorFunction);
1231 Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
1232 Irp->IoStatus.Information = 0;
1234 }
1235 }
1236}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
NTKERNELAPI PIRP NTAPI IoCsqRemoveNextIrp(_Inout_ PIO_CSQ Csq, _In_opt_ PVOID PeekContext)
IoCsqRemoveNextIrp - Removes the next IRP from the queue.
Definition: csq.c:398
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
VOID NTAPI DeviceIoctlPassive(PDRIVE_INFO DriveInfo, PIRP Irp)
Definition: ioctl.c:64
VOID NTAPI ReadWritePassive(PDRIVE_INFO DriveInfo, PIRP Irp)
Definition: readwrite.c:403
struct _DEVICE_OBJECT * PDEVICE_OBJECT
LONG NTAPI KeReadStateEvent(IN PKEVENT Event)
Definition: eventobj.c:121
@ WaitAny
NTSTATUS NTAPI KeWaitForMultipleObjects(IN ULONG Count, IN PVOID Object[], IN WAIT_TYPE WaitType, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL, OUT PKWAIT_BLOCK WaitBlockArray OPTIONAL)
Definition: wait.c:586
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639
#define IO_NO_INCREMENT
Definition: iotypes.h:598

Referenced by DriverEntry().

◆ Recalibrate()

static NTSTATUS NTAPI Recalibrate ( PDRIVE_INFO  DriveInfo)
static

Definition at line 284 of file floppy.c.

296{
298 ULONG i;
299
300 PAGED_CODE();
301 ASSERT(DriveInfo);
302
303 /* first turn on the motor */
304 /* Must stop after every start, prior to return */
305 StartMotor(DriveInfo);
306
307 /* set the data rate */
308 WARN_(FLOPPY, "FIXME: UN-HARDCODE DATA RATE\n");
309 if(HwSetDataRate(DriveInfo->ControllerInfo, 0) != STATUS_SUCCESS)
310 {
311 WARN_(FLOPPY, "Recalibrate: HwSetDataRate failed\n");
312 StopMotor(DriveInfo->ControllerInfo);
314 }
315
316 /* clear the event just in case the last call forgot */
317 KeClearEvent(&DriveInfo->ControllerInfo->SynchEvent);
318
319 /* sometimes you have to do this twice; we'll just do it twice all the time since
320 * we don't know if the people calling this Recalibrate routine expect a disk to
321 * even be in the drive, and if so, if that disk is formatted.
322 */
323 for(i = 0; i < 2; i++)
324 {
325 /* Send the command */
326 Status = HwRecalibrate(DriveInfo);
328 {
329 WARN_(FLOPPY, "Recalibrate: HwRecalibrate returned error\n");
330 continue;
331 }
332
334
335 /* Get the results */
338 {
339 WARN_(FLOPPY, "Recalibrate: HwRecalibrateResult returned error\n");
340 break;
341 }
342 }
343
344 KeClearEvent(&DriveInfo->ControllerInfo->SynchEvent);
345
346 /* Must stop after every start, prior to return */
347 StopMotor(DriveInfo->ControllerInfo);
348
349 return Status;
350}
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI HwRecalibrateResult(PCONTROLLER_INFO ControllerInfo)
Definition: hardware.c:394
NTSTATUS NTAPI HwRecalibrate(PDRIVE_INFO DriveInfo)
Definition: hardware.c:503
Status
Definition: gdiplustypes.h:24

Referenced by InitController(), and ResetChangeFlag().

◆ ReportToMountMgr()

static VOID NTAPI ReportToMountMgr ( UCHAR  ControlerId,
UCHAR  DriveId 
)
static

Definition at line 840 of file floppy.c.

851{
853 UNICODE_STRING MountMgrDevice;
856 PMOUNTMGR_TARGET_NAME MountTarget;
857 ULONG DeviceLen;
858 PIRP Irp;
861
862 /* First, get MountMgr DeviceObject */
866
867 if(!NT_SUCCESS(Status))
868 {
869 WARN_(FLOPPY, "ReportToMountMgr: Can't get MountMgr pointers %lx\n", Status);
870 return;
871 }
872
873 DeviceLen = wcslen(&gControllerInfo[ControlerId].DriveInfo[DriveId].DeviceNameBuffer[0]) * sizeof(WCHAR);
874
875 /* Allocate input buffer to report our floppy device */
876 MountTarget = ExAllocatePool(NonPagedPool,
877 sizeof(MOUNTMGR_TARGET_NAME) + DeviceLen);
878
879 if(!MountTarget)
880 {
881 WARN_(FLOPPY, "ReportToMountMgr: Allocation of mountTarget failed\n");
883 return;
884 }
885
886 MountTarget->DeviceNameLength = DeviceLen;
887 RtlCopyMemory(MountTarget->DeviceName,
888 gControllerInfo[ControlerId].DriveInfo[DriveId].DeviceNameBuffer,
889 DeviceLen);
890
892
893 /* Build the IRP used to communicate with the MountMgr */
896 MountTarget,
897 sizeof(MOUNTMGR_TARGET_NAME) + DeviceLen,
898 NULL,
899 0,
900 FALSE,
901 &Event,
902 &IoStatus);
903
904 if(!Irp)
905 {
906 WARN_(FLOPPY, "ReportToMountMgr: Allocation of irp failed\n");
907 ExFreePool(MountTarget);
909 return;
910 }
911
912 /* Call the MountMgr */
914
915 if (Status == STATUS_PENDING) {
917 Status = IoStatus.Status;
918 }
919
920 /* We're done */
921
922 INFO_(FLOPPY, "Reported to the MountMgr: %lx\n", Status);
923
924 ExFreePool(MountTarget);
926
927 return;
928}
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define NonPagedPool
Definition: env_spec_w32.h:307
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
#define MOUNTMGR_DEVICE_NAME
Definition: imports.h:74
#define IOCTL_MOUNTMGR_VOLUME_ARRIVAL_NOTIFICATION
Definition: imports.h:128
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:159
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
NTSTATUS NTAPI IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1446
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:881
#define IoCallDriver
Definition: irp.c:1225
short WCHAR
Definition: pedump.c:58
WCHAR DeviceNameBuffer[MAX_DEVICE_NAME]
Definition: floppy.h:52
USHORT DeviceNameLength
Definition: imports.h:152
WCHAR DeviceName[1]
Definition: imports.h:153
#define STATUS_PENDING
Definition: telnetd.h:14
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
* PFILE_OBJECT
Definition: iotypes.h:1998
@ Suspended
Definition: ketypes.h:472

Referenced by AddControllers().

◆ ResetChangeFlag()

NTSTATUS NTAPI ResetChangeFlag ( PDRIVE_INFO  DriveInfo)

Definition at line 354 of file floppy.c.

369{
370 BOOLEAN DiskChanged;
371
372 PAGED_CODE();
373 ASSERT(DriveInfo);
374
375 TRACE_(FLOPPY, "ResetChangeFlag called\n");
376
377 /* Try to recalibrate. We don't care if it works. */
378 Recalibrate(DriveInfo);
379
380 /* clear spurious interrupts in prep for seeks */
381 KeClearEvent(&DriveInfo->ControllerInfo->SynchEvent);
382
383 /* must re-start the drive because Recalibrate() stops it */
384 StartMotor(DriveInfo);
385
386 /* Seek to 1 */
387 if(HwSeek(DriveInfo, 1) != STATUS_SUCCESS)
388 {
389 WARN_(FLOPPY, "ResetChangeFlag(): HwSeek failed; returning STATUS_IO_DEVICE_ERROR\n");
390 StopMotor(DriveInfo->ControllerInfo);
392 }
393
395
397 {
398 WARN_(FLOPPY, "ResetChangeFlag(): HwSenseInterruptStatus failed; bailing out\n");
399 StopMotor(DriveInfo->ControllerInfo);
401 }
402
403 /* Seek back to 0 */
404 if(HwSeek(DriveInfo, 0) != STATUS_SUCCESS)
405 {
406 WARN_(FLOPPY, "ResetChangeFlag(): HwSeek failed; returning STATUS_IO_DEVICE_ERROR\n");
407 StopMotor(DriveInfo->ControllerInfo);
409 }
410
412
414 {
415 WARN_(FLOPPY, "ResetChangeFlag(): HwSenseInterruptStatus #2 failed; bailing\n");
416 StopMotor(DriveInfo->ControllerInfo);
418 }
419
420 /* Check the change bit */
421 if(HwDiskChanged(DriveInfo, &DiskChanged) != STATUS_SUCCESS)
422 {
423 WARN_(FLOPPY, "ResetChangeFlag(): HwDiskChanged failed; returning STATUS_IO_DEVICE_ERROR\n");
424 StopMotor(DriveInfo->ControllerInfo);
426 }
427
428 StopMotor(DriveInfo->ControllerInfo);
429
430 /* if the change flag is still set, there's probably no media in the drive. */
431 if(DiskChanged)
433
434 /* else we're done! */
435 return STATUS_SUCCESS;
436}
unsigned char BOOLEAN
Definition: actypes.h:127
NTSTATUS NTAPI HwSeek(PDRIVE_INFO DriveInfo, UCHAR Cylinder)
Definition: hardware.c:659
NTSTATUS NTAPI HwDiskChanged(PDRIVE_INFO DriveInfo, PBOOLEAN DiskChanged)
Definition: hardware.c:785
#define STATUS_NO_MEDIA_IN_DEVICE
Definition: udferr_usr.h:141

Referenced by DeviceIoctlPassive(), and ReadWritePassive().

◆ SignalMediaChanged()

VOID NTAPI SignalMediaChanged ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 1128 of file floppy.c.

1139{
1140 PDRIVE_INFO DriveInfo = DeviceObject->DeviceExtension;
1141
1142 TRACE_(FLOPPY, "SignalMediaChanged called\n");
1143
1144 DriveInfo->DiskChangeCount++;
1145
1146 /* If volume is not mounted, do NOT set verify and return STATUS_IO_DEVICE_ERROR */
1147 if(!(DeviceObject->Vpb->Flags & VPB_MOUNTED))
1148 {
1149 Irp->IoStatus.Status = STATUS_IO_DEVICE_ERROR;
1150 Irp->IoStatus.Information = 0;
1151 return;
1152 }
1153
1154 /* Notify the filesystem that it will need to verify the volume */
1156 Irp->IoStatus.Status = STATUS_VERIFY_REQUIRED;
1157 Irp->IoStatus.Information = 0;
1158
1159 /*
1160 * If this is a user-based, threaded request, let the IO manager know to pop up a box asking
1161 * the user to supply the correct media, but only if the error (which we just picked out above)
1162 * is deemed by the IO manager to be "user induced". The reason we don't just unconditionally
1163 * call IoSetHardError... is because MS might change the definition of "user induced" some day,
1164 * and we don't want to have to remember to re-code this.
1165 */
1166 if(Irp->Tail.Overlay.Thread && IoIsErrorUserInduced(Irp->IoStatus.Status))
1168}
#define DO_VERIFY_VOLUME
Definition: env_spec_w32.h:393
VOID NTAPI IoSetHardErrorOrVerifyDevice(IN PIRP Irp, IN PDEVICE_OBJECT DeviceObject)
Definition: util.c:316
ULONG DiskChangeCount
Definition: floppy.h:53
#define STATUS_VERIFY_REQUIRED
Definition: udferr_usr.h:130
#define IoIsErrorUserInduced(Status)
Definition: iofuncs.h:2817
#define VPB_MOUNTED
Definition: iotypes.h:1807

Referenced by DeviceIoctlPassive(), and ReadWritePassive().

◆ StartMotor()

VOID NTAPI StartMotor ( PDRIVE_INFO  DriveInfo)

Definition at line 159 of file floppy.c.

174{
175 PAGED_CODE();
176 ASSERT(DriveInfo);
177
178 TRACE_(FLOPPY, "StartMotor called\n");
179
180 if(DriveInfo->ControllerInfo->StopDpcQueued && !KeCancelTimer(&DriveInfo->ControllerInfo->MotorTimer))
181 {
182 /* Motor turner-offer is already running; wait for it to finish */
183 INFO_(FLOPPY, "StartMotor: motor turner-offer is already running; waiting for it\n");
184 KeWaitForSingleObject(&DriveInfo->ControllerInfo->MotorStoppedEvent, Executive, KernelMode, FALSE, NULL);
185 INFO_(FLOPPY, "StartMotor: wait satisfied\n");
186 }
187
188 DriveInfo->ControllerInfo->StopDpcQueued = FALSE;
189
190 if(HwTurnOnMotor(DriveInfo) != STATUS_SUCCESS)
191 {
192 WARN_(FLOPPY, "StartMotor(): warning: HwTurnOnMotor failed\n");
193 }
194}
NTSTATUS NTAPI HwTurnOnMotor(PDRIVE_INFO DriveInfo)
Definition: hardware.c:245
BOOLEAN NTAPI KeCancelTimer(IN OUT PKTIMER Timer)
Definition: timerobj.c:206

Referenced by AddControllers(), DeviceIoctlPassive(), ReadWritePassive(), Recalibrate(), and ResetChangeFlag().

◆ StopMotor()

VOID NTAPI StopMotor ( PCONTROLLER_INFO  ControllerInfo)

Definition at line 198 of file floppy.c.

208{
209 LARGE_INTEGER StopTime;
210
211 ASSERT(ControllerInfo);
212
213 TRACE_(FLOPPY, "StopMotor called\n");
214
215 /* one relative second, in 100-ns units */
216 StopTime.QuadPart = 10000000;
217 StopTime.QuadPart *= -1;
218
219 KeClearEvent(&ControllerInfo->MotorStoppedEvent);
220 KeSetTimer(&ControllerInfo->MotorTimer, StopTime, &ControllerInfo->MotorStopDpc);
221 ControllerInfo->StopDpcQueued = TRUE;
222}
BOOLEAN NTAPI KeSetTimer(IN OUT PKTIMER Timer, IN LARGE_INTEGER DueTime, IN PKDPC Dpc OPTIONAL)
Definition: timerobj.c:282

Referenced by AddControllers(), DeviceIoctlPassive(), ReadWritePassive(), Recalibrate(), and ResetChangeFlag().

◆ Unload()

static VOID NTAPI Unload ( PDRIVER_OBJECT  DriverObject)
static

Definition at line 440 of file floppy.c.

446{
447 PAGED_CODE();
448
449 TRACE_(FLOPPY, "unloading\n");
450
452}

Referenced by co_IntClientLoadLibrary(), DECLARE_INTERFACE_(), DriverEntry(), IntLoadHookModule(), KdpReportLoadSymbolsStateChange(), KdpSymbol(), and KdpTrap().

◆ WaitForControllerInterrupt()

NTSTATUS NTAPI WaitForControllerInterrupt ( PCONTROLLER_INFO  ControllerInfo,
PLARGE_INTEGER  Timeout 
)

Definition at line 226 of file floppy.c.

239{
241
242 PAGED_CODE();
243 ASSERT(ControllerInfo);
244
246 KeClearEvent(&ControllerInfo->SynchEvent);
247
248 return Status;
249}
static ULONG Timeout
Definition: ping.c:61

Referenced by InitController(), ReadWritePassive(), Recalibrate(), ResetChangeFlag(), RWDetermineMediaType(), and RWSeekToCylinder().

◆ ZwWaitForSingleObject()

Variable Documentation

◆ CreateClose

DRIVER_DISPATCH CreateClose
static

Definition at line 251 of file floppy.c.

Referenced by DriverEntry().

◆ gControllerInfo

CONTROLLER_INFO gControllerInfo[MAX_CONTROLLERS]
static

Definition at line 56 of file floppy.c.

Referenced by AddControllers(), Cleanup(), ConfigCallback(), DriverEntry(), and ReportToMountMgr().

◆ gNumberOfControllers

ULONG gNumberOfControllers = 0
static

Definition at line 57 of file floppy.c.

Referenced by AddControllers(), Cleanup(), and ConfigCallback().

◆ QueueThreadObject

PVOID QueueThreadObject
static

Definition at line 69 of file floppy.c.

Referenced by Cleanup(), and DriverEntry().

◆ QueueThreadTerminate

KEVENT QueueThreadTerminate
static

Definition at line 68 of file floppy.c.

Referenced by Cleanup(), DriverEntry(), and QueueThread().