ReactOS 0.4.16-dev-306-g647d351
isapnp.h File Reference
#include <ntddk.h>
#include <ntstrsafe.h>
#include <section_attribs.h>
#include "isapnphw.h"
#include "isapnpres.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_COMMON_EXTENSION
 
struct  _ISAPNP_FDO_EXTENSION
 
struct  _ISAPNP_PDO_EXTENSION
 

Macros

#define TAG_ISAPNP   'pasI'
 
#define ISAPNP_ENUMERATED   0x00000001
 Whether the device has been reported to the PnP manager.
 
#define ISAPNP_SCANNED_BY_READ_PORT   0x00000002
 The bus has been scanned by Read Port PDO.
 
#define ISAPNP_READ_PORT_ALLOW_FDO_SCAN   0x00000004
 Allows the active FDO to scan the bus.
 
#define ISAPNP_READ_PORT_NEED_REBALANCE   0x00000008
 The I/O resource requirements have changed.
 

Typedefs

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)
 
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 FindIrqDescriptor (_In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_ ULONG Vector)
 
BOOLEAN FindDmaDescriptor (_In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_ ULONG Channel)
 
BOOLEAN FindMemoryDescriptor (_In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_ ULONG RangeStart, _In_ ULONG RangeEnd, _Out_opt_ PUCHAR Information)
 
PIO_RESOURCE_REQUIREMENTS_LIST IsaPnpCreateReadPortDORequirements (_In_opt_ ULONG SelectedReadPort)
 
PCM_RESOURCE_LIST IsaPnpCreateReadPortDOResources (VOID)
 
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)
 
VOID IsaHwWakeDevice (_In_ PISAPNP_LOGICAL_DEVICE LogicalDevice)
 
VOID IsaHwDeactivateDevice (_In_ PISAPNP_LOGICAL_DEVICE LogicalDevice)
 
VOID IsaHwActivateDevice (_In_ PISAPNP_FDO_EXTENSION FdoExt, _In_ PISAPNP_LOGICAL_DEVICE LogicalDevice)
 
VOID IsaHwWaitForKey (VOID)
 

Variables

KEVENT BusSyncEvent
 
DRIVER_INITIALIZE DriverEntry
 

Macro Definition Documentation

◆ ISAPNP_ENUMERATED

#define ISAPNP_ENUMERATED   0x00000001

Whether the device has been reported to the PnP manager.

Definition at line 75 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 77 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 78 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 76 of file isapnp.h.

◆ TAG_ISAPNP

#define TAG_ISAPNP   'pasI'

Definition at line 26 of file isapnp.h.

Typedef Documentation

◆ ISAPNP_COMMON_EXTENSION

◆ ISAPNP_FDO_EXTENSION

◆ ISAPNP_PDO_EXTENSION

◆ ISAPNP_SIGNATURE

◆ PISAPNP_COMMON_EXTENSION

◆ PISAPNP_FDO_EXTENSION

◆ PISAPNP_PDO_EXTENSION

Enumeration Type Documentation

◆ _ISAPNP_SIGNATURE

Enumerator
IsaPnpBus 
IsaPnpLogicalDevice 
IsaPnpReadDataPort 

Definition at line 34 of file isapnp.h.

