Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Apr 2008 17:07:48 GMT
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 139914 for review
Message-ID:  <200804121707.m3CH7mJI094654@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=139914

Change 139914 by gonzo@gonzo_jeeves on 2008/04/12 17:07:10

	o Use paramteres passed from RB532 loader to set memory size 
	   properly.
	o Add TODO entry for platform_reset.

Affected files ...

.. //depot/projects/mips2-jnpr/src/sys/mips/mips32/idt/idt_machdep.c#5 edit

Differences ...

==== //depot/projects/mips2-jnpr/src/sys/mips/mips32/idt/idt_machdep.c#5 (text+ko) ====

@@ -88,6 +88,11 @@
 platform_reset(void)
 {
 	volatile unsigned int * p = (void *)0xb8008000;
+	/* 
+	 * TODO: we should take care of TLB stuff here. Otherwise
+	 * board does not boots properly next time
+	 */
+
 	/* Write 0x8000_0001 to the Reset register */
 	*p = 0x80000001;
 
@@ -108,19 +113,36 @@
 }
 
 void
-platform_start(__register_t a0 __unused, __register_t a1 __unused, 
+platform_start(__register_t a0, __register_t a1,
     __register_t a2 __unused, __register_t a3 __unused)
 {
 	uint64_t platform_counter_freq;
 	vm_offset_t kernend;
-	int i;
+	int argc = a0;
+	char **argv = (char **)a1;
+	int i, mem;
+
 
 	/* clear the BSS and SBSS segments */
 	kernend = round_page((vm_offset_t)&end);
 	memset(&edata, 0, kernend - (vm_offset_t)(&edata));
 
+	/*
+	 * Looking for mem=XXM argument
+	 */
+	mem = 0; /* Just something to start with */
+	for (i=0; i < argc; i++) {
+		if (strncmp(argv[i], "mem=", 4) == 0) {
+			mem = strtol(argv[i] + 4, NULL, 0);
+			break;
+		}
+	}
+
 	bootverbose = 1;
-	realmem = btoc(32 << 20);
+	if (mem > 0)
+		realmem = btoc(mem << 20);
+	else
+		realmem = btoc(32 << 20);
 
 	for (i = 0; i < 10; i++) {
 		phys_avail[i] = 0;
@@ -142,6 +164,14 @@
 	platform_counter_freq = 330000000UL;
 	mips_timer_init_params(platform_counter_freq, 1);
 	cninit();
+	/* Panic here, after cninit */ 
+	if (mem == 0)
+		panic("No mem=XX parameter in arguments");
+
+	printf("cmd line: ");
+	for (i=0; i < argc; i++)
+		printf("%s ", argv[i]);
+	printf("\n");
 
 	init_param2(physmem);
 	mips_cpu_init();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200804121707.m3CH7mJI094654>