ReactOS  0.4.14-dev-49-gfb4591c
pci.h File Reference
#include <ntifs.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
 

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
 

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
 

Macro Definition Documentation

◆ TAG_PCI

#define TAG_PCI   '0ICP'

Definition at line 6 of file pci.h.

Typedef Documentation

◆ COMMON_DEVICE_EXTENSION

◆ FDO_DEVICE_EXTENSION

◆ PCI_DEVICE

◆ PCI_DRIVER_EXTENSION

◆ PCOMMON_DEVICE_EXTENSION

◆ PDO_DEVICE_EXTENSION

◆ PFDO_DEVICE_EXTENSION

◆ PPCI_DEVICE

◆ PPCI_DRIVER_EXTENSION

◆ PPDO_DEVICE_EXTENSION

Enumeration Type Documentation

◆ PCI_DEVICE_STATE

Enumerator
dsStopped 
dsStarted 
dsPaused 
dsRemoved 
dsSurpriseRemoved 

Definition at line 29 of file pci.h.

30 {
31  dsStopped,
32  dsStarted,
33  dsPaused,
34  dsRemoved,
Definition: pci.h:34
Definition: pci.h:31
PCI_DEVICE_STATE
Definition: pci.h:29
Definition: pci.h:33
Definition: pci.h:32

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 */
389 
390  /* Setup the Driver Object */
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:2792
DRIVER_STARTIO BeepStartIo
Definition: beep.c:295
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
LONG NTSTATUS
Definition: precomp.h:26
WCHAR DeviceName[]
Definition: adapter.cpp:21
#define FILE_DEVICE_BEEP
Definition: winioctl.h:106
DRIVER_DISPATCH BeepDeviceControl
Definition: beep.c:206
NTSTATUS NTAPI DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
Definition: beep.c:367
PVOID DeviceExtension
Definition: env_spec_w32.h:418
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
VOID NTAPI KeInitializeTimer(OUT PKTIMER Timer)
Definition: timerobj.c:233
DRIVER_DISPATCH BeepCreate
Definition: beep.c:52
#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:3370
IO_DPC_ROUTINE * PIO_DPC_ROUTINE
Definition: iotypes.h:2492
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
static const WCHAR L[]
Definition: oid.c:1250
PDRIVER_UNLOAD DriverUnload
Definition: iotypes.h:2180
DRIVER_DISPATCH BeepCleanup
Definition: beep.c:145
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
FAST_MUTEX Mutex
Definition: beep.c:24
DRIVER_UNLOAD BeepUnload
Definition: beep.c:268
#define IRP_MJ_CLEANUP
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]
Definition: iotypes.h:2181
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
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:27
PDRIVER_STARTIO DriverStartIo
Definition: iotypes.h:2179
return STATUS_SUCCESS
Definition: btrfs.c:2966
#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 462 of file fdo.c.

