Author: manu
Date: Wed Sep 30 17:09:17 2020
New Revision: 366294
URL: https://svnweb.freebsd.org/changeset/base/366294

Log:
  acpi_resource: support multiple IRQs
  
  Some DSDT entries have multiple interrupts for one device.
  Add support for it.
  
  This fixes ahci on NXP LS2160 and genet on RPi4
  
  Submitted by: Greg V <greg@unrelenting.technology>
  Reviewed by:  jhb
  MFC after:    2 weeks
  Differential Revision:        https://reviews.freebsd.org/D25145

Modified:
  head/sys/dev/acpica/acpi_resource.c

Modified: head/sys/dev/acpica/acpi_resource.c
==============================================================================
--- head/sys/dev/acpica/acpi_resource.c Wed Sep 30 17:08:34 2020        
(r366293)
+++ head/sys/dev/acpica/acpi_resource.c Wed Sep 30 17:09:17 2020        
(r366294)
@@ -643,17 +643,13 @@ acpi_res_set_irq(device_t dev, void *context, uint8_t 
     int trig, int pol)
 {
     struct acpi_res_context    *cp = (struct acpi_res_context *)context;
-    rman_res_t intr;
+    int i;
 
     if (cp == NULL || irq == NULL)
        return;
 
-    /* This implements no resource relocation. */
-    if (count != 1)
-       return;
-
-    intr = *irq;
-    bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, intr, 1);
+    for (i = 0; i < count; i++)
+        bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, irq[i], 1);
 }
 
 static void
@@ -661,17 +657,13 @@ acpi_res_set_ext_irq(device_t dev, void *context, uint
     int trig, int pol)
 {
     struct acpi_res_context    *cp = (struct acpi_res_context *)context;
-    rman_res_t intr;
+    int i;
 
     if (cp == NULL || irq == NULL)
        return;
 
-    /* This implements no resource relocation. */
-    if (count != 1)
-       return;
-
-    intr = *irq;
-    bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, intr, 1);
+    for (i = 0; i < count; i++)
+        bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, irq[i], 1);
 }
 
 static void
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to