Module Name:    src
Committed By:   riastradh
Date:           Thu Mar 21 02:36:02 UTC 2024

Modified Files:
        src/distrib/sets/lists/debug: module.md.amd64 module.md.i386
        src/distrib/sets/lists/modules: md.amd64 md.i386
        src/share/man/man4: apei.4
        src/sys/arch/amd64/conf: ALL
        src/sys/arch/i386/conf: ALL
        src/sys/dev/acpi: files.acpi
        src/sys/modules: Makefile
Added Files:
        src/share/man/man4: acpihed.4
        src/sys/dev/acpi: acpi_hed.c
        src/sys/modules/acpihed: Makefile acpihed.ioconf

Log Message:
acpihed(4): New driver for PNP0C33 to notify apei(4).

PNP0C33 denotes the ACPI Hardware Error Device, which exists only to
be a vector for event notifications.

PR kern/58046


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/distrib/sets/lists/debug/module.md.amd64
cvs rdiff -u -r1.9 -r1.10 src/distrib/sets/lists/debug/module.md.i386
cvs rdiff -u -r1.101 -r1.102 src/distrib/sets/lists/modules/md.amd64
cvs rdiff -u -r1.98 -r1.99 src/distrib/sets/lists/modules/md.i386
cvs rdiff -u -r0 -r1.1 src/share/man/man4/acpihed.4
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/apei.4
cvs rdiff -u -r1.185 -r1.186 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.516 -r1.517 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r0 -r1.1 src/sys/dev/acpi/acpi_hed.c
cvs rdiff -u -r1.131 -r1.132 src/sys/dev/acpi/files.acpi
cvs rdiff -u -r1.283 -r1.284 src/sys/modules/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/acpihed/Makefile \
    src/sys/modules/acpihed/acpihed.ioconf

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

Modified files:

Index: src/distrib/sets/lists/debug/module.md.amd64
diff -u src/distrib/sets/lists/debug/module.md.amd64:1.15 src/distrib/sets/lists/debug/module.md.amd64:1.16
--- src/distrib/sets/lists/debug/module.md.amd64:1.15	Wed Mar 20 17:11:42 2024
+++ src/distrib/sets/lists/debug/module.md.amd64	Thu Mar 21 02:36:01 2024
@@ -1,4 +1,4 @@
-# $NetBSD: module.md.amd64,v 1.15 2024/03/20 17:11:42 riastradh Exp $
+# $NetBSD: module.md.amd64,v 1.16 2024/03/21 02:36:01 riastradh Exp $
 ./usr/libdata/debug/@MODULEDIR@/acpiacad				modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/acpiacad/acpiacad.kmod.debug		modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/acpibat				modules-base-kernel	kmod,debug
@@ -11,6 +11,8 @@
 ./usr/libdata/debug/@MODULEDIR@/acpidalb/acpidalb.kmod.debug		modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/acpifan				modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/acpifan/acpifan.kmod.debug		modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/acpihed				modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/acpihed/acpihed.kmod.debug		modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/acpilid				modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/acpilid/acpilid.kmod.debug		modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/acpipmtr				modules-base-kernel	kmod,debug

Index: src/distrib/sets/lists/debug/module.md.i386
diff -u src/distrib/sets/lists/debug/module.md.i386:1.9 src/distrib/sets/lists/debug/module.md.i386:1.10
--- src/distrib/sets/lists/debug/module.md.i386:1.9	Wed Mar 20 17:11:42 2024
+++ src/distrib/sets/lists/debug/module.md.i386	Thu Mar 21 02:36:01 2024
@@ -1,4 +1,4 @@
-# $NetBSD: module.md.i386,v 1.9 2024/03/20 17:11:42 riastradh Exp $
+# $NetBSD: module.md.i386,v 1.10 2024/03/21 02:36:01 riastradh Exp $
 ./usr/libdata/debug/@MODULEDIR@/acpiacad				modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/acpiacad/acpiacad.kmod.debug		modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/acpibat				modules-base-kernel	kmod,debug
