PERFORCE change 149139 for review

Julian Elischer julian at FreeBSD.org
Wed Sep 3 18:32:18 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=149139

Change 149139 by julian at julian_trafmon1 on 2008/09/03 18:31:55

	Loop back  ng_pipe and a few nits.  @149137

Affected files ...

.. //depot/projects/vimage-commit2/src/sys/boot/common/dev_net.c#4 integrate
.. //depot/projects/vimage-commit2/src/sys/boot/common/devopen.c#2 integrate
.. //depot/projects/vimage-commit2/src/sys/boot/powerpc/uboot/start.S#2 integrate
.. //depot/projects/vimage-commit2/src/sys/boot/uboot/common/main.c#3 integrate
.. //depot/projects/vimage-commit2/src/sys/boot/uboot/lib/glue.c#2 integrate
.. //depot/projects/vimage-commit2/src/sys/boot/uboot/lib/glue.h#3 integrate
.. //depot/projects/vimage-commit2/src/sys/conf/files.sun4v#2 integrate
.. //depot/projects/vimage-commit2/src/sys/netgraph/ng_pipe.c#1 branch
.. //depot/projects/vimage-commit2/src/sys/netgraph/ng_pipe.h#1 branch
.. //depot/projects/vimage-commit2/src/sys/netinet/ip_fw2.c#17 integrate
.. //depot/projects/vimage-commit2/src/sys/sparc64/include/clock.h#2 integrate
.. //depot/projects/vimage-commit2/src/sys/sparc64/include/cpufunc.h#4 integrate
.. //depot/projects/vimage-commit2/src/sys/sparc64/include/pcpu.h#5 integrate
.. //depot/projects/vimage-commit2/src/sys/sparc64/include/smp.h#2 integrate
.. //depot/projects/vimage-commit2/src/sys/sparc64/include/tick.h#2 integrate
.. //depot/projects/vimage-commit2/src/sys/sparc64/include/ver.h#2 integrate
.. //depot/projects/vimage-commit2/src/sys/sparc64/sparc64/clock.c#3 integrate
.. //depot/projects/vimage-commit2/src/sys/sparc64/sparc64/genassym.c#3 integrate
.. //depot/projects/vimage-commit2/src/sys/sparc64/sparc64/locore.S#4 integrate
.. //depot/projects/vimage-commit2/src/sys/sparc64/sparc64/machdep.c#4 integrate
.. //depot/projects/vimage-commit2/src/sys/sparc64/sparc64/mp_locore.S#3 integrate
.. //depot/projects/vimage-commit2/src/sys/sparc64/sparc64/mp_machdep.c#5 integrate
.. //depot/projects/vimage-commit2/src/sys/sparc64/sparc64/tick.c#3 integrate

Differences ...

==== //depot/projects/vimage-commit2/src/sys/boot/common/dev_net.c#4 (text+ko) ====

@@ -1,4 +1,4 @@
-/*	
+/*
  * $NetBSD: dev_net.c,v 1.12 1997/12/10 20:38:37 gwr Exp $
  */
 
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/boot/common/dev_net.c,v 1.16 2008/03/12 16:01:33 raj Exp $");
+__FBSDID("$FreeBSD: src/sys/boot/common/dev_net.c,v 1.17 2008/09/03 17:41:44 raj Exp $");
 
 /*-
  * This module implements a "raw device" interface suitable for
@@ -90,20 +90,21 @@
 static int net_getparams(int sock);
 
 struct devsw netdev = {
-    "net", 
-    DEVT_NET, 
-    net_init,
-    net_strategy, 
-    net_open, 
-    net_close, 
-    noioctl,
-    net_print
+	"net",
+	DEVT_NET,
+	net_init,
+	net_strategy,
+	net_open,
+	net_close,
+	noioctl,
+	net_print
 };
 
 int
 net_init(void)
 {
-    return 0;
+
+	return (0);
 }
 
 /*
@@ -114,75 +115,74 @@
 int
 net_open(struct open_file *f, ...)
 {
-    va_list args;
-    char *devname;		/* Device part of file name (or NULL). */
-    int error = 0;
+	va_list args;
+	char *devname;		/* Device part of file name (or NULL). */
+	int error = 0;
 
-    va_start(args, f);
-    devname = va_arg(args, char*);
-    va_end(args);
+	va_start(args, f);
+	devname = va_arg(args, char*);
+	va_end(args);
 
