Can't sleep so write more source codes! add scan bus functions to get power caps...
[reactos.git] / reactos / drivers / bus / pcix / pcivrify.c
index ed54474..f51f02d 100644 (file)
 BOOLEAN PciVerifierRegistered;
 PVOID PciVerifierNotificationHandle;
 
+PCI_VERIFIER_DATA PciVerifierFailureTable[PCI_VERIFIER_CODES] =
+{
+    {
+        1,
+        VFFAILURE_FAIL_LOGO,
+        0,
+        "The BIOS has reprogrammed the bus numbers of an active PCI device "
+        "(!devstack %DevObj) during a dock or undock!"
+    },
+    {
+        2,
+        VFFAILURE_FAIL_LOGO,
+        0,
+        "A device in the system did not update it's PMCSR register in the spec "
+        "mandated time (!devstack %DevObj, Power state D%Ulong)"
+    },
+    {
+        3,
+        VFFAILURE_FAIL_LOGO,
+        0,
+        "A driver controlling a PCI device has tried to access OS controlled "
+        "configuration space registers (!devstack %DevObj, Offset 0x%Ulong1, "
+        "Length 0x%Ulong2)"
+    },
+    {
+        4,
+        VFFAILURE_FAIL_UNDER_DEBUGGER,
+        0,
+        "A driver controlling a PCI device has tried to read or write from an "
+        "invalid space using IRP_MN_READ/WRITE_CONFIG or via BUS_INTERFACE_STANDARD."
+        "  NB: These functions take WhichSpace parameters of the form PCI_WHICHSPACE_*"
+        " and not a BUS_DATA_TYPE (!devstack %DevObj, WhichSpace 0x%Ulong1)"
+    },
+};
+
 /* FUNCTIONS ******************************************************************/
 
+PPCI_VERIFIER_DATA
+NTAPI
+PciVerifierRetrieveFailureData(IN ULONG FailureCode)
+{
+    PPCI_VERIFIER_DATA VerifierData;
+
+    /* Scan the verifier failure table for this code */
+    VerifierData = PciVerifierFailureTable;
+    while (VerifierData->FailureCode != FailureCode)
+    {
+        /* Keep searching */
+        ++VerifierData;
+        ASSERT(VerifierData < &PciVerifierFailureTable[PCI_VERIFIER_CODES]);
+    }
+
+    /* Return the entry for this code */
+    return VerifierData;
+}
+
 NTSTATUS
 NTAPI
 PciVerifierProfileChangeCallback(IN PVOID NotificationStructure,