Date: Tue, 17 Nov 2020 11:07:00 +0300 From: Vladimir Kondratyev <vladimir@kondratyev.su> To: Yuri Pankov <yuripv@yuripv.dev> Cc: current@freebsd.org, owner-freebsd-current@freebsd.org Subject: Re: acpi_wmi noisy without EC Message-ID: <fb0874b1cf4510a2d797a83a01d55935@kondratyev.su> In-Reply-To: <7b80877ae59fdd90f2f3b5dbf3db2113@kondratyev.su> References: <7dc142d3-1e0b-41d4-bdb4-7217bd09bbef@www.fastmail.com> <7b80877ae59fdd90f2f3b5dbf3db2113@kondratyev.su>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On 2020-11-17 10:57, Vladimir Kondratyev wrote:
> On 2020-11-17 03:00, Yuri Pankov wrote:
>> I have started seeing the following on boot since some time:
>>
>> acpi_wmi0: <ACPI-WMI mapping> on acpi0
>> acpi_wmi0: cannot find EC device
>> device_attach: acpi_wmi0 attach returned 6
>> acpi_wmi0: <ACPI-WMI mapping> on acpi0
>> acpi_wmi0: cannot find EC device
>> device_attach: acpi_wmi0 attach returned 6
>> acpi_wmi0: <ACPI-WMI mapping> on acpi0
>> acpi_wmi0: cannot find EC device
>> device_attach: acpi_wmi0 attach returned 6
>> acpi_wmi0: <ACPI-WMI mapping> on acpi0
>> acpi_wmi0: cannot find EC device
>> device_attach: acpi_wmi0 attach returned 6
>>
>> Likely following this commit:
>>
>> commit 708d048ccfdacf6199cc08a56aa05a9c899441fd
>> Author: Vladimir Kondratyev <wulf@FreeBSD.org>
>> Date: Sat Oct 31 22:19:39 2020 +0000
>>
>> acpi_wmi(4): Add ACPI_PNP_INFO
>>
>> While the reason is obvious -- there's no EC in this system (Gigabyte
>> X299X AORUS MASTER desktop motherboard), at least searching the
>> `acpidump -dt` output doesn't show any PNP0C09 entries -- it certainly
>> looks like "something is broken" when first noticed. I wonder if we
>> could/should handle this gracefully -- no EC, do nothing, simply exit?
>
> Following patch should ignore missing EC like Linux does. Could you
> test it?
>
> diff --git a/sys/dev/acpi_support/acpi_wmi.c
> b/sys/dev/acpi_support/acpi_wmi.c
> index 379cfd1705f1..efae96cdcc9a 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;
@#@##! Web client ate all the tabs.
Patch is in attachment.
--
WBR
Vladimir Kondratyev
[-- Attachment #2 --]
diff --git a/sys/dev/acpi_support/acpi_wmi.c b/sys/dev/acpi_support/acpi_wmi.c
index 379cfd1705f1..efae96cdcc9a 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?fb0874b1cf4510a2d797a83a01d55935>
