ReactOS  0.4.15-dev-3297-g037c744
isapnp.h File Reference
#include <ntddk.h>
#include <ntstrsafe.h>
#include <section_attribs.h>
#include "isapnphw.h"
#include <initguid.h>
#include <wdmguid.h>
Include dependency graph for isapnp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _ISAPNP_IO
 
struct  _ISAPNP_IRQ
 
struct  _ISAPNP_DMA
 
struct  _ISAPNP_MEMRANGE
 
struct  _ISAPNP_MEMRANGE32
 
struct  _ISAPNP_COMPATIBLE_ID_ENTRY
 
struct  _ISAPNP_ALTERNATIVES
 
struct  _ISAPNP_LOGICAL_DEVICE
 
struct  _ISAPNP_COMMON_EXTENSION
 
struct  _ISAPNP_FDO_EXTENSION
 
struct  _ISAPNP_PDO_EXTENSION
 

Macros

#define TAG_ISAPNP   'pasI'
 
#define ISAPNP_MAX_RESOURCEDATA   0x1000
 Maximum size of resource data structure supported by the driver. More...
 
#define ISAPNP_MAX_ALTERNATIVES   8
 Maximum number of Start DF tags supported by the driver. More...
 
#define ISAPNP_PRESENT   0x00000001
 Cleared when the device is physically removed. More...
 
#define ISAPNP_HAS_MULTIPLE_LOGDEVS   0x00000002
 Indicates if the parent card has multiple logical devices. More...
 
#define ISAPNP_HAS_RESOURCES   0x00000004
 Cleared when the device has no boot resources. More...
 
#define ISAPNP_ENUMERATED   0x00000001
 Whether the device has been reported to the PnP manager. More...
 
#define ISAPNP_SCANNED_BY_READ_PORT   0x00000002
 The bus has been scanned by Read Port PDO. More...
 
#define ISAPNP_READ_PORT_ALLOW_FDO_SCAN   0x00000004
 Allows the active FDO to scan the bus. More...
 
#define ISAPNP_READ_PORT_NEED_REBALANCE   0x00000008
 The I/O resource requirements have changed. More...
 

Typedefs

typedef struct _ISAPNP_IO ISAPNP_IO
 
typedef struct _ISAPNP_IOPISAPNP_IO
 
typedef struct _ISAPNP_IRQ ISAPNP_IRQ
 
typedef struct _ISAPNP_IRQPISAPNP_IRQ
 
typedef struct _ISAPNP_DMA ISAPNP_DMA
 
typedef struct _ISAPNP_DMAPISAPNP_DMA
 
typedef struct _ISAPNP_MEMRANGE ISAPNP_MEMRANGE
 
typedef struct _ISAPNP_MEMRANGEPISAPNP_MEMRANGE
 
typedef struct _ISAPNP_MEMRANGE32 ISAPNP_MEMRANGE32
 
typedef struct _ISAPNP_MEMRANGE32PISAPNP_MEMRANGE32
 
typedef struct _ISAPNP_COMPATIBLE_ID_ENTRY ISAPNP_COMPATIBLE_ID_ENTRY
 
typedef struct _ISAPNP_COMPATIBLE_ID_ENTRYPISAPNP_COMPATIBLE_ID_ENTRY
 
typedef struct _ISAPNP_ALTERNATIVES ISAPNP_ALTERNATIVES
 
typedef struct _ISAPNP_ALTERNATIVESPISAPNP_ALTERNATIVES
 
typedef struct _ISAPNP_LOGICAL_DEVICE ISAPNP_LOGICAL_DEVICE
 
typedef struct _ISAPNP_LOGICAL_DEVICEPISAPNP_LOGICAL_DEVICE
 
typedef enum _ISAPNP_SIGNATURE ISAPNP_SIGNATURE
 
typedef struct _ISAPNP_COMMON_EXTENSION ISAPNP_COMMON_EXTENSION
 
typedef struct _ISAPNP_COMMON_EXTENSIONPISAPNP_COMMON_EXTENSION
 
typedef struct _ISAPNP_FDO_EXTENSION ISAPNP_FDO_EXTENSION
 
typedef struct _ISAPNP_FDO_EXTENSIONPISAPNP_FDO_EXTENSION
 
typedef struct _ISAPNP_PDO_EXTENSION ISAPNP_PDO_EXTENSION
 
typedef struct _ISAPNP_PDO_EXTENSIONPISAPNP_PDO_EXTENSION
 

Enumerations

enum  ISAPNP_DEVICE_STATE { dsStopped, dsStarted }
 
enum  _ISAPNP_SIGNATURE { IsaPnpBus = 'odFI', IsaPnpLogicalDevice = 'veDI', IsaPnpReadDataPort = 'pdRI' }
 

Functions

 _Guarded_by_ (BusSyncEvent) extern BOOLEAN ReadPortCreated
 
 _Requires_lock_not_held_ (BusSyncEvent) _Acquires_lock_(BusSyncEvent) FORCEINLINE VOID IsaPnpAcquireBusDataLock(VOID)
 
 _Releases_lock_ (BusSyncEvent) FORCEINLINE VOID IsaPnpReleaseBusDataLock(VOID)
 
 _Requires_lock_not_held_ (FdoExt->DeviceSyncEvent) _Acquires_lock_(FdoExt -> DeviceSyncEvent) FORCEINLINE VOID IsaPnpAcquireDeviceDataLock(_In_ PISAPNP_FDO_EXTENSION FdoExt)
 
 _Releases_lock_ (FdoExt->DeviceSyncEvent) FORCEINLINE VOID IsaPnpReleaseDeviceDataLock(_In_ PISAPNP_FDO_EXTENSION FdoExt)
 
FORCEINLINE BOOLEAN HasIoAlternatives (_In_ PISAPNP_ALTERNATIVES Alternatives)
 
FORCEINLINE BOOLEAN HasIrqAlternatives (_In_ PISAPNP_ALTERNATIVES Alternatives)
 
FORCEINLINE BOOLEAN HasDmaAlternatives (_In_ PISAPNP_ALTERNATIVES Alternatives)
 
FORCEINLINE BOOLEAN HasMemoryAlternatives (_In_ PISAPNP_ALTERNATIVES Alternatives)
 
FORCEINLINE BOOLEAN HasMemory32Alternatives (_In_ PISAPNP_ALTERNATIVES Alternatives)
 
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, _Out_opt_ PUCHAR WriteOrder)
 
BOOLEAN FindIrqDescriptor (_In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_ ULONG Vector, _Out_opt_ PUCHAR WriteOrder)
 
BOOLEAN FindDmaDescriptor (_In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_ ULONG Channel, _Out_opt_ PUCHAR WriteOrder)
 
BOOLEAN FindMemoryDescriptor (_In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_ ULONG RangeStart, _In_ ULONG RangeEnd, _Out_opt_ PBOOLEAN Memory32, _Out_opt_ PUCHAR Information, _Out_opt_ PUCHAR WriteOrder)
 
NTSTATUS IsaPnpCreateReadPortDORequirements (_In_ PISAPNP_PDO_EXTENSION PdoExt, _In_opt_ ULONG SelectedReadPort)
 
VOID IsaPnpRemoveReadPortDO (_In_ PDEVICE_OBJECT Pdo)
 
NTSTATUS IsaPnpFillDeviceRelations (_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp, _In_ BOOLEAN IncludeDataPort)
 
