Module Name:    src
Committed By:   riastradh
Date:           Mon Mar 28 12:38:59 UTC 2022

Modified Files:
        src/sys/arch/amiga/amiga: autoconf.c
        src/sys/arch/amiga/dev: grf_cc.c grf_cl.c grf_cv.c grf_cv3d.c grf_et.c
            grf_rh.c grf_rt.c grf_ul.c
        src/sys/arch/amigappc/amigappc: autoconf.c
        src/sys/arch/arm/iomd: iomdiic.c
        src/sys/arch/atari/atari: autoconf.c
        src/sys/arch/atari/dev: ite_cc.c ite_et.c
        src/sys/arch/dreamcast/dev/maple: maple.c
        src/sys/arch/mips/mips: cpu_subr.c
        src/sys/ddb: db_autoconf.c
        src/sys/dev/sbus: esp_sbus.c
        src/sys/dev/wscons: wsmux.c
        src/sys/kern: kern_pmf.c subr_autoconf.c subr_device.c
        src/sys/rump/librump/rumpkern: rump.c
        src/sys/sys: device.h
Added Files:
        src/sys/sys: device_impl.h

Log Message:
sys: Split struct device into a private device_impl.h.

Include this only inside autoconf itself, and a few files that abuse
autoconf in ways I can't confidently make easy fixes for.

XXX kernel ABI change requires bump -- no more use of struct device
internals allowed, previously done by some drivers


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/amiga/amiga/autoconf.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/amiga/dev/grf_cc.c
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/amiga/dev/grf_cl.c
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/amiga/dev/grf_cv.c
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/amiga/dev/grf_cv3d.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amiga/dev/grf_et.c
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/amiga/dev/grf_rh.c \
    src/sys/arch/amiga/dev/grf_rt.c
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/amiga/dev/grf_ul.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/amigappc/amigappc/autoconf.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/iomd/iomdiic.c
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/atari/atari/autoconf.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/atari/dev/ite_cc.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/atari/dev/ite_et.c
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/dreamcast/dev/maple/maple.c
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/mips/mips/cpu_subr.c
cvs rdiff -u -r1.2 -r1.3 src/sys/ddb/db_autoconf.c
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/sbus/esp_sbus.c
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/wscons/wsmux.c
cvs rdiff -u -r1.47 -r1.48 src/sys/kern/kern_pmf.c
cvs rdiff -u -r1.300 -r1.301 src/sys/kern/subr_autoconf.c
cvs rdiff -u -r1.12 -r1.13 src/sys/kern/subr_device.c
cvs rdiff -u -r1.353 -r1.354 src/sys/rump/librump/rumpkern/rump.c
cvs rdiff -u -r1.181 -r1.182 src/sys/sys/device.h
cvs rdiff -u -r0 -r1.1 src/sys/sys/device_impl.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amiga/amiga/autoconf.c
diff -u src/sys/arch/amiga/amiga/autoconf.c:1.120 src/sys/arch/amiga/amiga/autoconf.c:1.121
--- src/sys/arch/amiga/amiga/autoconf.c:1.120	Sat Aug  7 16:18:41 2021
+++ src/sys/arch/amiga/amiga/autoconf.c	Mon Mar 28 12:38:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.120 2021/08/07 16:18:41 thorpej Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.121 2022/03/28 12:38:57 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.120 2021/08/07 16:18:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.121 2022/03/28 12:38:57 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -39,6 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
 #include <sys/conf.h>
 #include <sys/buf.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>	/* XXX autoconf abuse */
 #include <sys/disklabel.h>
 #include <sys/disk.h>
 #include <sys/proc.h>

Index: src/sys/arch/amiga/dev/grf_cc.c
diff -u src/sys/arch/amiga/dev/grf_cc.c:1.43 src/sys/arch/amiga/dev/grf_cc.c:1.44
--- src/sys/arch/amiga/dev/grf_cc.c:1.43	Sat Aug  7 16:18:41 2021
+++ src/sys/arch/amiga/dev/grf_cc.c	Mon Mar 28 12:38:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_cc.c,v 1.43 2021/08/07 16:18:41 thorpej Exp $ */
+/*	$NetBSD: grf_cc.c,v 1.44 2022/03/28 12:38:57 riastradh Exp $ */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf_cc.c,v 1.43 2021/08/07 16:18:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_cc.c,v 1.44 2022/03/28 12:38:57 riastradh Exp $");
 
 #include "grfcc.h"
 #include "ite.h"
