ReactOS 0.4.16-dev-88-ga65b6ae
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.

39{
40 PAGED_CODE();
41
45 if (Description->Information & 0x1)
47 else
49 Descriptor->u.Port.Length = Description->Length;
50 Descriptor->u.Port.Alignment = Description->Alignment;
51 Descriptor->u.Port.MinimumAddress.LowPart = Description->Minimum;
52 Descriptor->u.Port.MaximumAddress.LowPart = Description->Maximum +
53 Description->Length - 1;
54}
#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 1351 of file hardware.c.

1356{
1357 PISAPNP_LOGICAL_DEVICE LogDevice;
1358 UCHAR Csn;
1360 PUCHAR ResourceData;
1361
1362 PAGED_CODE();
1363 ASSERT(FdoExt->ReadDataPort);
1364
1365 DPRINT("%s for read port 0x%p\n", __FUNCTION__, FdoExt->ReadDataPort);
1366
1368 if (!ResourceData)
1369 {
1370 DPRINT1("Failed to allocate memory for cache data\n");
1372 }
1373
1374 for (Entry = FdoExt->DeviceListHead.Flink;
1375 Entry != &FdoExt->DeviceListHead;
1376 Entry = Entry->Flink)
1377 {
1378 LogDevice = CONTAINING_RECORD(Entry, ISAPNP_LOGICAL_DEVICE, DeviceLink);
1379
1380 LogDevice->Flags &= ~ISAPNP_PRESENT;
1381 }
1382
1383 for (Csn = 1; Csn <= FdoExt->Cards; Csn++)
1384 {
1386 UCHAR TempId[3], LogDev;
1388 ULONG MaxTagsPerDevice;
1389 USHORT MaxLogDev;
1390
1391 Wake(Csn);
1392
1393 Peek(FdoExt->ReadDataPort, &Identifier, sizeof(Identifier));
1394
1395 IsaPnpExtractAscii(TempId, Identifier.VendorId);
1396 Identifier.ProdId = RtlUshortByteSwap(Identifier.ProdId);
1397
1398 Status = ReadTags(FdoExt->ReadDataPort,
1399 ResourceData,
1401 &MaxLogDev,
1402 &MaxTagsPerDevice);
1403 if (!NT_SUCCESS(Status))
1404 {
1405 DPRINT1("Failed to read tags with status 0x%08lx, CSN %u\n", Status, Csn);
1406 continue;
1407 }
1408
1409 DPRINT("Detected ISA PnP device - VID: '%.3s' PID: 0x%04x SN: 0x%08lX\n",
1410 TempId, Identifier.ProdId, Identifier.Serial);
1411
1412 for (LogDev = 0; LogDev < MaxLogDev; LogDev++)
1413 {
1414 BOOLEAN IsAlreadyEnumerated = FALSE;
1415
1416#ifndef UNIT_TEST
1417 for (Entry = FdoExt->DeviceListHead.Flink;
1418 Entry != &FdoExt->DeviceListHead;
1419 Entry = Entry->Flink)
1420 {
1421 LogDevice = CONTAINING_RECORD(Entry, ISAPNP_LOGICAL_DEVICE, DeviceLink);
1422
1423 /* This logical device has already been enumerated */
1424 if ((LogDevice->SerialNumber == Identifier.Serial) &&
1425 (RtlCompareMemory(LogDevice->VendorId, TempId, 3) == 3) &&
1426 (LogDevice->ProdId == Identifier.ProdId) &&
1427 (LogDevice->LDN == LogDev))
1428 {
1429 LogDevice->Flags |= ISAPNP_PRESENT;
1430
1431 /* Assign a new CSN */
1432 LogDevice->CSN = Csn;
1433
1434 if (LogDevice->Pdo)
1435 {
1437
1438 if (PdoExt->Common.State == dsStarted)
1439 ActivateDevice(FdoExt->ReadDataPort, LogDev);
1440 }
1441
1442 DPRINT("Skip CSN %u, LDN %u\n", LogDevice->CSN, LogDevice->LDN);
1443 IsAlreadyEnumerated = TRUE;
1444 break;
1445 }
1446 }
1447#endif /* UNIT_TEST */
1448
1449 if (IsAlreadyEnumerated)
1450 continue;
1451
1453 if (!LogDevice)
1454 {
1455 DPRINT1("Failed to allocate logical device!\n");
1456 goto Deactivate;
1457 }
1458
1460
1461 LogDevice->CSN = Csn;
1462 LogDevice->LDN = LogDev;
1463
1465 MaxTagsPerDevice * sizeof(ISAPNP_RESOURCE),
1466 TAG_ISAPNP);
1467 if (!LogDevice->Resources)
1468 {
1469 DPRINT1("Failed to allocate the resources array\n");
1470 FreeLogicalDevice(LogDevice);
1471 goto Deactivate;
1472 }
1473
1474 Status = ParseTags(ResourceData, LogDev, LogDevice);
1475 if (!NT_SUCCESS(Status))
1476 {
1477 DPRINT1("Failed to parse tags with status 0x%08lx, CSN %u, LDN %u\n",
1478 Status, LogDevice->CSN, LogDevice->LDN);
1479 FreeLogicalDevice(LogDevice);
1480 goto Deactivate;
1481 }
1482
1483 if (!ReadCurrentResources(FdoExt->ReadDataPort, LogDevice))
1484 DPRINT("Unable to read boot resources\n");
1485
1486 IsaPnpExtractAscii(LogDevice->VendorId, Identifier.VendorId);
1487 LogDevice->ProdId = Identifier.ProdId;
1488 LogDevice->SerialNumber = Identifier.Serial;
1489
1490 if (MaxLogDev > 1)
1491 LogDevice->Flags |= ISAPNP_HAS_MULTIPLE_LOGDEVS;
1492
1493 LogDevice->Flags |= ISAPNP_PRESENT;
1494
1495 InsertTailList(&FdoExt->DeviceListHead, &LogDevice->DeviceLink);
1496 FdoExt->DeviceCount++;
1497
1498 /* Now we wait for the start device IRP */
1499Deactivate:
1500 DeactivateDevice(LogDev);
1501 }
1502 }
1503
1504 ExFreePoolWithTag(ResourceData, TAG_ISAPNP);
1505
1506 return STATUS_SUCCESS;
1507}
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:562
static VOID Peek(_In_ PUCHAR ReadDataPort, _Out_writes_bytes_all_opt_(Length) PVOID Buffer, _In_ USHORT Length)
Definition: hardware.c:373
static VOID ActivateDevice(_In_ PUCHAR ReadDataPort, _In_ UCHAR LogDev)
Definition: hardware.c:193
static VOID FreeLogicalDevice(_In_ __drv_freesMem(Mem) PISAPNP_LOGICAL_DEVICE LogDevice)
Definition: hardware.c:530
static VOID DeactivateDevice(_In_ UCHAR LogDev)
Definition: hardware.c:208
static VOID Wake(_In_ UCHAR Csn)
Definition: hardware.c:148
static VOID IsaPnpExtractAscii(_Out_writes_all_(3) PUCHAR Buffer, _In_ USHORT CompressedData)
Definition: hardware.c:419
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:433
static BOOLEAN ReadCurrentResources(_In_ PUCHAR ReadDataPort, _Inout_ PISAPNP_LOGICAL_DEVICE LogDevice)
Definition: hardware.c:1047
#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:3211
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 533 of file isapnp.c.

