Index: Makefile
===================================================================
RCS file: /cvs/linux/Makefile,v
retrieving revision 1.119.2.2
diff -u -u -r1.119.2.2 Makefile
--- Makefile	2001/12/29 05:37:46	1.119.2.2
+++ Makefile	2002/04/13 12:24:27
@@ -384,7 +384,7 @@
 endif
 .PHONY: _modinst_post
 _modinst_post: _modinst_post_pcmcia
-	if [ -r System.map ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi
+	if [ -r System.map ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE) || true; fi
 
 # Backwards compatibilty symlinks for people still using old versions
 # of pcmcia-cs with hard coded pathnames on insmod.  Remove
Index: arch/mips/config.in
===================================================================
RCS file: /cvs/linux/arch/mips/config.in,v
retrieving revision 1.154.2.14
diff -u -u -r1.154.2.14 config.in
--- arch/mips/config.in	2002/02/15 21:05:47	1.154.2.14
+++ arch/mips/config.in	2002/04/13 12:24:35
@@ -590,12 +590,12 @@
    comment 'SGI Character devices'
    if [ "$CONFIG_VT" = "y" ]; then
       tristate 'SGI Newport Console support' CONFIG_SGI_NEWPORT_CONSOLE
-      if [ "$CONFIG_SGI_NEWPORT_CONSOLE" != "y" ]; then
-	 define_bool CONFIG_DUMMY_CONSOLE y
-      else
+      if [ "$CONFIG_SGI_NEWPORT_CONSOLE" != "n" ]; then
 	 define_bool CONFIG_FONT_8x16 y
       fi
    fi
+# we always need the dummy console to make the serial console I2 happy
+   define_bool CONFIG_DUMMY_CONSOLE y
    endmenu
 fi
 
Index: arch/mips/boot/addinitrd.c
===================================================================
RCS file: /cvs/linux/arch/mips/boot/addinitrd.c,v
retrieving revision 1.1.6.1
diff -u -u -r1.1.6.1 addinitrd.c
--- arch/mips/boot/addinitrd.c	2001/12/13 21:22:23	1.1.6.1
+++ arch/mips/boot/addinitrd.c	2002/04/13 12:24:35
@@ -2,6 +2,8 @@
  * addinitrd - program to add a initrd image to an ecoff kernel
  *
  * (C) 1999 Thomas Bogendoerfer
+ * minor modifications, cleanup: Guido Guenther <agx@sigcpu.org>
+ *
  */
 
 #include <sys/types.h>
@@ -54,7 +56,7 @@
 		exit (1);
 	}
 
-	if ((fd_vmlinux = open (argv[1],O_RDWR)) < 0)
+	if ((fd_vmlinux = open (argv[1],O_RDONLY)) < 0)
 		 die ("open vmlinux");
 	if (read (fd_vmlinux, &efile, sizeof efile) != sizeof efile)
 		die ("read file header");
@@ -78,6 +80,11 @@
 			swab = 1;
 	}
 
+	/* make sure we have an empty data segment for the initrd */
+	if( eaout.dsize || esecs[1].s_size ) {
+		fprintf(2,"Data segment not empty. Giving up!");
+		exit(1);
+	}
 	if ((fd_initrd = open (argv[2], O_RDONLY)) < 0)
 		die ("open initrd");
 	if (fstat (fd_initrd, &st) < 0)
Index: arch/mips/kernel/proc.c
===================================================================
RCS file: /cvs/linux/arch/mips/kernel/proc.c,v
retrieving revision 1.27.2.7
diff -u -u -r1.27.2.7 proc.c
--- arch/mips/kernel/proc.c	2002/02/15 21:05:48	1.27.2.7
+++ arch/mips/kernel/proc.c	2002/04/13 12:24:35
@@ -98,6 +98,11 @@
 	seq_printf(m, "BogoMIPS\t\t: %lu.%02lu\n",
 	              loops_per_jiffy / (500000/HZ),
 	              (loops_per_jiffy / (5000/HZ)) % 100);