@@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: grf_cc.c,v 1
 #include <sys/ioctl.h>
 #include <sys/queue.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>	/* XXX autoconf abuse */
 #include <sys/systm.h>
 #include <sys/conf.h>
 #include <machine/cpu.h>

Index: src/sys/arch/amiga/dev/grf_cl.c
diff -u src/sys/arch/amiga/dev/grf_cl.c:1.54 src/sys/arch/amiga/dev/grf_cl.c:1.55
--- src/sys/arch/amiga/dev/grf_cl.c:1.54	Sun Dec 26 16:08:19 2021
+++ src/sys/arch/amiga/dev/grf_cl.c	Mon Mar 28 12:38:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_cl.c,v 1.54 2021/12/26 16:08:19 andvar Exp $ */
+/*	$NetBSD: grf_cl.c,v 1.55 2022/03/28 12:38:57 riastradh Exp $ */
 
 /*
  * Copyright (c) 1997 Klaus Burkert
@@ -36,7 +36,7 @@
 #include "opt_amigacons.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf_cl.c,v 1.54 2021/12/26 16:08:19 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_cl.c,v 1.55 2022/03/28 12:38:57 riastradh Exp $");
 
 #include "grfcl.h"
 #include "ite.h"
@@ -78,6 +78,7 @@ __KERNEL_RCSID(0, "$NetBSD: grf_cl.c,v 1
 #include <sys/errno.h>
 #include <sys/ioctl.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>	/* XXX autoconf abuse */
 #include <sys/malloc.h>
 
 #include <machine/cpu.h>

Index: src/sys/arch/amiga/dev/grf_cv.c
diff -u src/sys/arch/amiga/dev/grf_cv.c:1.63 src/sys/arch/amiga/dev/grf_cv.c:1.64
--- src/sys/arch/amiga/dev/grf_cv.c:1.63	Sat Jan  1 11:45:37 2022
+++ src/sys/arch/amiga/dev/grf_cv.c	Mon Mar 28 12:38:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_cv.c,v 1.63 2022/01/01 11:45:37 msaitoh Exp $ */
+/*	$NetBSD: grf_cv.c,v 1.64 2022/03/28 12:38:57 riastradh Exp $ */
 
 /*
  * Copyright (c) 1995 Michael Teske
@@ -33,7 +33,7 @@
 #include "opt_amigacons.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf_cv.c,v 1.63 2022/01/01 11:45:37 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_cv.c,v 1.64 2022/03/28 12:38:57 riastradh Exp $");
 
 #include "grfcv.h"
 #include "ite.h"
@@ -57,6 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: grf_cv.c,v 1
 #include <sys/errno.h>
 #include <sys/ioctl.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>	/* XXX autoconf abuse */
 #include <sys/malloc.h>
 #include <sys/systm.h>
 #include <sys/syslog.h>

Index: src/sys/arch/amiga/dev/grf_cv3d.c
diff -u src/sys/arch/amiga/dev/grf_cv3d.c:1.38 src/sys/arch/amiga/dev/grf_cv3d.c:1.39
--- src/sys/arch/amiga/dev/grf_cv3d.c:1.38	Sat Jan  1 11:45:37 2022
+++ src/sys/arch/amiga/dev/grf_cv3d.c	Mon Mar 28 12:38:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_cv3d.c,v 1.38 2022/01/01 11:45:37 msaitoh Exp $ */
+/*	$NetBSD: grf_cv3d.c,v 1.39 2022/03/28 12:38:57 riastradh Exp $ */
 
 /*
  * Copyright (c) 1995 Michael Teske
@@ -33,7 +33,7 @@
 #include "opt_amigacons.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf_cv3d.c,v 1.38 2022/01/01 11:45:37 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_cv3d.c,v 1.39 2022/03/28 12:38:57 riastradh Exp $");
 
 #include "grfcv3d.h"
 #include "ite.h"
@@ -81,6 +81,7 @@ Note: IO Regbase is needed for wakeup of
 #include <sys/errno.h>
 #include <sys/ioctl.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>	/* XXX autoconf abuse */
 #include <sys/malloc.h>
 #include <sys/systm.h>
 #include <sys/bus.h>

