summaryrefslogtreecommitdiff
path: root/sys/dev/flash
diff options
context:
space:
mode:
authorahoka <ahoka@NetBSD.org>2011-07-29 20:48:33 +0000
committerahoka <ahoka@NetBSD.org>2011-07-29 20:48:33 +0000
commit0e2eaacfe3fee1f47642d79de67806e1894e7523 (patch)
treef6c2c55ea64b0b4ac26e84e378efe9086f3d982b /sys/dev/flash
parent6242a098cf677547f1ba7eed1a682e325c787df8 (diff)
add a function to get the size of the flash device
Diffstat (limited to 'sys/dev/flash')
-rw-r--r--sys/dev/flash/flash.c14
-rw-r--r--sys/dev/flash/flash.h3
2 files changed, 14 insertions, 3 deletions
diff --git a/sys/dev/flash/flash.c b/sys/dev/flash/flash.c
index 71b09c6e41c..3d785a6f18d 100644
--- a/sys/dev/flash/flash.c
+++ b/sys/dev/flash/flash.c
@@ -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 <sys/cdefs.h>
-__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 <sys/param.h>
#include <sys/types.h>
@@ -525,6 +525,16 @@ flash_get_device(dev_t dev)
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)
{
diff --git a/sys/dev/flash/flash.h b/sys/dev/flash/flash.h
index 24071d86a2c..ad0f88a30af 100644
--- a/sys/dev/flash/flash.h
+++ b/sys/dev/flash/flash.h
@@ -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 @@ device_t flash_attach_mi(struct flash_interface *, device_t);
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 *);