On 7 Jul 2026, at 20:18, John Baldwin <[email protected]> wrote: > > The branch main has been updated by jhb: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=9313f6b01485ad9a0b7cc59b459f5714533587c3 > > commit 9313f6b01485ad9a0b7cc59b459f5714533587c3 > Author: John Baldwin <[email protected]> > AuthorDate: 2026-07-07 18:13:51 +0000 > Commit: John Baldwin <[email protected]> > CommitDate: 2026-07-07 18:13:51 +0000 > > acpi: Add a pseudo-bus for APEI devices to manage resources > > Different APEI tables can reuse the same registers (and sometimes > different views of the same register, e.g. 32- vs 64-bit mappings of > the same register). To enable this sharing, apei0 now acts as a bus > device managing a pool of allocated resources and handing out mappings > to child devices which handle individual tables. > > Most of the previous apei(4) driver has been moved into a new > hest0 device that is a child of apei0. > > Reviewed by: gallatin > Sponsored by: Netflix > Differential Revision: https://reviews.freebsd.org/D58024 > --- > ... > @@ -128,26 +125,6 @@ struct apei_pcie_error { > uint8_t AERInfo[96]; > }; > > -#ifdef __i386__ > -static __inline uint64_t > -apei_bus_read_8(struct resource *res, bus_size_t offset) > -{ > - return (bus_read_4(res, offset) | > - ((uint64_t)bus_read_4(res, offset + 4)) << 32); > -} > -static __inline void > -apei_bus_write_8(struct resource *res, bus_size_t offset, uint64_t val) > -{ > - bus_write_4(res, offset, val); > - bus_write_4(res, offset + 4, val >> 32); > -} > -#define READ8(r, o) apei_bus_read_8((r), (o)) > -#define WRITE8(r, o, v) apei_bus_write_8((r), (o), (v)) > -#else > -#define READ8(r, o) bus_read_8((r), (o)) > -#define WRITE8(r, o, v) bus_write_8((r), (o), (v)) > -#endif > - > #define GED_SIZE(ged) ((ged)->Revision >= 0x300 ? \ > sizeof(ACPI_HEST_GENERIC_DATA_V300) : sizeof(ACPI_HEST_GENERIC_DATA)) > #define GED_DATA(ged) ((uint8_t *)(ged) + GED_SIZE(ged)) > @@ -431,10 +408,10 @@ apei_ge_handler(struct apei_ge *ge, bool copy) > ... > diff --git a/sys/dev/acpica/apeivar.h b/sys/dev/acpica/apeivar.h > new file mode 100644 > index 000000000000..7820641aef1f > --- /dev/null > +++ b/sys/dev/acpica/apeivar.h > @@ -0,0 +1,54 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause > + * > + * Copyright (c) 2020 Alexander Motin <[email protected]> > + * Copyright (c) 2025 Netflix, Inc. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + */ > + > +#ifndef __APEIVAR_H__ > +#define __APEIVAR_H__ > + > +#include "apei_if.h" > + > +struct resource_map *apei_map_register(device_t dev, ACPI_GENERIC_ADDRESS > *gas); > +struct resource_map *apei_map_memory(device_t dev, rman_res_t start, > + rman_res_t len); > +int apei_unmap_register(device_t dev, struct resource_map *map); > + > +#ifdef __i386__ > +static __inline uint64_t > +bus_read_8(struct resource_map *res, bus_size_t offset) > +{ > + return (bus_read_4(res, offset) | > + ((uint64_t)bus_read_4(res, offset + 4)) << 32); > +} > +static __inline void > +bus_write_8(struct resource_map *res, bus_size_t offset, uint64_t val) > +{ > + bus_write_4(res, offset, val); > + bus_write_4(res, offset + 4, val >> 32); > +} > +#endif > + > +#endif /* !__APEIVAR_H__ */
Dropping the indirection / namespacing for these breaks i386; bus_read/write_8 are macros in sys/sys/bus.h: > In file included from > /local/scratch/jrtc4/cheribuild-root/freebsd/sys/dev/acpica/acpi_apei_bus.c:39: > /local/scratch/jrtc4/cheribuild-root/freebsd/sys/dev/acpica/apeivar.h:41:12: > error: type specifier missing, defaults to 'int'; ISO C99 and later do not > support implicit int [-Werror,-Wimplicit-int] > 41 | bus_read_8(struct resource_map *res, bus_size_t offset) > | ^ > /local/scratch/jrtc4/cheribuild-root/freebsd/sys/sys/bus.h:1137:20: note: > expanded from macro 'bus_read_8' > 1137 | bus_space_read_8((r)->r_bustag, (r)->r_bushandle, (o)) > | ^ Jessica