536{
538
539 PAGED_CODE();
540
541 Resource = LogDevice->Resources;
542 while (Resource->Type != ISAPNP_RESOURCE_TYPE_END)
543 {
545 {
547
548 if (Description->Mask & (1 << Channel))
549 return TRUE;
550 }
551
552 ++Resource;
553 }
554
555 return FALSE;
556}
_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 457 of file isapnp.c.

464{
466
467 PAGED_CODE();
468
469 Resource = LogDevice->Resources;
470 while (Resource->Type != ISAPNP_RESOURCE_TYPE_END)
471 {
473 {
475 BOOLEAN Match;
476
477 if (Base)
478 {
479 Match = (Base >= Description->Minimum) && (Base <= Description->Maximum);
480 }
481 else
482 {
483 Match = (RangeStart >= Description->Minimum) &&
484 (RangeEnd <= (ULONG)(Description->Maximum + Description->Length - 1));
485 }
486
487 if (Match)
488 {
489 if (Information)
490 *Information = Description->Information;
491 if (Length)
492 *Length = Description->Length;
493
494 return TRUE;
495 }
496 }
497
498 ++Resource;
499 }
500
501 return FALSE;
502}
#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 506 of file isapnp.c.

509{
511
512 PAGED_CODE();
513
514 Resource = LogDevice->Resources;
515 while (Resource->Type != ISAPNP_RESOURCE_TYPE_END)
516 {
518 {
520
521 if (Description->Mask & (1 << Vector))
522 return TRUE;
523 }
524
525 ++Resource;
526 }
527
528 return FALSE;
529}
#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 560 of file isapnp.c.