-    /* On first open, do netif open, mount, etc. */
-    if (netdev_opens == 0) {
-	/* Find network interface. */
-	if (netdev_sock < 0) {
-	    netdev_sock = netif_open(devname);
-	    if (netdev_sock < 0) {
-		printf("net_open: netif_open() failed\n");
-		return (ENXIO);
-	    }
-	    if (debug)
-		printf("net_open: netif_open() succeeded\n");
-	}
-	if (rootip.s_addr == 0) {
-	    /* Get root IP address, and path, etc. */
-	    error = net_getparams(netdev_sock);
-	    if (error) {
+	/* On first open, do netif open, mount, etc. */
+	if (netdev_opens == 0) {
+		/* Find network interface. */
+		if (netdev_sock < 0) {
+			netdev_sock = netif_open(devname);
+			if (netdev_sock < 0) {
+				printf("net_open: netif_open() failed\n");
+				return (ENXIO);
+			}
+			if (debug)
+			printf("net_open: netif_open() succeeded\n");
+		}
+		if (rootip.s_addr == 0) {
+			/* Get root IP address, and path, etc. */
+			error = net_getparams(netdev_sock);
+			if (error) {
 				/* getparams makes its own noise */
-		netif_close(netdev_sock);
-		netdev_sock = -1;
-		return (error);
-	    }
+				netif_close(netdev_sock);
+				netdev_sock = -1;
+				return (error);
+			}
+		}
 	}
-    }
-    netdev_opens++;
-    f->f_devdata = &netdev_sock;
-    return (error);
+	netdev_opens++;
+	f->f_devdata = &netdev_sock;
+	return (error);
 }
 
 int
-net_close(f)
-    struct open_file *f;
+net_close(struct open_file *f)
 {
-
 #ifdef	NETIF_DEBUG
-    if (debug)
-	printf("net_close: opens=%d\n", netdev_opens);
+	if (debug)
+		printf("net_close: opens=%d\n", netdev_opens);
 #endif
 
-    /* On last close, do netif close, etc. */
-    f->f_devdata = NULL;
-    /* Extra close call? */
-    if (netdev_opens <= 0)
+	/* On last close, do netif close, etc. */
+	f->f_devdata = NULL;
+	/* Extra close call? */
+	if (netdev_opens <= 0)
+		return (0);
+	netdev_opens--;
+	/* Not last close? */
+	if (netdev_opens > 0)
+		return(0);
+	rootip.s_addr = 0;
+	if (netdev_sock >= 0) {
+		if (debug)
+			printf("net_close: calling netif_close()\n");
+		netif_close(netdev_sock);
+		netdev_sock = -1;
+	}
 	return (0);
-    netdev_opens--;
-    /* Not last close? */
-    if (netdev_opens > 0)
-	return(0);
-    rootip.s_addr = 0;
-    if (netdev_sock >= 0) {
-	if (debug)
-	    printf("net_close: calling netif_close()\n");
-	netif_close(netdev_sock);
-	netdev_sock = -1;
-    }
-    return (0);
 }
 
 int
 net_strategy()
 {
-    return EIO;
+
+	return (EIO);
 }
 
 #define SUPPORT_BOOTP
@@ -205,106 +205,118 @@
 extern n_long ip_convertaddr(char *p);
 
 static int
