Module Name:    src
Committed By:   riastradh
Date:           Wed Mar 20 03:14:45 UTC 2024

Modified Files:
        src/sys/dev/acpi: acpi.c acpivar.h files.acpi

Log Message:
acpi(4): New iattr `apeibus' for attaching an APEI driver.

APEI is the ACPI Platform Error Interface, a standard (if very
complicated) interface for reporting hardware errors to the OS.

Firmware support for APEI is presented through the ACPI tables BERT
(Boot Error Record Table), ERST (Error Record Serialization Table),
EINJ (Error Injection Table), and HEST (Hardware Error Source Table),
rather than through nodes in the ACPI device tree, so it can't just
attach through the existing acpinodebus iattr and instead requires a
special pseudo-bus like acpiwdrt(4).

No driver yet -- this is just the hook to attach one in a module.

The new member sc_apei of struct acpi_softc is placed at the end of
the structure so that this change can be safely pulled up to release
branches without risk to ABI compatibility in existing modules such
as acpiverbose.kmod which may rely on the layout (but not size) of
struct acpi_softc.

PR kern/58046


To generate a diff of this commit:
cvs rdiff -u -r1.298 -r1.299 src/sys/dev/acpi/acpi.c
cvs rdiff -u -r1.89 -r1.90 src/sys/dev/acpi/acpivar.h
cvs rdiff -u -r1.128 -r1.129 src/sys/dev/acpi/files.acpi

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

Modified files:

Index: src/sys/dev/acpi/acpi.c
diff -u src/sys/dev/acpi/acpi.c:1.298 src/sys/dev/acpi/acpi.c:1.299
--- src/sys/dev/acpi/acpi.c:1.298	Tue May 31 20:28:57 2022
+++ src/sys/dev/acpi/acpi.c	Wed Mar 20 03:14:45 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.c,v 1.298 2022/05/31 20:28:57 mrg Exp $	*/
+/*	$NetBSD: acpi.c,v 1.299 2024/03/20 03:14:45 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.298 2022/05/31 20:28:57 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.299 2024/03/20 03:14:45 riastradh Exp $");
 
 #include "pci.h"
 #include "opt_acpi.h"
@@ -636,6 +636,9 @@ acpi_childdet(device_t self, device_t ch
 	if (sc->sc_wdrt == child)
 		sc->sc_wdrt = NULL;
 
+	if (sc->sc_apei == child)
+		sc->sc_apei = NULL;
+
 	SIMPLEQ_FOREACH(ad, &sc->sc_head, ad_list) {
 
 		if (ad->ad_device == child)
@@ -923,6 +926,11 @@ acpi_rescan(device_t self, const char *i
 					   CFARGS(.iattr = "acpiwdrtbus"));
 	}
 
+	if (ifattr_match(ifattr, "apeibus") && sc->sc_apei == NULL) {
+		sc->sc_apei = config_found(sc->sc_dev, NULL, NULL,
+					   CFARGS(.iattr = "apeibus"));
+	}
+
 	return 0;
 }
 

Index: src/sys/dev/acpi/acpivar.h
diff -u src/sys/dev/acpi/acpivar.h:1.89 src/sys/dev/acpi/acpivar.h:1.90
--- src/sys/dev/acpi/acpivar.h:1.89	Sun Dec 26 14:34:39 2021
+++ src/sys/dev/acpi/acpivar.h	Wed Mar 20 03:14:45 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpivar.h,v 1.89 2021/12/26 14:34:39 jmcneill Exp $	*/
+/*	$NetBSD: acpivar.h,v 1.90 2024/03/20 03:14:45 riastradh Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -177,6 +177,13 @@ struct acpi_softc {
 	struct sysmon_pswitch	 sc_smpsw_sleep;
 
 	SIMPLEQ_HEAD(, acpi_devnode)	sc_head;
+
+	/*
+	 * Move this section to the other pseudo-bus child pointers
+	 * after pullup -- putting it here avoids potential ABI
+	 * compatibility issues with kernel modules.
+	 */
+	device_t		 sc_apei;	/* apei(4) pseudo-bus */
 };
 
 /*

Index: src/sys/dev/acpi/files.acpi
diff -u src/sys/dev/acpi/files.acpi:1.128 src/sys/dev/acpi/files.acpi:1.129
--- src/sys/dev/acpi/files.acpi:1.128	Tue Jul 18 10:02:25 2023
+++ src/sys/dev/acpi/files.acpi	Wed Mar 20 03:14:45 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.acpi,v 1.128 2023/07/18 10:02:25 riastradh Exp $
+#	$NetBSD: files.acpi,v 1.129 2024/03/20 03:14:45 riastradh Exp $
 
 defflag	opt_acpi.h	ACPIVERBOSE ACPI_DEBUG ACPI_ACTIVATE_DEV
 			ACPI_DSDT_OVERRIDE ACPI_SCANPCI ACPI_BREAKPOINT
@@ -14,6 +14,7 @@ define	acpiwdrtbus { }
 define	acpisdtbus { }
 define	acpigtdtbus { }
 define	acpimadtbus { }
+define	apeibus { }
 
 device	acpi: acpica, acpiapmbus, acpinodebus, acpiecdtbus, acpisdtbus, acpigtdtbus, acpimadtbus, acpihpetbus, acpiwdrtbus, sysmon_power, sysmon_taskq
 attach	acpi at acpibus

Reply via email to