565{
567
568 PAGED_CODE();
569
570 Resource = LogDevice->Resources;
571 while (Resource->Type != ISAPNP_RESOURCE_TYPE_END)
572 {
573 switch (Resource->Type)
574 {
576 {
578
579 Description = &Resource->MemRangeDescription;
580
581 if ((RangeStart >= (ULONG)(Description->Minimum << 8)) &&
582 (RangeEnd <= (ULONG)((Description->Maximum << 8) +
583 (Description->Length << 8) - 1)))
584 {
585 if (Information)
586 *Information = Description->Information;
587
588 return TRUE;
589 }
590 break;
591 }
592
594 {
595 PISAPNP_MEMRANGE32_DESCRIPTION Description32;
596
597 Description32 = &Resource->MemRange32Description;
598
599 if ((RangeStart >= Description32->Minimum) &&
600 (RangeEnd <= (Description32->Maximum + Description32->Length - 1)))
601 {
602 if (Information)
603 *Information = Description32->Information;
604
605 return TRUE;
606 }
607 break;
608 }
609
610 default:
611 break;
612 }
613
614 ++Resource;
615 }
616
617 return FALSE;
618}
#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
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
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423
struct _IO_STACK_LOCATION::@3974::@3999 QueryDeviceRelations
union _IO_STACK_LOCATION::@1575 Parameters
#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::@3974::@4000 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 1655 of file hardware.c.

1658{
1659 PAGED_CODE();
1660
1661 ActivateDevice(FdoExt->ReadDataPort, LogicalDevice->LDN);
1662}

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 1511 of file hardware.c.

