Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jul 2002 19:39:04 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 14971 for review
Message-ID:  <200207270239.g6R2d4Se025564@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=14971

Change 14971 by peter@peter_ia64 on 2002/07/26 19:38:20

	This actually booted!  Shock! Horror!

Affected files ...

.. //depot/projects/ia64/sys/ia64/ia64/interrupt.c#10 edit

Differences ...

==== //depot/projects/ia64/sys/ia64/ia64/interrupt.c#10 (text+ko) ====

@@ -50,6 +50,7 @@
 #include <sys/lock.h>
 #include <sys/mutex.h>
 #include <sys/smp.h>
+#include <sys/cons.h>
 
 #include <machine/clock.h>
 #include <machine/cpu.h>
@@ -87,6 +88,8 @@
 
 
 static u_int schedclk2;
+time_t lts;
+u_int64_t lv;
 
 void
 interrupt(u_int64_t vector, struct trapframe *framep)
@@ -148,8 +151,20 @@
 		CTR1(KTR_SMP, "IPI_TEST, cpuid=%d", PCPU_GET(cpuid));
 		mp_ipi_test++;
 #endif
-	} else
+	} else {
+#if 0
+if (1 || vector < 48) {
+if (lts != time_second || lv != vector) {
+	printf(">I%ld<", vector - 32);
+	lts = time_second;
+	lv = vector;
+}
+} else {
+cnputc('I');
+}
+#endif
 		ia64_dispatch_intr(framep, vector);
+	}
 
  out:
 	atomic_subtract_int(&td->td_intr_nesting_level, 1);
@@ -187,8 +202,6 @@
 static struct mtx ia64_intrs_lock;
 static struct ia64_intr *ia64_intrs[256];
 
-static void	ithds_init(void *dummy);
-
 static void
 ithds_init(void *dummy)
 {
@@ -197,9 +210,11 @@
 }
 SYSINIT(ithds_init, SI_SUB_INTR, SI_ORDER_SECOND, ithds_init, NULL);
 
+
 void
 ia64_add_sapic(struct sapic *sa)
 {
+	printf("SAPIC %d is %p, %d-%d\n", ia64_sapic_count, sa, sa->sa_base, sa->sa_limit);
 	ia64_sapics[ia64_sapic_count++] = sa;
 }
 
@@ -211,7 +226,8 @@
 	irq = vector - IA64_HARDWARE_IRQ_BASE;
 	for (i = 0; i < ia64_sapic_count; i++) {
 		struct sapic *sa = ia64_sapics[i];
-		if (irq >= sa->sa_base && irq <= sa->sa_limit)
+		if (irq >= sa->sa_base && irq <= sa->sa_limit) {
+/* printf("ia64_enable: vector %d -> hw int %d apic %d input %d\n", vector, irq, i, irq - sa->sa_base); */
 			sapic_enable(sa, irq - sa->sa_base, vector,
 				     (irq < 16
 				      ? SAPIC_TRIGGER_EDGE
@@ -219,8 +235,44 @@
 				     (irq < 16
 				      ? SAPIC_POLARITY_HIGH
 				      : SAPIC_POLARITY_LOW));
+		}
+	}
+}
+
+#if 0
+#if 0
+long fakecnt;
+static void
+fakeihand(void *junk)
+{
+	printf(">FAKE %d<", (int)(uintptr_t)junk);
+}
+#endif
+static void
+ithds_init2(void *dummy)
+{
+#if 0
+	void *cookie;
+	void *arg;
+#endif
+	int i;
+
+	printf("SETTING UP FAKE INTERRUPTS\n");
+	for (i = 16; i < 128; i++) {
+#if 0
+		if (ia64_intrs[i + IA64_HARDWARE_IRQ_BASE])
+			continue;
+		arg = (void *)(uintptr_t)i;
+		ia64_setup_intr("fake", i + IA64_HARDWARE_IRQ_BASE, fakeihand, arg, INTR_TYPE_TTY, &cookie, &fakecnt);
+#else
+		ia64_enable(i + IA64_HARDWARE_IRQ_BASE);
+#endif
 	}
+	printf("SETTING UP DONE\n");
+
 }
+SYSINIT(ithds_init2, SI_SUB_PSEUDO, SI_ORDER_ANY, ithds_init2, NULL);
+#endif
 
 static void
 ia64_send_eoi(int vector)
@@ -260,6 +312,7 @@
 		if (i == NULL)
 			return ENOMEM;
 		i->cntp = cntp;
+/* printf("ia64_setup_intr: creating ithread for vector %d\n", vector); */
 		errcode = ithread_create(&i->ithd, vector, 0, 0,
 					 ia64_send_eoi, "intr:");
 		if (errcode) {
@@ -272,12 +325,14 @@
 		mtx_unlock_spin(&ia64_intrs_lock);
 	}
 
+/* printf("ia64_setup_intr: add handler for vector %d\n", vector); */
 	/* Second, add this handler. */
 	errcode = ithread_add_handler(i->ithd, name, handler, arg,
 	    ithread_priority(flags), flags, cookiep);
 	if (errcode)
 		return errcode;
 
+/* printf("ia64_setup_intr: enable vector %d\n", vector); */
 	ia64_enable(vector);
 	return 0;
 }
@@ -297,12 +352,15 @@
 	struct intrhand *ih;
 	int error;
 
+
 	/*
 	 * Find the interrupt thread for this vector.
 	 */
 	i = ia64_intrs[vector];
-	if (i == NULL)
+	if (i == NULL) {
+printf(">>STRAY IRQ VECTOR %ld (IRQ %ld)<<\n", vector, vector - 32);
 		return;			/* no ithread for this vector */
+	}
 
 	ithd = i->ithd;
 	KASSERT(ithd != NULL, ("interrupt vector without a thread"));
@@ -311,8 +369,10 @@
 	 * As an optimization, if an ithread has no handlers, don't
 	 * schedule it to run.
 	 */
-	if (TAILQ_EMPTY(&ithd->it_handlers))
+	if (TAILQ_EMPTY(&ithd->it_handlers)) {
+printf(">>STRAY HANDLER VECTOR %ld (IRQ %ld)<<\n", vector, vector - 32);
 		return;
+}
 
 	if (i->cntp)
 		atomic_add_long(i->cntp, 1);

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




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