Bug 67351

Summary: ACPI Fix that breaks _BIX table parsing.
Product: ACPI Reporter: Francisco Castro (fcr)
Component: Power-BatteryAssignee: Lan Tianyu (tianyu.lan)
Status: CLOSED CODE_FIX    
Severity: high CC: fcr, tianyu.lan
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 3.8.0.31 onwards Subsystem:
Regression: Yes Bisected commit-id:
Attachments: Binary dump of dmidecode
debug.patch
Fix for nec lz750-ls
bat.patch
update_bat.patch

Description Francisco Castro 2013-12-19 05:52:08 UTC
Hello,

Before anything, sorry for my broken english:

The issue to be reported here, is that the "fix" for the bug:

https://bugzilla.kernel.org/show_bug.cgi?id=60519

which was merged from kernel 3.8.0.31 onwards; makes the battery module fail
on a laptop (NEC LZ750/LS) which previously worked. After removing the two
lines that the parch added and recompiling, it works again.

These are the lines that dmesg is now showing:

[    2.272970] ACPI Warning: For \_SB_.PCI0.LPCB.EC__.BAT1._BIX: Return Package is too small - found 19 elements, expected 20 (20121018/nspredef-679)
[    2.272985] battery: probe of PNP0C0A:00 failed with error -14

The "fix" for that issue should be removed, or at least rewritten, since it
breaks compatibility with hardware that's somewhat new, and still on sale.

acpidump is attached to the refferenced bug.
Comment 1 Lan Tianyu 2013-12-19 09:37:42 UTC
Hi, check the _BIX package in the acpidump and it doesn't comply with ACPI5.0 SPEC(Table 10-234). The first member should be "revision" which always should be 0 which the first member of the package on this machine  is "Power Unit" which is the second member according ACPI SPEC. So this is a Bios problem. We can do a quirk for such machine. So please provide the output of the dmidecode.

 Name (BIX0, Package (0x13)
 {           {
                One,
                0x1130,
                0x1130,
                One,
                0x39D0,
                Zero,
                Zero,
                0xFFFFFFFF,
                0x00013880,
                0x07D0,
                0x07D0,
                0x0BB8,
                0x03E8,
                One,
                One,
                "CRB Battery 0",
                "Battery 0",
                "Lipo",
                "-Virtual Battery 0-"
            })
}
Comment 2 Francisco Castro 2013-12-19 10:55:39 UTC
Created attachment 119011 [details]
Binary dump of dmidecode
Comment 3 Lan Tianyu 2013-12-20 07:04:38 UTC
Created attachment 119131 [details]
debug.patch

Please try this patch.
Comment 4 Francisco Castro 2013-12-20 18:34:01 UTC
Created attachment 119151 [details]
Fix for nec lz750-ls

I modified the previous patch, changing the order where dmi_check_system is called. That's because acpi_bus_register_driver ends up calling acpi_battery_add, which calls acpi_battery_update which calls acpi_battery_get_info (where the battery_bix_broken_package flag is used).

And now it's working again.
Comment 5 Lan Tianyu 2013-12-23 01:34:43 UTC
Created attachment 119311 [details]
bat.patch

Thanks for test and correction. I just rework the patch. Please test again.
Comment 6 Lan Tianyu 2013-12-23 01:36:58 UTC
Created attachment 119321 [details]
update_bat.patch
Comment 7 Francisco Castro 2013-12-23 06:42:24 UTC
Tested and working.

Thank you!
Comment 8 Lan Tianyu 2014-01-02 07:49:00 UTC
Fix patch is sent to ACPI maillist.
https://patchwork.kernel.org/patch/3423901/