-net_getparams(sock)
-    int sock;
+net_getparams(int sock)
 {
-    char buf[MAXHOSTNAMELEN];
-    char temp[FNAME_SIZE];
-    struct iodesc *d;
-    int i;
-    n_long smask;
+	char buf[MAXHOSTNAMELEN];
+	char temp[FNAME_SIZE];
+	struct iodesc *d;
+	int i;
+	n_long smask;
 
 #ifdef	SUPPORT_BOOTP
-    /*
-     * Try to get boot info using BOOTP.  If we succeed, then
-     * the server IP address, gateway, and root path will all
-     * be initialized.  If any remain uninitialized, we will
-     * use RARP and RPC/bootparam (the Sun way) to get them.
-     */
-    if (try_bootp)
-	bootp(sock, BOOTP_NONE);
-    if (myip.s_addr != 0)
-	goto exit;
-    if (debug)
-	printf("net_open: BOOTP failed, trying RARP/RPC...\n");
+	/*
+	 * Try to get boot info using BOOTP.  If we succeed, then
+	 * the server IP address, gateway, and root path will all
+	 * be initialized.  If any remain uninitialized, we will
+	 * use RARP and RPC/bootparam (the Sun way) to get them.
+	 */
+	if (try_bootp)
+		bootp(sock, BOOTP_NONE);
+	if (myip.s_addr != 0)
+		goto exit;
+	if (debug)
+		printf("net_open: BOOTP failed, trying RARP/RPC...\n");
 #endif
 
-    /*
-     * Use RARP to get our IP address.  This also sets our
-     * netmask to the "natural" default for our address.
-     */
-    if (rarp_getipaddress(sock)) {
-	printf("net_open: RARP failed\n");
-	return (EIO);
-    }
-    printf("net_open: client addr: %s\n", inet_ntoa(myip));
+	/*
+	 * Use RARP to get our IP address.  This also sets our
+	 * netmask to the "natural" default for our address.
+	 */
+	if (rarp_getipaddress(sock)) {
+		printf("net_open: RARP failed\n");
+		return (EIO);
+	}
+	printf("net_open: client addr: %s\n", inet_ntoa(myip));
 
-    /* Get our hostname, server IP address, gateway. */
-    if (bp_whoami(sock)) {
-	printf("net_open: bootparam/whoami RPC failed\n");
-	return (EIO);
-    }
-    if (debug)
-        printf("net_open: client name: %s\n", hostname);
+	/* Get our hostname, server IP address, gateway. */
+	if (bp_whoami(sock)) {
+		printf("net_open: bootparam/whoami RPC failed\n");
+		return (EIO);
+	}
+	if (debug)
+		printf("net_open: client name: %s\n", hostname);
 
-    /*
-     * Ignore the gateway from whoami (unreliable).
-     * Use the "gateway" parameter instead.
-     */
-    smask = 0;
-    gateip.s_addr = 0;
-    if (bp_getfile(sock, "gateway", &gateip, buf) == 0) {
-	/* Got it!  Parse the netmask. */
-	smask = ip_convertaddr(buf);
-    }
-    if (smask) {
-	netmask = smask;
-        if (debug)
-            printf("net_open: subnet mask: %s\n", intoa(netmask));
-    }
-    if (gateip.s_addr && debug)
-        printf("net_open: net gateway: %s\n", inet_ntoa(gateip));
+	/*
+	 * Ignore the gateway from whoami (unreliable).
+	 * Use the "gateway" parameter instead.
+	 */
+	smask = 0;
+	gateip.s_addr = 0;
+	if (bp_getfile(sock, "gateway", &gateip, buf) == 0) {
+		/* Got it!  Parse the netmask. */
+		smask = ip_convertaddr(buf);
+	}
+	if (smask) {
+		netmask = smask;
+		if (debug)
+		printf("net_open: subnet mask: %s\n", intoa(netmask));
+	}
+	if (gateip.s_addr && debug)
+		printf("net_open: net gateway: %s\n", inet_ntoa(gateip));
 
-    /* Get the root server and pathname. */
-    if (bp_getfile(sock, "root", &rootip, rootpath)) {
-	printf("net_open: bootparam/getfile RPC failed\n");
-	return (EIO);
-    }
- exit:
-    /*
-     * If present, strip the server's address off of the rootpath
-     * before passing it along.  This allows us to be compatible with
-     * the kernel's diskless (BOOTP_NFSROOT) booting conventions
-     */
-    for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++)
-	    if (rootpath[i] == ':')
-		    break;
-    if (i && i != FNAME_SIZE && rootpath[i] == ':') {
-	    rootpath[i++] = '\0';
-	    if (inet_addr(&rootpath[0]) != INADDR_NONE)
-		    rootip.s_addr = inet_addr(&rootpath[0]);
-	    bcopy(&rootpath[i], &temp[0], strlen(&rootpath[i])+1);
-	    bcopy(&temp[0], &rootpath[0], strlen(&rootpath[i])+1);	    
-    }
-    if (debug) {
-        printf("net_open: server addr: %s\n", inet_ntoa(rootip));
-        printf("net_open: server path: %s\n", rootpath);
-    }
+	/* Get the root server and pathname. */
+	if (bp_getfile(sock, "root", &rootip, rootpath)) {
+		printf("net_open: bootparam/getfile RPC failed\n");
+		return (EIO);
+	}
+exit:
+	/*
+	 * If present, strip the server's address off of the rootpath
+	 * before passing it along.  This allows us to be compatible with
+	 * the kernel's diskless (BOOTP_NFSROOT) booting conventions
+	 */
+	for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++)
+		if (rootpath[i] == ':')
+			break;
+	if (i && i != FNAME_SIZE && rootpath[i] == ':') {
+		rootpath[i++] = '\0';
+		if (inet_addr(&rootpath[0]) != INADDR_NONE)
+			rootip.s_addr = inet_addr(&rootpath[0]);
+		bcopy(&rootpath[i], &temp[0], strlen(&rootpath[i])+1);
+		bcopy(&temp[0], &rootpath[0], strlen(&rootpath[i])+1);
+	}
+	if (debug) {
+		printf("net_open: server addr: %s\n", inet_ntoa(rootip));
+		printf("net_open: server path: %s\n", rootpath);
+	}
 