1515{
1516 ULONG i;
1517 UCHAR NumberOfIo = 0,
1518 NumberOfIrq = 0,
1519 NumberOfDma = 0,
1520 NumberOfMemory = 0,
1521 NumberOfMemory32 = 0;
1522
1523 PAGED_CODE();
1524
1525 if (!Resources)
1527
1528 WriteLogicalDeviceNumber(LogicalDevice->LDN);
1529
1530 for (i = 0; i < Resources->List[0].PartialResourceList.Count; i++)
1531 {
1533 &Resources->List[0].PartialResourceList.PartialDescriptors[i];
1534
1535 switch (Descriptor->Type)
1536 {
1537 case CmResourceTypePort:
1538 {
1539 if (NumberOfIo >= RTL_NUMBER_OF(LogicalDevice->Io))
1541
1542 IsaProgramIoDecoder(Descriptor, NumberOfIo++);
1543 break;
1544 }
1545
1547 {
1548 if (NumberOfIrq >= RTL_NUMBER_OF(LogicalDevice->Irq))
1550
1551 IsaProgramIrqSelect(Descriptor, NumberOfIrq++);
1552 break;
1553 }
1554
1555 case CmResourceTypeDma:
1556 {
1557 if (NumberOfDma >= RTL_NUMBER_OF(LogicalDevice->Dma))
1559
1560 IsaProgramDmaSelect(Descriptor, NumberOfDma++);
1561 break;
1562 }
1563
1565 {
1566 BOOLEAN IsMemory32;
1569
1570 if ((NumberOfMemory + NumberOfMemory32) >= RTL_NUMBER_OF(LogicalDevice->MemRange))
1572
1573 /*
1574 * The PNP ROM provides an information byte for each memory descriptor
1575 * which is then used to program the memory control register.
1576 */
1577 if (!FindMemoryDescriptor(LogicalDevice,
1578 Descriptor->u.Memory.Start.LowPart,
1579 Descriptor->u.Memory.Start.LowPart +
1580 Descriptor->u.Memory.Length - 1,
1581 &Information))
1582 {
1584 }
1585
1586 /* We can have a 24- or 32-bit memory decoder, but not both */
1587 IsMemory32 = !!(LogicalDevice->Flags & ISAPNP_HAS_MEM32_DECODER);
1588
1589 if (IsMemory32)
1590 Index = NumberOfMemory32++;
1591 else
1592 Index = NumberOfMemory++;
1593
1594 Status = IsaProgramMemoryDecoder(FdoExt->ReadDataPort,
1595 Descriptor,
1596 IsMemory32,
1598 Index);
1599 if (!NT_SUCCESS(Status))
1600 return Status;
1601
1602 break;
1603 }
1604
1605 default:
1606 break;
1607 }
1608 }
1609
1610 /* Disable the unclaimed device resources */
1611 for (i = NumberOfIo; i < RTL_NUMBER_OF(LogicalDevice->Io); i++)
1612 {
1614 }
1615 for (i = NumberOfIrq; i < RTL_NUMBER_OF(LogicalDevice->Irq); i++)
1616 {
1619 }
1620 for (i = NumberOfDma; i < RTL_NUMBER_OF(LogicalDevice->Dma); i++)
1621 {
1623 }
1624 for (i = NumberOfMemory; i < RTL_NUMBER_OF(LogicalDevice->MemRange); i++)
1625 {
1629 }
1630 for (i = NumberOfMemory32; i < RTL_NUMBER_OF(LogicalDevice->MemRange32); i++)
1631 {
1635 }
1636
1638
1639 return STATUS_SUCCESS;
1640}
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
static VOID WriteDoubleWord(_In_ UCHAR Address, _In_ ULONG Value)
Definition: hardware.c:77
static VOID IsaProgramIrqSelect(_In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, _In_ UCHAR Index)
Definition: hardware.c:1150
static VOID IsaProgramDmaSelect(_In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, _In_ UCHAR Index)
Definition: hardware.c:1172
static VOID WriteByte(_In_ UCHAR Address, _In_ UCHAR Value)
Definition: hardware.c:53
static VOID IsaProgramIoDecoder(_In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, _In_ UCHAR Index)
Definition: hardware.c:1136
static VOID WriteLogicalDeviceNumber(_In_ UCHAR LogDev)
Definition: hardware.c:184
static VOID WriteWord(_In_ UCHAR Address, _In_ USHORT Value)
Definition: hardware.c:66
static NTSTATUS IsaProgramMemoryDecoder(_In_ PUCHAR ReadDataPort, _In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, _In_ BOOLEAN IsMemory32, _In_ UCHAR Information, _In_ UCHAR Index)
Definition: hardware.c:1186
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:560
#define ISAPNP_MEMBASE32(n)
Definition: isapnphw.h:50
#define ISAPNP_MEMCONTROL32(n)
Definition: isapnphw.h:51
#define ISAPNP_MEMLIMIT(n)
Definition: isapnphw.h:42
#define ISAPNP_MEMLIMIT32(n)
Definition: isapnphw.h:52
#define ISAPNP_DMACHANNEL(n)
Definition: isapnphw.h:48
#define ISAPNP_MEMBASE(n)
Definition: isapnphw.h:36
#define ISAPNP_MEMCONTROL(n)
Definition: isapnphw.h:37
#define ISAPNP_IRQTYPE(n)
Definition: isapnphw.h:45
#define ISAPNP_IRQNO(n)
Definition: isapnphw.h:44
#define DMACHANNEL_NONE
Definition: isapnphw.h:49
#define ISAPNP_IOBASE(n)
Definition: isapnphw.h:43
#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 1667 of file hardware.c.

1669{
1670 PAGED_CODE();
1671
1672 DeactivateDevice(LogicalDevice->LDN);
1673}

Referenced by IsaPdoPnp(), and IsaPdoRemoveDevice().

◆ IsaHwTryReadDataPort()

UCHAR IsaHwTryReadDataPort ( _In_ PUCHAR  ReadDataPort)

Definition at line 1253 of file hardware.c.

