Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Apr 2013 19:30:40 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 227282 for review
Message-ID:  <201304011930.r31JUeJ8024392@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@227282?ac=10

Change 227282 by rwatson@rwatson_zenith_cl_cam_ac_uk on 2013/04/01 19:29:41

	Various boot2 improvements:
	
	
	Teach MIPS boot2 to pass on information on the boot-time environment
	to loader using bootinfo.  In particular, if we get passed a dtb,
	send it on to loader.
	
	Abstract the flash read interface very slightly so that we can more
	easily interpose a device switch later, and rename the flash-level
	read interface to cfi_read() to make it more reusable in loader.
	
	Scrub bootinfo a bit more of things that, at higher levels in the
	stack, will be handled by loader meta-data.

Affected files ...

.. //depot/projects/ctsrd/beribsd/src/sys/boot/mips/beri/boot2/boot2.c#8 edit
.. //depot/projects/ctsrd/beribsd/src/sys/boot/mips/beri/common/drv.h#2 edit
.. //depot/projects/ctsrd/beribsd/src/sys/boot/mips/beri/common/flash.c#2 edit
.. //depot/projects/ctsrd/beribsd/src/sys/mips/include/bootinfo.h#4 edit

Differences ...

==== //depot/projects/ctsrd/beribsd/src/sys/boot/mips/beri/boot2/boot2.c#8 (text+ko) ====

@@ -56,9 +56,12 @@
 
 #include <stdarg.h>
 
+#include <beri.h>
 #include <cons.h>
 #include <drv.h>
 
+extern register_t	beri_argc, beri_argv, beri_envv, beri_memsize;
+
 #define IO_KEYBOARD	1
 #define IO_SERIAL	2
 
@@ -160,8 +163,8 @@
 static uint32_t opts;
 #if 0
 static int comspeed = SIOSPD;
-static struct bootinfo bootinfo;
 #endif
+struct bootinfo bootinfo;
 static uint8_t ioctrl = IO_KEYBOARD;
 
 void exit(int);
@@ -252,9 +255,9 @@
     dsk.type = dsk.drive & DRV_HARD ? TYPE_AD : TYPE_FD;
     dsk.unit = dsk.drive & DRV_MASK;
     dsk.slice = *(uint8_t *)PTOV(ARGS + 1) + 1;
+#endif
     bootinfo.bi_version = BOOTINFO_VERSION;
     bootinfo.bi_size = sizeof(bootinfo);
-#endif
 
     /* Process configuration file */
 
@@ -391,8 +394,14 @@
 	   MAKEBOOTDEV(dev_maj[dsk.type], dsk.slice, dsk.unit, dsk.part),
 	   0, 0, 0, VTOP(&bootinfo));
 #endif
-    ((void(*)(int, int, int, int))addr)(opts & RBX_MASK, /* board_id */ 0, 0,
-	0);
+    bootinfo.bi_kernelname = kname;
+    bootinfo.bi_boot2opts = opts & RBX_MASK;
+    if (beri_memsize <= BERI_MEMVSDTB)
+	bootinfo.bi_memsize = beri_memsize;
+    else
+	bootinfo.bi_dtb = beri_memsize;
+    ((void(*)(int, int, int, void *))addr)(beri_argc, beri_argv, beri_envv,
+	&bootinfo);
 }
 
 static int
@@ -455,6 +464,7 @@
 #endif
 	} else {
 	    for (q = arg--; *q && *q != '('; q++);
+#if 0
 	    if (*q) {
 		drv = -1;
 		if (arg[1] == ':') {
@@ -494,6 +504,7 @@
 			     ? DRV_HARD : 0) + drv;
 		dsk_meta = 0;
 	    }
+#endif
 	    if ((i = ep - arg)) {
 		if ((size_t)i >= sizeof(knamebuf))
 		    return -1;
@@ -507,6 +518,14 @@
 }
 
 static int
+drvread(void *buf, unsigned lba, unsigned nblk)
+{
+
+	/* XXXRW: Eventually, a device switch. */
+	return (cfi_read(buf, lba, nblk));
+}
+
+static int
 dskread(void *buf, unsigned lba, unsigned nblk)
 {
 #if 0

==== //depot/projects/ctsrd/beribsd/src/sys/boot/mips/beri/common/drv.h#2 (text+ko) ====

@@ -31,7 +31,6 @@
 #ifndef _DRV_H_
 #define	_DRV_H_
 
-struct dsk;
-int	drvread(void *buf, unsigned lba, unsigned nblk);
+int	cfi_read(void *buf, unsigned lba, unsigned blk);
 
 #endif

==== //depot/projects/ctsrd/beribsd/src/sys/boot/mips/beri/common/flash.c#2 (text+ko) ====

@@ -49,7 +49,7 @@
 #define	CHERI_BOOTFS_LENGTH	((uintptr_t)&__cheri_flash_bootfs_len__)
 
 int
-drvread(void *buf, unsigned lba, unsigned nblk)
+cfi_read(void *buf, unsigned lba, unsigned nblk)
 {
 
 	if ((lba << 9) + (nblk << 9) > CHERI_BOOTFS_LENGTH)

==== //depot/projects/ctsrd/beribsd/src/sys/mips/include/bootinfo.h#4 (text+ko) ====

@@ -56,20 +56,13 @@
 	/* bootinfo meta-data. */
 	uint32_t	bi_version;
 	uint32_t	bi_size;
-	uint32_t	bi_bootopts;
-	uint32_t	_bi_pad0;
 
 	/* bootinfo contents. */
+	uint64_t	bi_boot2opts;	/* boot2 flags to loader. */
 	bi_ptr_t	bi_kernelname;	/* Pointer to name. */
 	bi_ptr_t	bi_nfs_diskless;/* Pointer to NFS data. */
 	bi_ptr_t	bi_dtb;		/* Pointer to dtb. */
-	bi_ptr_t	bi_physmem;	/* Physical memory size in bytes. */
-
-	/* Kernel bits. */
-	bi_ptr_t	bi_symtab;	/* Symbol table... */
-	bi_ptr_t	bi_esymtab;	/* ... */
-	bi_ptr_t	bi_kernend;	/* End of kernel address space. */
-	bi_ptr_t	bi_envp;	/* Kernel environment. */
+	bi_ptr_t	bi_memsize;	/* Physical memory size in bytes. */
 	bi_ptr_t	bi_modulep;	/* Preloaded modules. */
 };
 



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