473 {
474  PFDO_DEVICE_EXTENSION DeviceExtension;
476  NTSTATUS Status = Irp->IoStatus.Status;
477 
478  DPRINT("Called\n");
479 
480  DeviceExtension = DeviceObject->DeviceExtension;
481 
483  switch (IrpSp->MinorFunction)
484  {
485 #if 0
488  break;
489 
492  break;
493 
496  break;
497 
500  break;
501 #endif
503  if (IrpSp->Parameters.QueryDeviceRelations.Type != BusRelations)
504  break;
505 
507  Irp->IoStatus.Status = Status;
509  return Status;
510 #if 0
513  break;
514 
517  break;
518 #endif
519  case IRP_MN_START_DEVICE:
520  DPRINT("IRP_MN_START_DEVICE received\n");
522  if (NT_SUCCESS(Status))
524 
525  Irp->IoStatus.Status = Status;
527  return Status;
528 
530  /* We don't support stopping yet */
532  Irp->IoStatus.Status = Status;
534  return Status;
535 
536  case IRP_MN_STOP_DEVICE:
537  /* We can't fail this one so we fail the QUERY_STOP request that precedes it */
538  break;
539 #if 0
542  break;
543 #endif
544 
546  break;
547 
549  /* Detach the device object from the device stack */
550  IoDetachDevice(DeviceExtension->Ldo);
551 
552  /* Delete the device object */
554 
555  /* Return success */
557  break;
558 
561  /* Don't print the warning, too much noise */
562  break;
563 
564  default:
565  DPRINT1("Unknown PNP minor function 0x%x\n", IrpSp->MinorFunction);
566  break;
567  }
568 
569  Irp->IoStatus.Status = Status;
571  Status = IoCallDriver(DeviceExtension->Ldo, Irp);
572 
573  DPRINT("Leaving. Status 0x%lx\n", Status);
574 
575  return Status;
576 }
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define IRP_MN_REMOVE_DEVICE
static NTSTATUS FdoStartDevice(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:386
NTSTATUS NTAPI ForwardIrpAndWait(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:32
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
_In_ PIRP Irp
Definition: csq.h:116
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
PDEVICE_OBJECT Ldo
Definition: pci.h:94
#define IRP_MN_QUERY_REMOVE_DEVICE
PVOID DeviceExtension
Definition: env_spec_w32.h:418
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
#define IRP_MN_QUERY_STOP_DEVICE
#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:201
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
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:566
#define IRP_MN_CANCEL_STOP_DEVICE
#define IRP_MN_DEVICE_USAGE_NOTIFICATION
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
return STATUS_SUCCESS
Definition: btrfs.c:2966
#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 580 of file fdo.c.

591 {
592  PFDO_DEVICE_EXTENSION DeviceExtension;
594 
595  DPRINT("Called\n");
596 
597  DeviceExtension = DeviceObject->DeviceExtension;
598 
601  Status = PoCallDriver(DeviceExtension->Ldo, Irp);
602 
603  DPRINT("Leaving. Status 0x%X\n", Status);
604 
605  return Status;
606 }
NTSTATUS NTAPI PoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp)
Definition: power.c:485
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
PDEVICE_OBJECT Ldo
Definition: pci.h:94
PVOID DeviceExtension
Definition: env_spec_w32.h:418
void DPRINT(...)
Definition: polytest.cpp:61
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:626
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421

Referenced by PciPowerControl().

◆ PciCreateCompatibleIDsString()

NTSTATUS PciCreateCompatibleIDsString ( PUNICODE_STRING  HardwareIDs,
PPCI_DEVICE  Device 
)

Definition at line 323 of file pci.c.

325 {
326  WCHAR Buffer[256];
327  UNICODE_STRING BufferU;
328  ULONG Index;
329 
330  Index = 0;
331  Index += swprintf(&Buffer[Index],
332  L"PCI\\VEN_%04X&DEV_%04X&REV_%02X",
333  Device->PciConfig.VendorID,
334  Device->PciConfig.DeviceID,
335  Device->PciConfig.RevisionID);
336  Index++;
337 
338  Index += swprintf(&Buffer[Index],
339  L"PCI\\VEN_%04X&DEV_%04X",
340  Device->PciConfig.VendorID,
341  Device->PciConfig.DeviceID);
342  Index++;
343 
344  Index += swprintf(&Buffer[Index],
345  L"PCI\\VEN_%04X&CC_%02X%02X%02X",
346  Device->PciConfig.VendorID,
347  Device->PciConfig.BaseClass,
348  Device->PciConfig.SubClass,
349  Device->PciConfig.ProgIf);
350  Index++;
351 
352  Index += swprintf(&Buffer[Index],
353  L"PCI\\VEN_%04X&CC_%02X%02X",
354  Device->PciConfig.VendorID,
355  Device->PciConfig.BaseClass,
356  Device->PciConfig.SubClass);
357  Index++;
358 
359  Index += swprintf(&Buffer[Index],
360  L"PCI\\VEN_%04X",
361  Device->PciConfig.VendorID);
362  Index++;
363 
364  Index += swprintf(&Buffer[Index],
365  L"PCI\\CC_%02X%02X%02X",
366  Device->PciConfig.BaseClass,
367  Device->PciConfig.SubClass,
368  Device->PciConfig.ProgIf);
369  Index++;
370 
371  Index += swprintf(&Buffer[Index],
372  L"PCI\\CC_%02X%02X",
373  Device->PciConfig.BaseClass,
374  Device->PciConfig.SubClass);
375  Index++;
376 
378 
379  BufferU.Length = BufferU.MaximumLength = (USHORT)Index * sizeof(WCHAR);
380  BufferU.Buffer = Buffer;
381 
382  return PciDuplicateUnicodeString(0, &BufferU, CompatibleIDs);
383 }
_In_ PIRP _In_ PDEVICE_OBJECT Device
Definition: fatprocs.h:2020
USHORT MaximumLength
Definition: env_spec_w32.h:370
NTSTATUS PciDuplicateUnicodeString(IN ULONG Flags, IN PCUNICODE_STRING SourceString, OUT PUNICODE_STRING DestinationString)
Definition: pci.c:670
#define UNICODE_NULL
Definition: bufpool.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
static const UCHAR Index[8]
Definition: usbohci.c:18
static const WCHAR L[]
Definition: oid.c:1250
unsigned short USHORT
Definition: pedump.c:61
unsigned int ULONG
Definition: retypes.h:1
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ PciCreateDeviceDescriptionString()

NTSTATUS PciCreateDeviceDescriptionString ( PUNICODE_STRING  DeviceDescription,
PPCI_DEVICE  Device 
)

Definition at line 387 of file pci.c.

389 {
391 
392  switch (Device->PciConfig.BaseClass)
393  {
394  case PCI_CLASS_PRE_20:
395  switch (Device->PciConfig.SubClass)
396  {
398  Description = L"VGA device";
399  break;
400 
401  default:
403  Description = L"PCI device";
404  break;
405  }
406  break;
407 
409  switch (Device->PciConfig.SubClass)
410  {
412  Description = L"SCSI controller";
413  break;
414 
416  Description = L"IDE controller";
417  break;
418 
420  Description = L"Floppy disk controller";
421  break;
422 
424  Description = L"IPI controller";
425  break;
426 
428  Description = L"RAID controller";
429  break;
430 
431  default:
432  Description = L"Mass storage controller";
433  break;
434  }
435  break;
436 
438  switch (Device->PciConfig.SubClass)
439  {
441  Description = L"Ethernet controller";
442  break;
443 
445  Description = L"Token-Ring controller";
446  break;
447 
449  Description = L"FDDI controller";
450  break;
451 
453  Description = L"ATM controller";
454  break;
455 
456  default:
457  Description = L"Network controller";
458  break;
459  }
460  break;
461 
463  switch (Device->PciConfig.SubClass)
464  {
466  Description = L"VGA display controller";
467  break;
468 
470  Description = L"XGA display controller";
471  break;
472 
474  Description = L"Multimedia display controller";
475  break;
476 
477  default:
478  Description = L"Other display controller";
479  break;
480  }
481  break;
482 
484  switch (Device->PciConfig.SubClass)
485  {
487  Description = L"Multimedia video device";
488  break;
489 
491  Description = L"Multimedia audio device";
492  break;
493 
495  Description = L"Multimedia telephony device";
496  break;
497 
498  default:
499  Description = L"Other multimedia device";
500  break;
501  }
502  break;
503 
505  switch (Device->PciConfig.SubClass)
506  {
508  Description = L"PCI Memory";
509  break;
510 
512  Description = L"PCI Flash Memory";
513  break;
514 
515  default:
516  Description = L"Other memory controller";
517  break;
518  }
519  break;
520 
522  switch (Device->PciConfig.SubClass)
523  {
525  Description = L"PCI-Host bridge";
526  break;
527 
528  case PCI_SUBCLASS_BR_ISA:
529  Description = L"PCI-ISA bridge";
530  break;
531 
533  Description = L"PCI-EISA bridge";
534  break;
535 
536  case PCI_SUBCLASS_BR_MCA:
537  Description = L"PCI-Micro Channel bridge";
538  break;
539 
541  Description = L"PCI-PCI bridge";
542  break;
543 
545  Description = L"PCI-PCMCIA bridge";
546  break;
547 
549  Description = L"PCI-NUBUS bridge";
550  break;
551 
553  Description = L"PCI-CARDBUS bridge";
554  break;
555 
556  default:
557  Description = L"Other bridge device";
558  break;
559  }
560  break;
561 
563  switch (Device->PciConfig.SubClass)
564  {
565 
566  default:
567  Description = L"Communication device";
568  break;
569  }
570  break;
571 
573  switch (Device->PciConfig.SubClass)
574  {
575 
576  default:
577  Description = L"System device";
578  break;
579  }
580  break;
581 
582  case PCI_CLASS_INPUT_DEV:
583  switch (Device->PciConfig.SubClass)
584  {
585 
586  default:
587  Description = L"Input device";
588  break;
589  }
590  break;
591 
593  switch (Device->PciConfig.SubClass)
594  {
595 
596  default:
597  Description = L"Docking station";
598  break;
599  }
600  break;
601 
602  case PCI_CLASS_PROCESSOR:
603  switch (Device->PciConfig.SubClass)
604  {
605 
606  default:
607  Description = L"Processor";
608  break;
609  }
610  break;
611 
613  switch (Device->PciConfig.SubClass)
614  {
616  Description = L"FireWire controller";
617  break;
618 
620  Description = L"ACCESS bus controller";
621  break;
622 
623  case PCI_SUBCLASS_SB_SSA:
624  Description = L"SSA controller";
625  break;
626 
627  case PCI_SUBCLASS_SB_USB:
628  Description = L"USB controller";
629  break;
630 
632  Description = L"Fibre Channel controller";
633  break;
634 
636  Description = L"SMBus controller";
637  break;
638 
639  default:
640  Description = L"Other serial bus controller";
641  break;
642  }
643  break;
644 
645  default:
646  Description = L"Other PCI Device";
647  break;
648  }
649 
651 }
#define PCI_SUBCLASS_NET_TOKEN_RING_CTLR
Definition: iotypes.h:3781
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define PCI_SUBCLASS_NET_ETHERNET_CTLR
Definition: iotypes.h:3780
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define PCI_CLASS_SERIAL_BUS_CTLR
Definition: iotypes.h:3759
_In_ PIRP _In_ PDEVICE_OBJECT Device
Definition: fatprocs.h:2020
#define PCI_SUBCLASS_VID_3D_CTLR
Definition: iotypes.h:3790
#define PCI_SUBCLASS_MSC_SCSI_BUS_CTLR
Definition: iotypes.h:3772
#define PCI_SUBCLASS_SB_USB
Definition: iotypes.h:3851
#define PCI_SUBCLASS_MEM_RAM
Definition: iotypes.h:3800
#define PCI_CLASS_MULTIMEDIA_DEV
Definition: iotypes.h:3751
static const WCHAR Description[]
Definition: oid.c:1266
#define PCI_SUBCLASS_MEM_FLASH
Definition: iotypes.h:3801
#define PCI_SUBCLASS_PRE_20_NON_VGA
Definition: iotypes.h:3768
#define PCI_SUBCLASS_MM_TELEPHONY_DEV
Definition: iotypes.h:3796
#define PCI_SUBCLASS_MM_AUDIO_DEV
Definition: iotypes.h:3795
#define PCI_SUBCLASS_SB_FIBRE_CHANNEL
Definition: iotypes.h:3852
#define PCI_SUBCLASS_SB_SMBUS
Definition: iotypes.h:3853
#define PCI_SUBCLASS_BR_CARDBUS
Definition: iotypes.h:3812
#define PCI_SUBCLASS_NET_ATM_CTLR
Definition: iotypes.h:3783
#define PCI_SUBCLASS_MSC_FLOPPY_CTLR
Definition: iotypes.h:3774
#define PCI_SUBCLASS_MSC_IPI_CTLR
Definition: iotypes.h:3775
#define PCI_SUBCLASS_MSC_RAID_CTLR
Definition: iotypes.h:3776
#define PCI_SUBCLASS_NET_FDDI_CTLR
Definition: iotypes.h:3782
#define PCI_SUBCLASS_VID_VGA_CTLR
Definition: iotypes.h:3788
_Must_inspect_result_ _In_ PDEVICE_DESCRIPTION DeviceDescription
Definition: iofuncs.h:1015
#define PCI_SUBCLASS_BR_MCA
Definition: iotypes.h:3808
#define PCI_CLASS_DISPLAY_CTLR
Definition: iotypes.h:3750
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static const WCHAR L[]
Definition: oid.c:1250
#define PCI_SUBCLASS_BR_PCMCIA
Definition: iotypes.h:3810
#define PCI_CLASS_MEMORY_CTLR
Definition: iotypes.h:3752
#define PCI_SUBCLASS_BR_PCI_TO_PCI
Definition: iotypes.h:3809
#define PCI_SUBCLASS_MSC_IDE_CTLR
Definition: iotypes.h:3773
#define PCI_CLASS_SIMPLE_COMMS_CTLR
Definition: iotypes.h:3754
#define PCI_SUBCLASS_SB_SSA
Definition: iotypes.h:3850
#define PCI_CLASS_NETWORK_CTLR
Definition: iotypes.h:3749
#define PCI_SUBCLASS_MM_VIDEO_DEV
Definition: iotypes.h:3794
#define PCI_SUBCLASS_VID_XGA_CTLR
Definition: iotypes.h:3789
#define PCI_SUBCLASS_SB_IEEE1394
Definition: iotypes.h:3848
#define PCI_CLASS_INPUT_DEV
Definition: iotypes.h:3756
#define PCI_SUBCLASS_BR_NUBUS
Definition: iotypes.h:3811
#define PCI_SUBCLASS_PRE_20_VGA
Definition: iotypes.h:3769
#define PCI_CLASS_DOCKING_STATION
Definition: iotypes.h:3757
#define PCI_SUBCLASS_BR_HOST
Definition: iotypes.h:3805
#define PCI_CLASS_PROCESSOR
Definition: iotypes.h:3758
#define PCI_CLASS_BRIDGE_DEV
Definition: iotypes.h:3753
#define PCI_SUBCLASS_BR_ISA
Definition: iotypes.h:3806
#define PCI_SUBCLASS_SB_ACCESS
Definition: iotypes.h:3849
#define PCI_CLASS_BASE_SYSTEM_DEV
Definition: iotypes.h:3755
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define PCI_SUBCLASS_BR_EISA
Definition: iotypes.h:3807
#define PCI_CLASS_MASS_STORAGE_CTLR
Definition: iotypes.h:3748
#define PCI_CLASS_PRE_20
Definition: iotypes.h:3747

Referenced by FdcFdoQueryBusRelations(), and FdoQueryBusRelations().

◆ PciCreateDeviceIDString()

NTSTATUS PciCreateDeviceIDString ( PUNICODE_STRING  DeviceID,
PPCI_DEVICE  Device 
)

Definition at line 241 of file pci.c.

243 {
244  WCHAR Buffer[256];
245 
247  L"PCI\\VEN_%04X&DEV_%04X&SUBSYS_%08X&REV_%02X",
248  Device->PciConfig.VendorID,
249  Device->PciConfig.DeviceID,
250  (Device->PciConfig.u.type0.SubSystemID << 16) +
251  Device->PciConfig.u.type0.SubVendorID,
252  Device->PciConfig.RevisionID);
253 
255 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PIRP _In_ PDEVICE_OBJECT Device
Definition: fatprocs.h:2020
_In_ USHORT DeviceID
Definition: iotypes.h:860
Definition: bufpool.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static const WCHAR L[]
Definition: oid.c:1250
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by FdoQueryBusRelations().

◆ PciCreateDeviceLocationString()

NTSTATUS PciCreateDeviceLocationString ( PUNICODE_STRING  DeviceLocation,
PPCI_DEVICE  Device 
)

Definition at line 655 of file pci.c.

657 {
658  WCHAR Buffer[256];
659 
661  L"PCI-Bus %lu, Device %u, Function %u",
662  Device->BusNumber,
663  Device->SlotNumber.u.bits.DeviceNumber,
664  Device->SlotNumber.u.bits.FunctionNumber);
665 
667 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PIRP _In_ PDEVICE_OBJECT Device
Definition: fatprocs.h:2020
Definition: bufpool.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static const WCHAR L[]
Definition: oid.c:1250
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by FdcFdoQueryBusRelations(), and FdoQueryBusRelations().

◆ PciCreateHardwareIDsString()

NTSTATUS PciCreateHardwareIDsString ( PUNICODE_STRING  HardwareIDs,
PPCI_DEVICE  Device 
)

Definition at line 271 of file pci.c.

273 {
274  WCHAR Buffer[256];
275  UNICODE_STRING BufferU;
276  ULONG Index;
277 
278  Index = 0;
279  Index += swprintf(&Buffer[Index],
280  L"PCI\\VEN_%04X&DEV_%04X&SUBSYS_%08X&REV_%02X",
281  Device->PciConfig.VendorID,
282  Device->PciConfig.DeviceID,
283  (Device->PciConfig.u.type0.SubSystemID << 16) +
284  Device->PciConfig.u.type0.SubVendorID,
285  Device->PciConfig.RevisionID);
286  Index++;
287 
288  Index += swprintf(&Buffer[Index],
289  L"PCI\\VEN_%04X&DEV_%04X&SUBSYS_%08X",
290  Device->PciConfig.VendorID,
291  Device->PciConfig.DeviceID,
292  (Device->PciConfig.u.type0.SubSystemID << 16) +
293  Device->PciConfig.u.type0.SubVendorID);
294  Index++;
295 
296  Index += swprintf(&Buffer[Index],
297  L"PCI\\VEN_%04X&DEV_%04X&CC_%02X%02X%02X",
298  Device->PciConfig.VendorID,
299  Device->PciConfig.DeviceID,
300  Device->PciConfig.BaseClass,
301  Device->PciConfig.SubClass,
302  Device->PciConfig.ProgIf);
303  Index++;
304 
305  Index += swprintf(&Buffer[Index],
306  L"PCI\\VEN_%04X&DEV_%04X&CC_%02X%02X",
307  Device->PciConfig.VendorID,
308  Device->PciConfig.DeviceID,
309  Device->PciConfig.BaseClass,
310  Device->PciConfig.SubClass);
311  Index++;
312 
314 
315  BufferU.Length = BufferU.MaximumLength = (USHORT) Index * sizeof(WCHAR);
316  BufferU.Buffer = Buffer;
317 
318  return PciDuplicateUnicodeString(0, &BufferU, HardwareIDs);
319 }
_In_ PIRP _In_ PDEVICE_OBJECT Device
Definition: fatprocs.h:2020
USHORT MaximumLength
Definition: env_spec_w32.h:370
NTSTATUS PciDuplicateUnicodeString(IN ULONG Flags, IN PCUNICODE_STRING SourceString, OUT PUNICODE_STRING DestinationString)
Definition: pci.c:670
#define UNICODE_NULL
Definition: bufpool.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
static const UCHAR Index[8]
Definition: usbohci.c:18
static const WCHAR L[]
Definition: oid.c:1250
unsigned short USHORT
Definition: pedump.c:61
unsigned int ULONG
Definition: retypes.h:1
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ PciCreateInstanceIDString()

NTSTATUS PciCreateInstanceIDString ( PUNICODE_STRING  InstanceID,
PPCI_DEVICE  Device 
)

Definition at line 259 of file pci.c.

261 {
262  WCHAR Buffer[3];
263 
264  swprintf(Buffer, L"%02X", Device->SlotNumber.u.AsULONG & 0xff);
265 
267 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PIRP _In_ PDEVICE_OBJECT Device
Definition: fatprocs.h:2020
Definition: bufpool.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static const WCHAR L[]
Definition: oid.c:1250
return STATUS_SUCCESS
Definition: btrfs.c:2966

◆ PciDuplicateUnicodeString()

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

Definition at line 670 of file pci.c.

674 {
675  if (SourceString == NULL ||
676  DestinationString == NULL ||
680  Flags >= 4)
681  {
683  }
684 
685  if ((SourceString->Length == 0) &&
688  {
692  }
693  else
694  {
695  USHORT DestMaxLength = SourceString->Length;
696 
698  DestMaxLength += sizeof(UNICODE_NULL);
699 
701  if (DestinationString->Buffer == NULL)
702  return STATUS_NO_MEMORY;
703 
706  DestinationString->MaximumLength = DestMaxLength;
707 
710  }
711 
712  return STATUS_SUCCESS;
713 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#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
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
void * Buffer
Definition: sprintf.c:453
#define UNICODE_NULL
_Out_ _Inout_ POEM_STRING DestinationString
Definition: rtlfuncs.h:1869
smooth NULL
Definition: ftsmooth.c:416
__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:1869
#define TAG_PCI
Definition: pci.h:6
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
return STATUS_SUCCESS
Definition: btrfs.c:2966
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 1499 of file pdo.c.

1510 {
1512  NTSTATUS Status;
1513 
1514  DPRINT("Called\n");
1515 
1516  Status = Irp->IoStatus.Status;
1517 
1519 
1520  switch (IrpSp->MinorFunction)
1521  {
1523  DPRINT("Unimplemented IRP_MN_DEVICE_USAGE_NOTIFICATION received\n");
1524  break;
1525 
1526  case IRP_MN_EJECT:
1527  DPRINT("Unimplemented IRP_MN_EJECT received\n");
1528  break;
1529 
1532  break;
1533 
1536  break;
1537 
1540  break;
1541 
1543  DPRINT("IRP_MN_QUERY_DEVICE_TEXT received\n");
1545  break;
1546 
1547  case IRP_MN_QUERY_ID:
1548  DPRINT("IRP_MN_QUERY_ID received\n");
1550  break;
1551 
1553  DPRINT("Unimplemented IRP_MN_QUERY_ID received\n");
1554  break;
1555 
1557  DPRINT("IRP_MN_QUERY_RESOURCE_REQUIREMENTS received\n");
1559  break;
1560 
1562  DPRINT("IRP_MN_QUERY_RESOURCES received\n");
1564  break;
1565 
1566  case IRP_MN_SET_LOCK:
1567  DPRINT("Unimplemented IRP_MN_SET_LOCK received\n");
1568  break;
1569 
1570  case IRP_MN_START_DEVICE:
1572  break;
1573 
1576  case IRP_MN_STOP_DEVICE:
1581  break;
1582 
1583  case IRP_MN_REMOVE_DEVICE:
1584  {
1586  PFDO_DEVICE_EXTENSION FdoDeviceExtension = DeviceExtension->Fdo->DeviceExtension;
1587  KIRQL OldIrql;
1588 
1589  /* Remove it from the device list */
1590  KeAcquireSpinLock(&FdoDeviceExtension->DeviceListLock, &OldIrql);
1591  RemoveEntryList(&DeviceExtension->PciDevice->ListEntry);
1592  FdoDeviceExtension->DeviceListCount--;
1593  KeReleaseSpinLock(&FdoDeviceExtension->DeviceListLock, OldIrql);
1594 
1595  /* Free the device */
1596  ExFreePoolWithTag(DeviceExtension->PciDevice, TAG_PCI);
1597 
1598  /* Complete the IRP */
1599  Irp->IoStatus.Status = STATUS_SUCCESS;
1601 
1602  /* Delete the DO */
1604  return STATUS_SUCCESS;
1605  }
1606 
1608  DPRINT("IRP_MN_QUERY_INTERFACE received\n");
1610  break;
1611 
1612  case IRP_MN_READ_CONFIG:
1613  DPRINT("IRP_MN_READ_CONFIG received\n");
1615  break;
1616 
1617  case IRP_MN_WRITE_CONFIG:
1618  DPRINT("IRP_MN_WRITE_CONFIG received\n");
1620  break;
1621 
1623  DPRINT("IRP_MN_FILTER_RESOURCE_REQUIREMENTS received\n");
1624  /* Nothing to do */
1625  Irp->IoStatus.Status = Status;
1626  break;
1627 
1628  default:
1629  DPRINT1("Unknown IOCTL 0x%lx\n", IrpSp->MinorFunction);
1630  break;
1631  }
1632 
1633  if (Status != STATUS_PENDING)
1634  {
1635  Irp->IoStatus.Status = Status;
1637  }
1638 
1639  DPRINT("Leaving. Status 0x%X\n", Status);
1640 
1641  return Status;
1642 }
#define IRP_MN_CANCEL_REMOVE_DEVICE
static NTSTATUS PdoQueryResources(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:700
ULONG DeviceListCount
Definition: pci.h:90
#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:1468
_In_ PIRP Irp
Definition: csq.h:116
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
PDEVICE_OBJECT Fdo
Definition: pci.h:57
static NTSTATUS PdoQueryDeviceText(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:30
PPCI_DEVICE PciDevice
Definition: pci.h:59
#define IRP_MN_EJECT
static NTSTATUS PdoQueryBusInformation(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:141
KSPIN_LOCK DeviceListLock
Definition: pci.h:92
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define IRP_MN_QUERY_REMOVE_DEVICE
static NTSTATUS PdoQueryCapabilities(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:169
LIST_ENTRY ListEntry
Definition: pci.h:11
PVOID DeviceExtension
Definition: env_spec_w32.h:418
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
static NTSTATUS PdoWriteConfig(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:1439
#define IRP_MN_READ_CONFIG
#define IRP_MN_QUERY_STOP_DEVICE
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
#define IRP_MN_STOP_DEVICE
#define STATUS_PENDING
Definition: ntstatus.h:82
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define IRP_MN_START_DEVICE
#define IRP_MN_QUERY_DEVICE_TEXT
#define IRP_MN_QUERY_INTERFACE
#define IRP_MN_QUERY_BUS_INFORMATION
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
static NTSTATUS PdoReadConfig(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:1410
#define TAG_PCI
Definition: pci.h:6
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define DPRINT1
Definition: precomp.h:8
#define IRP_MN_SET_LOCK
#define IO_NO_INCREMENT
Definition: iotypes.h:566
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 ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define IRP_MN_DEVICE_USAGE_NOTIFICATION
static NTSTATUS PdoQueryResourceRequirements(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:375
return STATUS_SUCCESS
Definition: btrfs.c:2966
#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 1645 of file pdo.c.

1656 {
1658  NTSTATUS Status = Irp->IoStatus.Status;
1659 
1660  DPRINT("Called\n");
1661 
1663 
1664  switch (IrpSp->MinorFunction)
1665  {
1666  case IRP_MN_QUERY_POWER:
1667  case IRP_MN_SET_POWER:
1669  break;
1670  }
1671 
1673  Irp->IoStatus.Status = Status;
1675 
1676  DPRINT("Leaving. Status 0x%X\n", Status);
1677 
1678  return Status;
1679 }
#define IRP_MN_QUERY_POWER
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
#define IRP_MN_SET_POWER
Status
Definition: gdiplustypes.h:24
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:626
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
#define IO_NO_INCREMENT
Definition: iotypes.h:566
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by PciPowerControl().

Variable Documentation

◆ DriverExtension