Index: src/sys/arch/amiga/dev/grf_et.c
diff -u src/sys/arch/amiga/dev/grf_et.c:1.39 src/sys/arch/amiga/dev/grf_et.c:1.40
--- src/sys/arch/amiga/dev/grf_et.c:1.39	Sun Dec 26 16:08:19 2021
+++ src/sys/arch/amiga/dev/grf_et.c	Mon Mar 28 12:38:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_et.c,v 1.39 2021/12/26 16:08:19 andvar Exp $ */
+/*	$NetBSD: grf_et.c,v 1.40 2022/03/28 12:38:57 riastradh Exp $ */
 
 /*
  * Copyright (c) 1997 Klaus Burkert
@@ -37,7 +37,7 @@
 #include "opt_amigacons.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf_et.c,v 1.39 2021/12/26 16:08:19 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_et.c,v 1.40 2022/03/28 12:38:57 riastradh Exp $");
 
 #include "grfet.h"
 #include "ite.h"
@@ -69,6 +69,7 @@ __KERNEL_RCSID(0, "$NetBSD: grf_et.c,v 1
 #include <sys/errno.h>
 #include <sys/ioctl.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>	/* XXX autoconf abuse */
 #include <sys/malloc.h>
 
 #include <machine/cpu.h>

Index: src/sys/arch/amiga/dev/grf_rh.c
diff -u src/sys/arch/amiga/dev/grf_rh.c:1.60 src/sys/arch/amiga/dev/grf_rh.c:1.61
--- src/sys/arch/amiga/dev/grf_rh.c:1.60	Mon Aug  9 21:13:05 2021
+++ src/sys/arch/amiga/dev/grf_rh.c	Mon Mar 28 12:38:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_rh.c,v 1.60 2021/08/09 21:13:05 andvar Exp $ */
+/*	$NetBSD: grf_rh.c,v 1.61 2022/03/28 12:38:57 riastradh Exp $ */
 
 /*
  * Copyright (c) 1994 Markus Wild
@@ -34,7 +34,7 @@
 #include "opt_retina.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf_rh.c,v 1.60 2021/08/09 21:13:05 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_rh.c,v 1.61 2022/03/28 12:38:57 riastradh Exp $");
 
 #include "grfrh.h"
 #include "ite.h"
@@ -50,6 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: grf_rh.c,v 1
 #include <sys/errno.h>
 #include <sys/ioctl.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>	/* XXX autoconf abuse */
 #include <sys/malloc.h>
 #include <machine/cpu.h>
 #include <amiga/amiga/device.h>
Index: src/sys/arch/amiga/dev/grf_rt.c
diff -u src/sys/arch/amiga/dev/grf_rt.c:1.60 src/sys/arch/amiga/dev/grf_rt.c:1.61
--- src/sys/arch/amiga/dev/grf_rt.c:1.60	Sat Aug  7 16:18:41 2021
+++ src/sys/arch/amiga/dev/grf_rt.c	Mon Mar 28 12:38:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_rt.c,v 1.60 2021/08/07 16:18:41 thorpej Exp $ */
+/*	$NetBSD: grf_rt.c,v 1.61 2022/03/28 12:38:57 riastradh Exp $ */
 
 /*
  * Copyright (c) 1993 Markus Wild
@@ -33,7 +33,7 @@
 #include "opt_amigacons.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf_rt.c,v 1.60 2021/08/07 16:18:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_rt.c,v 1.61 2022/03/28 12:38:57 riastradh Exp $");
 
 #include "grfrt.h"
 #include "ite.h"
@@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: grf_rt.c,v 1
 #include <sys/errno.h>
 #include <sys/ioctl.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>	/* XXX autoconf abuse */
 #include <machine/cpu.h>
 #include <amiga/amiga/device.h>
 #include <amiga/dev/zbusvar.h>

Index: src/sys/arch/amiga/dev/grf_ul.c
diff -u src/sys/arch/amiga/dev/grf_ul.c:1.53 src/sys/arch/amiga/dev/grf_ul.c:1.54
--- src/sys/arch/amiga/dev/grf_ul.c:1.53	Sat Aug  7 16:18:41 2021
+++ src/sys/arch/amiga/dev/grf_ul.c	Mon Mar 28 12:38:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_ul.c,v 1.53 2021/08/07 16:18:41 thorpej Exp $ */
+/*	$NetBSD: grf_ul.c,v 1.54 2022/03/28 12:38:57 riastradh Exp $ */
 #define UL_DEBUG
 
 /*-
@@ -33,7 +33,7 @@
 #include "opt_amigacons.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf_ul.c,v 1.53 2021/08/07 16:18:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_ul.c,v 1.54 2022/03/28 12:38:57 riastradh Exp $");
 
 #include "grful.h"
 #include "ite.h"
@@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: grf_ul.c,v 1
 #include <sys/errno.h>
 #include <sys/ioctl.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>	/* XXX autoconf abuse */
 #include <sys/malloc.h>
 #include <sys/syslog.h>
 