+#ifdef __MIPSEB__
+	seq_printf(m, "byteorder\t\t: big endian\n");
+#else
+	seq_printf(m, "byteorder\t\t: little endian\n");
+#endif
 	seq_printf(m, "wait instruction\t: %s\n", cpu_wait ? "yes" : "no");
 	seq_printf(m, "microsecond timers\t: %s\n",
 	              (mips_cpu.options & MIPS_CPU_COUNTER) ? "yes" : "no");
Index: arch/mips/sgi-ip22/ip22-setup.c
===================================================================
RCS file: /cvs/linux/arch/mips/sgi-ip22/ip22-setup.c,v
retrieving revision 1.1.2.4
diff -u -u -r1.1.2.4 ip22-setup.c
--- arch/mips/sgi-ip22/ip22-setup.c	2002/01/24 23:14:24	1.1.2.4
+++ arch/mips/sgi-ip22/ip22-setup.c	2002/04/13 12:24:36
@@ -27,6 +27,7 @@
 #include <asm/sgi/sgint23.h>
 #include <asm/time.h>
 #include <asm/gdb-stub.h>
+#include <asm/bootinfo.h>
 
 #ifdef CONFIG_REMOTE_DEBUG
 extern void rs_kgdb_hook(int);
@@ -187,19 +188,23 @@
 
 #ifdef CONFIG_VT
 #ifdef CONFIG_SGI_NEWPORT_CONSOLE
-	conswitchp = &newport_con;
+	if( mips_machtype == MACH_SGI_INDY ) {
+		conswitchp = &newport_con;
 
-	screen_info = (struct screen_info) {
-		0, 0,		/* orig-x, orig-y */
-		0,		/* unused */
-		0,		/* orig_video_page */
-		0,		/* orig_video_mode */
-		160,		/* orig_video_cols */
-		0, 0, 0,	/* unused, ega_bx, unused */
-		64,		/* orig_video_lines */
-		0,		/* orig_video_isVGA */
-		16		/* orig_video_points */
-	};
+		screen_info = (struct screen_info) {
+			0, 0,		/* orig-x, orig-y */
+			0,		/* unused */
+			0,		/* orig_video_page */
+			0,		/* orig_video_mode */
+			160,		/* orig_video_cols */
+			0, 0, 0,	/* unused, ega_bx, unused */
+			64,		/* orig_video_lines */
+			0,		/* orig_video_isVGA */
+			16		/* orig_video_points */
+		};
+	} else {
+		conswitchp = &dummy_con;
+	}
 #else
 	conswitchp = &dummy_con;
 #endif
Index: drivers/char/indydog.c
===================================================================
RCS file: /cvs/linux/drivers/char/indydog.c,v
retrieving revision 1.1.2.1
diff -u -u -r1.1.2.1 indydog.c
--- drivers/char/indydog.c	2002/02/25 01:56:10	1.1.2.1
+++ drivers/char/indydog.c	2002/04/13 12:24:37
@@ -24,7 +24,7 @@
 #include <asm/uaccess.h>
 #include <asm/sgi/sgimc.h>
 
-static int indydog_alive;
+static unsigned long indydog_alive;
 static struct sgimc_misc_ctrl *mcmisc_regs; 
 
 static void indydog_ping()
@@ -41,7 +41,7 @@
 {
 	u32 mc_ctrl0;
 	
-	if(indydog_alive)
+	if( test_and_set_bit(0,&indydog_alive) )
 		return -EBUSY;
 #ifdef CONFIG_WATCHDOG_NOWAYOUT
 	MOD_INC_USE_COUNT;
@@ -55,7 +55,6 @@
 	mcmisc_regs->cpuctrl0 = mc_ctrl0;
 	indydog_ping();
 			
-	indydog_alive=1;
 	printk("Started watchdog timer.\n");
 	return 0;
 }
@@ -66,7 +65,6 @@
 	 *	Shut off the timer.
 	 * 	Lock it in if it's a module and we defined ...NOWAYOUT
 	 */
-	 lock_kernel();
 #ifndef CONFIG_WATCHDOG_NOWAYOUT
 	{
 	u32 mc_ctrl0 = mcmisc_regs->cpuctrl0; 
@@ -75,8 +73,7 @@
 	printk("Stopped watchdog timer.\n");
 	}
 #endif
