Synchronize with trunk revision 59636 (just before Alex's CreateProcess revamp).
[reactos.git] / drivers / bus / pcix / utils.c
index 24f442a..86ad92e 100644 (file)
@@ -152,8 +152,7 @@ PciIsDatacenter(VOID)
     else
     {
         /* This scenario shouldn't happen yet, since SetupDD isn't used */
-        UNIMPLEMENTED;
-        while (TRUE);
+        UNIMPLEMENTED_FATAL("ReactOS doesn't use SetupDD for its installation program. Therefore this scenario must not happen!\n");
     }
 
     /* Return if this is Datacenter or not */
@@ -369,16 +368,16 @@ PciFindParentPciFdoExtension(IN PDEVICE_OBJECT DeviceObject,
 
         /* Scan all children PDO, stop when no more PDOs, or found it */
         for (FoundExtension = DeviceExtension->ChildPdoList;
-             FoundExtension && (FoundExtension != SearchExtension);
+             ((FoundExtension) && (FoundExtension != SearchExtension));
              FoundExtension = FoundExtension->Next);
 
-        /* If we found it, break out */
-        if (FoundExtension) break;
-
         /* Release this device's lock */
         KeSetEvent(&DeviceExtension->ChildListLock, IO_NO_INCREMENT, FALSE);
         KeLeaveCriticalRegion();
 
+        /* If we found it, break out */
+        if (FoundExtension) break;
+
         /* Move to the next device */
         DeviceExtension = (PPCI_FDO_EXTENSION)DeviceExtension->List.Next;
     }
@@ -494,7 +493,7 @@ PciGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject,
                     Status,
                     STATUS_BUFFER_TOO_SMALL);
             *OutputBuffer = NULL;
-            ASSERTMSG(FALSE, "PCI Successfully did the impossible!");
+            ASSERTMSG("PCI Successfully did the impossible!", FALSE);
             break;
         }
 
@@ -503,7 +502,7 @@ PciGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject,
         if (!Buffer)
         {
             /* No memory, fail the request */
-            DPRINT1("PCI - Failed to allocate DeviceProperty buffer (%d bytes).\n", BufferLength);
+            DPRINT1("PCI - Failed to allocate DeviceProperty buffer (%u bytes).\n", BufferLength);
             Status = STATUS_INSUFFICIENT_RESOURCES;
             break;
         }
@@ -611,6 +610,9 @@ PciGetHackFlags(IN USHORT VendorId,
     ULONGLONG HackFlags;
     ULONG LastWeight, MatchWeight;
     ULONG EntryFlags;
+    
+    /* ReactOS SetupLDR Hack */
+    if (!PciHackTable) return 0;
 
     /* Initialize the variables before looping */
     LastWeight = 0;
@@ -749,13 +751,15 @@ PciIsDeviceOnDebugPath(IN PPCI_PDO_EXTENSION DeviceExtension)
 {
     PAGED_CODE();
 
+    UNREFERENCED_PARAMETER(DeviceExtension);
+
     /* Check for too many, or no, debug ports */
     ASSERT(PciDebugPortsCount <= MAX_DEBUGGING_DEVICES_SUPPORTED);
     if (!PciDebugPortsCount) return FALSE;
 
     /* eVb has not been able to test such devices yet */
-    UNIMPLEMENTED;
-    while (TRUE);
+    UNIMPLEMENTED_DBGBREAK();
+    return FALSE;
 }
 
 NTSTATUS
@@ -1313,6 +1317,8 @@ PciQueryBusInformation(IN PPCI_PDO_EXTENSION PdoExtension,
 {
     PPNP_BUS_INFORMATION BusInfo;
 
+    UNREFERENCED_PARAMETER(Buffer);
+
     /* Allocate a structure for the bus information */
     BusInfo = ExAllocatePoolWithTag(PagedPool,
                                     sizeof(PNP_BUS_INFORMATION),
@@ -1338,7 +1344,7 @@ PciDetermineSlotNumber(IN PPCI_PDO_EXTENSION PdoExtension,
 
     /* Check if a $PIR from the BIOS is used (legacy IRQ routing) */
     ParentExtension = PdoExtension->ParentFdoExtension;
-    DPRINT1("Slot lookup for %d.%d.%d\n",
+    DPRINT1("Slot lookup for %d.%u.%u\n",
             ParentExtension ? ParentExtension->BaseBus : -1,
             PdoExtension->Slot.u.bits.DeviceNumber,
             PdoExtension->Slot.u.bits.FunctionNumber);
@@ -1346,12 +1352,12 @@ PciDetermineSlotNumber(IN PPCI_PDO_EXTENSION PdoExtension,
     {
         /* Read every slot information entry */
         SlotInfo = &PciIrqRoutingTable->Slot[0];
-        DPRINT1("PIR$ %p is %lx bytes, slot 0 is at: %lx\n",
+        DPRINT1("PIR$ %p is %lx bytes, slot 0 is at: %p\n",
                 PciIrqRoutingTable, PciIrqRoutingTable->TableSize, SlotInfo);
         while (SlotInfo < (PSLOT_INFO)((ULONG_PTR)PciIrqRoutingTable +
                                        PciIrqRoutingTable->TableSize))
         {
-            DPRINT1("Slot Info: %d.%d->#%d\n",
+            DPRINT1("Slot Info: %u.%u->#%u\n",
                     SlotInfo->BusNumber,
                     SlotInfo->DeviceNumber,
                     SlotInfo->SlotNumber);