CVS commit: src/sys/dev/flash
Module Name:src Committed By: jmcneill Date: Tue Nov 14 14:15:30 UTC 2017 Modified Files: src/sys/dev/flash: files.flash Log Message: Add "disk" dependency to flash to set device class to DV_DISK. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/flash/files.flash Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/flash/files.flash diff -u src/sys/dev/flash/files.flash:1.3 src/sys/dev/flash/files.flash:1.4 --- src/sys/dev/flash/files.flash:1.3 Mon Nov 13 17:35:58 2017 +++ src/sys/dev/flash/files.flash Tue Nov 14 14:15:29 2017 @@ -1,8 +1,8 @@ -# $NetBSD: files.flash,v 1.3 2017/11/13 17:35:58 jmcneill Exp $ +# $NetBSD: files.flash,v 1.4 2017/11/14 14:15:29 jmcneill Exp $ define flashbus { [offset = 0], [size = 0], [readonly = 0], [dynamic = 0] } -device flash +device flash: disk attach flash at flashbus file dev/flash/flash.c flash file dev/flash/flash_io.c flash
CVS commit: src/sys/dev/flash
Module Name:src Committed By: jmcneill Date: Mon Nov 13 17:35:58 UTC 2017 Modified Files: src/sys/dev/flash: files.flash flash.c flash.h Added Files: src/sys/dev/flash: flash_mtdparts.c Log Message: Add support for defining partitions using a Linux-style "mtdparts" string. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/flash/files.flash cvs rdiff -u -r1.13 -r1.14 src/sys/dev/flash/flash.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/flash/flash.h cvs rdiff -u -r0 -r1.1 src/sys/dev/flash/flash_mtdparts.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/flash/files.flash diff -u src/sys/dev/flash/files.flash:1.2 src/sys/dev/flash/files.flash:1.3 --- src/sys/dev/flash/files.flash:1.2 Tue Jun 28 18:14:11 2011 +++ src/sys/dev/flash/files.flash Mon Nov 13 17:35:58 2017 @@ -1,10 +1,11 @@ -# $NetBSD: files.flash,v 1.2 2011/06/28 18:14:11 ahoka Exp $ +# $NetBSD: files.flash,v 1.3 2017/11/13 17:35:58 jmcneill Exp $ -define flashbus { [offset = 0], [size = 0], [readonly = 0] } +define flashbus { [offset = 0], [size = 0], [readonly = 0], [dynamic = 0] } device flash attach flash at flashbus file dev/flash/flash.c flash file dev/flash/flash_io.c flash +file dev/flash/flash_mtdparts.c flash defflag opt_flash.h FLASH_STATIC_PARTITIONS Index: src/sys/dev/flash/flash.c diff -u src/sys/dev/flash/flash.c:1.13 src/sys/dev/flash/flash.c:1.14 --- src/sys/dev/flash/flash.c:1.13 Sat Oct 28 04:53:55 2017 +++ src/sys/dev/flash/flash.c Mon Nov 13 17:35:58 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: flash.c,v 1.13 2017/10/28 04:53:55 riastradh Exp $ */ +/* $NetBSD: flash.c,v 1.14 2017/11/13 17:35:58 jmcneill Exp $ */ /*- * Copyright (c) 2011 Department of Software Engineering, @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.13 2017/10/28 04:53:55 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.14 2017/11/13 17:35:58 jmcneill Exp $"); #include #include @@ -147,20 +147,12 @@ flash_attach(device_t parent, device_t s aprint_naive("\n"); - switch (sc->flash_if->type) { - case FLASH_TYPE_NOR: - aprint_normal(": NOR flash partition size %s, offset %#jx", - pbuf[0], (uintmax_t )sc->sc_partinfo.part_offset); - break; - - case FLASH_TYPE_NAND: - aprint_normal(": NAND flash partition size %s, offset %#jx", - pbuf[0], (uintmax_t )sc->sc_partinfo.part_offset); - break; + aprint_normal(": partition"); + if (sc->sc_partinfo.part_name != NULL) + aprint_normal(" \"%s\"", sc->sc_partinfo.part_name); - default: - aprint_normal(": %s unknown flash", pbuf[0]); - } + aprint_normal(", size %s, offset %#jx", + pbuf[0], (uintmax_t)sc->sc_partinfo.part_offset); if (sc->sc_partinfo.part_flags & FLASH_PART_READONLY) { sc->sc_readonly = true; Index: src/sys/dev/flash/flash.h diff -u src/sys/dev/flash/flash.h:1.7 src/sys/dev/flash/flash.h:1.8 --- src/sys/dev/flash/flash.h:1.7 Fri Jul 29 20:48:33 2011 +++ src/sys/dev/flash/flash.h Mon Nov 13 17:35:58 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: flash.h,v 1.7 2011/07/29 20:48:33 ahoka Exp $ */ +/* $NetBSD: flash.h,v 1.8 2017/11/13 17:35:58 jmcneill Exp $ */ /*- * Copyright (c) 2011 Department of Software Engineering, @@ -53,6 +53,7 @@ struct flash_partition { flash_off_t part_offset; flash_size_t part_size; int part_flags; + const char *part_name; }; /** @@ -120,6 +121,7 @@ struct flash_cache { }; device_t flash_attach_mi(struct flash_interface *, device_t); +void flash_attach_mtdparts(struct flash_interface *, device_t, flash_size_t, const char *, const char *); const struct flash_interface *flash_get_interface(dev_t); const struct flash_softc *flash_get_softc(dev_t); device_t flash_get_device(dev_t); Added files: Index: src/sys/dev/flash/flash_mtdparts.c diff -u /dev/null src/sys/dev/flash/flash_mtdparts.c:1.1 --- /dev/null Mon Nov 13 17:35:58 2017 +++ src/sys/dev/flash/flash_mtdparts.c Mon Nov 13 17:35:58 2017 @@ -0,0 +1,196 @@ +/* $NetBSD: flash_mtdparts.c,v 1.1 2017/11/13 17:35:58 jmcneill Exp $ */ + +/*- + * Copyright (c) 2017 Jared McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
CVS commit: src/sys/dev/flash
Module Name:src Committed By: joerg Date: Fri Sep 13 22:18:42 UTC 2013 Modified Files: src/sys/dev/flash: flash.c Log Message: GC flash_get_part_offset. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/flash/flash.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/flash/flash.c diff -u src/sys/dev/flash/flash.c:1.9 src/sys/dev/flash/flash.c:1.10 --- src/sys/dev/flash/flash.c:1.9 Fri Jul 29 20:48:33 2011 +++ src/sys/dev/flash/flash.c Fri Sep 13 22:18:42 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: flash.c,v 1.9 2011/07/29 20:48:33 ahoka Exp $ */ +/* $NetBSD: flash.c,v 1.10 2013/09/13 22:18:42 joerg Exp $ */ /*- * Copyright (c) 2011 Department of Software Engineering, @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.9 2011/07/29 20:48:33 ahoka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.10 2013/09/13 22:18:42 joerg Exp $"); #include #include @@ -535,12 +535,6 @@ flash_get_size(dev_t dev) return sc->sc_partinfo.part_size; } -static inline flash_off_t -flash_get_part_offset(struct flash_softc * const sc, size_t poffset) -{ - return sc->sc_partinfo.part_offset + poffset; -} - int flash_erase(device_t self, struct flash_erase_instruction * const ei) {
CVS commit: src/sys/dev/flash
Module Name:src Committed By: ahoka Date: Fri Jul 29 20:48:33 UTC 2011 Modified Files: src/sys/dev/flash: flash.c flash.h Log Message: add a function to get the size of the flash device To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/flash/flash.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/flash/flash.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/flash/flash.c diff -u src/sys/dev/flash/flash.c:1.8 src/sys/dev/flash/flash.c:1.9 --- src/sys/dev/flash/flash.c:1.8 Fri Jul 15 19:19:57 2011 +++ src/sys/dev/flash/flash.c Fri Jul 29 20:48:33 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: flash.c,v 1.8 2011/07/15 19:19:57 cliff Exp $ */ +/* $NetBSD: flash.c,v 1.9 2011/07/29 20:48:33 ahoka Exp $ */ /*- * Copyright (c) 2011 Department of Software Engineering, @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.8 2011/07/15 19:19:57 cliff Exp $"); +__KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.9 2011/07/29 20:48:33 ahoka Exp $"); #include #include @@ -525,6 +525,16 @@ return sc->sc_dev; } +flash_size_t +flash_get_size(dev_t dev) +{ + const struct flash_softc *sc; + + sc = flash_get_softc(dev); + + return sc->sc_partinfo.part_size; +} + static inline flash_off_t flash_get_part_offset(struct flash_softc * const sc, size_t poffset) { Index: src/sys/dev/flash/flash.h diff -u src/sys/dev/flash/flash.h:1.6 src/sys/dev/flash/flash.h:1.7 --- src/sys/dev/flash/flash.h:1.6 Fri Jul 15 19:19:57 2011 +++ src/sys/dev/flash/flash.h Fri Jul 29 20:48:33 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: flash.h,v 1.6 2011/07/15 19:19:57 cliff Exp $ */ +/* $NetBSD: flash.h,v 1.7 2011/07/29 20:48:33 ahoka Exp $ */ /*- * Copyright (c) 2011 Department of Software Engineering, @@ -123,6 +123,7 @@ const struct flash_interface *flash_get_interface(dev_t); const struct flash_softc *flash_get_softc(dev_t); device_t flash_get_device(dev_t); +flash_size_t flash_get_size(dev_t); /* flash operations should be used through these */ int flash_erase(device_t, struct flash_erase_instruction *);
CVS commit: src/sys/dev/flash
Module Name:src Committed By: ahoka Date: Tue Jun 28 21:01:25 UTC 2011 Modified Files: src/sys/dev/flash: flash.h Log Message: dont define FLASH_DEBUG in header To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/flash/flash.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/flash/flash.h diff -u src/sys/dev/flash/flash.h:1.4 src/sys/dev/flash/flash.h:1.5 --- src/sys/dev/flash/flash.h:1.4 Tue Jun 28 18:14:11 2011 +++ src/sys/dev/flash/flash.h Tue Jun 28 21:01:23 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: flash.h,v 1.4 2011/06/28 18:14:11 ahoka Exp $ */ +/* $NetBSD: flash.h,v 1.5 2011/06/28 21:01:23 ahoka Exp $ */ /*- * Copyright (c) 2011 Department of Software Engineering, @@ -41,7 +41,6 @@ #include #include -#define FLASH_DEBUG 1 #ifdef FLASH_DEBUG #define FLDPRINTF(x) if (flashdebug) printf x #define FLDPRINTFN(n,x) if (flashdebug>(n)) printf x
CVS commit: src/sys/dev/flash
Module Name:src Committed By: ahoka Date: Tue Jun 28 20:58:00 UTC 2011 Modified Files: src/sys/dev/flash: flash_io.c Log Message: use proper format string To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/flash/flash_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/flash/flash_io.c diff -u src/sys/dev/flash/flash_io.c:1.1 src/sys/dev/flash/flash_io.c:1.2 --- src/sys/dev/flash/flash_io.c:1.1 Tue Jun 28 18:14:11 2011 +++ src/sys/dev/flash/flash_io.c Tue Jun 28 20:58:00 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: flash_io.c,v 1.1 2011/06/28 18:14:11 ahoka Exp $ */ +/* $NetBSD: flash_io.c,v 1.2 2011/06/28 20:58:00 ahoka Exp $ */ /*- * Copyright (c) 2011 Department of Software Engineering, @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: flash_io.c,v 1.1 2011/06/28 18:14:11 ahoka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: flash_io.c,v 1.2 2011/06/28 20:58:00 ahoka Exp $"); #include #include @@ -252,7 +252,7 @@ goto out; } - FLDPRINTF(("writing %zu bytes to 0x%jx\n", + FLDPRINTF(("writing %" PRIu32 " bytes to 0x%jx\n", fio->fio_if->erasesize, (uintmax_t )base)); error = fio->fio_if->write(fio->fio_dev,
CVS commit: src/sys/dev/flash
Module Name:src Committed By: ahoka Date: Tue Jun 28 07:00:18 UTC 2011 Modified Files: src/sys/dev/flash: flash.c Log Message: use nosize To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/flash/flash.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/flash/flash.c diff -u src/sys/dev/flash/flash.c:1.5 src/sys/dev/flash/flash.c:1.6 --- src/sys/dev/flash/flash.c:1.5 Sun Jun 12 05:29:42 2011 +++ src/sys/dev/flash/flash.c Tue Jun 28 07:00:17 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: flash.c,v 1.5 2011/06/12 05:29:42 matt Exp $ */ +/* $NetBSD: flash.c,v 1.6 2011/06/28 07:00:17 ahoka Exp $ */ /*- * Copyright (c) 2011 Department of Software Engineering, @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.5 2011/06/12 05:29:42 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.6 2011/06/28 07:00:17 ahoka Exp $"); #include #include @@ -80,7 +80,6 @@ dev_type_ioctl(flashioctl); dev_type_strategy(flashstrategy); dev_type_dump(flashdump); -dev_type_size(flashsize); int flash_print(void *aux, const char *pnp); @@ -107,7 +106,7 @@ .d_strategy = flashstrategy, .d_ioctl = flashioctl, .d_dump = flashdump, - .d_psize = flashsize, + .d_psize = nosize, .d_flag = D_DISK | D_MPSAFE }; @@ -153,7 +152,7 @@ format_bytes(pbuf[1], sizeof(pbuf[1]), sc->flash_if->erasesize); aprint_naive("\n"); - + switch (sc->flash_if->type) { case FLASH_TYPE_NOR: aprint_normal(": %s NOR flash\n", pbuf[0]); @@ -162,7 +161,7 @@ case FLASH_TYPE_NAND: aprint_normal(": %s NAND flash\n", pbuf[0]); break; - + default: aprint_normal(": %s unknown flash\n", pbuf[0]); } @@ -186,7 +185,7 @@ "partition size must be larger than 0\n"); return; } - + switch (sc->flash_if->type) { case FLASH_TYPE_NOR: aprint_normal_dev(sc->sc_dev, @@ -202,7 +201,7 @@ sc->flash_if->writesize); break; } - + if (!pmf_device_register1(sc->sc_dev, NULL, NULL, flash_shutdown)) aprint_error_dev(sc->sc_dev, "couldn't establish power handler\n"); @@ -217,7 +216,7 @@ /* freeing flash_if is our responsibility */ kmem_free(sc->flash_if, sizeof(*sc->flash_if)); - + return 0; } @@ -281,7 +280,7 @@ /* reset buffer length */ // sc->sc_cache->fc_len = 0; - + return 0; } @@ -306,7 +305,7 @@ if (err) return err; } - + return 0; } @@ -353,7 +352,7 @@ /* divider */ KASSERT(flash_if->writesize != 0); - + aprint_debug_dev(sc->sc_dev, "flash_strategy()\n"); if (!(bp->b_flags & B_READ) && sc->sc_readonly) { @@ -382,7 +381,7 @@ bp->b_resid = bp->b_bcount; flash_if->submit(sc->sc_parent_dev, bp); - + return; done: bp->b_resid = bp->b_bcount; @@ -426,7 +425,7 @@ ei.ei_addr = ep->ep_addr; ei.ei_len = ep->ep_len; ei.ei_callback = NULL; - + err = flash_erase(sc->sc_dev, &ei); if (err) { return err; @@ -452,7 +451,7 @@ err = flash_block_markbad(sc->sc_dev, bbp->bbp_addr); - break; + break; case FLASH_DUMP: dp = data; offset = dp->dp_block * sc->flash_if->erasesize; @@ -470,7 +469,7 @@ break; case FLASH_GET_INFO: ip = data; - + ip->ip_page_size = sc->flash_if->page_size; ip->ip_erase_size = sc->flash_if->erasesize; ip->ip_flash_type = sc->flash_if->type; @@ -484,12 +483,6 @@ } int -flashsize(dev_t dev) -{ -return -1; -} - -int flashdump(dev_t dev, daddr_t blkno, void *va, size_t size) { return EACCES; @@ -499,7 +492,7 @@ flash_shutdown(device_t self, int how) { struct flash_softc *sc = device_private(self); - + if ((how & RB_NOSYNC) == 0 && !sc->sc_readonly) flash_sync(self); @@ -566,7 +559,7 @@ if (e.ei_addr + e.ei_len > sc->flash_if->partition.part_size + sc->flash_if->partition.part_offset) return EINVAL; - + return sc->flash_if->erase(device_parent(self), &e); } @@ -612,9 +605,9 @@ if (sc->sc_readonly) return EACCES; - + offset += sc->flash_if->partition.part_offset; - + if (offset + sc->flash_if->erasesize >= sc->flash_if->partition.part_size + sc->flash_if->partition.part_offset) @@ -627,7 +620,7 @@ flash_block_isbad(device_t self, flash_off_t offset, bool *bad) { struct flash_softc *sc = device_private(self); - + offset += sc->flash_if->partition.part_offset; if (offset + sc->flash_if->erasesize > @@ -642,7 +635,7 @@ flash_sync(device_t self) { struct flash_softc *sc = device_private(self); - + if (sc->sc_readonly) return EACCES;
CVS commit: src/sys/dev/flash
Module Name:src Committed By: matt Date: Sun Jun 12 05:29:42 UTC 2011 Modified Files: src/sys/dev/flash: flash.c Log Message: Use %# instead of 0x% To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/flash/flash.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/flash/flash.c diff -u src/sys/dev/flash/flash.c:1.4 src/sys/dev/flash/flash.c:1.5 --- src/sys/dev/flash/flash.c:1.4 Tue Apr 26 17:42:20 2011 +++ src/sys/dev/flash/flash.c Sun Jun 12 05:29:42 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: flash.c,v 1.4 2011/04/26 17:42:20 ahoka Exp $ */ +/* $NetBSD: flash.c,v 1.5 2011/06/12 05:29:42 matt Exp $ */ /*- * Copyright (c) 2011 Department of Software Engineering, @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.4 2011/04/26 17:42:20 ahoka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.5 2011/06/12 05:29:42 matt Exp $"); #include #include @@ -168,7 +168,7 @@ } aprint_normal_dev(sc->sc_dev, - "size: 0x%jx, offset: 0x%jx", + "size: %#jx, offset: %#jx", (uintmax_t )sc->flash_if->partition.part_size, (uintmax_t )sc->flash_if->partition.part_offset);
CVS commit: src/sys/dev/flash
Module Name:src Committed By: ahoka Date: Tue Apr 26 17:42:20 UTC 2011 Modified Files: src/sys/dev/flash: flash.c Log Message: remove some debug printf leftover To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/flash/flash.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/flash/flash.c diff -u src/sys/dev/flash/flash.c:1.3 src/sys/dev/flash/flash.c:1.4 --- src/sys/dev/flash/flash.c:1.3 Mon Apr 4 14:25:09 2011 +++ src/sys/dev/flash/flash.c Tue Apr 26 17:42:20 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: flash.c,v 1.3 2011/04/04 14:25:09 ahoka Exp $ */ +/* $NetBSD: flash.c,v 1.4 2011/04/26 17:42:20 ahoka Exp $ */ /*- * Copyright (c) 2011 Department of Software Engineering, @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.3 2011/04/04 14:25:09 ahoka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.4 2011/04/26 17:42:20 ahoka Exp $"); #include #include @@ -216,9 +216,7 @@ pmf_device_deregister(sc->sc_dev); /* freeing flash_if is our responsibility */ - printf("freeing flash_if..."); kmem_free(sc->flash_if, sizeof(*sc->flash_if)); - printf("done!\n"); return 0; }
CVS commit: src/sys/dev/flash
Module Name:src Committed By: uebayasi Date: Wed Mar 30 14:34:26 UTC 2011 Modified Files: src/sys/dev/flash: flash.c flash.h Log Message: Whitespace. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/flash/flash.c src/sys/dev/flash/flash.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/flash/flash.c diff -u src/sys/dev/flash/flash.c:1.1 src/sys/dev/flash/flash.c:1.2 --- src/sys/dev/flash/flash.c:1.1 Sat Feb 26 18:07:30 2011 +++ src/sys/dev/flash/flash.c Wed Mar 30 14:34:26 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: flash.c,v 1.1 2011/02/26 18:07:30 ahoka Exp $ */ +/* $NetBSD: flash.c,v 1.2 2011/03/30 14:34:26 uebayasi Exp $ */ /*- * Copyright (c) 2011 Department of Software Engineering, @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.1 2011/02/26 18:07:30 ahoka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.2 2011/03/30 14:34:26 uebayasi Exp $"); #include #include @@ -487,6 +487,7 @@ return err; } + int flashsize(dev_t dev) { Index: src/sys/dev/flash/flash.h diff -u src/sys/dev/flash/flash.h:1.1 src/sys/dev/flash/flash.h:1.2 --- src/sys/dev/flash/flash.h:1.1 Sat Feb 26 18:07:30 2011 +++ src/sys/dev/flash/flash.h Wed Mar 30 14:34:26 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: flash.h,v 1.1 2011/02/26 18:07:30 ahoka Exp $ */ +/* $NetBSD: flash.h,v 1.2 2011/03/30 14:34:26 uebayasi Exp $ */ /*- * Copyright (c) 2011 Department of Software Engineering, @@ -75,7 +75,7 @@ struct flash_erase_instruction { flash_addr_t ei_addr; flash_addr_t ei_len; - void (*ei_callback) (struct flash_erase_instruction *); + void (*ei_callback)(struct flash_erase_instruction *); u_long ei_priv; u_char ei_state; }; @@ -106,12 +106,12 @@ * @block_isbad: checks if a block is bad on flash */ struct flash_interface { - int (*erase) (device_t, struct flash_erase_instruction *); - int (*read) (device_t, off_t, size_t, size_t *, uint8_t *); - int (*write) (device_t, off_t, size_t, size_t *, const uint8_t *); + int (*erase)(device_t, struct flash_erase_instruction *); + int (*read)(device_t, off_t, size_t, size_t *, uint8_t *); + int (*write)(device_t, off_t, size_t, size_t *, const uint8_t *); int (*block_markbad)(device_t, uint64_t); int (*block_isbad)(device_t, uint64_t); - int (*sync) (device_t); + int (*sync)(device_t); int (*submit)(device_t, struct buf *); @@ -159,7 +159,7 @@ { size_t i; for (i = offset; i < size; i++) { - if (((const uint8_t *) buf)[i] != patt) + if (((const uint8_t *)buf)[i] != patt) return 0; } return 1;