Module Name:    src
Committed By:   cherry
Date:           Mon Sep 10 05:08:55 UTC 2018

Modified Files:
        src/sys/arch/x86/x86: intr.c
        src/sys/arch/xen/include: intrdefs.h

Log Message:
Make the use of 'irqs' in the range 0 < irq < 255 by xen
as a handle for internal use explicit.

This allows us to pass up the handle as "legacy" irq while
establishing interrupt handlers for xen.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/xen/include/intrdefs.h

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/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.127 src/sys/arch/x86/x86/intr.c:1.128
--- src/sys/arch/x86/x86/intr.c:1.127	Tue Jul  3 11:45:54 2018
+++ src/sys/arch/x86/x86/intr.c	Mon Sep 10 05:08:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.127 2018/07/03 11:45:54 kamil Exp $	*/
+/*	$NetBSD: intr.c,v 1.128 2018/09/10 05:08:55 cherry Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.127 2018/07/03 11:45:54 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.128 2018/09/10 05:08:55 cherry Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -1266,15 +1266,18 @@ intr_establish_xname(int legacy_irq, str
 	intr_handle_t irq;
 	int evtchn;
 
-	KASSERTMSG(legacy_irq == -1 || (0 <= legacy_irq && legacy_irq < 16),
+	KASSERTMSG(legacy_irq == -1 || (0 <= legacy_irq && legacy_irq < NUM_XEN_IRQS),
 	    "bad legacy IRQ value: %d", legacy_irq);
 	KASSERTMSG(!(legacy_irq == -1 && pic == &i8259_pic),
 	    "non-legacy IRQon i8259 ");
 
 	if (pic->pic_type != PIC_I8259) {
 #if NIOAPIC > 0
+		/* Are we passing mp tranmogrified/cascaded irqs ? */
+		irq = (legacy_irq == -1) ? 0 : legacy_irq;
+
 		/* will do interrupts via I/O APIC */
-		irq = APIC_INT_VIA_APIC;
+		irq |= APIC_INT_VIA_APIC;
 		irq |= pic->pic_apicid << APIC_INT_APIC_SHIFT;
 		irq |= pin << APIC_INT_PIN_SHIFT;
 #else /* NIOAPIC */

Index: src/sys/arch/xen/include/intrdefs.h
diff -u src/sys/arch/xen/include/intrdefs.h:1.12 src/sys/arch/xen/include/intrdefs.h:1.13
--- src/sys/arch/xen/include/intrdefs.h:1.12	Mon May 19 22:47:54 2014
+++ src/sys/arch/xen/include/intrdefs.h	Mon Sep 10 05:08:55 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: intrdefs.h,v 1.12 2014/05/19 22:47:54 rmind Exp $ */
+/* $NetBSD: intrdefs.h,v 1.13 2018/09/10 05:08:55 cherry Exp $ */
 
 /* This file co-exists, and is included via machine/intrdefs.h */
 
@@ -17,4 +17,7 @@
 /* Note: IPI_KICK does not have a handler. */
 #define XEN_NIPIS		6
 
+/* The number of 'irqs' that XEN understands */
+#define NUM_XEN_IRQS 		256
+
 #endif /* _XEN_INTRDEFS_H_ */

Reply via email to