NTSTATUS IsaFdoPnp (_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
 
NTSTATUS IsaFdoQueryInterface (_In_ PISAPNP_FDO_EXTENSION FdoExt, _In_ PIO_STACK_LOCATION IrpSp)
 
NTSTATUS IsaPdoPnp (_In_ PISAPNP_PDO_EXTENSION PdoDeviceExtension, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
 
VOID IsaPnpRemoveLogicalDeviceDO (_In_ PDEVICE_OBJECT Pdo)
 
UCHAR IsaHwTryReadDataPort (_In_ PUCHAR ReadDataPort)
 
 _Requires_lock_held_ (FdoExt->DeviceSyncEvent) NTSTATUS IsaHwFillDeviceList(_In_ PISAPNP_FDO_EXTENSION FdoExt)
 
NTSTATUS IsaHwConfigureDevice (_In_ PISAPNP_FDO_EXTENSION FdoExt, _In_ PISAPNP_LOGICAL_DEVICE LogicalDevice, _In_ PCM_RESOURCE_LIST Resources)
 
 _IRQL_requires_max_ (DISPATCH_LEVEL) VOID IsaHwWakeDevice(_In_ PISAPNP_LOGICAL_DEVICE LogicalDevice)
 

Variables

KEVENT BusSyncEvent
 
DRIVER_INITIALIZE DriverEntry
 
_In_ PISAPNP_LOGICAL_DEVICE LogicalDevice
 

Macro Definition Documentation

◆ ISAPNP_ENUMERATED

#define ISAPNP_ENUMERATED   0x00000001

Whether the device has been reported to the PnP manager.

Definition at line 187 of file isapnp.h.

◆ ISAPNP_HAS_MULTIPLE_LOGDEVS

#define ISAPNP_HAS_MULTIPLE_LOGDEVS   0x00000002

Indicates if the parent card has multiple logical devices.

Definition at line 135 of file isapnp.h.

◆ ISAPNP_HAS_RESOURCES

#define ISAPNP_HAS_RESOURCES   0x00000004

Cleared when the device has no boot resources.

Definition at line 136 of file isapnp.h.

◆ ISAPNP_MAX_ALTERNATIVES

#define ISAPNP_MAX_ALTERNATIVES   8

Maximum number of Start DF tags supported by the driver.

Definition at line 30 of file isapnp.h.

◆ ISAPNP_MAX_RESOURCEDATA

#define ISAPNP_MAX_RESOURCEDATA   0x1000

Maximum size of resource data structure supported by the driver.

Definition at line 27 of file isapnp.h.

◆ ISAPNP_PRESENT

#define ISAPNP_PRESENT   0x00000001

Cleared when the device is physically removed.

Definition at line 134 of file isapnp.h.

◆ ISAPNP_READ_PORT_ALLOW_FDO_SCAN

#define ISAPNP_READ_PORT_ALLOW_FDO_SCAN   0x00000004

Allows the active FDO to scan the bus.

Definition at line 189 of file isapnp.h.

◆ ISAPNP_READ_PORT_NEED_REBALANCE

#define ISAPNP_READ_PORT_NEED_REBALANCE   0x00000008

The I/O resource requirements have changed.

Definition at line 190 of file isapnp.h.

◆ ISAPNP_SCANNED_BY_READ_PORT

#define ISAPNP_SCANNED_BY_READ_PORT   0x00000002

The bus has been scanned by Read Port PDO.

Definition at line 188 of file isapnp.h.

◆ TAG_ISAPNP

#define TAG_ISAPNP   'pasI'

Definition at line 24 of file isapnp.h.

Typedef Documentation

◆ ISAPNP_ALTERNATIVES

◆ ISAPNP_COMMON_EXTENSION

◆ ISAPNP_COMPATIBLE_ID_ENTRY

◆ ISAPNP_DMA

◆ ISAPNP_FDO_EXTENSION

◆ ISAPNP_IO

◆ ISAPNP_IRQ

◆ ISAPNP_LOGICAL_DEVICE

◆ ISAPNP_MEMRANGE

◆ ISAPNP_MEMRANGE32

◆ ISAPNP_PDO_EXTENSION

◆ ISAPNP_SIGNATURE

◆ PISAPNP_ALTERNATIVES

◆ PISAPNP_COMMON_EXTENSION

◆ PISAPNP_COMPATIBLE_ID_ENTRY

◆ PISAPNP_DMA

◆ PISAPNP_FDO_EXTENSION

◆ PISAPNP_IO

◆ PISAPNP_IRQ

◆ PISAPNP_LOGICAL_DEVICE

◆ PISAPNP_MEMRANGE

◆ PISAPNP_MEMRANGE32

◆ PISAPNP_PDO_EXTENSION

Enumeration Type Documentation

◆ _ISAPNP_SIGNATURE

Enumerator
IsaPnpBus 
IsaPnpLogicalDevice 
IsaPnpReadDataPort 

Definition at line 141 of file isapnp.h.

142 {
143  IsaPnpBus = 'odFI',
144  IsaPnpLogicalDevice = 'veDI',
145  IsaPnpReadDataPort = 'pdRI'
enum _ISAPNP_SIGNATURE ISAPNP_SIGNATURE

◆ ISAPNP_DEVICE_STATE

Enumerator
dsStopped 
dsStarted 

Definition at line 32 of file isapnp.h.

33 {
34  dsStopped,
35  dsStarted
ISAPNP_DEVICE_STATE
Definition: isapnp.h:32

Function Documentation

◆ _Guarded_by_()

_Guarded_by_ ( BusSyncEvent  )

Definition at line 23 of file isapnp.c.

40 {
41  PAGED_CODE();
42 
43  return Priority[*(PUCHAR)A] - Priority[*(PUCHAR)B];
44 }
unsigned char * PUCHAR
Definition: retypes.h:3
Definition: ehthrow.cxx:92
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY _In_ WDF_INTERRUPT_PRIORITY Priority
Definition: wdfinterrupt.h:651
#define B(row, col)
#define PAGED_CODE()

◆ _IRQL_requires_max_()

_IRQL_requires_max_ ( DISPATCH_LEVEL  )

Definition at line 1705 of file hardware.c.

1709 {
1710  SendKey();
1712 }
_In_ PISAPNP_LOGICAL_DEVICE LogicalDevice
Definition: isapnp.h:399
static VOID SendKey(VOID)
Definition: hardware.c:332
static VOID Wake(_In_ UCHAR Csn)
Definition: hardware.c:149

◆ _Releases_lock_() [1/2]

_Releases_lock_ ( BusSyncEvent  )

Definition at line 213 of file isapnp.h.

217 {
219 }
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
#define FALSE
Definition: types.h:117
KEVENT BusSyncEvent
Definition: isapnp.c:21
#define IO_NO_INCREMENT
Definition: iotypes.h:598

◆ _Releases_lock_() [2/2]

_Releases_lock_ ( FdoExt->  DeviceSyncEvent)

Definition at line 231 of file isapnp.h.

236 {
237  KeSetEvent(&FdoExt->DeviceSyncEvent, IO_NO_INCREMENT, FALSE);
238 }
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
#define FALSE
Definition: types.h:117
#define IO_NO_INCREMENT
Definition: iotypes.h:598

◆ _Requires_lock_held_()

_Requires_lock_held_ ( FdoExt->  DeviceSyncEvent)

Definition at line 1460 of file hardware.c.

1465 {
1466  PISAPNP_LOGICAL_DEVICE LogDevice;
1467  UCHAR Csn;
1469  PUCHAR ResourceData;
1470 
1471  PAGED_CODE();
1472  ASSERT(FdoExt->ReadDataPort);
1473 
1474  DPRINT("%s for read port 0x%p\n", __FUNCTION__, FdoExt->ReadDataPort);
1475 
1477  if (!ResourceData)
1478  {
1479  DPRINT1("Failed to allocate memory for cache data\n");
1481  }
1482 
1483  for (Entry = FdoExt->DeviceListHead.Flink;
1484  Entry != &FdoExt->DeviceListHead;
1485  Entry = Entry->Flink)
1486  {
1487  LogDevice = CONTAINING_RECORD(Entry, ISAPNP_LOGICAL_DEVICE, DeviceLink);
1488 
1489  LogDevice->Flags &= ~ISAPNP_PRESENT;
1490  }
1491 
1492  for (Csn = 1; Csn <= FdoExt->Cards; Csn++)
1493  {
1494  NTSTATUS Status;
1495  UCHAR TempId[3], LogDev;
1496  ISAPNP_IDENTIFIER Identifier;
1497  USHORT MaxLogDev;
1498 
1499  Wake(Csn);
1500 
1501  Peek(FdoExt->ReadDataPort, &Identifier, sizeof(Identifier));
1502 
1503  IsaPnpExtractAscii(TempId, Identifier.VendorId);
1504  Identifier.ProdId = RtlUshortByteSwap(Identifier.ProdId);
1505 
1506  Status = ReadTags(FdoExt->ReadDataPort, ResourceData, ISAPNP_MAX_RESOURCEDATA, &MaxLogDev);
1507  if (!NT_SUCCESS(Status))
1508  {
1509  DPRINT1("Failed to read tags with status 0x%08lx, CSN %u\n", Status, Csn);
1510  continue;
1511  }
1512 
1513  DPRINT("Detected ISA PnP device - VID: '%.3s' PID: 0x%04x SN: 0x%08lX\n",
1514  TempId, Identifier.ProdId, Identifier.Serial);
1515 
1516  for (LogDev = 0; LogDev < MaxLogDev; LogDev++)
1517  {
1518  BOOLEAN IsAlreadyEnumerated = FALSE;
1519 
1520  for (Entry = FdoExt->DeviceListHead.Flink;
1521  Entry != &FdoExt->DeviceListHead;
1522  Entry = Entry->Flink)
1523  {
1524  LogDevice = CONTAINING_RECORD(Entry, ISAPNP_LOGICAL_DEVICE, DeviceLink);
1525 
1526  /* This logical device has already been enumerated */
1527  if ((LogDevice->SerialNumber == Identifier.Serial) &&
1528  (RtlCompareMemory(LogDevice->VendorId, TempId, 3) == 3) &&
1529  (LogDevice->ProdId == Identifier.ProdId) &&
1530  (LogDevice->LDN == LogDev))
1531  {
1532  LogDevice->Flags |= ISAPNP_PRESENT;
1533 
1534  /* Assign a new CSN */
1535  LogDevice->CSN = Csn;
1536 
1537  if (LogDevice->Pdo)
1538  {
1540 
1541  if (PdoExt->Common.State == dsStarted)
1542  ActivateDevice(FdoExt->ReadDataPort, LogDev);
1543  }
1544 
1545  DPRINT("Skip CSN %u, LDN %u\n", LogDevice->CSN, LogDevice->LDN);
1546  IsAlreadyEnumerated = TRUE;
1547  break;
1548  }
1549  }
1550 
1551  if (IsAlreadyEnumerated)
1552  continue;
1553 
1554  LogDevice = ExAllocatePoolZero(NonPagedPool, sizeof(ISAPNP_LOGICAL_DEVICE), TAG_ISAPNP);
1555  if (!LogDevice)
1556  {
1557  DPRINT1("Failed to allocate logical device!\n");
1558  goto Deactivate;
1559  }
1560 
1561  InitializeListHead(&LogDevice->CompatibleIdList);
1562 
1563  LogDevice->CSN = Csn;
1564  LogDevice->LDN = LogDev;
1565 
1566  Status = ParseTags(ResourceData, LogDev, LogDevice);
1567  if (!NT_SUCCESS(Status))
1568  {
1569  DPRINT1("Failed to parse tags with status 0x%08lx, CSN %u, LDN %u\n",
1570  Status, LogDevice->CSN, LogDevice->LDN);
1571  FreeLogicalDevice(LogDevice);
1572  goto Deactivate;
1573  }
1574 
1575  if (!ReadCurrentResources(FdoExt->ReadDataPort, LogDevice))
1576  DPRINT("Unable to read boot resources\n");
1577 
1578  IsaPnpExtractAscii(LogDevice->VendorId, Identifier.VendorId);
1579  LogDevice->ProdId = Identifier.ProdId;
1580  LogDevice->SerialNumber = Identifier.Serial;
1581 
1582  if (MaxLogDev > 1)
1583  LogDevice->Flags |= ISAPNP_HAS_MULTIPLE_LOGDEVS;
1584 
1585  LogDevice->Flags |= ISAPNP_PRESENT;
1586 
1587  InsertTailList(&FdoExt->DeviceListHead, &LogDevice->DeviceLink);
1588  FdoExt->DeviceCount++;
1589 
1590  /* Now we wait for the start device IRP */
1591 Deactivate:
1592  DeactivateDevice(LogDev);
1593  }
1594  }
1595 
1596  ExFreePoolWithTag(ResourceData, TAG_ISAPNP);
1597 
1598  return STATUS_SUCCESS;
1599 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
struct _Entry Entry
Definition: kefuncs.h:627
#define ISAPNP_PRESENT
Cleared when the device is physically removed.
Definition: isapnp.h:134
#define TRUE
Definition: types.h:120
#define RtlUshortByteSwap(_x)
Definition: rtlfuncs.h:3197
unsigned char * PUCHAR
Definition: retypes.h:3
LONG NTSTATUS
Definition: precomp.h:26
static NTSTATUS ReadTags(_In_ PUCHAR ReadDataPort, _Out_writes_(ISAPNP_MAX_RESOURCEDATA) PUCHAR Buffer, _In_ ULONG MaxLength, _Out_ PUSHORT MaxLogDev)
Definition: hardware.c:449
PUSBHUB_PORT_PDO_EXTENSION NTAPI PdoExt(IN PDEVICE_OBJECT DeviceObject)
Definition: usbhub.c:133
static VOID IsaPnpExtractAscii(_Out_writes_all_(3) PUCHAR Buffer, _In_ USHORT CompressedData)
Definition: hardware.c:435
#define InsertTailList(ListHead, Entry)
#define FALSE
Definition: types.h:117
COMMON_DEVICE_EXTENSION Common
Definition: usbhub.h:204
PVOID DeviceExtension
Definition: env_spec_w32.h:418
unsigned char BOOLEAN
static VOID ActivateDevice(_In_ PUCHAR ReadDataPort, _In_ UCHAR LogDev)
Definition: hardware.c:194
#define ISAPNP_MAX_RESOURCEDATA
Maximum size of resource data structure supported by the driver.
Definition: isapnp.h:27
PDEVICE_OBJECT Pdo
Definition: isapnp.h:103
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
Status
Definition: gdiplustypes.h:24
#define ASSERT(a)
Definition: mode.c:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static NTSTATUS ParseTags(_In_ PUCHAR ResourceData, _In_ USHORT LogDevToParse, _Inout_ PISAPNP_LOGICAL_DEVICE LogDevice)
Definition: hardware.c:555
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
LIST_ENTRY DeviceLink
Definition: isapnp.h:138
unsigned char UCHAR
Definition: xmlstorage.h:181
Definition: typedefs.h:119
static BOOLEAN ReadCurrentResources(_In_ PUCHAR ReadDataPort, _Inout_ PISAPNP_LOGICAL_DEVICE LogDevice)
Definition: hardware.c:1105
LIST_ENTRY CompatibleIdList
Definition: isapnp.h:122
unsigned short USHORT
Definition: pedump.c:61
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
static VOID DeactivateDevice(_In_ UCHAR LogDev)
Definition: hardware.c:209
#define DPRINT1
Definition: precomp.h:8
static VOID Peek(_In_ PUCHAR ReadDataPort, _Out_writes_bytes_all_opt_(Length) PVOID Buffer, _In_ USHORT Length)
Definition: hardware.c:371
static VOID Wake(_In_ UCHAR Csn)
Definition: hardware.c:149
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
#define __FUNCTION__
Definition: types.h:112
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
base of all file and directory entries
Definition: entries.h:82
#define ISAPNP_HAS_MULTIPLE_LOGDEVS
Indicates if the parent card has multiple logical devices.
Definition: isapnp.h:135
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
#define TAG_ISAPNP
Definition: isapnp.h:24
static VOID FreeLogicalDevice(_In_ __drv_freesMem(Mem) PISAPNP_LOGICAL_DEVICE LogDevice)
Definition: hardware.c:523
#define PAGED_CODE()

◆ _Requires_lock_not_held_() [1/2]

_Requires_lock_not_held_ ( BusSyncEvent  )

Definition at line 204 of file isapnp.h.

209 {
211 }
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 FALSE
Definition: types.h:117
KEVENT BusSyncEvent
Definition: isapnp.c:21
#define NULL
Definition: types.h:112

◆ _Requires_lock_not_held_() [2/2]

_Requires_lock_not_held_ ( FdoExt->  DeviceSyncEvent) -> DeviceSyncEvent) FORCEINLINE VOID IsaPnpAcquireDeviceDataLock( _In_ PISAPNP_FDO_EXTENSION FdoExt)

Definition at line 221 of file isapnp.h.

227 {
228  KeWaitForSingleObject(&FdoExt->DeviceSyncEvent, Executive, KernelMode, FALSE, NULL);
229 }
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 FALSE
Definition: types.h:117
#define NULL
Definition: types.h:112

◆ FindDmaDescriptor()

BOOLEAN FindDmaDescriptor ( _In_ PISAPNP_LOGICAL_DEVICE  LogDevice,
_In_ ULONG  Channel,
_Out_opt_ PUCHAR  WriteOrder 
)

Definition at line 639 of file isapnp.c.

643 {
644  ULONG i, j;
646 
647  PAGED_CODE();
648 
649  for (i = 0; i < RTL_NUMBER_OF(LogDevice->Dma); i++)
650  {
651  Description = &LogDevice->Dma[i].Description;
652 
653  for (j = 0; j < RTL_BITS_OF(Description->Mask); j++)
654  {
655  if (Description->Mask & (1 << j))
656  {
657  if (j == Channel)
658  {
659  if (WriteOrder)
660  *WriteOrder = LogDevice->Dma[i].Index;
661 
662  return TRUE;
663  }
664  }
665  }
666  }
667 
668  if (!LogDevice->Alternatives)
669  return FALSE;
670 
671  for (i = 0; i < LogDevice->Alternatives->Count; i++)
672  {
673  Description = &LogDevice->Alternatives->Dma[i];
674 
675  for (j = 0; j < RTL_BITS_OF(Description->Mask); j++)
676  {
677  if (Description->Mask & (1 << j))
678  {
679  if (j == Channel)
680  {
681  if (WriteOrder)
682  *WriteOrder = LogDevice->Alternatives->DmaIndex;
683 
684  return TRUE;
685  }
686  }
687  }
688  }
689 
690  return FALSE;
691 }
#define TRUE
Definition: types.h:120
static const WCHAR Description[]
Definition: oid.c:1266
#define FALSE
Definition: types.h:117
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
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
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
unsigned int ULONG
Definition: retypes.h:1
#define RTL_BITS_OF(sizeOfArg)
Definition: ntbasedef.h:668
#define PAGED_CODE()

Referenced by IsaHwConfigureDevice(), IsaPnpCreateLogicalDeviceResources(), and WriteResources().

◆ FindIoDescriptor()

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,
_Out_opt_ PUCHAR  WriteOrder 
)

Definition at line 518 of file isapnp.c.

526 {
527  ULONG i;
528  BOOLEAN Match;
530 
531  PAGED_CODE();
532 
533  for (i = 0; i < RTL_NUMBER_OF(LogDevice->Io); i++)
534  {
535  Description = &LogDevice->Io[i].Description;
536 
537  Match = Base ? (Base >= Description->Minimum) && (Base <= Description->Maximum)
538  : (RangeStart >= Description->Minimum) &&
539  (RangeEnd <= (ULONG)(Description->Maximum + Description->Length - 1));
540 
541  if (Match)
542  {
543  if (Information)
544  *Information = Description->Information;
545  if (Length)
546  *Length = Description->Length;
547  if (WriteOrder)
548  *WriteOrder = LogDevice->Io[i].Index;
549 
550  return TRUE;
551  }
552  }
553 
554  if (!LogDevice->Alternatives)
555  return FALSE;
556 
557  for (i = 0; i < LogDevice->Alternatives->Count; i++)
558  {
559  Description = &LogDevice->Alternatives->Io[i];
560 
561  Match = Base ? (Base >= Description->Minimum) && (Base <= Description->Maximum)
562  : (RangeStart >= Description->Minimum) &&
563  (RangeEnd <= (ULONG)(Description->Maximum + Description->Length - 1));
564 
565  if (Match)
566  {
567  if (Information)
568  *Information = Description->Information;
569  if (Length)
570  *Length = Description->Length;
571  if (WriteOrder)
572  *WriteOrder = LogDevice->Alternatives->IoIndex;
573 
574  return TRUE;
575  }
576  }
577 
578  return FALSE;
579 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define TRUE
Definition: types.h:120
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2386
static const WCHAR Description[]
Definition: oid.c:1266
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1044
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
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
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
unsigned int ULONG
Definition: retypes.h:1
#define PAGED_CODE()

Referenced by IsaHwConfigureDevice(), IsaPnpCreateLogicalDeviceResources(), and WriteResources().

◆ FindIrqDescriptor()

BOOLEAN FindIrqDescriptor ( _In_ PISAPNP_LOGICAL_DEVICE  LogDevice,
_In_ ULONG  Vector,
_Out_opt_ PUCHAR  WriteOrder 
)

Definition at line 583 of file isapnp.c.

587 {
588  ULONG i, j;
590 
591  PAGED_CODE();
592 
593  for (i = 0; i < RTL_NUMBER_OF(LogDevice->Irq); i++)
594  {
595  Description = &LogDevice->Irq[i].Description;
596 
597  for (j = 0; j < RTL_BITS_OF(Description->Mask); j++)
598  {
599  if (Description->Mask & (1 << j))
600  {
601  if (j == Vector)
602  {
603  if (WriteOrder)
604  *WriteOrder = LogDevice->Irq[i].Index;
605 
606  return TRUE;
607  }
608  }
609  }
610  }
611 
612  if (!LogDevice->Alternatives)
613  return FALSE;
614 
615  for (i = 0; i < LogDevice->Alternatives->Count; i++)
616  {
617  Description = &LogDevice->Alternatives->Irq[i];
618 
619  for (j = 0; j < RTL_BITS_OF(Description->Mask); j++)
620  {
621  if (Description->Mask & (1 << j))
622  {
623  if (j == Vector)
624  {
625  if (WriteOrder)
626  *WriteOrder = LogDevice->Alternatives->IrqIndex;
627 
628  return TRUE;
629  }
630  }
631  }
632  }
633 
634  return FALSE;
635 }
#define TRUE
Definition: types.h:120
static const WCHAR Description[]
Definition: oid.c:1266
#define FALSE
Definition: types.h:117
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
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
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
unsigned int ULONG
Definition: retypes.h:1
#define RTL_BITS_OF(sizeOfArg)
Definition: ntbasedef.h:668
#define PAGED_CODE()

Referenced by IsaHwConfigureDevice(), IsaPnpCreateLogicalDeviceResources(), and WriteResources().

◆ FindMemoryDescriptor()

BOOLEAN FindMemoryDescriptor ( _In_ PISAPNP_LOGICAL_DEVICE  LogDevice,
_In_ ULONG  RangeStart,
_In_ ULONG  RangeEnd,
_Out_opt_ PBOOLEAN  Memory32,
_Out_opt_ PUCHAR  Information,
_Out_opt_ PUCHAR  WriteOrder 
)

Definition at line 695 of file isapnp.c.

702 {
703  ULONG i;
705  PISAPNP_MEMRANGE32_DESCRIPTION Description32;
706 
707  PAGED_CODE();
708 
709  for (i = 0; i < RTL_NUMBER_OF(LogDevice->MemRange); i++)
710  {
711  Description = &LogDevice->MemRange[i].Description;
712 
713  if ((RangeStart >= (ULONG)(Description->Minimum << 8)) &&
714  (RangeEnd <= (ULONG)((Description->Maximum << 8) + (Description->Length << 8) - 1)))
715  {
716  if (Memory32)
717  *Memory32 = FALSE;
718  if (Information)
719  *Information = Description->Information;
720  if (WriteOrder)
721  *WriteOrder = LogDevice->MemRange[i].Index;
722 
723  return TRUE;
724  }
725  }
726  for (i = 0; i < RTL_NUMBER_OF(LogDevice->MemRange32); i++)
727  {
728  Description32 = &LogDevice->MemRange32[i].Description;
729 
730  if ((RangeStart >= Description32->Minimum) &&
731  (RangeEnd <= (Description32->Maximum + Description32->Length - 1)))
732  {
733  if (Memory32)
734  *Memory32 = TRUE;
735  if (Information)
736  *Information = Description32->Information;
737  if (WriteOrder)
738  *WriteOrder = LogDevice->MemRange32[i].Index;
739 
740  return TRUE;
741  }
742  }
743 
744  if (!LogDevice->Alternatives)
745  return FALSE;
746 
747  for (i = 0; i < LogDevice->Alternatives->Count; i++)
748  {
749  Description = &LogDevice->Alternatives->MemRange[i];
750 
751  if ((RangeStart >= (ULONG)(Description->Minimum << 8)) &&
752  (RangeEnd <= (ULONG)((Description->Maximum << 8) + (Description->Length << 8) - 1)))
753  {
754  if (Memory32)
755  *Memory32 = FALSE;
756  if (Information)
757  *Information = Description->Information;
758  if (WriteOrder)
759  *WriteOrder = LogDevice->Alternatives->MemRangeIndex;
760 
761  return TRUE;
762  }
763  }
764  for (i = 0; i < LogDevice->Alternatives->Count; i++)
765  {
766  Description32 = &LogDevice->Alternatives->MemRange32[i];
767 
768  if ((RangeStart >= Description32->Minimum) &&
769  (RangeEnd <= (Description32->Maximum + Description32->Length - 1)))
770  {
771  if (Memory32)
772  *Memory32 = TRUE;
773  if (Information)
774  *Information = Description32->Information;
775  if (WriteOrder)
776  *WriteOrder = LogDevice->Alternatives->MemRange32Index;
777 
778  return TRUE;
779  }
780  }
781 
782  return FALSE;
783 }
#define TRUE
Definition: types.h:120
static const WCHAR Description[]
Definition: oid.c:1266
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1044
#define FALSE
Definition: types.h:117
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
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
unsigned int ULONG
Definition: retypes.h:1
#define PAGED_CODE()

Referenced by IsaHwConfigureDevice(), IsaPnpCreateLogicalDeviceResources(), and WriteResources().

◆ HasDmaAlternatives()

FORCEINLINE BOOLEAN HasDmaAlternatives ( _In_ PISAPNP_ALTERNATIVES  Alternatives)

Definition at line 258 of file isapnp.h.

260 {
261  return (Alternatives->Dma[0].Mask != 0);
262 }

Referenced by IsaPnpCreateLogicalDeviceRequirements(), and ParseTags().

◆ HasIoAlternatives()

FORCEINLINE BOOLEAN HasIoAlternatives ( _In_ PISAPNP_ALTERNATIVES  Alternatives)

Definition at line 242 of file isapnp.h.

244 {
245  return (Alternatives->Io[0].Length != 0);
246 }

Referenced by IsaPnpCreateLogicalDeviceRequirements(), and ParseTags().

◆ HasIrqAlternatives()

FORCEINLINE BOOLEAN HasIrqAlternatives ( _In_ PISAPNP_ALTERNATIVES  Alternatives)

Definition at line 250 of file isapnp.h.

252 {
253  return (Alternatives->Irq[0].Mask != 0);
254 }

Referenced by IsaPnpCreateLogicalDeviceRequirements(), and ParseTags().

◆ HasMemory32Alternatives()

FORCEINLINE BOOLEAN HasMemory32Alternatives ( _In_ PISAPNP_ALTERNATIVES  Alternatives)

Definition at line 274 of file isapnp.h.

276 {
277  return (Alternatives->MemRange32[0].Length != 0);
278 }

Referenced by IsaPnpCreateLogicalDeviceRequirements(), and ParseTags().

◆ HasMemoryAlternatives()

FORCEINLINE BOOLEAN HasMemoryAlternatives ( _In_ PISAPNP_ALTERNATIVES  Alternatives)

Definition at line 266 of file isapnp.h.

268 {
269  return (Alternatives->MemRange[0].Length != 0);
270 }

Referenced by IsaPnpCreateLogicalDeviceRequirements(), and ParseTags().

◆ IsaFdoPnp()

NTSTATUS IsaFdoPnp ( _In_ PISAPNP_FDO_EXTENSION  FdoExt,
_Inout_ PIRP  Irp,
_In_ PIO_STACK_LOCATION  IrpSp 
)

Definition at line 123 of file fdo.c.

127 {
129 
130  PAGED_CODE();
131 
132  DPRINT("%s(%p, %p) FDO %lu, Minor - %X\n",
133  __FUNCTION__,
134  FdoExt,
135  Irp,
136  FdoExt->BusNumber,
138 
139  switch (IrpSp->MinorFunction)
140  {
141  case IRP_MN_START_DEVICE:
142  Status = IsaFdoStartDevice(FdoExt, Irp);
143 
144  Irp->IoStatus.Status = Status;
146  return Status;
147 
149  {
150  if (IrpSp->Parameters.QueryDeviceRelations.Type != BusRelations)
151  break;
152 
154  if (!NT_SUCCESS(Status))
155  {
156  Irp->IoStatus.Status = Status;
158 
159  return Status;
160  }
161 
162  Irp->IoStatus.Status = Status;
163  break;
164  }
165 
167  return IsaFdoRemoveDevice(FdoExt, Irp);
168 
170  Irp->IoStatus.Information |= PNP_DEVICE_NOT_DISABLEABLE;
171  Irp->IoStatus.Status = STATUS_SUCCESS;
172  break;
173 
175  {
176  Status = IsaFdoQueryInterface(FdoExt, IrpSp);
178  {
179  break;
180  }
181  else if (!NT_SUCCESS(Status))
182  {
183  Irp->IoStatus.Status = Status;
185 
186  return Status;
187  }
188 
189  Irp->IoStatus.Status = Status;
190  break;
191  }
192 
198  case IRP_MN_STOP_DEVICE:
199  Irp->IoStatus.Status = STATUS_SUCCESS;
200  break;
201 
202  default:
203  DPRINT("Unknown PnP code: %X\n", IrpSp->MinorFunction);
204  break;
205  }
206 
208 
209  return IoCallDriver(FdoExt->Ldo, Irp);
210 }
#define IRP_MN_CANCEL_REMOVE_DEVICE
return STATUS_NOT_SUPPORTED
#define IRP_MN_REMOVE_DEVICE
LONG NTSTATUS
Definition: precomp.h:26
static NTSTATUS IsaFdoRemoveDevice(_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp)
Definition: fdo.c:56
_In_ PIRP Irp
Definition: csq.h:116
#define IRP_MN_QUERY_REMOVE_DEVICE
#define IoCompleteRequest
Definition: irp.c:1240
#define IRP_MN_QUERY_STOP_DEVICE
Status
Definition: gdiplustypes.h:24
static NTSTATUS IsaFdoQueryBusRelations(_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp)
Definition: fdo.c:44
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
#define IRP_MN_STOP_DEVICE
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IRP_MN_START_DEVICE
#define PNP_DEVICE_NOT_DISABLEABLE
Definition: iotypes.h:1006
#define IRP_MN_QUERY_INTERFACE
static NTSTATUS IsaFdoStartDevice(_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp)
Definition: fdo.c:18
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
NTSTATUS IsaFdoQueryInterface(_In_ PISAPNP_FDO_EXTENSION FdoExt, _In_ PIO_STACK_LOCATION IrpSp)
Definition: interface.c:19
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define IRP_MN_CANCEL_STOP_DEVICE
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
#define __FUNCTION__
Definition: types.h:112
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define PAGED_CODE()

Referenced by _Dispatch_type_().

◆ IsaFdoQueryInterface()

NTSTATUS IsaFdoQueryInterface ( _In_ PISAPNP_FDO_EXTENSION  FdoExt,
_In_ PIO_STACK_LOCATION  IrpSp 
)

Definition at line 19 of file interface.c.

22 {
23  PAGED_CODE();
24 
26  &GUID_TRANSLATOR_INTERFACE_STANDARD))
27  {
29  CM_RESOURCE_TYPE ResourceType;
30  ULONG ParentBusType, ParentBusNumber, Dummy;
31 
32  ResourceType = PtrToUlong(IrpSp->Parameters.QueryInterface.InterfaceSpecificData);
33 
35  ResourceType != CmResourceTypeInterrupt)
36  {
37  return STATUS_NOT_SUPPORTED;
38  }
39 
40  Status = IoGetDeviceProperty(FdoExt->Pdo,
42  sizeof(ParentBusType),
43  &ParentBusType,
44  &Dummy);
45  if (!NT_SUCCESS(Status))
46  {
47  DPRINT1("BusType request failed with status 0x%08lx\n", Status);
48  return Status;
49  }
50 
51  Status = IoGetDeviceProperty(FdoExt->Pdo,
53  sizeof(ParentBusNumber),
54  &ParentBusNumber,
55  &Dummy);
56  if (!NT_SUCCESS(Status))
57  {
58  DPRINT1("BusNumber request failed with status 0x%08lx\n", Status);
59  return Status;
60  }
61 
62  return HalGetInterruptTranslator(ParentBusType,
63  ParentBusNumber,
64  Isa,
68  Parameters.QueryInterface.Interface,
69  &ParentBusNumber);
70  }
71 
72  return STATUS_NOT_SUPPORTED;
73 }
return STATUS_NOT_SUPPORTED
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:863
LONG NTSTATUS
Definition: precomp.h:26
#define HalGetInterruptTranslator
Definition: haltypes.h:292
struct _IO_STACK_LOCATION::@3729::@3755 QueryInterface
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:240
NTSTATUS NTAPI IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, IN ULONG BufferLength, OUT PVOID PropertyBuffer, OUT PULONG ResultLength)
Definition: pnpmgr.c:1952
#define PtrToUlong(u)
Definition: config.h:107
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define DPRINT1
Definition: precomp.h:8
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
unsigned int ULONG
Definition: retypes.h:1
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
#define PAGED_CODE()

Referenced by _Dispatch_type_(), and IsaFdoPnp().

◆ IsaHwConfigureDevice()

NTSTATUS IsaHwConfigureDevice ( _In_ PISAPNP_FDO_EXTENSION  FdoExt,
_In_ PISAPNP_LOGICAL_DEVICE  LogicalDevice,
_In_ PCM_RESOURCE_LIST  Resources 
)

Definition at line 1603 of file hardware.c.

1607 {
1608  UCHAR i,
1609  NumberOfIo = 0,
1610  NumberOfIrq = 0,
1611  NumberOfDma = 0,
1612  NumberOfMemory = 0;
1613 
1614  PAGED_CODE();
1615 
1616  if (!Resources)
1618 
1619  /* Validate the resource list */
1620  for (i = 0; i < Resources->List[0].PartialResourceList.Count; i++)
1621  {
1623  &Resources->List[0].PartialResourceList.PartialDescriptors[i];
1624 
1625  switch (Descriptor->Type)
1626  {
1627  case CmResourceTypePort:
1628  {
1629  if (++NumberOfIo > RTL_NUMBER_OF(LogicalDevice->Io))
1631 
1633  0,
1634  Descriptor->u.Port.Start.LowPart,
1635  Descriptor->u.Port.Start.LowPart +
1636  Descriptor->u.Port.Length - 1,
1637  NULL,
1638  NULL,
1639  NULL))
1640  {
1642  }
1643 
1644  break;
1645  }
1646 
1648  {
1649  if (++NumberOfIrq > RTL_NUMBER_OF(LogicalDevice->Irq))
1651 
1652  if (!FindIrqDescriptor(LogicalDevice, Descriptor->u.Interrupt.Level, NULL))
1654 
1655  break;
1656  }
1657 
1658  case CmResourceTypeDma:
1659  {
1660  if (++NumberOfDma > RTL_NUMBER_OF(LogicalDevice->Dma))
1662 
1663  if (!FindDmaDescriptor(LogicalDevice, Descriptor->u.Dma.Channel, NULL))
1665 
1666  break;
1667  }
1668 
1669  case CmResourceTypeMemory:
1670  {
1671  BOOLEAN Memory32;
1672 
1673  if (++NumberOfMemory > RTL_NUMBER_OF(LogicalDevice->MemRange))
1675 
1677  Descriptor->u.Memory.Start.LowPart,
1678  Descriptor->u.Memory.Start.LowPart +
1679  Descriptor->u.Memory.Length - 1,
1680  &Memory32,
1681  NULL,
1682  NULL))
1683  {
1685  }
1686 
1687  if (!Memory32 && (Descriptor->u.Memory.Start.LowPart & 0xFF))
1688  return STATUS_INVALID_PARAMETER;
1689 
1690  break;
1691  }
1692 
1693  default:
1694  break;
1695  }
1696  }
1697 
1698  WriteResources(FdoExt->ReadDataPort, LogicalDevice, &Resources->List[0].PartialResourceList);
1699 
1701 
1702  return STATUS_SUCCESS;
1703 }
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, _Out_opt_ PUCHAR WriteOrder)
Definition: isapnp.c:518
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:339
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
BOOLEAN FindIrqDescriptor(_In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_ ULONG Vector, _Out_opt_ PUCHAR WriteOrder)
Definition: isapnp.c:583
ISAPNP_IO Io[8]
Definition: isapnp.h:126
BOOLEAN FindMemoryDescriptor(_In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_ ULONG RangeStart, _In_ ULONG RangeEnd, _Out_opt_ PBOOLEAN Memory32, _Out_opt_ PUCHAR Information, _Out_opt_ PUCHAR WriteOrder)
Definition: isapnp.c:695
#define CmResourceTypePort
Definition: hwresource.cpp:123
_In_ PISAPNP_LOGICAL_DEVICE LogicalDevice
Definition: isapnp.h:399
#define STATUS_INVALID_PARAMETER_3
Definition: ntstatus.h:477
unsigned char BOOLEAN
#define STATUS_INVALID_PARAMETER_2
Definition: ntstatus.h:476
static VOID WriteResources(_In_ PUCHAR ReadDataPort, _In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_ PCM_PARTIAL_RESOURCE_LIST PartialResourceList)
Definition: hardware.c:1194
BOOLEAN FindDmaDescriptor(_In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_ ULONG Channel, _Out_opt_ PUCHAR WriteOrder)
Definition: isapnp.c:639
unsigned char UCHAR
Definition: xmlstorage.h:181
#define STATUS_RESOURCE_DATA_NOT_FOUND
Definition: ntstatus.h:373
#define STATUS_INVALID_PARAMETER_1
Definition: ntstatus.h:475
ISAPNP_DMA Dma[2]
Definition: isapnp.h:128
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
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define NULL
Definition: types.h:112
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
ISAPNP_MEMRANGE MemRange[4]
Definition: isapnp.h:129
#define STATUS_SUCCESS
Definition: shellext.h:65
#define CmResourceTypeMemory
Definition: hwresource.cpp:125
#define STATUS_INVALID_PARAMETER_4
Definition: ntstatus.h:478
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
Definition: ntoskrnl.c:96
#define CmResourceTypeDma
Definition: hwresource.cpp:126
#define PAGED_CODE()
ISAPNP_IRQ Irq[2]
Definition: isapnp.h:127

