[PATCH] ISAPNP using an invalid IO_APIC IRQ

From: M.H.VanLeeuwen (vanl@megsinet.net)
Date: Thu Sep 21 2000 - 02:01:49 EST


Linus,

Is this patch acceptable?

info & patch below.

Martin
----------------------------------------------------------------
>>Jaroslav
>>
>>Basically, this patch discards any unusable IO_APIC IRQs from the list of IRQs
>>that ISA PNP is trying to allocate from - but only if IO_APIC IRQs are available.
>>
>>Comments?
>>Martin

Jaroslav Kysela wrote:
>
>It works only for i386.
>
>I suggest to add:
>
>#ifndef IO_APIC_IRQ
I used CONFIG_X86_IO_APIC instead
>#define IO_APIC_IRQ(x)
>#define io_apic_irqs 0
>#endif
>
>Also, isapnp_proc.c shouldn't be changed. I prefer to see all possible
>IRQs, although they can't be used. Feel free to post this patch to Linus
>and lkml.

I left in the patch for isapnp_proc.c just in case...

>
> Jaroslav
updated patch

--- /home/mhvl/linux.orig/drivers/pnp/isapnp.c Tue Jul 25 20:25:14 2000
+++ /home/mhvl/linux/drivers/pnp/isapnp.c Wed Sep 20 20:59:56 2000
@@ -33,10 +33,10 @@
 #include <linux/delay.h>
 #include <asm/io.h>
 #include <asm/dma.h>
-#include <asm/irq.h>
 #include <linux/pci.h>
 #include <linux/init.h>
 #include <linux/isapnp.h>
+#include <linux/irq.h>

 LIST_HEAD(isapnp_cards);
 LIST_HEAD(isapnp_devices);
@@ -48,6 +48,11 @@
 #define ISAPNP_DEBUG
 #endif

+#ifndef CONFIG_X86_IO_APIC
+#define IO_APIC_IRQ(x) 0
+#define io_apic_irqs 0
+#endif
+
 struct resource *pidxr_res = NULL;
 struct resource *pnpwrp_res = NULL;
 struct resource *isapnp_rdp_res = NULL;
@@ -1598,6 +1603,8 @@

        if (irq < 0 || irq > 15)
                return 1;
+ if (!IO_APIC_IRQ(irq) && io_apic_irqs)
+ return 1;
        for (i = 0; i < 16; i++) {
                if (isapnp_reserve_irq[i] == irq)
                        return 1;
--- /home/mhvl/linux.orig/drivers/pnp/isapnp_proc.c Wed Jul 12 23:58:43 2000
+++ /home/mhvl/linux/drivers/pnp/isapnp_proc.c Tue Sep 19 17:52:25 2000
@@ -30,6 +30,12 @@
 #include <asm/uaccess.h>
 #include <linux/smp_lock.h>
 #include <linux/isapnp.h>
+#include <linux/irq.h>
+
+#ifndef CONFIG_X86_IO_APIC
+#define IO_APIC_IRQ(x) 0
+#define io_apic_irqs 0
+#endif

 struct isapnp_info_buffer {
        char *buffer; /* pointer to begin of buffer */
@@ -448,7 +454,7 @@

        isapnp_printf(buffer, "%sIRQ ", space);
        for (i = 0; i < 16; i++)
- if (irq->map & (1<<i)) {
+ if (irq->map & (1<<i) && (IO_APIC_IRQ(i) || !io_apic_irqs)) {
                        if (!first) {
                                isapnp_printf(buffer, ",");
                        } else {

--------------------------------------------------------------------------
>From previous e-mails

"M.H.VanLeeuwen" wrote:
>
> Jaroslav Kysela wrote:
> >
> > On Tue, 29 Aug 2000, M.H.VanLeeuwen wrote:
> >
> > > With default BIOS settings, IRQ 5 is unavailable for ISA yet
> > > it is being assigned by the ne.c driver and NFS root system
> > > doesn't finish booting.
> > >
> > > Is this a driver problem or a ISAPNP problem?
> >
> > It is general IRQ manager problem. ISA PnP code cannot determine which
> > interrupts cannot be used. I think that we need some next layer between
> > IO APIC control code and Plug & Play routines to exchange this information
> > to prevent allocation of a free but unuseable IRQ for ISA PnP devices.
> >
> > Jaroslav
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 21:00:24 EST