35{
36 IsaPnpBus = 'odFI',
37 IsaPnpLogicalDevice = 'veDI',
38 IsaPnpReadDataPort = 'pdRI'
@ IsaPnpLogicalDevice
Definition: isapnp.h:37
@ IsaPnpBus
Definition: isapnp.h:36
@ IsaPnpReadDataPort
Definition: isapnp.h:38
enum _ISAPNP_SIGNATURE ISAPNP_SIGNATURE

◆ ISAPNP_DEVICE_STATE

Enumerator
dsStopped 
dsStarted 

Definition at line 28 of file isapnp.h.

29{
ISAPNP_DEVICE_STATE
Definition: isapnp.h:29
@ dsStopped
Definition: isapnp.h:30
@ dsStarted
Definition: isapnp.h:31

Function Documentation

◆ _Guarded_by_()

_Guarded_by_ ( BusSyncEvent  )

Definition at line 23 of file isapnp.c.

41{
42 PAGED_CODE();
43
47 if (Description->Information & 0x1)
49 else
51 Descriptor->u.Port.Length = Description->Length;
52 Descriptor->u.Port.Alignment = Description->Alignment;
53 Descriptor->u.Port.MinimumAddress.LowPart = Description->Minimum;
54 Descriptor->u.Port.MaximumAddress.LowPart = Description->Maximum +
55 Description->Length - 1;
56}
#define PAGED_CODE()
static const WCHAR Description[]
Definition: oid.c:1266
#define CmResourceTypePort
Definition: hwresource.cpp:123
#define CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
#define CM_RESOURCE_PORT_16_BIT_DECODE
Definition: cmtypes.h:112
#define CM_RESOURCE_PORT_10_BIT_DECODE
Definition: cmtypes.h:110
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
@ CmResourceShareDeviceExclusive
Definition: cmtypes.h:241

◆ _Releases_lock_() [1/2]

_Releases_lock_ ( BusSyncEvent  )

Definition at line 119 of file isapnp.h.

123{
125}
#define FALSE
Definition: types.h:117
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
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 139 of file isapnp.h.

144{
145 KeSetEvent(&FdoExt->DeviceSyncEvent, IO_NO_INCREMENT, FALSE);
146}

◆ _Requires_lock_held_()

_Requires_lock_held_ ( FdoExt->  DeviceSyncEvent)

Definition at line 1357 of file hardware.c.

1362{
1363 PISAPNP_LOGICAL_DEVICE LogDevice;
1364 UCHAR Csn;
1366 PUCHAR ResourceData;
1367
1368 PAGED_CODE();
1369 ASSERT(FdoExt->ReadDataPort);
1370
1371 DPRINT("%s for read port 0x%p\n", __FUNCTION__, FdoExt->ReadDataPort);
1372
1374 if (!ResourceData)
1375 {
1376 DPRINT1("Failed to allocate memory for cache data\n");
1378 }
1379
1380 for (Entry = FdoExt->DeviceListHead.Flink;
1381 Entry != &FdoExt->DeviceListHead;
1382 Entry = Entry->Flink)
1383 {
1384 LogDevice = CONTAINING_RECORD(Entry, ISAPNP_LOGICAL_DEVICE, DeviceLink);
1385
1386 LogDevice->Flags &= ~ISAPNP_PRESENT;
1387 }
1388
1389 for (Csn = 1; Csn <= FdoExt->Cards; Csn++)
1390 {
1392 UCHAR TempId[3], LogDev;
1394 ULONG MaxTagsPerDevice;
1395 USHORT MaxLogDev;
1396
1397 Wake(Csn);
1398
1399 Peek(FdoExt->ReadDataPort, &Identifier, sizeof(Identifier));
1400
1401 IsaPnpExtractAscii(TempId, Identifier.VendorId);
1402 Identifier.ProdId = RtlUshortByteSwap(Identifier.ProdId);
1403
1404 Status = ReadTags(FdoExt->ReadDataPort,
1405 ResourceData,
1407 &MaxLogDev,
1408 &MaxTagsPerDevice);
1409 if (!NT_SUCCESS(Status))
1410 {
1411 DPRINT1("Failed to read tags with status 0x%08lx, CSN %u\n", Status, Csn);
1412 continue;
1413 }
1414
1415 DPRINT("Detected ISA PnP device - VID: '%.3s' PID: 0x%04x SN: 0x%08lX\n",
1416 TempId, Identifier.ProdId, Identifier.Serial);
1417
1418 for (LogDev = 0; LogDev < MaxLogDev; LogDev++)
1419 {
1420 BOOLEAN IsAlreadyEnumerated = FALSE;
1421
1422#ifndef UNIT_TEST
1423 for (Entry = FdoExt->DeviceListHead.Flink;
1424 Entry != &FdoExt->DeviceListHead;
1425 Entry = Entry->Flink)
1426 {
1427 LogDevice = CONTAINING_RECORD(Entry, ISAPNP_LOGICAL_DEVICE, DeviceLink);
1428
1429 /* This logical device has already been enumerated */
1430 if ((LogDevice->SerialNumber == Identifier.Serial) &&
1431 (RtlCompareMemory(LogDevice->VendorId, TempId, 3) == 3) &&
1432 (LogDevice->ProdId == Identifier.ProdId) &&
1433 (LogDevice->LDN == LogDev))
1434 {
1435 LogDevice->Flags |= ISAPNP_PRESENT;
1436
1437 /* Assign a new CSN */
1438 LogDevice->CSN = Csn;
1439
1440 if (LogDevice->Pdo)
1441 {
1443
1444 if (PdoExt->Common.State == dsStarted)
1445 ActivateDevice(FdoExt->ReadDataPort, LogDev);
1446 }
1447
1448 DPRINT("Skip CSN %u, LDN %u\n", LogDevice->CSN, LogDevice->LDN);
1449 IsAlreadyEnumerated = TRUE;
1450 break;
1451 }
1452 }
1453#endif /* UNIT_TEST */
1454
1455 if (IsAlreadyEnumerated)
1456 continue;
1457
1459 if (!LogDevice)
1460 {
1461 DPRINT1("Failed to allocate logical device!\n");
1462 goto Deactivate;
1463 }
1464
1466
1467 LogDevice->CSN = Csn;
1468 LogDevice->LDN = LogDev;
1469
1471 MaxTagsPerDevice * sizeof(ISAPNP_RESOURCE),
1472 TAG_ISAPNP);
1473 if (!LogDevice->Resources)
1474 {
1475 DPRINT1("Failed to allocate the resources array\n");
1476 FreeLogicalDevice(LogDevice);
1477 goto Deactivate;
1478 }
1479
1480 Status = ParseTags(ResourceData, LogDev, LogDevice);
1481 if (!NT_SUCCESS(Status))
1482 {
1483 DPRINT1("Failed to parse tags with status 0x%08lx, CSN %u, LDN %u\n",
1484 Status, LogDevice->CSN, LogDevice->LDN);
1485 FreeLogicalDevice(LogDevice);
1486 goto Deactivate;
1487 }
1488
1489 if (!ReadCurrentResources(FdoExt->ReadDataPort, LogDevice))
1490 DPRINT("Unable to read boot resources\n");
1491
1492 IsaPnpExtractAscii(LogDevice->VendorId, Identifier.VendorId);
1493 LogDevice->ProdId = Identifier.ProdId;
1494 LogDevice->SerialNumber = Identifier.Serial;
1495
1496 if (MaxLogDev > 1)
1497 LogDevice->Flags |= ISAPNP_HAS_MULTIPLE_LOGDEVS;
1498
1499 LogDevice->Flags |= ISAPNP_PRESENT;
1500
1501 InsertTailList(&FdoExt->DeviceListHead, &LogDevice->DeviceLink);
1502 FdoExt->DeviceCount++;
1503
1504 /* Now we wait for the start device IRP */
1505Deactivate:
1506 DeactivateDevice(LogDev);
1507 }
1508 }
1509
1510 ExFreePoolWithTag(ResourceData, TAG_ISAPNP);
1511
1512 return STATUS_SUCCESS;
1513}
unsigned char BOOLEAN
@ Identifier
Definition: asmpp.cpp:95
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define TRUE
Definition: types.h:120
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
static NTSTATUS ParseTags(_In_ PUCHAR ResourceData, _In_ USHORT LogDevToParse, _Inout_ PISAPNP_LOGICAL_DEVICE LogDevice)
Definition: hardware.c:568
static VOID Peek(_In_ PUCHAR ReadDataPort, _Out_writes_bytes_all_opt_(Length) PVOID Buffer, _In_ USHORT Length)
Definition: hardware.c:379
static VOID ActivateDevice(_In_ PUCHAR ReadDataPort, _In_ UCHAR LogDev)
Definition: hardware.c:199
static VOID FreeLogicalDevice(_In_ __drv_freesMem(Mem) PISAPNP_LOGICAL_DEVICE LogDevice)
Definition: hardware.c:536
static VOID DeactivateDevice(_In_ UCHAR LogDev)
Definition: hardware.c:214
static VOID Wake(_In_ UCHAR Csn)
Definition: hardware.c:154
static VOID IsaPnpExtractAscii(_Out_writes_all_(3) PUCHAR Buffer, _In_ USHORT CompressedData)
Definition: hardware.c:425
static NTSTATUS ReadTags(_In_ PUCHAR ReadDataPort, _Out_writes_(ISAPNP_MAX_RESOURCEDATA) PUCHAR Buffer, _In_ ULONG MaxLength, _Out_ PUSHORT MaxLogDev, _Out_ PULONG MaxTagsPerDevice)
Definition: hardware.c:439
static BOOLEAN ReadCurrentResources(_In_ PUCHAR ReadDataPort, _Inout_ PISAPNP_LOGICAL_DEVICE LogDevice)
Definition: hardware.c:1053
#define __FUNCTION__
Definition: types.h:116
#define InsertTailList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
#define NonPagedPool
Definition: env_spec_w32.h:307
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define PagedPool
Definition: env_spec_w32.h:308
Status
Definition: gdiplustypes.h:25
#define TAG_ISAPNP
Definition: isapnp.h:26
#define ISAPNP_HAS_MULTIPLE_LOGDEVS
Definition: isapnpres.h:99
#define ISAPNP_MAX_RESOURCEDATA
Maximum size of resource data structure supported by the driver.
Definition: isapnpres.h:12
#define ISAPNP_PRESENT
Definition: isapnpres.h:96
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
FORCEINLINE PVOID ExAllocatePoolZero(ULONG PoolType, SIZE_T NumberOfBytes, ULONG Tag)
Definition: precomp.h:45
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
base of all file and directory entries
Definition: entries.h:83
PVOID DeviceExtension
Definition: env_spec_w32.h:418
LIST_ENTRY CompatibleIdList
Definition: isapnpres.h:129
PDEVICE_OBJECT Pdo
Definition: isapnpres.h:92
PISAPNP_RESOURCE Resources
Definition: isapnpres.h:127
LIST_ENTRY DeviceLink
Definition: isapnpres.h:91
Definition: typedefs.h:120
COMMON_DEVICE_EXTENSION Common
Definition: usbhub.h:204
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
PUSBHUB_PORT_PDO_EXTENSION NTAPI PdoExt(IN PDEVICE_OBJECT DeviceObject)
Definition: usbhub.c:133
#define RtlUshortByteSwap(_x)
Definition: rtlfuncs.h:3214
unsigned char UCHAR
Definition: xmlstorage.h:181

◆ _Requires_lock_not_held_() [1/2]

_Requires_lock_not_held_ ( BusSyncEvent  )

Definition at line 108 of file isapnp.h.

113{
115
117}
#define NULL
Definition: types.h:112
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KernelMode
Definition: asm.h:34
PEPROCESS PsInitialSystemProcess
Definition: psmgr.c:50
@ Executive
Definition: ketypes.h:415
#define PsGetCurrentProcess
Definition: psfuncs.h:17

◆ _Requires_lock_not_held_() [2/2]

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

Definition at line 127 of file isapnp.h.

133{
135
136 KeWaitForSingleObject(&FdoExt->DeviceSyncEvent, Executive, KernelMode, FALSE, NULL);
137}

◆ FindDmaDescriptor()

BOOLEAN FindDmaDescriptor ( _In_ PISAPNP_LOGICAL_DEVICE  LogDevice,
_In_ ULONG  Channel 
)

Definition at line 535 of file isapnp.c.

538{
540
541 PAGED_CODE();
542
543 Resource = LogDevice->Resources;
544 while (Resource->Type != ISAPNP_RESOURCE_TYPE_END)
545 {
547 {
549
550 if (Description->Mask & (1 << Channel))
551 return TRUE;
552 }
553
554 ++Resource;
555 }
556
557 return FALSE;
558}
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:843
#define ISAPNP_RESOURCE_TYPE_END
Definition: isapnpres.h:69
#define ISAPNP_RESOURCE_TYPE_DMA
Definition: isapnpres.h:72

◆ 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 
)