Referenced by IsaPdoPnp().

◆ IsaHwTryReadDataPort()

UCHAR IsaHwTryReadDataPort ( _In_ PUCHAR  ReadDataPort)

Definition at line 1362 of file hardware.c.

1364 {
1365  ULONG NumberOfRead = 0;
1366  UCHAR Csn = 0;
1367 
1368  PAGED_CODE();
1369 
1370  DPRINT("Setting read data port: 0x%p\n", ReadDataPort);
1371 
1372  SendKey();
1373 
1377 
1378  SendKey();
1379 
1380  Wake(0x00);
1382 
1383  SetReadDataPort(ReadDataPort);
1384 
1385  Wake(0x00);
1386 
1387  while (TRUE)
1388  {
1389  ISAPNP_IDENTIFIER Identifier;
1390  UCHAR i, j;
1391  BOOLEAN Seen55aa = FALSE;
1392 
1395 
1396  RtlZeroMemory(&Identifier, sizeof(Identifier));
1397 
1398  for (i = 0; i < sizeof(Identifier); i++)
1399  {
1400  UCHAR Byte = 0;
1401 
1402  for (j = 0; j < RTL_BITS_OF(Byte); j++)
1403  {
1404  USHORT Data;
1405 
1406  Data = ReadData(ReadDataPort) << 8;
1408  Data |= ReadData(ReadDataPort);
1410 
1411  Byte >>= 1;
1412 
1413  if (Data == 0x55AA)
1414  {
1415  Byte |= 0x80;
1416  Seen55aa = TRUE;
1417  }
1418  }
1419 
1420  ((PUCHAR)&Identifier)[i] = Byte;
1421  }
1422 
1423  ++NumberOfRead;
1424 
1425  if (Identifier.Checksum != 0x00 &&
1426  Identifier.Checksum != IsaPnpChecksum(&Identifier))
1427  {
1428  DPRINT("Bad checksum\n");
1429  break;
1430  }
1431 
1432  if (!Seen55aa)
1433  {
1434  DPRINT("Saw no sign of life\n");
1435  break;
1436  }
1437 
1438  Csn++;
1439 
1440  WriteCsn(Csn);
1442 
1443  Wake(0x00);
1444  }
1445 
1446  Wake(0x00);
1447 
1448  if (NumberOfRead == 1)
1449  {
1450  DPRINT("Trying next read data port\n");
1451  return 0;
1452  }
1453  else
1454  {
1455  DPRINT("Found %u cards at read port 0x%p\n", Csn, ReadDataPort);
1456  return Csn;
1457  }
1458 }
#define ISAPNP_CONFIG_RESET_CSN
Definition: isapnphw.h:50
#define TRUE
Definition: types.h:120
#define ISAPNP_CONFIG_WAIT_FOR_KEY
Definition: isapnphw.h:49
unsigned char * PUCHAR
Definition: retypes.h:3
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG _In_opt_ PVOID Data
Definition: wdfdevice.h:4527
static VOID WriteCsn(_In_ UCHAR Csn)
Definition: hardware.c:176
#define ISAPNP_CONFIGCONTROL
Definition: isapnphw.h:21
static VOID SetReadDataPort(_In_ PUCHAR ReadDataPort)
Definition: hardware.c:124
static VOID WriteByte(_In_ UCHAR Address, _In_ UCHAR Value)
Definition: hardware.c:56
#define FALSE
Definition: types.h:117
static UCHAR IsaPnpChecksum(_In_ PISAPNP_IDENTIFIER Identifier)
Definition: hardware.c:410
unsigned char BOOLEAN
static VOID SendKey(VOID)
Definition: hardware.c:332
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
unsigned char UCHAR
Definition: xmlstorage.h:181
static UCHAR ReadData(_In_ PUCHAR ReadDataPort)
Definition: hardware.c:47
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
unsigned short USHORT
Definition: pedump.c:61
unsigned char Byte
Definition: zlib.h:37
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
static VOID Wake(_In_ UCHAR Csn)
Definition: hardware.c:149
static VOID EnterIsolationState(VOID)
Definition: hardware.c:133
#define DPRINT
Definition: sndvol32.h:71
#define RTL_BITS_OF(sizeOfArg)
Definition: ntbasedef.h:668
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
Definition: ntoskrnl.c:96
#define PAGED_CODE()

