ReactOS  0.4.15-dev-1150-g593bcce
pci.h File Reference
#include <ntifs.h>
#include <cmreslist.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 7 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 30 of file pci.h.

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

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 */
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:2836
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
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
#define FALSE
Definition: types.h:117
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
_In_z_ PWSTR RegistryPath
Definition: classp.h:1930
#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:3385
IO_DPC_ROUTINE * PIO_DPC_ROUTINE
Definition: iotypes.h:2826
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
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
PDRIVER_UNLOAD DriverUnload
Definition: iotypes.h:2268
DRIVER_DISPATCH BeepCleanup
Definition: beep.c:145
FAST_MUTEX Mutex
Definition: beep.c:24
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
DRIVER_UNLOAD BeepUnload
Definition: beep.c:268
#define IRP_MJ_CLEANUP
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]
Definition: iotypes.h:2269
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
PDRIVER_STARTIO DriverStartIo
Definition: iotypes.h:2267
return STATUS_SUCCESS
Definition: btrfs.c:3014
#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:239
_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:95
#define IRP_MN_QUERY_REMOVE_DEVICE
#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
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
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:581
#define IRP_MN_CANCEL_STOP_DEVICE
#define IRP_MN_DEVICE_USAGE_NOTIFICATION
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3107
return STATUS_SUCCESS
Definition: btrfs.c:3014
#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 }
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
PDEVICE_OBJECT Ldo
Definition: pci.h:95
void DPRINT(...)
Definition: polytest.cpp:61
Status
Definition: gdiplustypes.h:24
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:737
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
#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:2029
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:4116
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define PCI_SUBCLASS_NET_ETHERNET_CTLR
Definition: iotypes.h:4115
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define PCI_CLASS_SERIAL_BUS_CTLR
Definition: iotypes.h:4094
_In_ PIRP _In_ PDEVICE_OBJECT Device
Definition: fatprocs.h:2029
#define PCI_SUBCLASS_VID_3D_CTLR
Definition: iotypes.h:4125
#define PCI_SUBCLASS_MSC_SCSI_BUS_CTLR
Definition: iotypes.h:4107
#define PCI_SUBCLASS_SB_USB
Definition: iotypes.h:4186
#define PCI_SUBCLASS_MEM_RAM
Definition: iotypes.h:4135
#define PCI_CLASS_MULTIMEDIA_DEV
Definition: iotypes.h:4086
static const WCHAR Description[]
Definition: oid.c:1266
#define PCI_SUBCLASS_MEM_FLASH
Definition: iotypes.h:4136
#define PCI_SUBCLASS_PRE_20_NON_VGA
Definition: iotypes.h:4103
#define PCI_SUBCLASS_MM_TELEPHONY_DEV
Definition: iotypes.h:4131
#define PCI_SUBCLASS_MM_AUDIO_DEV
Definition: iotypes.h:4130
#define PCI_SUBCLASS_SB_FIBRE_CHANNEL
Definition: iotypes.h:4187
#define PCI_SUBCLASS_SB_SMBUS
Definition: iotypes.h:4188
#define PCI_SUBCLASS_BR_CARDBUS
Definition: iotypes.h:4147
#define PCI_SUBCLASS_NET_ATM_CTLR
Definition: iotypes.h:4118
#define PCI_SUBCLASS_MSC_FLOPPY_CTLR
Definition: iotypes.h:4109
#define PCI_SUBCLASS_MSC_IPI_CTLR
Definition: iotypes.h:4110
#define PCI_SUBCLASS_MSC_RAID_CTLR
Definition: iotypes.h:4111
#define PCI_SUBCLASS_NET_FDDI_CTLR
Definition: iotypes.h:4117
#define PCI_SUBCLASS_VID_VGA_CTLR
Definition: iotypes.h:4123
_Must_inspect_result_ _In_ PDEVICE_DESCRIPTION DeviceDescription
Definition: iofuncs.h:1015
#define PCI_SUBCLASS_BR_MCA
Definition: iotypes.h:4143
#define PCI_CLASS_DISPLAY_CTLR
Definition: iotypes.h:4085
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:4145
#define PCI_CLASS_MEMORY_CTLR
Definition: iotypes.h:4087
#define PCI_SUBCLASS_BR_PCI_TO_PCI
Definition: iotypes.h:4144
#define PCI_SUBCLASS_MSC_IDE_CTLR
Definition: iotypes.h:4108
#define PCI_CLASS_SIMPLE_COMMS_CTLR
Definition: iotypes.h:4089
#define PCI_SUBCLASS_SB_SSA
Definition: iotypes.h:4185
#define PCI_CLASS_NETWORK_CTLR
Definition: iotypes.h:4084
#define PCI_SUBCLASS_MM_VIDEO_DEV
Definition: iotypes.h:4129
#define PCI_SUBCLASS_VID_XGA_CTLR
Definition: iotypes.h:4124
#define PCI_SUBCLASS_SB_IEEE1394
Definition: iotypes.h:4183
#define PCI_CLASS_INPUT_DEV
Definition: iotypes.h:4091
#define PCI_SUBCLASS_BR_NUBUS
Definition: iotypes.h:4146
#define PCI_SUBCLASS_PRE_20_VGA
Definition: iotypes.h:4104
#define PCI_CLASS_DOCKING_STATION
Definition: iotypes.h:4092
#define PCI_SUBCLASS_BR_HOST
Definition: iotypes.h:4140
#define PCI_CLASS_PROCESSOR
Definition: iotypes.h:4093
#define PCI_CLASS_BRIDGE_DEV
Definition: iotypes.h:4088
#define PCI_SUBCLASS_BR_ISA
Definition: iotypes.h:4141
#define PCI_SUBCLASS_SB_ACCESS
Definition: iotypes.h:4184
#define PCI_CLASS_BASE_SYSTEM_DEV
Definition: iotypes.h:4090
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define PCI_SUBCLASS_BR_EISA
Definition: iotypes.h:4142
#define PCI_CLASS_MASS_STORAGE_CTLR
Definition: iotypes.h:4083
#define PCI_CLASS_PRE_20
Definition: iotypes.h:4082

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:2029
_In_ USHORT DeviceID
Definition: iotypes.h:875
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:3014

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:2029
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:3014

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:2029
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:2029
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:3014

◆ 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
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:1868
smooth NULL
Definition: ftsmooth.c:416
#define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE
Definition: isapnp.h:82
__wchar_t WCHAR
Definition: xmlstorage.h:180
#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:7
#define RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING
Definition: isapnp.h:83
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
return STATUS_SUCCESS
Definition: btrfs.c:3014
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
_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
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
#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
void DPRINT(...)
Definition: polytest.cpp:61
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
#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
Status
Definition: gdiplustypes.h:24
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:2789
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define DPRINT1
Definition: precomp.h:8
#define IRP_MN_SET_LOCK
#define IO_NO_INCREMENT
Definition: iotypes.h:581
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 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:3014
#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
_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
Status
Definition: gdiplustypes.h:24
#define IRP_MN_SET_POWER
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:737
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define IO_NO_INCREMENT
Definition: iotypes.h:581
return STATUS_SUCCESS
Definition: btrfs.c:3014

Referenced by PciPowerControl().

Variable Documentation

◆ DriverExtension