From owner-p4-projects@FreeBSD.ORG Tue Jan 12 22:14:01 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2A3541065695; Tue, 12 Jan 2010 22:14:01 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB4951065676 for ; Tue, 12 Jan 2010 22:14:00 +0000 (UTC) (envelope-from raj@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B8C3B8FC08 for ; Tue, 12 Jan 2010 22:14:00 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o0CME0I8036144 for ; Tue, 12 Jan 2010 22:14:00 GMT (envelope-from raj@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o0CME0kc036142 for perforce@freebsd.org; Tue, 12 Jan 2010 22:14:00 GMT (envelope-from raj@freebsd.org) Date: Tue, 12 Jan 2010 22:14:00 GMT Message-Id: <201001122214.o0CME0kc036142@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to raj@freebsd.org using -f From: Rafal Jaworowski To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 173045 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jan 2010 22:14:01 -0000 http://p4web.freebsd.org/chv.cgi?CH=173045 Change 173045 by raj@raj_fdt on 2010/01/12 22:13:55 loader(8) cleanups. - Prevent endianess when modifying DT property. - Supply '/chosen/stdin' property if not present (this will be required by the reworked uart console FDT attachment). - Assorted minor typos and cosmetic fixes. Affected files ... .. //depot/projects/fdt/sys/boot/uboot/common/main.c#3 edit .. //depot/projects/fdt/sys/boot/uboot/lib/fdt.c#3 edit Differences ... ==== //depot/projects/fdt/sys/boot/uboot/common/main.c#3 (text+ko) ==== @@ -53,6 +53,8 @@ extern unsigned char __sbss_end[]; extern unsigned char _end[]; +extern int command_fdt_internal(int argc, char *argv[]); + static void dump_sig(struct api_signature *sig) { @@ -259,4 +261,17 @@ return (CMD_OK); } +/* + * Since proper fdt command handling function is defined in fdt.c, and + * declaring it as extern is in contradiction with COMMAND_SET() macro + * (which uses static pointer), we're defining wrapper function, which + * calls the proper fdt handling routine. + */ +static int +command_fdt(int argc, char *argv[]) +{ + + return (command_fdt_internal(argc, argv)); +} + COMMAND_SET(fdt, "fdt", "flattened device tree handling", command_fdt); ==== //depot/projects/fdt/sys/boot/uboot/lib/fdt.c#3 (text+ko) ==== @@ -100,7 +100,7 @@ int err; /* - * Find the device tree blob + * Find the device tree blob. */ bfp = file_findfile(NULL, "dtb"); if (bfp == NULL) { @@ -110,7 +110,7 @@ fdtp = (struct fdt_header *)bfp->f_addr; /* - * Validate the blob + * Validate the blob. */ err = fdt_check_header(fdtp); if (err < 0) { @@ -127,7 +127,6 @@ return (CMD_OK); } - #define fdt_strtovect(str, cellbuf, lim, cellsize) _fdt_strtovect((str), \ (cellbuf), (lim), (cellsize), 0); @@ -160,7 +159,8 @@ buf++; if (u32buf != NULL) - u32buf[cnt] = (uint32_t)strtol(buf, NULL, base); + u32buf[cnt] = + cpu_to_fdt32((uint32_t)strtol(buf, NULL, base)); else u8buf[cnt] = (uint8_t)strtol(buf, NULL, base); @@ -260,7 +260,6 @@ lo = MIN(o, o2); } - } void @@ -331,13 +330,14 @@ void fixup_stdout(const char *env) { - const char *str = ub_env_get(env); + const char *str; char *ptr; int serialno; int len, no, sero; const struct fdt_property *prop; char *tmp[10]; + str = ub_env_get(env); ptr = (char *)str + strlen(str) - 1; while (ptr > str && isdigit(*(str - 1))) str--; @@ -351,6 +351,8 @@ return; prop = fdt_get_property(fdtp, no, "stdout", &len); + + /* If /chosen/stdout does not extist, create it */ if (prop == NULL || (prop != NULL && len == 0)) { bzero(tmp, 10 * sizeof(char)); @@ -370,6 +372,8 @@ fdt_setprop(fdtp, no, "stdout", &tmp, strlen((char *)&tmp) + 1); + fdt_setprop(fdtp, no, "stdin", &tmp, + strlen((char *)&tmp) + 1); } } @@ -446,7 +450,7 @@ } int -command_fdt(int argc, char *argv[]) +command_fdt_internal(int argc, char *argv[]) { cmdf_t *cmdh; char *cmd; @@ -458,7 +462,7 @@ } /* - * Validate fdt + * Validate fdt . */ cmd = strdup(argv[1]); i = 0; @@ -486,7 +490,7 @@ fdt_fixup(); /* - * Call command handler + * Call command handler. */ err = (*cmdh)(argc, argv); @@ -1045,8 +1049,7 @@ rv = fdt_modprop(o, propname, value, 0); if (rv) return (CMD_ERROR); - else - return (CMD_OK); + return (CMD_OK); } /* User wants to display properties */