-	indydog_alive=0;
-	unlock_kernel();
+	clear_bit(0,&indydog_alive);
 	return 0;
 }
 
Index: drivers/tc/lk201.c
===================================================================
RCS file: /cvs/linux/drivers/tc/lk201.c,v
retrieving revision 1.5
diff -u -u -r1.5 lk201.c
--- drivers/tc/lk201.c	2001/10/31 04:53:18	1.5
+++ drivers/tc/lk201.c	2002/04/13 12:24:41
@@ -4,6 +4,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
+ * Copyright (C) 1999-2002 Harald Koerfgen <hkoerfg@web.de>
  * Copyright (C) 2001 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
  */
 
@@ -88,11 +89,12 @@
 {
 	int i;
 
-	for (i = 0; i < sizeof(lk201_reset_string); i++)
-		if (info->hook->poll_tx_char(info, lk201_reset_string[i])) {
-			printk(__FUNCTION__" transmit timeout\n");
+	for (i = 0; i < sizeof(lk201_reset_string); i++) {
+		if (info->hook->poll_tx_char(info, lk201_reset_string[i]) < 0) {
 			return -EIO;
 		}
+	}
+
 	return 0;
 }
 
@@ -290,24 +292,37 @@
 
 static int __init lk201_init(struct dec_serial *info)
 {
-	unsigned int ch, id = 0;
-	int result;
+	int ch, id = 0;
 
 	printk("DECstation LK keyboard driver v0.04... ");
+
 
-	result = lk201_reset(info);
-	if (result)
-		return result;
+	if (lk201_reset(info) < 0) {
+		printk("reset failed!\n");
+		return -ENODEV;
+	}
+
 	mdelay(10);
 
 	/*
 	 * Detect whether there is an LK201 or an LK401
 	 * The LK401 has ALT keys...
 	 */
-	info->hook->poll_tx_char(info, LK_CMD_REQ_ID);
+	if (info->hook->poll_tx_char(info, LK_CMD_REQ_ID) < 0) {
+		printk("tx request ID timeout!\n");
+		return -ENODEV;
+	}
+
+	mdelay(10);
+
 	while ((ch = info->hook->poll_rx_char(info)) > 0)
 		id = ch;
 
+	if (ch < 0) {
+		printk("rx request ID timeout!\n");
+		return -ENODEV;
+	}
+
 	switch (id) {
 	case 1:
 		printk("LK201 detected\n");
@@ -318,6 +333,7 @@
 	default:
 		printk("unknown keyboard, ID %d,\n", id);
 		printk("... please report to <linux-mips@oss.sgi.com>\n");
+		break;
 	}
 
 	/*
Index: drivers/tc/zs.c
===================================================================
RCS file: /cvs/linux/drivers/tc/zs.c,v
retrieving revision 1.19.2.1
diff -u -u -r1.19.2.1 zs.c
--- drivers/tc/zs.c	2002/02/14 00:18:50	1.19.2.1
+++ drivers/tc/zs.c	2002/04/13 12:24:44
@@ -5,7 +5,7 @@
  * Derived from drivers/macintosh/macserial.c by Harald Koerfgen.
  *
  * DECstation changes
- * Copyright (C) 1998-2000 Harald Koerfgen
+ * Copyright (C) 1998-2002 Harald Koerfgen
  * Copyright (C) 2000,2001 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
  *
  * For the rest of the code the original Copyright applies:
@@ -456,7 +456,7 @@
 			(*info->hook->rx_char)(ch, flag);
 			return;
   		}
-		
+
 		if (tty->flip.count >= TTY_FLIPBUF_SIZE) {
 			static int flip_buf_ovf;
 			++flip_buf_ovf;
@@ -471,7 +471,9 @@
 
 		*tty->flip.flag_buf_ptr++ = flag;
 		*tty->flip.char_buf_ptr++ = ch;
+#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && !defined(MODULE)
 	ignore_char:
+#endif
 	}
 	if (tty)
 		tty_flip_buffer_push(tty);
@@ -1719,7 +1721,7 @@
 
 static void __init show_serial_version(void)
 {
-	printk("DECstation Z8530 serial driver version 0.05\n");
+	printk("DECstation Z8530 serial driver version 0.06\n");
 }
 
 /*  Initialize Z8530s zs_channels
@@ -2010,32 +2012,27 @@
 
 	if(chan) {
 		int loops = 10000;
-//		int nine = read_zsreg(chan, R9);
 
-		RECOVERY_DELAY;
-//        	write_zsreg(chan, R9, nine & ~MIE);
+ 		RECOVERY_DELAY;
                	wbflush();
 		RECOVERY_DELAY;
 
-        	while (!(*(chan->control) & Tx_BUF_EMP) && --loops)
+		while (loops && !(*(chan->control) & Tx_BUF_EMP)) {
+			loops--;
 	        	RECOVERY_DELAY;
+		}
 
-                if (loops) {
-                        ret = 0;
-        	        *(chan->data) = ch;
-                	wbflush();
+		if (loops) {
+			*(chan->data) = ch;
+			wbflush();
 			RECOVERY_DELAY;
+			ret = 0;
                 } else
-                        ret = -EAGAIN;
+			ret = -EAGAIN;
 
-//        	write_zsreg(chan, R9, nine);
-               	wbflush();
-		RECOVERY_DELAY;
-
-                return ret;
-        }
-
-	return -ENODEV;
+		return ret;
+	} else
+		return -ENODEV;
 }
 
 static int
@@ -2047,15 +2044,16 @@
 	if(chan) {
                 int loops = 10000;
 
-                while((read_zsreg(chan, 0) & Rx_CH_AV) == 0)
-		        loops--;
+                while(loops && ((read_zsreg(chan, 0) & Rx_CH_AV) == 0)) {
+			loops--;
+		}
 
                 if (loops)
                         ret = read_zsdata(chan);
                 else
                         ret = -EAGAIN;
 
-                return ret;
+		return ret;
         } else
                 return -ENODEV;
 }
Index: include/asm-mips/pgtable.h
===================================================================
RCS file: /cvs/linux/include/asm-mips/pgtable.h,v
retrieving revision 1.63.2.6
diff -u -u -r1.63.2.6 pgtable.h
--- include/asm-mips/pgtable.h	2002/02/07 02:39:41	1.63.2.6
+++ include/asm-mips/pgtable.h	2002/04/13 12:24:46
@@ -165,7 +165,7 @@
 #define _PAGE_SILENT_READ           (1<<9)  /* synonym                 */
 #define _PAGE_DIRTY                 (1<<10) /* The MIPS dirty bit      */
 #define _PAGE_SILENT_WRITE          (1<<10)
-#define _CACHE_UNCACHED             (1<<11) /* R4[0246]00              */
+#define _CACHE_UNCACHED             (1<<11)
 #define _CACHE_MASK                 (1<<11)
 #define _CACHE_CACHABLE_NONCOHERENT 0
 
@@ -519,9 +519,19 @@
 extern void update_mmu_cache(struct vm_area_struct *vma,
 				unsigned long address, pte_t pte);
 
-#define SWP_TYPE(x)		(((x).val >> 1) & 0x3f)
+/* Swap entries must have VALID and GLOBAL bits cleared. */
+#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
+
+#define SWP_TYPE(x)		(((x).val >> 1) & 0x7f)
+#define SWP_OFFSET(x)		((x).val >> 10)
+#define SWP_ENTRY(type,offset)	((swp_entry_t) { ((type) << 1) | ((offset) << 10) })
+#else
+
+#define SWP_TYPE(x)		(((x).val >> 1) & 0x1f)
 #define SWP_OFFSET(x)		((x).val >> 8)
 #define SWP_ENTRY(type,offset)	((swp_entry_t) { ((type) << 1) | ((offset) << 8) })
+#endif
+
 #define pte_to_swp_entry(pte)	((swp_entry_t) { pte_val(pte) })
 #define swp_entry_to_pte(x)	((pte_t) { (x).val })
 