@@ -11,6 +11,8 @@
 ./usr/libdata/debug/@MODULEDIR@/acpidalb/acpidalb.kmod.debug		modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/acpifan				modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/acpifan/acpifan.kmod.debug		modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/acpihed				modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/acpihed/acpihed.kmod.debug		modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/acpilid				modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/acpilid/acpilid.kmod.debug		modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/acpipmtr				modules-base-kernel	kmod,debug

Index: src/distrib/sets/lists/modules/md.amd64
diff -u src/distrib/sets/lists/modules/md.amd64:1.101 src/distrib/sets/lists/modules/md.amd64:1.102
--- src/distrib/sets/lists/modules/md.amd64:1.101	Wed Mar 20 17:11:42 2024
+++ src/distrib/sets/lists/modules/md.amd64	Thu Mar 21 02:36:01 2024
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.101 2024/03/20 17:11:42 riastradh Exp $
+# $NetBSD: md.amd64,v 1.102 2024/03/21 02:36:01 riastradh Exp $
 #
 ./@MODULEDIR@/acpiacad				modules-base-kernel	kmod
 ./@MODULEDIR@/acpiacad/acpiacad.kmod		modules-base-kernel	kmod
@@ -12,6 +12,8 @@
 ./@MODULEDIR@/acpidalb/acpidalb.kmod		modules-base-kernel	kmod
 ./@MODULEDIR@/acpifan				modules-base-kernel	kmod
 ./@MODULEDIR@/acpifan/acpifan.kmod		modules-base-kernel	kmod
+./@MODULEDIR@/acpihed				modules-base-kernel	kmod
+./@MODULEDIR@/acpihed/acpihed.kmod		modules-base-kernel	kmod
 ./@MODULEDIR@/acpilid				modules-base-kernel	kmod
 ./@MODULEDIR@/acpilid/acpilid.kmod		modules-base-kernel	kmod
 ./@MODULEDIR@/acpipmtr				modules-base-kernel	kmod

Index: src/distrib/sets/lists/modules/md.i386
diff -u src/distrib/sets/lists/modules/md.i386:1.98 src/distrib/sets/lists/modules/md.i386:1.99
--- src/distrib/sets/lists/modules/md.i386:1.98	Wed Mar 20 17:11:42 2024
+++ src/distrib/sets/lists/modules/md.i386	Thu Mar 21 02:36:01 2024
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.98 2024/03/20 17:11:42 riastradh Exp $
+# $NetBSD: md.i386,v 1.99 2024/03/21 02:36:01 riastradh Exp $
 #
 ./@MODULEDIR@/acpiacad				modules-base-kernel	kmod
 ./@MODULEDIR@/acpiacad/acpiacad.kmod		modules-base-kernel	kmod
@@ -12,6 +12,8 @@
 ./@MODULEDIR@/acpidalb/acpidalb.kmod		modules-base-kernel	kmod
 ./@MODULEDIR@/acpifan				modules-base-kernel	kmod
 ./@MODULEDIR@/acpifan/acpifan.kmod		modules-base-kernel	kmod
+./@MODULEDIR@/acpihed				modules-base-kernel	kmod
+./@MODULEDIR@/acpihed/acpihed.kmod		modules-base-kernel	kmod
 ./@MODULEDIR@/acpilid				modules-base-kernel	kmod
 ./@MODULEDIR@/acpilid/acpilid.kmod		modules-base-kernel	kmod
 ./@MODULEDIR@/acpipmtr				modules-base-kernel	kmod

