

For some reason the hack of setting iobase and mapbase to zero to indicate
that the port is used by kgdb isn't working.

Create a new field for it instead.


 drivers/serial/8250.c       |   20 +++++++++++---------
 drivers/serial/core.c       |    5 +++++
 include/linux/serial_core.h |    4 +++-
 3 files changed, 19 insertions(+), 10 deletions(-)

diff -puN drivers/serial/8250.c~kgdb-serial-fix drivers/serial/8250.c
--- 25/drivers/serial/8250.c~kgdb-serial-fix	2003-08-03 01:50:48.000000000 -0700
+++ 25-akpm/drivers/serial/8250.c	2003-08-03 01:51:53.000000000 -0700
@@ -1183,6 +1183,7 @@ static void serial8250_break_ctl(struct 
 	serial_out(up, UART_LCR, up->lcr);
 	spin_unlock_irqrestore(&up->port.lock, flags);
 }
+
 #ifdef CONFIG_KGDB
 static int kgdb_irq = -1;
 #endif
@@ -1192,11 +1193,12 @@ static int serial8250_startup(struct uar
 	struct uart_8250_port *up = (struct uart_8250_port *)port;
 	unsigned long flags;
 	int retval;
+
 #ifdef CONFIG_KGDB
-	if ( up->port.irq == kgdb_irq){
+	if (up->port.irq == kgdb_irq)
 		return -EBUSY;
-	}
 #endif
+
 	if (up->port.type == PORT_16C950) {
 		/* Wake up and initialize UART */
 		up->acr = 0;
@@ -1861,9 +1863,8 @@ static void __init serial8250_register_p
 		struct uart_8250_port *up = &serial8250_ports[i];
 
 #ifdef CONFIG_KGDB
-		if(up->port.irq == kgdb_irq){
-			up->port.iobase = up->port.mapbase = 0;
-		}
+		if (up->port.irq == kgdb_irq)
+			up->port.kgdb = 1;
 #endif
 		up->port.line = i;
 		up->port.ops = &serial8250_pops;
@@ -2128,6 +2129,7 @@ void serial8250_resume_port(int line, u3
 {
 	uart_resume_port(&serial8250_reg, &serial8250_ports[line].port, level);
 }
+
 #ifdef CONFIG_KGDB
 /*
  * Find all the ports using the given irq and shut them down.
@@ -2142,17 +2144,17 @@ void shutdown_for_kgdb(struct async_stru
 	kgdb_irq = irq;			/* save for later init */
 	for (ttyS = 0; ttyS < UART_NR; ttyS++){
 		up =  &serial8250_ports[ttyS];
-		if( up->port.irq == irq && (irq_lists + irq)->head){
+		if (up->port.irq == irq && (irq_lists + irq)->head) {
 #ifdef CONFIG_DEBUG_SPINLOCK   /* ugly business... */
-			if(up->port.lock.magic != SPINLOCK_MAGIC){
+			if(up->port.lock.magic != SPINLOCK_MAGIC)
 				spin_lock_init(&up->port.lock);
-			}
 #endif
 			serial8250_shutdown(&up->port);
 		}
         }
 }
-#endif
+#endif	/* CONFIG_KGDB */
+
 static int __init serial8250_init(void)
 {
 	int ret, i;
diff -puN include/linux/serial_core.h~kgdb-serial-fix include/linux/serial_core.h
--- 25/include/linux/serial_core.h~kgdb-serial-fix	2003-08-03 01:50:48.000000000 -0700
+++ 25-akpm/include/linux/serial_core.h	2003-08-03 01:52:21.000000000 -0700
@@ -149,7 +149,9 @@ struct uart_port {
 	unsigned char		x_char;			/* xon/xoff char */
 	unsigned char		regshift;		/* reg offset shift */
 	unsigned char		iotype;			/* io access style */
-
+#ifdef CONFIG_KGDB
+	int			kgdb;			/* in use by kgdb */
+#endif
 #define UPIO_PORT		(0)
 #define UPIO_HUB6		(1)
 #define UPIO_MEM		(2)
diff -puN drivers/serial/core.c~kgdb-serial-fix drivers/serial/core.c
--- 25/drivers/serial/core.c~kgdb-serial-fix	2003-08-03 01:50:48.000000000 -0700
+++ 25-akpm/drivers/serial/core.c	2003-08-03 01:52:40.000000000 -0700
@@ -1985,6 +1985,11 @@ uart_configure_port(struct uart_driver *
 {
 	unsigned int flags;
 
+#ifdef CONFIG_KGDB
+	if (port->kgdb)
+		return;
+#endif
+
 	/*
 	 * If there isn't a port here, don't do anything further.
 	 */

_
