Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Mar 2009 22:29:42 +0000 (UTC)
From:      Sam Leffler <sam@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r189654 - head/sys/dev/cfi
Message-ID:  <200903102229.n2AMTgvM075573@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sam
Date: Tue Mar 10 22:29:42 2009
New Revision: 189654
URL: http://svn.freebsd.org/changeset/base/189654

Log:
  choose the size of the last region for d_stripsize instead of the first;
  this fixes geom_redboot on boards that have multiple parts/regions as it
  uses the value to locate the FIS directory which is in the last erase
  region of flash

Modified:
  head/sys/dev/cfi/cfi_disk.c

Modified: head/sys/dev/cfi/cfi_disk.c
==============================================================================
--- head/sys/dev/cfi/cfi_disk.c	Tue Mar 10 22:04:52 2009	(r189653)
+++ head/sys/dev/cfi/cfi_disk.c	Tue Mar 10 22:29:42 2009	(r189654)
@@ -99,9 +99,16 @@ cfi_disk_attach(device_t dev)
 	sc->disk->d_mediasize = sc->parent->sc_size;
 	sc->disk->d_maxsize = CFI_DISK_MAXIOSIZE;
 	/* NB: use stripesize to hold the erase/region size */
-	if (sc->parent->sc_regions)
-		sc->disk->d_stripesize = sc->parent->sc_region->r_blksz;
-	else
+	if (sc->parent->sc_regions) {
+		/*
+		 * Multiple regions, use the last one.  This is a
+		 * total hack as it's (presently) used only by
+		 * geom_redboot to locate the FIS directory which
+		 * lies at the start of the last erase region.
+		 */
+		sc->disk->d_stripesize =
+		    sc->parent->sc_region[sc->parent->sc_regions-1].r_blksz;
+	} else
 		sc->disk->d_stripesize = sc->disk->d_mediasize;
 	sc->disk->d_drv1 = sc;
 	disk_create(sc->disk, DISK_VERSION);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903102229.n2AMTgvM075573>