opnsense-src/sys/dev/acpica
Bartosz Fabianowski cd8c3af747 ACPI: Treat all 20-element _BIX entires as revision 0
Some Fujitsu Lifebooks return an invalid _BIX object. The first element
of _BIX is a revision number, which indicates what elements will follow:
* ACPI 4.0 defined _BIX revision 0 with 20 elements.
* ACPI 6.0 introduced _BIX revision 1 with 21 elements.
The problem is that the offending Lifebooks have the a non-zero _BIX
revision, but provide 20 fields only.

The ACPICA parser chokes on this [1], but that seems to be
inconsequential. More importantly, our own battery info handling code
also verifies that for revision > 0, there are at least 21 fields - and
refuses to process the invalid _BIX. One workaround would be to
introduce special case / quirk handling for Fujitsu Lifebooks. A better
one is to relax the requirements check: If there are only 20 elements,
treat the _BIX as revision 0, no matter what revision number was
provided by the device.

Linux doesn't run into this problem by the way because it only supports
the 20 fields defined in the ACPI 4.0 spec [3]. It never looks at the
revision number or the 21st field added in ACPI 6.0.

[1] https://cgit.freebsd.org/src/tree/sys/contrib/dev/acpica/components/namespace/nsprepkg.c#n815
[2] https://cgit.freebsd.org/src/tree/sys/dev/acpica/acpi_cmbat.c#n371
[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/acpi/battery.c#n418

PR: 252030
Reviewed by: imp
MFC After: 2 weeks
2024-10-02 12:30:15 -06:00
..
Osd pci_cfgreg: Add a PCI domain argument to the low-level register API 2023-11-29 10:31:47 -08:00
acpi.c newbus: replace -1 in BUS_ADD_CHILD(...-1) with DEVICE_UNIT_ANY 2024-07-24 22:23:02 -06:00
acpi_acad.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
acpi_apei.c apei: Mark ReadAckRegister resource as shareable 2024-01-09 16:07:34 -05:00
acpi_battery.c acpi_battery: avoid divide-by-zero when no devices have capacity info 2024-04-16 19:39:45 -04:00
acpi_bus_if.m sys: Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:54:58 -06:00
acpi_button.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
acpi_cmbat.c ACPI: Treat all 20-element _BIX entires as revision 0 2024-10-02 12:30:15 -06:00
acpi_container.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
acpi_cpu.c acpi_cpu: Reduce BUS_MASTER_RLD manipulations 2023-12-25 21:43:20 -05:00
acpi_dock.c sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
acpi_ec.c acpi: Use device_set_descf() 2024-06-02 19:38:41 -04:00
acpi_ged.c acpi_ged: Handle events directly 2023-10-12 11:27:44 -04:00
acpi_hpet.c acpi_hpet: Make use of enum for vm_guest to improve readability 2024-03-24 23:31:22 +08:00
acpi_hpet.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
acpi_if.m sys: Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:54:58 -06:00
acpi_isab.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
acpi_lid.c acpi_lid: Remove duplicate events 2023-12-23 21:33:51 -05:00
acpi_package.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
acpi_pci.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
acpi_pci_link.c acpi: Use device_set_descf() 2024-06-02 19:38:41 -04:00
acpi_pcib.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
acpi_pcib_acpi.c Retire unused non-PCI_RES_BUS code 2024-07-18 18:55:33 +01:00
acpi_pcib_pci.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
acpi_pcibvar.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
acpi_pcivar.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
acpi_perf.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
acpi_powerres.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
acpi_pxm.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
acpi_quirk.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
acpi_quirks sys: Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:54:58 -06:00
acpi_resource.c acpi: Narrow workaround for broken interrupt settings on x86 2024-07-15 12:13:51 -07:00
acpi_smbat.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
acpi_smbus.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
acpi_thermal.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
acpi_throttle.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
acpi_timer.c acpi_timer: remove leftovers from Garbage-collect ACPI-safe timer and friends 2024-06-21 14:06:26 +02:00
acpi_video.c newbus: globally replace device_add_child(..., -1) with DEVICE_UNIT_ANY 2024-07-24 22:22:58 -06:00
acpiio.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
acpivar.h acpi: Narrow workaround for broken interrupt settings on x86 2024-07-15 12:13:51 -07:00