FreeBSD/src 4073e53sys/dev/acpica acpi_cmbat.c

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)
DeltaFile
+2-2sys/dev/acpica/acpi_cmbat.c
+2-21 files

FreeBSD/src 3c59c44sys/dev/acpica acpi_cmbat.c

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]
DeltaFile
+11-2sys/dev/acpica/acpi_cmbat.c
+11-21 files

FreeBSD/src 4651f4bsys/dev/acpica acpi_cmbat.c

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]
DeltaFile
+11-2sys/dev/acpica/acpi_cmbat.c
+11-21 files

FreeBSD/src cd8c3afsys/dev/acpica acpi_cmbat.c

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]
DeltaFile
+11-2sys/dev/acpica/acpi_cmbat.c
+11-21 files

FreeBSD/src d0cc25fsys/dev/acpica acpi_cmbat.c

acpi_cmbat: Use nitems instead of sizeof

Reviewed by: imp, markj, Elliott Mitchell
Pull Request: https://github.com/freebsd/freebsd-src/pull/1125
DeltaFile
+2-2sys/dev/acpica/acpi_cmbat.c
+2-21 files

FreeBSD/src 3bc8099sys/arm/arm bcopy_page.S blockio.S

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/

Similar commit in current:
(cherry picked from commit 685dc743dc3b)
DeltaFile
+0-3sys/arm/arm/bcopy_page.S
+0-3sys/arm/arm/blockio.S
+0-3sys/arm/arm/exception.S
+0-3sys/arm/arm/hypervisor-stub.S
+0-3sys/arm/arm/locore-v6.S
+0-3sys/arm/arm/swtch-v6.S
+0-184,033 files not shown
+0-7,9144,039 files

FreeBSD/src 685dc74sys/arm/arm swtch.S swtch-v6.S, sys/arm/mv/armadaxp mptramp.S

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
DeltaFile
+0-3sys/arm/mv/armadaxp/mptramp.S
+0-3sys/arm/arm/swtch.S
+0-3sys/arm/arm/swtch-v6.S
+0-3sys/arm/arm/locore-v6.S
+0-3sys/arm/arm/hypervisor-stub.S
+0-3sys/arm/arm/exception.S
+0-183,795 files not shown
+0-7,4523,801 files

FreeBSD/src f63aaffsys/dev/acpica acpi_cmbat.c

acpi(4): Fix a typo in a kernel message

- s/enitialization/initialization/

MFC afer:       5 days
DeltaFile
+1-1sys/dev/acpica/acpi_cmbat.c
+1-11 files

FreeBSD/src 916a5d8sys/dev/acpica acpi_container.c acpi_pci_link.c

acpi: Remove unused devclass arguments to DRIVER_MODULE.
DeltaFile
+1-4sys/dev/acpica/acpi_container.c
+1-4sys/dev/acpica/acpi_pci_link.c
+1-4sys/dev/acpica/acpi_video.c
+1-3sys/dev/acpica/acpi_button.c
+1-3sys/dev/acpica/acpi_dock.c
+1-3sys/dev/acpica/acpi_hpet.c
+6-2116 files not shown
+22-5822 files

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]
DeltaFile
+380-0share/man/man4/acpi_battery.4
+169-83sys/dev/acpica/acpi_cmbat.c
+80-60sys/dev/acpica/acpi_battery.c
+91-4sys/dev/acpica/acpiio.h
+44-17usr.sbin/acpi/acpiconf/acpiconf.c
+29-23sys/dev/acpica/acpi_smbat.c
+793-1874 files not shown
+818-19110 files

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]
DeltaFile
+380-0share/man/man4/acpi_battery.4
+169-83sys/dev/acpica/acpi_cmbat.c
+80-60sys/dev/acpica/acpi_battery.c
+91-4sys/dev/acpica/acpiio.h
+44-17usr.sbin/acpi/acpiconf/acpiconf.c
+29-23sys/dev/acpica/acpi_smbat.c
+793-1874 files not shown
+818-19110 files

