From bde56c99426431c6319afd35c2a3cd66e315034a Mon Sep 17 00:00:00 2001 From: Vladimir Kondratyev Date: Mon, 21 Dec 2020 18:48:50 +0300 Subject: acpi_wmi(4): Allow attachment to ACPI node if EC is not found Conducted tests showed that Embedded Controller is not mandatory for WMI extensions to work. Reported-by: yuripv Reviewed-by: avg MFC-after: 2 weeks Differential-Revision: https://reviews.freebsd.org/D27653 --- sys/dev/acpi_support/acpi_wmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sys') diff --git a/sys/dev/acpi_support/acpi_wmi.c b/sys/dev/acpi_support/acpi_wmi.c index 379cfd1705f10..efae96cdcc9af 100644 --- a/sys/dev/acpi_support/acpi_wmi.c +++ b/sys/dev/acpi_support/acpi_wmi.c @@ -246,7 +246,7 @@ acpi_wmi_attach(device_t dev) if ((sc->ec_dev = devclass_get_device(devclass_find("acpi_ec"), 0)) == NULL) device_printf(dev, "cannot find EC device\n"); - else if (ACPI_FAILURE((status = AcpiInstallNotifyHandler(sc->wmi_handle, + if (ACPI_FAILURE((status = AcpiInstallNotifyHandler(sc->wmi_handle, ACPI_DEVICE_NOTIFY, acpi_wmi_notify_handler, sc)))) device_printf(sc->wmi_dev, "couldn't install notify handler - %s\n", AcpiFormatException(status)); @@ -701,6 +701,8 @@ acpi_wmi_ec_handler(UINT32 function, ACPI_PHYSICAL_ADDRESS address, return (AE_BAD_PARAMETER); if (address + (width / 8) - 1 > 0xFF) return (AE_BAD_ADDRESS); + if (sc->ec_dev == NULL) + return (AE_NOT_FOUND); if (function == ACPI_READ) *value = 0; ec_addr = address; -- cgit v1.2.3