Module Name:    src
Committed By:   cherry
Date:           Fri Jul 28 07:42:41 UTC 2017

Modified Files:
        src/sys/arch/xen/xen: pci_intr_machdep.c

Log Message:
APIC related macros are mixed with IOAPIC related ones.
This needs separation.

Until then, band-aid it.

This fixes pci-passthrough build failures on XEN3_DOMU pointed out by
msaitoh@


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/xen/xen/pci_intr_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/xen/xen/pci_intr_machdep.c
diff -u src/sys/arch/xen/xen/pci_intr_machdep.c:1.19 src/sys/arch/xen/xen/pci_intr_machdep.c:1.20
--- src/sys/arch/xen/xen/pci_intr_machdep.c:1.19	Sun Jul 16 14:02:48 2017
+++ src/sys/arch/xen/xen/pci_intr_machdep.c	Fri Jul 28 07:42:41 2017
@@ -1,4 +1,4 @@
-/*      $NetBSD: pci_intr_machdep.c,v 1.19 2017/07/16 14:02:48 cherry Exp $      */
+/*      $NetBSD: pci_intr_machdep.c,v 1.20 2017/07/28 07:42:41 cherry Exp $      */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.19 2017/07/16 14:02:48 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.20 2017/07/28 07:42:41 cherry Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -61,6 +61,15 @@ __KERNEL_RCSID(0, "$NetBSD: pci_intr_mac
 #include <machine/mpacpi.h>
 #endif
 
+/* XXX: cherry@: Hack - this is a symptom of lapic vs. ioapic
+ * needing more code separation.
+ */
+#if NIOAPIC > 0
+#define IRQ_LEGACY_IRQ(_irq) APIC_IRQ_LEGACY_IRQ(_irq)
+#else
+#define IRQ_LEGACY_IRQ(_irq) (_irq & 0xff)
+#endif
+
 int
 pci_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
 {
@@ -157,7 +166,7 @@ pci_intr_string(pci_chipset_tag_t pc, pc
 {
 	int evtch;
 
-	evtch = get_pirq_to_evtch(APIC_IRQ_LEGACY_IRQ(ih));
+	evtch = get_pirq_to_evtch(IRQ_LEGACY_IRQ(ih));
 #if NIOAPIC > 0
 	struct ioapic_softc *pic;
 	if (ih & APIC_INT_VIA_APIC) {
@@ -217,8 +226,8 @@ pci_intr_establish(pci_chipset_tag_t pci
 #endif
 		snprintf(evname, sizeof(evname), "irq%"PRIu64, intrh);
 
-	return (void *)pirq_establish(APIC_IRQ_LEGACY_IRQ(intrh),
-	    get_pirq_to_evtch(APIC_IRQ_LEGACY_IRQ(intrh)), func, arg, level, evname);
+	return (void *)pirq_establish(IRQ_LEGACY_IRQ(intrh),
+	    get_pirq_to_evtch(IRQ_LEGACY_IRQ(intrh)), func, arg, level, evname);
 }
 
 void

Reply via email to