ReactOS  0.4.15-dev-4863-gba0d16f
pci.h File Reference
#include <ntifs.h>
#include <cmreslist.h>
#include <ntstrsafe.h>
Include dependency graph for pci.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _PCI_DEVICE
 
struct  _COMMON_DEVICE_EXTENSION
 
struct  _PDO_DEVICE_EXTENSION
 
struct  _FDO_DEVICE_EXTENSION
 
struct  _PCI_DRIVER_EXTENSION
 
union  _PCI_TYPE1_CFG_CYCLE_BITS
 

Macros

#define TAG_PCI   '0ICP'
 

Typedefs

typedef struct _PCI_DEVICE PCI_DEVICE
 
typedef struct _PCI_DEVICEPPCI_DEVICE
 
typedef struct _COMMON_DEVICE_EXTENSION COMMON_DEVICE_EXTENSION
 
typedef struct _COMMON_DEVICE_EXTENSIONPCOMMON_DEVICE_EXTENSION
 
typedef struct _PDO_DEVICE_EXTENSION PDO_DEVICE_EXTENSION
 
typedef struct _PDO_DEVICE_EXTENSIONPPDO_DEVICE_EXTENSION
 
typedef struct _FDO_DEVICE_EXTENSION FDO_DEVICE_EXTENSION
 
typedef struct _FDO_DEVICE_EXTENSIONPFDO_DEVICE_EXTENSION
 
typedef struct _PCI_DRIVER_EXTENSION PCI_DRIVER_EXTENSION
 
typedef struct _PCI_DRIVER_EXTENSIONPPCI_DRIVER_EXTENSION
 
typedef union _PCI_TYPE1_CFG_CYCLE_BITS PCI_TYPE1_CFG_CYCLE_BITS
 
typedef union _PCI_TYPE1_CFG_CYCLE_BITSPPCI_TYPE1_CFG_CYCLE_BITS
 

Enumerations

enum  PCI_DEVICE_STATE {
  dsStopped, dsStarted, dsPaused, dsRemoved,
  dsSurpriseRemoved
}
 

Functions

