[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree

zrouter-src-freebsd at zrouter.org zrouter-src-freebsd at zrouter.org
Thu Aug 16 08:35:09 UTC 2012


details:   http://zrouter.org/hg/FreeBSD/head//rev/02b2b55f6449
changeset: 526:02b2b55f6449
user:      Aleksandr Rybalko <ray at ddteam.net>
date:      Thu Aug 16 11:35:40 2012 +0300
description:
Update sys/boot to r239327.

diffstat:

 head/sys/boot/common/disk.c    |  30 ++++++++----
 head/sys/boot/common/part.c    |   6 ++-
 head/sys/boot/uboot/lib/glue.c |  94 +++++++++++++++++++++++++++++++++++++++++-
 head/sys/boot/zfs/zfs.c        |   5 +-
 4 files changed, 120 insertions(+), 15 deletions(-)

diffs (236 lines):

diff -r 49889ad5ef1f -r 02b2b55f6449 head/sys/boot/common/disk.c
--- a/head/sys/boot/common/disk.c	Wed Aug 15 11:46:11 2012 +0300
+++ b/head/sys/boot/common/disk.c	Thu Aug 16 11:35:40 2012 +0300
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/boot/common/disk.c 239232 2012-08-13 13:33:21Z ae $");
+__FBSDID("$FreeBSD: head/sys/boot/common/disk.c 239293 2012-08-15 10:11:29Z ae $");
 
 #include <sys/disk.h>
 #include <stand.h>
@@ -187,16 +187,14 @@
 		dev->d_offset = part.start;
 		if (dev->d_partition == 255)
 			goto out; /* Nothing more to do */
-		if (dev->d_partition == -1) {
-			/*
-			 * If we are looking at a BSD slice, and the
-			 * partition is < 0, assume the 'a' partition.
-			 */
-			if (part.type == PART_FREEBSD)
-				dev->d_partition = 0;
-			else
-				goto out;
-		}
+		/*
+		 * If d_partition < 0 and we are looking at a BSD slice,
+		 * then try to read BSD label, otherwise return the
+		 * whole MBR slice.
+		 */
+		if (dev->d_partition == -1 &&
+		    part.type != PART_FREEBSD)
+			goto out;
 		/* Try to read BSD label */
 		table = ptable_open(dev, part.end - part.start + 1,
 		    od->sectorsize, ptblread);
@@ -205,6 +203,16 @@
 			rc = ENXIO;
 			goto out;
 		}
+		/*
+		 * If slice contains BSD label and d_partition < 0, then
+		 * assume the 'a' partition. Otherwise just return the
+		 * whole MBR slice, because it can contain ZFS.
+		 */
+		if (dev->d_partition < 0) {
+			if (ptable_gettype(table) != PTABLE_BSD)
+				goto out;
+			dev->d_partition = 0;
+		}
 		rc = ptable_getpart(table, &part, dev->d_partition);
 		if (rc != 0)
 			goto out;
diff -r 49889ad5ef1f -r 02b2b55f6449 head/sys/boot/common/part.c
--- a/head/sys/boot/common/part.c	Wed Aug 15 11:46:11 2012 +0300
+++ b/head/sys/boot/common/part.c	Thu Aug 16 11:35:40 2012 +0300
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/boot/common/part.c 239127 2012-08-07 09:22:46Z ae $");
+__FBSDID("$FreeBSD: head/sys/boot/common/part.c 239325 2012-08-16 06:45:58Z ae $");
 
 #include <stand.h>
 #include <sys/param.h>
