Index: Makefile
===================================================================
RCS file: /home/cvs/linux/Makefile,v
retrieving revision 1.119.2.6
diff -u -u -r1.119.2.6 Makefile
--- Makefile	10 Sep 2002 15:32:47 -0000	1.119.2.6
+++ Makefile	4 Oct 2002 22:47:25 -0000
@@ -413,7 +413,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/arc/arc_con.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/arc/arc_con.c,v
retrieving revision 1.1.4.3
diff -u -u -r1.1.4.3 arc_con.c
--- arch/mips/arc/arc_con.c	5 Aug 2002 23:53:30 -0000	1.1.4.3
+++ arch/mips/arc/arc_con.c	4 Oct 2002 22:47:35 -0000
@@ -39,7 +39,7 @@
 }
 
 static struct console arc_cons = {
-	name:		"ttyS",
+	name:		"arc",
 	write:		prom_console_write,
 	device:		prom_console_device,
 	setup:		prom_console_setup,
Index: arch/mips/boot/addinitrd.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/boot/addinitrd.c,v
retrieving revision 1.1.6.2
diff -u -u -r1.1.6.2 addinitrd.c
--- arch/mips/boot/addinitrd.c	5 Aug 2002 23:53:31 -0000	1.1.6.2
+++ arch/mips/boot/addinitrd.c	4 Oct 2002 22:47:36 -0000
@@ -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: /home/cvs/linux/arch/mips/kernel/proc.c,v
retrieving revision 1.27.2.10
diff -u -u -r1.27.2.10 proc.c
--- arch/mips/kernel/proc.c	15 Jul 2002 00:02:56 -0000	1.27.2.10
+++ arch/mips/kernel/proc.c	4 Oct 2002 22:47:37 -0000
@@ -105,6 +105,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/kernel/setup.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/kernel/setup.c,v
retrieving revision 1.96.2.27
diff -u -u -r1.96.2.27 setup.c
--- arch/mips/kernel/setup.c	2 Sep 2002 16:11:44 -0000	1.96.2.27
+++ arch/mips/kernel/setup.c	4 Oct 2002 22:47:38 -0000
@@ -236,6 +236,38 @@
 	}
 }
 
