ReactOS 0.4.15-dev-7788-g1ad9096
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{
PCI_DEVICE_STATE
Definition: pci.h:34
@ dsSurpriseRemoved
Definition: pci.h:39
@ dsStopped
Definition: pci.h:35
@ dsPaused
Definition: pci.h:37
@ dsStarted
Definition: pci.h:36
@ dsRemoved
Definition: pci.h:38

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;
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 */
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}
LONG NTSTATUS
Definition: precomp.h:26
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
DRIVER_STARTIO BeepStartIo
Definition: beep.c:295
VOID NTAPI BeepDPC(IN PKDPC Dpc, IN PDEVICE_OBJECT DeviceObject, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: beep.c:34
DRIVER_DISPATCH BeepClose
Definition: beep.c:78
DRIVER_DISPATCH BeepCleanup
Definition: beep.c:145
DRIVER_UNLOAD BeepUnload
Definition: beep.c:268
DRIVER_DISPATCH BeepCreate
Definition: beep.c:52
DRIVER_DISPATCH BeepDeviceControl
Definition: beep.c:206
DRIVER_INITIALIZE DriverEntry
Definition: condrv.c:21
#define DO_BUFFERED_IO
Definition: env_spec_w32.h:394
Status
Definition: gdiplustypes.h:25
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
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 L(x)
Definition: ntvdm.h:50
#define FILE_DEVICE_BEEP
Definition: winioctl.h:107
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define STATUS_SUCCESS
Definition: shellext.h:65
FAST_MUTEX Mutex
Definition: beep.c:24
PVOID NTAPI MmPageEntireDriver(IN PVOID AddressWithinSection)
Definition: sysldr.c:3554
VOID NTAPI KeInitializeTimer(OUT PKTIMER Timer)
Definition: timerobj.c:233
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3275
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
FORCEINLINE VOID IoInitializeDpcRequest(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIO_DPC_ROUTINE DpcRoutine)
Definition: iofuncs.h:2840
IO_DPC_ROUTINE * PIO_DPC_ROUTINE
Definition: iotypes.h:2847
#define IRP_MJ_CLEANUP

◆ 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
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
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 DPRINT1
Definition: precomp.h:8
static NTSTATUS FdoStartDevice(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:393
static NTSTATUS FdoQueryBusRelations(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: fdo.c:208
_In_ PIRP Irp
Definition: csq.h:116
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
#define IoCompleteRequest
Definition: irp.c:1240
BOOLEAN NTAPI IoForwardIrpSynchronously(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1625
#define IoCallDriver
Definition: irp.c:1225
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
#define DPRINT
Definition: sndvol32.h:71
PDEVICE_OBJECT Ldo
Definition: pci.h:98
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
#define IRP_MN_CANCEL_STOP_DEVICE
@ BusRelations
Definition: iotypes.h:2152
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define IRP_MN_START_DEVICE
#define IRP_MN_DEVICE_USAGE_NOTIFICATION
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IRP_MN_QUERY_STOP_DEVICE
#define IRP_MN_QUERY_CAPABILITIES
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define IRP_MN_STOP_DEVICE
#define IRP_MN_QUERY_REMOVE_DEVICE

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}
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:758

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;
375 L"PCI\\VEN_%04X&DEV_%04X&REV_%02X",
376 Device->PciConfig.VendorID,
377 Device->PciConfig.DeviceID,
378 Device->PciConfig.RevisionID);
379 Index++;
380
382 L"PCI\\VEN_%04X&DEV_%04X",
383 Device->PciConfig.VendorID,
384 Device->PciConfig.DeviceID);
385 Index++;
386
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
396 L"PCI\\VEN_%04X&CC_%02X%02X",
397 Device->PciConfig.VendorID,
398 Device->PciConfig.BaseClass,
399 Device->PciConfig.SubClass);
400 Index++;
401
403 L"PCI\\VEN_%04X",
404 Device->PciConfig.VendorID);
405 Index++;
406
408 L"PCI\\CC_%02X%02X%02X",
409 Device->PciConfig.BaseClass,
410 Device->PciConfig.SubClass,
411 Device->PciConfig.ProgIf);
412 Index++;
413
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}
Definition: bufpool.h:45
#define swprintf
Definition: precomp.h:40
#define UNICODE_NULL
NTSTATUS PciDuplicateUnicodeString(IN ULONG Flags, IN PCUNICODE_STRING SourceString, OUT PUNICODE_STRING DestinationString)
Definition: pci.c:713
unsigned short USHORT
Definition: pedump.c:61
USHORT MaximumLength
Definition: env_spec_w32.h:370
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_In_ WDFCOLLECTION _In_ ULONG Index
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by FdcFdoQueryBusRelations(), and FdoQueryBusRelations().