-    d = socktodesc(sock);
-    sprintf(temp, "%6D", d->myea, ":");
-    setenv("boot.netif.ip", inet_ntoa(myip), 1);
-    setenv("boot.netif.netmask", intoa(netmask), 1);
-    setenv("boot.netif.gateway", inet_ntoa(gateip), 1);
-    setenv("boot.netif.hwaddr", temp, 1);
-    setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
-    setenv("boot.nfsroot.path", rootpath, 1);
+	d = socktodesc(sock);
+	sprintf(temp, "%6D", d->myea, ":");
+	setenv("boot.netif.ip", inet_ntoa(myip), 1);
+	setenv("boot.netif.netmask", intoa(netmask), 1);
+	setenv("boot.netif.gateway", inet_ntoa(gateip), 1);
+	setenv("boot.netif.hwaddr", temp, 1);
+	setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
+	setenv("boot.nfsroot.path", rootpath, 1);
 
-    return (0);
+	return (0);
 }
 
 static void
 net_print(int verbose)
 {
-    return;
+	struct netif_driver *drv;
+	int i, d, cnt;
+
+	cnt = 0;
+	for (d = 0; netif_drivers[d]; d++) {
+		drv = netif_drivers[d];
+		for (i = 0; i < drv->netif_nifs; i++) {
+			printf("\t%s%d:", "net", cnt++);
+			if (verbose)
+				printf(" (%s%d)", drv->netif_bname,
+				    drv->netif_ifs[i].dif_unit);
+		}
+	}
+	printf("\n");
 }

==== //depot/projects/vimage-commit2/src/sys/boot/common/devopen.c#2 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/boot/common/devopen.c,v 1.5 2006/11/02 00:02:22 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/boot/common/devopen.c,v 1.6 2008/09/03 17:41:44 raj Exp $");
 
 #include <stand.h>
 #include <string.h>
@@ -35,32 +35,33 @@
 int
 devopen(struct open_file *f, const char *fname, const char **file) 
 {
-    struct devdesc *dev;
-    int result;
+	struct devdesc *dev;
+	int result;
 
-    result = archsw.arch_getdev((void **)&dev, fname, file);
-    if (result)
-	return (result);
+	result = archsw.arch_getdev((void **)&dev, fname, file);
+	if (result)
+		return (result);
 
-    /* point to device-specific data so that device open can use it */
-    f->f_devdata = dev;
-    result = dev->d_dev->dv_open(f, dev);
-    if (result != 0) {
-	f->f_devdata = NULL;
-	free(dev);
-	return (result);
-    }
+	/* point to device-specific data so that device open can use it */
+	f->f_devdata = dev;
+	result = dev->d_dev->dv_open(f, dev);
+	if (result != 0) {
+		f->f_devdata = NULL;
+		free(dev);
+		return (result);
+	}
 
-    /* reference the devsw entry from the open_file structure */
-    f->f_dev = dev->d_dev;
-    return (0);
+	/* reference the devsw entry from the open_file structure */
+	f->f_dev = dev->d_dev;
+	return (0);
 }
 
 int
 devclose(struct open_file *f)
 {
-    if (f->f_devdata != NULL) {
-	free(f->f_devdata);
-    }
-    return(0);
+
+	if (f->f_devdata != NULL) {
+		free(f->f_devdata);
+	}
+	return (0);
 }