Referenced by IsaPdoStartReadPort(), and IsaPnpFillDeviceRelations().

◆ IsaPdoPnp()

NTSTATUS IsaPdoPnp ( _In_ PISAPNP_PDO_EXTENSION  PdoDeviceExtension,
_Inout_ PIRP  Irp,
_In_ PIO_STACK_LOCATION  IrpSp 
)

Definition at line 864 of file pdo.c.

868 {
869  NTSTATUS Status = Irp->IoStatus.Status;
870 
871  PAGED_CODE();
872 
873  if (PdoExt->Common.Signature == IsaPnpLogicalDevice)
874  {
875  DPRINT("%s(%p, %p) CSN %u, LDN %u, Minor - %X\n",
876  __FUNCTION__,
877  PdoExt,
878  Irp,
879  PdoExt->IsaPnpDevice->CSN,
880  PdoExt->IsaPnpDevice->LDN,
882  }
883  else
884  {
885  DPRINT("%s(%p, %p) ReadPort, Minor - %X\n",
886  __FUNCTION__,
887  PdoExt,
888  Irp,
890  }
891 
892  switch (IrpSp->MinorFunction)
893  {
894  case IRP_MN_START_DEVICE:
895  {
896  if (PdoExt->Common.Signature == IsaPnpLogicalDevice)
897  {
898  IsaHwWakeDevice(PdoExt->IsaPnpDevice);
899 
901  PdoExt->IsaPnpDevice,
902  IrpSp->Parameters.StartDevice.AllocatedResources);
903  if (NT_SUCCESS(Status))
904  {
905  IsaHwActivateDevice(PdoExt->FdoExt, PdoExt->IsaPnpDevice);
906  }
907  else
908  {
909  DPRINT1("Failed to configure CSN %u, LDN %u with status 0x%08lx\n",
910  PdoExt->IsaPnpDevice->CSN, PdoExt->IsaPnpDevice->LDN, Status);
911  }
912 
913  IsaHwWaitForKey();
914  }
915  else
916  {
918  IrpSp->Parameters.StartDevice.AllocatedResources);
919  }
920 
921  if (NT_SUCCESS(Status))
922  PdoExt->Common.State = dsStarted;
923  break;
924  }
925 
926  case IRP_MN_STOP_DEVICE:
927  {
928  if (PdoExt->Common.Signature == IsaPnpLogicalDevice)
929  {
930  IsaHwWakeDevice(PdoExt->IsaPnpDevice);
931  IsaHwDeactivateDevice(PdoExt->IsaPnpDevice);
932 
933  IsaHwWaitForKey();
934  }
935  else
936  {
938  }
939 
941 
942  if (NT_SUCCESS(Status))
943  PdoExt->Common.State = dsStopped;
944  break;
945  }
946 
948  {
949  if (PdoExt->SpecialFiles > 0)
951  else if (PdoExt->Flags & ISAPNP_READ_PORT_NEED_REBALANCE)
953  else
955 
956  break;
957  }
958 
960  {
961  if (PdoExt->SpecialFiles > 0)
963  else
965  break;
966  }
967 
970  break;
971 
974  break;
975 
977  if (PdoExt->Common.Signature == IsaPnpLogicalDevice)
979  else
981  break;
982 
984  if (PdoExt->Common.Signature == IsaPnpLogicalDevice)
986  else
988  break;
989 
992  break;
993 
996  break;
997 
1000  break;
1001 
1002  case IRP_MN_QUERY_ID:
1003  if (PdoExt->Common.Signature == IsaPnpLogicalDevice)
1005  else
1007  break;
1008 
1010  if (PdoExt->Common.Signature == IsaPnpLogicalDevice)
1012  break;
1013 
1016  break;
1017 
1020  break;
1021 
1024  break;
1025 
1029  break;
1030 
1031  default:
1032  DPRINT("Unknown PnP code: %X\n", IrpSp->MinorFunction);
1033  break;
1034  }
1035 
1036  Irp->IoStatus.Status = Status;
1038 
1039  return Status;
1040 }
#define IRP_MN_CANCEL_REMOVE_DEVICE
static NTSTATUS IsaReadPortRemoveDevice(_In_ PISAPNP_PDO_EXTENSION PdoExt, _In_ BOOLEAN FinalRemove)
Definition: pdo.c:782
#define IRP_MN_QUERY_RESOURCES
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_QUERY_ID
#define TRUE
Definition: types.h:120
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS
static NTSTATUS IsaPdoQueryId(_In_ PISAPNP_PDO_EXTENSION PdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:115
LONG NTSTATUS
Definition: precomp.h:26
PUSBHUB_PORT_PDO_EXTENSION NTAPI PdoExt(IN PDEVICE_OBJECT DeviceObject)
Definition: usbhub.c:133
#define ISAPNP_READ_PORT_NEED_REBALANCE
The I/O resource requirements have changed.
Definition: isapnp.h:190
static NTSTATUS IsaPdoQueryCapabilities(_In_ PISAPNP_PDO_EXTENSION PdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:51
static NTSTATUS IsaPdoQueryDeviceRelations(_In_ PISAPNP_PDO_EXTENSION PdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:18
NTSTATUS IsaHwConfigureDevice(_In_ PISAPNP_FDO_EXTENSION FdoExt, _In_ PISAPNP_LOGICAL_DEVICE LogicalDevice, _In_ PCM_RESOURCE_LIST Resources)
Definition: hardware.c:1603
static NTSTATUS IsaPdoQueryResources(_In_ PISAPNP_PDO_EXTENSION PdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:469
#define FALSE
Definition: types.h:117
_In_ PIRP Irp
Definition: csq.h:116
static NTSTATUS IsaPdoRemoveDevice(_In_ PISAPNP_PDO_EXTENSION PdoExt, _In_ BOOLEAN FinalRemove)
Definition: pdo.c:745
#define IRP_MN_QUERY_REMOVE_DEVICE
COMMON_DEVICE_EXTENSION Common
Definition: usbhub.h:204
#define IoCompleteRequest
Definition: irp.c:1240
static NTSTATUS IsaPdoFilterResourceRequirements(_In_ PISAPNP_PDO_EXTENSION PdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:675
#define ISAPNP_READ_PORT_ALLOW_FDO_SCAN
Allows the active FDO to scan the bus.
Definition: isapnp.h:189
#define IRP_MN_QUERY_STOP_DEVICE
Status
Definition: gdiplustypes.h:24
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
#define IRP_MN_STOP_DEVICE
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IRP_MN_START_DEVICE
#define IRP_MN_QUERY_DEVICE_TEXT
static NTSTATUS IsaPdoStartReadPort(_In_ PISAPNP_PDO_EXTENSION PdoExt, _In_ PCM_RESOURCE_LIST ResourceList)
Definition: pdo.c:534
#define IRP_MN_QUERY_BUS_INFORMATION
static NTSTATUS IsaPdoQueryResourceRequirements(_In_ PISAPNP_PDO_EXTENSION PdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:504
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define STATUS_DEVICE_BUSY
Definition: udferr_usr.h:129
#define STATUS_RESOURCE_REQUIREMENTS_CHANGED
Definition: ntstatus.h:103
#define IRP_MN_QUERY_DEVICE_RELATIONS
static NTSTATUS IsaPdoQueryDeviceText(_In_ PISAPNP_PDO_EXTENSION PdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:411
#define DPRINT1
Definition: precomp.h:8
static NTSTATUS IsaReadPortQueryId(_Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:335
static NTSTATUS IsaPdoQueryDeviceUsageNotification(_In_ PISAPNP_PDO_EXTENSION PdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:716
#define IO_NO_INCREMENT
Definition: iotypes.h:598
static NTSTATUS IsaPdoQueryBusInformation(_In_ PISAPNP_PDO_EXTENSION PdoExt, _Inout_ PIRP Irp)
Definition: pdo.c:691
#define IRP_MN_CANCEL_STOP_DEVICE
#define STATUS_SUCCESS
Definition: shellext.h:65
#define IRP_MN_DEVICE_USAGE_NOTIFICATION
static NTSTATUS IsaPdoQueryPnpDeviceState(_In_ PISAPNP_PDO_EXTENSION PdoExt, _Inout_ PIRP Irp)
Definition: pdo.c:90
#define DPRINT
Definition: sndvol32.h:71
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
#define __FUNCTION__
Definition: types.h:112
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define IRP_MN_QUERY_CAPABILITIES
#define PAGED_CODE()

Referenced by _Dispatch_type_().

◆ IsaPnpCreateReadPortDORequirements()

NTSTATUS IsaPnpCreateReadPortDORequirements ( _In_ PISAPNP_PDO_EXTENSION  PdoExt,
_In_opt_ ULONG  SelectedReadPort 
)

Definition at line 1042 of file isapnp.c.

1045 {
1046  ULONG ResourceCount, ListSize, i;
1050  const ULONG ReadPorts[] = { 0x274, 0x3E4, 0x204, 0x2E4, 0x354, 0x2F4 };
1051 
1052  PAGED_CODE();
1053 
1054  if (SelectedReadPort)
1055  {
1056  /*
1057  * [IO descriptor: ISAPNP_WRITE_DATA, required]
1058  * [IO descriptor: ISAPNP_WRITE_DATA, optional]
1059  * [IO descriptor: ISAPNP_ADDRESS, required]
1060  * [IO descriptor: ISAPNP_ADDRESS, optional]
1061  * [IO descriptor: Selected Read Port, required]
1062  * [IO descriptor: Read Port 1, optional]
1063  * [IO descriptor: Read Port 2, optional]
1064  * [...]
1065  * [IO descriptor: Read Port X - 1, optional]
1066  */
1067  ResourceCount = RTL_NUMBER_OF(Ports) * 2 + RTL_NUMBER_OF(ReadPorts);
1068  }
1069  else
1070  {
1071  /*
1072  * [IO descriptor: ISAPNP_WRITE_DATA, required]
1073  * [IO descriptor: ISAPNP_WRITE_DATA, optional]
1074  * [IO descriptor: ISAPNP_ADDRESS, required]
1075  * [IO descriptor: ISAPNP_ADDRESS, optional]
1076  * [IO descriptor: Read Port 1, required]
1077  * [IO descriptor: Read Port 1, optional]
1078  * [IO descriptor: Read Port 2, required]
1079  * [IO descriptor: Read Port 2, optional]
1080  * [...]
1081  * [IO descriptor: Read Port X, required]
1082  * [IO descriptor: Read Port X, optional]
1083  */
1084  ResourceCount = (RTL_NUMBER_OF(Ports) + RTL_NUMBER_OF(ReadPorts)) * 2;
1085  }
1086  ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) +
1087  sizeof(IO_RESOURCE_DESCRIPTOR) * (ResourceCount - 1);
1088  RequirementsList = ExAllocatePoolZero(PagedPool, ListSize, TAG_ISAPNP);
1089  if (!RequirementsList)
1090  return STATUS_NO_MEMORY;
1091 
1092  RequirementsList->ListSize = ListSize;
1093  RequirementsList->AlternativeLists = 1;
1094 
1095  RequirementsList->List[0].Version = 1;
1096  RequirementsList->List[0].Revision = 1;
1097  RequirementsList->List[0].Count = ResourceCount;
1098 
1099  Descriptor = &RequirementsList->List[0].Descriptors[0];
1100 
1101  /* Store the Data port and the Address port */
1102  for (i = 0; i < RTL_NUMBER_OF(Ports) * 2; i++)
1103  {
1104  if ((i % 2) == 0)
1105  {
1106  /* Expected port */
1108  Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1110  Descriptor->u.Port.Length = 0x01;
1111  Descriptor->u.Port.Alignment = 0x01;
1112  Descriptor->u.Port.MinimumAddress.LowPart =
1113  Descriptor->u.Port.MaximumAddress.LowPart = Ports[i / 2];
1114  }
1115  else
1116  {
1117  /* ... but mark it as optional */
1120  Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1122  Descriptor->u.Port.Alignment = 0x01;
1123  }
1124 
1125  Descriptor++;
1126  }
1127 
1128  /* Store the Read Ports */
1129  if (SelectedReadPort)
1130  {
1131  BOOLEAN Selected = FALSE;
1132 
1134 
1135  for (i = 0; i < RTL_NUMBER_OF(ReadPorts); i++)
1136  {
1137  if (ReadPorts[i] != SelectedReadPort)
1139  else
1140  Selected = TRUE;
1142  Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1144  Descriptor->u.Port.Length = 0x04;
1145  Descriptor->u.Port.Alignment = 0x01;
1146  Descriptor->u.Port.MinimumAddress.LowPart = ReadPorts[i];
1147  Descriptor->u.Port.MaximumAddress.LowPart = ReadPorts[i] +
1148  Descriptor->u.Port.Length - 1;
1149 
1150  Descriptor++;
1151  }
1152 
1153  ASSERT(Selected == TRUE);
1154  }
1155  else
1156  {
1157  for (i = 0; i < RTL_NUMBER_OF(ReadPorts) * 2; i++)
1158  {
1159  if ((i % 2) == 0)
1160  {
1161  /* Expected port */
1163  Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1165  Descriptor->u.Port.Length = 0x04;
1166  Descriptor->u.Port.Alignment = 0x01;
1167  Descriptor->u.Port.MinimumAddress.LowPart = ReadPorts[i / 2];
1168  Descriptor->u.Port.MaximumAddress.LowPart = ReadPorts[i / 2] +
1169  Descriptor->u.Port.Length - 1;
1170  }
1171  else
1172  {
1173  /* ... but mark it as optional */
1176  Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1178  Descriptor->u.Port.Alignment = 0x01;
1179  }
1180 
1181  Descriptor++;
1182  }
1183  }
1184 
1185  PdoExt->RequirementsList = RequirementsList;
1186  return STATUS_SUCCESS;
1187 }
struct _IO_RESOURCE_REQUIREMENTS_LIST IO_RESOURCE_REQUIREMENTS_LIST
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:339
#define TRUE
Definition: types.h:120
PUSBHUB_PORT_PDO_EXTENSION NTAPI PdoExt(IN PDEVICE_OBJECT DeviceObject)
Definition: usbhub.c:133
#define CmResourceTypePort
Definition: hwresource.cpp:123
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
#define CM_RESOURCE_PORT_16_BIT_DECODE
Definition: cmtypes.h:112
#define ISAPNP_ADDRESS
Definition: isapnphw.h:16
#define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
Definition: ntbasedef.h:319
#define ASSERT(a)
Definition: mode.c:44
#define IO_RESOURCE_ALTERNATIVE
static PS2_PORT Ports[PS2_PORTS]
Definition: ps2.c:52
static ULONG ResourceCount
Definition: inbv.c:92
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
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
_In_ WDFIORESREQLIST RequirementsList
Definition: wdfresource.h:65
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65
#define ISAPNP_WRITE_DATA
Definition: isapnphw.h:17
#define TAG_ISAPNP
Definition: isapnp.h:24
#define PAGED_CODE()

Referenced by IsaPdoStartReadPort(), and IsaPnpCreateReadPortDO().

◆ IsaPnpFillDeviceRelations()

NTSTATUS IsaPnpFillDeviceRelations ( _In_ PISAPNP_FDO_EXTENSION  FdoExt,
_Inout_ PIRP  Irp,
_In_ BOOLEAN  IncludeDataPort 
)

Definition at line 1304 of file isapnp.c.

1308 {
1310  PLIST_ENTRY CurrentEntry;
1311  PISAPNP_LOGICAL_DEVICE IsaDevice;
1312  PDEVICE_RELATIONS DeviceRelations;
1313  ULONG PdoCount, i = 0;
1314 
1315  PAGED_CODE();
1316 
1317  IsaPnpAcquireBusDataLock();
1318 
1319  /* Try to claim the Read Port for our FDO */
1320  if (!ReadPortCreated)
1321  {
1322  Status = IsaPnpCreateReadPortDO(FdoExt);
1323  if (!NT_SUCCESS(Status))
1324  return Status;
1325 
1326  ReadPortCreated = TRUE;
1327  }
1328 
1329  IsaPnpReleaseBusDataLock();
1330 
1331  /* Inactive ISA bus */
1332  if (!FdoExt->ReadPortPdo)
1333  IncludeDataPort = FALSE;
1334 
1335  IsaPnpAcquireDeviceDataLock(FdoExt);
1336 
1337  /* If called from the FDO dispatch routine && Active bus */
1338  if (IncludeDataPort && FdoExt->ReadPortPdo)
1339  {
1340  PISAPNP_PDO_EXTENSION ReadPortExt = FdoExt->ReadPortPdo->DeviceExtension;
1341 
1342  if ((ReadPortExt->Flags & ISAPNP_READ_PORT_ALLOW_FDO_SCAN) &&
1343  !(ReadPortExt->Flags & ISAPNP_SCANNED_BY_READ_PORT))
1344  {
1345  DPRINT("Rescan ISA PnP bus\n");
1346 
1347  /* Run the isolation protocol */
1348  FdoExt->Cards = IsaHwTryReadDataPort(FdoExt->ReadDataPort);
1349 
1350  /* Card identification */
1351  if (FdoExt->Cards > 0)
1352  (VOID)IsaHwFillDeviceList(FdoExt);
1353 
1354  IsaHwWaitForKey();
1355  }
1356 
1357  ReadPortExt->Flags &= ~ISAPNP_SCANNED_BY_READ_PORT;
1358  }
1359 
1360  PdoCount = FdoExt->DeviceCount;
1361  if (IncludeDataPort)
1362  ++PdoCount;
1363 
1364  CurrentEntry = FdoExt->DeviceListHead.Flink;
1365  while (CurrentEntry != &FdoExt->DeviceListHead)
1366  {
1367  IsaDevice = CONTAINING_RECORD(CurrentEntry, ISAPNP_LOGICAL_DEVICE, DeviceLink);
1368 
1369  if (!(IsaDevice->Flags & ISAPNP_PRESENT))
1370  --PdoCount;
1371 
1372  CurrentEntry = CurrentEntry->Flink;
1373  }
1374 
1375  DeviceRelations = ExAllocatePoolWithTag(PagedPool,
1376  FIELD_OFFSET(DEVICE_RELATIONS, Objects[PdoCount]),
1377  TAG_ISAPNP);
1378  if (!DeviceRelations)
1379  {
1380  IsaPnpReleaseDeviceDataLock(FdoExt);
1381  return STATUS_NO_MEMORY;
1382  }
1383 
1384  if (IncludeDataPort)
1385  {
1386  PISAPNP_PDO_EXTENSION ReadPortExt = FdoExt->ReadPortPdo->DeviceExtension;
1387 
1388  DeviceRelations->Objects[i++] = FdoExt->ReadPortPdo;
1389  ObReferenceObject(FdoExt->ReadPortPdo);
1390 
1391  /* The Read Port PDO can only be removed by FDO */
1392  ReadPortExt->Flags |= ISAPNP_ENUMERATED;
1393  }
1394 
1395  CurrentEntry = FdoExt->DeviceListHead.Flink;
1396  while (CurrentEntry != &FdoExt->DeviceListHead)
1397  {
1399 
1400  IsaDevice = CONTAINING_RECORD(CurrentEntry, ISAPNP_LOGICAL_DEVICE, DeviceLink);
1401 
1402  if (!(IsaDevice->Flags & ISAPNP_PRESENT))
1403  goto SkipPdo;
1404 
1405  if (!IsaDevice->Pdo)
1406  {
1407  Status = IoCreateDevice(FdoExt->DriverObject,
1408  sizeof(ISAPNP_PDO_EXTENSION),
1409  NULL,
1412  FALSE,
1413  &IsaDevice->Pdo);
1414  if (!NT_SUCCESS(Status))
1415  goto SkipPdo;
1416 
1417  IsaDevice->Pdo->Flags &= ~DO_DEVICE_INITIALIZING;
1418  /* The power pagable flag is always unset */
1419 
1420  PdoExt = IsaDevice->Pdo->DeviceExtension;
1421 
1423  PdoExt->Common.Signature = IsaPnpLogicalDevice;
1424  PdoExt->Common.Self = IsaDevice->Pdo;
1425  PdoExt->Common.State = dsStopped;
1426  PdoExt->IsaPnpDevice = IsaDevice;
1427  PdoExt->FdoExt = FdoExt;
1428 
1431  {
1432  if (PdoExt->RequirementsList)
1433  {
1434  ExFreePoolWithTag(PdoExt->RequirementsList, TAG_ISAPNP);
1435  PdoExt->RequirementsList = NULL;
1436  }
1437 
1438  if (PdoExt->ResourceList)
1439  {
1440  ExFreePoolWithTag(PdoExt->ResourceList, TAG_ISAPNP);
1441  PdoExt->ResourceList = NULL;
1442  }
1443 
1444  IoDeleteDevice(IsaDevice->Pdo);
1445  IsaDevice->Pdo = NULL;
1446  goto SkipPdo;
1447  }
1448  }
1449  else
1450  {
1451  PdoExt = IsaDevice->Pdo->DeviceExtension;
1452  }
1453  DeviceRelations->Objects[i++] = IsaDevice->Pdo;
1454  ObReferenceObject(IsaDevice->Pdo);
1455 
1456  PdoExt->Flags |= ISAPNP_ENUMERATED;
1457 
1458  CurrentEntry = CurrentEntry->Flink;
1459  continue;
1460 
1461 SkipPdo:
1462  if (IsaDevice->Pdo)
1463  {
1464  PdoExt = IsaDevice->Pdo->DeviceExtension;
1465 
1466  if (PdoExt)
1467  PdoExt->Flags &= ~ISAPNP_ENUMERATED;
1468  }
1469 
1470  CurrentEntry = CurrentEntry->Flink;
1471  }
1472 
1473  IsaPnpReleaseDeviceDataLock(FdoExt);
1474 
1475  DeviceRelations->Count = i;
1476 
1477  Irp->IoStatus.Information = (ULONG_PTR)DeviceRelations;
1478 
1479  return Status;
1480 }
static NTSTATUS IsaPnpCreateLogicalDeviceResources(_In_ PISAPNP_PDO_EXTENSION PdoExt)
Definition: isapnp.c:788
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define ISAPNP_SCANNED_BY_READ_PORT
The bus has been scanned by Read Port PDO.
Definition: isapnp.h:188
#define ISAPNP_ENUMERATED
Whether the device has been reported to the PnP manager.
Definition: isapnp.h:187
#define ISAPNP_PRESENT
Cleared when the device is physically removed.
Definition: isapnp.h:134
#define TRUE
Definition: types.h:120
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2163
LONG NTSTATUS
Definition: precomp.h:26
PUSBHUB_PORT_PDO_EXTENSION NTAPI PdoExt(IN PDEVICE_OBJECT DeviceObject)
Definition: usbhub.c:133
#define FILE_DEVICE_CONTROLLER
Definition: winioctl.h:110
#define FALSE
Definition: types.h:117
_In_ PIRP Irp
Definition: csq.h:116
COMMON_DEVICE_EXTENSION Common
Definition: usbhub.h:204
PVOID DeviceExtension
Definition: env_spec_w32.h:418
PDEVICE_OBJECT Pdo
Definition: isapnp.h:103
#define FILE_AUTOGENERATED_DEVICE_NAME
Definition: iotypes.h:138
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define ISAPNP_READ_PORT_ALLOW_FDO_SCAN
Allows the active FDO to scan the bus.
Definition: isapnp.h:189
Status
Definition: gdiplustypes.h:24
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define VOID
Definition: acefi.h:82
Definition: typedefs.h:119
static NTSTATUS IsaPnpCreateLogicalDeviceRequirements(_In_ PISAPNP_PDO_EXTENSION PdoExt)
Definition: isapnp.c:194
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
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
static NTSTATUS IsaPnpCreateReadPortDO(_In_ PISAPNP_FDO_EXTENSION FdoExt)
Definition: isapnp.c:1234
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NULL
Definition: types.h:112
#define ObReferenceObject
Definition: obfuncs.h:204
unsigned int ULONG
Definition: retypes.h:1
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
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define ULONG_PTR
Definition: config.h:101
UCHAR IsaHwTryReadDataPort(_In_ PUCHAR ReadDataPort)
Definition: hardware.c:1362
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define TAG_ISAPNP
Definition: isapnp.h:24
#define PAGED_CODE()

Referenced by IsaFdoQueryBusRelations(), and IsaPdoQueryDeviceRelations().

◆ IsaPnpRemoveLogicalDeviceDO()

VOID IsaPnpRemoveLogicalDeviceDO ( _In_ PDEVICE_OBJECT  Pdo)

Definition at line 820 of file pdo.c.

822 {
823  PISAPNP_PDO_EXTENSION PdoExt = Pdo->DeviceExtension;
824  PISAPNP_LOGICAL_DEVICE LogDev = PdoExt->IsaPnpDevice;
826 
827  PAGED_CODE();
828  ASSERT(LogDev);
829 
830  DPRINT("Removing CSN %u, LDN %u\n", LogDev->CSN, LogDev->LDN);
831 
832  if (PdoExt->RequirementsList)
833  ExFreePoolWithTag(PdoExt->RequirementsList, TAG_ISAPNP);
834 
835  if (PdoExt->ResourceList)
836  ExFreePoolWithTag(PdoExt->ResourceList, TAG_ISAPNP);
837 
838  if (LogDev->FriendlyName)
840 
841  if (LogDev->Alternatives)
843 
844  Entry = LogDev->CompatibleIdList.Flink;
845  while (Entry != &LogDev->CompatibleIdList)
846  {
847  PISAPNP_COMPATIBLE_ID_ENTRY CompatibleId =
849 
850  RemoveEntryList(&CompatibleId->IdLink);
851 
852  Entry = Entry->Flink;
853 
854  ExFreePoolWithTag(CompatibleId, TAG_ISAPNP);
855  }
856 
857  ExFreePoolWithTag(LogDev, TAG_ISAPNP);
858 
860 }
struct _Entry Entry
Definition: kefuncs.h:627
PUSBHUB_PORT_PDO_EXTENSION NTAPI PdoExt(IN PDEVICE_OBJECT DeviceObject)
Definition: usbhub.c:133
Definition: isapnp.h:76
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
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
Definition: wdfminiport.h:64
COMMON_DEVICE_EXTENSION Common
Definition: usbhub.h:204
PISAPNP_ALTERNATIVES Alternatives
Definition: isapnp.h:124
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define ASSERT(a)
Definition: mode.c:44
LIST_ENTRY IdLink
Definition: isapnp.h:80
Definition: typedefs.h:119
LIST_ENTRY CompatibleIdList
Definition: isapnp.h:122
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
#define DPRINT
Definition: sndvol32.h:71
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
base of all file and directory entries
Definition: entries.h:82
#define TAG_ISAPNP
Definition: isapnp.h:24
#define PAGED_CODE()

Referenced by IsaFdoRemoveDevice(), and IsaPdoRemoveDevice().

◆ IsaPnpRemoveReadPortDO()

VOID IsaPnpRemoveReadPortDO ( _In_ PDEVICE_OBJECT  Pdo)

Definition at line 1284 of file isapnp.c.

1286 {
1287  PISAPNP_PDO_EXTENSION ReadPortExt = Pdo->DeviceExtension;
1288 
1289  PAGED_CODE();
1290 
1291  DPRINT("Removing Read Port\n");
1292 
1293  if (ReadPortExt->RequirementsList)
1295 
1296  if (ReadPortExt->ResourceList)
1297  ExFreePoolWithTag(ReadPortExt->ResourceList, TAG_ISAPNP);
1298 
1300 }
PCM_RESOURCE_LIST ResourceList
Definition: isapnp.h:183
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
Definition: wdfminiport.h:64
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList
Definition: isapnp.h:181
#define DPRINT
Definition: sndvol32.h:71
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define TAG_ISAPNP
Definition: isapnp.h:24
#define PAGED_CODE()

Referenced by IsaFdoRemoveDevice(), IsaPnpCreateReadPortDO(), and IsaReadPortRemoveDevice().

Variable Documentation

◆ BusSyncEvent

KEVENT BusSyncEvent

Definition at line 21 of file isapnp.c.

Referenced by _Releases_lock_(), _Requires_lock_not_held_(), and DriverEntry().

◆ DriverEntry

DRIVER_INITIALIZE DriverEntry

Definition at line 336 of file isapnp.h.

◆ LogicalDevice

Definition at line 399 of file isapnp.h.

Referenced by _IRQL_requires_max_(), and IsaHwConfigureDevice().