Subject: [patch] getting cvs to run on IP22

From: Florian Lohoff <[email-masked]>
Date: Fri, 28 Apr 2000 15:55:05 +0200

Hi,
i had the time today and retry getting 2.3.99pre6 (current cvs)
to run on SGI. I'll just attach the patch with what you get
the kernel to work.

Following things get changes:

- Move __initcall(rs_init) to drivers/char/sgiserial.c 
  This is obvious and rs_init in mips/sgi/kernel/setup.c
  is definitly only a dirty hack i introduced

- Do a different (probably incorrect but working) 
  memory setup -  I had the problem of not having any
  DMAable pages after initialization. Now ALL pages
  get into ZONE_DMA which might be right ( I surrounded
  this by CONFIG_ISA and CONFIG_PCI as the PCee controllers
  mostly have DMA limits )

- Call init_serial_console even if CONFIG_SERIAL isnt set
  (but CONFIG_SGI_SERIAL)

- Remove the console initialisation from sgi/kernel/setup.c
  as this hmmm - isnt the thing i think is correct. 
  Normally a kernel "console=" parameter should override
  the setup of the prom (i have ArcEnv = g but want serial console)

TODO:

- Cleanup of mips/arc/memory.c changes for kernel allocation 
  I seem to have luck to get the only broken prom version on the
  planet not allocating the kernel space.
  So - prevent allocating already allocated pages or ignorant
  freeing of ARC memory chunks for some broken proms.

- Clean way of setting the console (Arc Console Env as fallback
  and priotity to console= command line and support
  for the major 5 minor 1 console device like on i386 etc ... 

I would like to have some comments on the different fragments.

Flo

Index: arch/mips/mm/init.c
===================================================================
RCS file: /cvs/linux/arch/mips/mm/init.c,v
retrieving revision 1.27
diff -u -r1.27 init.c
--- arch/mips/mm/init.c	2000/02/23 01:33:56	1.27
+++ arch/mips/mm/init.c	2000/04/28 13:47:55
@@ -256,12 +256,16 @@
 	max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
 	low = max_low_pfn;
 
+#if defined(CONFIG_PCI) || defined(CONFIG_ISA)
 	if (low < max_dma)
 		zones_size[ZONE_DMA] = low;
 	else {
 		zones_size[ZONE_DMA] = max_dma;
 		zones_size[ZONE_NORMAL] = low - max_dma;
 	}
+#else
+	zones_size[ZONE_DMA] = low;
+#endif
 
 	free_area_init(zones_size);
 }
Index: arch/mips/sgi/kernel/setup.c
===================================================================
RCS file: /cvs/linux/arch/mips/sgi/kernel/setup.c,v
retrieving revision 1.32
diff -u -r1.32 setup.c
--- arch/mips/sgi/kernel/setup.c	2000/04/06 20:26:58	1.32
+++ arch/mips/sgi/kernel/setup.c	2000/04/28 13:47:55
@@ -160,20 +160,6 @@
 	/* Now enable boardcaches, if any. */
 	indy_sc_init();
 
-#ifdef CONFIG_SERIAL_CONSOLE
-	/* ARCS console environment variable is set to "g?" for
-	 * graphics console, it is set to "d" for the first serial
-	 * line and "d2" for the second serial line.
-	 */
-	ctype = ArcGetEnvironmentVariable("console");
-	if(*ctype == 'd') {
-		if(*(ctype+1)=='2')
-			console_setup ("ttyS1");
-		else
-			console_setup ("ttyS0");
-	}
-#endif
-
 #ifdef CONFIG_REMOTE_DEBUG
 	kgdb_ttyd = prom_getcmdline();
 	if ((kgdb_ttyd = strstr(kgdb_ttyd, "kgdb=ttyd")) != NULL) {
@@ -195,10 +181,6 @@
 	}
 #endif
 
-#ifdef CONFIG_SGI_PROM_CONSOLE
-	console_setup("ttyS0");
-#endif
- 
 	sgi_volume_set(simple_strtoul(ArcGetEnvironmentVariable("volume"), NULL, 10));
 
 #ifdef CONFIG_VT
