2 * PROJECT: ReactOS PCI Bus Driver
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: drivers/bus/pci/pcivrify.c
5 * PURPOSE: PCI Driver Verifier Support
6 * PROGRAMMERS: ReactOS Portable Systems Group
9 /* INCLUDES *******************************************************************/
16 /* GLOBALS ********************************************************************/
18 BOOLEAN PciVerifierRegistered
;
19 PVOID PciVerifierNotificationHandle
;
21 PCI_VERIFIER_DATA PciVerifierFailureTable
[PCI_VERIFIER_CODES
] =
27 "The BIOS has reprogrammed the bus numbers of an active PCI device "
28 "(!devstack %DevObj) during a dock or undock!"
34 "A device in the system did not update it's PMCSR register in the spec "
35 "mandated time (!devstack %DevObj, Power state D%Ulong)"
41 "A driver controlling a PCI device has tried to access OS controlled "
42 "configuration space registers (!devstack %DevObj, Offset 0x%Ulong1, "
47 VFFAILURE_FAIL_UNDER_DEBUGGER
,
49 "A driver controlling a PCI device has tried to read or write from an "
50 "invalid space using IRP_MN_READ/WRITE_CONFIG or via BUS_INTERFACE_STANDARD."
51 " NB: These functions take WhichSpace parameters of the form PCI_WHICHSPACE_*"
52 " and not a BUS_DATA_TYPE (!devstack %DevObj, WhichSpace 0x%Ulong1)"
56 /* FUNCTIONS ******************************************************************/
60 PciVerifierRetrieveFailureData(IN ULONG FailureCode
)
62 PPCI_VERIFIER_DATA VerifierData
;
64 /* Scan the verifier failure table for this code */
65 VerifierData
= PciVerifierFailureTable
;
66 while (VerifierData
->FailureCode
!= FailureCode
)
70 ASSERT(VerifierData
< &PciVerifierFailureTable
[PCI_VERIFIER_CODES
]);
73 /* Return the entry for this code */
77 DRIVER_NOTIFICATION_CALLBACK_ROUTINE PciVerifierProfileChangeCallback
;
81 PciVerifierProfileChangeCallback(IN PVOID NotificationStructure
,
84 UNREFERENCED_PARAMETER(NotificationStructure
);
85 UNREFERENCED_PARAMETER(Context
);
87 /* This function is not yet implemented */
88 UNIMPLEMENTED_DBGBREAK();
89 return STATUS_SUCCESS
;
94 PciVerifierInit(IN PDRIVER_OBJECT DriverObject
)
98 /* Check if the kernel driver verifier is enabled */
99 if (VfIsVerificationEnabled(VFOBJTYPE_SYSTEM_BIOS
, NULL
))
101 /* Register a notification for changes, to keep track of the PCI tree */
102 Status
= IoRegisterPlugPlayNotification(EventCategoryHardwareProfileChange
,
106 PciVerifierProfileChangeCallback
,
108 &PciVerifierNotificationHandle
);
109 if (NT_SUCCESS(Status
)) PciVerifierRegistered
= TRUE
;