Date: Tue, 03 Sep 2019 14:07:29 -0000 From: Justin Hibbits <jhibbits@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r346363 - head/sys/powerpc/powernv Message-ID: <201904190228.x3J2S4LV050207@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhibbits Date: Fri Apr 19 02:28:04 2019 New Revision: 346363 URL: https://svnweb.freebsd.org/changeset/base/346363 Log: powerpc/powernv: Make erasing before writes optional If the OPAL flash driver supports writing without erase, it adds a 'no-erase' property to the flash device node. Honor that property and don't bother erasing if it exists. Modified: head/sys/powerpc/powernv/opal_flash.c Modified: head/sys/powerpc/powernv/opal_flash.c ============================================================================== --- head/sys/powerpc/powernv/opal_flash.c Fri Apr 19 00:32:13 2019 (r346362) +++ head/sys/powerpc/powernv/opal_flash.c Fri Apr 19 02:28:04 2019 (r346363) @@ -69,6 +69,7 @@ struct opalflash_softc { struct proc *sc_p; struct bio_queue_head sc_bio_queue; int sc_opal_id; + bool sc_erase; /* Erase is needed before write. */ }; #define OPALFLASH_LOCK(sc) mtx_lock(&(sc)->sc_mtx) @@ -242,10 +243,12 @@ opalflash_write(struct opalflash_softc *sc, off_t off, count % sc->sc_disk->d_stripesize != 0) return (EIO); - /* Erase the full block first, then write in page chunks. */ - rv = opalflash_erase(sc, off, count); - if (rv != 0) - return (rv); + if (sc->sc_erase) { + /* Erase the full block first, then write in page chunks. */ + rv = opalflash_erase(sc, off, count); + if (rv != 0) + return (rv); + } token = opal_alloc_async_token(); @@ -354,6 +357,9 @@ opalflash_attach(device_t dev) device_printf(dev, "Cannot determine flash block size.\n"); return (ENXIO); } + + if (!OF_hasprop(node, "no-erase")) + sc->sc_erase = true; OPALFLASH_LOCK_INIT(sc);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904190228.x3J2S4LV050207>