Definition at line 459 of file isapnp.c.

466{
468
469 PAGED_CODE();
470
471 Resource = LogDevice->Resources;
472 while (Resource->Type != ISAPNP_RESOURCE_TYPE_END)
473 {
475 {
477 BOOLEAN Match;
478
479 if (Base)
480 {
481 Match = (Base >= Description->Minimum) && (Base <= Description->Maximum);
482 }
483 else
484 {
485 Match = (RangeStart >= Description->Minimum) &&
486 (RangeEnd <= (ULONG)(Description->Maximum + Description->Length - 1));
487 }
488
489 if (Match)
490 {
491 if (Information)
492 *Information = Description->Information;
493 if (Length)
494 *Length = Description->Length;
495
496 return TRUE;
497 }
498 }
499
500 ++Resource;
501 }
502
503 return FALSE;
504}
#define ISAPNP_RESOURCE_TYPE_IO
Definition: isapnpres.h:70
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2451
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1049

Referenced by IsaPnpCreateLogicalDeviceResources().

◆ FindIrqDescriptor()

BOOLEAN FindIrqDescriptor ( _In_ PISAPNP_LOGICAL_DEVICE  LogDevice,
_In_ ULONG  Vector 
)

Definition at line 508 of file isapnp.c.

511{
513
514 PAGED_CODE();
515
516 Resource = LogDevice->Resources;
517 while (Resource->Type != ISAPNP_RESOURCE_TYPE_END)
518 {
520 {
522
523 if (Description->Mask & (1 << Vector))
524 return TRUE;
525 }
526
527 ++Resource;
528 }
529
530 return FALSE;
531}
#define ISAPNP_RESOURCE_TYPE_IRQ
Definition: isapnpres.h:71

◆ FindMemoryDescriptor()

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

Definition at line 562 of file isapnp.c.

567{
569
570 PAGED_CODE();
571
572 Resource = LogDevice->Resources;
573 while (Resource->Type != ISAPNP_RESOURCE_TYPE_END)
574 {
575 switch (Resource->Type)
576 {
578 {
580
581 Description = &Resource->MemRangeDescription;
582
583 if ((RangeStart >= (ULONG)(Description->Minimum << 8)) &&
584 (RangeEnd <= (ULONG)((Description->Maximum << 8) +
585 (Description->Length << 8) - 1)))
586 {
587 if (Information)
588 *Information = Description->Information;
589
590 return TRUE;
591 }
592 break;
593 }
594
596 {
597 PISAPNP_MEMRANGE32_DESCRIPTION Description32;
598
599 Description32 = &Resource->MemRange32Description;
600
601 if ((RangeStart >= Description32->Minimum) &&
602 (RangeEnd <= (Description32->Maximum + Description32->Length - 1)))
603 {
604 if (Information)
605 *Information = Description32->Information;
606
607 return TRUE;
608 }
609 break;
610 }
611
612 default:
613 break;
614 }
615
616 ++Resource;
617 }
618
619 return FALSE;
620}
#define ISAPNP_RESOURCE_TYPE_MEMRANGE
Definition: isapnpres.h:73
#define ISAPNP_RESOURCE_TYPE_MEMRANGE32
Definition: isapnpres.h:74

Referenced by IsaHwConfigureDevice(), and IsaPnpCreateLogicalDeviceResources().

