opnsense-src/sys/contrib/dev
Dimitry Andric 130a690ae1 Fix acpica macros that subtract null pointers
Clang 13.0.0 produces a new -Werror warning about the ACPI_TO_INTEGER(p)
and ACPI_OFFSET(d, f) macros in acpica's actypes.h:

    sys/contrib/dev/acpica/components/dispatcher/dsopcode.c:708:31: error: performing pointer subtraction with a null pointer has undefined behavior [-Werror,-Wnull-pointer-subtraction]
        ObjDesc->Region.Address = ACPI_PTR_TO_PHYSADDR (Table);
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    sys/contrib/dev/acpica/include/actypes.h:664:41: note: expanded from macro 'ACPI_PTR_TO_PHYSADDR'
    #define ACPI_PTR_TO_PHYSADDR(i)         ACPI_TO_INTEGER(i)
                                            ^~~~~~~~~~~~~~~~~~
    sys/contrib/dev/acpica/include/actypes.h:661:41: note: expanded from macro 'ACPI_TO_INTEGER'
    #define ACPI_TO_INTEGER(p)              ACPI_PTR_DIFF (p, (void *) 0)
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    sys/contrib/dev/acpica/include/actypes.h:656:82: note: expanded from macro 'ACPI_PTR_DIFF'
    #define ACPI_PTR_DIFF(a, b)             ((ACPI_SIZE) (ACPI_CAST_PTR (UINT8, (a)) - ACPI_CAST_PTR (UINT8, (b))))
                                                                                     ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.

This problem of undefined behavior was also reported to acpica by @cem
in 2018: https://github.com/acpica/acpica/issues/407, but it seems there
was never any fix committed for it upstream.

Instead fix these locally, for ACPI_TO_INTEGER by simply casting the
incoming pointer to ACPI_SIZE (which corresponds roughly to uintptr_t
and size_t), and for ACPI_OFFSET by reusing our __offsetof definition
from sys/cdefs.h.

Reviewed by:	emaste, kib, imp
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D31710
2021-08-30 21:34:34 +02:00
..
acpica Fix acpica macros that subtract null pointers 2021-08-30 21:34:34 +02:00
ath/ath_hal/ar9300 [ath_hal] Add get/set NAV functions 2021-04-18 22:52:31 -07:00
ice ice_ddp: Revert mode back to 0644 2021-06-25 10:28:28 -07:00
imx Add the firmware blob required to use the sdma hardware in the imx6 2020-11-26 01:40:04 +00:00
ipw
iwi
iwm Downgrade the firmware images imported in r354201. 2019-11-03 03:23:27 +00:00
iwn
liquidio The diff is the initial submission of Cavium Liquidio 2350/2360 10/25G 2017-09-12 23:36:58 +00:00
mwl
nvidia ARM: Enhance common Nvidia Tegra drivers by support for Tegra210 SoC. 2020-12-26 19:13:10 +01:00
otus Add an initial driver for the AR9170 series draft-11n hardware from 2015-09-26 07:08:35 +00:00
qat Add firmware modules for qat(4), take two 2020-11-06 16:12:06 +00:00
ral
rsu
rtwn rtwn_pci(4): add support for RTL8188EE chipset. 2019-01-02 06:48:53 +00:00
run
uath Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
wpi