Module Name:    src
Committed By:   martin
Date:           Mon Mar 25 15:05:17 UTC 2024

Modified Files:
        src/sys/dev/acpi [netbsd-10]: acpi.c acpivar.h files.acpi

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #639):

        sys/dev/acpi/acpivar.h: revision 1.90
        sys/dev/acpi/files.acpi: revision 1.129
        sys/dev/acpi/acpi.c: revision 1.299
        sys/dev/acpi/files.acpi: revision 1.130

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

acpi(4): Make apeibus actually work as an iattr.
PR kern/58046


To generate a diff of this commit:
cvs rdiff -u -r1.298 -r1.298.4.1 src/sys/dev/acpi/acpi.c
cvs rdiff -u -r1.89 -r1.89.4.1 src/sys/dev/acpi/acpivar.h
cvs rdiff -u -r1.126.4.1 -r1.126.4.2 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.298.4.1
--- src/sys/dev/acpi/acpi.c:1.298	Tue May 31 20:28:57 2022
+++ src/sys/dev/acpi/acpi.c	Mon Mar 25 15:05:17 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.c,v 1.298 2022/05/31 20:28:57 mrg Exp $	*/
+/*	$NetBSD: acpi.c,v 1.298.4.1 2024/03/25 15:05:17 martin 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.298.4.1 2024/03/25 15:05:17 martin 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.89.4.1
--- src/sys/dev/acpi/acpivar.h:1.89	Sun Dec 26 14:34:39 2021
+++ src/sys/dev/acpi/acpivar.h	Mon Mar 25 15:05:17 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpivar.h,v 1.89 2021/12/26 14:34:39 jmcneill Exp $	*/
+/*	$NetBSD: acpivar.h,v 1.89.4.1 2024/03/25 15:05:17 martin 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.126.4.1 src/sys/dev/acpi/files.acpi:1.126.4.2
--- src/sys/dev/acpi/files.acpi:1.126.4.1	Sun Jul 30 12:01:53 2023
+++ src/sys/dev/acpi/files.acpi	Mon Mar 25 15:05:17 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.acpi,v 1.126.4.1 2023/07/30 12:01:53 martin Exp $
+#	$NetBSD: files.acpi,v 1.126.4.2 2024/03/25 15:05:17 martin Exp $
 
 defflag	opt_acpi.h	ACPIVERBOSE ACPI_DEBUG ACPI_ACTIVATE_DEV
 			ACPI_DSDT_OVERRIDE ACPI_SCANPCI ACPI_BREAKPOINT
@@ -14,8 +14,9 @@ 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
+device	acpi: acpica, acpiapmbus, acpinodebus, acpiecdtbus, acpisdtbus, acpigtdtbus, acpimadtbus, acpihpetbus, acpiwdrtbus, apeibus, sysmon_power, sysmon_taskq
 attach	acpi at acpibus
 file	dev/acpi/acpi.c			acpi
 file	dev/acpi/acpi_debug.c		acpi

Reply via email to