FreeBSD/src 75dfc66 (r358401)lib/libc/sparc64/fpu fpu_implode.c, libexec/rtld-elf/sparc64 reloc.c

Merge ^/head r358269 through r358399.
DeltaFile
+1,445-154share/misc/pci_vendors
+0-1,120tools/test/testfloat/sparc64/systfloat.S
+0-887libexec/rtld-elf/sparc64/reloc.c
+0-706tools/test/testfloat/sparc64/fpu_util.c
+0-542lib/libc/sparc64/fpu/fpu_implode.c
+54-423sys/dev/mpr/mpr_sas.c
+1,499-3,832784 files not shown
+7,479-16,079790 files

FreeBSD/src ff29a95 (r358395)sys/dev/acpica acpi_cmbat.c

Add workaround for models which do not follow the ACPI specification strictly.
Extra objects are now simply ignored instead of rejecting everything.
DeltaFile
+17-4sys/dev/acpica/acpi_cmbat.c
+17-41 files

FreeBSD/src 43c7dd6 (r358131)contrib/ncurses configure announce.html.in, contrib/ncurses/doc/html announce.html

Merge ^/head r358075 through r358130.
DeltaFile
+1,503-1,504contrib/ncurses/configure
+1,070-1,850contrib/ncurses/announce.html.in
+1,037-1,777contrib/ncurses/doc/html/announce.html
+612-998contrib/ncurses/ANNOUNCE
+318-256sys/vm/uma_core.c
+208-117sys/vm/vm_radix.c
+4,748-6,502624 files not shown
+7,647-8,119630 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]
DeltaFile
+156-83sys/dev/acpica/acpi_cmbat.c
+135-38share/man/man4/acpi_battery.4
+80-60sys/dev/acpica/acpi_battery.c
+91-4sys/dev/acpica/acpiio.h
+44-17usr.sbin/acpi/acpiconf/acpiconf.c
+29-23sys/dev/acpica/acpi_smbat.c
+535-2253 files not shown
+559-2299 files

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.
DeltaFile
+3,462-0contrib/libarchive/libarchive/archive_read_support_format_rar5.c
+916-0contrib/libarchive/libarchive/test/test_read_format_rar5_arm.rar.uu
+728-0contrib/libarchive/libarchive/test/test_read_format_rar5.c
+367-0contrib/libarchive/libarchive/archive_blake2s_ref.c
+359-0contrib/libarchive/libarchive/archive_blake2sp_ref.c
+189-165sbin/dumpon/dumpon.8
+6,021-165249 files not shown
+13,921-1,164255 files

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
DeltaFile
+28-16sys/dev/acpica/acpi.c
+11-9sys/dev/ichiic/ig4_acpi.c
+10-7sys/dev/amdgpio/amdgpio.c
+10-7sys/dev/acpi_support/acpi_toshiba.c
+8-7sys/dev/intel/spi.c
+7-6sys/dev/gpio/bytgpio.c
+74-5229 files not shown
+249-17635 files

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
DeltaFile
+51,685-49,575sys/dev/qlnx/qlnxe/ecore_init_values.h
+10,407-5,984sys/dev/qlnx/qlnxe/reg_addr.h
+2,891-2,449sys/dev/qlnx/qlnxe/ecore_dbg_values.h
+4,961-0sys/dev/qlnx/qlnxe/ecore_sriov.c
+2,041-945sys/dev/qlnx/qlnxe/ecore_dev.c
+0-2,382sys/dev/usb/controller/at91dci.c
+71,985-61,3351,587 files not shown
+127,140-133,2281,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.
DeltaFile
+619-213sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c
+792-0sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_initialize.c
+432-161sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
+398-187sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_removal.c
+537-18sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c
+226-170sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
+3,004-749395 files not shown
+11,245-4,125401 files