◆ 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",
134 FdoExt,
135 Irp,
136 FdoExt->BusNumber,
138
139 switch (IrpSp->MinorFunction)
140 {
142 Status = IsaFdoStartDevice(FdoExt, Irp);
143
144 Irp->IoStatus.Status = Status;
146 return Status;
147
149 {
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 {
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
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}
static NTSTATUS IsaFdoStartDevice(_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp)
Definition: fdo.c:18
static NTSTATUS IsaFdoQueryBusRelations(_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp)
Definition: fdo.c:44
static NTSTATUS IsaFdoRemoveDevice(_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp)
Definition: fdo.c:56
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
NTSTATUS IsaFdoQueryInterface(_In_ PISAPNP_FDO_EXTENSION FdoExt, _In_ PIO_STACK_LOCATION IrpSp)
Definition: interface.c:19
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define IoCompleteRequest
Definition: irp.c:1240
#define IoCallDriver
Definition: irp.c:1225
union _IO_STACK_LOCATION::@1580 Parameters
struct _IO_STACK_LOCATION::@3979::@4004 QueryDeviceRelations
#define IRP_MN_CANCEL_STOP_DEVICE
@ BusRelations
Definition: iotypes.h:2152
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define PNP_DEVICE_NOT_DISABLEABLE
Definition: iotypes.h:1006
#define IRP_MN_QUERY_INTERFACE
#define IRP_MN_START_DEVICE
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IRP_MN_QUERY_STOP_DEVICE
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define IRP_MN_STOP_DEVICE
#define IRP_MN_QUERY_REMOVE_DEVICE

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 {
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
73}
#define PtrToUlong(u)
Definition: config.h:107
@ Isa
Definition: hwresource.cpp:138
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
NTSTATUS NTAPI IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, IN ULONG BufferLength, OUT PVOID PropertyBuffer, OUT PULONG ResultLength)
Definition: pnpmgr.c:1382
struct _IO_STACK_LOCATION::@3979::@4005 QueryInterface
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:869
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:235
#define HalGetInterruptTranslator
Definition: haltypes.h:303
@ DevicePropertyBusNumber
Definition: iotypes.h:1209
@ DevicePropertyLegacyBusType
Definition: iotypes.h:1208

Referenced by _Dispatch_type_(), and IsaFdoPnp().

◆ IsaHwActivateDevice()

VOID IsaHwActivateDevice ( _In_ PISAPNP_FDO_EXTENSION  FdoExt,
_In_ PISAPNP_LOGICAL_DEVICE  LogicalDevice 
)

Definition at line 1661 of file hardware.c.

1664{
1665 PAGED_CODE();
1666
1667 ActivateDevice(FdoExt->ReadDataPort, LogicalDevice->LDN);
1668}

Referenced by DrvTestResources(), and IsaPdoPnp().

◆ IsaHwConfigureDevice()

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

Definition at line 1517 of file hardware.c.

1521{
1522 ULONG i;
1523 UCHAR NumberOfIo = 0,
1524 NumberOfIrq = 0,
1525 NumberOfDma = 0,
1526 NumberOfMemory = 0,
1527 NumberOfMemory32 = 0;
1528
1529 PAGED_CODE();
1530
1531 if (!Resources)
1533
1534 WriteLogicalDeviceNumber(LogicalDevice->LDN);
1535
1536 for (i = 0; i < Resources->List[0].PartialResourceList.Count; i++)
1537 {
1539 &Resources->List[0].PartialResourceList.PartialDescriptors[i];
1540
1541 switch (Descriptor->Type)
1542 {
1543 case CmResourceTypePort:
1544 {
1545 if (NumberOfIo >= RTL_NUMBER_OF(LogicalDevice->Io))
1547
1548 IsaProgramIoDecoder(Descriptor, NumberOfIo++);
1549 break;
1550 }
1551
1553 {
1554 if (NumberOfIrq >= RTL_NUMBER_OF(LogicalDevice->Irq))
1556
1557 IsaProgramIrqSelect(Descriptor, NumberOfIrq++);
1558 break;
1559 }
1560
1561 case CmResourceTypeDma:
1562 {
1563 if (NumberOfDma >= RTL_NUMBER_OF(LogicalDevice->Dma))
1565
1566 IsaProgramDmaSelect(Descriptor, NumberOfDma++);
1567 break;
1568 }
1569
1571 {
1572 BOOLEAN IsMemory32;
1575
1576 if ((NumberOfMemory + NumberOfMemory32) >= RTL_NUMBER_OF(LogicalDevice->MemRange))
1578
1579 /*
1580 * The PNP ROM provides an information byte for each memory descriptor
1581 * which is then used to program the memory control register.
1582 */
1583 if (!FindMemoryDescriptor(LogicalDevice,
1584 Descriptor->u.Memory.Start.LowPart,
1585 Descriptor->u.Memory.Start.LowPart +
1586 Descriptor->u.Memory.Length - 1,
1587 &Information))
1588 {
1590 }
1591
1592 /* We can have a 24- or 32-bit memory decoder, but not both */
1593 IsMemory32 = !!(LogicalDevice->Flags & ISAPNP_HAS_MEM32_DECODER);
1594
1595 if (IsMemory32)
1596 Index = NumberOfMemory32++;
1597 else
1598 Index = NumberOfMemory++;
1599
1600 Status = IsaProgramMemoryDecoder(FdoExt->ReadDataPort,
1601 Descriptor,
1602 IsMemory32,
1604 Index);
1605 if (!NT_SUCCESS(Status))
1606 return Status;
1607
1608 break;
1609 }
1610
1611 default:
1612 break;
1613 }
1614 }
1615
1616 /* Disable the unclaimed device resources */
1617 for (i = NumberOfIo; i < RTL_NUMBER_OF(LogicalDevice->Io); i++)
1618 {
1620 }
1621 for (i = NumberOfIrq; i < RTL_NUMBER_OF(LogicalDevice->Irq); i++)
1622 {
1625 }
1626 for (i = NumberOfDma; i < RTL_NUMBER_OF(LogicalDevice->Dma); i++)
1627 {
1629 }
1630 for (i = NumberOfMemory; i < RTL_NUMBER_OF(LogicalDevice->MemRange); i++)
1631 {
1635 }
1636 for (i = NumberOfMemory32; i < RTL_NUMBER_OF(LogicalDevice->MemRange32); i++)
1637 {
1641 }
1642
1644
1645 return STATUS_SUCCESS;
1646}
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
static VOID WriteDoubleWord(_In_ UCHAR Address, _In_ ULONG Value)
Definition: hardware.c:83
static VOID IsaProgramIrqSelect(_In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, _In_ UCHAR Index)
Definition: hardware.c:1156
static VOID IsaProgramDmaSelect(_In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, _In_ UCHAR Index)
Definition: hardware.c:1178
static VOID WriteByte(_In_ UCHAR Address, _In_ UCHAR Value)
Definition: hardware.c:59
static VOID IsaProgramIoDecoder(_In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, _In_ UCHAR Index)
Definition: hardware.c:1142
static VOID WriteLogicalDeviceNumber(_In_ UCHAR LogDev)
Definition: hardware.c:190
static VOID WriteWord(_In_ UCHAR Address, _In_ USHORT Value)
Definition: hardware.c:72
static NTSTATUS IsaProgramMemoryDecoder(_In_ PUCHAR ReadDataPort, _In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, _In_ BOOLEAN IsMemory32, _In_ UCHAR Information, _In_ UCHAR Index)
Definition: hardware.c:1192
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 CmResourceTypeMemory
Definition: hwresource.cpp:125
#define CmResourceTypeDma
Definition: hwresource.cpp:126
BOOLEAN FindMemoryDescriptor(_In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_ ULONG RangeStart, _In_ ULONG RangeEnd, _Out_opt_ PUCHAR Information)
Definition: isapnp.c:562
#define ISAPNP_MEMBASE32(n)
Definition: isapnphw.h:48
#define ISAPNP_MEMCONTROL32(n)
Definition: isapnphw.h:49
#define ISAPNP_MEMLIMIT(n)
Definition: isapnphw.h:40
#define ISAPNP_MEMLIMIT32(n)
Definition: isapnphw.h:50
#define ISAPNP_DMACHANNEL(n)
Definition: isapnphw.h:46
#define ISAPNP_MEMBASE(n)
Definition: isapnphw.h:34
#define ISAPNP_MEMCONTROL(n)
Definition: isapnphw.h:35
#define ISAPNP_IRQTYPE(n)
Definition: isapnphw.h:43
#define ISAPNP_IRQNO(n)
Definition: isapnphw.h:42
#define DMACHANNEL_NONE
Definition: isapnphw.h:47
#define ISAPNP_IOBASE(n)
Definition: isapnphw.h:41
#define ISAPNP_HAS_MEM32_DECODER
Definition: isapnpres.h:108
#define KeStallExecutionProcessor(MicroSeconds)
Definition: precomp.h:27
#define STATUS_INVALID_PARAMETER_4
Definition: ntstatus.h:478
#define STATUS_INVALID_PARAMETER_2
Definition: ntstatus.h:476
#define STATUS_RESOURCE_DATA_NOT_FOUND
Definition: ntstatus.h:373
#define STATUS_INVALID_PARAMETER_1
Definition: ntstatus.h:475
#define STATUS_INVALID_PARAMETER_3
Definition: ntstatus.h:477
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by DrvTestResources(), and IsaPdoPnp().

◆ IsaHwDeactivateDevice()

VOID IsaHwDeactivateDevice ( _In_ PISAPNP_LOGICAL_DEVICE  LogicalDevice)

Definition at line 1673 of file hardware.c.

1675{
1676 PAGED_CODE();
1677
1678 DeactivateDevice(LogicalDevice->LDN);
1679}

Referenced by IsaPdoPnp(), and IsaPdoRemoveDevice().

◆ IsaHwTryReadDataPort()

UCHAR IsaHwTryReadDataPort ( _In_ PUCHAR  ReadDataPort)

Definition at line 1259 of file hardware.c.

1261{
1262 ULONG NumberOfRead = 0;
1263 UCHAR Csn = 0;
1264
1265 PAGED_CODE();
1266
1267 DPRINT("Setting read data port: 0x%p\n", ReadDataPort);
1268
1269 SendKey();
1270
1274
1275 SendKey();
1276
1277 Wake(0x00);
1279
1280 SetReadDataPort(ReadDataPort);
1281
1282 Wake(0x00);
1283
1284 while (TRUE)
1285 {
1287 UCHAR i, j;
1288 BOOLEAN Seen55aa = FALSE;
1289
1292
1294
1295 for (i = 0; i < sizeof(Identifier); i++)
1296 {
1297 UCHAR Byte = 0;
1298
1299 for (j = 0; j < RTL_BITS_OF(Byte); j++)
1300 {
1301 USHORT Data;
1302
1303 Data = ReadData(ReadDataPort) << 8;
1305 Data |= ReadData(ReadDataPort);
1307
1308 Byte >>= 1;
1309
1310 if (Data == 0x55AA)
1311 {
1312 Byte |= 0x80;
1313 Seen55aa = TRUE;
1314 }
1315 }
1316
1317 ((PUCHAR)&Identifier)[i] = Byte;
1318 }
1319
1320 ++NumberOfRead;
1321
1322 if (Identifier.Checksum != 0x00 &&
1323 Identifier.Checksum != IsaPnpChecksum(&Identifier))
1324 {
1325 DPRINT("Bad checksum\n");
1326 break;
1327 }
1328
1329 if (!Seen55aa)
1330 {
1331 DPRINT("Saw no sign of life\n");
1332 break;
1333 }
1334
1335 Csn++;
1336
1337 WriteCsn(Csn);
1339
1340 Wake(0x00);
1341 }
1342
1343 Wake(0x00);
1344
1345 if (NumberOfRead == 1)
1346 {
1347 DPRINT("Trying next read data port\n");
1348 return 0;
1349 }
1350 else
1351 {
1352 DPRINT("Found %u cards at read port 0x%p\n", Csn, ReadDataPort);
1353 return Csn;
1354 }
1355}
@ ReadData
Definition: amstream.idl:63
unsigned char Byte
Definition: zlib.h:37
static VOID SetReadDataPort(_In_ PUCHAR ReadDataPort)
Definition: hardware.c:129
static VOID SendKey(VOID)
Definition: hardware.c:338
static VOID WriteCsn(_In_ UCHAR Csn)
Definition: hardware.c:181
static VOID EnterIsolationState(VOID)
Definition: hardware.c:138
static UCHAR IsaPnpChecksum(_In_ PISAPNP_IDENTIFIER Identifier)
Definition: hardware.c:400
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define ISAPNP_CONFIG_WAIT_FOR_KEY
Definition: isapnphw.h:53
#define ISAPNP_CONFIGCONTROL
Definition: isapnphw.h:24
#define ISAPNP_CONFIG_RESET_CSN
Definition: isapnphw.h:54
#define RTL_BITS_OF(sizeOfArg)
Definition: ntbasedef.h:676
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

Referenced by DrvTestIsolation(), IsaPdoStartReadPort(), and IsaPnpFillDeviceRelations().

◆ IsaHwWaitForKey()

VOID IsaHwWaitForKey ( VOID  )

Definition at line 1684 of file hardware.c.

1685{
1686 PAGED_CODE();
1687
1688 WaitForKey();
1689}
static VOID WaitForKey(VOID)
Definition: hardware.c:146

Referenced by DrvTestIsolation(), DrvTestResources(), IsaPdoPnp(), IsaPdoRemoveDevice(), IsaPdoStartReadPort(), and IsaPnpFillDeviceRelations().

◆ IsaHwWakeDevice()

VOID IsaHwWakeDevice ( _In_ PISAPNP_LOGICAL_DEVICE  LogicalDevice)

Definition at line 1650 of file hardware.c.

1652{
1653 PAGED_CODE();
1654
1655 SendKey();
1656 Wake(LogicalDevice->CSN);
1657}

Referenced by DrvTestResources(), IsaPdoPnp(), and IsaPdoRemoveDevice().

◆ IsaPdoPnp()

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

Definition at line 867 of file pdo.c.

871{
872 NTSTATUS Status = Irp->IoStatus.Status;
873
874 PAGED_CODE();
875
876 if (PdoExt->Common.Signature == IsaPnpLogicalDevice)
877 {
878 DPRINT("%s(%p, %p) CSN %u, LDN %u, Minor - %X\n",
880 PdoExt,
881 Irp,
882 PdoExt->IsaPnpDevice->CSN,
883 PdoExt->IsaPnpDevice->LDN,
885 }
886 else
887 {
888 DPRINT("%s(%p, %p) ReadPort, Minor - %X\n",
890 PdoExt,
891 Irp,
893 }
894
895 switch (IrpSp->MinorFunction)
896 {
898 {
899 if (PdoExt->Common.Signature == IsaPnpLogicalDevice)
900 {
901 IsaHwWakeDevice(PdoExt->IsaPnpDevice);
902
904 PdoExt->IsaPnpDevice,
905 IrpSp->Parameters.StartDevice.AllocatedResources);
906 if (NT_SUCCESS(Status))
907 {
908 IsaHwActivateDevice(PdoExt->FdoExt, PdoExt->IsaPnpDevice);
909 }
910 else
911 {
912 DPRINT1("Failed to configure CSN %u, LDN %u with status 0x%08lx\n",
913 PdoExt->IsaPnpDevice->CSN, PdoExt->IsaPnpDevice->LDN, Status);
914 }
915
917 }
918 else
919 {
921 IrpSp->Parameters.StartDevice.AllocatedResources);
922 }
923
924 if (NT_SUCCESS(Status))
925 PdoExt->Common.State = dsStarted;
926 break;
927 }
928
930 {
931 if (PdoExt->Common.Signature == IsaPnpLogicalDevice)
932 {
933 IsaHwWakeDevice(PdoExt->IsaPnpDevice);
934 IsaHwDeactivateDevice(PdoExt->IsaPnpDevice);
935
937 }
938 else
939 {
940 PdoExt->Flags &= ~ISAPNP_READ_PORT_ALLOW_FDO_SCAN;
941 }
942
944
945 if (NT_SUCCESS(Status))
946 PdoExt->Common.State = dsStopped;
947 break;
948 }
949
951 {
952 if (PdoExt->SpecialFiles > 0)
954 else if (PdoExt->Flags & ISAPNP_READ_PORT_NEED_REBALANCE)
956 else
958
959 break;
960 }
961
963 {
964 if (PdoExt->SpecialFiles > 0)
966 else
968 break;
969 }
970
973 break;
974
977 break;
978
981 {
983
984 if (PdoExt->Common.Signature == IsaPnpLogicalDevice)
985 Status = IsaPdoRemoveDevice(PdoExt, FinalRemove);
986 else
987 Status = IsaReadPortRemoveDevice(PdoExt, FinalRemove);
988 break;
989 }
990
993 break;
994
997 break;
998
1001 break;
1002
1003 case IRP_MN_QUERY_ID:
1004 if (PdoExt->Common.Signature == IsaPnpLogicalDevice)
1006 else
1008 break;
1009
1011 if (PdoExt->Common.Signature == IsaPnpLogicalDevice)
1013 break;
1014
1017 break;
1018
1021 break;
1022
1025 break;
1026
1030 break;
1031
1032 default:
1033 DPRINT("Unknown PnP code: %X\n", IrpSp->MinorFunction);
1034 break;
1035 }
1036
1037 Irp->IoStatus.Status = Status;
1039
1040 return Status;
1041}
static NTSTATUS IsaPdoQueryDeviceUsageNotification(_In_ PISAPNP_PDO_EXTENSION PdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:719
static NTSTATUS IsaPdoQueryDeviceText(_In_ PISAPNP_PDO_EXTENSION PdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:411
static NTSTATUS IsaPdoQueryCapabilities(_In_ PISAPNP_PDO_EXTENSION PdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:51
static NTSTATUS IsaReadPortQueryId(_Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:335
static NTSTATUS IsaReadPortRemoveDevice(_In_ PISAPNP_PDO_EXTENSION PdoExt, _In_ BOOLEAN FinalRemove)
Definition: pdo.c:785
static NTSTATUS IsaPdoQueryDeviceRelations(_In_ PISAPNP_PDO_EXTENSION PdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:18
static NTSTATUS IsaPdoQueryResourceRequirements(_In_ PISAPNP_PDO_EXTENSION PdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:507
static NTSTATUS IsaPdoQueryBusInformation(_In_ PISAPNP_PDO_EXTENSION PdoExt, _Inout_ PIRP Irp)
Definition: pdo.c:694
static NTSTATUS IsaPdoQueryResources(_In_ PISAPNP_PDO_EXTENSION PdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:469
static NTSTATUS IsaPdoQueryId(_In_ PISAPNP_PDO_EXTENSION PdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:115
static NTSTATUS IsaPdoStartReadPort(_In_ PISAPNP_PDO_EXTENSION PdoExt, _In_ PCM_RESOURCE_LIST ResourceList)
Definition: pdo.c:547
static NTSTATUS IsaPdoQueryPnpDeviceState(_In_ PISAPNP_PDO_EXTENSION PdoExt, _Inout_ PIRP Irp)
Definition: pdo.c:90
static NTSTATUS IsaPdoFilterResourceRequirements(_In_ PISAPNP_PDO_EXTENSION PdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:678
static NTSTATUS IsaPdoRemoveDevice(_In_ PISAPNP_PDO_EXTENSION PdoExt, _In_ BOOLEAN FinalRemove)
Definition: pdo.c:748
VOID IsaHwWakeDevice(_In_ PISAPNP_LOGICAL_DEVICE LogicalDevice)
Definition: hardware.c:1650
VOID IsaHwWaitForKey(VOID)
Definition: hardware.c:1684
VOID IsaHwDeactivateDevice(_In_ PISAPNP_LOGICAL_DEVICE LogicalDevice)
Definition: hardware.c:1673
NTSTATUS IsaHwConfigureDevice(_In_ PISAPNP_FDO_EXTENSION FdoExt, _In_ PISAPNP_LOGICAL_DEVICE LogicalDevice, _In_ PCM_RESOURCE_LIST Resources)
Definition: hardware.c:1517
VOID IsaHwActivateDevice(_In_ PISAPNP_FDO_EXTENSION FdoExt, _In_ PISAPNP_LOGICAL_DEVICE LogicalDevice)
Definition: hardware.c:1661
#define ISAPNP_READ_PORT_NEED_REBALANCE
The I/O resource requirements have changed.
Definition: isapnp.h:78
#define STATUS_RESOURCE_REQUIREMENTS_CHANGED
Definition: ntstatus.h:103
struct _IO_STACK_LOCATION::@3979::@4016 StartDevice
#define STATUS_DEVICE_BUSY
Definition: udferr_usr.h:129
#define IRP_MN_DEVICE_USAGE_NOTIFICATION
#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS
#define IRP_MN_QUERY_ID
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
#define IRP_MN_QUERY_DEVICE_TEXT
#define IRP_MN_QUERY_CAPABILITIES
#define IRP_MN_QUERY_RESOURCES
#define IRP_MN_QUERY_BUS_INFORMATION

Referenced by _Dispatch_type_().

◆ IsaPnpCreateReadPortDORequirements()

PIO_RESOURCE_REQUIREMENTS_LIST IsaPnpCreateReadPortDORequirements ( _In_opt_ ULONG  SelectedReadPort)

Definition at line 821 of file isapnp.c.

823{
824 ULONG ResourceCount, ListSize, i;
827 const ULONG ReadPorts[] = { 0x274, 0x3E4, 0x204, 0x2E4, 0x354, 0x2F4 };
828
829 PAGED_CODE();
830
831 if (SelectedReadPort)
832 {
833 /*
834 * [IO descriptor: ISAPNP_WRITE_DATA, required]
835 * [IO descriptor: ISAPNP_WRITE_DATA, optional]
836 * [IO descriptor: ISAPNP_ADDRESS, required]
837 * [IO descriptor: ISAPNP_ADDRESS, optional]
838 * [IO descriptor: Selected Read Port, required]
839 * [IO descriptor: Read Port 1, optional]
840 * [IO descriptor: Read Port 2, optional]
841 * [...]
842 * [IO descriptor: Read Port X - 1, optional]
843 */
845 }
846 else
847 {
848 /*
849 * [IO descriptor: ISAPNP_WRITE_DATA, required]
850 * [IO descriptor: ISAPNP_WRITE_DATA, optional]
851 * [IO descriptor: ISAPNP_ADDRESS, required]
852 * [IO descriptor: ISAPNP_ADDRESS, optional]
853 * [IO descriptor: Read Port 1, required]
854 * [IO descriptor: Read Port 1, optional]
855 * [IO descriptor: Read Port 2, required]
856 * [IO descriptor: Read Port 2, optional]
857 * [...]
858 * [IO descriptor: Read Port X, required]
859 * [IO descriptor: Read Port X, optional]
860 */
862 }
863 ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) +
866 if (!RequirementsList)
867 return NULL;
868
869 RequirementsList->ListSize = ListSize;
870 RequirementsList->AlternativeLists = 1;
871
872 RequirementsList->List[0].Version = 1;
873 RequirementsList->List[0].Revision = 1;
874 RequirementsList->List[0].Count = ResourceCount;
875
876 Descriptor = &RequirementsList->List[0].Descriptors[0];
877
878 /* Store the Data port and the Address port */
879 for (i = 0; i < RTL_NUMBER_OF(IsaConfigPorts) * 2; i++)
880 {
881 if ((i % 2) == 0)
882 {
883 /* Expected port */
885 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
887 Descriptor->u.Port.Length = 0x01;
888 Descriptor->u.Port.Alignment = 0x01;
889 Descriptor->u.Port.MinimumAddress.LowPart =
890 Descriptor->u.Port.MaximumAddress.LowPart = IsaConfigPorts[i / 2];
891 }
892 else
893 {
894 /* ... but mark it as optional */
897 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
899 Descriptor->u.Port.Alignment = 0x01;
900 }
901
902 Descriptor++;
903 }
904
905 /* Store the Read Ports */
906 if (SelectedReadPort)
907 {
908 BOOLEAN Selected = FALSE;
909
911
912 for (i = 0; i < RTL_NUMBER_OF(ReadPorts); i++)
913 {
914 if (ReadPorts[i] != SelectedReadPort)
916 else
917 Selected = TRUE;
919 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
921 Descriptor->u.Port.Length = 0x04;
922 Descriptor->u.Port.Alignment = 0x01;
923 Descriptor->u.Port.MinimumAddress.LowPart = ReadPorts[i];
924 Descriptor->u.Port.MaximumAddress.LowPart = ReadPorts[i] +
925 Descriptor->u.Port.Length - 1;
926
927 Descriptor++;
928 }
929
930 ASSERT(Selected == TRUE);
931 }
932 else
933 {
934 for (i = 0; i < RTL_NUMBER_OF(ReadPorts) * 2; i++)
935 {
936 if ((i % 2) == 0)
937 {
938 /* Expected port */
940 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
942 Descriptor->u.Port.Length = 0x04;
943 Descriptor->u.Port.Alignment = 0x01;
944 Descriptor->u.Port.MinimumAddress.LowPart = ReadPorts[i / 2];
945 Descriptor->u.Port.MaximumAddress.LowPart = ReadPorts[i / 2] +
946 Descriptor->u.Port.Length - 1;
947 }
948 else
949 {
950 /* ... but mark it as optional */
953 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
955 Descriptor->u.Port.Alignment = 0x01;
956 }
957
958 Descriptor++;
959 }
960 }
961
962 return RequirementsList;
963}
ULONG IsaConfigPorts[2]
Definition: hardware.c:23
static ULONG ResourceCount
Definition: inbv.c:50
#define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
Definition: ntbasedef.h:327
_In_ WDFIORESREQLIST RequirementsList
Definition: wdfresource.h:65
#define IO_RESOURCE_ALTERNATIVE
struct _IO_RESOURCE_REQUIREMENTS_LIST IO_RESOURCE_REQUIREMENTS_LIST

Referenced by DrvTestReadDataPortQueryResourcesRequirementsForEnum(), DrvTestReadDataPortQueryResourcesRequirementsForRebalance(), and IsaPdoQueryResourceRequirements().

◆ IsaPnpCreateReadPortDOResources()

PCM_RESOURCE_LIST IsaPnpCreateReadPortDOResources ( VOID  )

Definition at line 967 of file isapnp.c.

968{
969 ULONG ListSize, i;
972
973 PAGED_CODE();
974
975 ListSize = sizeof(CM_RESOURCE_LIST) +
978 if (!ResourceList)
979 return NULL;
980
981 ResourceList->Count = 1;
982 ResourceList->List[0].InterfaceType = Internal;
983 ResourceList->List[0].PartialResourceList.Version = 1;
984 ResourceList->List[0].PartialResourceList.Revision = 1;
985 ResourceList->List[0].PartialResourceList.Count = RTL_NUMBER_OF(IsaConfigPorts);
986
987 Descriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[0];
988 for (i = 0; i < RTL_NUMBER_OF(IsaConfigPorts); i++)
989 {
991 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
993 Descriptor->u.Port.Length = 0x01;
994 Descriptor->u.Port.Start.LowPart = IsaConfigPorts[i];
995
996 Descriptor++;
997 }
998
999 return ResourceList;
1000}
struct _CM_RESOURCE_LIST CM_RESOURCE_LIST
@ Internal
Definition: hwresource.cpp:137
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:309

Referenced by DrvTestReadDataPortQueryResources(), and IsaPdoQueryResources().

◆ IsaPnpFillDeviceRelations()

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

Definition at line 1054 of file isapnp.c.

1058{
1060 PLIST_ENTRY CurrentEntry;
1061 PISAPNP_LOGICAL_DEVICE IsaDevice;
1062 PDEVICE_RELATIONS DeviceRelations;
1063 ULONG PdoCount, i = 0;
1064
1065 PAGED_CODE();
1066
1067 IsaPnpAcquireBusDataLock();
1068
1069 /* Try to claim the Read Port for our FDO */
1070 if (!ReadPortCreated)
1071 {
1073 if (!NT_SUCCESS(Status))
1074 return Status;
1075
1076 ReadPortCreated = TRUE;
1077 }
1078
1079 IsaPnpReleaseBusDataLock();
1080
1081 /* Inactive ISA bus */
1082 if (!FdoExt->ReadPortPdo)
1083 IncludeDataPort = FALSE;
1084
1085 IsaPnpAcquireDeviceDataLock(FdoExt);
1086
1087 /* If called from the FDO dispatch routine && Active bus */
1088 if (IncludeDataPort && FdoExt->ReadPortPdo)
1089 {
1090 PISAPNP_PDO_EXTENSION ReadPortExt = FdoExt->ReadPortPdo->DeviceExtension;
1091
1092 if ((ReadPortExt->Flags & ISAPNP_READ_PORT_ALLOW_FDO_SCAN) &&
1093 !(ReadPortExt->Flags & ISAPNP_SCANNED_BY_READ_PORT))
1094 {
1095 DPRINT("Rescan ISA PnP bus\n");
1096
1097 /* Run the isolation protocol */
1098 FdoExt->Cards = IsaHwTryReadDataPort(FdoExt->ReadDataPort);
1099
1100 /* Card identification */
1101 if (FdoExt->Cards > 0)
1102 (VOID)IsaHwFillDeviceList(FdoExt);
1103
1105 }
1106
1107 ReadPortExt->Flags &= ~ISAPNP_SCANNED_BY_READ_PORT;
1108 }
1109
1110 PdoCount = FdoExt->DeviceCount;
1111 if (IncludeDataPort)
1112 ++PdoCount;
1113
1114 CurrentEntry = FdoExt->DeviceListHead.Flink;
1115 while (CurrentEntry != &FdoExt->DeviceListHead)
1116 {
1117 IsaDevice = CONTAINING_RECORD(CurrentEntry, ISAPNP_LOGICAL_DEVICE, DeviceLink);
1118
1119 if (!(IsaDevice->Flags & ISAPNP_PRESENT))
1120 --PdoCount;
1121
1122 CurrentEntry = CurrentEntry->Flink;
1123 }
1124
1125 DeviceRelations = ExAllocatePoolWithTag(PagedPool,
1126 FIELD_OFFSET(DEVICE_RELATIONS, Objects[PdoCount]),
1127 TAG_ISAPNP);
1128 if (!DeviceRelations)
1129 {
1130 IsaPnpReleaseDeviceDataLock(FdoExt);
1131 return STATUS_NO_MEMORY;
1132 }
1133
1134 if (IncludeDataPort)
1135 {
1136 PISAPNP_PDO_EXTENSION ReadPortExt = FdoExt->ReadPortPdo->DeviceExtension;
1137
1138 DeviceRelations->Objects[i++] = FdoExt->ReadPortPdo;
1139 ObReferenceObject(FdoExt->ReadPortPdo);
1140
1141 /* The Read Port PDO can only be removed by FDO */
1142 ReadPortExt->Flags |= ISAPNP_ENUMERATED;
1143 }
1144
1145 CurrentEntry = FdoExt->DeviceListHead.Flink;
1146 while (CurrentEntry != &FdoExt->DeviceListHead)
1147 {
1149
1150 IsaDevice = CONTAINING_RECORD(CurrentEntry, ISAPNP_LOGICAL_DEVICE, DeviceLink);
1151
1152 if (!(IsaDevice->Flags & ISAPNP_PRESENT))
1153 goto SkipPdo;
1154
1155 if (!IsaDevice->Pdo)
1156 {
1157 Status = IoCreateDevice(FdoExt->DriverObject,
1158 sizeof(ISAPNP_PDO_EXTENSION),
1159 NULL,
1162 FALSE,
1163 &IsaDevice->Pdo);
1164 if (!NT_SUCCESS(Status))
1165 goto SkipPdo;
1166
1167 IsaDevice->Pdo->Flags &= ~DO_DEVICE_INITIALIZING;
1168 /* The power pagable flag is always unset */
1169
1170 PdoExt = IsaDevice->Pdo->DeviceExtension;
1171
1173 PdoExt->Common.Signature = IsaPnpLogicalDevice;
1174 PdoExt->Common.Self = IsaDevice->Pdo;
1175 PdoExt->Common.State = dsStopped;
1176 PdoExt->IsaPnpDevice = IsaDevice;
1177 PdoExt->FdoExt = FdoExt;
1178
1181 {
1182 if (PdoExt->RequirementsList)
1183 {
1184 ExFreePoolWithTag(PdoExt->RequirementsList, TAG_ISAPNP);
1185 PdoExt->RequirementsList = NULL;
1186 }
1187
1188 if (PdoExt->ResourceList)
1189 {
1190 ExFreePoolWithTag(PdoExt->ResourceList, TAG_ISAPNP);
1191 PdoExt->ResourceList = NULL;
1192 }
1193
1194 IoDeleteDevice(IsaDevice->Pdo);
1195 IsaDevice->Pdo = NULL;
1196 goto SkipPdo;
1197 }
1198 }
1199 else
1200 {
1201 PdoExt = IsaDevice->Pdo->DeviceExtension;
1202 }
1203 DeviceRelations->Objects[i++] = IsaDevice->Pdo;
1204 ObReferenceObject(IsaDevice->Pdo);
1205
1206 PdoExt->Flags |= ISAPNP_ENUMERATED;
1207
1208 CurrentEntry = CurrentEntry->Flink;
1209 continue;
1210
1211SkipPdo:
1212 if (IsaDevice->Pdo)
1213 {
1214 PdoExt = IsaDevice->Pdo->DeviceExtension;
1215
1216 if (PdoExt)
1217 PdoExt->Flags &= ~ISAPNP_ENUMERATED;
1218 }
1219
1220 CurrentEntry = CurrentEntry->Flink;
1221 }
1222
1223 IsaPnpReleaseDeviceDataLock(FdoExt);
1224
1225 DeviceRelations->Count = i;
1226
1227 Irp->IoStatus.Information = (ULONG_PTR)DeviceRelations;
1228
1229 return Status;
1230}
#define VOID
Definition: acefi.h:82
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
UCHAR IsaHwTryReadDataPort(_In_ PUCHAR ReadDataPort)
Definition: hardware.c:1259
#define ULONG_PTR
Definition: config.h:101
static NTSTATUS IsaPnpCreateLogicalDeviceRequirements(_In_ PISAPNP_PDO_EXTENSION PdoExt)
Definition: isapnp.c:189
static NTSTATUS IsaPnpCreateLogicalDeviceResources(_In_ PISAPNP_PDO_EXTENSION PdoExt)
Definition: isapnp.c:625
static NTSTATUS IsaPnpCreateReadPortDO(_In_ PISAPNP_FDO_EXTENSION FdoExt)
Definition: isapnp.c:1007
#define ISAPNP_READ_PORT_ALLOW_FDO_SCAN
Allows the active FDO to scan the bus.
Definition: isapnp.h:77
#define ISAPNP_SCANNED_BY_READ_PORT
The bus has been scanned by Read Port PDO.
Definition: isapnp.h:76
#define ISAPNP_ENUMERATED
Whether the device has been reported to the PnP manager.
Definition: isapnp.h:75
#define FILE_AUTOGENERATED_DEVICE_NAME
Definition: iotypes.h:138
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
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
#define FILE_DEVICE_CONTROLLER
Definition: winioctl.h:49
PDEVICE_OBJECT Self
Definition: pciidex.h:60
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2163
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define ObReferenceObject
Definition: obfuncs.h:204

Referenced by IsaFdoQueryBusRelations(), and IsaPdoQueryDeviceRelations().

◆ IsaPnpRemoveLogicalDeviceDO()

VOID IsaPnpRemoveLogicalDeviceDO ( _In_ PDEVICE_OBJECT  Pdo)

Definition at line 823 of file pdo.c.

825{
826 PISAPNP_PDO_EXTENSION PdoExt = Pdo->DeviceExtension;
827 PISAPNP_LOGICAL_DEVICE LogDev = PdoExt->IsaPnpDevice;
829
830 PAGED_CODE();
831 ASSERT(LogDev);
832
833 DPRINT("Removing CSN %u, LDN %u\n", LogDev->CSN, LogDev->LDN);
834
835 if (PdoExt->RequirementsList)
836 ExFreePoolWithTag(PdoExt->RequirementsList, TAG_ISAPNP);
837
838 if (PdoExt->ResourceList)
839 ExFreePoolWithTag(PdoExt->ResourceList, TAG_ISAPNP);
840
841 if (LogDev->FriendlyName)
843
844 if (LogDev->Resources)
846
847 Entry = LogDev->CompatibleIdList.Flink;
848 while (Entry != &LogDev->CompatibleIdList)
849 {
850 PISAPNP_COMPATIBLE_ID_ENTRY CompatibleId =
852
853 RemoveEntryList(&CompatibleId->IdLink);
854
855 Entry = Entry->Flink;
856
857 ExFreePoolWithTag(CompatibleId, TAG_ISAPNP);
858 }
859
861
863}
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
Definition: isapnpres.h:53
LIST_ENTRY IdLink
Definition: isapnpres.h:56
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:72

Referenced by IsaFdoRemoveDevice(), and IsaPdoRemoveDevice().

◆ IsaPnpRemoveReadPortDO()

VOID IsaPnpRemoveReadPortDO ( _In_ PDEVICE_OBJECT  Pdo)

Definition at line 1042 of file isapnp.c.

1044{
1045 PAGED_CODE();
1046
1047 DPRINT("Removing Read Port\n");
1048
1050}

Referenced by IsaFdoRemoveDevice(), and IsaReadPortRemoveDevice().

Variable Documentation

◆ BusSyncEvent

KEVENT BusSyncEvent
extern

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 202 of file isapnp.h.