Index: src/sys/arch/amigappc/amigappc/autoconf.c
diff -u src/sys/arch/amigappc/amigappc/autoconf.c:1.9 src/sys/arch/amigappc/amigappc/autoconf.c:1.10
--- src/sys/arch/amigappc/amigappc/autoconf.c:1.9	Sat Aug  7 16:18:42 2021
+++ src/sys/arch/amigappc/amigappc/autoconf.c	Mon Mar 28 12:38:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.9 2021/08/07 16:18:42 thorpej Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.10 2022/03/28 12:38:57 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.9 2021/08/07 16:18:42 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.10 2022/03/28 12:38:57 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -39,6 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
 #include <sys/conf.h>
 #include <sys/buf.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>	/* XXX autoconf abuse */
 #include <sys/disklabel.h>
 #include <sys/disk.h>
 #include <sys/proc.h>

Index: src/sys/arch/arm/iomd/iomdiic.c
diff -u src/sys/arch/arm/iomd/iomdiic.c:1.11 src/sys/arch/arm/iomd/iomdiic.c:1.12
--- src/sys/arch/arm/iomd/iomdiic.c:1.11	Sat Aug  7 16:18:44 2021
+++ src/sys/arch/arm/iomd/iomdiic.c	Mon Mar 28 12:38:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: iomdiic.c,v 1.11 2021/08/07 16:18:44 thorpej Exp $	*/
+/*	$NetBSD: iomdiic.c,v 1.12 2022/03/28 12:38:57 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -37,6 +37,7 @@
 
 #include <sys/param.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>	/* XXX autoconf abuse */
 #include <sys/kernel.h>
 #include <sys/systm.h>
 #include <sys/mutex.h>

Index: src/sys/arch/atari/atari/autoconf.c
diff -u src/sys/arch/atari/atari/autoconf.c:1.71 src/sys/arch/atari/atari/autoconf.c:1.72
--- src/sys/arch/atari/atari/autoconf.c:1.71	Sat Aug  7 16:18:46 2021
+++ src/sys/arch/atari/atari/autoconf.c	Mon Mar 28 12:38:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.71 2021/08/07 16:18:46 thorpej Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.72 2022/03/28 12:38:57 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.71 2021/08/07 16:18:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.72 2022/03/28 12:38:57 riastradh Exp $");
 
 #include "opt_md.h"
 
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
 #include <sys/conf.h>
 #include <sys/buf.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>	/* XXX autoconf abuse */
 #include <sys/disklabel.h>
 #include <sys/disk.h>
 #include <sys/kmem.h>

Index: src/sys/arch/atari/dev/ite_cc.c
diff -u src/sys/arch/atari/dev/ite_cc.c:1.43 src/sys/arch/atari/dev/ite_cc.c:1.44
--- src/sys/arch/atari/dev/ite_cc.c:1.43	Sat Aug  7 16:18:46 2021
+++ src/sys/arch/atari/dev/ite_cc.c	Mon Mar 28 12:38:58 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite_cc.c,v 1.43 2021/08/07 16:18:46 thorpej Exp $	*/
+/*	$NetBSD: ite_cc.c,v 1.44 2022/03/28 12:38:58 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ite_cc.c,v 1.43 2021/08/07 16:18:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ite_cc.c,v 1.44 2022/03/28 12:38:58 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: ite_cc.c,v 1
 #include <sys/termios.h>
 #include <sys/malloc.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>	/* XXX autoconf abuse */
 #include <dev/cons.h>
 #include <machine/cpu.h>
 #include <atari/atari/device.h>

Index: src/sys/arch/atari/dev/ite_et.c
diff -u src/sys/arch/atari/dev/ite_et.c:1.34 src/sys/arch/atari/dev/ite_et.c:1.35
--- src/sys/arch/atari/dev/ite_et.c:1.34	Sat Aug  7 16:18:46 2021
+++ src/sys/arch/atari/dev/ite_et.c	Mon Mar 28 12:38:58 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite_et.c,v 1.34 2021/08/07 16:18:46 thorpej Exp $	*/
+/*	$NetBSD: ite_et.c,v 1.35 2022/03/28 12:38:58 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ite_et.c,v 1.34 2021/08/07 16:18:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ite_et.c,v 1.35 2022/03/28 12:38:58 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -34,6 +34,7 @@ __KERNEL_RCSID(0, "$NetBSD: ite_et.c,v 1
 #include <sys/ioctl.h>
 #include <sys/malloc.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>	/* XXX autoconf abuse */
 #include <dev/cons.h>
 
 #include <machine/cpu.h>