1255{
1256 ULONG NumberOfRead = 0;
1257 UCHAR Csn = 0;
1258
1259 PAGED_CODE();
1260
1261 DPRINT("Setting read data port: 0x%p\n", ReadDataPort);
1262
1263 SendKey();
1264
1268
1269 SendKey();
1270
1271 Wake(0x00);
1273
1274 SetReadDataPort(ReadDataPort);
1275
1276 Wake(0x00);
1277
1278 while (TRUE)
1279 {
1281 UCHAR i, j;
1282 BOOLEAN Seen55aa = FALSE;
1283
1286
1288
1289 for (i = 0; i < sizeof(Identifier); i++)
1290 {
1291 UCHAR Byte = 0;
1292
1293 for (j = 0; j < RTL_BITS_OF(Byte); j++)
1294 {
1295 USHORT Data;
1296
1297 Data = ReadData(ReadDataPort) << 8;
1299 Data |= ReadData(ReadDataPort);
1301
1302 Byte >>= 1;
1303
1304 if (Data == 0x55AA)
1305 {
1306 Byte |= 0x80;
1307 Seen55aa = TRUE;
1308 }
1309 }
1310
1311 ((PUCHAR)&Identifier)[i] = Byte;
1312 }
1313
1314 ++NumberOfRead;
1315
1316 if (Identifier.Checksum != 0x00 &&
1317 Identifier.Checksum != IsaPnpChecksum(&Identifier))
1318 {
1319 DPRINT("Bad checksum\n");
1320 break;
1321 }
1322
1323 if (!Seen55aa)
1324 {
1325 DPRINT("Saw no sign of life\n");
1326 break;
1327 }
1328
1329 Csn++;
1330
1331 WriteCsn(Csn);
1333
1334 Wake(0x00);
1335 }
1336
1337 Wake(0x00);
1338
1339 if (NumberOfRead == 1)
1340 {
1341 DPRINT("Trying next read data port\n");
1342 return 0;
1343 }
1344 else
1345 {
1346 DPRINT("Found %u cards at read port 0x%p\n", Csn, ReadDataPort);
1347 return Csn;
1348 }
1349}
@ ReadData
Definition: amstream.idl:63
unsigned char Byte
Definition: zlib.h:37
static VOID SetReadDataPort(_In_ PUCHAR ReadDataPort)
Definition: hardware.c:123
static VOID SendKey(VOID)
Definition: hardware.c:332
static VOID WriteCsn(_In_ UCHAR Csn)
Definition: hardware.c:175
static VOID EnterIsolationState(VOID)
Definition: hardware.c:132
static UCHAR IsaPnpChecksum(_In_ PISAPNP_IDENTIFIER Identifier)
Definition: hardware.c:394
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:55
#define ISAPNP_CONFIGCONTROL
Definition: isapnphw.h:26
#define ISAPNP_CONFIG_RESET_CSN
Definition: isapnphw.h:56
#define RTL_BITS_OF(sizeOfArg)
Definition: ntbasedef.h:668
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

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

◆ IsaHwWaitForKey()

VOID IsaHwWaitForKey ( VOID  )

Definition at line 1678 of file hardware.c.

1679{
1680 PAGED_CODE();
1681
1682 WaitForKey();
1683}
static VOID WaitForKey(VOID)
Definition: hardware.c:140

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

◆ IsaHwWakeDevice()

VOID IsaHwWakeDevice ( _In_ PISAPNP_LOGICAL_DEVICE  LogicalDevice)

Definition at line 1644 of file hardware.c.

1646{
1647 PAGED_CODE();
1648
1649 SendKey();
1650 Wake(LogicalDevice->CSN);
1651}

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:1644
VOID IsaHwWaitForKey(VOID)
Definition: hardware.c:1678
VOID IsaHwDeactivateDevice(_In_ PISAPNP_LOGICAL_DEVICE LogicalDevice)
Definition: hardware.c:1667
NTSTATUS IsaHwConfigureDevice(_In_ PISAPNP_FDO_EXTENSION FdoExt, _In_ PISAPNP_LOGICAL_DEVICE LogicalDevice, _In_ PCM_RESOURCE_LIST Resources)
Definition: hardware.c:1511
VOID IsaHwActivateDevice(_In_ PISAPNP_FDO_EXTENSION FdoExt, _In_ PISAPNP_LOGICAL_DEVICE LogicalDevice)
Definition: hardware.c:1655
#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::@3974::@4011 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 819 of file isapnp.c.

