Re: reserve legacy io regions on powermac

From: Olaf Hering
Date: Fri Jul 23 2004 - 11:49:37 EST


On Wed, Jul 21, Olaf Hering wrote:

>
> Anton pointed this out.
>
> ppc32 can boot one single binary on prep, chrp and pmac boards.
> pmac has no legacy io, probing for PC style legacy hardware leads to a
> hard crash.
> Several patches exist to prevent serial, floppy, ps2, parport and other
> drivers from probing these io ports.
> I think the simplest fix for 2.6 is a request_region of the problematic
> areas.

This one works for me with serial console and a pccard modem.


diff -purN linux-2.6.7/arch/ppc/kernel/setup.c linux-2.6.8-rc2/arch/ppc/kernel/setup.c
--- linux-2.6.7/arch/ppc/kernel/setup.c 2004-07-23 18:30:32.983641453 +0200
+++ linux-2.6.8-rc2/arch/ppc/kernel/setup.c 2004-07-23 18:25:40.371381030 +0200
@@ -477,6 +477,8 @@ platform_init(unsigned long r3, unsigned

#ifdef CONFIG_SERIAL_CORE_CONSOLE
extern char *of_stdout_device;
+int do_not_try_pc_legacy_8250_console;
+EXPORT_SYMBOL(do_not_try_pc_legacy_8250_console);

static int __init set_preferred_console(void)
{
@@ -518,10 +520,14 @@ static int __init set_preferred_console(
return -ENODEV;
}
}
- } else if (strcmp(name, "ch-a") == 0)
+ } else if (strcmp(name, "ch-a") == 0) {
+ do_not_try_pc_legacy_8250_console = 1;
offset = 0;
- else if (strcmp(name, "ch-b") == 0)
+ }
+ else if (strcmp(name, "ch-b") == 0) {
+ do_not_try_pc_legacy_8250_console = 1;
offset = 1;
+ }
else
return -ENODEV;
return add_preferred_console("ttyS", offset, NULL);
diff -purN linux-2.6.7/arch/ppc/platforms/pmac_pci.c linux-2.6.8-rc2/arch/ppc/platforms/pmac_pci.c
--- linux-2.6.7/arch/ppc/platforms/pmac_pci.c 2004-06-16 07:19:23.000000000 +0200
+++ linux-2.6.8-rc2/arch/ppc/platforms/pmac_pci.c 2004-07-23 16:40:18.092808076 +0200
@@ -888,6 +888,9 @@ pmac_pcibios_fixup(void)
{
/* Fixup interrupts according to OF tree */
pcibios_fixup_OF_interrupts();
+ request_region(0x0UL, 0x2e0UL, "reserved legacy io");
+ request_region(0x300UL, 0xe0UL, "reserved legacy io");
+ request_region(0x400UL, 0x10000UL-0x400UL, "reserved legacy io");
}

int __pmac
diff -purN linux-2.6.7/drivers/serial/8250.c linux-2.6.8-rc2/drivers/serial/8250.c
--- linux-2.6.7/drivers/serial/8250.c 2004-07-23 18:30:39.200571363 +0200
+++ linux-2.6.8-rc2/drivers/serial/8250.c 2004-07-23 18:22:22.607426922 +0200
@@ -36,6 +36,10 @@
#include <asm/io.h>
#include <asm/irq.h>

+#ifndef NO_PC_LEGACY_SERIAL_8250_CONSOLE
+#define do_not_try_pc_legacy_8250_console (0)
+#endif
+
#if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
@@ -2017,6 +2021,10 @@ static struct console serial8250_console

static int __init serial8250_console_init(void)
{
+ if(do_not_try_pc_legacy_8250_console) {
+ printk("%s: nothing to do on this board\n",__FUNCTION__);
+ return -ENODEV;
+ }
serial8250_isa_init_ports();
register_console(&serial8250_console);
return 0;
@@ -2166,6 +2174,11 @@ static int __init serial8250_init(void)
{
int ret, i;

+ if(do_not_try_pc_legacy_8250_console) {
+ printk("%s: nothing to do on this board\n",__FUNCTION__);
+ return -ENODEV;
+ }
+
printk(KERN_INFO "Serial: 8250/16550 driver $Revision: 1.90 $ "
"%d ports, IRQ sharing %sabled\n", (int) UART_NR,
share_irqs ? "en" : "dis");
diff -purN linux-2.6.7/include/asm-ppc/io.h linux-2.6.8-rc2/include/asm-ppc/io.h
--- linux-2.6.7/include/asm-ppc/io.h 2004-07-23 18:30:41.815545307 +0200
+++ linux-2.6.8-rc2/include/asm-ppc/io.h 2004-07-23 18:21:56.999578333 +0200
@@ -399,6 +399,10 @@ static inline int isa_check_signature(un
return 0;
}

+#define NO_PC_LEGACY_SERIAL_8250_CONSOLE 1
+extern int do_not_try_pc_legacy_8250_console;
+
+
#endif /* _PPC_IO_H */

#ifdef CONFIG_8260_PCI9

--
USB is for mice, FireWire is for men!

sUse lINUX ag, nÃRNBERG
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/