acpi_cmbat: Use nitems instead of sizeof
Reviewed by: imp, markj, Elliott Mitchell
Pull Request: https://github.com/freebsd/freebsd-src/pull/1125
(cherry picked from commit d0cc25f770aee068bcbaee89aa2f52cc5dd79dd5)
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
[12 lines not shown]
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
[12 lines not shown]
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
[10 lines not shown]
acpi_cmbat: Use nitems instead of sizeof
Reviewed by: imp, markj, Elliott Mitchell
Pull Request: https://github.com/freebsd/freebsd-src/pull/1125
sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
Similar commit in current:
(cherry picked from commit 685dc743dc3b)
sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
acpi(4): Fix a typo in a kernel message
- s/enitialization/initialization/
MFC afer: 5 days
acpi: Remove unused devclass arguments to DRIVER_MODULE.
FreeBSD/src 9f75f58 (r359076) — share/man/man4 acpi_battery.4, sys/dev/acpica acpi_cmbat.c acpi_battery.c
MFC of r355574, r358095, and r358395:
Add ACPI battery subsystem man page.
Add _BIX (Battery Information Extended) object support.
ACPI Control Method Batteries have a _BIF and/or _BIX object which
provide static properties of the battery. FreeBSD acpi_cmbat module
supported _BIF object only, which was deprecated as of ACPI 4.0.
_BIX is an extended version of _BIF defined in ACPI 4.0 or later.
As of writing, _BIX has two revisions. One is in ACPI 4.0 (rev.0) and
another is in ACPI 6.0 (rev.1). It seems that hardware vendors still
stick to _BIF only or _BIX rev.0 + _BIF for the maximum compatibility.
Microsoft requires _BIX rev.0 for Windows machines, so there are some
laptop machines with _BIX rev.0 only. In this case, FreeBSD does not
recognize the battery information.
After this change, the acpi_cmbat module gets battery information from
[20 lines not shown]
FreeBSD/src 5511922 (r359076) — share/man/man4 acpi_battery.4, sys/dev/acpica acpi_cmbat.c acpi_battery.c
MFC of r355574, r358095, and r358395:
Add ACPI battery subsystem man page.
Add _BIX (Battery Information Extended) object support.
ACPI Control Method Batteries have a _BIF and/or _BIX object which
provide static properties of the battery. FreeBSD acpi_cmbat module
supported _BIF object only, which was deprecated as of ACPI 4.0.
_BIX is an extended version of _BIF defined in ACPI 4.0 or later.
As of writing, _BIX has two revisions. One is in ACPI 4.0 (rev.0) and
another is in ACPI 6.0 (rev.1). It seems that hardware vendors still
stick to _BIF only or _BIX rev.0 + _BIF for the maximum compatibility.
Microsoft requires _BIX rev.0 for Windows machines, so there are some
laptop machines with _BIX rev.0 only. In this case, FreeBSD does not
recognize the battery information.
After this change, the acpi_cmbat module gets battery information from
[20 lines not shown]
FreeBSD/src 75dfc66 (r358401) — lib/libc/sparc64/fpu fpu_implode.c, libexec/rtld-elf/sparc64 reloc.c
Merge ^/head r358269 through r358399.
Add workaround for models which do not follow the ACPI specification strictly.
Extra objects are now simply ignored instead of rejecting everything.
FreeBSD/src 43c7dd6 (r358131) — contrib/ncurses configure announce.html.in, contrib/ncurses/doc/html announce.html
Merge ^/head r358075 through r358130.
Delta | File |
---|
+1,503 | -1,504 | contrib/ncurses/configure |
+1,070 | -1,850 | contrib/ncurses/announce.html.in |
+1,037 | -1,777 | contrib/ncurses/doc/html/announce.html |
+612 | -998 | contrib/ncurses/ANNOUNCE |
+318 | -256 | sys/vm/uma_core.c |
+208 | -117 | sys/vm/vm_radix.c |
+4,748 | -6,502 | 624 files not shown |
+7,647 | -8,119 | 630 files |
FreeBSD/src 294de6b (r358095) — share/man/man4 acpi_battery.4, sys/dev/acpica acpi_cmbat.c acpi_battery.c
Add _BIX (Battery Information Extended) object support.
ACPI Control Method Batteries have a _BIF and/or _BIX object which
provide static properties of the battery. FreeBSD acpi_cmbat module
supported _BIF object only, which was deprecated as of ACPI 4.0.
_BIX is an extended version of _BIF defined in ACPI 4.0 or later.
As of writing, _BIX has two revisions. One is in ACPI 4.0 (rev.0) and
another is in ACPI 6.0 (rev.1). It seems that hardware vendors still
stick to _BIF only or _BIX rev.0 + _BIF for the maximum compatibility.
Microsoft requires _BIX rev.0 for Windows machines, so there are some
laptop machines with _BIX rev.0 only. In this case, FreeBSD does not
recognize the battery information.
After this change, the acpi_cmbat module gets battery information from
_BIX or _BIF object and internally uses _BIX rev.1 data structure as
the primary information store in the kernel. ACPIIO_BATT_GET_BI[FX]
returns an acpi_bi[fx] structure built by using information obtained
from a _BIF or a _BIX object found on the system. The revision number
[14 lines not shown]
FreeBSD/src fda9ada (r339813) — contrib/libarchive/libarchive archive_read_support_format_rar5.c archive_blake2s_ref.c, contrib/libarchive/libarchive/test test_read_format_rar5_arm.rar.uu test_read_format_rar5.c
Merge ^/head r339670 through r339812.
FreeBSD/src 5efca36 (r339754) — sys/dev/acpi_support acpi_toshiba.c, sys/dev/acpica acpi.c
Distinguish _CID match and _HID match and make lower priority probe
when _CID match.
Reviewed by: jhb, imp
Differential Revision:https://reviews.freebsd.org/D16468
FreeBSD/src 14b841d (r337608) — sys/dev/qlnx/qlnxe ecore_init_values.h reg_addr.h, sys/dev/usb/controller at91dci.c
MFH @ r337607, in preparation for boarding
Delta | File |
---|
+51,685 | -49,575 | sys/dev/qlnx/qlnxe/ecore_init_values.h |
+10,407 | -5,984 | sys/dev/qlnx/qlnxe/reg_addr.h |
+2,891 | -2,449 | sys/dev/qlnx/qlnxe/ecore_dbg_values.h |
+4,961 | -0 | sys/dev/qlnx/qlnxe/ecore_sriov.c |
+2,041 | -945 | sys/dev/qlnx/qlnxe/ecore_dev.c |
+0 | -2,382 | sys/dev/usb/controller/at91dci.c |
+71,985 | -61,335 | 1,587 files not shown |
+127,140 | -133,228 | 1,593 files |
FreeBSD/src bbd7a92 (r337286) — sys/cddl/contrib/opensolaris/uts/common/fs/zfs space_map.c vdev_initialize.c
Merge ^/head r336870 through r337285, and resolve conflicts.
Make timespecadd(3) and friends public
The timespecadd(3) family of macros were imported from NetBSD back in
r35029. However, they were initially guarded by #ifdef _KERNEL. In the
meantime, we have grown at least 28 syscalls that use timespecs in some
way, leading many programs both inside and outside of the base system to
redefine those macros. It's better just to make the definitions public.
Our kernel currently defines two-argument versions of timespecadd and
timespecsub. NetBSD, OpenBSD, and FreeDesktop.org's libbsd, however, define
three-argument versions. Solaris also defines a three-argument version, but
only in its kernel. This revision changes our definition to match the
common three-argument version.
Bump _FreeBSD_version due to the breaking KPI change.
Discussed with: cem, jilles, ian, bde
Differential Revision: https://reviews.freebsd.org/D14725
MFC r314328:
Fix startup race initialising ACPI CM battery structures on MacBookPro.
During acpi_cmbat_attach() the acpi_cmbat_init_battery() notification
handler is registered. It has been observed this notification handler
can be called instantly, before the attach routine has returned. In
the notification handler there is a call to device_is_attached() which
returns false. Because the softc is set we know an attach is in
progress and the fix is simply to wait and try again in this case.
Reviewed by: avg @
MFC r314328:
Fix startup race initialising ACPI CM battery structures on MacBookPro.
During acpi_cmbat_attach() the acpi_cmbat_init_battery() notification
handler is registered. It has been observed this notification handler
can be called instantly, before the attach routine has returned. In
the notification handler there is a call to device_is_attached() which
returns false. Because the softc is set we know an attach is in
progress and the fix is simply to wait and try again in this case.
Reviewed by: avg @
MFC r314328:
Fix startup race initialising ACPI CM battery structures on MacBookPro.
During acpi_cmbat_attach() the acpi_cmbat_init_battery() notification
handler is registered. It has been observed this notification handler
can be called instantly, before the attach routine has returned. In
the notification handler there is a call to device_is_attached() which
returns false. Because the softc is set we know an attach is in
progress and the fix is simply to wait and try again in this case.
Reviewed by: avg @
MFC r314328:
Fix startup race initialising ACPI CM battery structures on MacBookPro.
During acpi_cmbat_attach() the acpi_cmbat_init_battery() notification
handler is registered. It has been observed this notification handler
can be called instantly, before the attach routine has returned. In
the notification handler there is a call to device_is_attached() which
returns false. Because the softc is set we know an attach is in
progress and the fix is simply to wait and try again in this case.
Reviewed by: avg @
FreeBSD/src be64968 (r314421) — sys/arm/allwinner/clkng ccu_a31.c ccu_h3.c, sys/compat/svr4 svr4_stream.c svr4_misc.c
Merge ^/head r314270 through r314419.
Fix startup race initialising ACPI CM battery structures on MacBookPro.
During acpi_cmbat_attach() the acpi_cmbat_init_battery() notification
handler is registered. It has been observed this notification handler
can be called instantly, before the attach routine has returned. In
the notification handler there is a call to device_is_attached() which
returns false. Because the softc is set we know an attach is in
progress and the fix is simply to wait and try again in this case.
Reviewed by: avg @
MFC after: 1 week
Merge fresh head.
Delta | File |
---|
+140,456 | -0 | contrib/sqlite3/sqlite3.c |
+83,644 | -0 | sys/contrib/dev/ath/ath_hal/ar9300/osprey_reg_map_macro.h |
+66,519 | -0 | sys/contrib/dev/ath/ath_hal/ar9300/scorpion_reg_map_macro.h |
+65,039 | -0 | tools/tools/cxgbetool/reg_defs_t5.c |
+37,786 | -0 | contrib/apr-util/configure |
+30,720 | -0 | contrib/apr/configure |
+424,164 | -0 | 14,987 files not shown |
+2,853,377 | -989,560 | 14,993 files |
MFC r227293 (by ed):
Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.
This means that their use is restricted to a single C file.
FreeBSD/src d241a0e (r247353) — contrib/expat configure, contrib/ldns configure ltmain.sh
IFC @247348.
Delta | File |
---|
+8,388 | -17,778 | contrib/openbsm/configure |
+0 | -22,017 | contrib/expat/configure |
+18,892 | -0 | contrib/ldns/configure |
+6,303 | -4,236 | contrib/openbsm/aclocal.m4 |
+6,457 | -3,763 | contrib/openbsm/config/ltmain.sh |
+9,661 | -0 | contrib/ldns/ltmain.sh |
+49,701 | -47,794 | 5,939 files not shown |
+444,763 | -188,195 | 5,945 files |
FreeBSD/src d9a4475 (r246555) — contrib/llvm/tools/clang/lib/Rewrite RewriteModernObjC.cpp, contrib/llvm/tools/clang/lib/Rewrite/Frontend RewriteModernObjC.cpp
Sync with HEAD.
Delta | File |
---|
+8,388 | -17,778 | contrib/openbsm/configure |
+6,303 | -4,236 | contrib/openbsm/aclocal.m4 |
+6,457 | -3,763 | contrib/openbsm/config/ltmain.sh |
+7,982 | -0 | contrib/openbsm/m4/libtool.m4 |
+7,607 | -0 | contrib/llvm/tools/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp |
+0 | -7,543 | contrib/llvm/tools/clang/lib/Rewrite/RewriteModernObjC.cpp |
+36,737 | -33,320 | 5,398 files not shown |
+322,757 | -153,044 | 5,404 files |