maltalinux-cvs-patches
[Top] [All Lists]

CVS Update@linux-mips.org: malta

To: maltalinux-cvs-patches@linux-mips.org
Subject: CVS Update@linux-mips.org: malta
From: beth@linux-mips.org
Date: Fri, 16 Sep 2005 11:45:44 +0100
Reply-to: linux-mips@linux-mips.org
Sender: maltalinux-cvs-patches-bounce@linux-mips.org
CVSROOT:        /home/cvs
Module name:    malta
Changes by:     beth@ftp.linux-mips.org 05/09/16 11:45:43

Modified files:
        linux/arch/mips/kernel: Tag: MaltaRef_2_6 vpe.c 
        linux/arch/mips/mips-boards/generic: Tag: MaltaRef_2_6 memory.c 

Log message:
        * arch/mips/kernel/vpe.c: Set $a3 to the physical or assumed memory size
        so SP programs can set their stack pointer to the top of memory.
        
        * arch/mips/mips-boards/generic/memory.c: Rearranged memsize handling to
        keep a note of the physical or determined memory sizes for use by the
        VPE loader.

diff -urN malta/linux/arch/mips/kernel/vpe.c malta/linux/arch/mips/kernel/vpe.c
--- malta/linux/arch/mips/kernel/vpe.c  2005/09/02 17:02:54     1.1.1000.5
+++ malta/linux/arch/mips/kernel/vpe.c  2005/09/16 10:45:43     1.1.1000.6
@@ -58,6 +58,9 @@
 #include <asm/vpe.h>
 #include <asm/kspd.h>
 
+#include <asm/mips-boards/prom.h>
+
+
 typedef void *vpe_handle;
 
 #if 0
@@ -94,6 +97,8 @@
 #define P_SIZE (256 * 1024)
 #endif
 
+extern unsigned long physical_memsize;
+
 #define MAX_VPES 16
 
 #define VPE_PATH_MAX 256
@@ -785,11 +790,10 @@
        
        write_tc_c0_tchalt(read_tc_c0_tchalt() & ~TCHALT_H);
 
-       /* The sde-kit passes 'memsize' to __start in $a3, so set something 
here...
-          Or set $a3 to zero and define DFLT_STACK_SIZE and DFLT_HEAP_SIZE 
when you compile
-          your program */
-
-       mttgpr($7, 0);
+       /* The sde-kit passes 'memsize' to __start in $a3, so if we have the 
info
+          from YAMON, then set it. Otherwise set $a3 to zero and define 
DFLT_STACK_SIZE
+          and DFLT_HEAP_SIZE when you compile your program */
+       mttgpr($7, physical_memsize);
 
        /* set up VPE1 */
        /* bind the TC to VPE 1 as late as possible so we only have the final 
VPE 
diff -urN malta/linux/arch/mips/mips-boards/generic/memory.c 
malta/linux/arch/mips/mips-boards/generic/memory.c
--- malta/linux/arch/mips/mips-boards/generic/memory.c  2005/06/21 13:24:12     
1.11.1000.2
+++ malta/linux/arch/mips/mips-boards/generic/memory.c  2005/09/16 10:45:43     
1.11.1000.3
@@ -49,6 +49,9 @@
 /* References to section boundaries */
 extern char _end;
 
+/* determined physical memory size, not overridden by command line args  */
+unsigned long physical_memsize = 0L;
+
 #define PFN_ALIGN(x)    (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
 
 
@@ -58,28 +61,30 @@
        unsigned int memsize;
        char cmdline[CL_SIZE], *ptr;
 
-       /* Check the command line first for a memsize directive */
+       /* otherwise look in the environment */
+       memsize_str = prom_getenv("memsize");
+       if (!memsize_str) {
+               prom_printf("memsize not set in boot prom, set to default 
(32Mb)\n");
+               physical_memsize = 0x02000000;
+       } else {
+#ifdef DEBUG
+               prom_printf("prom_memsize = %s\n", memsize_str);
+#endif
+               physical_memsize = simple_strtol(memsize_str, NULL, 0);
+       }
+
+       /* Check the command line for a memsize directive that overrides 
+          the physical/default amount */
        strcpy(cmdline, arcs_cmdline);
        ptr = strstr(cmdline, "memsize=");
        if (ptr && (ptr != cmdline) && (*(ptr - 1) != ' '))
                ptr = strstr(ptr, " memsize=");
                
-       if (ptr) {
+       if (ptr)
                memsize = memparse(ptr + 8, &ptr);
-       }
-       else {
-               /* otherwise look in the environment */
-               memsize_str = prom_getenv("memsize");
-               if (!memsize_str) {
-                       prom_printf("memsize not set in boot prom, set to 
default (32Mb)\n");
-                       memsize = 0x02000000;
-               } else {
-#ifdef DEBUG
-                       prom_printf("prom_memsize = %s\n", memsize_str);
-#endif
-                       memsize = simple_strtol(memsize_str, NULL, 0);
-               }
-       }
+       else
+               memsize = physical_memsize;
+
        memset(mdesc, 0, sizeof(mdesc));
 
        mdesc[0].type = yamon_dontuse;

<Prev in Thread] Current Thread [Next in Thread>