diff options
author | marius <marius@FreeBSD.org> | 2017-05-10 21:42:12 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2017-05-10 21:42:12 +0000 |
commit | c0ac95fd0ac9f0466a427d868118f4f039cb453c (patch) | |
tree | 76fb82e6dd22147d9bef81c99a08d562618ca34b /sys/sys | |
parent | dcde69b03b85cf7ea79958caad181b7dcf93f7b4 (diff) | |
download | FreeBSD-src-c0ac95fd0ac9f0466a427d868118f4f039cb453c.zip FreeBSD-src-c0ac95fd0ac9f0466a427d868118f4f039cb453c.tar.gz |
MFC: r314097
- Allow different slicers for different flash types to be registered
with geom_flashmap(4) and teach it about MMC for slicing enhanced
user data area partitions. The FDT slicer still is the default for
CFI, NAND and SPI flash on FDT-enabled platforms.
- In addition to a device_t, also pass the name of the GEOM provider
in question to the slicers as a single device may provide more than
one provider.
- Build a geom_flashmap.ko.
- Use MODULE_VERSION() so other modules can depend on geom_flashmap(4).
- Remove redundant/superfluous GEOM routines that either do nothing
or provide/just call default GEOM (slice) functionality.
- Trim/adjust includes
Diffstat (limited to 'sys/sys')
-rw-r--r-- | sys/sys/slicer.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/sys/sys/slicer.h b/sys/sys/slicer.h index 9bf8748..53f680d 100644 --- a/sys/sys/slicer.h +++ b/sys/sys/slicer.h @@ -27,26 +27,38 @@ */ #ifndef _FLASH_SLICER_H_ -#define _FLASH_SLICER_H_ +#define _FLASH_SLICER_H_ #include <sys/types.h> -#define FLASH_SLICES_MAX_NUM 8 -#define FLASH_SLICES_MAX_NAME_LEN (32 + 1) +#define FLASH_SLICES_MAX_NUM 8 +#define FLASH_SLICES_MAX_NAME_LEN (32 + 1) #define FLASH_SLICES_FLAG_NONE 0 #define FLASH_SLICES_FLAG_RO 1 /* Read only */ +#define FLASH_SLICES_FMT "%ss.%s" + struct flash_slice { off_t base; off_t size; - char *label; + const char *label; unsigned int flags; }; #ifdef _KERNEL -int fdt_flash_fill_slices(device_t, struct flash_slice *, int *) __weak_symbol; -void flash_register_slicer(int (*)(device_t, struct flash_slice *, int *)); + +typedef int (*flash_slicer_t)(device_t dev, const char *provider, + struct flash_slice *slices, int *slices_num); + +#define FLASH_SLICES_TYPE_NAND 0 +#define FLASH_SLICES_TYPE_CFI 1 +#define FLASH_SLICES_TYPE_SPI 2 +#define FLASH_SLICES_TYPE_MMC 3 + +/* Use NULL for deregistering a slicer */ +void flash_register_slicer(flash_slicer_t slicer, u_int type, bool force); + #endif /* _KERNEL */ #endif /* _FLASH_SLICER_H_ */ |