svn commit: r367232 - head/sys/dev/acpica

Vladimir Kondratyev wulf at FreeBSD.org
Sat Oct 31 20:14:29 UTC 2020


Author: wulf
Date: Sat Oct 31 20:14:28 2020
New Revision: 367232
URL: https://svnweb.freebsd.org/changeset/base/367232

Log:
  acpi(9): Add EVENTHANDLERs for video and AC adapter events.
  
  They are required for coming ACPI support in LinuxKPI.
  
  Reviewed by:	hselasky, manu (as part of D26603)

Modified:
  head/sys/dev/acpica/acpi_acad.c
  head/sys/dev/acpica/acpi_video.c
  head/sys/dev/acpica/acpivar.h

Modified: head/sys/dev/acpica/acpi_acad.c
==============================================================================
--- head/sys/dev/acpica/acpi_acad.c	Sat Oct 31 19:47:34 2020	(r367231)
+++ head/sys/dev/acpica/acpi_acad.c	Sat Oct 31 20:14:28 2020	(r367232)
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
 
 #include <machine/bus.h>
 #include <sys/rman.h>
+#include <sys/eventhandler.h>
 #include <sys/ioccom.h>
 #include <sys/malloc.h>
 #include <sys/module.h>
@@ -115,6 +116,7 @@ acpi_acad_get_status(void *context)
 	ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
 	    "%s Line\n", newstatus ? "On" : "Off");
 	acpi_UserNotify("ACAD", h, newstatus);
+	EVENTHANDLER_INVOKE(acpi_acad_event, newstatus);
     } else
 	ACPI_SERIAL_END(acad);
 }

Modified: head/sys/dev/acpica/acpi_video.c
==============================================================================
--- head/sys/dev/acpica/acpi_video.c	Sat Oct 31 19:47:34 2020	(r367231)
+++ head/sys/dev/acpica/acpi_video.c	Sat Oct 31 20:14:28 2020	(r367232)
@@ -351,6 +351,12 @@ acpi_video_shutdown(device_t dev)
 }
 
 static void
+acpi_video_invoke_event_handler(void *context)
+{
+	EVENTHANDLER_INVOKE(acpi_video_event, (int)(intptr_t)context);
+}
+
+static void
 acpi_video_notify_handler(ACPI_HANDLE handle, UINT32 notify, void *context)
 {
 	struct acpi_video_softc *sc;
@@ -402,6 +408,8 @@ acpi_video_notify_handler(ACPI_HANDLE handle, UINT32 n
 		device_printf(sc->device, "unknown notify event 0x%x\n",
 		    notify);
 	}
+	AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_video_invoke_event_handler,
+	    (void *)(uintptr_t)notify);
 }
 
 static void
@@ -752,6 +760,9 @@ acpi_video_vo_notify_handler(ACPI_HANDLE handle, UINT3
 
 out:
 	ACPI_SERIAL_END(video_output);
+
+	AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_video_invoke_event_handler,
+	    (void *)(uintptr_t)notify);
 }
 
 /* ARGSUSED */

Modified: head/sys/dev/acpica/acpivar.h
==============================================================================
--- head/sys/dev/acpica/acpivar.h	Sat Oct 31 19:47:34 2020	(r367231)
+++ head/sys/dev/acpica/acpivar.h	Sat Oct 31 20:14:28 2020	(r367232)
@@ -433,6 +433,8 @@ typedef void (*acpi_event_handler_t)(void *, int);
 
 EVENTHANDLER_DECLARE(acpi_sleep_event, acpi_event_handler_t);
 EVENTHANDLER_DECLARE(acpi_wakeup_event, acpi_event_handler_t);
+EVENTHANDLER_DECLARE(acpi_acad_event, acpi_event_handler_t);
+EVENTHANDLER_DECLARE(acpi_video_event, acpi_event_handler_t);
 
 /* Device power control. */
 ACPI_STATUS	acpi_pwr_wake_enable(ACPI_HANDLE consumer, int enable);


More information about the svn-src-head mailing list