From owner-svn-src-all@FreeBSD.ORG Mon Mar 17 16:10:42 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DAA0345A; Mon, 17 Mar 2014 16:10:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BA8B47D9; Mon, 17 Mar 2014 16:10:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s2HGAgi4030551; Mon, 17 Mar 2014 16:10:42 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s2HGAgQh030550; Mon, 17 Mar 2014 16:10:42 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201403171610.s2HGAgQh030550@svn.freebsd.org> From: Ian Lepore Date: Mon, 17 Mar 2014 16:10:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r263267 - head/sys/boot/uboot/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Mar 2014 16:10:42 -0000 Author: ian Date: Mon Mar 17 16:10:42 2014 New Revision: 263267 URL: http://svnweb.freebsd.org/changeset/base/263267 Log: Cosmetic changes to printed output, mostly related to probing devices... - Display slice and partition as instead of 0 or -1 when they're not set to specific values (the paritition=-1 was confusing folks). - When loaderdev isn't set in the u-boot environment, say so rather than displaying unknown device ''. - Print the loader(8) ident/version info earlier, so that all device- related info appears together afterwards. The one change here that isn't purely cosmetic is to call setheap() earlier. The comment says "Initialise heap as early as possible", now that's more accurate. It shouldn't make any functional difference, but may be safer if future changes lead to trying to allocate memory earlier. Modified: head/sys/boot/uboot/common/main.c Modified: head/sys/boot/uboot/common/main.c ============================================================================== --- head/sys/boot/uboot/common/main.c Mon Mar 17 14:19:42 2014 (r263266) +++ head/sys/boot/uboot/common/main.c Mon Mar 17 16:10:42 2014 (r263267) @@ -128,7 +128,7 @@ meminfo(void) for (i = 0; i < 3; i++) { size = memsize(si, t[i]); if (size > 0) - printf("%s:\t %lldMB\n", ub_mem_type(t[i]), + printf("%s: %lldMB\n", ub_mem_type(t[i]), size / 1024 / 1024); } } @@ -198,18 +198,20 @@ get_load_device(int *type, int *unit, in const char *p; char *endp; - devstr = ub_env_get("loaderdev"); - if (devstr == NULL) - devstr = ""; - else - printf("U-Boot setting: loaderdev=%s\n", devstr); - - p = get_device_type(devstr, type); - + *type = -1; *unit = -1; *slice = 0; *partition = -1; + devstr = ub_env_get("loaderdev"); + if (devstr == NULL) { + printf("U-Boot env: loaderdev not set, will probe all devices.\n"); + return; + } + printf("U-Boot env: loaderdev='%s'\n", devstr); + + p = get_device_type(devstr, type); + /* * Empty device string, or unknown device name, or a bare, known * device name. @@ -297,6 +299,27 @@ get_load_device(int *type, int *unit, in *partition = -1; } +static void +print_disk_probe_info() +{ + char slice[32]; + char partition[32]; + + if (currdev.d_disk.slice > 0) + sprintf(slice, "%d", currdev.d_disk.slice); + else + strcpy(slice, ""); + + if (currdev.d_disk.partition > 0) + sprintf(partition, "%d", currdev.d_disk.partition); + else + strcpy(partition, ""); + + printf(" Checking unit=%d slice=%s partition=%s...", + currdev.d_unit, slice, partition); + +} + static int probe_disks(int devidx, int load_type, int load_unit, int load_slice, int load_partition) @@ -311,13 +334,11 @@ probe_disks(int devidx, int load_type, i open_result = -1; if (load_type == -1) { - printf("Probing all storage devices...\n"); + printf(" Probing all disk devices...\n"); /* Try each disk in succession until one works. */ for (currdev.d_unit = 0; currdev.d_unit < UB_MAX_DEV; currdev.d_unit++) { - printf("Checking unit=%d slice=%d partition=%d...", - currdev.d_unit, currdev.d_disk.slice, - currdev.d_disk.partition); + print_disk_probe_info(); open_result = devsw[devidx]->dv_open(&f, &currdev); if (open_result == 0) { printf(" good.\n"); @@ -329,15 +350,13 @@ probe_disks(int devidx, int load_type, i } if (load_unit == -1) { - printf("Probing all %s devices...\n", device_typename(load_type)); + printf(" Probing all %s devices...\n", device_typename(load_type)); /* Try each disk of given type in succession until one works. */ for (unit = 0; unit < UB_MAX_DEV; unit++) { currdev.d_unit = uboot_diskgetunit(load_type, unit); if (currdev.d_unit == -1) break; - printf("Checking unit=%d slice=%d partition=%d...", - currdev.d_unit, currdev.d_disk.slice, - currdev.d_disk.partition); + print_disk_probe_info(); open_result = devsw[devidx]->dv_open(&f, &currdev); if (open_result == 0) { printf(" good.\n"); @@ -349,18 +368,16 @@ probe_disks(int devidx, int load_type, i } if ((currdev.d_unit = uboot_diskgetunit(load_type, load_unit)) != -1) { - printf("Checking unit=%d slice=%d partition=%d...", - currdev.d_unit, currdev.d_disk.slice, - currdev.d_disk.partition); + print_disk_probe_info(); open_result = devsw[devidx]->dv_open(&f,&currdev); if (open_result == 0) { - printf("good.\n"); + printf(" good.\n"); return (0); } printf("\n"); } - printf("Requested disk type/unit not found\n"); + printf(" Requested disk type/unit not found\n"); return (-1); } @@ -393,21 +410,26 @@ main(void) bzero(__bss_start, _end - __bss_start); /* - * Set up console. - */ + * Initialise the heap as early as possible. Once this is done, + * alloc() is usable. The stack is buried inside us, so this is safe. + */ + setheap((void *)end, (void *)(end + 512 * 1024)); + + /* + * Set up console. + */ cons_probe(); + printf("Compatible U-Boot API signature found @%x\n", (uint32_t)sig); - printf("Compatible API signature found @%x\n", (uint32_t)sig); + printf("\n"); + printf("%s, Revision %s\n", bootprog_name, bootprog_rev); + printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n"); dump_sig(sig); dump_addr_info(); - /* - * Initialise the heap as early as possible. Once this is done, - * alloc() is usable. The stack is buried inside us, so this is - * safe. - */ - setheap((void *)end, (void *)(end + 512 * 1024)); + meminfo(); /* * Enumerate U-Boot devices @@ -416,11 +438,6 @@ main(void) panic("no U-Boot devices found"); printf("Number of U-Boot devices: %d\n", devs_no); - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); - meminfo(); - get_load_device(&load_type, &load_unit, &load_slice, &load_partition); /*