Index: src/share/man/man4/apei.4
diff -u src/share/man/man4/apei.4:1.1 src/share/man/man4/apei.4:1.2
--- src/share/man/man4/apei.4:1.1	Wed Mar 20 17:11:42 2024
+++ src/share/man/man4/apei.4	Thu Mar 21 02:36:01 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: apei.4,v 1.1 2024/03/20 17:11:42 riastradh Exp $
+.\"	$NetBSD: apei.4,v 1.2 2024/03/21 02:36:01 riastradh Exp $
 .\"
 .\" Copyright (c) 2024 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -85,6 +85,7 @@ Details of the hardware error sources ca
 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .Sh SEE ALSO
 .Xr acpi 4 ,
+.Xr acpihed 4 ,
 .Xr acpidump 8
 .Rs
 .%B ACPI Specification 6.5

Index: src/sys/arch/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.185 src/sys/arch/amd64/conf/ALL:1.186
--- src/sys/arch/amd64/conf/ALL:1.185	Wed Mar 20 17:11:42 2024
+++ src/sys/arch/amd64/conf/ALL	Thu Mar 21 02:36:01 2024
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.185 2024/03/20 17:11:42 riastradh Exp $
+# $NetBSD: ALL,v 1.186 2024/03/21 02:36:01 riastradh Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.185 $"
+#ident		"ALL-$Revision: 1.186 $"
 
 maxusers	64		# estimated number of users
 
@@ -370,6 +370,7 @@ acpiec* 	at acpi?		# ACPI Embedded Contr
 acpiecdt*	at acpi?		# ACPI Embedded Controller (early)
 options 	ACPIEC_DEBUG=-1
 acpifan*	at acpi?		# ACPI Fan
+acpihed*	at acpi?		# ACPI Hardware Error Device
 acpilid*	at acpi?		# ACPI Lid Switch
 acpipmtr*	at acpi?		# ACPI Power Meter (experimental)
 # XXX Do not enable this in a real kernel unless you also disable any

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.516 src/sys/arch/i386/conf/ALL:1.517
--- src/sys/arch/i386/conf/ALL:1.516	Wed Mar 20 17:11:42 2024
+++ src/sys/arch/i386/conf/ALL	Thu Mar 21 02:36:01 2024
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.516 2024/03/20 17:11:42 riastradh Exp $
+# $NetBSD: ALL,v 1.517 2024/03/21 02:36:01 riastradh Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.516 $"
+#ident		"ALL-$Revision: 1.517 $"
 
 maxusers	64		# estimated number of users
 
@@ -357,6 +357,7 @@ acpiec* 	at acpi?		# ACPI Embedded Contr
 acpiecdt*	at acpi?		# ACPI Embedded Controller (early)
 options 	ACPIEC_DEBUG=-1
 acpifan*	at acpi?		# ACPI Fan
+acpihed*	at acpi?		# ACPI Hardware Error Device
 acpilid*	at acpi?		# ACPI Lid Switch
 acpipmtr*	at acpi?		# ACPI Power Meter (experimental)
 # XXX Do not enable this in a real kernel unless you also disable any

Index: src/sys/dev/acpi/files.acpi
diff -u src/sys/dev/acpi/files.acpi:1.131 src/sys/dev/acpi/files.acpi:1.132
--- src/sys/dev/acpi/files.acpi:1.131	Wed Mar 20 17:11:44 2024
+++ src/sys/dev/acpi/files.acpi	Thu Mar 21 02:36:01 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.acpi,v 1.131 2024/03/20 17:11:44 riastradh Exp $
+#	$NetBSD: files.acpi,v 1.132 2024/03/21 02:36:01 riastradh Exp $
 
 defflag	opt_acpi.h	ACPIVERBOSE ACPI_DEBUG ACPI_ACTIVATE_DEV
 			ACPI_DSDT_OVERRIDE ACPI_SCANPCI ACPI_BREAKPOINT
@@ -128,6 +128,11 @@ file	dev/acpi/apei_interp.c		apei
 file	dev/acpi/apei_mapreg.c		apei
 file	dev/acpi/apei_reg.c		apei
 
