ReactOS 0.4.17-dev-1190-g4c812f4
fdo.c File Reference
#include <pci.h>
#include <debug.h>
Include dependency graph for fdo.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static BOOLEAN NTAPI PciGetRootBusRange (_In_ PCM_RESOURCE_LIST BootConfig, _Out_ PUCHAR FirstBus, _Out_ PUCHAR LastBus)
 Finds the bus number range a root bus decodes in its boot configuration.
 
static VOID NTAPI PciDeleteBusChildren (_Inout_ PPCI_FDO_EXTENSION FdoExtension)
 Deletes the PDOs of a bus being removed. Each one already had its own remove.
 
static VOID NTAPI PciFreeBusSecondaryExtensions (_Inout_ PPCI_FDO_EXTENSION FdoExtension)
 Destroys the arbiter instances a bus being removed still holds.
 
NTSTATUS NTAPI PciFdoIrpStartDevice (IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
 
NTSTATUS NTAPI PciFdoIrpQueryRemoveDevice (IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
 
NTSTATUS NTAPI PciFdoIrpRemoveDevice (IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
 
NTSTATUS NTAPI PciFdoIrpCancelRemoveDevice (IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
 
NTSTATUS NTAPI PciFdoIrpStopDevice (IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
 
NTSTATUS NTAPI PciFdoIrpQueryStopDevice (IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
 
NTSTATUS NTAPI PciFdoIrpCancelStopDevice (IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
 
NTSTATUS NTAPI PciFdoIrpQueryDeviceRelations (IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
 
NTSTATUS NTAPI PciFdoIrpQueryInterface (IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
 
NTSTATUS NTAPI PciFdoIrpQueryCapabilities (IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
 
NTSTATUS NTAPI PciFdoIrpDeviceUsageNotification (IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
 
NTSTATUS NTAPI PciFdoIrpSurpriseRemoval (IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
 
NTSTATUS NTAPI PciFdoIrpQueryLegacyBusInformation (IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
 
VOID NTAPI PciGetHotPlugParameters (IN PPCI_FDO_EXTENSION FdoExtension)
 
VOID NTAPI PciInitializeFdoExtensionCommonFields (PPCI_FDO_EXTENSION FdoExtension, IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
 
NTSTATUS NTAPI PciAddDevice (IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
 

Variables

SINGLE_LIST_ENTRY PciFdoExtensionListHead
 
BOOLEAN PciBreakOnDefault
 
PCI_MN_DISPATCH_TABLE PciFdoDispatchPowerTable []
 
PCI_MN_DISPATCH_TABLE PciFdoDispatchPnpTable []
 
PCI_MJ_DISPATCH_TABLE PciFdoDispatchTable
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file fdo.c.

Function Documentation

◆ PciAddDevice()

NTSTATUS NTAPI PciAddDevice ( IN PDRIVER_OBJECT  DriverObject,
IN PDEVICE_OBJECT  PhysicalDeviceObject 
)

Definition at line 707 of file fdo.c.

709{
711 PDEVICE_OBJECT AttachedTo;
713 PPCI_FDO_EXTENSION ParentExtension;
722 PAGED_CODE();
723 DPRINT1("PCIX - AddDevice (a new bus). PDO: %p (Driver: %wZ)\n",
724 PhysicalDeviceObject, &PhysicalDeviceObject->DriverObject->DriverName);
725
726 /* Zero out variables so failure path knows what to do */
727 AttachedTo = NULL;
731
732 do
733 {
734 /* Check if there's already a device extension for this bus */
737 if (ParentExtension)
738 {
739 /* Make sure we find a real PDO */
742
743 /* Make sure it's a PCI-to-PCI bridge */
744 if ((PdoExtension->BaseClass != PCI_CLASS_BRIDGE_DEV) ||
746 {
747 /* This should never happen */
748 DPRINT1("PCIX - PciAddDevice for Non-Root/Non-PCI-PCI bridge,\n"
749 " Class %02x, SubClass %02x, will not add.\n",
750 PdoExtension->BaseClass,
751 PdoExtension->SubClass);
752 ASSERT((PdoExtension->BaseClass == PCI_CLASS_BRIDGE_DEV) &&
754
755 /* Enter the failure path */
757 break;
758 }
759
760 /* Subordinate bus on the bridge */
761 DPRINT1("PCIX - AddDevice (new bus is child of bus 0x%x).\n",
762 ParentExtension->BaseBus);
763
764 /* Make sure PCI bus numbers are configured */
766 {
767 /* This is a critical failure */
768 DPRINT1("PCIX - Bus numbers not configured for bridge (0x%x.0x%x.0x%x)\n",
769 ParentExtension->BaseBus,
770 PdoExtension->Slot.u.bits.DeviceNumber,
771 PdoExtension->Slot.u.bits.FunctionNumber);
772
773 /* Enter the failure path */
775 break;
776 }
777 }
778
779 /* Create the FDO for the bus */
781 sizeof(PCI_FDO_EXTENSION),
782 NULL,
784 0,
785 0,
786 &DeviceObject);
787 if (!NT_SUCCESS(Status)) break;
788
789 /* Initialize the extension for the FDO */
790 FdoExtension = DeviceObject->DeviceExtension;
794
795 /* Attach to the root PDO */
799 ASSERT(AttachedTo != NULL);
800 if (!AttachedTo) break;
801 FdoExtension->AttachedDeviceObject = AttachedTo;
802
803 /* Check if this is a child bus, or the root */
804 if (ParentExtension)
805 {
806 /* The child inherits root data */
807 FdoExtension->BaseBus = PdoExtension->Dependent.type1.SecondaryBus;
808 FdoExtension->BusRootFdoExtension = ParentExtension->BusRootFdoExtension;
809 PdoExtension->BridgeFdoExtension = FdoExtension;
810 FdoExtension->ParentFdoExtension = ParentExtension;
811 }
812 else
813 {
814 /* Query the boot configuration */
817 (PVOID*)&Descriptor);
818 if (!NT_SUCCESS(Status))
819 {
820 /* No configuration has been set */
822 }
823
824 /* The firmware reports the bus numbers this root decodes in its boot config */
825 if (Descriptor &&
827 &FdoExtension->BaseBus,
828 &FdoExtension->MaxSubordinateBus))
829 {
830 DPRINT1("PCIX - Root bus range 0x%x to 0x%x.\n",
831 FdoExtension->BaseBus,
832 FdoExtension->MaxSubordinateBus);
833 }
834 else
835 {
836 /* Default configuration isn't the normal path on Windows */
838 {
839 /* If a second bus is found and there's still no data, crash */
840 KeBugCheckEx(PCI_BUS_DRIVER_INTERNAL,
841 0xDEAD0010u,
843 0,
844 0);
845 }
846
847 /* Warn that a default configuration will be used, and set bus 0 */
848 DPRINT1("PCIX - Will use default configuration.\n");
850 FdoExtension->BaseBus = 0;
851 FdoExtension->MaxSubordinateBus = 0xFF;
852 }
853
854 if (Descriptor)
856
857 /* This is the root bus */
858 FdoExtension->BusRootFdoExtension = FdoExtension;
859 }
860
861 /* Get the HAL or ACPI Bus Handler Callbacks for Configuration Access */
863 if (!NT_SUCCESS(Status)) break;
864
865 /* Map this bus for extended configuration space access */
867
868 /* Initialize all the supported PCI arbiters */
870 if (!NT_SUCCESS(Status)) break;
871
872 /* This is a real FDO, insert it into the list */
873 FdoExtension->Fake = FALSE;
877
878 /* Open the device registry key so that we can query the errata flags */
882 &KeyHandle),
883
884 /* Open the value that contains errata flags for this bus instance */
885 RtlInitUnicodeString(&ValueName, L"HackFlags");
886 Status = ZwQueryValueKey(KeyHandle,
887 &ValueName,
889 ValueInfo,
890 sizeof(Buffer),
891 &ResultLength);
893 if (NT_SUCCESS(Status))
894 {
895 /* Make sure the data is of expected type and size */
896 if ((ValueInfo->Type == REG_DWORD) &&
897 (ValueInfo->DataLength == sizeof(ULONG)))
898 {
899 /* Read the flags for this bus */
900 FdoExtension->BusHackFlags = *(PULONG)&ValueInfo->Data;
901 }
902 }
903
904 /* Query ACPI for PCI HotPlug Support */
906
907 /* The Bus FDO is now initialized */
908 DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
909 return STATUS_SUCCESS;
910 } while (FALSE);
911
912 /* This is the failure path */
914
915 /* Check if the FDO extension exists */
916 if (FdoExtension) DPRINT1("PCIX - Should destroy secondaries\n");
917
918 /* Delete device objects */
919 if (AttachedTo) IoDetachDevice(AttachedTo);
921 return Status;
922}
#define PAGED_CODE()
NTSTATUS NTAPI PciInitializeArbiters(IN PPCI_FDO_EXTENSION FdoExtension)
Definition: arb_comn.c:242
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
DECLSPEC_NORETURN VOID NTAPI KeBugCheckEx(IN ULONG BugCheckCode, IN ULONG_PTR BugCheckParameter1, IN ULONG_PTR BugCheckParameter2, IN ULONG_PTR BugCheckParameter3, IN ULONG_PTR BugCheckParameter4)
Definition: debug.c:485
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1157
static BOOLEAN NTAPI PciGetRootBusRange(_In_ PCM_RESOURCE_LIST BootConfig, _Out_ PUCHAR FirstBus, _Out_ PUCHAR LastBus)
Finds the bus number range a root bus decodes in its boot configuration.
Definition: fdo.c:82
VOID NTAPI PciInitializeFdoExtensionCommonFields(PPCI_FDO_EXTENSION FdoExtension, IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
Definition: fdo.c:682
BOOLEAN PciBreakOnDefault
Definition: fdo.c:19
SINGLE_LIST_ENTRY PciFdoExtensionListHead
Definition: fdo.c:18
VOID NTAPI PciGetHotPlugParameters(IN PPCI_FDO_EXTENSION FdoExtension)
Definition: fdo.c:593
Definition: bufpool.h:45
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define L(x)
Definition: resources.c:13
KEVENT PciGlobalLock
Definition: init.c:20
VOID NTAPI PciInsertEntryAtTail(IN PSINGLE_LIST_ENTRY ListHead, IN PPCI_FDO_EXTENSION DeviceExtension, IN PKEVENT Lock)
Definition: utils.c:400
BOOLEAN NTAPI PciAreBusNumbersConfigured(IN PPCI_PDO_EXTENSION PdoExtension)
Definition: busno.c:20
VOID NTAPI PciInitializeEcam(_In_ PPCI_FDO_EXTENSION FdoExtension)
Maps the bus an FDO decodes into the ECAM window and verifies the window the first time a bus with de...
Definition: ecam.c:336
PPCI_FDO_EXTENSION NTAPI PciFindParentPciFdoExtension(IN PDEVICE_OBJECT DeviceObject, IN PKEVENT Lock)
Definition: utils.c:340
NTSTATUS NTAPI PciGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, OUT PVOID *OutputBuffer)
Definition: utils.c:475
#define ASSERT_PDO(x)
Definition: pci.h:48
NTSTATUS NTAPI PciGetConfigHandlers(IN PPCI_FDO_EXTENSION FdoExtension)
Definition: config.c:266
@ PdoExtension
Definition: precomp.h:61
@ FdoExtension
Definition: precomp.h:60
Status
Definition: gdiplustypes.h:24
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4715
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
@ KeyValuePartialInformation
Definition: nt_native.h:1185
#define KEY_ALL_ACCESS
Definition: nt_native.h:1044
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
struct _KEY_VALUE_PARTIAL_INFORMATION KEY_VALUE_PARTIAL_INFORMATION
struct _KEY_VALUE_PARTIAL_INFORMATION * PKEY_VALUE_PARTIAL_INFORMATION
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:973
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:1038
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1306
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1261
NTSTATUS NTAPI IoOpenDeviceRegistryKey(IN PDEVICE_OBJECT DeviceObject, IN ULONG DevInstKeyType, IN ACCESS_MASK DesiredAccess, OUT PHANDLE DevInstRegKey)
Definition: pnpmgr.c:1621
#define FILE_DEVICE_BUS_EXTENDER
Definition: winioctl.h:87
#define REG_DWORD
Definition: sdbapi.c:615
#define STATUS_SUCCESS
Definition: shellext.h:65
PVOID DeviceExtension
Definition: env_spec_w32.h:418
BOOLEAN BaseBus
Definition: pci.h:260
struct _PCI_FDO_EXTENSION * BusRootFdoExtension
Definition: pci.h:254
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char UCHAR
Definition: typedefs.h:53
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
_In_ PGUID _In_ ULONG _Out_ PULONG ResultLength
Definition: ucxcontroller.h:83
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:243
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
#define PLUGPLAY_REGKEY_DEVICE
Definition: iofuncs.h:2793
#define PCI_SUBCLASS_BR_PCI_TO_PCI
Definition: iotypes.h:4181
@ DevicePropertyBootConfiguration
Definition: iotypes.h:1198
#define PCI_CLASS_BRIDGE_DEV
Definition: iotypes.h:4124

◆ PciDeleteBusChildren()

static VOID NTAPI PciDeleteBusChildren ( _Inout_ PPCI_FDO_EXTENSION  FdoExtension)
static

Deletes the PDOs of a bus being removed. Each one already had its own remove.

Definition at line 130 of file fdo.c.

132{
133 PPCI_PDO_EXTENSION PdoExtension, NextExtension;
134 PAGED_CODE();
135
138
139 PdoExtension = FdoExtension->ChildPdoList;
140 FdoExtension->ChildPdoList = NULL;
141 FdoExtension->ChildBridgePdoList = NULL;
142
143 KeSetEvent(&FdoExtension->ChildListLock, IO_NO_INCREMENT, FALSE);
145
146 while (PdoExtension)
147 {
149 ASSERT(PdoExtension->DeviceState != PciStarted);
150
151 /* The extension goes away with the device object */
152 NextExtension = PdoExtension->Next;
153
154 if (PdoExtension->Resources)
156
157 IoDeleteDevice(PdoExtension->PhysicalDeviceObject);
158 PdoExtension = NextExtension;
159 }
160}
@ PciStarted
Definition: pci.h:169
#define PCI_POOL_TAG
Definition: pci.h:27
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
#define KernelMode
Definition: asm.h:38
#define IO_NO_INCREMENT
Definition: iotypes.h:598
@ Executive
Definition: ketypes.h:467

Referenced by PciFdoIrpRemoveDevice().

◆ PciFdoIrpCancelRemoveDevice()

NTSTATUS NTAPI PciFdoIrpCancelRemoveDevice ( IN PIRP  Irp,
IN PIO_STACK_LOCATION  IoStackLocation,
IN PPCI_FDO_EXTENSION  DeviceExtension 
)

Definition at line 322 of file fdo.c.

325{
326 PAGED_CODE();
327
330
331 /* The remove is off, so the bus stays where it was */
332 PciCancelStateTransition(DeviceExtension, PciDeleted);
333 return STATUS_SUCCESS;
334}
@ PciDeleted
Definition: pci.h:170
NTSTATUS NTAPI PciCancelStateTransition(IN PPCI_FDO_EXTENSION DeviceExtension, IN PCI_STATE NewState)
Definition: state.c:145
_In_ PIRP Irp
Definition: kse.h:79
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
_In_ PIO_STACK_LOCATION IoStackLocation
Definition: usbdlib.h:292

◆ PciFdoIrpCancelStopDevice()

NTSTATUS NTAPI PciFdoIrpCancelStopDevice ( IN PIRP  Irp,
IN PIO_STACK_LOCATION  IoStackLocation,
IN PPCI_FDO_EXTENSION  DeviceExtension 
)

Definition at line 382 of file fdo.c.

385{
386 PAGED_CODE();
387
390
391 /* The stop is off, so the bus keeps its windows */
392 PciCancelStateTransition(DeviceExtension, PciStopped);
393 return STATUS_SUCCESS;
394}
@ PciStopped
Definition: pci.h:171

◆ PciFdoIrpDeviceUsageNotification()

NTSTATUS NTAPI PciFdoIrpDeviceUsageNotification ( IN PIRP  Irp,
IN PIO_STACK_LOCATION  IoStackLocation,
IN PPCI_FDO_EXTENSION  DeviceExtension 
)

Definition at line 527 of file fdo.c.

530{
531 PAGED_CODE();
532
533 /* A failure from below stands, but a lower driver that ignored it does not count */
534 if (!NT_SUCCESS(Irp->IoStatus.Status) &&
535 (Irp->IoStatus.Status != STATUS_NOT_SUPPORTED))
536 {
537 return Irp->IoStatus.Status;
538 }
539
540 return PciUpdateDeviceUsage(&DeviceExtension->PowerState, IoStackLocation);
541}
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
NTSTATUS NTAPI PciUpdateDeviceUsage(_Inout_ PPCI_POWER_STATE PowerState, _In_ PIO_STACK_LOCATION IoStackLocation)
Counts a paging, hibernation or dump file arriving on or leaving a device.
Definition: usage.c:35

◆ PciFdoIrpQueryCapabilities()

NTSTATUS NTAPI PciFdoIrpQueryCapabilities ( IN PIRP  Irp,
IN PIO_STACK_LOCATION  IoStackLocation,
IN PPCI_FDO_EXTENSION  DeviceExtension 
)

Definition at line 500 of file fdo.c.

503{
505 PAGED_CODE();
506 ASSERT_FDO(DeviceExtension);
507
509
510 /* Get the capabilities */
512
513 /* Inherit wake levels and power mappings from the higher-up capabilities */
514 DeviceExtension->PowerState.SystemWakeLevel = Capabilities->SystemWake;
515 DeviceExtension->PowerState.DeviceWakeLevel = Capabilities->DeviceWake;
516 RtlCopyMemory(DeviceExtension->PowerState.SystemStateMapping,
517 Capabilities->DeviceState,
518 sizeof(DeviceExtension->PowerState.SystemStateMapping));
519
520 /* Dump the capabilities and return success */
522 return STATUS_SUCCESS;
523}
VOID NTAPI PciDebugDumpQueryCapabilities(IN PDEVICE_CAPABILITIES DeviceCaps)
Definition: debug.c:221
#define ASSERT_FDO(x)
Definition: pci.h:47
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
struct _IO_STACK_LOCATION::@5020::@5047 DeviceCapabilities
union _IO_STACK_LOCATION::@1814 Parameters
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
* PDEVICE_CAPABILITIES
Definition: iotypes.h:965

◆ PciFdoIrpQueryDeviceRelations()

NTSTATUS NTAPI PciFdoIrpQueryDeviceRelations ( IN PIRP  Irp,
IN PIO_STACK_LOCATION  IoStackLocation,
IN PPCI_FDO_EXTENSION  DeviceExtension 
)

Definition at line 398 of file fdo.c.

401{
403 PAGED_CODE();
404
405 /* Are bus relations being queried? */
407 {
408 /* The FDO is a bus, so only bus relations can be obtained */
410 }
411 else
412 {
413 /* Scan the PCI bus and build the device relations for the caller */
414 Status = PciQueryDeviceRelations(DeviceExtension,
416 &Irp->IoStatus.Information);
417 }
418
419 /* Return the enumeration status back */
420 return Status;
421}
NTSTATUS NTAPI PciQueryDeviceRelations(IN PPCI_FDO_EXTENSION DeviceExtension, IN OUT PDEVICE_RELATIONS *pDeviceRelations)
Definition: enum.c:2366
struct _IO_STACK_LOCATION::@5020::@5045 QueryDeviceRelations
@ BusRelations
Definition: iotypes.h:2154

◆ PciFdoIrpQueryInterface()

NTSTATUS NTAPI PciFdoIrpQueryInterface ( IN PIRP  Irp,
IN PIO_STACK_LOCATION  IoStackLocation,
IN PPCI_FDO_EXTENSION  DeviceExtension 
)

Definition at line 425 of file fdo.c.

428{
430 PAGED_CODE();
431 ASSERT(DeviceExtension->ExtensionType == PciFdoExtensionType);
432
433 /* Deleted extensions don't respond to IRPs */
434 if (DeviceExtension->DeviceState == PciDeleted)
435 {
436 /* Hand it back to try to deal with it */
437 return PciPassIrpFromFdoToPdo(DeviceExtension, Irp);
438 }
439
440 /* Query our driver for this interface */
441 Status = PciQueryInterface(DeviceExtension,
445 Size,
447 Version,
451 Interface,
452 FALSE);
453 if (NT_SUCCESS(Status))
454 {
455 /* We found it, let the PDO handle it */
456 Irp->IoStatus.Status = Status;
457 return PciPassIrpFromFdoToPdo(DeviceExtension, Irp);
458 }
459 else if (Status == STATUS_NOT_SUPPORTED)
460 {
461 /* Otherwise, we can't handle it, let someone else down the stack try */
462 Status = PciCallDownIrpStack(DeviceExtension, Irp);
464 {
465 /* They can't either, try a last-resort interface lookup */
466 Status = PciQueryInterface(DeviceExtension,
470 Size,
472 Version,
476 Interface,
477 TRUE);
478 }
479 }
480
481 /* Has anyone claimed this interface yet? */
483 {
484 /* No, return the original IRP status */
485 Status = Irp->IoStatus.Status;
486 }
487 else
488 {
489 /* Yes, set the new IRP status */
490 Irp->IoStatus.Status = Status;
491 }
492
493 /* Complete this IRP */
495 return Status;
496}
NTSTATUS NTAPI PciCallDownIrpStack(IN PPCI_FDO_EXTENSION DeviceExtension, IN PIRP Irp)
Definition: dispatch.c:39
NTSTATUS NTAPI PciPassIrpFromFdoToPdo(IN PPCI_FDO_EXTENSION DeviceExtension, IN PIRP Irp)
Definition: dispatch.c:70
@ PciFdoExtensionType
Definition: pci.h:134
NTSTATUS NTAPI PciQueryInterface(IN PPCI_FDO_EXTENSION DeviceExtension, IN CONST GUID *InterfaceType, IN ULONG Size, IN ULONG Version, IN PVOID InterfaceData, IN PINTERFACE Interface, IN BOOLEAN LastChance)
Definition: intrface.c:45
#define IoCompleteRequest
Definition: irp.c:1272
struct _IO_STACK_LOCATION::@5020::@5046 QueryInterface
_In_ UCXUSBDEVICE _In_ ULONG Interface
Definition: ucxusbdevice.h:428
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID InterfaceType
Definition: wdffdo.h:463
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
Definition: wdffdo.h:469
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT _In_opt_ PVOID InterfaceSpecificData
Definition: wdffdo.h:472

◆ PciFdoIrpQueryLegacyBusInformation()

NTSTATUS NTAPI PciFdoIrpQueryLegacyBusInformation ( IN PIRP  Irp,
IN PIO_STACK_LOCATION  IoStackLocation,
IN PPCI_FDO_EXTENSION  DeviceExtension 
)

Definition at line 567 of file fdo.c.

570{
572 PAGED_CODE();
573
575
576 /* The PnP manager frees this once it has recorded the bus */
578 sizeof(*BusInformation),
580 if (!BusInformation)
582
583 BusInformation->BusTypeGuid = GUID_BUS_TYPE_PCI;
584 BusInformation->LegacyBusType = PCIBus;
585 BusInformation->BusNumber = DeviceExtension->BaseBus;
586
587 Irp->IoStatus.Information = (ULONG_PTR)BusInformation;
588 return STATUS_SUCCESS;
589}
#define ULONG_PTR
Definition: config.h:101
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
@ PCIBus
Definition: restypes.h:127
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ WDFDEVICE _In_ PPNP_BUS_INFORMATION BusInformation
Definition: wdfdevice.h:3921

◆ PciFdoIrpQueryRemoveDevice()

NTSTATUS NTAPI PciFdoIrpQueryRemoveDevice ( IN PIRP  Irp,
IN PIO_STACK_LOCATION  IoStackLocation,
IN PPCI_FDO_EXTENSION  DeviceExtension 
)

Definition at line 236 of file fdo.c.

239{
240 PAGED_CODE();
241
244
245 /* Paging, hibernation and dump files behind this bus cannot lose their path */
246 if (DeviceExtension->PowerState.Paging ||
247 DeviceExtension->PowerState.Hibernate ||
248 DeviceExtension->PowerState.CrashDump)
249 {
250 return STATUS_DEVICE_BUSY;
251 }
252
253 /* The remove that follows commits this */
254 return PciBeginStateTransition(DeviceExtension, PciDeleted);
255}
NTSTATUS NTAPI PciBeginStateTransition(IN PPCI_FDO_EXTENSION DeviceExtension, IN PCI_STATE NewState)
Definition: state.c:97
#define STATUS_DEVICE_BUSY
Definition: udferr_usr.h:129

◆ PciFdoIrpQueryStopDevice()

NTSTATUS NTAPI PciFdoIrpQueryStopDevice ( IN PIRP  Irp,
IN PIO_STACK_LOCATION  IoStackLocation,
IN PPCI_FDO_EXTENSION  DeviceExtension 
)

Definition at line 356 of file fdo.c.

359{
360 PAGED_CODE();
361
364
365 /* Paging, hibernation and dump files behind this bus cannot lose their path */
366 if (DeviceExtension->PowerState.Paging ||
367 DeviceExtension->PowerState.Hibernate ||
368 DeviceExtension->PowerState.CrashDump)
369 {
370 return STATUS_DEVICE_BUSY;
371 }
372
373 /* Root bus ranges are fixed, and children would sit outside new bridge windows */
374 if (PCI_IS_ROOT_FDO(DeviceExtension) || DeviceExtension->ChildPdoList)
375 return STATUS_UNSUCCESSFUL;
376
377 return PciBeginStateTransition(DeviceExtension, PciStopped);
378}
#define PCI_IS_ROOT_FDO(x)
Definition: pci.h:42
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132

◆ PciFdoIrpRemoveDevice()

NTSTATUS NTAPI PciFdoIrpRemoveDevice ( IN PIRP  Irp,
IN PIO_STACK_LOCATION  IoStackLocation,
IN PPCI_FDO_EXTENSION  DeviceExtension 
)

Definition at line 259 of file fdo.c.

262{
264 PPCI_PDO_EXTENSION BridgeExtension;
267 PAGED_CODE();
268
270
271 /* A remove with no query before it, such as after a failed start, begins the deletion here */
272 if (DeviceExtension->TentativeNextState != PciDeleted)
273 PciBeginStateTransition(DeviceExtension, PciDeleted);
274
275 PciCommitStateTransition(DeviceExtension, PciDeleted);
276
277 /* Unlink the bus first so no lookup can reach it while it comes apart */
280
281 for (Entry = &PciFdoExtensionListHead; Entry->Next; Entry = Entry->Next)
282 {
283 if (Entry->Next == &DeviceExtension->List)
284 {
285 Entry->Next = DeviceExtension->List.Next;
286 break;
287 }
288 }
289
290 if (!PCI_IS_ROOT_FDO(DeviceExtension))
291 {
292 BridgeExtension = DeviceExtension->PhysicalDeviceObject->DeviceExtension;
293 ASSERT_PDO(BridgeExtension);
294
295 if (BridgeExtension->BridgeFdoExtension == DeviceExtension)
296 BridgeExtension->BridgeFdoExtension = NULL;
297 }
298
301
302 PciDeleteBusChildren(DeviceExtension);
303 PciFreeBusSecondaryExtensions(DeviceExtension);
304
305 if (DeviceExtension->PreservedConfig)
306 ExFreePoolWithTag(DeviceExtension->PreservedConfig, TAG_PCI_PRESERVED);
307
308 /* The lower drivers see the remove before this device leaves the stack */
309 DeviceObject = DeviceExtension->FunctionalDeviceObject;
310 AttachedDeviceObject = DeviceExtension->AttachedDeviceObject;
311
312 Irp->IoStatus.Status = STATUS_SUCCESS;
313 Status = PciPassIrpFromFdoToPdo(DeviceExtension, Irp);
314
317 return Status;
318}
static VOID NTAPI PciFreeBusSecondaryExtensions(_Inout_ PPCI_FDO_EXTENSION FdoExtension)
Destroys the arbiter instances a bus being removed still holds.
Definition: fdo.c:168
static VOID NTAPI PciDeleteBusChildren(_Inout_ PPCI_FDO_EXTENSION FdoExtension)
Deletes the PDOs of a bus being removed. Each one already had its own remove.
Definition: fdo.c:130
#define TAG_PCI_PRESERVED
Definition: pci.h:37
VOID NTAPI PciCommitStateTransition(IN PPCI_FDO_EXTENSION DeviceExtension, IN PCI_STATE NewState)
Definition: state.c:181
Entry
Definition: section.c:5216
PCI_FDO_EXTENSION * BridgeFdoExtension
Definition: pci.h:372
PDEVICE_OBJECT PhysicalDeviceObject
Definition: pci.h:333
Definition: ntbasedef.h:640
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT AttachedDeviceObject
Definition: wdfminiport.h:70

◆ PciFdoIrpStartDevice()

NTSTATUS NTAPI PciFdoIrpStartDevice ( IN PIRP  Irp,
IN PIO_STACK_LOCATION  IoStackLocation,
IN PPCI_FDO_EXTENSION  DeviceExtension 
)

Definition at line 202 of file fdo.c.

205{
208 PAGED_CODE();
209
210 /* The device stack must be starting the FDO in a success path */
211 if (!NT_SUCCESS(Irp->IoStatus.Status)) return STATUS_NOT_SUPPORTED;
212
213 /* Attempt to switch the state machine to the started state */
214 Status = PciBeginStateTransition(DeviceExtension, PciStarted);
215 if (!NT_SUCCESS(Status)) return Status;
216
217 /* Only a root bus seeds its arbiters from these, a bus behind a bridge uses its windows */
218 Resources = IoStackLocation->Parameters.StartDevice.AllocatedResources;
219
220 /* Initialize the arbiter for this FDO */
221 Status = PciInitializeArbiterRanges(DeviceExtension, Resources);
222 if (!NT_SUCCESS(Status))
223 {
224 /* Cancel the transition if this failed */
225 PciCancelStateTransition(DeviceExtension, PciStarted);
226 return Status;
227 }
228
229 /* Commit the transition to the started state */
230 PciCommitStateTransition(DeviceExtension, PciStarted);
231 return STATUS_SUCCESS;
232}
NTSTATUS NTAPI PciInitializeArbiterRanges(IN PPCI_FDO_EXTENSION DeviceExtension, IN PCM_RESOURCE_LIST Resources)
Definition: arb_comn.c:447
struct _IO_STACK_LOCATION::@5020::@5057 StartDevice

◆ PciFdoIrpStopDevice()

NTSTATUS NTAPI PciFdoIrpStopDevice ( IN PIRP  Irp,
IN PIO_STACK_LOCATION  IoStackLocation,
IN PPCI_FDO_EXTENSION  DeviceExtension 
)

Definition at line 338 of file fdo.c.

341{
342 PAGED_CODE();
343
346
347 PciCommitStateTransition(DeviceExtension, PciStopped);
348
349 /* The next start seeds the arbiters again from the windows it is given */
350 DeviceExtension->ArbitersInitialized = FALSE;
351 return STATUS_SUCCESS;
352}

◆ PciFdoIrpSurpriseRemoval()

NTSTATUS NTAPI PciFdoIrpSurpriseRemoval ( IN PIRP  Irp,
IN PIO_STACK_LOCATION  IoStackLocation,
IN PPCI_FDO_EXTENSION  DeviceExtension 
)

Definition at line 545 of file fdo.c.

548{
549 PAGED_CODE();
550
553
554 /* Only the remove that follows is left, and it commits the deletion */
556 {
558 PciBeginStateTransition(DeviceExtension, PciDeleted);
559 }
560
561 /* Failing this would keep it from reaching the PDO below */
562 return STATUS_SUCCESS;
563}
@ PciSurpriseRemoved
Definition: pci.h:172

◆ PciFreeBusSecondaryExtensions()

static VOID NTAPI PciFreeBusSecondaryExtensions ( _Inout_ PPCI_FDO_EXTENSION  FdoExtension)
static

Destroys the arbiter instances a bus being removed still holds.

Definition at line 168 of file fdo.c.

170{
171 VOID (NTAPI *Destructor)(_In_ PVOID Extension);
174 PAGED_CODE();
175
178
179 Entry = FdoExtension->SecondaryExtension.Next;
180 FdoExtension->SecondaryExtension.Next = NULL;
181 FdoExtension->ArbitersInitialized = FALSE;
182
183 KeSetEvent(&FdoExtension->SecondaryExtLock, IO_NO_INCREMENT, FALSE);
185
186 while (Entry)
187 {
189 Entry = Entry->Next;
190
191 /* The destructor frees the range lists, the instance itself is freed here */
192 Destructor = Extension->Destructor;
193 if (Destructor)
194 Destructor(Extension);
195
197 }
198}
#define VOID
Definition: acefi.h:82
_Inout_opt_ PUNICODE_STRING Extension
Definition: fltkernel.h:1092
#define _In_
Definition: no_sal2.h:158
#define NTAPI
Definition: typedefs.h:36
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550

Referenced by PciFdoIrpRemoveDevice().

◆ PciGetHotPlugParameters()

VOID NTAPI PciGetHotPlugParameters ( IN PPCI_FDO_EXTENSION  FdoExtension)

Definition at line 593 of file fdo.c.

594{
598 ULONG Length, i;
600 PAGED_CODE();
601
602 /* We should receive 4 parameters, per the HPP specification */
604
605 /* Allocate the buffer to hold the parameters */
607 if (!OutputBuffer) return;
608
609 /* Initialize the output and input buffers. The method is _HPP */
611 *(PULONG)InputBuffer.MethodName = 'PPH_';
613 do
614 {
615 /* Send the IOCTL to the ACPI driver */
616 Status = PciSendIoctl(FdoExtension->PhysicalDeviceObject,
619 sizeof(InputBuffer),
621 Length);
622 if (!NT_SUCCESS(Status))
623 {
624 /* The method failed, check if we can salvage data from parent */
626 {
627 /* Copy the root bus' hot plug parameters */
628 FdoExtension->HotPlugParameters = FdoExtension->ParentFdoExtension->HotPlugParameters;
629 }
630
631 /* Nothing more to do on this path */
632 break;
633 }
634
635 /* ACPI sent back some data. 4 parameters are expected in the output */
636 if (OutputBuffer->Count != 4) break;
637
638 /* Every one of them has to be an integer for the set to mean anything */
639 Argument = OutputBuffer->Argument;
640 for (i = 0; i < 4; i++)
641 {
643 break;
644 }
645 if (i != 4)
646 {
647 DPRINT1("PCIX - _HPP returned something other than four integers\n");
648 break;
649 }
650
651 /* Cache line size and latency timer are byte registers, SERR and PERR are flags */
652 if ((Argument[0].Argument > MAXUCHAR) ||
653 (Argument[1].Argument > MAXUCHAR) ||
654 (Argument[2].Argument > 1) ||
655 (Argument[3].Argument > 1))
656 {
657 DPRINT1("PCIX - _HPP returned values out of range, ignoring them\n");
658 break;
659 }
660
661 /* Settings for devices that later appear in a hot plug slot on this bus */
662 FdoExtension->HotPlugParameters.CacheLineSize = (UCHAR)Argument[0].Argument;
663 FdoExtension->HotPlugParameters.LatencyTimer = (UCHAR)Argument[1].Argument;
664 FdoExtension->HotPlugParameters.EnableSERR = (BOOLEAN)Argument[2].Argument;
665 FdoExtension->HotPlugParameters.EnablePERR = (BOOLEAN)Argument[3].Argument;
666 FdoExtension->HotPlugParameters.Acquired = TRUE;
667
668 DPRINT1("PCIX - _HPP for FDO ext 0x%p: cache line %u, latency %u, SERR %u, PERR %u\n",
670 FdoExtension->HotPlugParameters.CacheLineSize,
671 FdoExtension->HotPlugParameters.LatencyTimer,
672 FdoExtension->HotPlugParameters.EnableSERR,
673 FdoExtension->HotPlugParameters.EnablePERR);
674 } while (FALSE);
675
676 /* Free the buffer and return */
678}
Type
Definition: Type.h:7
ACPI_METHOD_ARGUMENT UNALIGNED * PACPI_METHOD_ARGUMENT
Definition: acpiioct.h:80
struct _ACPI_EVAL_OUTPUT_BUFFER ACPI_EVAL_OUTPUT_BUFFER
#define ACPI_METHOD_ARGUMENT_INTEGER
Definition: acpiioct.h:30
#define ACPI_EVAL_INPUT_BUFFER_SIGNATURE
Definition: acpiioct.h:12
#define IOCTL_ACPI_EVAL_METHOD
Definition: acpiioct.h:194
ACPI_EVAL_OUTPUT_BUFFER UNALIGNED * PACPI_EVAL_OUTPUT_BUFFER
Definition: acpiioct.h:99
_Check_return_ _In_ DXGK_EVENT_TYPE _In_ ULONG _In_ PVOID Argument
Definition: dispmprt.h:1288
NTSTATUS NTAPI PciSendIoctl(IN PDEVICE_OBJECT DeviceObject, IN ULONG IoControlCode, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength)
Definition: utils.c:531
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define BOOLEAN
Definition: pedump.c:73
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define MAXUCHAR
Definition: umtypes.h:117
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:863
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:953

Referenced by PciAddDevice().

◆ PciGetRootBusRange()

static BOOLEAN NTAPI PciGetRootBusRange ( _In_ PCM_RESOURCE_LIST  BootConfig,
_Out_ PUCHAR  FirstBus,
_Out_ PUCHAR  LastBus 
)
static

Finds the bus number range a root bus decodes in its boot configuration.

Returns
TRUE if the list has a bus number descriptor, FALSE otherwise.

Definition at line 82 of file fdo.c.

86{
87 PCM_FULL_RESOURCE_DESCRIPTOR FullDescriptor;
89 ULONG FullIndex, PartialIndex;
90 ULONG EndBus;
91 PAGED_CODE();
92
93 FullDescriptor = BootConfig->List;
94 for (FullIndex = 0; FullIndex < BootConfig->Count; FullIndex++)
95 {
96 Partial = FullDescriptor->PartialResourceList.PartialDescriptors;
97 for (PartialIndex = 0;
98 PartialIndex < FullDescriptor->PartialResourceList.Count;
99 PartialIndex++)
100 {
101 if (Partial->Type != CmResourceTypeBusNumber)
102 {
103 Partial = CmiGetNextPartialDescriptor(Partial);
104 continue;
105 }
106
107 /* Bus numbers on a single segment never go past 0xFF */
108 EndBus = Partial->u.BusNumber.Start + Partial->u.BusNumber.Length - 1;
109 ASSERT(Partial->u.BusNumber.Start <= EndBus);
110 ASSERT(EndBus <= 0xFF);
111
112 *FirstBus = (UCHAR)Partial->u.BusNumber.Start;
113 *LastBus = (UCHAR)EndBus;
114 return TRUE;
115 }
116
117 /* The next full descriptor follows the last partial one */
118 FullDescriptor = (PCM_FULL_RESOURCE_DESCRIPTOR)Partial;
119 }
120
121 return FALSE;
122}
FORCEINLINE PCM_PARTIAL_RESOURCE_DESCRIPTOR CmiGetNextPartialDescriptor(_In_ const CM_PARTIAL_RESOURCE_DESCRIPTOR *PartialDescriptor)
Definition: cmreslist.h:31
struct _CM_FULL_RESOURCE_DESCRIPTOR * PCM_FULL_RESOURCE_DESCRIPTOR
#define CmResourceTypeBusNumber
Definition: restypes.h:109
CM_PARTIAL_RESOURCE_LIST PartialResourceList
Definition: restypes.h:145
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@494::@502 BusNumber
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@494 u
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: restypes.h:100

Referenced by PciAddDevice().

◆ PciInitializeFdoExtensionCommonFields()

VOID NTAPI PciInitializeFdoExtensionCommonFields ( PPCI_FDO_EXTENSION  FdoExtension,
IN PDEVICE_OBJECT  DeviceObject,
IN PDEVICE_OBJECT  PhysicalDeviceObject 
)

Definition at line 682 of file fdo.c.

685{
686 /* Initialize the extension */
688
689 /* Setup the common fields */
690 FdoExtension->PhysicalDeviceObject = PhysicalDeviceObject;
691 FdoExtension->FunctionalDeviceObject = DeviceObject;
692 FdoExtension->ExtensionType = PciFdoExtensionType;
693 FdoExtension->PowerState.CurrentSystemState = PowerSystemWorking;
694 FdoExtension->PowerState.CurrentDeviceState = PowerDeviceD0;
695 FdoExtension->IrpDispatchTable = &PciFdoDispatchTable;
696
697 /* Initialize the extension locks */
700
701 /* Initialize the default state */
703}
PCI_MJ_DISPATCH_TABLE PciFdoDispatchTable
Definition: fdo.c:60
VOID NTAPI PciInitializeState(IN PPCI_FDO_EXTENSION DeviceExtension)
Definition: state.c:88
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
@ SynchronizationEvent
@ PowerSystemWorking
Definition: ntpoapi.h:36
@ PowerDeviceD0
Definition: ntpoapi.h:49

Referenced by PciAddDevice().

Variable Documentation

◆ PciBreakOnDefault

BOOLEAN PciBreakOnDefault

Definition at line 19 of file fdo.c.

Referenced by PciAddDevice().

◆ PciFdoDispatchPnpTable

PCI_MN_DISPATCH_TABLE PciFdoDispatchPnpTable[]
Initial value:
=
{
}
NTSTATUS NTAPI PciFdoIrpQueryLegacyBusInformation(IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
Definition: fdo.c:567
NTSTATUS NTAPI PciFdoIrpStartDevice(IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
Definition: fdo.c:202
NTSTATUS NTAPI PciFdoIrpStopDevice(IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
Definition: fdo.c:338
NTSTATUS NTAPI PciFdoIrpSurpriseRemoval(IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
Definition: fdo.c:545
NTSTATUS NTAPI PciFdoIrpQueryDeviceRelations(IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
Definition: fdo.c:398
NTSTATUS NTAPI PciFdoIrpQueryRemoveDevice(IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
Definition: fdo.c:236
NTSTATUS NTAPI PciFdoIrpCancelRemoveDevice(IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
Definition: fdo.c:322
NTSTATUS NTAPI PciFdoIrpQueryInterface(IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
Definition: fdo.c:425
NTSTATUS NTAPI PciFdoIrpQueryCapabilities(IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
Definition: fdo.c:500
NTSTATUS NTAPI PciFdoIrpDeviceUsageNotification(IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
Definition: fdo.c:527
NTSTATUS NTAPI PciFdoIrpQueryStopDevice(IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
Definition: fdo.c:356
NTSTATUS NTAPI PciFdoIrpCancelStopDevice(IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
Definition: fdo.c:382
NTSTATUS NTAPI PciFdoIrpRemoveDevice(IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
Definition: fdo.c:259
NTSTATUS NTAPI PciIrpNotSupported(IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
Definition: dispatch.c:261
@ IRP_UPWARD
Definition: pci.h:184
@ IRP_DISPATCH
Definition: pci.h:185
@ IRP_DOWNWARD
Definition: pci.h:183
NTSTATUS(NTAPI * PCI_DISPATCH_FUNCTION)(IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PVOID DeviceExtension)
Definition: pci.h:390

Definition at line 30 of file fdo.c.

◆ PciFdoDispatchPowerTable

PCI_MN_DISPATCH_TABLE PciFdoDispatchPowerTable[]
Initial value:
=
{
}
NTSTATUS NTAPI PciFdoWaitWake(IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
Definition: power.c:305
NTSTATUS NTAPI PciFdoSetPowerState(IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
Definition: power.c:318
NTSTATUS NTAPI PciFdoIrpQueryPower(IN PIRP Irp, IN PIO_STACK_LOCATION IoStackLocation, IN PPCI_FDO_EXTENSION DeviceExtension)
Definition: power.c:351

Definition at line 21 of file fdo.c.

◆ PciFdoDispatchTable

PCI_MJ_DISPATCH_TABLE PciFdoDispatchTable
Initial value:
=
{
}
PCI_MN_DISPATCH_TABLE PciFdoDispatchPnpTable[]
Definition: fdo.c:30
PCI_MN_DISPATCH_TABLE PciFdoDispatchPowerTable[]
Definition: fdo.c:21
#define IRP_MN_QUERY_POWER
#define IRP_MN_QUERY_LEGACY_BUS_INFORMATION
Definition: iotypes.h:4443

Definition at line 60 of file fdo.c.

Referenced by PciInitializeFdoExtensionCommonFields().

◆ PciFdoExtensionListHead