Index: src/sys/arch/dreamcast/dev/maple/maple.c
diff -u src/sys/arch/dreamcast/dev/maple/maple.c:1.55 src/sys/arch/dreamcast/dev/maple/maple.c:1.56
--- src/sys/arch/dreamcast/dev/maple/maple.c:1.55	Sat Aug  7 16:18:48 2021
+++ src/sys/arch/dreamcast/dev/maple/maple.c	Mon Mar 28 12:38:58 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: maple.c,v 1.55 2021/08/07 16:18:48 thorpej Exp $	*/
+/*	$NetBSD: maple.c,v 1.56 2022/03/28 12:38:58 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -62,10 +62,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: maple.c,v 1.55 2021/08/07 16:18:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: maple.c,v 1.56 2022/03/28 12:38:58 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>	/* XXX autoconf abuse */
 #include <sys/fcntl.h>
 #include <sys/kernel.h>
 #include <sys/kthread.h>

Index: src/sys/arch/mips/mips/cpu_subr.c
diff -u src/sys/arch/mips/mips/cpu_subr.c:1.60 src/sys/arch/mips/mips/cpu_subr.c:1.61
--- src/sys/arch/mips/mips/cpu_subr.c:1.60	Thu Mar  3 06:27:41 2022
+++ src/sys/arch/mips/mips/cpu_subr.c	Mon Mar 28 12:38:58 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.60 2022/03/03 06:27:41 riastradh Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.61 2022/03/28 12:38:58 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2010, 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.60 2022/03/03 06:27:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.61 2022/03/28 12:38:58 riastradh Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v
 #include <sys/bitops.h>
 #include <sys/cpu.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>	/* XXX autoconf abuse */
 #include <sys/idle.h>
 #include <sys/intr.h>
 #include <sys/ipi.h>

Index: src/sys/ddb/db_autoconf.c
diff -u src/sys/ddb/db_autoconf.c:1.2 src/sys/ddb/db_autoconf.c:1.3
--- src/sys/ddb/db_autoconf.c:1.2	Mon Mar  5 07:47:21 2018
+++ src/sys/ddb/db_autoconf.c	Mon Mar 28 12:38:58 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_autoconf.c,v 1.2 2018/03/05 07:47:21 mlelstv Exp $	*/
+/*	$NetBSD: db_autoconf.c,v 1.3 2022/03/28 12:38:58 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_autoconf.c,v 1.2 2018/03/05 07:47:21 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_autoconf.c,v 1.3 2022/03/28 12:38:58 riastradh Exp $");
 
 #ifndef _KERNEL
 #include <stdbool.h>
@@ -35,6 +35,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_autoconf.
 
 #include <sys/param.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>
 
 #include <ddb/ddb.h>
 

Index: src/sys/dev/sbus/esp_sbus.c
diff -u src/sys/dev/sbus/esp_sbus.c:1.56 src/sys/dev/sbus/esp_sbus.c:1.57
--- src/sys/dev/sbus/esp_sbus.c:1.56	Tue Feb 23 07:13:53 2021
+++ src/sys/dev/sbus/esp_sbus.c	Mon Mar 28 12:38:58 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: esp_sbus.c,v 1.56 2021/02/23 07:13:53 mrg Exp $	*/
+/*	$NetBSD: esp_sbus.c,v 1.57 2022/03/28 12:38:58 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,11 +31,12 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: esp_sbus.c,v 1.56 2021/02/23 07:13:53 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: esp_sbus.c,v 1.57 2022/03/28 12:38:58 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>	/* XXX autoconf abuse */
 #include <sys/buf.h>
 #include <sys/malloc.h>
 

