Hi there,
 I am trying to rewrite parts of file drivers/char/serial.c ,
making better IRQ detection (use of probe_irq_*())
and after cleanning, trying to support other chipset.
 I have two typo in arch/i386/kernel/irq.c, linux 2.1.88 -
 works also on 2.1.89:
  (i<<1) instead of (1<<i) -- patch file at end of message
  (sorry it is a reverse patch)  (Linus, are you there ?)
  I also like to know what people think of the two functions
added in this file, that would enable faster IRQ detection;
and if it is accepted some adds from the SMP people to
detect SMP special IRQ which are waiting (pending and
not enabled) - and maybe currently treated.
 With those, detecting an IRQ would be done by:
  - get all currently pending IRQ - not enable new ones
  - save number of enabled and treated IRQ
  - make new chip generate the IRQ to detect
  - see if a new pending IRQ appear
       that will be the usual case and will be faster
  - else, wait 100 ms to check for wild interrupt
  - and continue the probe_irq_* process
  In this patch, there is also small modification to
display on a "cat /proc/interrupt" the line where
there is no action at present but there was some
(nb IRQ not null).
  Thanks for reading,
  Etienne Lorrain.
-- etienne.lorrain@ibm.net
-- On ne voit bien qu'avec le coeur,
-- l'essentiel est invisible pour les yeux. St Exupery.
----------- etienne.lorrain@ibm.net
-- hdc: irq timeout: status=0xd0 { Busy }
-- ide1: reset: success
----------> I like Linux !
--Message-Boundary-7336
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Text from file 'irqpatch.txt'
diff -ur linux-2.1.88-patched/arch/i386/kernel/irq.c linux/arch/i386/kernel/irq.c
--- linux-2.1.88-patched/arch/i386/kernel/irq.c	Sat Mar  7 13:23:57 1998
+++ linux/arch/i386/kernel/irq.c	Sun Mar  8 21:52:24 1998
@@ -176,30 +176,6 @@
 	}
 }
 
-unsigned get_8259A_irq_in_treatment(void)
-{
-	/* Read PIC1 and PIC2 ISR : */
-	return (inb(0xA0) << 8) | inb(0x20);
-}
-
-unsigned get_8259A_irq_waiting(void)
-{
-	register unsigned returned;
-	unsigned long flags;
-
-	save_flags(flags); cli();
-	/* Set PICs to read Interrupt Request Register at address 0x20/0xA0 : */
-	outb(0x0A, 0xA0);
-	outb(0x0A, 0x20);
-	/* Read PIC2 and PIC1 IRR : */
-	returned = (inb(0xA0) << 8) | inb(0x20);
-	/* Reset PICs to read In Service Register at address 0x20/0xA0 : */
-	outb(0x0B, 0x20);
-	outb(0x0B, 0xA0);
-	restore_flags(flags);
-	return returned;
-}
-
 void unmask_generic_irq(unsigned int irq)
 {
 	if (IO_APIC_IRQ(irq))
@@ -232,7 +208,7 @@
 #ifdef __SMP__
 
 /*
- * The IO-APIC (present only in SMP boards) has 8 more hardware
+ * The IO-APIC (persent only in SMP boards) has 8 more hardware
  * interrupt pins, for all of them we define an IRQ vector:
  *
  * raw PCI interrupts 0-3, basically these are the ones used
@@ -294,12 +270,8 @@
 /*
  * Initial irq handlers.
  */
-static unsigned nb_IRQ_no_action = 0;
 
-static void no_action(int cpl, void *dev_id, struct pt_regs *regs)
-{
-	nb_IRQ_no_action++;
-}
+static void no_action(int cpl, void *dev_id, struct pt_regs *regs) { }
 
 /*
  * Note that on a 486, we don't want to do a SIGFPE on an irq13
@@ -352,7 +324,7 @@
 
 	for (i = 0 ; i < NR_IRQS ; i++) {
 		action = irq_action[i];
-		if (!action && !kstat_irqs(i)) 
+		if (!action) 
 			continue;
 		p += sprintf(p, "%3d: ",i);
 #ifndef __SMP__
@@ -367,18 +339,14 @@
 			p += sprintf(p, " IO-APIC ");
 		else
 			p += sprintf(p, "  XT PIC ");
+		p += sprintf(p, "  %s", action->name);
 
-		if (action) {
-			p += sprintf(p, "  %s", action->name);
-			for (action=action->next; action; action = action->next)
-				p += sprintf(p, ", %s", action->name);
-		} else
-			p += sprintf(p, "  unregistered");
+		for (action=action->next; action; action = action->next) {
+			p += sprintf(p, ", %s", action->name);
+		}
 		*p++ = '\n';
 	}
 	p += sprintf(p, "NMI: %10u\n", atomic_read(&nmi_counter));
-	if (nb_IRQ_no_action)
-		p += sprintf(p, "Unaffected: %3u\n", nb_IRQ_no_action);
 #ifdef __SMP__
 	p += sprintf(p, "IPI: %10lu\n", ipi_count);
 #endif		
@@ -1025,7 +993,7 @@
 	for (i=0; i<NR_IRQS; i++)
 		for (j=0; j<NR_CPUS; j++)
 			if (kstat.irqs[j][i] != probe_irqs[j][i])
-				irqs &= ~(1<<i);
+				irqs &= ~(i<<1);
 
 	return irqs;
 }
@@ -1040,7 +1008,7 @@
 			sum += kstat.irqs[j][i];
 			sum -= probe_irqs[j][i];
 		}
-		if (sum && (irqs & (1<<i))) {
+		if (sum && (irqs & (i<<1))) {
 			if (irq_found != -1) {
 				irq_found = -irq_found;
 				goto out;
--Message-Boundary-7336--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu