38IsaConvertIoRequirement(
195 ULONG FirstFixedDescriptors, LastFixedDescriptors;
197 BOOLEAN IsFirstAltList, IsFirstDescriptor;
205 FirstFixedDescriptors = 0;
206 LastFixedDescriptors = 0;
251 FirstFixedDescriptors += BitCount;
259 LastFixedDescriptors += BitCount;
275 ++FirstFixedDescriptors;
283 ++LastFixedDescriptors;
301 if ((
ResourceCount == 0) && (FirstFixedDescriptors == 0) && (LastFixedDescriptors == 0))
309 (FirstFixedDescriptors + LastFixedDescriptors);
322 IsFirstAltList =
TRUE;
335 AltList->
Count += LastFixedDescriptors;
346 AltList->
Count += FirstFixedDescriptors;
351 IsFirstAltList =
FALSE;
368 IsFirstDescriptor =
TRUE;
372 if (!(
Resource->IrqDescription.Mask & (1 <<
i)))
381 IsFirstDescriptor =
FALSE;
389 IsFirstDescriptor =
TRUE;
393 if (!(
Resource->DmaDescription.Mask & (1 <<
i)))
402 IsFirstDescriptor =
FALSE;
434 if (LastFixedDescriptors)
443 for (
i = 0;
i < AltListCount;
i++)
481 Match = (
Base >=
Description->Minimum) && (Base <= Description->Maximum);
599 Description32 = &
Resource->MemRange32Description;
601 if ((RangeStart >= Description32->
Minimum) &&
602 (RangeEnd <= (Description32->
Maximum + Description32->
Length - 1)))
709 goto InvalidBiosResources;
760 DPRINT1(
"MEM entry #%lu %lx %lx not found\n",
764 goto InvalidBiosResources;
788 DPRINT1(
"MEM32 entry #%lu %lx %lx not found\n",
792 goto InvalidBiosResources;
808 PdoExt->ResourceListSize = ListSize;
812 DPRINT1(
"Invalid boot resources! (CSN %u, LDN %u)\n", LogDev->
CSN, LogDev->
LDN);
814 LogDev->
Flags &= ~ISAPNP_HAS_RESOURCES;
827 const ULONG ReadPorts[] = { 0x274, 0x3E4, 0x204, 0x2E4, 0x354, 0x2F4 };
831 if (SelectedReadPort)
906 if (SelectedReadPort)
914 if (ReadPorts[
i] != SelectedReadPort)
923 Descriptor->u.Port.MinimumAddress.LowPart = ReadPorts[
i];
924 Descriptor->u.Port.MaximumAddress.LowPart = ReadPorts[
i] +
944 Descriptor->u.Port.MinimumAddress.LowPart = ReadPorts[
i / 2];
945 Descriptor->u.Port.MaximumAddress.LowPart = ReadPorts[
i / 2] +
1016 DPRINT(
"Creating Read Port\n");
1024 &FdoExt->ReadPortPdo);
1028 PdoExt = FdoExt->ReadPortPdo->DeviceExtension;
1035 FdoExt->ReadPortPdo->Flags &= ~DO_DEVICE_INITIALIZING;
1047 DPRINT(
"Removing Read Port\n");
1067 IsaPnpAcquireBusDataLock();
1070 if (!ReadPortCreated)
1076 ReadPortCreated =
TRUE;
1079 IsaPnpReleaseBusDataLock();
1082 if (!FdoExt->ReadPortPdo)
1083 IncludeDataPort =
FALSE;
1085 IsaPnpAcquireDeviceDataLock(FdoExt);
1088 if (IncludeDataPort && FdoExt->ReadPortPdo)
1095 DPRINT(
"Rescan ISA PnP bus\n");
1101 if (FdoExt->Cards > 0)
1102 (
VOID)IsaHwFillDeviceList(FdoExt);
1107 ReadPortExt->
Flags &= ~ISAPNP_SCANNED_BY_READ_PORT;
1110 PdoCount = FdoExt->DeviceCount;
1111 if (IncludeDataPort)
1114 CurrentEntry = FdoExt->DeviceListHead.
Flink;
1115 while (CurrentEntry != &FdoExt->DeviceListHead)
1122 CurrentEntry = CurrentEntry->
Flink;
1128 if (!DeviceRelations)
1130 IsaPnpReleaseDeviceDataLock(FdoExt);
1134 if (IncludeDataPort)
1138 DeviceRelations->
Objects[
i++] = FdoExt->ReadPortPdo;
1145 CurrentEntry = FdoExt->DeviceListHead.
Flink;
1146 while (CurrentEntry != &FdoExt->DeviceListHead)
1155 if (!IsaDevice->
Pdo)
1167 IsaDevice->
Pdo->
Flags &= ~DO_DEVICE_INITIALIZING;
1176 PdoExt->IsaPnpDevice = IsaDevice;
1182 if (
PdoExt->RequirementsList)
1188 if (
PdoExt->ResourceList)
1208 CurrentEntry = CurrentEntry->
Flink;
1217 PdoExt->Flags &= ~ISAPNP_ENUMERATED;
1220 CurrentEntry = CurrentEntry->
Flink;
1223 IsaPnpReleaseDeviceDataLock(FdoExt);
1225 DeviceRelations->
Count =
i;
1227 Irp->IoStatus.Information = (
ULONG_PTR)DeviceRelations;
1264 FdoExt =
Fdo->DeviceExtension;
1284 IsaPnpAcquireBusDataLock();
1286 IsaPnpReleaseBusDataLock();
1288 Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
1332static CODE_SEG(
"PAGE") DRIVER_DISPATCH_PAGED IsaPnp;
1355static CODE_SEG(
"PAGE") DRIVER_DISPATCH_PAGED IsaCreateClose;
1378static CODE_SEG(
"PAGE") DRIVER_DISPATCH_PAGED IsaForwardOrIgnore;
1430 DriverObject->DriverExtension->AddDevice = IsaAddDevice;
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define _Dispatch_type_(a)
PDEVICE_OBJECT PhysicalDeviceObject
NTSTATUS IsaFdoPnp(_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
#define FILE_DEVICE_SECURE_OPEN
#define _Guarded_by_(lock)
#define _No_competing_thread_begin_
#define _No_competing_thread_end_
#define STATUS_DEVICE_REMOVED
#define RtlInitializeBitMap
#define RtlNumberOfSetBits
#define NT_SUCCESS(StatCode)
static const WCHAR Description[]
DRIVER_INITIALIZE DriverEntry
VOID IsaHwWaitForKey(VOID)
UCHAR IsaHwTryReadDataPort(_In_ PUCHAR ReadDataPort)
_In_ PIO_STACK_LOCATION IrpSp
#define InsertTailList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
#define KeInitializeEvent(pEvt, foo, foo2)
#define InitializeListHead(ListHead)
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
static ULONG BitmapBuffer[(XMS_BLOCKS+31)/32]
struct _CM_RESOURCE_LIST CM_RESOURCE_LIST
#define CmResourceTypeMemory
#define CmResourceTypeDma
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR CM_PARTIAL_RESOURCE_DESCRIPTOR
#define CmResourceTypePort
#define CmResourceTypeInterrupt
static ULONG ResourceCount
BOOLEAN FindDmaDescriptor(_In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_ ULONG Channel)
static VOID IsaConvertIrqRequirement(_Out_ PIO_RESOURCE_DESCRIPTOR Descriptor, _In_ PISAPNP_IRQ_DESCRIPTION Description, _In_ ULONG Vector, _In_ BOOLEAN FirstDescriptor)
BOOLEAN FindIrqDescriptor(_In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_ ULONG Vector)
NTSTATUS IsaPnpFillDeviceRelations(_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp, _In_ BOOLEAN IncludeDataPort)
static NTSTATUS IsaPnpCreateLogicalDeviceRequirements(_In_ PISAPNP_PDO_EXTENSION PdoExt)
VOID IsaPnpRemoveReadPortDO(_In_ PDEVICE_OBJECT Pdo)
static NTSTATUS IsaPnpCreateLogicalDeviceResources(_In_ PISAPNP_PDO_EXTENSION PdoExt)
PIO_RESOURCE_REQUIREMENTS_LIST IsaPnpCreateReadPortDORequirements(_In_opt_ ULONG SelectedReadPort)
static VOID IsaConvertMemRange32Requirement(_Out_ PIO_RESOURCE_DESCRIPTOR Descriptor, _In_ PISAPNP_MEMRANGE32_DESCRIPTION Description)
static VOID IsaConvertMemRangeRequirement(_Out_ PIO_RESOURCE_DESCRIPTOR Descriptor, _In_ PISAPNP_MEMRANGE_DESCRIPTION Description)
PCM_RESOURCE_LIST IsaPnpCreateReadPortDOResources(VOID)
BOOLEAN FindIoDescriptor(_In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_opt_ ULONG Base, _In_ ULONG RangeStart, _In_ ULONG RangeEnd, _Out_opt_ PUCHAR Information, _Out_opt_ PULONG Length)
BOOLEAN FindMemoryDescriptor(_In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_ ULONG RangeStart, _In_ ULONG RangeEnd, _Out_opt_ PUCHAR Information)
static VOID IsaConvertDmaRequirement(_Out_ PIO_RESOURCE_DESCRIPTOR Descriptor, _In_ PISAPNP_DMA_DESCRIPTION Description, _In_ ULONG Channel, _In_ BOOLEAN FirstDescriptor)
static NTSTATUS IsaPnpCreateReadPortDO(_In_ PISAPNP_FDO_EXTENSION FdoExt)
#define ISAPNP_READ_PORT_ALLOW_FDO_SCAN
Allows the active FDO to scan the bus.
NTSTATUS IsaPdoPnp(_In_ PISAPNP_PDO_EXTENSION PdoDeviceExtension, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
#define ISAPNP_SCANNED_BY_READ_PORT
The bus has been scanned by Read Port PDO.
#define ISAPNP_ENUMERATED
Whether the device has been reported to the PnP manager.
#define ISAPNP_ADDRESS_PC98
#define ISAPNP_WRITE_DATA_PC98
#define ISAPNP_RESOURCE_TYPE_MEMRANGE
ISAPNP_DEPENDENT_FUNCTION_STATE
#define ISAPNP_RESOURCE_TYPE_END
#define ISAPNP_RESOURCE_TYPE_IRQ
#define ISAPNP_RESOURCE_TYPE_IO
#define ISAPNP_RESOURCE_TYPE_START_DEPENDENT
#define ISAPNP_RESOURCE_TYPE_MEMRANGE32
#define ISAPNP_RESOURCE_TYPE_END_DEPENDENT
#define ISAPNP_RESOURCE_TYPE_DMA
#define ISAPNP_HAS_RESOURCES
#define ExFreePoolWithTag(_P, _T)
FORCEINLINE PVOID ExAllocatePoolZero(ULONG PoolType, SIZE_T NumberOfBytes, ULONG Tag)
#define CM_RESOURCE_PORT_IO
#define CM_RESOURCE_DMA_8
#define CM_RESOURCE_MEMORY_READ_ONLY
#define CM_RESOURCE_PORT_16_BIT_DECODE
#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE
#define CM_RESOURCE_MEMORY_READ_WRITE
#define CM_RESOURCE_MEMORY_24
#define CM_RESOURCE_INTERRUPT_LATCHED
#define CM_RESOURCE_PORT_10_BIT_DECODE
#define FILE_AUTOGENERATED_DEVICE_NAME
#define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
#define DEFAULT_UNREACHABLE
#define RTL_BITS_OF(sizeOfArg)
#define UNREFERENCED_PARAMETER(P)
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define IoSkipCurrentIrpStackLocation(Irp)
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
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)
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
#define IoCompleteRequest
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
#define FILE_DEVICE_BUS_EXTENDER
#define FILE_DEVICE_CONTROLLER
#define IRP_MJ_DEVICE_CONTROL
struct _IO_RESOURCE_DESCRIPTOR IO_RESOURCE_DESCRIPTOR
PDEVICE_OBJECT Objects[1]
IO_RESOURCE_DESCRIPTOR Descriptors[1]
ISAPNP_SIGNATURE Signature
ISAPNP_DEVICE_STATE State
PDRIVER_OBJECT DriverObject
LIST_ENTRY DeviceListHead
ISAPNP_COMMON_EXTENSION Common
ISAPNP_MEMRANGE32 MemRange32[4]
ISAPNP_MEMRANGE MemRange[4]
struct _LIST_ENTRY * Flink
COMMON_DEVICE_EXTENSION Common
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
PUSBHUB_PORT_PDO_EXTENSION NTAPI PdoExt(IN PDEVICE_OBJECT DeviceObject)
_In_ PDEVICE_OBJECT DeviceObject
_In_ UCHAR _In_ UCHAR MinorFunction
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
_Must_inspect_result_ _In_ WDFDEVICE Fdo
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT Pdo
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
_In_ WDFIORESREQLIST RequirementsList
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
_Must_inspect_result_ _In_ WDFCMRESLIST List
@ CmResourceShareDeviceExclusive
@ CmResourceShareUndetermined
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
DRIVER_DISPATCH DRIVER_DISPATCH_RAISED
struct _IO_RESOURCE_LIST * PIO_RESOURCE_LIST
#define IO_RESOURCE_ALTERNATIVE
#define IRP_MJ_SYSTEM_CONTROL
#define IRP_MN_QUERY_POWER
struct _IO_RESOURCE_REQUIREMENTS_LIST IO_RESOURCE_REQUIREMENTS_LIST
#define ObReferenceObject