Index: src/sys/dev/wscons/wsmux.c
diff -u src/sys/dev/wscons/wsmux.c:1.65 src/sys/dev/wscons/wsmux.c:1.66
--- src/sys/dev/wscons/wsmux.c:1.65	Wed Nov 10 16:57:39 2021
+++ src/sys/dev/wscons/wsmux.c	Mon Mar 28 12:38:58 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsmux.c,v 1.65 2021/11/10 16:57:39 msaitoh Exp $	*/
+/*	$NetBSD: wsmux.c,v 1.66 2022/03/28 12:38:58 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2005 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsmux.c,v 1.65 2021/11/10 16:57:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsmux.c,v 1.66 2022/03/28 12:38:58 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -63,6 +63,7 @@ __KERNEL_RCSID(0, "$NetBSD: wsmux.c,v 1.
 #include <sys/tty.h>
 #include <sys/signalvar.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>	/* XXX autoconf abuse */
 
 #include "opt_wsdisplay_compat.h"
 

Index: src/sys/kern/kern_pmf.c
diff -u src/sys/kern/kern_pmf.c:1.47 src/sys/kern/kern_pmf.c:1.48
--- src/sys/kern/kern_pmf.c:1.47	Thu Jul  1 22:08:13 2021
+++ src/sys/kern/kern_pmf.c	Mon Mar 28 12:38:59 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_pmf.c,v 1.47 2021/07/01 22:08:13 blymn Exp $ */
+/* $NetBSD: kern_pmf.c,v 1.48 2022/03/28 12:38:59 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcne...@invisible.ca>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_pmf.c,v 1.47 2021/07/01 22:08:13 blymn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_pmf.c,v 1.48 2022/03/28 12:38:59 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -36,6 +36,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_pmf.c,v
 #include <sys/callout.h>
 #include <sys/kernel.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>
 #include <sys/pmf.h>
 #include <sys/queue.h>
 #include <sys/sched.h>

Index: src/sys/kern/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.300 src/sys/kern/subr_autoconf.c:1.301
--- src/sys/kern/subr_autoconf.c:1.300	Mon Mar 28 12:38:24 2022
+++ src/sys/kern/subr_autoconf.c	Mon Mar 28 12:38:59 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.300 2022/03/28 12:38:24 riastradh Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.301 2022/03/28 12:38:59 riastradh Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.300 2022/03/28 12:38:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.301 2022/03/28 12:38:59 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -86,6 +86,7 @@ __KERNEL_RCSID(0, "$NetBSD: subr_autocon
 
 #include <sys/param.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>
 #include <sys/disklabel.h>
 #include <sys/conf.h>
 #include <sys/kauth.h>

Index: src/sys/kern/subr_device.c
diff -u src/sys/kern/subr_device.c:1.12 src/sys/kern/subr_device.c:1.13
--- src/sys/kern/subr_device.c:1.12	Thu Mar  3 06:25:46 2022
+++ src/sys/kern/subr_device.c	Mon Mar 28 12:38:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_device.c,v 1.12 2022/03/03 06:25:46 riastradh Exp $	*/
+/*	$NetBSD: subr_device.c,v 1.13 2022/03/28 12:38:59 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2006, 2021 The NetBSD Foundation, Inc.
@@ -27,10 +27,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_device.c,v 1.12 2022/03/03 06:25:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_device.c,v 1.13 2022/03/28 12:38:59 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>
 #include <sys/systm.h>
 
 #include <sys/device_calls.h>

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.353 src/sys/rump/librump/rumpkern/rump.c:1.354
--- src/sys/rump/librump/rumpkern/rump.c:1.353	Sun Jan 17 22:32:25 2021
+++ src/sys/rump/librump/rumpkern/rump.c	Mon Mar 28 12:38:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.353 2021/01/17 22:32:25 chs Exp $	*/
+/*	$NetBSD: rump.c,v 1.354 2022/03/28 12:38:59 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.353 2021/01/17 22:32:25 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.354 2022/03/28 12:38:59 riastradh Exp $");
 
 #include <sys/systm.h>
 #define ELFSIZE ARCH_ELFSIZE
@@ -38,6 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.3
 #include <sys/conf.h>
 #include <sys/cpu.h>
 #include <sys/device.h>
+#include <sys/device_impl.h>
 #include <sys/evcnt.h>
 #include <sys/event.h>
 #include <sys/exec_elf.h>

Index: src/sys/sys/device.h
diff -u src/sys/sys/device.h:1.181 src/sys/sys/device.h:1.182
--- src/sys/sys/device.h:1.181	Mon Mar 28 12:38:15 2022
+++ src/sys/sys/device.h	Mon Mar 28 12:38:59 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: device.h,v 1.181 2022/03/28 12:38:15 riastradh Exp $ */
+/* $NetBSD: device.h,v 1.182 2022/03/28 12:38:59 riastradh Exp $ */
 
 /*
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -255,72 +255,13 @@ struct devhandle_impl {
 /* Max size of a device external name (including terminating NUL) */
 #define	DEVICE_XNAME_SIZE	16
 