==== //depot/projects/vimage-commit2/src/sys/boot/powerpc/uboot/start.S#2 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/boot/powerpc/uboot/start.S,v 1.3 2008/02/23 18:42:53 marcel Exp $
+ * $FreeBSD: src/sys/boot/powerpc/uboot/start.S,v 1.4 2008/09/03 16:38:27 raj Exp $
  */
 
 #include <machine/asm.h>
@@ -37,7 +37,7 @@
 	/* Hint where to look for the API signature */
 	lis	%r11, uboot_address at ha
 	addi	%r11, %r11, uboot_address at l
-	stw	%r2, 0(%r11)
+	stw	%r1, 0(%r11)
 	/* Save U-Boot's r14 */
 	lis	%r11, saved_regs at ha
 	addi	%r11, %r11, saved_regs at l

==== //depot/projects/vimage-commit2/src/sys/boot/uboot/common/main.c#3 (text+ko) ====

@@ -1,7 +1,7 @@
 /*-
  * Copyright (c) 2000 Benno Rice <benno at jeamland.net>
  * Copyright (c) 2000 Stephane Potvin <sepotvin at videotron.ca>
- * Copyright (c) 2007 Semihalf, Rafal Jaworowski <raj at semihalf.com>
+ * Copyright (c) 2007-2008 Semihalf, Rafal Jaworowski <raj at semihalf.com>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/boot/uboot/common/main.c,v 1.4 2008/09/03 15:39:50 raj Exp $");
+__FBSDID("$FreeBSD: src/sys/boot/uboot/common/main.c,v 1.5 2008/09/03 17:48:41 raj Exp $");
 
 #include <stand.h>
 
@@ -36,9 +36,9 @@
 #include "glue.h"
 #include "libuboot.h"
 
-struct uboot_devdesc	currdev;
-struct arch_switch	archsw;		/* MI/MD interface boundary */
-int			devs_no;
+struct uboot_devdesc currdev;
+struct arch_switch archsw;		/* MI/MD interface boundary */
+int devs_no;
 
 extern char end[];
 extern char bootprog_name[];
@@ -53,49 +53,37 @@
 extern unsigned char __sbss_end[];
 extern unsigned char _end[];
 
-void dump_si(struct sys_info *si)
+static void
+dump_sig(struct api_signature *sig)
 {
 #ifdef DEBUG
-	printf("sys info:\n");
-	printf("  clkbus\t= 0x%08x\n", si->clk_bus);
-	printf("  clkcpu\t= 0x%08x\n", si->clk_cpu);
-	printf("  bar\t\t= 0x%08x\n", si->bar);
-#endif
-}
-
-static void dump_sig(struct api_signature *sig)
-{
-#ifdef DEBUG
 	printf("signature:\n");
 	printf("  version\t= %d\n", sig->version);
 	printf("  checksum\t= 0x%08x\n", sig->checksum);
 	printf("  sc entry\t= 0x%08x\n", sig->syscall);
 #endif
 }
+
 static void
 dump_addr_info(void)
 {
 #ifdef DEBUG
 	printf("\naddresses info:\n");
-	printf(" _etext (sdata) = 0x%08x\n", (u_int32_t)_etext);
-	printf(" _edata         = 0x%08x\n", (u_int32_t)_edata);
-	printf(" __sbss_start   = 0x%08x\n", (u_int32_t)__sbss_start);
-	printf(" __sbss_end     = 0x%08x\n", (u_int32_t)__sbss_end);
-	printf(" __sbss_start   = 0x%08x\n", (u_int32_t)__bss_start);
-	printf(" _end           = 0x%08x\n", (u_int32_t)_end);
-	printf(" syscall entry  = 0x%08x\n", (u_int32_t)syscall_ptr);
+	printf(" _etext (sdata) = 0x%08x\n", (uint32_t)_etext);
+	printf(" _edata         = 0x%08x\n", (uint32_t)_edata);
+	printf(" __sbss_start   = 0x%08x\n", (uint32_t)__sbss_start);
+	printf(" __sbss_end     = 0x%08x\n", (uint32_t)__sbss_end);
+	printf(" __sbss_start   = 0x%08x\n", (uint32_t)__bss_start);
+	printf(" _end           = 0x%08x\n", (uint32_t)_end);
+	printf(" syscall entry  = 0x%08x\n", (uint32_t)syscall_ptr);
 #endif
 }
 
 static uint64_t