+# ACPI Hardware Error Device
+device	acpihed: apei
+attach	acpihed at acpinodebus
+file	dev/acpi/acpi_hed.c		acpihed
+
 # Serial interface
 attach	com at acpinodebus with com_acpi
 file	dev/acpi/com_acpi.c		com_acpi

Index: src/sys/modules/Makefile
diff -u src/sys/modules/Makefile:1.283 src/sys/modules/Makefile:1.284
--- src/sys/modules/Makefile:1.283	Wed Mar 20 17:11:44 2024
+++ src/sys/modules/Makefile	Thu Mar 21 02:36:02 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.283 2024/03/20 17:11:44 riastradh Exp $
+#	$NetBSD: Makefile,v 1.284 2024/03/21 02:36:02 riastradh Exp $
 
 .include <bsd.own.mk>
 
@@ -288,6 +288,7 @@ SUBDIR+=	acpibut
 SUBDIR+=	acpicpu
 SUBDIR+=	acpidalb
 SUBDIR+=	acpifan
+SUBDIR+=	acpihed
 SUBDIR+=	acpilid
 SUBDIR+=	acpipmtr
 SUBDIR+=	acpitz

Added files:

Index: src/share/man/man4/acpihed.4
diff -u /dev/null src/share/man/man4/acpihed.4:1.1
--- /dev/null	Thu Mar 21 02:36:02 2024
+++ src/share/man/man4/acpihed.4	Thu Mar 21 02:36:01 2024
@@ -0,0 +1,69 @@
+.\"	$NetBSD: acpihed.4,v 1.1 2024/03/21 02:36:01 riastradh Exp $
+.\"
+.\" Copyright (c) 2024 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.
+.\"
+.Dd March 18, 2024
+.Dt APEI 4
+.Os
+.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.Sh NAME
+.Nm acpihed
+.Nd ACPI Hardware Error Device
+.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.Sh SYNOPSIS
+.Cd "acpihed* at acpi?"
+.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.Sh DESCRIPTION
+Certain hardware error sources that can be queried by
+.Xr apei 4
+notify an ACPI node with PNP ID
+.Sq Li PNP0C33
+when an error occurs.
+The
+.Nm
+driver listens for these notifications and passes them on to
+.Xr apei 4
+so it can report the error.
+.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.Sh SEE ALSO
+.Xr acpi 4 ,
+.Xr apei 4
+.Rs
+.%B ACPI Specification 6.5
+.%O Chapter 18: ACPI Platform Error Interfaces (APEI)
+.%U https://uefi.org/specs/ACPI/6.5/18_Platform_Error_Interfaces.html
+.Re
+.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Nx 11.0 .
+.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Taylor R Campbell Aq Mt riastr...@netbsd.org .