-struct device {
-	devhandle_t	dv_handle;	/* this device's handle;
-					   new device_t's get INVALID */
-	devclass_t	dv_class;	/* this device's classification */
-	TAILQ_ENTRY(device) dv_list;	/* entry on list of all devices */
-	cfdata_t	dv_cfdata;	/* config data that found us
-					   (NULL if pseudo-device) */
-	cfdriver_t	dv_cfdriver;	/* our cfdriver */
-	cfattach_t	dv_cfattach;	/* our cfattach */
-	int		dv_unit;	/* device unit number */
-					/* external name (name + unit) */
-	char		dv_xname[DEVICE_XNAME_SIZE];
-	device_t	dv_parent;	/* pointer to parent device
-					   (NULL if pseudo- or root node) */
-	int		dv_depth;	/* number of parents until root */
-	int		dv_flags;	/* misc. flags; see below */
-	void		*dv_private;	/* this device's private storage */
-	int		*dv_locators;	/* our actual locators (optional) */
-	prop_dictionary_t dv_properties;/* properties dictionary */
-	struct localcount *dv_localcount;/* reference count */
-
-	int		dv_pending;	/* config_pending count */
-	TAILQ_ENTRY(device) dv_pending_list;
-
-	struct lwp	*dv_attaching;	/* thread not yet finished in attach */
-	struct lwp	*dv_detaching;	/* detach lock (config_misc_lock/cv) */
-	bool		dv_detached;	/* config_misc_lock */
-
-	size_t		dv_activity_count;
-	void		(**dv_activity_handlers)(device_t, devactive_t);
-
-	bool		(*dv_driver_suspend)(device_t, const pmf_qual_t *);
-	bool		(*dv_driver_resume)(device_t, const pmf_qual_t *);
-	bool		(*dv_driver_shutdown)(device_t, int);
-	bool		(*dv_driver_child_register)(device_t);
-
-	void		*dv_bus_private;
-	bool		(*dv_bus_suspend)(device_t, const pmf_qual_t *);
-	bool		(*dv_bus_resume)(device_t, const pmf_qual_t *);
-	bool		(*dv_bus_shutdown)(device_t, int);
-	void		(*dv_bus_deregister)(device_t);
-
-	void		*dv_class_private;
-	bool		(*dv_class_suspend)(device_t, const pmf_qual_t *);
-	bool		(*dv_class_resume)(device_t, const pmf_qual_t *);
-	void		(*dv_class_deregister)(device_t);
-
-	devgen_t		dv_add_gen,
-				dv_del_gen;
-
-	struct device_lock	dv_lock;
-	const device_suspensor_t
-	    *dv_bus_suspensors[DEVICE_SUSPENSORS_MAX],
-	    *dv_driver_suspensors[DEVICE_SUSPENSORS_MAX],
-	    *dv_class_suspensors[DEVICE_SUSPENSORS_MAX];
-	struct device_garbage dv_garbage;
-};
+struct device;
 
-/* dv_flags */
-#define	DVF_ACTIVE		0x0001	/* device is activated */
+/*
+ * struct cfattach::ca_flags (must not overlap with device_impl.h
+ * struct device::dv_flags for now)
+ */
 #define	DVF_PRIV_ALLOC		0x0002	/* device private storage != device */
-#define	DVF_POWER_HANDLERS	0x0004	/* device has suspend/resume support */
-#define	DVF_CLASS_SUSPENDED	0x0008	/* device class suspend was called */
-#define	DVF_DRIVER_SUSPENDED	0x0010	/* device driver suspend was called */
-#define	DVF_BUS_SUSPENDED	0x0020	/* device bus suspend was called */
-#define	DVF_ATTACH_INPROGRESS	0x0040	/* device attach is in progress */
 #define	DVF_DETACH_SHUTDOWN	0x0080	/* device detaches safely at shutdown */
 
 #ifdef _KERNEL

Added files:

