[PATCH] Re: 2.1.80 no-go

MOLNAR Ingo (mingo@chiara.csoma.elte.hu)
Wed, 21 Jan 1998 17:38:29 +0100 (CET)


On Tue, 20 Jan 1998, Bill Hawes wrote:

> Kernel 2.1.80 doesn't boot for me -- I get keyboard timeouts, then
> timeouts on hda, hdb, etc. [...]

oops, this patch should fix that. It also cleans up booting wrt IO-APIC.
With this patch i can boot a 486 box with or without SMP.

--- linux/init/.main.c.orig Tue Jan 27 05:07:03 1998
+++ linux/init/main.c Tue Jan 27 05:08:33 1998
@@ -927,8 +927,6 @@

#else

-extern void setup_IO_APIC(void);
-
/*
* Multiprocessor idle thread is in arch/...
*/
@@ -1051,7 +1049,6 @@
printk("POSIX conformance testing by UNIFIX\n");
#ifdef __SMP__
smp_init();
- setup_IO_APIC();
#endif
#ifdef CONFIG_SYSCTL
sysctl_init();
--- linux/arch/i386/kernel/.irq.h.orig Tue Jan 27 04:53:40 1998
+++ linux/arch/i386/kernel/irq.h Tue Jan 27 04:54:35 1998
@@ -19,7 +19,12 @@
void setup_IO_APIC (void);
void init_IO_APIC_traps(void);

-extern const unsigned int io_apic_irqs;
+#ifdef __SMP__
+ extern unsigned int io_apic_irqs;
+#else
+ extern const unsigned int io_apic_irqs;
+#endif
+
#define IO_APIC_IRQ(x) ((1<<x) & io_apic_irqs)

#define MAX_IRQ_SOURCES 128
--- linux/arch/i386/kernel/.smp.c.orig Tue Jan 27 04:51:48 1998
+++ linux/arch/i386/kernel/smp.c Tue Jan 27 05:08:24 1998
@@ -927,6 +927,7 @@
if (!smp_found_config)
{
printk(KERN_NOTICE "SMP motherboard not detected. Using dummy APIC emulation.\n");
+ io_apic_irqs = 0;
return;
}

@@ -1087,6 +1088,12 @@
if(smp_b_stepping)
printk(KERN_WARNING "WARNING: SMP operation may be unreliable with B stepping processors.\n");
SMP_PRINTK(("Boot done.\n"));
+
+ /*
+ * Here we can be sure that there is an IO-APIC in the system, lets
+ * go and set it up:
+ */
+ setup_IO_APIC();
}

/*
--- linux/arch/i386/kernel/.irq.c.orig Tue Jan 27 04:53:16 1998
+++ linux/arch/i386/kernel/irq.c Tue Jan 27 05:25:11 1998
@@ -128,7 +128,7 @@
* routed through the IO-APIC, distributed amongst all CPUs, dependent
* on irq traffic and CPU load.
*/
- const unsigned int io_apic_irqs = ~((1<<0)|(1<<2)|(1<<13));
+ unsigned int io_apic_irqs = ~((1<<0)|(1<<2)|(1<<13));
#endif

static inline int ack_irq(int irq)
@@ -179,14 +179,16 @@

void set_8259A_irq_mask(int irq)
{
- if (irq >= 16) {
- printk ("HUH #3 (%d)?\n", irq);
- return;
- }
- if (irq & 8) {
- outb(cached_A1,0xA1);
- } else {
- outb(cached_21,0x21);
+ /*
+ * (it might happen that we see IRQ>15 on a UP box, with SMP
+ * emulation)
+ */
+ if (irq < 16) {
+ if (irq & 8) {
+ outb(cached_A1,0xA1);
+ } else {
+ outb(cached_21,0x21);
+ }
}
}