summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorVladimir Kondratyev <wulf@FreeBSD.org>2020-12-21 15:48:50 +0000
committerVladimir Kondratyev <wulf@FreeBSD.org>2020-12-23 08:10:53 +0000
commitbde56c99426431c6319afd35c2a3cd66e315034a (patch)
tree36ada2be58d8d2abe8b0e4cc812d8f6a8482fcc7 /sys
parent54d2dfc4b24db110c8a4b75e2f02a2360fd9fc8c (diff)
downloadsrc-test-bde56c99426431c6319afd35c2a3cd66e315034a.tar.gz
src-test-bde56c99426431c6319afd35c2a3cd66e315034a.zip
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
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/acpi_support/acpi_wmi.c4
1 files changed, 3 insertions, 1 deletions
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;