diff options
Diffstat (limited to 'sys/powerpc/include')
| -rw-r--r-- | sys/powerpc/include/_limits.h | 3 | ||||
| -rw-r--r-- | sys/powerpc/include/_stdint.h | 33 | ||||
| -rw-r--r-- | sys/powerpc/include/atomic.h | 33 | ||||
| -rw-r--r-- | sys/powerpc/include/kexec.h | 38 | ||||
| -rw-r--r-- | sys/powerpc/include/openpicvar.h | 9 |
5 files changed, 109 insertions, 7 deletions
diff --git a/sys/powerpc/include/_limits.h b/sys/powerpc/include/_limits.h index 542248e51498..cae389ef0f36 100644 --- a/sys/powerpc/include/_limits.h +++ b/sys/powerpc/include/_limits.h @@ -42,6 +42,9 @@ */ #define __CHAR_BIT 8 /* number of bits in a char */ +#define __SHRT_BIT 16 /* number of bits in an short */ +#define __INT_BIT 32 /* number of bits in an int */ +#define __LLONG_BIT 64 /* number of bits in a long long */ #define __SCHAR_MAX 0x7f /* max value for a signed char */ #define __SCHAR_MIN (-0x7f - 1) /* min value for a signed char */ diff --git a/sys/powerpc/include/_stdint.h b/sys/powerpc/include/_stdint.h index 67719432259d..983db38ccf25 100644 --- a/sys/powerpc/include/_stdint.h +++ b/sys/powerpc/include/_stdint.h @@ -195,6 +195,39 @@ #define WINT_MIN INT32_MIN #define WINT_MAX INT32_MAX +#if __ISO_C_VISIBLE >= 2023 +/* + * ISO/IEC 9899:2023 + * 7.22.2 Widths of specified-width integer types + */ +#define INT_FAST8_WIDTH INT32_WIDTH +#define INT_FAST16_WIDTH INT32_WIDTH +#define INT_FAST32_WIDTH INT32_WIDTH +#define INT_FAST64_WIDTH INT64_WIDTH +#ifdef __LP64__ +#define INTPTR_WIDTH INT64_WIDTH +#else +#define INTPTR_WIDTH INT32_WIDTH +#endif +#define INTMAX_WIDTH INT64_WIDTH + +/* + * ISO/IEC 9899:2023 + * 7.22.3 Width of other integer types + */ +#ifdef __LP64__ +#define PTRDIFF_WIDTH INT64_WIDTH +#define SIG_ATOMIC_WIDTH INT64_WIDTH +#define SIZE_WIDTH INT64_WIDTH +#else +#define PTRDIFF_WIDTH INT32_WIDTH +#define SIG_ATOMIC_WIDTH INT32_WIDTH +#define SIZE_WIDTH INT32_WIDTH +#endif +#define WCHAR_WIDTH INT32_WIDTH +#define WINT_WIDTH INT32_WIDTH +#endif /* __ISO_C_VISIBLE >= 2023 */ + #endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ #endif /* !_MACHINE__STDINT_H_ */ diff --git a/sys/powerpc/include/atomic.h b/sys/powerpc/include/atomic.h index 015a283e2de7..b2d7549e5bd0 100644 --- a/sys/powerpc/include/atomic.h +++ b/sys/powerpc/include/atomic.h @@ -1137,7 +1137,38 @@ atomic_thread_fence_seq_cst(void) #define atomic_cmpset_short atomic_cmpset_16 #define atomic_fcmpset_char atomic_fcmpset_8 #define atomic_fcmpset_short atomic_fcmpset_16 -#endif +#define atomic_set_short atomic_set_16 +#define atomic_clear_short atomic_clear_16 +#else + +static __inline void +atomic_set_short(volatile u_short *p, u_short bit) +{ + u_short v; + + v = atomic_load_short(p); + for (;;) { + if (atomic_fcmpset_16(p, &v, v | bit)) + break; + } +} + +static __inline void +atomic_clear_short(volatile u_short *p, u_short bit) +{ + u_short v; + + v = atomic_load_short(p); + for (;;) { + if (atomic_fcmpset_16(p, &v, v & ~bit)) + break; + } +} + +#define atomic_set_16 atomic_set_short +#define atomic_clear_16 atomic_clear_short + +#endif /* ISA_206_ATOMICS */ /* These need sys/_atomic_subword.h on non-ISA-2.06-atomic platforms. */ ATOMIC_CMPSET_ACQ_REL(char); diff --git a/sys/powerpc/include/kexec.h b/sys/powerpc/include/kexec.h new file mode 100644 index 000000000000..a57c50926696 --- /dev/null +++ b/sys/powerpc/include/kexec.h @@ -0,0 +1,38 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2025 Juniper Networks, 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 _POWERPC_KEXEC_H_ +#define _POWERPC_KEXEC_H_ + +int +kexec_load_md(struct kexec_image *image) +{ + return (ENOSYS); +} + +#define kexec_reboot_md(x) do {} while (0) +#endif /* _POWERPC_KEXEC_H_ */ diff --git a/sys/powerpc/include/openpicvar.h b/sys/powerpc/include/openpicvar.h index 3a170a8a35fe..12f01cb80406 100644 --- a/sys/powerpc/include/openpicvar.h +++ b/sys/powerpc/include/openpicvar.h @@ -28,6 +28,8 @@ #ifndef _POWERPC_OPENPICVAR_H_ #define _POWERPC_OPENPICVAR_H_ +#include <sys/kobj.h> + #define OPENPIC_DEVSTR "OpenPIC Interrupt Controller" #define OPENPIC_IRQMAX 256 /* h/w allows more */ @@ -75,16 +77,11 @@ int openpic_common_attach(device_t, uint32_t); /* * PIC interface. */ -void openpic_bind(device_t dev, u_int irq, cpuset_t cpumask, void **); void openpic_config(device_t, u_int, enum intr_trigger, enum intr_polarity); -void openpic_dispatch(device_t, struct trapframe *); void openpic_enable(device_t, u_int, u_int, void **); void openpic_eoi(device_t, u_int, void *); -void openpic_ipi(device_t, u_int); -void openpic_mask(device_t, u_int, void *); void openpic_unmask(device_t, u_int, void *); -int openpic_suspend(device_t dev); -int openpic_resume(device_t dev); +DECLARE_CLASS(openpic_class); #endif /* _POWERPC_OPENPICVAR_H_ */ |