-memsize(int flags)
+memsize(struct sys_info *si, int flags)
 {
-	int		i;
-	struct sys_info	*si;
-	uint64_t	size;
-
-	if ((si = ub_get_sys_info()) == NULL)
-		return 0;
+	uint64_t size;
+	int i;
 
 	size = 0;
 	for (i = 0; i < si->mr_no; i++)
@@ -105,6 +93,25 @@
 	return (size);
 }
 
+static void
+meminfo(void)
+{
+	uint64_t size;
+	struct sys_info *si;
+	int t[3] = { MR_ATTR_DRAM, MR_ATTR_FLASH, MR_ATTR_SRAM };
+	int i;
+
+	if ((si = ub_get_sys_info()) == NULL)
+		panic("could not retrieve system info");
+
+	for (i = 0; i < 3; i++) {
+		size = memsize(si, t[i]);
+		if (size > 0)
+			printf("%s:\t %lldMB\n", ub_mem_type(t[i]),
+			    size / 1024 / 1024);
+	}
+}
+
 int
 main(void)
 {
@@ -112,14 +119,14 @@
 	int i;
 
 	if (!api_search_sig(&sig))
-		return -1;
+		return (-1);
 
 	syscall_ptr = sig->syscall;
 	if (syscall_ptr == NULL)
-		return -2;
+		return (-2);
 
 	if (sig->version > API_SIG_VERSION)
-		return -3;
+		return (-3);
 
         /* Clear BSS sections */
 	bzero(__sbss_start, __sbss_end - __sbss_start);
@@ -146,10 +153,9 @@
 	 * Enumerate U-Boot devices
 	 */
 	if ((devs_no = ub_dev_enum()) == 0)
-		panic("no devices found");
-	printf("Number of U-Boot devices found %d\n", devs_no);
+		panic("no U-Boot devices found");
+	printf("Number of U-Boot devices: %d\n", devs_no);
 
-	/* XXX all our dv_init()s currently don't do anything... */
 	/*
 	 * March through the device switch probing for things.
 	 */
@@ -160,9 +166,7 @@
 	printf("\n");
 	printf("%s, Revision %s\n", bootprog_name, bootprog_rev);
 	printf("(%s, %s)\n", bootprog_maker, bootprog_date);
-	printf("Memory: %lldMB\n", memsize(MR_ATTR_DRAM) / 1024 / 1024);
-	printf("FLASH:  %lldMB\n", memsize(MR_ATTR_FLASH) / 1024 / 1024);
-//	printf("SRAM:   %lldMB\n", memsize(MR_ATTR_SRAM) / 1024 / 1024);
+	meminfo();
 
 	/* XXX only support netbooting for now */
 	for (i = 0; devsw[i] != NULL; i++)
@@ -193,7 +197,7 @@
 
 	interact();				/* doesn't return */
 
-	return 0;
+	return (0);
 }
 
 
@@ -205,7 +209,7 @@
 	printf("heap base at %p, top at %p, used %d\n", end, sbrk(0),
 	    sbrk(0) - end);
 
-	return(CMD_OK);
+	return (CMD_OK);
 }
 
 COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot);
@@ -218,3 +222,38 @@
 	printf("Reset failed!\n");
 	while(1);
 }
+
+COMMAND_SET(devinfo, "devinfo", "show U-Boot devices", command_devinfo);
+static int
+command_devinfo(int argc, char *argv[])
+{
+	int i;
+
+	if ((devs_no = ub_dev_enum()) == 0) {
+		command_errmsg = "no U-Boot devices found!?";
+		return (CMD_ERROR);
+	}
+	
+	printf("U-Boot devices:\n");
+	for (i = 0; i < devs_no; i++) {
+		ub_dump_di(i);
+		printf("\n");
+	}
+	return (CMD_OK);
+}
+
+COMMAND_SET(sysinfo, "sysinfo", "show U-Boot system info", command_sysinfo);
+static int
+command_sysinfo(int argc, char *argv[])
+{
+	struct sys_info *si;
+
+	if ((si = ub_get_sys_info()) == NULL) {
+		command_errmsg = "could not retrieve U-Boot sys info!?";
+		return (CMD_ERROR);
+	}
+
+	printf("U-Boot system info:\n");
+	ub_dump_si(si);
+	return (CMD_OK);
+}

==== //depot/projects/vimage-commit2/src/sys/boot/uboot/lib/glue.c#2 (text+ko) ====

