Bug 199093 - ACPI Error: AE_BAD_PARAMETER, Returned by Handler for [EmbeddedControl] (20180105/evregion-300)
Summary: ACPI Error: AE_BAD_PARAMETER, Returned by Handler for [EmbeddedControl] (2018...
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: ACPI
Classification: Unclassified
Component: EC (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Zhang Rui
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-12 23:28 UTC by Paul Menzel
Modified: 2018-08-29 06:26 UTC (History)
5 users (show)

See Also:
Kernel Version: 4.16-rc5
Subsystem:
Regression: No
Bisected commit-id:


Attachments
sudo acpidump (1.12 MB, text/plain)
2018-03-12 23:28 UTC, Paul Menzel
Details
Linux 4.17-rc5 messages (55.30 KB, text/plain)
2018-05-15 14:13 UTC, Paul Menzel
Details
attachment-11153-0.html (510 bytes, text/html)
2018-05-31 17:58 UTC, superm1
Details
custom ECR2 to dump more context (161 bytes, application/octet-stream)
2018-06-25 07:59 UTC, Zhang Rui
Details

Description Paul Menzel 2018-03-12 23:28:07 UTC
Created attachment 274697 [details]
sudo acpidump

On the Dell XPS 13 9370, suspending the system (deep) the error below is shown.


```
$ sudo dmesg
[…]
[ 1242.546566] ACPI: Preparing to enter system sleep state S3
[ 1242.616582] ACPI: EC: event blocked
[ 1242.616591] ACPI: EC: EC stopped
[ 1242.616602] PM: Saving platform NVS memory
[ 1242.616665] Disabling non-boot CPUs ...
[ 1242.618185] ACPI Error: AE_BAD_PARAMETER, Returned by Handler for [EmbeddedControl] (20180105/evregion-300)
[ 1242.618195] ACPI Error: Method parse/execution failed \_SB.PCI0.LPCB.ECDV.ECR1, AE_BAD_PARAMETER (20180105/psparse-550)
[ 1242.618209] ACPI Error: Method parse/execution failed \_SB.PCI0.LPCB.ECDV.ECR2, AE_BAD_PARAMETER (20180105/psparse-550)
[ 1242.618221] ACPI Error: Method parse/execution failed \ECRW, AE_BAD_PARAMETER (20180105/psparse-550)
[ 1242.618232] ACPI Error: Method parse/execution failed \ECGD, AE_BAD_PARAMETER (20180105/psparse-550)
[ 1242.618243] ACPI Error: Method parse/execution failed \NEVT, AE_BAD_PARAMETER (20180105/psparse-550)
[ 1242.618255] ACPI Error: Method parse/execution failed \_SB.PCI0.LPCB.ECDV._Q66, AE_BAD_PARAMETER (20180105/psparse-550)
[…]
$ sudo dmidecode -t bios
# dmidecode 3.1
Getting SMBIOS data from sysfs.
SMBIOS 3.0.0 present.

Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
	Vendor: Dell Inc.
	Version: 1.0.2
	Release Date: 12/06/2017
	Address: 0xF0000
	Runtime Size: 64 kB
	ROM Size: 16 MB
	Characteristics:
		PCI is supported
		PNP is supported
		BIOS is upgradeable
		BIOS shadowing is allowed
		Boot from CD is supported
		Selectable boot is supported
		EDD is supported
		Japanese floppy for NEC 9800 1.2 MB is supported (int 13h)
		5.25"/1.2 MB floppy services are supported (int 13h)
		3.5"/720 kB floppy services are supported (int 13h)
		3.5"/2.88 MB floppy services are supported (int 13h)
		Print screen service is supported (int 5h)
		8042 keyboard services are supported (int 9h)
		Serial services are supported (int 14h)
		Printer services are supported (int 17h)
		ACPI is supported
		USB legacy is supported
		Smart battery is supported
		BIOS boot specification is supported
		Function key-initiated network boot is supported
		Targeted content distribution is supported
		UEFI is supported
	BIOS Revision: 1.0

Handle 0xF03C, DMI type 13, 22 bytes
BIOS Language Information
	Language Description Format: Long
	Installable Languages: 2
		en|US|iso8859-1
		<BAD INDEX>
	Currently Installed Language: en|US|iso8859-1
```
Comment 1 Mario Limonciello 2018-03-12 23:36:03 UTC
Does this only happen in deep?  Or also the default (s2idle)?
Comment 2 Paul Menzel 2018-03-12 23:48:45 UTC
(In reply to Mario Limonciello from comment #1)
> Does this only happen in deep?  Or also the default (s2idle)?

I was only able to reproduce it once in *deep*.
Comment 3 Mario Limonciello 2018-03-13 00:13:43 UTC
As in you've tried multiple times in deep and it's just that one time?  Or you tried once and it happened that once.
Comment 4 Paul Menzel 2018-03-13 16:08:20 UTC
(In reply to Mario Limonciello from comment #3)
> As in you've tried multiple times in deep and it's just that one time?  Or
> you tried once and it happened that once.

Yes, I tried *multiple times* with *deep*, and only saw the message once.
Comment 5 Zhang Rui 2018-05-07 07:20:03 UTC
are you able to reproduce now, if you do multiple suspend cycles?
if yes, I will send you a customized DST, to check which piece of ASL causes the EC address space handler error.


@erik,
I got following errors when assembling the dsdt table.

Intel ACPI Component Architecture
ASL+ Optimizing Compiler/Disassembler version 20180313
Copyright (c) 2000 - 2018 Intel Corporation

Compiler aborting due to parser-detected syntax error(s)
dsdt.dsl   4514:                     ECRW (If (PM0H)
Error    6126 -                            ^ syntax error, unexpected PARSEOP_IF, expecting PARSEOP_CLOSE_PAREN or ','

dsdt.dsl   4515:                             {
Error    6126 -                             ^ syntax error, unexpected '{'

dsdt.dsl   4518:                             }) = Zero
Error    6126 -                              ^ syntax error, unexpected PARSEOP_CLOSE_PAREN

ASL Input:     dsdt.dsl - 39718 lines, 1202500 bytes, 17649 keywords
Hex Dump:      dsdt.hex - 230 bytes

Compilation complete. 3 Errors, 0 Warnings, 0 Remarks, 0 Optimizations

and it is caused by the following piece of code
                If ((PM6H == One))
                {
                    CreateBitField (BUF0, \_SB.PCI0._Y0C._RW, ECRW)  // _RW_: Read-Write Status
                    ECRW (If (PM0H)
                            {
                                CreateDWordField (BUF0, \_SB.PCI0._Y0D._LEN, F0LN)  // _LEN: Length
                                F0LN = Zero
                            }) = Zero
                }

do we support this kind of ASL writing?
Comment 6 Paul Menzel 2018-05-15 14:13:52 UTC
Created attachment 275993 [details]
Linux 4.17-rc5 messages

(In reply to Zhang Rui from comment #5)
> are you able to reproduce now, if you do multiple suspend cycles?
> if yes, I will send you a customized DST, to check which piece of ASL causes
> the EC address space handler error.

Sorry for the late responds. With Linux 4.17-rc5 I was able to access the device today. So, yes, doing `sudo ./sleepgraph.py -multi 50 5 -skiphtml -maxdepth 0` it occurred *three* times.

```
$ journalctl -k -p 1..3
-- Logs begin at Mon 2018-03-26 11:06:55 CEST, end at Tue 2018-05-15 16:10:33 CEST. --
May 15 15:27:52 palestrina.molgen.mpg.de kernel: ioremap error for 0x3f799000-0x3f79a000, requested 0x2, got 0x0
May 15 15:42:18 palestrina.molgen.mpg.de kernel: ACPI Error: AE_BAD_PARAMETER, Returned by Handler for [EmbeddedControl] (20180313/evregion-266)
May 15 15:42:18 palestrina.molgen.mpg.de kernel: ACPI Error: Method parse/execution failed \_SB.PCI0.LPCB.ECDV.ECR1, AE_BAD_PARAMETER (20180313/psparse-516)
May 15 15:42:18 palestrina.molgen.mpg.de kernel: ACPI Error: Method parse/execution failed \_SB.PCI0.LPCB.ECDV.ECR2, AE_BAD_PARAMETER (20180313/psparse-516)
May 15 15:42:18 palestrina.molgen.mpg.de kernel: ACPI Error: Method parse/execution failed \ECRW, AE_BAD_PARAMETER (20180313/psparse-516)
May 15 15:42:18 palestrina.molgen.mpg.de kernel: ACPI Error: Method parse/execution failed \ECGD, AE_BAD_PARAMETER (20180313/psparse-516)
May 15 15:42:18 palestrina.molgen.mpg.de kernel: ACPI Error: Method parse/execution failed \NEVT, AE_BAD_PARAMETER (20180313/psparse-516)
May 15 15:42:18 palestrina.molgen.mpg.de kernel: ACPI Error: Method parse/execution failed \_SB.PCI0.LPCB.ECDV._Q66, AE_BAD_PARAMETER (20180313/psparse-516)
May 15 15:47:06 palestrina.molgen.mpg.de kernel: ACPI Error: AE_BAD_PARAMETER, Returned by Handler for [EmbeddedControl] (20180313/evregion-266)
May 15 15:47:06 palestrina.molgen.mpg.de kernel: ACPI Error: Method parse/execution failed \_SB.PCI0.LPCB.ECDV.ECR1, AE_BAD_PARAMETER (20180313/psparse-516)
May 15 15:47:06 palestrina.molgen.mpg.de kernel: ACPI Error: Method parse/execution failed \_SB.PCI0.LPCB.ECDV.ECR2, AE_BAD_PARAMETER (20180313/psparse-516)
May 15 15:47:06 palestrina.molgen.mpg.de kernel: ACPI Error: Method parse/execution failed \ECRW, AE_BAD_PARAMETER (20180313/psparse-516)
May 15 15:47:06 palestrina.molgen.mpg.de kernel: ACPI Error: Method parse/execution failed \ECGD, AE_BAD_PARAMETER (20180313/psparse-516)
May 15 15:47:06 palestrina.molgen.mpg.de kernel: ACPI Error: Method parse/execution failed \NEVT, AE_BAD_PARAMETER (20180313/psparse-516)
May 15 15:47:06 palestrina.molgen.mpg.de kernel: ACPI Error: Method parse/execution failed \_SB.PCI0.LPCB.ECDV._Q66, AE_BAD_PARAMETER (20180313/psparse-516)
May 15 15:47:54 palestrina.molgen.mpg.de kernel: ACPI Error: AE_BAD_PARAMETER, Returned by Handler for [EmbeddedControl] (20180313/evregion-266)
May 15 15:47:54 palestrina.molgen.mpg.de kernel: ACPI Error: Method parse/execution failed \_SB.PCI0.LPCB.ECDV.ECR1, AE_BAD_PARAMETER (20180313/psparse-516)
May 15 15:47:54 palestrina.molgen.mpg.de kernel: ACPI Error: Method parse/execution failed \_SB.PCI0.LPCB.ECDV.ECR2, AE_BAD_PARAMETER (20180313/psparse-516)
May 15 15:47:54 palestrina.molgen.mpg.de kernel: ACPI Error: Method parse/execution failed \ECRW, AE_BAD_PARAMETER (20180313/psparse-516)
May 15 15:47:54 palestrina.molgen.mpg.de kernel: ACPI Error: Method parse/execution failed \ECG1, AE_BAD_PARAMETER (20180313/psparse-516)
May 15 15:47:54 palestrina.molgen.mpg.de kernel: ACPI Error: Method parse/execution failed \NEVT, AE_BAD_PARAMETER (20180313/psparse-516)
May 15 15:47:54 palestrina.molgen.mpg.de kernel: ACPI Error: Method parse/execution failed \_SB.PCI0.LPCB.ECDV._Q66, AE_BAD_PARAMETER (20180313/psparse-516)
```
Comment 7 Zhang Rui 2018-05-30 05:55:39 UTC
@erik
have we fixed the error in disassembler?
if yes, I'd like to cook up a custom DSDT to check why the EC error happens. it smells to me that we are accessing invalid EC address space
Comment 8 Erik Kaneda 2018-05-31 17:47:10 UTC
(In reply to Zhang Rui from comment #7)
> @erik
> have we fixed the error in disassembler?
Hi Rui,

This turns out to require a fairly substantial change in the AML parser that we're trying to implement see https://bugs.acpica.org/show_bug.cgi?id=1448. 

For now, you can change this code block at line 4511:

If ((PM6H == One))
{
    CreateBitField (BUF0, \_SB.PCI0._Y0C._RW, ECRW)  // _RW_: Read-Write Status
    ECRW (If (PM0H)
    {
         CreateDWordField (BUF0, \_SB.PCI0._Y0D._LEN, F0LN)  // _LEN: Length
         F0LN = Zero
    }) = Zero
}


to this:

If ((PM6H == One))
{
    CreateBitField (BUF0, \_SB.PCI0._Y0C._RW, ECRW)  // _RW_: Read-Write Status
    ECRW = Zero
}
If (PM0H)
{
    CreateDWordField (BUF0, \_SB.PCI0._Y0D._LEN, F0LN)  // _LEN: Length
    F0LN = Zero
}

Let me know if you have any other issues

> if yes, I'd like to cook up a custom DSDT to check why the EC error happens.
> it smells to me that we are accessing invalid EC address space
Comment 9 superm1 2018-05-31 17:58:30 UTC
Created attachment 276283 [details]
attachment-11153-0.html

?
Hello,

I will be on vacation through June 4. Expect delayed response.
Comment 10 Zhang Rui 2018-06-25 07:40:47 UTC
@Erik

dsdt.dsl  20329:                     XTBT (TBSE, CPGN)
Error    6152 -                        ^ Illegal recursive call to method that creates named objects (XTBT)

    Original name creation/declaration below:
    dsdt.dsl  20277:         Method (XTBT, 2, Serialized)

so XTBT is invoked inside XTBT() method, is this allowed?
Comment 11 Zhang Rui 2018-06-25 07:59:05 UTC
Created attachment 276827 [details]
custom ECR2 to dump more context

please
1. make sure your kernel is built with CONFIG_ACPI_CUSTOM_METHOD
2. boot with kernel option acpi.aml_debug_output=1
3. after boot, run "echo ecr2.aml > /sys/kernel/debug/acpi/custom_method"
4. attach the dmesg output after reproducing the problem
Comment 12 Erik Kaneda 2018-06-28 23:26:17 UTC
(In reply to Zhang Rui from comment #10)
> @Erik
> 
> dsdt.dsl  20329:                     XTBT (TBSE, CPGN)
> Error    6152 -                        ^ Illegal recursive call to method
> that creates named objects (XTBT)
> 
>     Original name creation/declaration below:
>     dsdt.dsl  20277:         Method (XTBT, 2, Serialized)
> 
> so XTBT is invoked inside XTBT() method, is this allowed?

It should not be so we made this as a compilation error in newer versions of iASL. If XTBT calls itself recursively, I think you'll get an error but it won't cause a fatal error (like a kernel panic) or anything like that.
Comment 13 Zhang Rui 2018-08-29 06:26:46 UTC
Bug closed as there is no response from the bug reporter.
please feel free to reopen it if you can provide the test result for comment #11.

Note You need to log in before you can comment on or make changes to this bug.