Index: src/sys/sys/device_impl.h
diff -u /dev/null src/sys/sys/device_impl.h:1.1
--- /dev/null	Mon Mar 28 12:38:59 2022
+++ src/sys/sys/device_impl.h	Mon Mar 28 12:38:59 2022
@@ -0,0 +1,183 @@
+/*	$NetBSD: device_impl.h,v 1.1 2022/03/28 12:38:59 riastradh Exp $	*/
+
+/*
+ * Copyright (c) 2022 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1996, 2000 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *          This product includes software developed for the
+ *          NetBSD Project.  See http://www.NetBSD.org/ for
+ *          information about NetBSD.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * --(license Id: LICENSE.proto,v 1.1 2000/06/13 21:40:26 cgd Exp )--
+ */
+
+/*
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Lawrence Berkeley Laboratories.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)device.h	8.2 (Berkeley) 2/17/94
+ */
+
+#ifndef	_SYS_DEVICE_IMPL_H_
+#define	_SYS_DEVICE_IMPL_H_
+
+/*
+ * Private autoconf-internal device structures.
+ *
+ * DO NOT USE outside autoconf internals.
+ */
+
+#include <sys/device.h>
+
+struct device {
+	devhandle_t	dv_handle;	/* this device's handle;
+					   new device_t's get INVALID */
+	devclass_t	dv_class;	/* this device's classification */
+	TAILQ_ENTRY(device) dv_list;	/* entry on list of all devices */
+	cfdata_t	dv_cfdata;	/* config data that found us
+					   (NULL if pseudo-device) */
+	cfdriver_t	dv_cfdriver;	/* our cfdriver */
+	cfattach_t	dv_cfattach;	/* our cfattach */
+	int		dv_unit;	/* device unit number */
+					/* external name (name + unit) */
+	char		dv_xname[DEVICE_XNAME_SIZE];
+	device_t	dv_parent;	/* pointer to parent device
+					   (NULL if pseudo- or root node) */
+	int		dv_depth;	/* number of parents until root */
+	int		dv_flags;	/* misc. flags; see below */
+	void		*dv_private;	/* this device's private storage */
+	int		*dv_locators;	/* our actual locators (optional) */
+	prop_dictionary_t dv_properties;/* properties dictionary */
+	struct localcount *dv_localcount;/* reference count */
+
+	int		dv_pending;	/* config_pending count */
+	TAILQ_ENTRY(device) dv_pending_list;
+
+	struct lwp	*dv_attaching;	/* thread not yet finished in attach */
+	struct lwp	*dv_detaching;	/* detach lock (config_misc_lock/cv) */
+	bool		dv_detached;	/* config_misc_lock */
+
+	size_t		dv_activity_count;
+	void		(**dv_activity_handlers)(device_t, devactive_t);
+
+	bool		(*dv_driver_suspend)(device_t, const pmf_qual_t *);
+	bool		(*dv_driver_resume)(device_t, const pmf_qual_t *);
+	bool		(*dv_driver_shutdown)(device_t, int);
+	bool		(*dv_driver_child_register)(device_t);
+
+	void		*dv_bus_private;
+	bool		(*dv_bus_suspend)(device_t, const pmf_qual_t *);
+	bool		(*dv_bus_resume)(device_t, const pmf_qual_t *);
+	bool		(*dv_bus_shutdown)(device_t, int);
+	void		(*dv_bus_deregister)(device_t);
+
+	void		*dv_class_private;
+	bool		(*dv_class_suspend)(device_t, const pmf_qual_t *);
+	bool		(*dv_class_resume)(device_t, const pmf_qual_t *);
+	void		(*dv_class_deregister)(device_t);
+
+	devgen_t		dv_add_gen,
+				dv_del_gen;
+
+	struct device_lock	dv_lock;
+	const device_suspensor_t
+	    *dv_bus_suspensors[DEVICE_SUSPENSORS_MAX],
+	    *dv_driver_suspensors[DEVICE_SUSPENSORS_MAX],
+	    *dv_class_suspensors[DEVICE_SUSPENSORS_MAX];
+	struct device_garbage dv_garbage;
+};
+
+/*
+ * struct device::dv_flags (must not overlap with device.h struct
+ * cfattach::ca_flags for now)
+ */
+#define	DVF_ACTIVE		0x0001	/* device is activated */
+#define	DVF_POWER_HANDLERS	0x0004	/* device has suspend/resume support */
+#define	DVF_CLASS_SUSPENDED	0x0008	/* device class suspend was called */
+#define	DVF_DRIVER_SUSPENDED	0x0010	/* device driver suspend was called */
+#define	DVF_BUS_SUSPENDED	0x0020	/* device bus suspend was called */
+#define	DVF_ATTACH_INPROGRESS	0x0040	/* device attach is in progress */
+
+#endif	/* _SYS_DEVICE_IMPL_H_ */

Reply via email to