FreeBSD/src 6040822 (r336914)lib/libnetbsd/sys time.h, sbin/fsck_ffs fsutil.c

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
DeltaFile
+67-21share/man/man3/timeradd.3
+0-65lib/libnetbsd/sys/time.h
+8-33tools/regression/sockets/udp_pingpong/udp_pingpong.c
+3-32tools/regression/posixsem/posixsem.c
+6-27sbin/fsck_ffs/fsutil.c
+16-12sys/sys/time.h
+100-19039 files not shown
+187-36245 files

FreeBSD/src c943fb9 (r315266)sys/dev/acpica acpi_cmbat.c

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 @
DeltaFile
+29-5sys/dev/acpica/acpi_cmbat.c
+29-51 files

FreeBSD/src e96b771 (r315265)sys/dev/acpica acpi_cmbat.c

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 @
DeltaFile
+29-5sys/dev/acpica/acpi_cmbat.c
+29-51 files

FreeBSD/src 11c9e16 (r315264)sys/dev/acpica acpi_cmbat.c

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 @
DeltaFile
+29-5sys/dev/acpica/acpi_cmbat.c
+29-51 files

FreeBSD/src 8e409b5 (r315263)sys/dev/acpica acpi_cmbat.c

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 @
DeltaFile
+29-5sys/dev/acpica/acpi_cmbat.c
+29-51 files

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.
DeltaFile
+0-2,043sys/compat/svr4/svr4_stream.c
+0-1,680sys/compat/svr4/svr4_misc.c
+936-0sys/arm/allwinner/clkng/ccu_a31.c
+0-732sys/compat/svr4/svr4_fcntl.c
+720-0sys/arm/allwinner/clkng/ccu_h3.c
+0-705sys/compat/svr4/svr4_stat.c
+1,656-5,160273 files not shown
+7,137-16,706279 files

FreeBSD/src a26871e (r314328)sys/dev/acpica acpi_cmbat.c

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
DeltaFile
+29-5sys/dev/acpica/acpi_cmbat.c
+29-51 files

FreeBSD/src cfe30d0 (r251991)contrib/apr configure, contrib/apr-util configure

Merge fresh head.
DeltaFile
+140,456-0contrib/sqlite3/sqlite3.c
+83,644-0sys/contrib/dev/ath/ath_hal/ar9300/osprey_reg_map_macro.h
+66,519-0sys/contrib/dev/ath/ath_hal/ar9300/scorpion_reg_map_macro.h
+65,039-0tools/tools/cxgbetool/reg_defs_t5.c
+37,786-0contrib/apr-util/configure
+30,720-0contrib/apr/configure
+424,164-014,987 files not shown
+2,853,377-989,56014,993 files

FreeBSD/src 1139d39 (r249132)sys/cam cam_queue.c, sys/fs/ntfs ntfs_subr.c

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.
DeltaFile
+6-4sys/fs/ntfs/ntfs_subr.c
+6-3sys/netgraph/ng_base.c
+4-3sys/net/vnet.c
+3-3sys/cam/cam_queue.c
+3-2sys/nfs/nfs_lock.c
+2-2sys/netgraph/atm/ngatmbase.c
+24-17142 files not shown
+180-165148 files

FreeBSD/src d241a0e (r247353)contrib/expat configure, contrib/ldns configure ltmain.sh

IFC @247348.
DeltaFile
+8,388-17,778contrib/openbsm/configure
+0-22,017contrib/expat/configure
+18,892-0contrib/ldns/configure
+6,303-4,236contrib/openbsm/aclocal.m4
+6,457-3,763contrib/openbsm/config/ltmain.sh
+9,661-0contrib/ldns/ltmain.sh
+49,701-47,7945,939 files not shown
+444,763-188,1955,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.
DeltaFile
+8,388-17,778contrib/openbsm/configure
+6,303-4,236contrib/openbsm/aclocal.m4
+6,457-3,763contrib/openbsm/config/ltmain.sh
+7,982-0contrib/openbsm/m4/libtool.m4
+7,607-0contrib/llvm/tools/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp
+0-7,543contrib/llvm/tools/clang/lib/Rewrite/RewriteModernObjC.cpp
+36,737-33,3205,398 files not shown
+322,757-153,0445,404 files