◆ 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
572 Description = L"PCI-ISA bridge";
573 break;
574
576 Description = L"PCI-EISA bridge";
577 break;
578
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
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
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
667 Description = L"SSA controller";
668 break;
669
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}
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static const WCHAR Description[]
Definition: oid.c:1266
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING DeviceDescription
Definition: wdfpdo.h:432
#define PCI_SUBCLASS_NET_TOKEN_RING_CTLR
Definition: iotypes.h:4137
#define PCI_CLASS_INPUT_DEV
Definition: iotypes.h:4112
#define PCI_SUBCLASS_NET_ATM_CTLR
Definition: iotypes.h:4139
#define PCI_SUBCLASS_SB_IEEE1394
Definition: iotypes.h:4204
#define PCI_SUBCLASS_SB_SMBUS
Definition: iotypes.h:4209
#define PCI_SUBCLASS_NET_ETHERNET_CTLR
Definition: iotypes.h:4136
#define PCI_SUBCLASS_BR_EISA
Definition: iotypes.h:4163
#define PCI_SUBCLASS_MSC_FLOPPY_CTLR
Definition: iotypes.h:4130
#define PCI_SUBCLASS_BR_HOST
Definition: iotypes.h:4161
#define PCI_CLASS_MEMORY_CTLR
Definition: iotypes.h:4108
#define PCI_SUBCLASS_BR_PCI_TO_PCI
Definition: iotypes.h:4165
#define PCI_CLASS_MASS_STORAGE_CTLR
Definition: iotypes.h:4104
#define PCI_SUBCLASS_PRE_20_NON_VGA
Definition: iotypes.h:4124
#define PCI_CLASS_DOCKING_STATION
Definition: iotypes.h:4113
#define PCI_CLASS_SIMPLE_COMMS_CTLR
Definition: iotypes.h:4110
#define PCI_CLASS_PROCESSOR
Definition: iotypes.h:4114
#define PCI_SUBCLASS_MSC_IDE_CTLR
Definition: iotypes.h:4129
#define PCI_SUBCLASS_BR_MCA
Definition: iotypes.h:4164
#define PCI_SUBCLASS_MM_AUDIO_DEV
Definition: iotypes.h:4151
#define PCI_SUBCLASS_SB_USB
Definition: iotypes.h:4207
#define PCI_SUBCLASS_SB_ACCESS
Definition: iotypes.h:4205
#define PCI_SUBCLASS_VID_XGA_CTLR
Definition: iotypes.h:4145
#define PCI_CLASS_MULTIMEDIA_DEV
Definition: iotypes.h:4107
#define PCI_SUBCLASS_BR_ISA
Definition: iotypes.h:4162
#define PCI_CLASS_BRIDGE_DEV
Definition: iotypes.h:4109
#define PCI_SUBCLASS_BR_PCMCIA
Definition: iotypes.h:4166
#define PCI_SUBCLASS_BR_CARDBUS
Definition: iotypes.h:4168
#define PCI_SUBCLASS_VID_3D_CTLR
Definition: iotypes.h:4146
#define PCI_CLASS_PRE_20
Definition: iotypes.h:4103
#define PCI_SUBCLASS_MM_TELEPHONY_DEV
Definition: iotypes.h:4152
#define PCI_SUBCLASS_SB_FIBRE_CHANNEL
Definition: iotypes.h:4208
#define PCI_CLASS_NETWORK_CTLR
Definition: iotypes.h:4105
#define PCI_SUBCLASS_MM_VIDEO_DEV
Definition: iotypes.h:4150
#define PCI_SUBCLASS_NET_FDDI_CTLR
Definition: iotypes.h:4138
#define PCI_CLASS_BASE_SYSTEM_DEV
Definition: iotypes.h:4111
#define PCI_CLASS_SERIAL_BUS_CTLR
Definition: iotypes.h:4115
#define PCI_SUBCLASS_VID_VGA_CTLR
Definition: iotypes.h:4144
#define PCI_SUBCLASS_MSC_RAID_CTLR
Definition: iotypes.h:4132
#define PCI_SUBCLASS_SB_SSA
Definition: iotypes.h:4206
#define PCI_SUBCLASS_MSC_IPI_CTLR
Definition: iotypes.h:4131
#define PCI_SUBCLASS_MEM_FLASH
Definition: iotypes.h:4157
#define PCI_SUBCLASS_PRE_20_VGA
Definition: iotypes.h:4125
#define PCI_SUBCLASS_BR_NUBUS
Definition: iotypes.h:4167
#define PCI_CLASS_DISPLAY_CTLR
Definition: iotypes.h:4106
#define PCI_SUBCLASS_MSC_SCSI_BUS_CTLR
Definition: iotypes.h:4128
#define PCI_SUBCLASS_MEM_RAM
Definition: iotypes.h:4156

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}
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING DeviceID
Definition: wdfpdo.h:278

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}
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING _In_ PCUNICODE_STRING DeviceLocation
Definition: wdfpdo.h:434

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;
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
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
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
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}

