patch-1.3.93 linux/arch/sparc/kernel/setup.c

Next file: linux/arch/sparc/kernel/signal.c
Previous file: linux/arch/sparc/kernel/sclow.S
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.92/linux/arch/sparc/kernel/setup.c linux/arch/sparc/kernel/setup.c
@@ -1,4 +1,4 @@
-/*  $Id: setup.c,v 1.54 1996/02/25 06:49:18 davem Exp $
+/*  $Id: setup.c,v 1.60 1996/04/04 16:30:28 tridge Exp $
  *  linux/arch/sparc/kernel/setup.c
  *
  *  Copyright (C) 1995  David S. Miller (davem@caip.rutgers.edu)
@@ -13,6 +13,7 @@
 #include <linux/ptrace.h>
 #include <linux/malloc.h>
 #include <linux/ldt.h>
+#include <linux/smp.h>
 #include <linux/user.h>
 #include <linux/a.out.h>
 #include <linux/tty.h>
@@ -47,7 +48,6 @@
 	16                      /* orig-video-points */
 };
 
-char wp_works_ok = 0;
 unsigned int phys_bytes_of_ram, end_of_phys_memory;
 
 unsigned long bios32_init(unsigned long memory_start, unsigned long memory_end)
@@ -55,7 +55,7 @@
 	return memory_start;
 }
 
-/* Typing sync at the prom prompt calls the function pointed to by
+/* Typing sync at the prom promptcalls the function pointed to by
  * romvec->pv_synchook which I set to the following function.
  * This should sync all filesystems and return, for now it just
  * prints out pretty messages and returns.
@@ -63,7 +63,9 @@
 
 extern unsigned long trapbase;
 extern void breakpoint(void);
+#if CONFIG_SUN_CONSOLE
 extern void console_restore_palette(void);
+#endif
 asmlinkage void sys_sync(void);	/* it's really int */
 
 /* Pretty sick eh? */
@@ -78,10 +80,12 @@
 			     "nop\n\t"
 			     "nop\n\t" : : "r" (&trapbase));
 
+#if CONFIG_SUN_CONSOLE
         console_restore_palette ();
+#endif
 	prom_printf("PROM SYNC COMMAND...\n");
 	show_free_areas();
