svn commit: r237040 - in head/sys/arm: arm at91 econa include mv s3c2xx0 sa11x0 xscale/i80321 xscale/i8134x xscale/ixp425

Warner Losh imp at FreeBSD.org
Thu Jun 14 04:00:31 UTC 2012


Author: imp
Date: Thu Jun 14 04:00:30 2012
New Revision: 237040
URL: http://svn.freebsd.org/changeset/base/237040

Log:
  Modify all the arm platform files to call parse_boot_param passing in
  the boot parameters from initarm first thing.  parse_boot_param parses
  the boot arguments and converts them to the /boot/loader metadata the
  rest of the kernel uses.  parse_boot_param is a weak alias to
  fake_preload_metadata, which all the platforms use now, but may become
  more extensive in the future.
  
  Since it is a weak symbol, specific boards may define their own
  parse_boot_param to interface to custom boot loaders.
  
  Reviewed by:	cognet@, Ian Lapore

Modified:
  head/sys/arm/arm/machdep.c
  head/sys/arm/at91/at91_machdep.c
  head/sys/arm/econa/econa_machdep.c
  head/sys/arm/include/machdep.h
  head/sys/arm/mv/mv_machdep.c
  head/sys/arm/s3c2xx0/s3c24x0_machdep.c
  head/sys/arm/sa11x0/assabet_machdep.c
  head/sys/arm/xscale/i80321/ep80219_machdep.c
  head/sys/arm/xscale/i80321/iq31244_machdep.c
  head/sys/arm/xscale/i8134x/crb_machdep.c
  head/sys/arm/xscale/ixp425/avila_machdep.c

