aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ifxmips/files/arch/mips
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2008-06-22 19:01:14 +0000
committerJohn Crispin <blogic@openwrt.org>2008-06-22 19:01:14 +0000
commit93e6eecf2d160a2b4f4204ff192aa9c052ad4b48 (patch)
treea9f5a48db54bb023e6152eda8cc337efc012d5e0 /target/linux/ifxmips/files/arch/mips
parent126798e44f248c871ac6b5a252cd731ec19858b3 (diff)
downloadmaster-187ad058-93e6eecf2d160a2b4f4204ff192aa9c052ad4b48.tar.gz
master-187ad058-93e6eecf2d160a2b4f4204ff192aa9c052ad4b48.tar.bz2
master-187ad058-93e6eecf2d160a2b4f4204ff192aa9c052ad4b48.zip
fixes several compile errors, reserves memory for second core, adds u-boot env parsing for ifxmips
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11558 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ifxmips/files/arch/mips')
-rw-r--r--target/linux/ifxmips/files/arch/mips/ifxmips/prom.c71
1 files changed, 63 insertions, 8 deletions
diff --git a/target/linux/ifxmips/files/arch/mips/ifxmips/prom.c b/target/linux/ifxmips/files/arch/mips/ifxmips/prom.c
index 2fb33b7cb8..41e111c691 100644
--- a/target/linux/ifxmips/files/arch/mips/ifxmips/prom.c
+++ b/target/linux/ifxmips/files/arch/mips/ifxmips/prom.c
@@ -29,25 +29,28 @@
#include <asm/bootinfo.h>
#include <asm/ifxmips/ifxmips.h>
+
static char buf[1024];
+u32 *prom_cp1_base = NULL;
+u32 prom_cp1_size = 0;
void
-prom_free_prom_memory (void)
+prom_free_prom_memory(void)
{
}
void
-prom_putchar (char c)
+prom_putchar(char c)
{
- while ((ifxmips_r32(IFXMIPS_ASC1_FSTAT) & ASCFSTAT_TXFFLMASK) >> ASCFSTAT_TXFFLOFF);
+ while((ifxmips_r32(IFXMIPS_ASC1_FSTAT) & ASCFSTAT_TXFFLMASK) >> ASCFSTAT_TXFFLOFF);
- if (c == '\n')
+ if(c == '\n')
ifxmips_w32('\r', IFXMIPS_ASC1_TBUF);
ifxmips_w32(c, IFXMIPS_ASC1_TBUF);
}
void
-prom_printf (const char * fmt, ...)
+prom_printf(const char * fmt, ...)
{
va_list args;
int l;
@@ -58,17 +61,69 @@ prom_printf (const char * fmt, ...)
va_end(args);
buf_end = buf + l;
- for (p = buf; p < buf_end; p++)
+ for(p = buf; p < buf_end; p++)
{
prom_putchar(*p);
}
}
+u32 *prom_get_cp1_base(void)
+{
+ return prom_cp1_base;
+}
+
+u32 prom_get_cp1_size(void)
+{
+ return prom_cp1_size;
+}
+
void __init
prom_init(void)
{
+ int argc = fw_arg0;
+ char **argv = (char **) fw_arg1;
+ char **envp = (char **) fw_arg2;
+
+ int memsize = 16;
+ int i;
+
mips_machtype = MACH_INFINEON_IFXMIPS;
- strcpy(&(arcs_cmdline[0]), "console=ttyS0,115200 rootfstype=squashfs,jffs2 init=/etc/preinit");
- add_memory_region (0x00000000, 0x2000000, BOOT_MEM_RAM);
+ argv = (char**)KSEG1ADDR((unsigned long)argv);
+ arcs_cmdline[0] = '\0';
+ for(i = 1; i < argc; i++)
+ {
+ char *a = (char*)KSEG1ADDR(argv[i]);
+ if(!a)
+ continue;
+ if(strlen(arcs_cmdline) + strlen(a + 1) >= sizeof(arcs_cmdline))
+ break;
+ strcat(arcs_cmdline, a);
+ strcat(arcs_cmdline, " ");
+ }
+
+ envp = (char**)KSEG1ADDR((unsigned long)envp);
+ while(*envp)
+ {
+ char *e = (char*)KSEG1ADDR(*envp);
+
+ if(!strncmp(e, "memsize=", 8))
+ {
+ e += 8;
+ memsize = simple_strtoul(e, NULL, 10);
+ }
+ envp++;
+ }
+
+ prom_cp1_size = 2;
+ memsize -= prom_cp1_size;
+ prom_cp1_base = (u32*)(0xA0000000 + (memsize * 1024 * 1024));
+
+ prom_printf(KERN_INFO "Using %dMB Ram and reserving %dMB for cp1\n", memsize, prom_cp1_size);
+ memsize *= 1024 * 1024;
+
+ if(!*arcs_cmdline)
+ strcpy(&(arcs_cmdline[0]), "console=ttyS0,115200 rootfstype=squashfs,jffs2 init=/etc/preinit");
+
+ add_memory_region(0x00000000, memsize, BOOT_MEM_RAM);
}