@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2007 Semihalf, Rafal Jaworowski <raj at semihalf.com>
+ * Copyright (c) 2007-2008 Semihalf, Rafal Jaworowski <raj at semihalf.com>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/boot/uboot/lib/glue.c,v 1.4 2008/03/13 17:54:21 obrien Exp $");
+__FBSDID("$FreeBSD: src/sys/boot/uboot/lib/glue.c,v 1.5 2008/09/03 17:48:41 raj Exp $");
 
 #include <stand.h>
 #include "api_public.h"
@@ -41,7 +41,7 @@
 #endif
 
 /* Some random address used by U-Boot. */
-extern long		uboot_address;
+extern long uboot_address;
 
 /* crc32 stuff stolen from lib/libdisk/write_ia64_disk.c */
 static uint32_t crc32_tab[] = {
@@ -138,7 +138,6 @@
 int
 api_search_sig(struct api_signature **sig)
 {
-
 	unsigned char *sp, *spend;
 
 	if (sig == NULL)
@@ -176,7 +175,7 @@
 	if (!syscall(API_GETC, NULL, (uint32_t)&c))
 		return (-1);
 
-	return c;
+	return (c);
 }
 
 int
@@ -187,7 +186,7 @@
 	if (!syscall(API_TSTC, NULL, (uint32_t)&t))
 		return (-1);
 
-	return t;
+	return (t);
 }
 
 void
@@ -313,7 +312,7 @@
 		di->cookie = devices[n - 1].cookie;
 
 		if (!syscall(API_DEV_ENUM, NULL, di))
-			return 0;
+			return (0);
 	}
 
 	return (n);
@@ -461,6 +460,87 @@
 	return (err);
 }
 
+static char *
+ub_stor_type(int type)
+{
+
+	if (type & DT_STOR_IDE)
+		return ("IDE");
+
+	if (type & DT_STOR_SCSI)
+		return ("SCSI");
+
+	if (type & DT_STOR_USB)
+		return ("USB");
+
+	if (type & DT_STOR_MMC);
+		return ("MMC");
+
+	return ("Unknown");
+}
+
+char *
+ub_mem_type(int flags)
+{
+
+	switch(flags & 0x000F) {
+	case MR_ATTR_FLASH:
+		return ("FLASH");
+	case MR_ATTR_DRAM:
+		return ("DRAM");
+	case MR_ATTR_SRAM:
+		return ("SRAM");
+	default:
+		return ("Unknown");
+	}
+}
+
+void
+ub_dump_di(int handle)
+{
+	struct device_info *di = ub_dev_get(handle);
+	int i;
+
+	printf("device info (%d):\n", handle);
+	printf("  cookie\t= 0x%08x\n", (uint32_t)di->cookie);
+	printf("  type\t\t= 0x%08x\n", di->type);
+
+	if (di->type == DEV_TYP_NET) {
+		printf("  hwaddr\t= ");
+		for (i = 0; i < 6; i++)
+			printf("%02x ", di->di_net.hwaddr[i]);
+
+		printf("\n");
+
+	} else if (di->type & DEV_TYP_STOR) {
+		printf("  type\t\t= %s\n", ub_stor_type(di->type));
+		printf("  blk size\t\t= %ld\n", di->di_stor.block_size);
+		printf("  blk count\t\t= %ld\n", di->di_stor.block_count);
+	}
+}
+
+void
+ub_dump_si(struct sys_info *si)
+{
+	int i;
+
+	printf("sys info:\n");
+	printf("  clkbus\t= %ld MHz\n", si->clk_bus / 1000 / 1000);
+	printf("  clkcpu\t= %ld MHz\n", si->clk_cpu / 1000 / 1000);
+	printf("  bar\t\t= 0x%08lx\n", si->bar);
+
+	printf("---\n");
+	for (i = 0; i < si->mr_no; i++) {
+		if (si->mr[i].flags == 0)
+			break;
+
+		printf("  start\t= 0x%08lx\n", si->mr[i].start);
+		printf("  size\t= 0x%08lx\n", si->mr[i].size);
+		printf("  type\t= %s\n", ub_mem_type(si->mr[i].flags));
+		printf("---\n");
+	}
+}
+
 /****************************************
  *
  * env vars

==== //depot/projects/vimage-commit2/src/sys/boot/uboot/lib/glue.h#3 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/boot/uboot/lib/glue.h,v 1.3 2008/09/03 15:39:50 raj Exp $
+ * $FreeBSD: src/sys/boot/uboot/lib/glue.h,v 1.4 2008/09/03 17:48:41 raj Exp $
  */
 
 /*
@@ -35,10 +35,10 @@
 
 #include "api_public.h"
 
-int	syscall(int, int *, ...);
-void	*syscall_ptr;
+int syscall(int, int *, ...);
+void *syscall_ptr;
 
-int	api_search_sig(struct api_signature **sig);
+int api_search_sig(struct api_signature **sig);
 
 /*
  * The ub_ library calls are part of the application, not U-Boot code!  They
@@ -48,32 +48,36 @@
  */
 
 /* console */
