From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 23 06:29:35 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BC731065672; Sat, 23 Jan 2010 06:29:35 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 39A558FC16; Sat, 23 Jan 2010 06:29:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0N6TZsb022393; Sat, 23 Jan 2010 06:29:35 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0N6TZMY022390; Sat, 23 Jan 2010 06:29:35 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201001230629.o0N6TZMY022390@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 23 Jan 2010 06:29:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r202866 - stable/8/sys/boot/ia64/efi X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2010 06:29:35 -0000 Author: marcel Date: Sat Jan 23 06:29:34 2010 New Revision: 202866 URL: http://svn.freebsd.org/changeset/base/202866 Log: MFC rev 202552: Add command-line option -dev to set the default value of the currdev variable. Modified: stable/8/sys/boot/ia64/efi/main.c stable/8/sys/boot/ia64/efi/version Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/boot/ia64/efi/main.c ============================================================================== --- stable/8/sys/boot/ia64/efi/main.c Sat Jan 23 05:59:10 2010 (r202865) +++ stable/8/sys/boot/ia64/efi/main.c Sat Jan 23 06:29:34 2010 (r202866) @@ -50,7 +50,6 @@ extern char bootprog_rev[]; extern char bootprog_date[]; extern char bootprog_maker[]; -struct devdesc currdev; /* our current device */ struct arch_switch archsw; /* MI/MD interface boundary */ extern u_int64_t ia64_pal_entry; @@ -101,10 +100,49 @@ find_pal_proc(void) return; } +static int +usc2cmp(CHAR16 *s1, CHAR16 *s2) +{ + + while (*s1 == *s2++) { + if (*s1++ == 0) + return (0); + } + return (*s1 - *(s2 - 1)); +} + +static char * +get_dev_option(int argc, CHAR16 *argv[]) +{ + static char dev[32]; + CHAR16 *arg; + char *devp; + int i, j; + + devp = NULL; + for (i = 0; i < argc; i++) { + if (usc2cmp(argv[i], L"-dev") == 0 && i < argc - 1) { + arg = argv[i + 1]; + j = 0; + while (j < sizeof(dev) && *arg != 0) + dev[j++] = *arg++; + if (j == sizeof(dev)) + j--; + dev[j] = '\0'; + devp = dev; + break; + } + } + + return (devp); +} + EFI_STATUS main(int argc, CHAR16 *argv[]) { + struct devdesc currdev; EFI_LOADED_IMAGE *img; + char *dev; int i; /* @@ -115,6 +153,10 @@ main(int argc, CHAR16 *argv[]) */ cons_probe(); + printf("\n"); + printf("%s, Revision %s\n", bootprog_name, bootprog_rev); + printf("(%s, %s)\n", bootprog_maker, bootprog_date); + find_pal_proc(); /* @@ -124,16 +166,6 @@ main(int argc, CHAR16 *argv[]) if (devsw[i]->dv_init != NULL) (devsw[i]->dv_init)(); - /* Get our loaded image protocol interface structure. */ - BS->HandleProtocol(IH, &imgid, (VOID**)&img); - - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); - - efi_handle_lookup(img->DeviceHandle, &currdev.d_dev, &currdev.d_unit); - currdev.d_type = currdev.d_dev->dv_type; - /* * Disable the watchdog timer. By default the boot manager sets * the timer to 5 minutes before invoking a boot option. If we @@ -145,13 +177,24 @@ main(int argc, CHAR16 *argv[]) */ BS->SetWatchdogTimer(0, 0, 0, NULL); - env_setenv("currdev", EV_VOLATILE, ia64_fmtdev(&currdev), - ia64_setcurrdev, env_nounset); + /* Get our loaded image protocol interface structure. */ + BS->HandleProtocol(IH, &imgid, (VOID**)&img); + + bzero(&currdev, sizeof(currdev)); + efi_handle_lookup(img->DeviceHandle, &currdev.d_dev, &currdev.d_unit); + currdev.d_type = currdev.d_dev->dv_type; + env_setenv("loaddev", EV_VOLATILE, ia64_fmtdev(&currdev), env_noset, env_nounset); + dev = get_dev_option(argc, argv); + if (dev == NULL) + dev = ia64_fmtdev(&currdev); + + env_setenv("currdev", EV_VOLATILE, dev, ia64_setcurrdev, env_nounset); + setenv("LINES", "24", 1); /* optional */ - + archsw.arch_autoload = ia64_autoload; archsw.arch_getdev = ia64_getdev; archsw.arch_copyin = ia64_copyin; Modified: stable/8/sys/boot/ia64/efi/version ============================================================================== --- stable/8/sys/boot/ia64/efi/version Sat Jan 23 05:59:10 2010 (r202865) +++ stable/8/sys/boot/ia64/efi/version Sat Jan 23 06:29:34 2010 (r202866) @@ -3,6 +3,7 @@ $FreeBSD$ NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this file is important. Make sure the current version number is on line 6. +2.1: Add support for "-dev " argument parsing. 2.0: Provide devices based on the block I/O protocol, rather than the simple file services protocol. Use the FreeBSD file system code on top of those devices to access files.