Index: src/sys/dev/acpi/acpi_hed.c
diff -u /dev/null src/sys/dev/acpi/acpi_hed.c:1.1
--- /dev/null	Thu Mar 21 02:36:02 2024
+++ src/sys/dev/acpi/acpi_hed.c	Thu Mar 21 02:36:01 2024
@@ -0,0 +1,143 @@
+/*	$NetBSD: acpi_hed.c,v 1.1 2024/03/21 02:36:01 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 2024 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.
+ */
+
+/*
+ * HED: Hardware Error Device, PNP0C33.
+ *
+ * This device serves only to receive notifications about hardware
+ * errors, which we then dispatch to apei(4).
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: acpi_hed.c,v 1.1 2024/03/21 02:36:01 riastradh Exp $");
+
+#include <sys/device.h>
+#include <sys/module.h>
+
+#include <dev/acpi/acpireg.h>
+#include <dev/acpi/acpivar.h>
+#include <dev/acpi/apei_hed.h>
+
+#define	_COMPONENT		ACPI_RESOURCE_COMPONENT
+ACPI_MODULE_NAME		("acpi_hed")
+
+struct acpihed_softc {
+	device_t		sc_dev;
+	struct acpi_devnode	*sc_node;
+};
+
+static const struct device_compatible_entry compat_data[] = {
+	{ .compat = "PNP0C33" },
+	DEVICE_COMPAT_EOL
+};
+
+static int acpihed_match(device_t, cfdata_t, void *);
+static void acpihed_attach(device_t, device_t, void *);
+static int acpihed_detach(device_t, int);
+static void acpihed_notify(ACPI_HANDLE, uint32_t, void *);
+
+CFATTACH_DECL_NEW(acpihed, sizeof(struct acpihed_softc),
+    acpihed_match, acpihed_attach, acpihed_detach, NULL);
+
+static int
+acpihed_match(device_t parent, cfdata_t match, void *aux)
+{
+	struct acpi_attach_args *aa = aux;
+
+	return acpi_compatible_match(aa, compat_data);
+}
+
+static void
+acpihed_attach(device_t parent, device_t self, void *aux)
+{
+	struct acpihed_softc *sc = device_private(self);
+	struct acpi_attach_args *aa = aux;
+
+	aprint_naive("\n");
+	aprint_normal(": ACPI Hardware Error Device\n");
+
+	pmf_device_register(self, NULL, NULL);
+
+	sc->sc_dev = self;
+	sc->sc_node = aa->aa_node;
+
+	acpi_register_notify(sc->sc_node, acpihed_notify);
+}
+
+static int
+acpihed_detach(device_t self, int flags)
+{
+	struct acpihed_softc *sc = device_private(self);
+	int error;
+
+	error = config_detach_children(self, flags);
+	if (error)
+		return error;
+
+	acpi_deregister_notify(sc->sc_node);
+
+	pmf_device_deregister(self);
+
+	return 0;
+}
+
+static void
+acpihed_notify(ACPI_HANDLE handle, uint32_t event, void *cookie)
+{
+
+	apei_hed_notify();
+}
+
+MODULE(MODULE_CLASS_DRIVER, acpihed, "apei");
+
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
+
+static int
+acpihed_modcmd(modcmd_t cmd, void *opaque)
+{
+	int error = 0;
+
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+#ifdef _MODULE
+		error = config_init_component(cfdriver_ioconf_acpihed,
+		    cfattach_ioconf_acpihed, cfdata_ioconf_acpihed);
+#endif
+		return error;
+	case MODULE_CMD_FINI:
+#ifdef _MODULE
+		error = config_fini_component(cfdriver_ioconf_acpihed,
+		    cfattach_ioconf_acpihed, cfdata_ioconf_acpihed);
+#endif
+		return error;
+	default:
+		return ENOTTY;
+	}
+}

Index: src/sys/modules/acpihed/Makefile
diff -u /dev/null src/sys/modules/acpihed/Makefile:1.1
--- /dev/null	Thu Mar 21 02:36:02 2024
+++ src/sys/modules/acpihed/Makefile	Thu Mar 21 02:36:02 2024
@@ -0,0 +1,11 @@
+#	$NetBSD: Makefile,v 1.1 2024/03/21 02:36:02 riastradh Exp $
+
+.include "../Makefile.inc"
+
+.PATH:	$S/dev/acpi
+
+KMOD=	acpihed
+IOCONF=	acpihed.ioconf
+SRCS=	acpi_hed.c
+
+.include <bsd.kmodule.mk>
Index: src/sys/modules/acpihed/acpihed.ioconf
diff -u /dev/null src/sys/modules/acpihed/acpihed.ioconf:1.1
--- /dev/null	Thu Mar 21 02:36:02 2024
+++ src/sys/modules/acpihed/acpihed.ioconf	Thu Mar 21 02:36:02 2024
@@ -0,0 +1,11 @@
+#	$NetBSD: acpihed.ioconf,v 1.1 2024/03/21 02:36:02 riastradh Exp $
+#
+
+ioconf acpihed
+
+include "conf/files"
+include "dev/acpi/files.acpi"
+
+pseudo-root acpi*
+
+acpihed* at acpi?

Reply via email to