diff options
author | jhibbits <jhibbits@FreeBSD.org> | 2015-08-22 05:50:18 +0000 |
---|---|---|
committer | jhibbits <jhibbits@FreeBSD.org> | 2015-08-22 05:50:18 +0000 |
commit | 2693c49ecb94287e9ade96abab901e902a632042 (patch) | |
tree | 80d83f2737cf72f74148d576621482cfdacbea7a /sys/geom/geom_flashmap.c | |
parent | c4b111a2732b06d29af6310d22e942c6bbb7e888 (diff) | |
download | FreeBSD-src-2693c49ecb94287e9ade96abab901e902a632042.zip FreeBSD-src-2693c49ecb94287e9ade96abab901e902a632042.tar.gz |
Create a RouterBoard platform and use it to create a flash map
Summary:
The RouterBoard uses a predefined partition map which doesn't exist in the fdt.
This change allows overriding the fdt slicer with a custom slicer, and uses this
custom slicer to define the flash map on the RouterBoard RB800.
D3305 converts the mpc85xx platform into a base class, so that systems based on
the mpc85xx platform can add their own overrides. This change builds on D3305,
and creates a RouterBoard (RB800) platform to initialize the slicer override.
Reviewed By: nwhitehorn, imp
Differential Revision: https://reviews.freebsd.org/D3345
Diffstat (limited to 'sys/geom/geom_flashmap.c')
-rw-r--r-- | sys/geom/geom_flashmap.c | 11 |
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, |