@@ -372,8 +372,10 @@
 	if (buf == NULL)
 		return (table);
 	for (i = 0; i < MAXEBRENTRIES; i++) {
+#if 0	/* Some BIOSes return an incorrect number of sectors */
 		if (offset >= table->sectors)
 			break;
+#endif
 		if (dread(dev, buf, 1, offset) != 0)
 			break;
 		dp = (struct dos_partition *)(buf + DOSPARTOFF);
@@ -663,8 +665,10 @@
 		end = le32toh(dp[i].dp_size);
 		if (start == 0 || end == 0)
 			continue;
+#if 0	/* Some BIOSes return an incorrect number of sectors */
 		if (start + end - 1 >= sectors)
 			continue;	/* XXX: ignore */
+#endif
 		if (dp[i].dp_typ == DOSPTYP_EXT ||
 		    dp[i].dp_typ == DOSPTYP_EXTLBA)
 			has_ext = 1;
diff -r 49889ad5ef1f -r 02b2b55f6449 head/sys/boot/uboot/lib/glue.c
--- a/head/sys/boot/uboot/lib/glue.c	Wed Aug 15 11:46:11 2012 +0300
+++ b/head/sys/boot/uboot/lib/glue.c	Thu Aug 16 11:35:40 2012 +0300
@@ -83,11 +83,17 @@
 	if (sig == NULL)
 		return (0);
 
+
 	if (uboot_address == 0)
 		uboot_address = 255 * 1024 * 1024;
 
 	sp = (void *)(uboot_address & ~0x000fffff);
 	spend = sp + 0x00300000 - API_SIG_MAGLEN;
+
+	sp = (void *)0x9fe00920;
+	*sig = (struct api_signature *)sp;
+	return (1);
+
 	while (sp < spend) {
 		if (!bcmp(sp, API_SIG_MAGIC, API_SIG_MAGLEN)) {
 			*sig = (struct api_signature *)sp;
@@ -106,7 +112,7 @@
  * console
  *
  ****************************************/
-
+#ifndef NO_IMX
 int
 ub_getc(void)
 {
@@ -143,6 +149,92 @@
 	syscall(API_PUTS, NULL, (uint32_t)s);
 }
 
+#else
+
+/****************************************
+ *
+ * IMX515 console
+ *
+ ****************************************/
+
+#define	IMX_RXD			(u_int32_t *)0x73fbc000
+#define	IMX_TXD			(u_int32_t *)0x73fbc040
+
+#define	IMX_USR1		(u_int32_t *)0x73fbc094
+#define	IMX_USR1_TRDY		(1 << 13)		/* ro  */
+
+#define	IMX_USR2		(u_int32_t *)0x73fbc098
+#define	IMX_USR2_RDR		(1 << 0)
+
+/*
+ * uart related funcs
+ */
+static u_int32_t
+uart_getreg(u_int32_t *bas)
+{
+	return *((volatile u_int32_t *)(bas)) & 0xff;
+}
+
+static void
+uart_setreg(u_int32_t *bas, u_int32_t val)
+{
+	*((volatile u_int32_t *)(bas)) = (u_int32_t)val;
+}
+
+void
+DELAY(int val)
+{
+	volatile int sub;
+	volatile int subsub;
+
+	sub = val;
+	while(sub) {
+		subsub = 100;
+		while(subsub)
+			subsub--;
+		sub--;
+	}
+}
+
+
+int
+ub_getc(void)
+{
+
+	while (!uart_getreg(IMX_USR2) & IMX_USR2_RDR) DELAY(1);
+
+	return (uart_getreg(IMX_RXD) & 0xff);
+}
+
+int
+ub_tstc(void)
+{
+
+	return ((uart_getreg(IMX_USR2) & IMX_USR2_RDR) ? 1 : 0);
+}
+
+void
+ub_putc(char c)
+{
+	while (!uart_getreg(IMX_USR1) & IMX_USR1_TRDY) DELAY(1);
+
+	uart_setreg(IMX_TXD, c & 0xff);
+
+	while (!uart_getreg(IMX_USR1) & IMX_USR1_TRDY) DELAY(1);
+}
+
+void
+ub_puts(const char *s)
+{
+
+	while (*s) {
+		ub_putc(*s);
+		s++;
+	}
+}
+
+#endif
+
 /****************************************
  *
  * system
diff -r 49889ad5ef1f -r 02b2b55f6449 head/sys/boot/zfs/zfs.c
--- a/head/sys/boot/zfs/zfs.c	Wed Aug 15 11:46:11 2012 +0300
+++ b/head/sys/boot/zfs/zfs.c	Thu Aug 16 11:35:40 2012 +0300
@@ -23,11 +23,11 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: head/sys/boot/zfs/zfs.c 239068 2012-08-05 14:48:28Z ae $
+ *	$FreeBSD: head/sys/boot/zfs/zfs.c 239292 2012-08-15 09:18:49Z ae $
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/boot/zfs/zfs.c 239068 2012-08-05 14:48:28Z ae $");
+__FBSDID("$FreeBSD: head/sys/boot/zfs/zfs.c 239292 2012-08-15 09:18:49Z ae $");
 
 /*
  *	Stand-alone file reading package.
@@ -422,6 +422,7 @@
 
 	ppa = (struct zfs_probe_args *)arg;
 	strncpy(devname, ppa->devname, strlen(ppa->devname) - 1);
+	devname[strlen(ppa->devname) - 1] = '\0';
 	sprintf(devname, "%s%s:", devname, partname);
 	pa.fd = open(devname, O_RDONLY);
 	if (pa.fd == -1)


More information about the Zrouter-src-freebsd mailing list