[ros-diffs] [cgutman] 49158: [SCSIPORT] - Remove some code duplication and fix a bug of copying the same interrupt information twice for a device with 2 interrupts (instead of the info for interrupt 1 then the...

cgutman at svn.reactos.org cgutman at svn.reactos.org
Fri Oct 15 19:25:07 UTC 2010


Author: cgutman
Date: Fri Oct 15 19:25:07 2010
New Revision: 49158

URL: http://svn.reactos.org/svn/reactos?rev=49158&view=rev
Log:
[SCSIPORT]
- Remove some code duplication and fix a bug of copying the same interrupt information twice for a device with 2 interrupts (instead of the info for interrupt 1 then the info for interrupt 2) effectively making initialization fail because the resource allocation code will detect a conflict with itself

Modified:
    trunk/reactos/drivers/storage/scsiport/scsiport.c

Modified: trunk/reactos/drivers/storage/scsiport/scsiport.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/scsiport/scsiport.c?rev=49158&r1=49157&r2=49158&view=diff
==============================================================================
--- trunk/reactos/drivers/storage/scsiport/scsiport.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/storage/scsiport/scsiport.c [iso-8859-1] Fri Oct 15 19:25:07 2010
@@ -2216,7 +2216,7 @@
     }
 
     /* If we use interrupt(s), copy them */
-    if (Interrupt)
+    while (Interrupt)
     {
         ResourceDescriptor->Type = CmResourceTypeInterrupt;
 
@@ -2232,37 +2232,12 @@
             ResourceDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
         }
 
-        ResourceDescriptor->u.Interrupt.Level = PortConfig->BusInterruptLevel;
-        ResourceDescriptor->u.Interrupt.Vector = PortConfig->BusInterruptVector;
+        ResourceDescriptor->u.Interrupt.Level = (Interrupt == 2) ? PortConfig->BusInterruptLevel2 : PortConfig->BusInterruptLevel;
+        ResourceDescriptor->u.Interrupt.Vector = (Interrupt == 2) ? PortConfig->BusInterruptVector2 : PortConfig->BusInterruptVector;
         ResourceDescriptor->u.Interrupt.Affinity = 0;
 
         ResourceDescriptor++;
         Interrupt--;
-    }
-
-    /* Copy 2nd interrupt
-       FIXME: Stupid code duplication, remove */
-    if (Interrupt)
-    {
-        ResourceDescriptor->Type = CmResourceTypeInterrupt;
-
-        if (PortConfig->AdapterInterfaceType == MicroChannel ||
-            PortConfig->InterruptMode == LevelSensitive)
-        {
-            ResourceDescriptor->ShareDisposition = CmResourceShareShared;
-            ResourceDescriptor->Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE;
-        }
-        else
-        {
-            ResourceDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
-            ResourceDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
-        }
-
-        ResourceDescriptor->u.Interrupt.Level = PortConfig->BusInterruptLevel;
-        ResourceDescriptor->u.Interrupt.Vector = PortConfig->BusInterruptVector;
-        ResourceDescriptor->u.Interrupt.Affinity = 0;
-
-        ResourceDescriptor++;
     }
 
     /* Copy DMA data */




More information about the Ros-diffs mailing list