ReactOS 0.4.16-dev-306-g647d351
pci.c File Reference
#include "pci.h"
#include <stdio.h>
#include <debug.h>
Include dependency graph for pci.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static NTSTATUS NTAPI PciDispatchDeviceControl (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
static NTSTATUS NTAPI PciAddDevice (IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
 
static NTSTATUS NTAPI PciPowerControl (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
static NTSTATUS NTAPI PciPnpControl (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
VOID NTAPI PciUnload (IN PDRIVER_OBJECT DriverObject)
 
static VOID PciLocateKdDevices (VOID)
 
NTSTATUS NTAPI DriverEntry (IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
 
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 CompatibleIDs, 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)
 

Variables

static DRIVER_DISPATCH PciDispatchDeviceControl
 
static DRIVER_ADD_DEVICE PciAddDevice
 
static DRIVER_DISPATCH PciPowerControl
 
static DRIVER_DISPATCH PciPnpControl
 
PPCI_DRIVER_EXTENSION DriverExtension = NULL
 
BOOLEAN HasDebuggingDevice = FALSE
 
PCI_TYPE1_CFG_CYCLE_BITS PciDebuggingDevice [2] = {0}
 
DRIVER_UNLOAD PciUnload
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 14 of file pci.c.

Function Documentation

◆ DriverEntry()

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

Definition at line 250 of file pci.c.

253{
255
257 DPRINT("Peripheral Component Interconnect Bus Driver\n");
258
260 DriverObject->MajorFunction[IRP_MJ_PNP] = PciPnpControl;
261 DriverObject->MajorFunction[IRP_MJ_POWER] = PciPowerControl;
262 DriverObject->DriverExtension->AddDevice = PciAddDevice;
263 DriverObject->DriverUnload = PciUnload;
264
267 sizeof(PCI_DRIVER_EXTENSION),
269 if (!NT_SUCCESS(Status))
270 return Status;
271
273
276
278
279 return STATUS_SUCCESS;
280}
LONG NTSTATUS
Definition: precomp.h:26
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
Status
Definition: gdiplustypes.h:25
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325
NTSTATUS NTAPI IoAllocateDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress, IN ULONG DriverObjectExtensionSize, OUT PVOID *DriverObjectExtension)
Definition: driver.c:1826
DRIVER_UNLOAD PciUnload
Definition: pci.c:188
static DRIVER_DISPATCH PciPnpControl
Definition: pci.c:26
static DRIVER_DISPATCH PciDispatchDeviceControl
Definition: pci.c:17
static DRIVER_ADD_DEVICE PciAddDevice
Definition: pci.c:20
static VOID PciLocateKdDevices(VOID)
Definition: pci.c:202
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:31
static DRIVER_DISPATCH PciPowerControl
Definition: pci.c:23
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
KSPIN_LOCK BusListLock
Definition: pci.h:108
LIST_ENTRY BusListHead
Definition: pci.h:106
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_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
#define IRP_MJ_POWER

◆ PciAddDevice()

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

Definition at line 143 of file pci.c.

146{
147 PFDO_DEVICE_EXTENSION DeviceExtension;
150
151 DPRINT("Called\n");
153 return STATUS_SUCCESS;
154
156 sizeof(FDO_DEVICE_EXTENSION),
157 NULL,
160 TRUE,
161 &Fdo);
162 if (!NT_SUCCESS(Status))
163 {
164 DPRINT("IoCreateDevice() failed with status 0x%X\n", Status);
165 return Status;
166 }
167
168 DeviceExtension = (PFDO_DEVICE_EXTENSION)Fdo->DeviceExtension;
169
170 RtlZeroMemory(DeviceExtension, sizeof(FDO_DEVICE_EXTENSION));
171
172 DeviceExtension->Common.IsFDO = TRUE;
173
174 DeviceExtension->Ldo = IoAttachDeviceToDeviceStack(Fdo,
176
177 DeviceExtension->State = dsStopped;
178
179 Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
180
181 //Fdo->Flags |= DO_POWER_PAGABLE;
182
183 DPRINT("Done AddDevice\n");
184
185 return STATUS_SUCCESS;
186}
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1157
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
@ dsStopped
Definition: isapnp.h:30
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:966
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 FILE_DEVICE_BUS_EXTENDER
Definition: winioctl.h:87
PDEVICE_OBJECT Ldo
Definition: pci.h:98
COMMON_DEVICE_EXTENSION Common
Definition: pci.h:84
PCI_DEVICE_STATE State
Definition: pci.h:90
_Must_inspect_result_ _In_ WDFDEVICE Fdo
Definition: wdffdo.h:461

◆ PciCreateCompatibleIDsString()

NTSTATUS PciCreateCompatibleIDsString ( PUNICODE_STRING  CompatibleIDs,
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
#define L(x)
Definition: ntvdm.h:50
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().

◆ PciDispatchDeviceControl()

static NTSTATUS NTAPI PciDispatchDeviceControl ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)
static

Definition at line 39 of file pci.c.

42{
45
47 DPRINT("Called. IRP is at (0x%p)\n", Irp);
48
49 Irp->IoStatus.Information = 0;
50
52 switch (IrpSp->Parameters.DeviceIoControl.IoControlCode)
53 {
54 default:
55 DPRINT("Unknown IOCTL 0x%X\n", IrpSp->Parameters.DeviceIoControl.IoControlCode);
57 break;
58 }
59
61 {
62 Irp->IoStatus.Status = Status;
63
64 DPRINT("Completing IRP at 0x%p\n", Irp);
65
67 }
68
69 DPRINT("Leaving. Status 0x%X\n", Status);
70
71 return Status;
72}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_PENDING
Definition: d3dkmdt.h:43
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define IoCompleteRequest
Definition: irp.c:1240
struct _IO_STACK_LOCATION::@1580::@1581 DeviceIoControl
union _IO_STACK_LOCATION::@1580 Parameters
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define IO_NO_INCREMENT
Definition: iotypes.h:598

◆ 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 STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
#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:1922
_Out_ _Inout_ POEM_STRING DestinationString
Definition: rtlfuncs.h:1921
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().

◆ PciLocateKdDevices()

static VOID PciLocateKdDevices ( VOID  )
static

Definition at line 202 of file pci.c.

203{
204 ULONG i;
206 WCHAR KeyNameBuffer[16];
209
212 QueryTable[0].Name = L"Bus";
215 QueryTable[1].Name = L"Slot";
217
218 for (i = 0; i < RTL_NUMBER_OF(PciDebuggingDevice); ++i)
219 {
220 PCI_SLOT_NUMBER PciSlot;
221
222 RtlStringCbPrintfW(KeyNameBuffer, sizeof(KeyNameBuffer), L"PCI\\Debug\\%d", i);
223
225 KeyNameBuffer,
227 NULL,
228 NULL);
229 if (!NT_SUCCESS(Status))
230 return;
231
233
234 PciSlot.u.AsULONG = SlotNumber;
235 PciDebuggingDevice[i].DeviceNumber = PciSlot.u.bits.DeviceNumber;
236 PciDebuggingDevice[i].FunctionNumber = PciSlot.u.bits.FunctionNumber;
239
240 DPRINT1("PCI debugging device %02x:%02x.%x\n",
241 BusNumber,
242 PciSlot.u.bits.DeviceNumber,
243 PciSlot.u.bits.FunctionNumber);
244 }
245}
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define DPRINT1
Definition: precomp.h:8
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
NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
_In_ PCWSTR _Inout_ _At_ QueryTable _Pre_unknown_ PRTL_QUERY_REGISTRY_TABLE QueryTable
Definition: rtlfuncs.h:4220
#define RTL_QUERY_REGISTRY_REQUIRED
Definition: nt_native.h:132
#define RTL_QUERY_REGISTRY_DIRECT
Definition: nt_native.h:144
#define RTL_REGISTRY_SERVICES
Definition: nt_native.h:162
NTSTRSAFEVAPI RtlStringCbPrintfW(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1173
PCI_TYPE1_CFG_CYCLE_BITS PciDebuggingDevice[2]
Definition: pci.c:33
BOOLEAN HasDebuggingDevice
Definition: pci.c:32
union _PCI_SLOT_NUMBER::@4023 u
struct _PCI_SLOT_NUMBER::@4023::@4024 bits
_In_ WDFIORESREQLIST _In_ ULONG SlotNumber
Definition: wdfresource.h:68
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:160

Referenced by DriverEntry().

◆ PciPnpControl()

static NTSTATUS NTAPI PciPnpControl ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)
static

Definition at line 77 of file pci.c.

88{
89 PCOMMON_DEVICE_EXTENSION DeviceExtension;
91
92 DeviceExtension = (PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
93
94 DPRINT("IsFDO %u\n", DeviceExtension->IsFDO);
95
96 if (DeviceExtension->IsFDO)
97 {
99 }
100 else
101 {
103 }
104
105 return Status;
106}
NTSTATUS FdoPnpControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: fdo.c:469
NTSTATUS PdoPnpControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: pdo.c:1502
struct _COMMON_DEVICE_EXTENSION * PCOMMON_DEVICE_EXTENSION

◆ PciPowerControl()

static NTSTATUS NTAPI PciPowerControl ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)
static

Definition at line 111 of file pci.c.

122{
123 PCOMMON_DEVICE_EXTENSION DeviceExtension;
125
126 DeviceExtension = (PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
127
128 if (DeviceExtension->IsFDO)
129 {
131 }
132 else
133 {
135 }
136
137 return Status;
138}
NTSTATUS FdoPowerControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: fdo.c:594
NTSTATUS PdoPowerControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: pdo.c:1625
if(dx< 0)
Definition: linetemp.h:194

◆ PciUnload()

VOID NTAPI PciUnload ( IN PDRIVER_OBJECT  DriverObject)

Definition at line 192 of file pci.c.

194{
195 /* The driver object extension is destroyed by the I/O manager */
197}

Variable Documentation

◆ DriverExtension

◆ HasDebuggingDevice

BOOLEAN HasDebuggingDevice = FALSE

◆ PciAddDevice

static NTSTATUS NTAPI PciAddDevice
static

Definition at line 20 of file pci.c.

Referenced by DriverEntry().

◆ PciDebuggingDevice

PCI_TYPE1_CFG_CYCLE_BITS PciDebuggingDevice[2] = {0}

Definition at line 33 of file pci.c.

Referenced by PciIsDebuggingDevice(), and PciLocateKdDevices().

◆ PciDispatchDeviceControl

static NTSTATUS NTAPI PciDispatchDeviceControl
static

Definition at line 17 of file pci.c.

Referenced by DriverEntry().

◆ PciPnpControl

static NTSTATUS NTAPI PciPnpControl
static

Definition at line 26 of file pci.c.

Referenced by DriverEntry().

◆ PciPowerControl

static NTSTATUS NTAPI PciPowerControl
static

Definition at line 23 of file pci.c.

Referenced by DriverEntry().

◆ PciUnload

DRIVER_UNLOAD PciUnload

Definition at line 188 of file pci.c.

Referenced by DriverEntry().