NTSTATUS FdoPnpControl (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS FdoPowerControl (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS PciCreateDeviceIDString (PUNICODE_STRING DeviceID, PPCI_DEVICE Device)
 
NTSTATUS PciCreateInstanceIDString (PUNICODE_STRING InstanceID, PPCI_DEVICE Device)
 
NTSTATUS PciCreateHardwareIDsString (PUNICODE_STRING HardwareIDs, PPCI_DEVICE Device)
 
NTSTATUS PciCreateCompatibleIDsString (PUNICODE_STRING HardwareIDs, PPCI_DEVICE Device)
 
NTSTATUS PciCreateDeviceDescriptionString (PUNICODE_STRING DeviceDescription, PPCI_DEVICE Device)
 
NTSTATUS PciCreateDeviceLocationString (PUNICODE_STRING DeviceLocation, PPCI_DEVICE Device)
 
NTSTATUS PciDuplicateUnicodeString (IN ULONG Flags, IN PCUNICODE_STRING SourceString, OUT PUNICODE_STRING DestinationString)
 
NTSTATUS PdoPnpControl (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS PdoPowerControl (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS NTAPI DriverEntry (IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
 

Variables

PPCI_DRIVER_EXTENSION DriverExtension
 
BOOLEAN HasDebuggingDevice
 
PCI_TYPE1_CFG_CYCLE_BITS PciDebuggingDevice [2]
 

Macro Definition Documentation

◆ TAG_PCI

#define TAG_PCI   '0ICP'

Definition at line 8 of file pci.h.

Typedef Documentation

◆ COMMON_DEVICE_EXTENSION

◆ FDO_DEVICE_EXTENSION

◆ PCI_DEVICE

◆ PCI_DRIVER_EXTENSION

◆ PCI_TYPE1_CFG_CYCLE_BITS

◆ PCOMMON_DEVICE_EXTENSION

◆ PDO_DEVICE_EXTENSION

◆ PFDO_DEVICE_EXTENSION

◆ PPCI_DEVICE

◆ PPCI_DRIVER_EXTENSION

◆ PPCI_TYPE1_CFG_CYCLE_BITS

◆ PPDO_DEVICE_EXTENSION

Enumeration Type Documentation

◆ PCI_DEVICE_STATE

Enumerator
dsStopped 
dsStarted 
dsPaused 
dsRemoved 
dsSurpriseRemoved 

Definition at line 33 of file pci.h.

34 {
35  dsStopped,
36  dsStarted,
37  dsPaused,
38  dsRemoved,
Definition: pci.h:38
Definition: pci.h:35
PCI_DEVICE_STATE
Definition: pci.h:33
Definition: pci.h:37
Definition: pci.h:36

Function Documentation

◆ DriverEntry()

NTSTATUS NTAPI DriverEntry ( IN PDRIVER_OBJECT  DriverObject,
IN PUNICODE_STRING  RegistryPath 
)

Definition at line 367 of file beep.c.

369 {
370  PDEVICE_EXTENSION DeviceExtension;
372  UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\Beep");
374 
376 
377  /* Create the device */
379  sizeof(DEVICE_EXTENSION),
380  &DeviceName,
382  0,
383  FALSE,
384  &DeviceObject);
385  if (!NT_SUCCESS(Status)) return Status;
386 
387  /* Make it use buffered I/O */
388  DeviceObject->Flags |= DO_BUFFERED_IO;
389 
390  /* Setup the Driver Object */
391  DriverObject->MajorFunction[IRP_MJ_CREATE] = BeepCreate;
392  DriverObject->MajorFunction[IRP_MJ_CLOSE] = BeepClose;
393  DriverObject->MajorFunction[IRP_MJ_CLEANUP] = BeepCleanup;
395  DriverObject->DriverUnload = BeepUnload;
396  DriverObject->DriverStartIo = BeepStartIo;
397 
398  /* Set up device extension */
399  DeviceExtension = DeviceObject->DeviceExtension;
400  DeviceExtension->ReferenceCount = 0;
401  DeviceExtension->TimerActive = FALSE;
403  KeInitializeTimer(&DeviceExtension->Timer);
404  ExInitializeFastMutex(&DeviceExtension->Mutex);
405 
406  /* Page the entire driver */
408  return STATUS_SUCCESS;
409 }
DRIVER_DISPATCH BeepClose
Definition: beep.c:78
FORCEINLINE VOID IoInitializeDpcRequest(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIO_DPC_ROUTINE DpcRoutine)
Definition: iofuncs.h:2840
DRIVER_STARTIO BeepStartIo
Definition: beep.c:295
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:213
#define FILE_DEVICE_BEEP
Definition: winioctl.h:107
DRIVER_DISPATCH BeepDeviceControl
Definition: beep.c:206
NTSTATUS NTAPI DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
Definition: beep.c:367
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define L(x)
Definition: ntvdm.h:50
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3272
#define FALSE
Definition: types.h:117
VOID NTAPI KeInitializeTimer(OUT PKTIMER Timer)
Definition: timerobj.c:233
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
DRIVER_DISPATCH BeepCreate
Definition: beep.c:52
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define DO_BUFFERED_IO
Definition: env_spec_w32.h:394
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
PVOID NTAPI MmPageEntireDriver(IN PVOID AddressWithinSection)
Definition: sysldr.c:3467
IO_DPC_ROUTINE * PIO_DPC_ROUTINE
Definition: iotypes.h:2847
VOID NTAPI BeepDPC(IN PKDPC Dpc, IN PDEVICE_OBJECT DeviceObject, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: beep.c:34
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
DRIVER_DISPATCH BeepCleanup
Definition: beep.c:145
FAST_MUTEX Mutex
Definition: beep.c:24
DRIVER_UNLOAD BeepUnload
Definition: beep.c:268
#define IRP_MJ_CLEANUP
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
#define STATUS_SUCCESS
Definition: shellext.h:65
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

◆ FdoPnpControl()

NTSTATUS FdoPnpControl ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 469 of file fdo.c.

480 {
481  PFDO_DEVICE_EXTENSION DeviceExtension;
483  NTSTATUS Status = Irp->IoStatus.Status;
484 
485  DPRINT("Called\n");
486 
487  DeviceExtension = DeviceObject->DeviceExtension;
488 
490  switch (IrpSp->MinorFunction)
491  {
492 #if 0
495  break;
496 
499  break;
500 
503  break;
504 
507  break;
508 #endif
510  if (IrpSp->Parameters.QueryDeviceRelations.Type != BusRelations)
511  break;
512 
514  Irp->IoStatus.Status = Status;
516  return Status;
517 #if 0
520  break;
521 
524  break;
525 #endif
526  case IRP_MN_START_DEVICE:
527  DPRINT("IRP_MN_START_DEVICE received\n");
529 
530  if (IoForwardIrpSynchronously(DeviceExtension->Ldo, Irp))
531  {
532  Status = Irp->IoStatus.Status;
533  if (NT_SUCCESS(Status))
534  {
536  }
537  }
538 
539  Irp->IoStatus.Status = Status;
541  return Status;
542 
544  /* We don't support stopping yet */
546  Irp->IoStatus.Status = Status;
548  return Status;
549 
550  case IRP_MN_STOP_DEVICE:
551  /* We can't fail this one so we fail the QUERY_STOP request that precedes it */
552  break;
553 #if 0
556  break;
557 #endif
558 
560  break;
561 
563  /* Detach the device object from the device stack */
564  IoDetachDevice(DeviceExtension->Ldo);
565 
566  /* Delete the device object */
568 
569  /* Return success */
571  break;
572 
575  /* Don't print the warning, too much noise */
576  break;
577 
578  default:
579  DPRINT1("Unknown PNP minor function 0x%x\n", IrpSp->MinorFunction);
580  break;
581  }
582 
583  Irp->IoStatus.Status = Status;
585  Status = IoCallDriver(DeviceExtension->Ldo, Irp);
586 
587  DPRINT("Leaving. Status 0x%lx\n", Status);
588 
589  return Status;
590 }
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define IRP_MN_REMOVE_DEVICE
static NTSTATUS FdoStartDevice(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:393
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
BOOLEAN NTAPI IoForwardIrpSynchronously(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1625
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
PDEVICE_OBJECT Ldo
Definition: pci.h:98
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
return STATUS_NOT_IMPLEMENTED
_In_ PIRP Irp
Definition: csq.h:116
#define IRP_MN_QUERY_REMOVE_DEVICE
#define IoCompleteRequest
Definition: irp.c:1240
#define IRP_MN_QUERY_STOP_DEVICE
Status
Definition: gdiplustypes.h:24
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
#define IRP_MN_STOP_DEVICE
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IRP_MN_START_DEVICE
static NTSTATUS FdoQueryBusRelations(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: fdo.c:208
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define DPRINT1
Definition: precomp.h:8
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define IRP_MN_CANCEL_STOP_DEVICE
#define STATUS_SUCCESS
Definition: shellext.h:65
#define IRP_MN_DEVICE_USAGE_NOTIFICATION
#define DPRINT
Definition: sndvol32.h:71
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define IRP_MN_QUERY_CAPABILITIES

Referenced by PciPnpControl().

◆ FdoPowerControl()

NTSTATUS FdoPowerControl ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 594 of file fdo.c.

605 {
606  PFDO_DEVICE_EXTENSION DeviceExtension;
608 
609  DPRINT("Called\n");
610 
611  DeviceExtension = DeviceObject->DeviceExtension;
612 
615  Status = PoCallDriver(DeviceExtension->Ldo, Irp);
616 
617  DPRINT("Leaving. Status 0x%X\n", Status);
618 
619  return Status;
620 }
LONG NTSTATUS
Definition: precomp.h:26
PDEVICE_OBJECT Ldo
Definition: pci.h:98
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIRP Irp
Definition: csq.h:116
Status
Definition: gdiplustypes.h:24
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:746
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define DPRINT
Definition: sndvol32.h:71

Referenced by PciPowerControl().

◆ PciCreateCompatibleIDsString()

NTSTATUS PciCreateCompatibleIDsString ( PUNICODE_STRING  HardwareIDs,
PPCI_DEVICE  Device 
)

Definition at line 366 of file pci.c.

368 {
369  WCHAR Buffer[256];
370  UNICODE_STRING BufferU;
371  ULONG Index;
372 
373  Index = 0;
374  Index += swprintf(&Buffer[Index],
375  L"PCI\\VEN_%04X&DEV_%04X&REV_%02X",
376  Device->PciConfig.VendorID,
377  Device->PciConfig.DeviceID,
378  Device->PciConfig.RevisionID);
379  Index++;
380 
381  Index += swprintf(&Buffer[Index],
382  L"PCI\\VEN_%04X&DEV_%04X",
383  Device->PciConfig.VendorID,
384  Device->PciConfig.DeviceID);
385  Index++;
386 
387  Index += swprintf(&Buffer[Index],
388  L"PCI\\VEN_%04X&CC_%02X%02X%02X",
389  Device->PciConfig.VendorID,
390  Device->PciConfig.BaseClass,
391  Device->PciConfig.SubClass,
392  Device->PciConfig.ProgIf);
393  Index++;
394 
395  Index += swprintf(&Buffer[Index],
396  L"PCI\\VEN_%04X&CC_%02X%02X",
397  Device->PciConfig.VendorID,
398  Device->PciConfig.BaseClass,
399  Device->PciConfig.SubClass);
400  Index++;
401 
402  Index += swprintf(&Buffer[Index],
403  L"PCI\\VEN_%04X",
404  Device->PciConfig.VendorID);
405  Index++;
406 
407  Index += swprintf(&Buffer[Index],
408  L"PCI\\CC_%02X%02X%02X",
409  Device->PciConfig.BaseClass,
410  Device->PciConfig.SubClass,
411  Device->PciConfig.ProgIf);
412  Index++;
413 
414  Index += swprintf(&Buffer[Index],
415  L"PCI\\CC_%02X%02X",
416  Device->PciConfig.BaseClass,
417  Device->PciConfig.SubClass);
418  Index++;
419 
421 
422  BufferU.Length = BufferU.MaximumLength = (USHORT)Index * sizeof(WCHAR);
423  BufferU.Buffer = Buffer;
424 
425  return PciDuplicateUnicodeString(0, &BufferU, CompatibleIDs);
426 }
USHORT MaximumLength
Definition: env_spec_w32.h:370
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
NTSTATUS PciDuplicateUnicodeString(IN ULONG Flags, IN PCUNICODE_STRING SourceString, OUT PUNICODE_STRING DestinationString)
Definition: pci.c:713
#define L(x)
Definition: ntvdm.h:50
#define UNICODE_NULL
Definition: bufpool.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_ WDFCOLLECTION _In_ ULONG Index
int _cdecl swprintf(const WCHAR *,...)
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
unsigned short USHORT
Definition: pedump.c:61
unsigned int ULONG
Definition: retypes.h:1

◆ PciCreateDeviceDescriptionString()

NTSTATUS PciCreateDeviceDescriptionString ( PUNICODE_STRING  DeviceDescription,
PPCI_DEVICE  Device 
)

Definition at line 430 of file pci.c.

432 {
434 
435  switch (Device->PciConfig.BaseClass)
436  {
437  case PCI_CLASS_PRE_20:
438  switch (Device->PciConfig.SubClass)
439  {
441  Description = L"VGA device";
442  break;
443 
444  default:
446  Description = L"PCI device";
447  break;
448  }
449  break;
450 
452  switch (Device->PciConfig.SubClass)
453  {
455  Description = L"SCSI controller";
456  break;
457 
459  Description = L"IDE controller";
460  break;
461 
463  Description = L"Floppy disk controller";
464  break;
465 
467  Description = L"IPI controller";
468  break;
469 
471  Description = L"RAID controller";
472  break;
473 
474  default:
475  Description = L"Mass storage controller";
476  break;
477  }
478  break;
479 
481  switch (Device->PciConfig.SubClass)
482  {
484  Description = L"Ethernet controller";
485  break;
486 
488  Description = L"Token-Ring controller";
489  break;
490 
492  Description = L"FDDI controller";
493  break;
494 
496  Description = L"ATM controller";
497  break;
498 
499  default:
500  Description = L"Network controller";
501  break;
502  }
503  break;
504 
506  switch (Device->PciConfig.SubClass)
507  {
509  Description = L"VGA display controller";
510  break;
511 
513  Description = L"XGA display controller";
514  break;
515 
517  Description = L"Multimedia display controller";
518  break;
519 
520  default:
521  Description = L"Other display controller";
522  break;
523  }
524  break;
525 
527  switch (Device->PciConfig.SubClass)
528  {
530  Description = L"Multimedia video device";
531  break;
532 
534  Description = L"Multimedia audio device";
535  break;
536 
538  Description = L"Multimedia telephony device";
539  break;
540 
541  default:
542  Description = L"Other multimedia device";
543  break;
544  }
545  break;
546 
548  switch (Device->PciConfig.SubClass)
549  {
551  Description = L"PCI Memory";
552  break;
553 
555  Description = L"PCI Flash Memory";
556  break;
557 
558  default:
559  Description = L"Other memory controller";
560  break;
561  }
562  break;
563 
565  switch (Device->PciConfig.SubClass)
566  {
568  Description = L"PCI-Host bridge";
569  break;
570 
571  case PCI_SUBCLASS_BR_ISA:
572  Description = L"PCI-ISA bridge";
573  break;
574 
576  Description = L"PCI-EISA bridge";
577  break;
578 
579  case PCI_SUBCLASS_BR_MCA:
580  Description = L"PCI-Micro Channel bridge";
581  break;
582 
584  Description = L"PCI-PCI bridge";
585  break;
586 
588  Description = L"PCI-PCMCIA bridge";
589  break;
590 
592  Description = L"PCI-NUBUS bridge";
593  break;
594 
596  Description = L"PCI-CARDBUS bridge";
597  break;
598 
599  default:
600  Description = L"Other bridge device";
601  break;
602  }
603  break;
604 
606  switch (Device->PciConfig.SubClass)
607  {
608 
609  default:
610  Description = L"Communication device";
611  break;
612  }
613  break;
614 
616  switch (Device->PciConfig.SubClass)
617  {
618 
619  default:
620  Description = L"System device";
621  break;
622  }
623  break;
624 
625  case PCI_CLASS_INPUT_DEV:
626  switch (Device->PciConfig.SubClass)
627  {
628 
629  default:
630  Description = L"Input device";
631  break;
632  }
633  break;
634 
636  switch (Device->PciConfig.SubClass)
637  {
638 
639  default:
640  Description = L"Docking station";
641  break;
642  }
643  break;
644 
645  case PCI_CLASS_PROCESSOR:
646  switch (Device->PciConfig.SubClass)
647  {
648 
649  default:
650  Description = L"Processor";
651  break;
652  }
653  break;
654 
656  switch (Device->PciConfig.SubClass)
657  {
659  Description = L"FireWire controller";
660  break;
661 
663  Description = L"ACCESS bus controller";
664  break;
665 
666  case PCI_SUBCLASS_SB_SSA:
667  Description = L"SSA controller";
668  break;
669 
670  case PCI_SUBCLASS_SB_USB:
671  Description = L"USB controller";
672  break;
673 
675  Description = L"Fibre Channel controller";
676  break;
677 
679  Description = L"SMBus controller";
680  break;
681 
682  default:
683  Description = L"Other serial bus controller";
684  break;
685  }
686  break;
687 
688  default:
689  Description = L"Other PCI Device";
690  break;
691  }
692 
694 }
#define PCI_SUBCLASS_NET_TOKEN_RING_CTLR
Definition: iotypes.h:4137
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define PCI_SUBCLASS_NET_ETHERNET_CTLR
Definition: iotypes.h:4136
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define PCI_CLASS_SERIAL_BUS_CTLR
Definition: iotypes.h:4115
#define PCI_SUBCLASS_VID_3D_CTLR
Definition: iotypes.h:4146
#define PCI_SUBCLASS_MSC_SCSI_BUS_CTLR
Definition: iotypes.h:4128
#define PCI_SUBCLASS_SB_USB
Definition: iotypes.h:4207
#define PCI_SUBCLASS_MEM_RAM
Definition: iotypes.h:4156
#define PCI_CLASS_MULTIMEDIA_DEV
Definition: iotypes.h:4107
static const WCHAR Description[]
Definition: oid.c:1266
#define PCI_SUBCLASS_MEM_FLASH
Definition: iotypes.h:4157
#define PCI_SUBCLASS_PRE_20_NON_VGA
Definition: iotypes.h:4124
#define PCI_SUBCLASS_MM_TELEPHONY_DEV
Definition: iotypes.h:4152
#define PCI_SUBCLASS_MM_AUDIO_DEV
Definition: iotypes.h:4151
#define PCI_SUBCLASS_SB_FIBRE_CHANNEL
Definition: iotypes.h:4208
#define PCI_SUBCLASS_SB_SMBUS
Definition: iotypes.h:4209
#define PCI_SUBCLASS_BR_CARDBUS
Definition: iotypes.h:4168
#define L(x)
Definition: ntvdm.h:50
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING DeviceDescription
Definition: wdfpdo.h:430
#define PCI_SUBCLASS_NET_ATM_CTLR
Definition: iotypes.h:4139
#define PCI_SUBCLASS_MSC_FLOPPY_CTLR
Definition: iotypes.h:4130
#define PCI_SUBCLASS_MSC_IPI_CTLR
Definition: iotypes.h:4131
#define PCI_SUBCLASS_MSC_RAID_CTLR
Definition: iotypes.h:4132
#define PCI_SUBCLASS_NET_FDDI_CTLR
Definition: iotypes.h:4138
#define PCI_SUBCLASS_VID_VGA_CTLR
Definition: iotypes.h:4144
#define PCI_SUBCLASS_BR_MCA
Definition: iotypes.h:4164
#define PCI_CLASS_DISPLAY_CTLR
Definition: iotypes.h:4106
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define PCI_SUBCLASS_BR_PCMCIA
Definition: iotypes.h:4166
#define PCI_CLASS_MEMORY_CTLR
Definition: iotypes.h:4108
#define PCI_SUBCLASS_BR_PCI_TO_PCI
Definition: iotypes.h:4165
#define PCI_SUBCLASS_MSC_IDE_CTLR
Definition: iotypes.h:4129
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
#define PCI_CLASS_SIMPLE_COMMS_CTLR
Definition: iotypes.h:4110
#define PCI_SUBCLASS_SB_SSA
Definition: iotypes.h:4206
#define PCI_CLASS_NETWORK_CTLR
Definition: iotypes.h:4105
#define PCI_SUBCLASS_MM_VIDEO_DEV
Definition: iotypes.h:4150
#define PCI_SUBCLASS_VID_XGA_CTLR
Definition: iotypes.h:4145
#define PCI_SUBCLASS_SB_IEEE1394
Definition: iotypes.h:4204
#define PCI_CLASS_INPUT_DEV
Definition: iotypes.h:4112
#define PCI_SUBCLASS_BR_NUBUS
Definition: iotypes.h:4167
#define PCI_SUBCLASS_PRE_20_VGA
Definition: iotypes.h:4125
#define PCI_CLASS_DOCKING_STATION
Definition: iotypes.h:4113
#define PCI_SUBCLASS_BR_HOST
Definition: iotypes.h:4161
#define PCI_CLASS_PROCESSOR
Definition: iotypes.h:4114
#define PCI_CLASS_BRIDGE_DEV
Definition: iotypes.h:4109
#define STATUS_SUCCESS
Definition: shellext.h:65
#define PCI_SUBCLASS_BR_ISA
Definition: iotypes.h:4162
#define PCI_SUBCLASS_SB_ACCESS
Definition: iotypes.h:4205
#define PCI_CLASS_BASE_SYSTEM_DEV
Definition: iotypes.h:4111
#define PCI_SUBCLASS_BR_EISA
Definition: iotypes.h:4163
#define PCI_CLASS_MASS_STORAGE_CTLR
Definition: iotypes.h:4104
#define PCI_CLASS_PRE_20
Definition: iotypes.h:4103

Referenced by FdcFdoQueryBusRelations(), and FdoQueryBusRelations().

◆ PciCreateDeviceIDString()

NTSTATUS PciCreateDeviceIDString ( PUNICODE_STRING  DeviceID,
PPCI_DEVICE  Device 
)

Definition at line 284 of file pci.c.

286 {
287  WCHAR Buffer[256];
288 
290  L"PCI\\VEN_%04X&DEV_%04X&SUBSYS_%08X&REV_%02X",
291  Device->PciConfig.VendorID,
292  Device->PciConfig.DeviceID,
293  (Device->PciConfig.u.type0.SubSystemID << 16) +
294  Device->PciConfig.u.type0.SubVendorID,
295  Device->PciConfig.RevisionID);
296 
298 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define L(x)
Definition: ntvdm.h:50
Definition: bufpool.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING DeviceID
Definition: wdfpdo.h:275
int _cdecl swprintf(const WCHAR *,...)
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by FdoQueryBusRelations().

◆ PciCreateDeviceLocationString()

NTSTATUS PciCreateDeviceLocationString ( PUNICODE_STRING  DeviceLocation,
PPCI_DEVICE  Device 
)

Definition at line 698 of file pci.c.

700 {
701  WCHAR Buffer[256];
702 
704  L"PCI-Bus %lu, Device %u, Function %u",
705  Device->BusNumber,
706  Device->SlotNumber.u.bits.DeviceNumber,
707  Device->SlotNumber.u.bits.FunctionNumber);
708 
710 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define L(x)
Definition: ntvdm.h:50
Definition: bufpool.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
int _cdecl swprintf(const WCHAR *,...)
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING _In_ PCUNICODE_STRING DeviceLocation
Definition: wdfpdo.h:430
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by FdcFdoQueryBusRelations(), and FdoQueryBusRelations().

◆ PciCreateHardwareIDsString()

NTSTATUS PciCreateHardwareIDsString ( PUNICODE_STRING  HardwareIDs,
PPCI_DEVICE  Device 
)

Definition at line 314 of file pci.c.

316 {
317  WCHAR Buffer[256];
318  UNICODE_STRING BufferU;
319  ULONG Index;
320 
321  Index = 0;
322  Index += swprintf(&Buffer[Index],
323  L"PCI\\VEN_%04X&DEV_%04X&SUBSYS_%08X&REV_%02X",
324  Device->PciConfig.VendorID,
325  Device->PciConfig.DeviceID,
326  (Device->PciConfig.u.type0.SubSystemID << 16) +
327  Device->PciConfig.u.type0.SubVendorID,
328  Device->PciConfig.RevisionID);
329  Index++;
330 
331  Index += swprintf(&Buffer[Index],
332  L"PCI\\VEN_%04X&DEV_%04X&SUBSYS_%08X",
333  Device->PciConfig.VendorID,
334  Device->PciConfig.DeviceID,
335  (Device->PciConfig.u.type0.SubSystemID << 16) +
336  Device->PciConfig.u.type0.SubVendorID);
337  Index++;
338 
339  Index += swprintf(&Buffer[Index],
340  L"PCI\\VEN_%04X&DEV_%04X&CC_%02X%02X%02X",
341  Device->PciConfig.VendorID,
342  Device->PciConfig.DeviceID,
343  Device->PciConfig.BaseClass,
344  Device->PciConfig.SubClass,
345  Device->PciConfig.ProgIf);
346  Index++;
347 
348  Index += swprintf(&Buffer[Index],
349  L"PCI\\VEN_%04X&DEV_%04X&CC_%02X%02X",
350  Device->PciConfig.VendorID,
351  Device->PciConfig.DeviceID,
352  Device->PciConfig.BaseClass,
353  Device->PciConfig.SubClass);
354  Index++;
355 
357 
358  BufferU.Length = BufferU.MaximumLength = (USHORT) Index * sizeof(WCHAR);
359  BufferU.Buffer = Buffer;
360 
361  return PciDuplicateUnicodeString(0, &BufferU, HardwareIDs);
362 }
USHORT MaximumLength
Definition: env_spec_w32.h:370
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
NTSTATUS PciDuplicateUnicodeString(IN ULONG Flags, IN PCUNICODE_STRING SourceString, OUT PUNICODE_STRING DestinationString)
Definition: pci.c:713
#define L(x)
Definition: ntvdm.h:50
#define UNICODE_NULL
Definition: bufpool.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_ WDFCOLLECTION _In_ ULONG Index
int _cdecl swprintf(const WCHAR *,...)
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
unsigned short USHORT
Definition: pedump.c:61
unsigned int ULONG
Definition: retypes.h:1

◆ PciCreateInstanceIDString()

NTSTATUS PciCreateInstanceIDString ( PUNICODE_STRING  InstanceID,
PPCI_DEVICE  Device 
)

Definition at line 302 of file pci.c.

304 {
305  WCHAR Buffer[3];
306 
307  swprintf(Buffer, L"%02X", Device->SlotNumber.u.AsULONG & 0xff);
308 
310 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define L(x)
Definition: ntvdm.h:50
Definition: bufpool.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING InstanceID
Definition: wdfpdo.h:306
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
int _cdecl swprintf(const WCHAR *,...)
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ PciDuplicateUnicodeString()

NTSTATUS PciDuplicateUnicodeString ( IN ULONG  Flags,
IN PCUNICODE_STRING  SourceString,
OUT PUNICODE_STRING  DestinationString 
)

Definition at line 713 of file pci.c.

717 {
718  if (SourceString == NULL ||
719  DestinationString == NULL ||
723  Flags >= 4)
724  {
726  }
727 
728  if ((SourceString->Length == 0) &&
731  {
735  }
736  else
737  {
738  USHORT DestMaxLength = SourceString->Length;
739 
741  DestMaxLength += sizeof(UNICODE_NULL);
742 
744  if (DestinationString->Buffer == NULL)
745  return STATUS_NO_MEMORY;
746 
749  DestinationString->MaximumLength = DestMaxLength;
750 
753  }
754 
755  return STATUS_SUCCESS;
756 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING
Definition: green.h:16
unsigned short Length
Definition: sprintf.c:451
void * Buffer
Definition: sprintf.c:453
#define UNICODE_NULL
_Out_ _Inout_ POEM_STRING DestinationString
Definition: rtlfuncs.h:1868
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE
Definition: green.h:15
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
_Out_ _Inout_ POEM_STRING _In_ PCUNICODE_STRING SourceString
Definition: rtlfuncs.h:1868
#define TAG_PCI
Definition: pci.h:8
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define NULL
Definition: types.h:112
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_SUCCESS
Definition: shellext.h:65
unsigned short MaximumLength
Definition: sprintf.c:452

Referenced by PciCreateCompatibleIDsString(), PciCreateHardwareIDsString(), PdoQueryDeviceText(), and PdoQueryId().

◆ PdoPnpControl()

NTSTATUS PdoPnpControl ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 1500 of file pdo.c.

1511 {
1513  NTSTATUS Status;
1514 
1515  DPRINT("Called\n");
1516 
1517  Status = Irp->IoStatus.Status;
1518 
1520 
1521  switch (IrpSp->MinorFunction)
1522  {
1524  DPRINT("Unimplemented IRP_MN_DEVICE_USAGE_NOTIFICATION received\n");
1525  break;
1526 
1527  case IRP_MN_EJECT:
1528  DPRINT("Unimplemented IRP_MN_EJECT received\n");
1529  break;
1530 
1533  break;
1534 
1537  break;
1538 
1541  break;
1542 
1544  DPRINT("IRP_MN_QUERY_DEVICE_TEXT received\n");
1546  break;
1547 
1548  case IRP_MN_QUERY_ID:
1549  DPRINT("IRP_MN_QUERY_ID received\n");
1551  break;
1552 
1554  DPRINT("Unimplemented IRP_MN_QUERY_ID received\n");
1555  break;
1556 
1558  DPRINT("IRP_MN_QUERY_RESOURCE_REQUIREMENTS received\n");
1560  break;
1561 
1563  DPRINT("IRP_MN_QUERY_RESOURCES received\n");
1565  break;
1566 
1567  case IRP_MN_SET_LOCK:
1568  DPRINT("Unimplemented IRP_MN_SET_LOCK received\n");
1569  break;
1570 
1571  case IRP_MN_START_DEVICE:
1573  break;
1574 
1577  case IRP_MN_STOP_DEVICE:
1580  case IRP_MN_REMOVE_DEVICE:
1583  break;
1584 
1586  DPRINT("IRP_MN_QUERY_INTERFACE received\n");
1588  break;
1589 
1590  case IRP_MN_READ_CONFIG:
1591  DPRINT("IRP_MN_READ_CONFIG received\n");
1593  break;
1594 
1595  case IRP_MN_WRITE_CONFIG:
1596  DPRINT("IRP_MN_WRITE_CONFIG received\n");
1598  break;
1599 
1601  DPRINT("IRP_MN_FILTER_RESOURCE_REQUIREMENTS received\n");
1602  /* Nothing to do */
1603  Irp->IoStatus.Status = Status;
1604  break;
1605 
1606  default:
1607  DPRINT1("Unknown IOCTL 0x%lx\n", IrpSp->MinorFunction);
1608  break;
1609  }
1610 
1611  if (Status != STATUS_PENDING)
1612  {
1613  Irp->IoStatus.Status = Status;
1615  }
1616 
1617  DPRINT("Leaving. Status 0x%X\n", Status);
1618 
1619  return Status;
1620 }
#define IRP_MN_CANCEL_REMOVE_DEVICE
static NTSTATUS PdoQueryResources(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:700
#define IRP_MN_QUERY_RESOURCES
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_QUERY_ID
static NTSTATUS PdoQueryDeviceRelations(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:1469
static NTSTATUS PdoQueryId(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:74
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS
static NTSTATUS PdoQueryInterface(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:1248
#define IRP_MN_WRITE_CONFIG
LONG NTSTATUS
Definition: precomp.h:26
static NTSTATUS PdoQueryDeviceText(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:30
#define IRP_MN_EJECT
static NTSTATUS PdoQueryBusInformation(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:141
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIRP Irp
Definition: csq.h:116
#define IRP_MN_QUERY_REMOVE_DEVICE
static NTSTATUS PdoQueryCapabilities(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:169
#define IoCompleteRequest
Definition: irp.c:1240
static NTSTATUS PdoWriteConfig(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:1440
#define IRP_MN_READ_CONFIG
#define IRP_MN_QUERY_STOP_DEVICE
Status
Definition: gdiplustypes.h:24
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
#define IRP_MN_STOP_DEVICE
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IRP_MN_START_DEVICE
#define IRP_MN_QUERY_DEVICE_TEXT
#define IRP_MN_QUERY_INTERFACE
#define IRP_MN_QUERY_BUS_INFORMATION
static NTSTATUS PdoReadConfig(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:1411
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define DPRINT1
Definition: precomp.h:8
#define IRP_MN_SET_LOCK
#define IO_NO_INCREMENT
Definition: iotypes.h:598
static NTSTATUS PdoStartDevice(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:1318
#define IRP_MN_CANCEL_STOP_DEVICE
#define STATUS_SUCCESS
Definition: shellext.h:65
#define IRP_MN_DEVICE_USAGE_NOTIFICATION
#define DPRINT
Definition: sndvol32.h:71
static NTSTATUS PdoQueryResourceRequirements(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:375
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define IRP_MN_QUERY_CAPABILITIES

Referenced by PciPnpControl().

◆ PdoPowerControl()

NTSTATUS PdoPowerControl ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 1623 of file pdo.c.

1634 {
1636  NTSTATUS Status = Irp->IoStatus.Status;
1637 
1638  DPRINT("Called\n");
1639 
1641 
1642  switch (IrpSp->MinorFunction)
1643  {
1644  case IRP_MN_QUERY_POWER:
1645  case IRP_MN_SET_POWER:
1647  break;
1648  }
1649 
1651  Irp->IoStatus.Status = Status;
1653 
1654  DPRINT("Leaving. Status 0x%X\n", Status);
1655 
1656  return Status;
1657 }
#define IRP_MN_QUERY_POWER
LONG NTSTATUS
Definition: precomp.h:26
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
Status
Definition: gdiplustypes.h:24
#define IRP_MN_SET_POWER
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:746
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71

Referenced by PciPowerControl().

Variable Documentation

◆ DriverExtension

◆ HasDebuggingDevice

BOOLEAN HasDebuggingDevice

◆ PciDebuggingDevice

PCI_TYPE1_CFG_CYCLE_BITS PciDebuggingDevice[2]

Definition at line 33 of file pci.c.

Referenced by PciIsDebuggingDevice(), and PciLocateKdDevices().