From owner-svn-src-head@freebsd.org Tue Feb 26 22:34:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE0CC150630E; Tue, 26 Feb 2019 22:34:30 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5E04776DF5; Tue, 26 Feb 2019 22:34:30 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4ABADBCCA; Tue, 26 Feb 2019 22:34:30 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1QMYURf013217; Tue, 26 Feb 2019 22:34:30 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1QMYTo7013214; Tue, 26 Feb 2019 22:34:29 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201902262234.x1QMYTo7013214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 26 Feb 2019 22:34:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r344609 - in head/sys: dev/fdt modules/fdt modules/fdt/fdt_slicer X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys: dev/fdt modules/fdt modules/fdt/fdt_slicer X-SVN-Commit-Revision: 344609 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5E04776DF5 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Feb 2019 22:34:31 -0000 Author: ian Date: Tue Feb 26 22:34:29 2019 New Revision: 344609 URL: https://svnweb.freebsd.org/changeset/base/344609 Log: Make it possible to load fdt_slicer as a module (unloading works too fwiw). Added: head/sys/modules/fdt/ head/sys/modules/fdt/Makefile (contents, props changed) head/sys/modules/fdt/fdt_slicer/ head/sys/modules/fdt/fdt_slicer/Makefile (contents, props changed) Modified: head/sys/dev/fdt/fdt_slicer.c Modified: head/sys/dev/fdt/fdt_slicer.c ============================================================================== --- head/sys/dev/fdt/fdt_slicer.c Tue Feb 26 22:07:59 2019 (r344608) +++ head/sys/dev/fdt/fdt_slicer.c Tue Feb 26 22:34:29 2019 (r344609) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -131,10 +132,37 @@ fdt_slicer_init(void) 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), * 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. */ -SYSINIT(fdt_slicer_rootconf, SI_SUB_DRIVERS, SI_ORDER_SECOND, fdt_slicer_init, - NULL); +SYSINIT(fdt_slicer, SI_SUB_DRIVERS, SI_ORDER_SECOND, fdt_slicer_init, 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); Added: head/sys/modules/fdt/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/fdt/Makefile Tue Feb 26 22:34:29 2019 (r344609) @@ -0,0 +1,7 @@ +# $FreeBSD$ +# Build dev/fdt modules. + +SUBDIR = \ + fdt_slicer \ + +.include Added: head/sys/modules/fdt/fdt_slicer/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/fdt/fdt_slicer/Makefile Tue Feb 26 22:34:29 2019 (r344609) @@ -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