ReactOS  0.4.15-dev-439-g292f67a
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

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 904 of file floppy.c.

920 {
921  INTERFACE_TYPE InterfaceType = Isa;
922  CONFIGURATION_TYPE ControllerType = DiskController;
923  CONFIGURATION_TYPE PeripheralType = FloppyDiskPeripheral;
926  UCHAR i;
927  UCHAR j;
928 
929  PAGED_CODE();
930 
931  /* Find our controllers on all ISA buses */
932  IoQueryDeviceDescription(&InterfaceType, 0, &ControllerType, 0, &PeripheralType, 0, ConfigCallback, 0);
933 
934  /*
935  * w2k breaks the return val from ConfigCallback, so we have to hack around it, rather than just
936  * looking for a return value from ConfigCallback. We expect at least one controller.
937  */
938  if(!gControllerInfo[0].Populated)
939  {
940  WARN_(FLOPPY, "AddControllers: failed to get controller info from registry\n");
941  return FALSE;
942  }
943 
944  /* Now that we have a controller, set it up with the system */
945  for(i = 0; i < gNumberOfControllers && gControllerInfo[i].NumberOfDrives > 0; i++)
946  {
947  /* 0: Report resource usage to the kernel, to make sure they aren't assigned to anyone else */
948  /* FIXME: Implement me. */
949 
950  /* 1: Set up interrupt */
953  &gControllerInfo[i].MappedLevel, &Affinity);
954 
955  /* Must set up the DPC before we connect the interrupt */
957 
958  INFO_(FLOPPY, "Connecting interrupt %d to controller%d (object 0x%p)\n", gControllerInfo[i].MappedVector,
959  i, &gControllerInfo[i]);
960 
961  /* NOTE: We cannot share our interrupt, even on level-triggered buses. See Isr() for details. */
963  gControllerInfo[i].MappedLevel, gControllerInfo[i].MappedLevel, gControllerInfo[i].InterruptMode,
964  FALSE, Affinity, 0) != STATUS_SUCCESS)
965  {
966  WARN_(FLOPPY, "AddControllers: unable to connect interrupt\n");
967  continue;
968  }
969 
970  /* 2: Set up DMA */
976  DeviceDescription.MaximumLength = 2*18*512; /* based on a 1.44MB floppy */
977 
978  /* DMA 0,1,2,3 are 8-bit; 4,5,6,7 are 16-bit (4 is chain i think) */
980 
982 
983  if(!gControllerInfo[i].AdapterObject)
984  {
985  WARN_(FLOPPY, "AddControllers: unable to allocate an adapter object\n");
987  continue;
988  }
989 
990  /* 2b: Initialize the new controller */
992  {
993  WARN_(FLOPPY, "AddControllers(): Unable to set up controller %d - initialization failed\n", i);
995  continue;
996  }
997 
998  /* 2c: Set the controller's initialized flag so we know to release stuff in Unload */
1000 
1001  /* 3: per-drive setup */
1002  for(j = 0; j < gControllerInfo[i].NumberOfDrives; j++)
1003  {
1005  UNICODE_STRING ArcPath;
1006  UCHAR DriveNumber;
1007 
1008  INFO_(FLOPPY, "AddControllers(): Configuring drive %d on controller %d\n", i, j);
1009 
1010  /*
1011  * 3a: create a device object for the drive
1012  * Controllers and drives are 0-based, so the combos are:
1013  * 0: 0,0
1014  * 1: 0,1
1015  * 2: 0,2
1016  * 3: 0,3
1017  * 4: 1,0
1018  * 5: 1,1
1019  * ...
1020  * 14: 3,2
1021  * 15: 3,3
1022  */
1023 
1024  DriveNumber = (UCHAR)(i*4 + j); /* loss of precision is OK; there are only 16 of 'em */
1025 
1026  swprintf(gControllerInfo[i].DriveInfo[j].DeviceNameBuffer, L"\\Device\\Floppy%d", DriveNumber);
1027  RtlInitUnicodeString(&DeviceName, gControllerInfo[i].DriveInfo[j].DeviceNameBuffer);
1028 
1031  &gControllerInfo[i].DriveInfo[j].DeviceObject) != STATUS_SUCCESS)
1032  {
1033  WARN_(FLOPPY, "AddControllers: unable to register a Device object\n");
1035  continue; /* continue on to next drive */
1036  }
1037 
1038  INFO_(FLOPPY, "AddControllers: New device: %S (0x%p)\n",
1039  gControllerInfo[i].DriveInfo[j].DeviceNameBuffer,
1040  gControllerInfo[i].DriveInfo[j].DeviceObject);
1041 
1042  /* 3b.5: Create an ARC path in case we're booting from this drive */
1043  swprintf(gControllerInfo[i].DriveInfo[j].ArcPathBuffer,
1044  L"\\ArcName\\multi(%d)disk(%d)fdisk(%d)", gControllerInfo[i].BusNumber, i, DriveNumber);
1045 
1046  RtlInitUnicodeString(&ArcPath, gControllerInfo[i].DriveInfo[j].ArcPathBuffer);
1047  IoAssignArcName(&ArcPath, &DeviceName);
1048 
1049  /* 3c: Set flags up */
1051 
1052  /* 3d: Increase global floppy drives count */
1054 
1055  /* 3e: Set up the DPC */
1057 
1058  /* 3f: Point the device extension at our DriveInfo struct */
1060 
1061  /* 3g: neat comic strip */
1062 
1063  /* 3h: set the initial media type to unknown */
1064  memset(&gControllerInfo[i].DriveInfo[j].DiskGeometry, 0, sizeof(DISK_GEOMETRY));
1066 
1067  /* 3i: Now that we're done, set the Initialized flag so we know to free this in Unload */
1069 
1070  /* 3j: Clear the DO_DEVICE_INITIALIZING flag */
1072 
1073  /* 3k: Report to the MountMgr */
1074  ReportToMountMgr(i, j);
1075 
1076  /* 3l: Attempt to get drive info - if a floppy is already present */
1077  StartMotor(&gControllerInfo[i].DriveInfo[j]);
1078  RWDetermineMediaType(&gControllerInfo[i].DriveInfo[j], TRUE);
1079  StopMotor(gControllerInfo[i].DriveInfo[j].ControllerInfo);
1080  }
1081  }
1082 
1083  INFO_(FLOPPY, "AddControllers: --------------------------------------------> finished adding controllers\n");
1084 
1085  return (IoGetConfigurationInformation()->FloppyCount != 0);
1086 }
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
FORCEINLINE VOID IoInitializeDpcRequest(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIO_DPC_ROUTINE DpcRoutine)
Definition: iofuncs.h:2792
#define FILE_DEVICE_DISK
Definition: winioctl.h:112
#define TRUE
Definition: types.h:120
INTERFACE_TYPE InterfaceType
Definition: floppy.h:62
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG _In_ KIRQL _In_ KIRQL _In_ KINTERRUPT_MODE InterruptMode
Definition: iofuncs.h:798
enum _INTERFACE_TYPE INTERFACE_TYPE
#define INFO_(ch,...)
Definition: debug.h:159
PCONFIGURATION_INFORMATION NTAPI IoGetConfigurationInformation(VOID)
Definition: iorsrce.c:830
BOOLEAN Initialized
Definition: floppy.h:54
ULONG BusNumber
Definition: floppy.h:63
VOID NTAPI StartMotor(PDRIVE_INFO DriveInfo)
Definition: floppy.c:96
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
WCHAR DeviceName[]
Definition: adapter.cpp:21
VOID NTAPI StopMotor(PCONTROLLER_INFO ControllerInfo)
Definition: floppy.c:135
UCHAR NumberOfDrives
Definition: fdc.h:58
#define DEVICE_DESCRIPTION_VERSION
Definition: iotypes.h:2020
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
PDEVICE_OBJECT DeviceObject
Definition: fdc.h:26
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
PADAPTER_OBJECT AdapterObject
Definition: floppy.h:77
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:22
#define FILE_REMOVABLE_MEDIA
Definition: nt_native.h:807
PVOID DeviceExtension
Definition: env_spec_w32.h:418
VOID NTAPI IoDisconnectInterrupt(PKINTERRUPT InterruptObject)
Definition: irq.c:140
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
NTHALAPI ULONG NTAPI HalGetInterruptVector(INTERFACE_TYPE, ULONG, ULONG, ULONG, PKIRQL, PKAFFINITY)
static CONTROLLER_INFO gControllerInfo[MAX_CONTROLLERS]
Definition: floppy.c:56
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
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
static BOOLEAN NTAPI Isr(PKINTERRUPT Interrupt, PVOID ServiceContext)
Definition: floppy.c:581
NTSTATUS NTAPI IoQueryDeviceDescription(PINTERFACE_TYPE BusType OPTIONAL, PULONG BusNumber OPTIONAL, PCONFIGURATION_TYPE ControllerType OPTIONAL, PULONG ControllerNumber OPTIONAL, PCONFIGURATION_TYPE PeripheralType OPTIONAL, PULONG PeripheralNumber OPTIONAL, PIO_QUERY_DEVICE_ROUTINE CalloutRoutine, PVOID Context)
Definition: iorsrce.c:1011
_Must_inspect_result_ _In_ PDEVICE_DESCRIPTION DeviceDescription
Definition: iofuncs.h:1015
_In_ LARGE_INTEGER _In_opt_ PKDPC Dpc
Definition: kefuncs.h:511
#define swprintf(buf, format,...)
Definition: sprintf.c:56
IO_DPC_ROUTINE * PIO_DPC_ROUTINE
Definition: iotypes.h:2492
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
Definition: halfuncs.h:170
MEDIA_TYPE MediaType
Definition: ntdddisk.h:378
DMA_WIDTH DmaWidth
Definition: iotypes.h:2037
unsigned char UCHAR
Definition: xmlstorage.h:181
static const WCHAR L[]
Definition: oid.c:1250
CONFIGURATION_TYPE
Definition: iotypes.h:4037
DISK_GEOMETRY DiskGeometry
Definition: floppy.h:49
BOOLEAN Initialized
Definition: floppy.h:60
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:428
static ULONG gNumberOfControllers
Definition: floppy.c:57
ULONG MappedVector
Definition: floppy.h:67
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1569
ULONG_PTR KAFFINITY
Definition: compat.h:75
#define IoAssignArcName(_ArcName, _DeviceName)
VOID NTAPI DpcForIsr(PKDPC UnusedDpc, PVOID Context, PVOID SystemArgument1, PVOID SystemArgument2)
Definition: floppy.c:630
DRIVE_INFO DriveInfo[MAX_DRIVES_PER_CONTROLLER]
Definition: fdc.h:60
NTSTATUS NTAPI RWDetermineMediaType(PDRIVE_INFO DriveInfo, BOOLEAN OneShot)
Definition: readwrite.c:153
INTERFACE_TYPE InterfaceType
Definition: iotypes.h:2036
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:1031
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static VOID NTAPI ReportToMountMgr(UCHAR ControlerId, UCHAR DriveId)
Definition: floppy.c:812
static NTSTATUS NTAPI InitController(PCONTROLLER_INFO ControllerInfo)
Definition: floppy.c:663
#define FILE_FLOPPY_DISKETTE
Definition: nt_native.h:809
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:711
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define memset(x, y, z)
Definition: compat.h:39
#define WARN_(ch,...)
Definition: debug.h:157
PADAPTER_OBJECT NTAPI HalGetAdapter(IN PDEVICE_DESCRIPTION DeviceDescription, OUT PULONG NumberOfMapRegisters)
Definition: dma.c:22
#define PAGED_CODE()