-	if(current != task[0]) {
+	if(current->pid != 0) {
 		sti();
 		sys_sync();
 		cli();
@@ -104,6 +108,29 @@
 #define BOOTME_SINGLE 0x2
 #define BOOTME_KGDB   0x4
 
+void kernel_enter_debugger(void)
+{
+	if (boot_flags & BOOTME_KGDB) {
+		printk("KGDB: Entered\n");
+		breakpoint();
+	}
+}
+
+int obp_system_intr(void)
+{
+	if (boot_flags & BOOTME_KGDB) {
+		printk("KGDB: system interrupted\n");
+		breakpoint();
+		return 1;
+	}
+	if (boot_flags & BOOTME_DEBUG) {
+		printk("OBP: system interrupted\n");
+		prom_halt();
+		return 1;
+	}
+	return 0;
+}
+
 /* This routine does no error checking, make sure your string is sane
  * before calling this!
  * XXX This is cheese, make generic and better.
@@ -138,11 +165,19 @@
 				printk("KGDB: Using serial line /dev/tty%c for "
 				       "session\n", commands[i+8]);
 				boot_flags |= BOOTME_KGDB;
+#if CONFIG_SUN_SERIAL
 				if(commands[i+8]=='a')
 					rs_kgdb_hook(0);
 				else if(commands[i+8]=='b')
 					rs_kgdb_hook(1);
-				else {
+				else
+#endif
+#if CONFIG_AP1000
+                                if(commands[i+8]=='c')
+				  printk("KGDB: ap1000+ debugging\n");
+				else
+#endif
+				{
 					printk("KGDB: whoops bogon tty line "
 					       "requested, disabling session\n");
 					boot_flags &= (~BOOTME_KGDB);
@@ -177,14 +212,21 @@
 void setup_arch(char **cmdline_p,
 	unsigned long * memory_start_p, unsigned long * memory_end_p)
 {
-	int total, i, panic_stuff[2];
+	int total, i, panic_stuff[2], packed;
+
+#if CONFIG_AP1000
+        register_console(prom_printf);
+	((char *)(&cputypval))[4] = 'm'; /* ugly :-( */
+#endif
 
+#if 0
 	/* Always reboot on panic, but give 5 seconds to hit L1-A
 	 * and look at debugging info if desired.
 	 */
 	panic_stuff[0] = 1;
 	panic_stuff[1] = 5;
 	panic_setup(0, panic_stuff);
+#endif
 
 	sparc_ttable = (struct tt_entry *) &start;
 
@@ -200,20 +242,25 @@
 	if(!strcmp(&cputypval,"sun4e")) { sparc_cpu_model=sun4e; }
 	if(!strcmp(&cputypval,"sun4u")) { sparc_cpu_model=sun4u; }
 	printk("ARCH: ");
+	packed = 0;
 	switch(sparc_cpu_model)
 	  {
 	  case sun4c:
 		  printk("SUN4C\n");
 		  sun4c_probe_vac();
+		  packed = 0;
 		  break;
           case sun4m:
 		  printk("SUN4M\n");
+		  packed = 1;
 		  break;
 	  case sun4d:
 		  printk("SUN4D\n");
+		  packed = 1;
 		  break;
 	  case sun4e:
 		  printk("SUN4E\n");
+		  packed = 0;
 		  break;
 	  case sun4u:
 		  printk("SUN4U\n");
@@ -238,18 +285,18 @@
 	load_mmu();
 	total = prom_probe_memory();
 	*memory_start_p = (((unsigned long) &end));
-#if 0
-	prom_printf("Physical Memory: %d bytes (in hex %08lx)\n", (int) total,
-		    (unsigned long) total);
-#endif
 
-	for(i=0; sp_banks[i].num_bytes != 0; i++) {
-#if 0
-		printk("Bank %d:  base 0x%x  bytes %d\n", i,
-			    (unsigned int) sp_banks[i].base_addr, 
-			    (int) sp_banks[i].num_bytes);
-#endif
-		end_of_phys_memory = sp_banks[i].base_addr + sp_banks[i].num_bytes;
+	if(!packed) {
+		for(i=0; sp_banks[i].num_bytes != 0; i++)
+			end_of_phys_memory = sp_banks[i].base_addr +
+				sp_banks[i].num_bytes;
+	} else {
+		unsigned int sum = 0;
+
+		for(i = 0; sp_banks[i].num_bytes != 0; i++)
+			sum += sp_banks[i].num_bytes;
+
+		end_of_phys_memory = sum;
 	}
 
 	prom_setsync(prom_sync_me);
@@ -266,6 +313,9 @@
 
 	{
 		extern int serial_console;  /* in console.c, of course */
+#if !CONFIG_SUN_SERIAL
+		serial_console = 0;
+#else
 		int idev = prom_query_input_device();
 		int odev = prom_query_output_device();
 		if (idev == PROMDEV_IKBD && odev == PROMDEV_OSCREEN) {
@@ -279,6 +329,7 @@
 			prom_printf("Inconsistent console\n");
 			prom_halt();
 		}
+#endif
 	}
 #if 1
 	/* XXX ROOT_DEV hack for kgdb - davem XXX */
@@ -301,6 +352,8 @@
 extern char *sparc_cpu_type[];
 extern char *sparc_fpu_type[];
 
+extern char *smp_info(void);
+
 int get_cpuinfo(char *buffer)
 {
 	int cpuid=get_cpuid();
@@ -308,23 +361,46 @@
 	return sprintf(buffer, "cpu\t\t: %s\n"
             "fpu\t\t: %s\n"
             "promlib\t\t: Version %d Revision %d\n"
-            "wp\t\t: %s\n"
             "type\t\t: %s\n"
             "Elf Support\t: %s\n"   /* I can't remember when I do --ralp */
+#ifndef __SMP__
             "BogoMips\t: %lu.%02lu\n"
-	    "%s",
+#else
+	    "Cpu0Bogo\t: %lu.%02lu\n"
+	    "Cpu1Bogo\t: %lu.%02lu\n"
+	    "Cpu2Bogo\t: %lu.%02lu\n"
+	    "Cpu3Bogo\t: %lu.%02lu\n"
+#endif
+	    "%s"
+#ifdef __SMP__
+	    "%s"
+#endif
+	    ,
             sparc_cpu_type[cpuid],
             sparc_fpu_type[cpuid],
+#if CONFIG_AP1000
+            0, 0,
+#else
             romvec->pv_romvers, prom_rev,
-            wp_works_ok ? "yes" : "no",
+#endif
             &cputypval,
 #if CONFIG_BINFMT_ELF
             "yes",
 #else
             "no",
 #endif
+#ifndef __SMP__
             loops_per_sec/500000, (loops_per_sec/5000) % 100,
+#else
+	    cpu_data[0].udelay_val/500000, (cpu_data[0].udelay_val/5000)%100,
+	    cpu_data[1].udelay_val/500000, (cpu_data[1].udelay_val/5000)%100,
+	    cpu_data[2].udelay_val/500000, (cpu_data[2].udelay_val/5000)%100,
+	    cpu_data[3].udelay_val/500000, (cpu_data[3].udelay_val/5000)%100,
+#endif
 	    mmu_info()
+#ifdef __SMP__
+	    , smp_info()
+#endif
             );
 
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this