-int	ub_getc(void);
-int	ub_tstc(void);
-void	ub_putc(char c);
-void	ub_puts(const char *s);
+int ub_getc(void);
+int ub_tstc(void);
+void ub_putc(char c);
+void ub_puts(const char *s);
 
 /* system */
-void	ub_reset(void);
+void ub_reset(void);
 struct sys_info *ub_get_sys_info(void);
 
 /* time */
-void		ub_udelay(unsigned long);
-unsigned long	ub_get_timer(unsigned long);
+void ub_udelay(unsigned long);
+unsigned long ub_get_timer(unsigned long);
 
 /* env vars */
-char	*ub_env_get(const char *name);
-void	ub_env_set(const char *name, char *value);
-const char	*ub_env_enum(const char *last);
+char *ub_env_get(const char *name);
+void ub_env_set(const char *name, char *value);
+const char *ub_env_enum(const char *last);
 
 /* devices */
-int	ub_dev_enum(void);
-int	ub_dev_open(int handle);
-int	ub_dev_close(int handle);
-int	ub_dev_read(int handle, void *buf, lbasize_t len, lbastart_t start);
-int	ub_dev_send(int handle, void *buf, int len);
-int	ub_dev_recv(int handle, void *buf, int len);
+int ub_dev_enum(void);
+int ub_dev_open(int handle);
+int ub_dev_close(int handle);
+int ub_dev_read(int handle, void *buf, lbasize_t len, lbastart_t start);
+int ub_dev_send(int handle, void *buf, int len);
+int ub_dev_recv(int handle, void *buf, int len);
 
 struct device_info *	ub_dev_get(int);
 
+void ub_dump_di(int);
+void ub_dump_si(struct sys_info *);
+char *ub_mem_type(int);
+
 #endif /* _API_GLUE_H_ */

==== //depot/projects/vimage-commit2/src/sys/conf/files.sun4v#2 (text+ko) ====

@@ -1,7 +1,7 @@
 # This file tells config what files go into building a kernel,
 # files marked standard are always included.
 #
-# $FreeBSD: src/sys/conf/files.sun4v,v 1.15 2008/05/02 17:41:52 marius Exp $
+# $FreeBSD: src/sys/conf/files.sun4v,v 1.16 2008/09/03 17:31:13 marius Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -34,7 +34,7 @@
 libkern/flsl.c			standard
 sparc64/sparc64/autoconf.c	standard
 sun4v/sun4v/bus_machdep.c	standard
-sparc64/sparc64/clock.c		standard
+sun4v/sun4v/clock.c		standard
 sparc64/sparc64/db_disasm.c	optional	ddb
 sun4v/sun4v/db_interface.c	optional	ddb
 sun4v/sun4v/db_trace.c		optional	ddb

==== //depot/projects/vimage-commit2/src/sys/netinet/ip_fw2.c#17 (text+ko) ====

@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/ip_fw2.c,v 1.190 2008/08/25 05:38:18 julian Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/ip_fw2.c,v 1.191 2008/09/03 18:09:15 julian Exp $");
 
 #define        DEB(x)
 #define        DDB(x) x
@@ -4484,7 +4484,7 @@
 				continue;
 			if ( (q->state & BOTH_SYN) != BOTH_SYN)
 				continue;
-			if (TIME_LEQ( time_uptime + V_dyn_keepalive_interval,
+			if (TIME_LEQ(time_uptime + V_dyn_keepalive_interval,
 			    q->expire))
 				continue;	/* too early */
 			if (TIME_LEQ(q->expire, time_uptime))

==== //depot/projects/vimage-commit2/src/sys/sparc64/include/clock.h#2 (text+ko) ====

@@ -23,14 +23,16 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.

>>> TRUNCATED FOR MAIL (1000 lines) <<<


More information about the p4-projects mailing list