summaryrefslogtreecommitdiffstats
path: root/sys/geom
diff options
context:
space:
mode:
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/geom_flashmap.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/geom/geom_flashmap.c b/sys/geom/geom_flashmap.c
index 58d0b65..0383f69 100644
--- a/sys/geom/geom_flashmap.c
+++ b/sys/geom/geom_flashmap.c
@@ -70,6 +70,8 @@ static struct g_geom *g_flashmap_taste(struct g_class *,
static void g_flashmap_config(struct gctl_req *, struct g_class *,
const char *);
static int g_flashmap_load(device_t, struct g_flashmap_head *);
+static int (*flash_fill_slices)(device_t, struct flash_slice *, int *) =
+ fdt_flash_fill_slices;
MALLOC_DECLARE(M_FLASHMAP);
MALLOC_DEFINE(M_FLASHMAP, "geom_flashmap", "GEOM flash memory slicer class");
@@ -230,7 +232,8 @@ g_flashmap_load(device_t dev, struct g_flashmap_head *head)
buf_size = sizeof(struct flash_slice) * FLASH_SLICES_MAX_NUM;
slices = malloc(buf_size, M_FLASHMAP, M_WAITOK | M_ZERO);
- if (flash_fill_slices(dev, slices, &nslices) == 0) {
+ if (flash_fill_slices &&
+ flash_fill_slices(dev, slices, &nslices) == 0) {
for (i = 0; i < nslices; i++) {
slice = malloc(sizeof(struct g_flashmap_slice),
M_FLASHMAP, M_WAITOK);
@@ -247,6 +250,12 @@ g_flashmap_load(device_t dev, struct g_flashmap_head *head)
return (nslices);
}
+void flash_register_slicer(int (*slicer)(device_t, struct flash_slice *, int *))
+{
+
+ flash_fill_slices = slicer;
+}
+
static struct g_class g_flashmap_class = {
.name = FLASHMAP_CLASS_NAME,
.version = G_VERSION,
OpenPOWER on IntegriCloud