Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Mar 2018 13:16:04 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r330582 - in head/sys: arm64/arm64 arm64/include dev/pci
Message-ID:  <201803071316.w27DG4YU007495@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Wed Mar  7 13:16:03 2018
New Revision: 330582
URL: https://svnweb.freebsd.org/changeset/base/330582

Log:
  Create macros for the ACPI interrupt cross references. This is considered a
  band aid until a better solution to find the correct interrupt controller
  can be found.
  
  While here fix one place in the GICv3 ITS driver where the offset wasn't
  correctly applied.
  
  Sponsored by:	DARPA, AFRL
  Sponsored by:	Cavium (Hardware)

Modified:
  head/sys/arm64/arm64/gic_v3_acpi.c
  head/sys/arm64/arm64/gicv3_its.c
  head/sys/arm64/arm64/nexus.c
  head/sys/arm64/include/intr.h
  head/sys/dev/pci/pci_host_generic_acpi.c

Modified: head/sys/arm64/arm64/gic_v3_acpi.c
==============================================================================
--- head/sys/arm64/arm64/gic_v3_acpi.c	Wed Mar  7 13:01:00 2018	(r330581)
+++ head/sys/arm64/arm64/gic_v3_acpi.c	Wed Mar  7 13:16:03 2018	(r330582)
@@ -27,6 +27,8 @@
  * SUCH DAMAGE.
  */
 
+#include "opt_acpi.h"
+
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
@@ -260,14 +262,14 @@ gic_v3_acpi_attach(device_t dev)
 	if (err != 0)
 		goto error;
 
-	sc->gic_pic = intr_pic_register(dev, 0);
+	sc->gic_pic = intr_pic_register(dev, ACPI_INTR_XREF);
 	if (sc->gic_pic == NULL) {
 		device_printf(dev, "could not register PIC\n");
 		err = ENXIO;
 		goto error;
 	}
 
-	if (intr_pic_claim_root(dev, 0, arm_gic_v3_intr, sc,
+	if (intr_pic_claim_root(dev, ACPI_INTR_XREF, arm_gic_v3_intr, sc,
 	    GIC_LAST_SGI - GIC_FIRST_SGI + 1) != 0) {
 		err = ENXIO;
 		goto error;

Modified: head/sys/arm64/arm64/gicv3_its.c
==============================================================================
--- head/sys/arm64/arm64/gicv3_its.c	Wed Mar  7 13:01:00 2018	(r330581)
+++ head/sys/arm64/arm64/gicv3_its.c	Wed Mar  7 13:16:03 2018	(r330582)
@@ -1734,12 +1734,13 @@ gicv3_its_acpi_attach(device_t dev)
 	if (err != 0)
 		return (err);
 
-	sc->sc_pic = intr_pic_register(dev, device_get_unit(dev) + 1);
+	sc->sc_pic = intr_pic_register(dev,
+	    device_get_unit(dev) + ACPI_MSI_XREF);
 	intr_pic_add_handler(device_get_parent(dev), sc->sc_pic,
 	    gicv3_its_intr, sc, GIC_FIRST_LPI, LPI_NIRQS);
 
 	/* Register this device to handle MSI interrupts */
-	intr_msi_register(dev, 1);
+	intr_msi_register(dev, device_get_unit(dev) + ACPI_MSI_XREF);
 
 	return (0);
 }

Modified: head/sys/arm64/arm64/nexus.c
==============================================================================
--- head/sys/arm64/arm64/nexus.c	Wed Mar  7 13:01:00 2018	(r330581)
+++ head/sys/arm64/arm64/nexus.c	Wed Mar  7 13:16:03 2018	(r330582)
@@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$");
 #include <contrib/dev/acpica/include/acpi.h>
 #include <dev/acpica/acpivar.h>
 #include "acpi_bus_if.h"
+#include "pcib_if.h"
 #endif
 
 extern struct bus_space memmap_bus;
@@ -524,7 +525,8 @@ nexus_acpi_map_intr(device_t dev, device_t child, u_in
 	 * controllers for the largest base value that is no larger than
 	 * the IRQ value.
 	 */
-	irq = intr_map_irq(NULL, 0, (struct intr_map_data *)acpi_data);
+	irq = intr_map_irq(NULL, ACPI_INTR_XREF,
+	    (struct intr_map_data *)acpi_data);
 	return (irq);
 }
 #endif

Modified: head/sys/arm64/include/intr.h
==============================================================================
--- head/sys/arm64/include/intr.h	Wed Mar  7 13:01:00 2018	(r330581)
+++ head/sys/arm64/include/intr.h	Wed Mar  7 13:16:03 2018	(r330582)
@@ -48,4 +48,9 @@ arm_irq_memory_barrier(uintptr_t irq)
 void intr_ipi_dispatch(u_int, struct trapframe *);
 #endif
 
+#ifdef DEV_ACPI
+#define	ACPI_INTR_XREF	1
+#define	ACPI_MSI_XREF	2
+#endif
+
 #endif	/* _MACHINE_INTR_H */

Modified: head/sys/dev/pci/pci_host_generic_acpi.c
==============================================================================
--- head/sys/dev/pci/pci_host_generic_acpi.c	Wed Mar  7 13:01:00 2018	(r330581)
+++ head/sys/dev/pci/pci_host_generic_acpi.c	Wed Mar  7 13:16:03 2018	(r330582)
@@ -228,7 +228,8 @@ generic_pcie_acpi_alloc_msi(device_t pci, device_t chi
 {
 
 #if defined(INTRNG)
-	return (intr_alloc_msi(pci, child, 1, count, maxcount, irqs));
+	return (intr_alloc_msi(pci, child, ACPI_MSI_XREF, count, maxcount,
+	    irqs));
 #else
 	return (ENXIO);
 #endif
@@ -240,7 +241,7 @@ generic_pcie_acpi_release_msi(device_t pci, device_t c
 {
 
 #if defined(INTRNG)
-	return (intr_release_msi(pci, child, 1, count, irqs));
+	return (intr_release_msi(pci, child, ACPI_MSI_XREF, count, irqs));
 #else
 	return (ENXIO);
 #endif
@@ -252,7 +253,7 @@ generic_pcie_acpi_map_msi(device_t pci, device_t child
 {
 
 #if defined(INTRNG)
-	return (intr_map_msi(pci, child, 1, irq, addr, data));
+	return (intr_map_msi(pci, child, ACPI_MSI_XREF, irq, addr, data));
 #else
 	return (ENXIO);
 #endif
@@ -263,7 +264,7 @@ generic_pcie_acpi_alloc_msix(device_t pci, device_t ch
 {
 
 #if defined(INTRNG)
-	return (intr_alloc_msix(pci, child, 1, irq));
+	return (intr_alloc_msix(pci, child, ACPI_MSI_XREF, irq));
 #else
 	return (ENXIO);
 #endif
@@ -274,7 +275,7 @@ generic_pcie_acpi_release_msix(device_t pci, device_t 
 {
 
 #if defined(INTRNG)
-	return (intr_release_msix(pci, child, 1, irq));
+	return (intr_release_msix(pci, child, ACPI_MSI_XREF, irq));
 #else
 	return (ENXIO);
 #endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803071316.w27DG4YU007495>