Modified: head/sys/arm/arm/machdep.c
==============================================================================
--- head/sys/arm/arm/machdep.c	Thu Jun 14 03:27:01 2012	(r237039)
+++ head/sys/arm/arm/machdep.c	Thu Jun 14 04:00:30 2012	(r237040)
@@ -666,7 +666,7 @@ makectx(struct trapframe *tf, struct pcb
  * Fake up a boot descriptor table
  */
 vm_offset_t
-fake_preload_metadata(void)
+fake_preload_metadata(struct arm_boot_params *abp __unused)
 {
 #ifdef DDB
 	vm_offset_t zstart = 0, zend = 0;
@@ -713,6 +713,23 @@ fake_preload_metadata(void)
 }
 
 /*
+ * Stub version of the boot parameter parsing routine.  We are
+ * called early in initarm, before even VM has been initialized.
+ * This routine needs to preserve any data that the boot loader
+ * has passed in before the kernel starts to grow past the end
+ * of the BSS, traditionally the place boot-loaders put this data.
+ *
+ * Since this is called so early, things that depend on the vm system
+ * being setup (including access to some SoC's serial ports), about
+ * all that can be done in this routine is to copy the arguments.
+ *
+ * This is the default boot parameter parsing routine.  Individual
+ * kernels/boards can override this weak function with one of their
+ * own.  We just fake metadata...
+ */
+__weak_reference(fake_preload_metadata, parse_boot_param);
+
+/*
  * Initialize proc0
  */
 void

Modified: head/sys/arm/at91/at91_machdep.c
==============================================================================
--- head/sys/arm/at91/at91_machdep.c	Thu Jun 14 03:27:01 2012	(r237039)
+++ head/sys/arm/at91/at91_machdep.c	Thu Jun 14 04:00:30 2012	(r237040)
@@ -392,8 +392,8 @@ initarm(struct arm_boot_params *abp)
 	uint32_t memsize;
 	vm_offset_t lastaddr;
 
+	lastaddr = parse_boot_param(abp);
 	set_cpufuncs();
-	lastaddr = fake_preload_metadata();
 	pcpu_init(pcpup, 0, sizeof(struct pcpu));
 	PCPU_SET(curthread, &thread0);
 

Modified: head/sys/arm/econa/econa_machdep.c
==============================================================================
--- head/sys/arm/econa/econa_machdep.c	Thu Jun 14 03:27:01 2012	(r237039)
+++ head/sys/arm/econa/econa_machdep.c	Thu Jun 14 04:00:30 2012	(r237040)
@@ -194,9 +194,8 @@ initarm(struct arm_boot_params *abp)
 	int mem_info;
 
 	boothowto = RB_VERBOSE;
-
+	lastaddr = parse_boot_param(abp);
 	set_cpufuncs();
-	lastaddr = fake_preload_metadata();
 	pcpu_init(pcpup, 0, sizeof(struct pcpu));
 	PCPU_SET(curthread, &thread0);
 

Modified: head/sys/arm/include/machdep.h
==============================================================================
--- head/sys/arm/include/machdep.h	Thu Jun 14 03:27:01 2012	(r237039)
+++ head/sys/arm/include/machdep.h	Thu Jun 14 04:00:30 2012	(r237040)
@@ -6,11 +6,14 @@
 
 /* misc prototypes used by the many arm machdeps */
 void arm_lock_cache_line(vm_offset_t);
-vm_offset_t fake_preload_metadata(void);
 void init_proc0(vm_offset_t kstack);
 void halt(void);
 void data_abort_handler(trapframe_t *);
 void prefetch_abort_handler(trapframe_t *);
 void undefinedinstruction_bounce(trapframe_t *);
 
+struct arm_boot_params;
+vm_offset_t fake_preload_metadata(struct arm_boot_params *);
+vm_offset_t parse_boot_param(struct arm_boot_params *);
+
 #endif /* !_MACHINE_MACHDEP_H_ */

Modified: head/sys/arm/mv/mv_machdep.c
==============================================================================
--- head/sys/arm/mv/mv_machdep.c	Thu Jun 14 03:27:01 2012	(r237039)
+++ head/sys/arm/mv/mv_machdep.c	Thu Jun 14 04:00:30 2012	(r237040)
@@ -331,7 +331,7 @@ initarm(struct arm_boot_params *abp)
 	 */
 	mdp = (void *)((uint32_t)mdp & ~PAGE_MASK);
 
-	/* Parse metadata and fetch parameters */
+	/* Parse metadata and fetch parameters (move to common machdep.c?) */
 	if (mdp != NULL) {
 		preload_metadata = mdp;
 		kmdp = preload_search_by_type("elf kernel");
@@ -350,7 +350,7 @@ initarm(struct arm_boot_params *abp)
 		preload_addr_relocate = KERNVIRTADDR - KERNPHYSADDR;
 	} else {
 		/* Fall back to hardcoded metadata. */
-		lastaddr = fake_preload_metadata();
+		lastaddr = fake_preload_metadata(abp);
 	}
 
 #if defined(FDT_DTB_STATIC)

Modified: head/sys/arm/s3c2xx0/s3c24x0_machdep.c
==============================================================================
--- head/sys/arm/s3c2xx0/s3c24x0_machdep.c	Thu Jun 14 03:27:01 2012	(r237039)
+++ head/sys/arm/s3c2xx0/s3c24x0_machdep.c	Thu Jun 14 04:00:30 2012	(r237040)
@@ -244,10 +244,9 @@ initarm(struct arm_boot_params *abp)
 	int i;
 	uint32_t memsize;
 
+	boothowto = 0;  /* Likely not needed */
+	lastaddr = parse_boot_param(abp);
 	i = 0;
-
-	boothowto = 0;
-
 	set_cpufuncs();
 	cpufuncs.cf_sleep = s3c24x0_sleep;
 	lastaddr = fake_preload_metadata();

Modified: head/sys/arm/sa11x0/assabet_machdep.c
==============================================================================
--- head/sys/arm/sa11x0/assabet_machdep.c	Thu Jun 14 03:27:01 2012	(r237039)
+++ head/sys/arm/sa11x0/assabet_machdep.c	Thu Jun 14 04:00:30 2012	(r237040)
@@ -215,10 +215,10 @@ initarm(struct arm_boot_params *abp)
 	uint32_t memsize = 32 * 1024 * 1024;
 	sa1110_uart_vaddr = SACOM1_VBASE;
 
-	boothowto = RB_VERBOSE | RB_SINGLE;
+	boothowto = RB_VERBOSE | RB_SINGLE;     /* Default value */
+	lastaddr = parse_boot_param(abp);
 	cninit();
 	set_cpufuncs();
-	lastaddr = fake_preload_metadata();
 	physmem = memsize / PAGE_SIZE;
 	pc = &__pcpu;
 	pcpu_init(pc, 0, sizeof(struct pcpu));

Modified: head/sys/arm/xscale/i80321/ep80219_machdep.c
==============================================================================
--- head/sys/arm/xscale/i80321/ep80219_machdep.c	Thu Jun 14 03:27:01 2012	(r237039)
+++ head/sys/arm/xscale/i80321/ep80219_machdep.c	Thu Jun 14 04:00:30 2012	(r237040)
@@ -192,8 +192,8 @@ initarm(struct arm_boot_params *abp)
 	vm_offset_t lastaddr;
 	uint32_t memsize, memstart;
 
+	lastaddr = parse_boot_param(abp);
 	set_cpufuncs();
-	lastaddr = fake_preload_metadata();
 	pcpu_init(pcpup, 0, sizeof(struct pcpu));
 	PCPU_SET(curthread, &thread0);
 

Modified: head/sys/arm/xscale/i80321/iq31244_machdep.c
==============================================================================
--- head/sys/arm/xscale/i80321/iq31244_machdep.c	Thu Jun 14 03:27:01 2012	(r237039)
+++ head/sys/arm/xscale/i80321/iq31244_machdep.c	Thu Jun 14 04:00:30 2012	(r237040)
@@ -193,8 +193,8 @@ initarm(struct arm_boot_params *abp)
 	vm_offset_t lastaddr;
 	uint32_t memsize, memstart;
 
+	lastaddr = parse_boot_param(abp);
 	set_cpufuncs();
-	lastaddr = fake_preload_metadata();
 	pcpu_init(pcpup, 0, sizeof(struct pcpu));
 	PCPU_SET(curthread, &thread0);
 

Modified: head/sys/arm/xscale/i8134x/crb_machdep.c
==============================================================================
--- head/sys/arm/xscale/i8134x/crb_machdep.c	Thu Jun 14 03:27:01 2012	(r237039)
+++ head/sys/arm/xscale/i8134x/crb_machdep.c	Thu Jun 14 04:00:30 2012	(r237040)
@@ -189,8 +189,8 @@ initarm(struct arm_boot_params *abp)
 	vm_offset_t lastaddr;
 	uint32_t memsize, memstart;
 
+	lastaddr = parse_boot_param(abp);
 	set_cpufuncs();
-	lastaddr = fake_preload_metadata();
 	pcpu_init(pcpup, 0, sizeof(struct pcpu));
 	PCPU_SET(curthread, &thread0);
 

Modified: head/sys/arm/xscale/ixp425/avila_machdep.c
==============================================================================
--- head/sys/arm/xscale/ixp425/avila_machdep.c	Thu Jun 14 03:27:01 2012	(r237039)
+++ head/sys/arm/xscale/ixp425/avila_machdep.c	Thu Jun 14 04:00:30 2012	(r237040)
@@ -238,8 +238,8 @@ initarm(struct arm_boot_params *abp)
 	vm_offset_t lastaddr;
 	uint32_t memsize;
 
+	lastaddr = parse_boot_param(abp);
 	set_cpufuncs();		/* NB: sets cputype */
-	lastaddr = fake_preload_metadata();
 	pcpu_init(pcpup, 0, sizeof(struct pcpu));
 	PCPU_SET(curthread, &thread0);
 


More information about the svn-src-all mailing list