Referenced by DriverEntry().

◆ 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 428 of file floppy.c.

469 {
470  PKEY_VALUE_FULL_INFORMATION ControllerFullDescriptor = ControllerInformation[IoQueryDeviceConfigurationData];
471  PCM_FULL_RESOURCE_DESCRIPTOR ControllerResourceDescriptor = (PCM_FULL_RESOURCE_DESCRIPTOR)((PCHAR)ControllerFullDescriptor +
472  ControllerFullDescriptor->DataOffset);
473 
474  PKEY_VALUE_FULL_INFORMATION PeripheralFullDescriptor = PeripheralInformation[IoQueryDeviceConfigurationData];
475  PCM_FULL_RESOURCE_DESCRIPTOR PeripheralResourceDescriptor = (PCM_FULL_RESOURCE_DESCRIPTOR)((PCHAR)PeripheralFullDescriptor +
476  PeripheralFullDescriptor->DataOffset);
477 
478  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
479  PCM_FLOPPY_DEVICE_DATA FloppyDeviceData;
480  UCHAR i;
481 
482  PAGED_CODE();
483  UNREFERENCED_PARAMETER(PeripheralType);
484  UNREFERENCED_PARAMETER(PeripheralNumber);
485  UNREFERENCED_PARAMETER(BusInformation);
487  UNREFERENCED_PARAMETER(ControllerType);
488  UNREFERENCED_PARAMETER(PathName);
489 
490 
491  TRACE_(FLOPPY, "ConfigCallback called with ControllerNumber %d\n", ControllerNumber);
492 
496 
497  /* Get controller interrupt level/vector, dma channel, and port base */
498  for(i = 0; i < ControllerResourceDescriptor->PartialResourceList.Count; i++)
499  {
501 
502  PartialDescriptor = &ControllerResourceDescriptor->PartialResourceList.PartialDescriptors[i];
503 
504  if(PartialDescriptor->Type == CmResourceTypeInterrupt)
505  {
506  gControllerInfo[gNumberOfControllers].Level = PartialDescriptor->u.Interrupt.Level;
507  gControllerInfo[gNumberOfControllers].Vector = PartialDescriptor->u.Interrupt.Vector;
508 
509  if(PartialDescriptor->Flags & CM_RESOURCE_INTERRUPT_LATCHED)
511  else
513  }
514 
515  else if(PartialDescriptor->Type == CmResourceTypePort)
516  {
518  ULONG AddressSpace = 0x1; /* I/O Port Range */
519 
520  if(!HalTranslateBusAddress(BusType, BusNumber, PartialDescriptor->u.Port.Start, &AddressSpace, &TranslatedAddress))
521  {
522  WARN_(FLOPPY, "HalTranslateBusAddress failed; returning\n");
523  return STATUS_IO_DEVICE_ERROR;
524  }
525 
526  if(AddressSpace == 0)
528  else
530  }
531 
532  else if(PartialDescriptor->Type == CmResourceTypeDma)
533  gControllerInfo[gNumberOfControllers].Dma = PartialDescriptor->u.Dma.Channel;
534  }
535 
536  /* Start with 0 drives, then go looking */
538 
539  /* learn about drives attached to controller */
540  for(i = 0; i < PeripheralResourceDescriptor->PartialResourceList.Count; i++)
541  {
543 
544  PartialDescriptor = &PeripheralResourceDescriptor->PartialResourceList.PartialDescriptors[i];
545 
546  if(PartialDescriptor->Type != CmResourceTypeDeviceSpecific)
547  continue;
548 
549  FloppyDeviceData = (PCM_FLOPPY_DEVICE_DATA)(PartialDescriptor + 1);
550 
552  DriveInfo->UnitNumber = i;
553 
554  DriveInfo->FloppyDeviceData.MaxDensity = FloppyDeviceData->MaxDensity;
555  DriveInfo->FloppyDeviceData.MountDensity = FloppyDeviceData->MountDensity;
556  DriveInfo->FloppyDeviceData.StepRateHeadUnloadTime = FloppyDeviceData->StepRateHeadUnloadTime;
557  DriveInfo->FloppyDeviceData.HeadLoadTime = FloppyDeviceData->HeadLoadTime;
558  DriveInfo->FloppyDeviceData.MotorOffTime = FloppyDeviceData->MotorOffTime;
559  DriveInfo->FloppyDeviceData.SectorLengthCode = FloppyDeviceData->SectorLengthCode;
560  DriveInfo->FloppyDeviceData.SectorPerTrack = FloppyDeviceData->SectorPerTrack;
561  DriveInfo->FloppyDeviceData.ReadWriteGapLength = FloppyDeviceData->ReadWriteGapLength;
562  DriveInfo->FloppyDeviceData.FormatGapLength = FloppyDeviceData->FormatGapLength;
563  DriveInfo->FloppyDeviceData.FormatFillCharacter = FloppyDeviceData->FormatFillCharacter;
564  DriveInfo->FloppyDeviceData.HeadSettleTime = FloppyDeviceData->HeadSettleTime;
565  DriveInfo->FloppyDeviceData.MotorSettleTime = FloppyDeviceData->MotorSettleTime;
566  DriveInfo->FloppyDeviceData.MaximumTrackValue = FloppyDeviceData->MaximumTrackValue;
567  DriveInfo->FloppyDeviceData.DataTransferLength = FloppyDeviceData->DataTransferLength;
568 
569  /* Once it's all set up, acknowledge its existence in the controller info object */
571  }
572 
575 
576  return STATUS_SUCCESS;
577 }
signed char * PCHAR
Definition: retypes.h:7
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@379::@381 Port
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
#define TRUE
Definition: types.h:120
INTERFACE_TYPE InterfaceType
Definition: floppy.h:62
ULONG ControllerNumber
Definition: floppy.h:61
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE BusType
Definition: halfuncs.h:156
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
Definition: iofuncs.h:2268
unsigned char * PUCHAR
Definition: retypes.h:3
ULONG BusNumber
Definition: floppy.h:63
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@379::@382 Interrupt
ULONG Vector
Definition: floppy.h:66
PVOID NTAPI MmMapIoSpace(IN PHYSICAL_ADDRESS PhysicalAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
Definition: iosup.c:47
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
Definition: iofuncs.h:2268
struct _CONTROLLER_INFO * ControllerInfo
Definition: fdc.h:23
UCHAR NumberOfDrives
Definition: fdc.h:58
#define CmResourceTypePort
Definition: hwresource.cpp:123
uint32_t ULONG_PTR
Definition: typedefs.h:64
#define STATUS_IO_DEVICE_ERROR
Definition: udferr_usr.h:179
CM_PARTIAL_RESOURCE_LIST PartialResourceList
Definition: hwresource.cpp:160
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
BOOLEAN Populated
Definition: fdc.h:39
struct _CM_FULL_RESOURCE_DESCRIPTOR * PCM_FULL_RESOURCE_DESCRIPTOR
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@379::@385 Dma
static CONTROLLER_INFO gControllerInfo[MAX_CONTROLLERS]
Definition: floppy.c:56
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
#define TRACE_(x)
Definition: compat.h:66
unsigned char UCHAR
Definition: xmlstorage.h:181
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
CM_FLOPPY_DEVICE_DATA FloppyDeviceData
Definition: fdc.h:27
KINTERRUPT_MODE InterruptMode
Definition: floppy.h:68
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@379 u
static ULONG gNumberOfControllers
Definition: floppy.c:57
UCHAR UnitNumber
Definition: fdc.h:24
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
ULONG Level
Definition: floppy.h:64
UCHAR StepRateHeadUnloadTime
Definition: cmtypes.h:489
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
DRIVE_INFO DriveInfo[MAX_DRIVES_PER_CONTROLLER]
Definition: fdc.h:60
struct _CM_FLOPPY_DEVICE_DATA * PCM_FLOPPY_DEVICE_DATA
PUCHAR BaseAddress
Definition: fdc.h:49
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define WARN_(ch,...)
Definition: debug.h:157
#define FDC_PORT_BYTES
Definition: hardware.h:40
#define CmResourceTypeDma
Definition: hwresource.cpp:126
LONGLONG QuadPart
Definition: typedefs.h:113
#define PAGED_CODE()

Referenced by AddControllers().

◆ CreateClose()

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

Definition at line 189 of file floppy.c.

206 {
208 
209  TRACE_(FLOPPY, "CreateClose called\n");
210 
211  Irp->IoStatus.Status = STATUS_SUCCESS;
212  Irp->IoStatus.Information = FILE_OPENED;
213 
215 
216  return STATUS_SUCCESS;
217 }
_In_ PIRP Irp
Definition: csq.h:116
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define FILE_OPENED
Definition: nt_native.h:769
#define IO_DISK_INCREMENT
Definition: iotypes.h:568
#define IoCompleteRequest
Definition: irp.c:1240
#define TRACE_(x)
Definition: compat.h:66
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1569
return STATUS_SUCCESS
Definition: btrfs.c:3014

◆ DpcForIsr()

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

Definition at line 630 of file floppy.c.

647 {
648  PCONTROLLER_INFO ControllerInfo = (PCONTROLLER_INFO)Context;
649 
650  UNREFERENCED_PARAMETER(UnusedDpc);
653 
654  ASSERT(ControllerInfo);
655 
656  TRACE_(FLOPPY, "DpcForIsr called\n");
657 
658  KeSetEvent(&ControllerInfo->SynchEvent, EVENT_INCREMENT, FALSE);
659 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:675
#define TRACE_(x)
Definition: compat.h:66
struct _CONTROLLER_INFO * PCONTROLLER_INFO
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:675
#define EVENT_INCREMENT
Definition: iotypes.h:565
KEVENT SynchEvent
Definition: floppy.h:74

Referenced by AddControllers().

◆ DriverEntry()

NTSTATUS NTAPI DriverEntry ( PDRIVER_OBJECT  DriverObject,
PUNICODE_STRING  RegistryPath 
)

Definition at line 1202 of file floppy.c.

1213 {
1214  HANDLE ThreadHandle;
1215 
1217 
1218  /*
1219  * Set up dispatch routines
1220  */
1226 
1228 
1229  /*
1230  * We depend on some zeroes in these structures. I know this is supposed to be
1231  * initialized to 0 by the complier but this makes me feel beter.
1232  */
1233  memset(&gControllerInfo, 0, sizeof(gControllerInfo));
1234 
1235  /*
1236  * Set up queue. This routine cannot fail (trust me, I wrote it).
1237  */
1240 
1241  /*
1242  * ...and its lock
1243  */
1245 
1246  /*
1247  * ...and the queue list itself
1248  */
1250 
1251  /*
1252  * The queue is counted by a semaphore. The queue management thread
1253  * blocks on this semaphore, so if requests come in faster than the queue
1254  * thread can handle them, the semaphore count goes up.
1255  */
1256  KeInitializeSemaphore(&QueueSemaphore, 0, 0x7fffffff);
1257 
1258  /*
1259  * Event to terminate that thread
1260  */
1262 
1263  /*
1264  * Create the queue processing thread. Save its handle in the global variable
1265  * ThreadHandle so we can wait on its termination during Unload.
1266  */
1267  if(PsCreateSystemThread(&ThreadHandle, THREAD_ALL_ACCESS, 0, 0, 0, QueueThread, 0) != STATUS_SUCCESS)
1268  {
1269  WARN_(FLOPPY, "Unable to create system thread; failing init\n");
1271  }
1272 
1274  {
1275  WARN_(FLOPPY, "Unable to reference returned thread handle; failing init\n");
1276  return STATUS_UNSUCCESSFUL;
1277  }
1278 
1279  /*
1280  * Close the handle, now that we have the object pointer and a reference of our own.
1281  * The handle will certainly not be valid in the context of the caller next time we
1282  * need it, as handles are process-specific.
1283  */
1284  ZwClose(ThreadHandle);
1285 
1286  /*
1287  * Start the device discovery process. Returns STATUS_SUCCESS if
1288  * it finds even one drive attached to one controller.
1289  */
1291  return STATUS_NO_SUCH_DEVICE;
1292 
1293  return STATUS_SUCCESS;
1294 }
_In_ PIO_CSQ_INSERT_IRP CsqInsertIrp
Definition: iofuncs.h:1884
#define THREAD_ALL_ACCESS
Definition: nt_native.h:1339
static BOOLEAN NTAPI AddControllers(PDRIVER_OBJECT DriverObject)
Definition: floppy.c:904
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
LIST_ENTRY IrpQueue
Definition: csqrtns.c:49
_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:1884
static PVOID QueueThreadObject
Definition: floppy.c:61
KSEMAPHORE QueueSemaphore
Definition: csqrtns.c:51
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:496
DRIVER_DISPATCH DeviceIoctl
Definition: ioctl.h:29
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:238
smooth NULL
Definition: ftsmooth.c:416
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
static CONTROLLER_INFO gControllerInfo[MAX_CONTROLLERS]
Definition: floppy.c:56
_In_ PIO_CSQ_INSERT_IRP _In_ PIO_CSQ_REMOVE_IRP _In_ PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp
Definition: iofuncs.h:1884
_In_ PIO_CSQ_INSERT_IRP _In_ PIO_CSQ_REMOVE_IRP CsqRemoveIrp
Definition: iofuncs.h:1884
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
_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:1884
static VOID NTAPI QueueThread(PVOID Context)
Definition: floppy.c:1134
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
POBJECT_TYPE PsThreadType
Definition: thread.c:20
PDRIVER_UNLOAD DriverUnload
Definition: iotypes.h:2180
static DRIVER_DISPATCH CreateClose
Definition: floppy.c:188
KSPIN_LOCK IrpQueueLock
Definition: csqrtns.c:50
DRIVER_DISPATCH * PDRIVER_DISPATCH
Definition: iotypes.h:2154
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define STANDARD_RIGHTS_ALL
Definition: nt_native.h:69
static KEVENT QueueThreadTerminate
Definition: floppy.c:60
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
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
static VOID NTAPI Unload(PDRIVER_OBJECT DriverObject)
Definition: floppy.c:377
#define IRP_MJ_READ
Definition: rdpdr.c:46
IO_CSQ Csq
Definition: csqrtns.c:46
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]
Definition: iotypes.h:2181
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:28
DRIVER_DISPATCH ReadWrite
Definition: readwrite.h:29
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
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
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define memset(x, y, z)
Definition: compat.h:39
_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:1884
#define WARN_(ch,...)
Definition: debug.h:157
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52

◆ InitController()

static NTSTATUS NTAPI InitController ( PCONTROLLER_INFO  ControllerInfo)
static

Definition at line 663 of file floppy.c.

672 {
673  int i;
674  UCHAR HeadLoadTime;
675  UCHAR HeadUnloadTime;
676  UCHAR StepRateTime;
677  UCHAR ControllerVersion;
678 
679  PAGED_CODE();
680  ASSERT(ControllerInfo);
681 
682  TRACE_(FLOPPY, "InitController called with Controller 0x%p\n", ControllerInfo);
683 
684  /* Get controller in a known state */
685  if(HwConfigure(ControllerInfo, FALSE, TRUE, TRUE, 0, 0) != STATUS_SUCCESS)
686  {
687  WARN_(FLOPPY, "InitController: unable to configure controller\n");
688  return STATUS_IO_DEVICE_ERROR;
689  }
690 
691  /* Get the controller version */
692  ControllerVersion = HwGetVersion(ControllerInfo);
693 
694  KeClearEvent(&ControllerInfo->SynchEvent);
695 
696  /* Reset the controller */
697  if(HwReset(ControllerInfo) != STATUS_SUCCESS)
698  {
699  WARN_(FLOPPY, "InitController: unable to reset controller\n");
700  return STATUS_IO_DEVICE_ERROR;
701  }
702 
703  INFO_(FLOPPY, "InitController: waiting for initial interrupt\n");
704 
705  /* Wait for an interrupt */
706  WaitForControllerInterrupt(ControllerInfo, NULL);
707 
708  /* Reset means you have to clear each of the four interrupts (one per drive) */
709  for(i = 0; i < MAX_DRIVES_PER_CONTROLLER; i++)
710  {
711  INFO_(FLOPPY, "InitController: Sensing interrupt %d\n", i);
712 
713  if(HwSenseInterruptStatus(ControllerInfo) != STATUS_SUCCESS)
714  {
715  WARN_(FLOPPY, "InitController: Unable to clear interrupt 0x%x\n", i);
716  return STATUS_IO_DEVICE_ERROR;
717  }
718  }
719 
720  INFO_(FLOPPY, "InitController: done sensing interrupts\n");
721 
722  /* Next, see if we have the right version to do implied seek */
723  if(ControllerVersion == VERSION_ENHANCED)
724  {
725  /* If so, set that up -- all defaults below except first TRUE for EIS */
726  if(HwConfigure(ControllerInfo, TRUE, TRUE, TRUE, 0, 0) != STATUS_SUCCESS)
727  {
728  WARN_(FLOPPY, "InitController: unable to set up implied seek\n");
729  ControllerInfo->ImpliedSeeks = FALSE;
730  }
731  else
732  {
733  INFO_(FLOPPY, "InitController: implied seeks set!\n");
734  ControllerInfo->ImpliedSeeks = TRUE;
735  }
736 
737  /*
738  * FIXME: Figure out the answer to the below
739  *
740  * I must admit that I'm really confused about the Model 30 issue. At least one
741  * important bit (the disk change bit in the DIR) is flipped if this is a Model 30
742  * controller. However, at least one other floppy driver believes that there are only
743  * two computers that are guaranteed to have a Model 30 controller:
744  * - IBM Thinkpad 750
745  * - IBM PS2e
746  *
747  * ...and another driver only lists a config option for "thinkpad", that flips
748  * the change line. A third driver doesn't mention the Model 30 issue at all.
749  *
750  * What I can't tell is whether or not the average, run-of-the-mill computer now has
751  * a Model 30 controller. For the time being, I'm going to wire this to FALSE,
752  * and just not support the computers mentioned above, while I try to figure out
753  * how ubiquitous these newfangled 30 thingies are.
754  */
755  //ControllerInfo->Model30 = TRUE;
756  ControllerInfo->Model30 = FALSE;
757  }
758  else
759  {
760  INFO_(FLOPPY, "InitController: enhanced version not supported; disabling implied seeks\n");
761  ControllerInfo->ImpliedSeeks = FALSE;
762  ControllerInfo->Model30 = FALSE;
763  }
764 
765  /* Specify */
766  WARN_(FLOPPY, "FIXME: Figure out speed\n");
767  HeadLoadTime = SPECIFY_HLT_500K;
768  HeadUnloadTime = SPECIFY_HUT_500K;
769  StepRateTime = SPECIFY_SRT_500K;
770 
771  INFO_(FLOPPY, "InitController: setting data rate\n");
772 
773  /* Set data rate */
774  if(HwSetDataRate(ControllerInfo, DRSR_DSEL_500KBPS) != STATUS_SUCCESS)
775  {
776  WARN_(FLOPPY, "InitController: unable to set data rate\n");
777  return STATUS_IO_DEVICE_ERROR;
778  }
779 
780  INFO_(FLOPPY, "InitController: issuing specify command to controller\n");
781 
782  /* Don't disable DMA --> enable dma (dumb & confusing) */
783  if(HwSpecify(ControllerInfo, HeadLoadTime, HeadUnloadTime, StepRateTime, FALSE) != STATUS_SUCCESS)
784  {
785  WARN_(FLOPPY, "InitController: unable to specify options\n");
786  return STATUS_IO_DEVICE_ERROR;
787  }
788 
789  /* Init the stop stuff */
790  KeInitializeDpc(&ControllerInfo->MotorStopDpc, MotorStopDpcFunc, ControllerInfo);
791  KeInitializeTimer(&ControllerInfo->MotorTimer);
793  ControllerInfo->StopDpcQueued = FALSE;
794 
795  /*
796  * Recalibrate each drive on the controller (depends on StartMotor, which depends on the timer stuff above)
797  * We don't even know if there is a disk in the drive, so this may not work, but that's OK.
798  */
799  for(i = 0; i < ControllerInfo->NumberOfDrives; i++)
800  {
801  INFO_(FLOPPY, "InitController: recalibrating drive 0x%x on controller 0x%p\n", i, ControllerInfo);
802  Recalibrate(&ControllerInfo->DriveInfo[i]);
803  }
804 
805  INFO_(FLOPPY, "InitController: done initializing; returning STATUS_SUCCESS\n");
806 
807  return STATUS_SUCCESS;
808 }
NTSTATUS NTAPI HwSetDataRate(PCONTROLLER_INFO ControllerInfo, UCHAR DataRate)
Definition: hardware.c:204
#define TRUE
Definition: types.h:120
#define INFO_(ch,...)
Definition: debug.h:159
static NTSTATUS NTAPI Recalibrate(PDRIVE_INFO DriveInfo)
Definition: floppy.c:221
#define MAX_DRIVES_PER_CONTROLLER
Definition: fdc.h:16
NTSTATUS NTAPI HwReset(PCONTROLLER_INFO ControllerInfo)
Definition: hardware.c:973
#define SPECIFY_HLT_500K
Definition: hardware.h:219
UCHAR NumberOfDrives
Definition: fdc.h:58
#define STATUS_IO_DEVICE_ERROR
Definition: udferr_usr.h:179
BOOLEAN ImpliedSeeks
Definition: floppy.h:79
static VOID NTAPI MotorStopDpcFunc(PKDPC UnusedDpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2)
Definition: floppy.c:65
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
smooth NULL
Definition: ftsmooth.c:416
VOID NTAPI KeInitializeTimer(OUT PKTIMER Timer)
Definition: timerobj.c:233
#define TRACE_(x)
Definition: compat.h:66
KDPC MotorStopDpc
Definition: floppy.h:85
#define SPECIFY_SRT_500K
Definition: hardware.h:227
#define VERSION_ENHANCED
Definition: hardware.h:239
KEVENT MotorStoppedEvent
Definition: floppy.h:83
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
NTSTATUS NTAPI HwSenseInterruptStatus(PCONTROLLER_INFO ControllerInfo)
Definition: hardware.c:539
unsigned char UCHAR
Definition: xmlstorage.h:181
BOOLEAN Model30
Definition: floppy.h:82
BOOLEAN StopDpcQueued
Definition: floppy.h:86
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
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
KEVENT SynchEvent
Definition: floppy.h:74
DRIVE_INFO DriveInfo[MAX_DRIVES_PER_CONTROLLER]
Definition: fdc.h:60
#define SPECIFY_HUT_500K
Definition: hardware.h:223
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:711
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define DRSR_DSEL_500KBPS
Definition: hardware.h:106
#define WARN_(ch,...)
Definition: debug.h:157
NTSTATUS NTAPI HwSpecify(PCONTROLLER_INFO ControllerInfo, UCHAR HeadLoadTime, UCHAR HeadUnloadTime, UCHAR StepRateTime, BOOLEAN NonDma)
Definition: hardware.c:925
NTSTATUS NTAPI WaitForControllerInterrupt(PCONTROLLER_INFO ControllerInfo, PLARGE_INTEGER Timeout)
Definition: floppy.c:163
#define PAGED_CODE()
KTIMER MotorTimer
Definition: floppy.h:84

Referenced by AddControllers().

◆ Isr()

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

Definition at line 581 of file floppy.c.

607 {
609 
610  UNREFERENCED_PARAMETER(Interrupt);
611 
612  ASSERT(ControllerInfo);
613 
614  TRACE_(FLOPPY, "ISR called\n");
615 
616  /*
617  * Due to the stupidity of the drive/controller relationship on the floppy drive, only one device object
618  * can have an active interrupt pending. Due to the nature of these IRPs, though, there will only ever
619  * be one thread expecting an interrupt at a time, and furthermore, Interrupts (outside of spurious ones)
620  * won't ever happen unless a thread is expecting them. Therefore, all we have to do is signal an event
621  * and we're done. Queue a DPC and leave.
622  */
623  KeInsertQueueDpc(&ControllerInfo->Dpc, NULL, NULL);
624 
625  return TRUE;
626 }
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
BOOLEAN NTAPI KeInsertQueueDpc(IN PKDPC Dpc, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: dpc.c:724
smooth NULL
Definition: ftsmooth.c:416
#define TRACE_(x)
Definition: compat.h:66
struct _CONTROLLER_INFO * PCONTROLLER_INFO
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID ServiceContext
Definition: iofuncs.h:798
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)

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

◆ MotorStopDpcFunc()

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

Definition at line 65 of file floppy.c.

77 {
79 
82  UNREFERENCED_PARAMETER(UnusedDpc);
83 
85  ASSERT(ControllerInfo);
86 
87  TRACE_(FLOPPY, "MotorStopDpcFunc called\n");
88 
89  HwTurnOffMotor(ControllerInfo);
90  ControllerInfo->StopDpcQueued = FALSE;
92 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:675
#define TRACE_(x)
Definition: compat.h:66
struct _CONTROLLER_INFO * PCONTROLLER_INFO
KEVENT MotorStoppedEvent
Definition: floppy.h:83
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
BOOLEAN StopDpcQueued
Definition: floppy.h:86
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:675
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define EVENT_INCREMENT
Definition: iotypes.h:565
NTSTATUS NTAPI HwTurnOffMotor(PCONTROLLER_INFO ControllerInfo)
Definition: hardware.c:223
_In_opt_ PVOID DeferredContext
Definition: ketypes.h:675

Referenced by InitController().

◆ QueueThread()

static VOID NTAPI QueueThread ( PVOID  Context)
static

Definition at line 1134 of file floppy.c.

1140 {
1141  PIRP Irp;
1142  PIO_STACK_LOCATION Stack;
1144  PVOID Objects[2];
1145 
1146  PAGED_CODE();
1148 
1149  Objects[0] = &QueueSemaphore;
1150  Objects[1] = &QueueThreadTerminate;
1151 
1152  for(;;)
1153  {
1155 
1157  {
1158  INFO_(FLOPPY, "QueueThread terminating\n");
1159  return;
1160  }
1161 
1162  INFO_(FLOPPY, "QueueThread: servicing an IRP\n");
1163 
1164  Irp = IoCsqRemoveNextIrp(&Csq, 0);
1165 
1166  /* we won't get an irp if it was canceled */
1167  if(!Irp)
1168  {
1169  INFO_(FLOPPY, "QueueThread: IRP queue empty\n");
1170  continue;
1171  }
1172 
1173  DeviceObject = (PDEVICE_OBJECT)Irp->Tail.Overlay.DriverContext[0];
1174 
1176 
1178 
1179  /* Decide what to do with the IRP */
1180  switch(Stack->MajorFunction)
1181  {
1182  case IRP_MJ_READ:
1183  case IRP_MJ_WRITE:
1185  break;
1186 
1187  case IRP_MJ_DEVICE_CONTROL:
1189  break;
1190 
1191  default:
1192  WARN_(FLOPPY, "QueueThread(): Unrecognized irp: mj: 0x%x\n", Stack->MajorFunction);
1193  Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
1194  Irp->IoStatus.Information = 0;
1196  }
1197  }
1198 }
#define INFO_(ch,...)
Definition: debug.h:159
NTKERNELAPI PIRP NTAPI IoCsqRemoveNextIrp(_Inout_ PIO_CSQ Csq, _In_opt_ PVOID PeekContext)
IoCsqRemoveNextIrp - Removes the next IRP from the queue.
Definition: csq.c:398
_In_ PIRP Irp
Definition: csq.h:116
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
struct _DEVICE_OBJECT * PDEVICE_OBJECT
VOID NTAPI ReadWritePassive(PDRIVE_INFO DriveInfo, PIRP Irp)
Definition: readwrite.c:403
KSEMAPHORE QueueSemaphore
Definition: csqrtns.c:51
VOID NTAPI DeviceIoctlPassive(PDRIVE_INFO DriveInfo, PIRP Irp)
Definition: ioctl.c:64
PVOID DeviceExtension
Definition: env_spec_w32.h:418
smooth NULL
Definition: ftsmooth.c:416
#define IoCompleteRequest
Definition: irp.c:1240
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
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1569
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
static KEVENT QueueThreadTerminate
Definition: floppy.c:60
#define IRP_MJ_READ
Definition: rdpdr.c:46
IO_CSQ Csq
Definition: csqrtns.c:46
LONG NTAPI KeReadStateEvent(IN PKEVENT Event)
Definition: eventobj.c:120
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
#define IO_NO_INCREMENT
Definition: iotypes.h:566
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define WARN_(ch,...)
Definition: debug.h:157
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define PAGED_CODE()

Referenced by DriverEntry().

◆ Recalibrate()

static NTSTATUS NTAPI Recalibrate ( PDRIVE_INFO  DriveInfo)
static

Definition at line 221 of file floppy.c.

233 {
235  ULONG i;
236 
237  PAGED_CODE();
238  ASSERT(DriveInfo);
239 
240  /* first turn on the motor */
241  /* Must stop after every start, prior to return */
242  StartMotor(DriveInfo);
243 
244  /* set the data rate */
245  WARN_(FLOPPY, "FIXME: UN-HARDCODE DATA RATE\n");
246  if(HwSetDataRate(DriveInfo->ControllerInfo, 0) != STATUS_SUCCESS)
247  {
248  WARN_(FLOPPY, "Recalibrate: HwSetDataRate failed\n");
249  StopMotor(DriveInfo->ControllerInfo);
250  return STATUS_IO_DEVICE_ERROR;
251  }
252 
253  /* clear the event just in case the last call forgot */
254  KeClearEvent(&DriveInfo->ControllerInfo->SynchEvent);
255 
256  /* sometimes you have to do this twice; we'll just do it twice all the time since
257  * we don't know if the people calling this Recalibrate routine expect a disk to
258  * even be in the drive, and if so, if that disk is formatted.
259  */
260  for(i = 0; i < 2; i++)
261  {
262  /* Send the command */
263  Status = HwRecalibrate(DriveInfo);
264  if(Status != STATUS_SUCCESS)
265  {
266  WARN_(FLOPPY, "Recalibrate: HwRecalibrate returned error\n");
267  continue;
268  }
269 
271 
272  /* Get the results */
274  if(Status != STATUS_SUCCESS)
275  {
276  WARN_(FLOPPY, "Recalibrate: HwRecalibrateResult returned error\n");
277  break;
278  }
279  }
280 
281  KeClearEvent(&DriveInfo->ControllerInfo->SynchEvent);
282 
283  /* Must stop after every start, prior to return */
284  StopMotor(DriveInfo->ControllerInfo);
285 
286  return Status;
287 }
NTSTATUS NTAPI HwSetDataRate(PCONTROLLER_INFO ControllerInfo, UCHAR DataRate)
Definition: hardware.c:204
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI HwRecalibrateResult(PCONTROLLER_INFO ControllerInfo)
Definition: hardware.c:394
VOID NTAPI StartMotor(PDRIVE_INFO DriveInfo)
Definition: floppy.c:96
VOID NTAPI StopMotor(PCONTROLLER_INFO ControllerInfo)
Definition: floppy.c:135
struct _CONTROLLER_INFO * ControllerInfo
Definition: fdc.h:23
#define STATUS_IO_DEVICE_ERROR
Definition: udferr_usr.h:179
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
smooth NULL
Definition: ftsmooth.c:416
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI HwRecalibrate(PDRIVE_INFO DriveInfo)
Definition: hardware.c:503
unsigned int ULONG
Definition: retypes.h:1
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define WARN_(ch,...)
Definition: debug.h:157
NTSTATUS NTAPI WaitForControllerInterrupt(PCONTROLLER_INFO ControllerInfo, PLARGE_INTEGER Timeout)
Definition: floppy.c:163
#define PAGED_CODE()

Referenced by InitController(), and ResetChangeFlag().

◆ ReportToMountMgr()

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

Definition at line 812 of file floppy.c.

823 {
825  UNICODE_STRING MountMgrDevice;
828  PMOUNTMGR_TARGET_NAME MountTarget;
829  ULONG DeviceLen;
830  PIRP Irp;
831  KEVENT Event;
833 
834  /* First, get MountMgr DeviceObject */
835  RtlInitUnicodeString(&MountMgrDevice, MOUNTMGR_DEVICE_NAME);
838 
839  if(!NT_SUCCESS(Status))
840  {
841  WARN_(FLOPPY, "ReportToMountMgr: Can't get MountMgr pointers %lx\n", Status);
842  return;
843  }
844 
845  DeviceLen = wcslen(&gControllerInfo[ControlerId].DriveInfo[DriveId].DeviceNameBuffer[0]) * sizeof(WCHAR);
846 
847  /* Allocate input buffer to report our floppy device */
848  MountTarget = ExAllocatePool(NonPagedPool,
849  sizeof(MOUNTMGR_TARGET_NAME) + DeviceLen);
850 
851  if(!MountTarget)
852  {
853  WARN_(FLOPPY, "ReportToMountMgr: Allocation of mountTarget failed\n");
855  return;
856  }
857 
858  MountTarget->DeviceNameLength = DeviceLen;
859  RtlCopyMemory(MountTarget->DeviceName,
860  gControllerInfo[ControlerId].DriveInfo[DriveId].DeviceNameBuffer,
861  DeviceLen);
862 
864 
865  /* Build the IRP used to communicate with the MountMgr */
867  DeviceObject,
868  MountTarget,
869  sizeof(MOUNTMGR_TARGET_NAME) + DeviceLen,
870  NULL,
871  0,
872  FALSE,
873  &Event,
874  &IoStatus);
875 
876  if(!Irp)
877  {
878  WARN_(FLOPPY, "ReportToMountMgr: Allocation of irp failed\n");
879  ExFreePool(MountTarget);
881  return;
882  }
883 
884  /* Call the MountMgr */
886 
887  if (Status == STATUS_PENDING) {
889  Status = IoStatus.Status;
890  }
891 
892  /* We're done */
893 
894  INFO_(FLOPPY, "Reported to the MountMgr: %lx\n", Status);
895 
896  ExFreePool(MountTarget);
898 
899  return;
900 }
WCHAR DeviceName[1]
Definition: imports.h:155
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define INFO_(ch,...)
Definition: debug.h:159
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2659
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1435
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
#define MOUNTMGR_DEVICE_NAME
Definition: imports.h:76
#define IOCTL_MOUNTMGR_VOLUME_ARRIVAL_NOTIFICATION
Definition: imports.h:130
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:435
smooth NULL
Definition: ftsmooth.c:416
static CONTROLLER_INFO gControllerInfo[MAX_CONTROLLERS]
Definition: floppy.c:56
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
* PFILE_OBJECT
Definition: iotypes.h:1955
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1569
USHORT DeviceNameLength
Definition: imports.h:154
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
DRIVE_INFO DriveInfo[MAX_DRIVES_PER_CONTROLLER]
Definition: fdc.h:60
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
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define WARN_(ch,...)
Definition: debug.h:157
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
WCHAR DeviceNameBuffer[MAX_DEVICE_NAME]
Definition: floppy.h:52

Referenced by AddControllers().

◆ ResetChangeFlag()

NTSTATUS NTAPI ResetChangeFlag ( PDRIVE_INFO  DriveInfo)

Definition at line 291 of file floppy.c.

306 {
307  BOOLEAN DiskChanged;
308 
309  PAGED_CODE();
310  ASSERT(DriveInfo);
311 
312  TRACE_(FLOPPY, "ResetChangeFlag called\n");
313 
314  /* Try to recalibrate. We don't care if it works. */
315  Recalibrate(DriveInfo);
316 
317  /* clear spurious interrupts in prep for seeks */
318  KeClearEvent(&DriveInfo->ControllerInfo->SynchEvent);
319 
320  /* must re-start the drive because Recalibrate() stops it */
321  StartMotor(DriveInfo);
322 
323  /* Seek to 1 */
324  if(HwSeek(DriveInfo, 1) != STATUS_SUCCESS)
325  {
326  WARN_(FLOPPY, "ResetChangeFlag(): HwSeek failed; returning STATUS_IO_DEVICE_ERROR\n");
327  StopMotor(DriveInfo->ControllerInfo);
328  return STATUS_IO_DEVICE_ERROR;
329  }
330 
332 
334  {
335  WARN_(FLOPPY, "ResetChangeFlag(): HwSenseInterruptStatus failed; bailing out\n");
336  StopMotor(DriveInfo->ControllerInfo);
337  return STATUS_IO_DEVICE_ERROR;
338  }
339 
340  /* Seek back to 0 */
341  if(HwSeek(DriveInfo, 0) != STATUS_SUCCESS)
342  {
343  WARN_(FLOPPY, "ResetChangeFlag(): HwSeek failed; returning STATUS_IO_DEVICE_ERROR\n");
344  StopMotor(DriveInfo->ControllerInfo);
345  return STATUS_IO_DEVICE_ERROR;
346  }
347 
349 
351  {
352  WARN_(FLOPPY, "ResetChangeFlag(): HwSenseInterruptStatus #2 failed; bailing\n");
353  StopMotor(DriveInfo->ControllerInfo);
354  return STATUS_IO_DEVICE_ERROR;
355  }
356 
357  /* Check the change bit */
358  if(HwDiskChanged(DriveInfo, &DiskChanged) != STATUS_SUCCESS)
359  {
360  WARN_(FLOPPY, "ResetChangeFlag(): HwDiskChanged failed; returning STATUS_IO_DEVICE_ERROR\n");
361  StopMotor(DriveInfo->ControllerInfo);
362  return STATUS_IO_DEVICE_ERROR;
363  }
364 
365  StopMotor(DriveInfo->ControllerInfo);
366 
367  /* if the change flag is still set, there's probably no media in the drive. */
368  if(DiskChanged)
370 
371  /* else we're done! */
372  return STATUS_SUCCESS;
373 }
#define STATUS_NO_MEDIA_IN_DEVICE
Definition: udferr_usr.h:141
static NTSTATUS NTAPI Recalibrate(PDRIVE_INFO DriveInfo)
Definition: floppy.c:221
VOID NTAPI StartMotor(PDRIVE_INFO DriveInfo)
Definition: floppy.c:96
VOID NTAPI StopMotor(PCONTROLLER_INFO ControllerInfo)
Definition: floppy.c:135
struct _CONTROLLER_INFO * ControllerInfo
Definition: fdc.h:23
#define STATUS_IO_DEVICE_ERROR
Definition: udferr_usr.h:179
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define TRACE_(x)
Definition: compat.h:66
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
NTSTATUS NTAPI HwSenseInterruptStatus(PCONTROLLER_INFO ControllerInfo)
Definition: hardware.c:539
NTSTATUS NTAPI HwDiskChanged(PDRIVE_INFO DriveInfo, PBOOLEAN DiskChanged)
Definition: hardware.c:785
NTSTATUS NTAPI HwSeek(PDRIVE_INFO DriveInfo, UCHAR Cylinder)
Definition: hardware.c:659
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define WARN_(ch,...)
Definition: debug.h:157
NTSTATUS NTAPI WaitForControllerInterrupt(PCONTROLLER_INFO ControllerInfo, PLARGE_INTEGER Timeout)
Definition: floppy.c:163
#define PAGED_CODE()

Referenced by DeviceIoctlPassive(), and ReadWritePassive().

◆ SignalMediaChanged()

VOID NTAPI SignalMediaChanged ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 1090 of file floppy.c.

1101 {
1103 
1104  TRACE_(FLOPPY, "SignalMediaChanged called\n");
1105 
1106  DriveInfo->DiskChangeCount++;
1107 
1108  /* If volume is not mounted, do NOT set verify and return STATUS_IO_DEVICE_ERROR */
1109  if(!(DeviceObject->Vpb->Flags & VPB_MOUNTED))
1110  {
1111  Irp->IoStatus.Status = STATUS_IO_DEVICE_ERROR;
1112  Irp->IoStatus.Information = 0;
1113  return;
1114  }
1115 
1116  /* Notify the filesystem that it will need to verify the volume */
1118  Irp->IoStatus.Status = STATUS_VERIFY_REQUIRED;
1119  Irp->IoStatus.Information = 0;
1120 
1121  /*
1122  * If this is a user-based, threaded request, let the IO manager know to pop up a box asking
1123  * the user to supply the correct media, but only if the error (which we just picked out above)
1124  * is deemed by the IO manager to be "user induced". The reason we don't just unconditionally
1125  * call IoSetHardError... is because MS might change the definition of "user induced" some day,
1126  * and we don't want to have to remember to re-code this.
1127  */
1128  if(Irp->Tail.Overlay.Thread && IoIsErrorUserInduced(Irp->IoStatus.Status))
1130 }
ULONG DiskChangeCount
Definition: floppy.h:53
_In_ PIRP Irp
Definition: csq.h:116
#define IoIsErrorUserInduced(Status)
Definition: iofuncs.h:2769
#define DO_VERIFY_VOLUME
Definition: env_spec_w32.h:393
#define STATUS_VERIFY_REQUIRED
Definition: udferr_usr.h:130
#define STATUS_IO_DEVICE_ERROR
Definition: udferr_usr.h:179
PVOID DeviceExtension
Definition: env_spec_w32.h:418
#define TRACE_(x)
Definition: compat.h:66
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1569
VOID NTAPI IoSetHardErrorOrVerifyDevice(IN PIRP Irp, IN PDEVICE_OBJECT DeviceObject)
Definition: util.c:316
#define VPB_MOUNTED
Definition: iotypes.h:1764

Referenced by DeviceIoctlPassive(), and ReadWritePassive().

◆ StartMotor()

VOID NTAPI StartMotor ( PDRIVE_INFO  DriveInfo)

Definition at line 96 of file floppy.c.

111 {
112  PAGED_CODE();
113  ASSERT(DriveInfo);
114 
115  TRACE_(FLOPPY, "StartMotor called\n");
116 
117  if(DriveInfo->ControllerInfo->StopDpcQueued && !KeCancelTimer(&DriveInfo->ControllerInfo->MotorTimer))
118  {
119  /* Motor turner-offer is already running; wait for it to finish */
120  INFO_(FLOPPY, "StartMotor: motor turner-offer is already running; waiting for it\n");
121  KeWaitForSingleObject(&DriveInfo->ControllerInfo->MotorStoppedEvent, Executive, KernelMode, FALSE, NULL);
122  INFO_(FLOPPY, "StartMotor: wait satisfied\n");
123  }
124 
125  DriveInfo->ControllerInfo->StopDpcQueued = FALSE;
126 
127  if(HwTurnOnMotor(DriveInfo) != STATUS_SUCCESS)
128  {
129  WARN_(FLOPPY, "StartMotor(): warning: HwTurnOnMotor failed\n");
130  }
131 }
#define INFO_(ch,...)
Definition: debug.h:159
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
struct _CONTROLLER_INFO * ControllerInfo
Definition: fdc.h:23
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS NTAPI HwTurnOnMotor(PDRIVE_INFO DriveInfo)
Definition: hardware.c:245
#define TRACE_(x)
Definition: compat.h:66
BOOLEAN NTAPI KeCancelTimer(IN OUT PKTIMER Timer)
Definition: timerobj.c:206
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define WARN_(ch,...)
Definition: debug.h:157
#define PAGED_CODE()

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

◆ StopMotor()

VOID NTAPI StopMotor ( PCONTROLLER_INFO  ControllerInfo)

Definition at line 135 of file floppy.c.

145 {
146  LARGE_INTEGER StopTime;
147 
148  ASSERT(ControllerInfo);
149 
150  TRACE_(FLOPPY, "StopMotor called\n");
151 
152  /* one relative second, in 100-ns units */
153  StopTime.QuadPart = 10000000;
154  StopTime.QuadPart *= -1;
155 
156  KeClearEvent(&ControllerInfo->MotorStoppedEvent);
157  KeSetTimer(&ControllerInfo->MotorTimer, StopTime, &ControllerInfo->MotorStopDpc);
158  ControllerInfo->StopDpcQueued = TRUE;
159 }
#define TRUE
Definition: types.h:120
BOOLEAN NTAPI KeSetTimer(IN OUT PKTIMER Timer, IN LARGE_INTEGER DueTime, IN PKDPC Dpc OPTIONAL)
Definition: timerobj.c:281
#define TRACE_(x)
Definition: compat.h:66
KDPC MotorStopDpc
Definition: floppy.h:85
KEVENT MotorStoppedEvent
Definition: floppy.h:83
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
BOOLEAN StopDpcQueued
Definition: floppy.h:86
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
LONGLONG QuadPart
Definition: typedefs.h:113
KTIMER MotorTimer
Definition: floppy.h:84

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

◆ Unload()

static VOID NTAPI Unload ( PDRIVER_OBJECT  DriverObject)
static

Definition at line 377 of file floppy.c.

383 {
384  ULONG i,j;
385 
386  PAGED_CODE();
388 
389  TRACE_(FLOPPY, "unloading\n");
390 
394 
395  for(i = 0; i < gNumberOfControllers; i++)
396  {
398  continue;
399 
400  for(j = 0; j < gControllerInfo[i].NumberOfDrives; j++)
401  {
402  if(!gControllerInfo[i].DriveInfo[j].Initialized)
403  continue;
404 
405  if(gControllerInfo[i].DriveInfo[j].DeviceObject)
406  {
408 
409  RtlInitUnicodeString(&Link, gControllerInfo[i].DriveInfo[j].ArcPathBuffer);
411 
413  }
414  }
415 
417 
418  /* Power down the controller */
420  {
421  WARN_(FLOPPY, "unload: warning: HwPowerOff failed\n");
422  }
423  }
424 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
NTSTATUS NTAPI HwPowerOff(PCONTROLLER_INFO ControllerInfo)
Definition: hardware.c:1010
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
static int Link(const char **args)
Definition: vfdcmd.c:2414
UCHAR NumberOfDrives
Definition: fdc.h:58
static PVOID QueueThreadObject
Definition: floppy.c:61
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
VOID NTAPI IoDisconnectInterrupt(PKINTERRUPT InterruptObject)
Definition: irq.c:140
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
static CONTROLLER_INFO gControllerInfo[MAX_CONTROLLERS]
Definition: floppy.c:56
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
#define TRACE_(x)
Definition: compat.h:66
#define IoDeassignArcName
static ULONG gNumberOfControllers
Definition: floppy.c:57
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1569
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
static KEVENT QueueThreadTerminate
Definition: floppy.c:60
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define WARN_(ch,...)
Definition: debug.h:157
#define PAGED_CODE()

Referenced by DriverEntry().

◆ WaitForControllerInterrupt()

NTSTATUS NTAPI WaitForControllerInterrupt ( PCONTROLLER_INFO  ControllerInfo,
PLARGE_INTEGER  Timeout 
)

Definition at line 163 of file floppy.c.

176 {
178 
179  PAGED_CODE();
180  ASSERT(ControllerInfo);
181 
183  KeClearEvent(&ControllerInfo->SynchEvent);
184 
185  return Status;
186 }
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Status
Definition: gdiplustypes.h:24
static ULONG Timeout
Definition: ping.c:61
KEVENT SynchEvent
Definition: floppy.h:74
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
#define PAGED_CODE()

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

Variable Documentation

◆ CreateClose

DRIVER_DISPATCH CreateClose
static

Definition at line 188 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(), ConfigCallback(), DriverEntry(), ReportToMountMgr(), and Unload().

◆ gNumberOfControllers

ULONG gNumberOfControllers = 0
static

Definition at line 57 of file floppy.c.

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

◆ QueueThreadObject

PVOID QueueThreadObject
static

Definition at line 61 of file floppy.c.

Referenced by DriverEntry(), and Unload().

◆ QueueThreadTerminate

KEVENT QueueThreadTerminate
static

Definition at line 60 of file floppy.c.

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