Referenced by FdcFdoQueryBusRelations(), and FdoQueryBusRelations().

◆ 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}
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING InstanceID
Definition: wdfpdo.h:309

Referenced by FdcFdoQueryBusRelations(), and FdoQueryBusRelations().

◆ 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 ||
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
745 return STATUS_NO_MEMORY;
746
749 DestinationString->MaximumLength = DestMaxLength;
750
753 }
754
755 return STATUS_SUCCESS;
756}
#define NULL
Definition: types.h:112
#define TAG_PCI
Definition: pci.h:8
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
#define RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING
Definition: green.h:16
#define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE
Definition: green.h:15
_Out_ _Inout_ POEM_STRING _In_ PCUNICODE_STRING SourceString
Definition: rtlfuncs.h:1910
_Out_ _Inout_ POEM_STRING DestinationString
Definition: rtlfuncs.h:1909
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
unsigned short Length
Definition: sprintf.c:451
void * Buffer
Definition: sprintf.c:453
unsigned short MaximumLength
Definition: sprintf.c:452
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

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

◆ PdoPnpControl()

NTSTATUS PdoPnpControl ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 1502 of file pdo.c.

1513{
1516
1517 DPRINT("Called\n");
1518
1519 Status = Irp->IoStatus.Status;
1520
1522
1523 switch (IrpSp->MinorFunction)
1524 {
1526 DPRINT("Unimplemented IRP_MN_DEVICE_USAGE_NOTIFICATION received\n");
1527 break;
1528
1529 case IRP_MN_EJECT:
1530 DPRINT("Unimplemented IRP_MN_EJECT received\n");
1531 break;
1532
1535 break;
1536
1539 break;
1540
1543 break;
1544
1546 DPRINT("IRP_MN_QUERY_DEVICE_TEXT received\n");
1548 break;
1549
1550 case IRP_MN_QUERY_ID:
1551 DPRINT("IRP_MN_QUERY_ID received\n");
1553 break;
1554
1556 DPRINT("Unimplemented IRP_MN_QUERY_ID received\n");
1557 break;
1558
1560 DPRINT("IRP_MN_QUERY_RESOURCE_REQUIREMENTS received\n");
1562 break;
1563
1565 DPRINT("IRP_MN_QUERY_RESOURCES received\n");
1567 break;
1568
1569 case IRP_MN_SET_LOCK:
1570 DPRINT("Unimplemented IRP_MN_SET_LOCK received\n");
1571 break;
1572
1575 break;
1576
1579 case IRP_MN_STOP_DEVICE:
1585 break;
1586
1588 DPRINT("IRP_MN_QUERY_INTERFACE received\n");
1590 break;
1591
1592 case IRP_MN_READ_CONFIG:
1593 DPRINT("IRP_MN_READ_CONFIG received\n");
1595 break;
1596
1598 DPRINT("IRP_MN_WRITE_CONFIG received\n");
1600 break;
1601
1603 DPRINT("IRP_MN_FILTER_RESOURCE_REQUIREMENTS received\n");
1604 /* Nothing to do */
1605 Irp->IoStatus.Status = Status;
1606 break;
1607
1608 default:
1609 DPRINT1("Unknown IOCTL 0x%lx\n", IrpSp->MinorFunction);
1610 break;
1611 }
1612
1613 if (Status != STATUS_PENDING)
1614 {
1615 Irp->IoStatus.Status = Status;
1617 }
1618
1619 DPRINT("Leaving. Status 0x%X\n", Status);
1620
1621 return Status;
1622}
static NTSTATUS PdoReadConfig(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:1413
static NTSTATUS PdoWriteConfig(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:1442
static NTSTATUS PdoQueryResources(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:702
static NTSTATUS PdoQueryCapabilities(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:169
static NTSTATUS PdoQueryBusInformation(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:141
static NTSTATUS PdoQueryResourceRequirements(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:377
static NTSTATUS PdoQueryDeviceText(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:30
static NTSTATUS PdoStartDevice(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:1320
static NTSTATUS PdoQueryDeviceRelations(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:1471
static NTSTATUS PdoQueryInterface(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:1250
static NTSTATUS PdoQueryId(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:74
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IRP_MN_EJECT
#define IRP_MN_QUERY_INTERFACE
#define IRP_MN_READ_CONFIG
#define IRP_MN_WRITE_CONFIG
#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS
#define IRP_MN_QUERY_ID
#define IRP_MN_QUERY_DEVICE_TEXT
#define IRP_MN_QUERY_RESOURCES
#define IRP_MN_SET_LOCK
#define IRP_MN_QUERY_BUS_INFORMATION

Referenced by PciPnpControl().

◆ PdoPowerControl()

NTSTATUS PdoPowerControl ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 1625 of file pdo.c.

1636{
1638 NTSTATUS Status = Irp->IoStatus.Status;
1639
1640 DPRINT("Called\n");
1641
1643
1644 switch (IrpSp->MinorFunction)
1645 {
1646 case IRP_MN_QUERY_POWER:
1647 case IRP_MN_SET_POWER:
1649 break;
1650 }
1651
1653 Irp->IoStatus.Status = Status;
1655
1656 DPRINT("Leaving. Status 0x%X\n", Status);
1657
1658 return Status;
1659}
#define IRP_MN_SET_POWER
#define IRP_MN_QUERY_POWER

Referenced by PciPowerControl().

Variable Documentation

◆ DriverExtension

◆ HasDebuggingDevice

BOOLEAN HasDebuggingDevice
extern

◆ PciDebuggingDevice

PCI_TYPE1_CFG_CYCLE_BITS PciDebuggingDevice[2]
extern

Definition at line 33 of file pci.c.

Referenced by PciIsDebuggingDevice(), and PciLocateKdDevices().