+static inline void parse_rd_cmdline(unsigned long* rd_start, unsigned long* rd_end)
+{
+	char c = ' ', *to = command_line, *from = saved_command_line;
+	int len = 0;
+	unsigned long rd_size = 0;
+
+	for (;;) {
+		/*
+		 * "rd_start=0xNNNNNNNN" defines the memory address of an initrd
+		 * "rd_size=0xNN" it's size
+		 */
+		if (c == ' ' && !memcmp(from, "rd_start=", 9)) {
+			if (to != command_line)
+				to--;
+			(*rd_start) = memparse(from + 9, &from);
+		}
+		if (c == ' ' && !memcmp(from, "rd_size=", 8)) {
+			if (to != command_line)
+				to--;
+			rd_size = memparse(from + 8, &from);
+		}
+		c = *(from++);
+		if (!c)
+			break;
+		if (CL_SIZE <= ++len)
+			break;
+		*(to++) = c;
+	}
+	*to = '\0';
+	(*rd_end) = (*rd_start) + rd_size;
+}
+
 void __init setup_arch(char **cmdline_p)
 {
 	void atlas_setup(void);
@@ -264,10 +296,7 @@
 
 	unsigned long bootmap_size;
 	unsigned long start_pfn, max_pfn, max_low_pfn, first_usable_pfn;
-#ifdef CONFIG_BLK_DEV_INITRD
-	unsigned long tmp;
-	unsigned long* initrd_header;
-#endif
+	unsigned long end = &_end;
 
 	int i;
 
@@ -449,22 +478,18 @@
 #define MAXMEM_PFN	PFN_DOWN(MAXMEM)
 
 #ifdef CONFIG_BLK_DEV_INITRD
-	tmp = (((unsigned long)&_end + PAGE_SIZE-1) & PAGE_MASK) - 8;
-	if (tmp < (unsigned long)&_end)
-		tmp += PAGE_SIZE;
-	initrd_header = (unsigned long *)tmp;
-	if (initrd_header[0] == 0x494E5244) {
-		initrd_start = (unsigned long)&initrd_header[2];
-		initrd_end = initrd_start + initrd_header[1];
+	parse_rd_cmdline(&initrd_start, &initrd_end);
+	if(initrd_start && initrd_end)
+		end = initrd_end;
+	else {
+		initrd_start = initrd_end = 0;
 	}
-	start_pfn = PFN_UP(__pa((&_end)+(initrd_end - initrd_start) + PAGE_SIZE));
-#else
+#endif /* CONFIG_BLK_DEV_INITRD */
 	/*
 	 * Partially used pages are not usable - thus
 	 * we are rounding upwards.
 	 */
-	start_pfn = PFN_UP(__pa(&_end));
-#endif	/* CONFIG_BLK_DEV_INITRD */
+	start_pfn = PFN_UP(__pa(end));
 
 	/* Find the highest page frame number we have available.  */
 	max_pfn = 0;
Index: arch/mips/sgi-ip22/ip22-gio.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/sgi-ip22/ip22-gio.c,v
retrieving revision 1.1.2.3
diff -u -u -r1.1.2.3 ip22-gio.c
--- arch/mips/sgi-ip22/ip22-gio.c	5 Aug 2002 23:53:35 -0000	1.1.2.3
+++ arch/mips/sgi-ip22/ip22-gio.c	4 Oct 2002 22:47:39 -0000
@@ -69,14 +69,12 @@
 	int i;
 	char *p = buf;
 
-	p += sprintf(p, "GIO devices found:\n");
 	for (i = 0; i < GIO_NUM_SLOTS; i++) {
 		if (gio_slot[i].flags & GIO_NO_DEVICE)
 			continue;
-		p += sprintf(p, "  Slot %s, DeviceId 0x%02x\n",
-			     gio_slot[i].slot_name, gio_slot[i].device);
-		p += sprintf(p, "    BaseAddr 0x%08lx, MapSize 0x%08x\n",
-			     gio_slot[i].base_addr, gio_slot[i].map_size);
+		p += sprintf(p, "%s 0x%02x 0x%08lx 0x%08x\n",
+				gio_slot[i].slot_name, gio_slot[i].device,
+				gio_slot[i].base_addr, gio_slot[i].map_size);
 	}
 
 	return p - buf;
@@ -84,7 +82,16 @@
 
 void create_gio_proc_entry(void)
 {
-	create_proc_read_entry("gio", 0, NULL, gio_read_proc, NULL);
+	int i;
+
+	for (i = 0; i < GIO_NUM_SLOTS; i++) {
+		/* only create proc entry if we have at least one device */
+		if (! (gio_slot[i].flags & GIO_NO_DEVICE))
+			if( proc_mkdir("bus/gio", NULL) )
+				create_proc_read_entry("bus/gio/devices", 0,
+						NULL, gio_read_proc, NULL);
+			break;
+	}
 }
 
 /**
Index: arch/mips/sgi-ip22/ip22-setup.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/sgi-ip22/ip22-setup.c,v
retrieving revision 1.1.2.13
diff -u -u -r1.1.2.13 ip22-setup.c
--- arch/mips/sgi-ip22/ip22-setup.c	23 Jul 2002 16:39:10 -0000	1.1.2.13
+++ arch/mips/sgi-ip22/ip22-setup.c	4 Oct 2002 22:47:40 -0000
@@ -162,19 +162,22 @@
 	 * line and "d2" for the second serial line.
 	 */
 	ctype = ArcGetEnvironmentVariable("console");
-	if (*ctype == 'd') {
+	if (ctype && *ctype == 'd') {
 #ifdef CONFIG_SERIAL_CONSOLE
 		if(*(ctype + 1) == '2')
 			console_setup("ttyS1");
 		else
 			console_setup("ttyS0");
 #endif
-	} else {
+	}
 #ifdef CONFIG_ARC_CONSOLE
-		prom_flags &= PROM_FLAG_USE_AS_CONSOLE;
-		console_setup("ttyS0");
-#endif
+	else if (!ctype || *ctype != 'g') {
+		/* Use ARC if we don't want serial ('d') or
+		 * Newport ('g'). */
+		prom_flags |= PROM_FLAG_USE_AS_CONSOLE;
+		console_setup("arc");
 	}
+#endif
 
 #ifdef CONFIG_REMOTE_DEBUG
 	kgdb_ttyd = prom_getcmdline();
@@ -201,7 +204,7 @@
 
 #ifdef CONFIG_VT
 #ifdef CONFIG_SGI_NEWPORT_CONSOLE
-	{
+	if (ctype && *ctype == 'g'){
 		unsigned long *gfxinfo;
 		long (*__vec)(void) = (void *) *(long *)((PROMBLOCK)->pvector + 0x20);
 
@@ -209,29 +212,29 @@
 		sgi_gfxaddr = ((gfxinfo[1] >= 0xa0000000
 			       && gfxinfo[1] <= 0xc0000000)
 			       ? gfxinfo[1] - 0xa0000000 : 0);
+
+		/* newport addresses? */
+		if (sgi_gfxaddr == 0x1f0f0000 || sgi_gfxaddr == 0x1f4f0000) {
+			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 */
+			};
+		}
 	}
-	/* newport addresses? */
-	if (sgi_gfxaddr == 0x1f0f0000 || sgi_gfxaddr == 0x1f4f0000) {
-		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 */
-		};
-	} else {
-		conswitchp = &dummy_con;
-	}
-#else
-#ifdef CONFIG_DUMMY_CONSOLE
-	conswitchp = &dummy_con;
 #endif
+#ifdef CONFIG_DUMMY_CONSOLE
+	/* Either if newport console wasn't used or failed to initialize. */
+	if(conswitchp != &newport_con)
+		conswitchp = &dummy_con;
 #endif
 #endif
 
Index: drivers/char/indydog.c
===================================================================
RCS file: /home/cvs/linux/drivers/char/indydog.c,v
retrieving revision 1.1.2.3
diff -u -u -r1.1.2.3 indydog.c
--- drivers/char/indydog.c	30 Jun 2002 12:07:12 -0000	1.1.2.3
+++ drivers/char/indydog.c	4 Oct 2002 22:47:48 -0000
@@ -39,7 +39,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;
@@ -51,7 +51,6 @@
 	mcmisc_regs->cpuctrl0 = mc_ctrl0;
 	indydog_ping();
 			
-	indydog_alive = 1;
 	printk("Started watchdog timer.\n");
 	
 	return 0;
@@ -63,7 +62,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; 
@@ -72,9 +70,7 @@
 	printk("Stopped watchdog timer.\n");
 	}
 #endif
-	indydog_alive = 0;
-	unlock_kernel();
-	
+	clear_bit(0,&indydog_alive);
 	return 0;
 }
 
