Make it possible to load fdt_slicer as a module (unloading works too fwiw).
This commit is contained in:
parent
f2f497c6fe
commit
4e46217874
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=344609
@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
#include <sys/kernel.h>
|
#include <sys/kernel.h>
|
||||||
|
#include <sys/module.h>
|
||||||
#include <sys/slicer.h>
|
#include <sys/slicer.h>
|
||||||
|
|
||||||
#include <dev/fdt/fdt_common.h>
|
#include <dev/fdt/fdt_common.h>
|
||||||
@ -131,10 +132,37 @@ fdt_slicer_init(void)
|
|||||||
FALSE);
|
FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fdt_slicer_cleanup(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
flash_register_slicer(NULL, FLASH_SLICES_TYPE_NAND, true);
|
||||||
|
flash_register_slicer(NULL, FLASH_SLICES_TYPE_CFI, true);
|
||||||
|
flash_register_slicer(NULL, FLASH_SLICES_TYPE_SPI, true);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Must be initialized after GEOM classes (SI_SUB_DRIVERS/SI_ORDER_FIRST),
|
* Must be initialized after GEOM classes (SI_SUB_DRIVERS/SI_ORDER_FIRST),
|
||||||
* i. e. after g_init() is called, due to the use of the GEOM topology_lock
|
* i. e. after g_init() is called, due to the use of the GEOM topology_lock
|
||||||
* in flash_register_slicer(). However, must be before SI_SUB_CONFIGURE.
|
* in flash_register_slicer(). However, must be before SI_SUB_CONFIGURE.
|
||||||
*/
|
*/
|
||||||
SYSINIT(fdt_slicer_rootconf, SI_SUB_DRIVERS, SI_ORDER_SECOND, fdt_slicer_init,
|
SYSINIT(fdt_slicer, SI_SUB_DRIVERS, SI_ORDER_SECOND, fdt_slicer_init, NULL);
|
||||||
NULL);
|
SYSUNINIT(fdt_slicer, SI_SUB_DRIVERS, SI_ORDER_SECOND, fdt_slicer_cleanup, NULL);
|
||||||
|
|
||||||
|
static int
|
||||||
|
mod_handler(module_t mod, int type, void *data)
|
||||||
|
{
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Nothing to do here: the SYSINIT/SYSUNINIT defined above run
|
||||||
|
* automatically at module load/unload time.
|
||||||
|
*/
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static moduledata_t fdt_slicer_mod = {
|
||||||
|
"fdt_slicer", mod_handler, NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
DECLARE_MODULE(fdt_slicer, fdt_slicer_mod, SI_SUB_DRIVERS, SI_ORDER_SECOND);
|
||||||
|
MODULE_VERSION(fdt_slicer, 1);
|
||||||
|
7
sys/modules/fdt/Makefile
Normal file
7
sys/modules/fdt/Makefile
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
# Build dev/fdt modules.
|
||||||
|
|
||||||
|
SUBDIR = \
|
||||||
|
fdt_slicer \
|
||||||
|
|
||||||
|
.include <bsd.subdir.mk>
|
13
sys/modules/fdt/fdt_slicer/Makefile
Normal file
13
sys/modules/fdt/fdt_slicer/Makefile
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
.PATH: ${SRCTOP}/sys/dev/fdt
|
||||||
|
|
||||||
|
KMOD= fdt_slicer
|
||||||
|
SRCS= fdt_slicer.c
|
||||||
|
|
||||||
|
# Generated files...
|
||||||
|
SRCS+= \
|
||||||
|
ofw_bus_if.h \
|
||||||
|
opt_platform.h \
|
||||||
|
|
||||||
|
.include <bsd.kmod.mk>
|
Loading…
Reference in New Issue
Block a user