public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Olaf Hering <olh@suse.de>
To: linux-kernel@vger.kernel.org, Paul Mackeras <paulus@samba.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Olaf Hering <olh@suse.de>
Subject: Re: reserve legacy io regions on powermac
Date: Fri, 23 Jul 2004 18:44:50 +0200	[thread overview]
Message-ID: <20040723164450.GA3836@suse.de> (raw)
In-Reply-To: <20040721091249.GA1336@suse.de>

 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

  parent reply	other threads:[~2004-07-23 16:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-21  9:12 reserve legacy io regions on powermac Olaf Hering
2004-07-21 14:51 ` Benjamin Herrenschmidt
2004-07-21 14:56   ` Olaf Hering
2004-07-21 15:48     ` Geert Uytterhoeven
2004-07-21 17:08       ` Segher Boessenkool
2004-07-21 20:07   ` Jesse Barnes
2004-07-22  8:21     ` Segher Boessenkool
2004-07-23 14:21   ` Olaf Hering
2004-07-23 16:44 ` Olaf Hering [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-07-22  0:59 Albert Cahalan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040723164450.GA3836@suse.de \
    --to=olh@suse.de \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox