From owner-freebsd-sparc64@FreeBSD.ORG Sat Jun 30 12:22:10 2012 Return-Path: Delivered-To: sparc64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE05D1065672 for ; Sat, 30 Jun 2012 12:22:10 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 625898FC0C for ; Sat, 30 Jun 2012 12:22:10 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id q5UCM9pc094692 for ; Sat, 30 Jun 2012 14:22:09 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id q5UCM9bJ094691 for sparc64@freebsd.org; Sat, 30 Jun 2012 14:22:09 +0200 (CEST) (envelope-from marius) Date: Sat, 30 Jun 2012 14:22:09 +0200 From: Marius Strobl To: sparc64@freebsd.org Message-ID: <20120630122209.GL69382@alchemy.franken.de> References: <201206291839.q5TIdN1G063896@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201206291839.q5TIdN1G063896@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: Subject: Re: svn commit: r237815 - stable/9/sys/boot/sparc64/loader X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jun 2012 12:22:10 -0000 FYI, with this commit and r237816 for stable/8, the ZFS boot support for sparc64 in stable/{8,9} should be en par with x86. Instructions can be found in the original commit log: http://svnweb.freebsd.org/base?view=revision&revision=234898 Thanks to Gavin Mu for his work! Marius On Fri, Jun 29, 2012 at 06:39:23PM +0000, Marius Strobl wrote: > Author: marius > Date: Fri Jun 29 18:39:22 2012 > New Revision: 237815 > URL: http://svn.freebsd.org/changeset/base/237815 > > Log: > MFC: r236581 > > The loaddev environment variable is not modifiable once set, so it is not > update for ZFS. It seems that this does not really affect anything except > the help command. Nevertheless, rearrange things so loaddev is set only > once in all cases in order to get it right. > Pointed out by: avg > > Modified: > stable/9/sys/boot/sparc64/loader/main.c > Directory Properties: > stable/9/sys/ (props changed) > stable/9/sys/amd64/include/xen/ (props changed) > stable/9/sys/boot/ (props changed) > stable/9/sys/boot/i386/efi/ (props changed) > stable/9/sys/boot/ia64/efi/ (props changed) > stable/9/sys/boot/ia64/ski/ (props changed) > stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) > stable/9/sys/boot/powerpc/ofw/ (props changed) > stable/9/sys/cddl/contrib/opensolaris/ (props changed) > stable/9/sys/conf/ (props changed) > stable/9/sys/contrib/dev/acpica/ (props changed) > stable/9/sys/contrib/octeon-sdk/ (props changed) > stable/9/sys/contrib/pf/ (props changed) > stable/9/sys/contrib/x86emu/ (props changed) > stable/9/sys/dev/ (props changed) > stable/9/sys/dev/e1000/ (props changed) > stable/9/sys/dev/isp/ (props changed) > stable/9/sys/dev/ixgbe/ (props changed) > stable/9/sys/fs/ (props changed) > stable/9/sys/fs/ntfs/ (props changed) > stable/9/sys/modules/ (props changed) > > Modified: stable/9/sys/boot/sparc64/loader/main.c > ============================================================================== > --- stable/9/sys/boot/sparc64/loader/main.c Fri Jun 29 18:18:51 2012 (r237814) > +++ stable/9/sys/boot/sparc64/loader/main.c Fri Jun 29 18:39:22 2012 (r237815) > @@ -141,6 +141,7 @@ static u_int tlb_locked; > static vm_offset_t curkva = 0; > static vm_offset_t heapva; > > +static char bootpath[64]; > static phandle_t root; > > /* > @@ -740,7 +741,7 @@ sparc64_zfs_probe(void) > > /* Get the GUID of the ZFS pool on the boot device. */ > guid = 0; > - zfs_probe_dev(getenv("currdev"), &guid); > + zfs_probe_dev(bootpath, &guid); > > for (unit = 0; unit < MAXDEV; unit++) { > /* Find freebsd-zfs slices in the VTOC. */ > @@ -757,7 +758,7 @@ sparc64_zfs_probe(void) > > for (part = 0; part < 8; part++) { > if (part == 2 || vtoc.part[part].tag != > - VTOC_TAG_FREEBSD_ZFS) > + VTOC_TAG_FREEBSD_ZFS) > continue; > sprintf(devname, "disk%d:%c", unit, part + 'a'); > if (zfs_probe_dev(devname, NULL) == ENXIO) > @@ -770,11 +771,9 @@ sparc64_zfs_probe(void) > zfs_currdev.root_guid = 0; > zfs_currdev.d_dev = &zfs_dev; > zfs_currdev.d_type = zfs_currdev.d_dev->dv_type; > - /* Update the environment for ZFS. */ > - env_setenv("currdev", EV_VOLATILE, zfs_fmtdev(&zfs_currdev), > - ofw_setcurrdev, env_nounset); > - env_setenv("loaddev", EV_VOLATILE, zfs_fmtdev(&zfs_currdev), > - env_noset, env_nounset); > + (void)strncpy(bootpath, zfs_fmtdev(&zfs_currdev), > + sizeof(bootpath) - 1); > + bootpath[sizeof(bootpath) - 1] = '\0'; > } > } > #endif /* LOADER_ZFS_SUPPORT */ > @@ -782,7 +781,6 @@ sparc64_zfs_probe(void) > int > main(int (*openfirm)(void *)) > { > - char bootpath[64]; > char compatible[32]; > struct devsw **dp; > > @@ -834,16 +832,11 @@ main(int (*openfirm)(void *)) > */ > if (bootpath[strlen(bootpath) - 2] == ':' && > bootpath[strlen(bootpath) - 1] == 'f' && > - strstr(bootpath, "cdrom")) { > + strstr(bootpath, "cdrom") != NULL) { > bootpath[strlen(bootpath) - 1] = 'a'; > printf("Boot path set to %s\n", bootpath); > } > > - env_setenv("currdev", EV_VOLATILE, bootpath, > - ofw_setcurrdev, env_nounset); > - env_setenv("loaddev", EV_VOLATILE, bootpath, > - env_noset, env_nounset); > - > /* > * Initialize devices. > */ > @@ -851,6 +844,15 @@ main(int (*openfirm)(void *)) > if ((*dp)->dv_init != 0) > (*dp)->dv_init(); > > + /* > + * Now that sparc64_zfs_probe() might have altered bootpath, > + * export it. > + */ > + env_setenv("currdev", EV_VOLATILE, bootpath, > + ofw_setcurrdev, env_nounset); > + env_setenv("loaddev", EV_VOLATILE, bootpath, > + env_noset, env_nounset); > + > printf("\n"); > printf("%s, Revision %s\n", bootprog_name, bootprog_rev); > printf("(%s, %s)\n", bootprog_maker, bootprog_date); > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"