821{
822 ULONG ResourceCount, ListSize, i;
826 const ULONG ReadPorts[] = { 0x274, 0x3E4, 0x204, 0x2E4, 0x354, 0x2F4 };
827
828 PAGED_CODE();
829
830 if (SelectedReadPort)
831 {
832 /*
833 * [IO descriptor: ISAPNP_WRITE_DATA, required]
834 * [IO descriptor: ISAPNP_WRITE_DATA, optional]
835 * [IO descriptor: ISAPNP_ADDRESS, required]
836 * [IO descriptor: ISAPNP_ADDRESS, optional]
837 * [IO descriptor: Selected Read Port, required]
838 * [IO descriptor: Read Port 1, optional]
839 * [IO descriptor: Read Port 2, optional]
840 * [...]
841 * [IO descriptor: Read Port X - 1, optional]
842 */
844 }
845 else
846 {
847 /*
848 * [IO descriptor: ISAPNP_WRITE_DATA, required]
849 * [IO descriptor: ISAPNP_WRITE_DATA, optional]
850 * [IO descriptor: ISAPNP_ADDRESS, required]
851 * [IO descriptor: ISAPNP_ADDRESS, optional]
852 * [IO descriptor: Read Port 1, required]
853 * [IO descriptor: Read Port 1, optional]
854 * [IO descriptor: Read Port 2, required]
855 * [IO descriptor: Read Port 2, optional]
856 * [...]
857 * [IO descriptor: Read Port X, required]
858 * [IO descriptor: Read Port X, optional]
859 */
860 ResourceCount = (RTL_NUMBER_OF(Ports) + RTL_NUMBER_OF(ReadPorts)) * 2;
861 }
862 ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) +
865 if (!RequirementsList)
866 return NULL;
867
868 RequirementsList->ListSize = ListSize;
869 RequirementsList->AlternativeLists = 1;
870
871 RequirementsList->List[0].Version = 1;
872 RequirementsList->List[0].Revision = 1;
873 RequirementsList->List[0].Count = ResourceCount;
874
875 Descriptor = &RequirementsList->List[0].Descriptors[0];
876
877 /* Store the Data port and the Address port */
878 for (i = 0; i < RTL_NUMBER_OF(Ports) * 2; i++)
879 {
880 if ((i % 2) == 0)
881 {
882 /* Expected port */
884 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
886 Descriptor->u.Port.Length = 0x01;
887 Descriptor->u.Port.Alignment = 0x01;
888 Descriptor->u.Port.MinimumAddress.LowPart =
889 Descriptor->u.Port.MaximumAddress.LowPart = Ports[i / 2];
890 }
891 else
892 {
893 /* ... but mark it as optional */
896 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
898 Descriptor->u.Port.Alignment = 0x01;
899 }
900
901 Descriptor++;
902 }
903
904 /* Store the Read Ports */
905 if (SelectedReadPort)
906 {
907 BOOLEAN Selected = FALSE;
908
910
911 for (i = 0; i < RTL_NUMBER_OF(ReadPorts); i++)
912 {
913 if (ReadPorts[i] != SelectedReadPort)
915 else
916 Selected = TRUE;
918 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
920 Descriptor->u.Port.Length = 0x04;
921 Descriptor->u.Port.Alignment = 0x01;
922 Descriptor->u.Port.MinimumAddress.LowPart = ReadPorts[i];
923 Descriptor->u.Port.MaximumAddress.LowPart = ReadPorts[i] +
924 Descriptor->u.Port.Length - 1;
925
926 Descriptor++;
927 }
928
929 ASSERT(Selected == TRUE);
930 }
931 else
932 {
933 for (i = 0; i < RTL_NUMBER_OF(ReadPorts) * 2; i++)
934 {
935 if ((i % 2) == 0)
936 {
937 /* Expected port */
939 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
941 Descriptor->u.Port.Length = 0x04;
942 Descriptor->u.Port.Alignment = 0x01;
943 Descriptor->u.Port.MinimumAddress.LowPart = ReadPorts[i / 2];
944 Descriptor->u.Port.MaximumAddress.LowPart = ReadPorts[i / 2] +
945 Descriptor->u.Port.Length - 1;
946 }
947 else
948 {
949 /* ... but mark it as optional */
952 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
954 Descriptor->u.Port.Alignment = 0x01;
955 }
956
957 Descriptor++;
958 }
959 }
960
961 return RequirementsList;
962}
static ULONG ResourceCount
Definition: inbv.c:50
#define ISAPNP_ADDRESS
Definition: isapnphw.h:20
#define ISAPNP_WRITE_DATA
Definition: isapnphw.h:21
#define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
Definition: ntbasedef.h:319
static PS2_PORT Ports[PS2_PORTS]
Definition: ps2.c:52
_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 966 of file isapnp.c.

967{
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(Ports);
986
987 Descriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[0];
988 for (i = 0; i < RTL_NUMBER_OF(Ports); i++)
989 {
991 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
993 Descriptor->u.Port.Length = 0x01;
994 Descriptor->u.Port.Start.LowPart = Ports[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
UCHAR IsaHwTryReadDataPort(_In_ PUCHAR ReadDataPort)
Definition: hardware.c:1253
#define ULONG_PTR
Definition: config.h:101
static NTSTATUS IsaPnpCreateLogicalDeviceRequirements(_In_ PISAPNP_PDO_EXTENSION PdoExt)
Definition: isapnp.c:187
static NTSTATUS IsaPnpCreateLogicalDeviceResources(_In_ PISAPNP_PDO_EXTENSION PdoExt)
Definition: isapnp.c:623
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 STATUS_NO_MEMORY
Definition: ntstatus.h:260
#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.