@@ -230,4 +212,3 @@
 	init_vino();
 #endif
 }
-__initcall(rs_init);
Index: drivers/char/tty_io.c
===================================================================
RCS file: /cvs/linux/drivers/char/tty_io.c,v
retrieving revision 1.33
diff -u -r1.33 tty_io.c
--- drivers/char/tty_io.c	2000/04/28 01:09:37	1.33
+++ drivers/char/tty_io.c	2000/04/28 13:47:58
@@ -2189,7 +2189,7 @@
 #ifdef CONFIG_SERIAL_CONSOLE
 #ifdef CONFIG_8xx
 	console_8xx_init();
-#elif defined(CONFIG_SERIAL) 	
+#elif defined(CONFIG_SERIAL) || defined(CONFIG_SGI_SERIAL)
 	serial_console_init();
 #endif /* CONFIG_8xx */
 #if defined(CONFIG_MVME162_SCC) || defined(CONFIG_BVME6000_SCC) || defined(CONFIG_MVME147_SCC)
Index: drivers/sgi/char/sgiserial.c
===================================================================
RCS file: /cvs/linux/drivers/sgi/char/sgiserial.c,v
retrieving revision 1.23
diff -u -r1.23 sgiserial.c
--- drivers/sgi/char/sgiserial.c	2000/01/27 01:05:35	1.23
+++ drivers/sgi/char/sgiserial.c	2000/04/28 13:48:21
@@ -2251,3 +2251,5 @@
 {
 	register_console(&sgi_console_driver);
 }
+
+__initcall(rs_init);

-- 
Florian Lohoff		[email-masked]		      	+49-subject-2-change
"Technology is a constant battle between manufacturers producing bigger and
more idiot-proof systems and nature producing bigger and better idiots."

---

From: Mike Hill <[email-masked]>
Date: Sat, 29 Apr 2000 13:38:42 -0400

>>>>> "Flo" == Florian Lohoff <[email-masked]> writes:

    Flo> Hi, i had the time today and retry getting 2.3.99pre6
    Flo> (current cvs) to run on SGI. I'll just attach the patch with
    Flo> what you get the kernel to work.

Patched but quits like below (native compile).  Am I missing something in my
.config?

Thanks,

Mike

gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -O2
-fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -mcpu=r4600 -mips2 -pipe
-c -o init/main.o init/main.c
In file included from /usr/src/linux/include/asm/bitops.h:13,
                 from /usr/src/linux/include/linux/fs.h:25,
                 from /usr/src/linux/include/linux/capability.h:13,
                 from /usr/src/linux/include/linux/binfmts.h:5,
                 from /usr/src/linux/include/linux/sched.h:9,
                 from /usr/src/linux/include/linux/mm.h:4,
                 from /usr/src/linux/include/linux/slab.h:14,
                 from /usr/src/linux/include/linux/malloc.h:4,
                 from /usr/src/linux/include/linux/proc_fs.h:5,
                 from init/main.c:15:
/usr/src/linux/include/asm/byteorder.h:24: linux/byteorder/big_endian.h: No
such file or directory
init/main.c:24: linux/raid/md.h: No such file or directory
/usr/src/linux/include/asm/bitops.h: In function `ext2_find_next_zero_bit':
In file included from /usr/src/linux/include/linux/fs.h:25,
                 from /usr/src/linux/include/linux/capability.h:13,
                 from /usr/src/linux/include/linux/binfmts.h:5,
                 from /usr/src/linux/include/linux/sched.h:9,
                 from /usr/src/linux/include/linux/mm.h:4,
                 from /usr/src/linux/include/linux/slab.h:14,
                 from /usr/src/linux/include/linux/malloc.h:4,
                 from /usr/src/linux/include/linux/proc_fs.h:5,
                 from init/main.c:15:
/usr/src/linux/include/asm/bitops.h:512: warning: implicit declaration of
function `__swab32'
make: *** [init/main.o] Error 1