162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef _ASM_POWERPC_COMPAT_H
362306a36Sopenharmony_ci#define _ASM_POWERPC_COMPAT_H
462306a36Sopenharmony_ci#ifdef __KERNEL__
562306a36Sopenharmony_ci/*
662306a36Sopenharmony_ci * Architecture specific compatibility types
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci#include <linux/types.h>
962306a36Sopenharmony_ci#include <linux/sched.h>
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#define compat_ipc_pid_t compat_ipc_pid_t
1262306a36Sopenharmony_citypedef u16		compat_ipc_pid_t;
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#define compat_ipc64_perm compat_ipc64_perm
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#include <asm-generic/compat.h>
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci#ifdef __BIG_ENDIAN__
1962306a36Sopenharmony_ci#define COMPAT_UTS_MACHINE	"ppc\0\0"
2062306a36Sopenharmony_ci#else
2162306a36Sopenharmony_ci#define COMPAT_UTS_MACHINE	"ppcle\0\0"
2262306a36Sopenharmony_ci#endif
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_citypedef s16		compat_nlink_t;
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_cistruct compat_stat {
2762306a36Sopenharmony_ci	compat_dev_t	st_dev;
2862306a36Sopenharmony_ci	compat_ino_t	st_ino;
2962306a36Sopenharmony_ci	compat_mode_t	st_mode;
3062306a36Sopenharmony_ci	compat_nlink_t	st_nlink;
3162306a36Sopenharmony_ci	__compat_uid32_t	st_uid;
3262306a36Sopenharmony_ci	__compat_gid32_t	st_gid;
3362306a36Sopenharmony_ci	compat_dev_t	st_rdev;
3462306a36Sopenharmony_ci	compat_off_t	st_size;
3562306a36Sopenharmony_ci	compat_off_t	st_blksize;
3662306a36Sopenharmony_ci	compat_off_t	st_blocks;
3762306a36Sopenharmony_ci	old_time32_t	st_atime;
3862306a36Sopenharmony_ci	u32		st_atime_nsec;
3962306a36Sopenharmony_ci	old_time32_t	st_mtime;
4062306a36Sopenharmony_ci	u32		st_mtime_nsec;
4162306a36Sopenharmony_ci	old_time32_t	st_ctime;
4262306a36Sopenharmony_ci	u32		st_ctime_nsec;
4362306a36Sopenharmony_ci	u32		__unused4[2];
4462306a36Sopenharmony_ci};
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci/*
4762306a36Sopenharmony_ci * ipc64_perm is actually 32/64bit clean but since the compat layer refers to
4862306a36Sopenharmony_ci * it we may as well define it.
4962306a36Sopenharmony_ci */
5062306a36Sopenharmony_cistruct compat_ipc64_perm {
5162306a36Sopenharmony_ci	compat_key_t key;
5262306a36Sopenharmony_ci	__compat_uid_t uid;
5362306a36Sopenharmony_ci	__compat_gid_t gid;
5462306a36Sopenharmony_ci	__compat_uid_t cuid;
5562306a36Sopenharmony_ci	__compat_gid_t cgid;
5662306a36Sopenharmony_ci	compat_mode_t mode;
5762306a36Sopenharmony_ci	unsigned int seq;
5862306a36Sopenharmony_ci	unsigned int __pad2;
5962306a36Sopenharmony_ci	unsigned long __unused1;	/* yes they really are 64bit pads */
6062306a36Sopenharmony_ci	unsigned long __unused2;
6162306a36Sopenharmony_ci};
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_cistruct compat_semid64_ds {
6462306a36Sopenharmony_ci	struct compat_ipc64_perm sem_perm;
6562306a36Sopenharmony_ci	unsigned int sem_otime_high;
6662306a36Sopenharmony_ci	unsigned int sem_otime;
6762306a36Sopenharmony_ci	unsigned int sem_ctime_high;
6862306a36Sopenharmony_ci	unsigned int sem_ctime;
6962306a36Sopenharmony_ci	compat_ulong_t sem_nsems;
7062306a36Sopenharmony_ci	compat_ulong_t __unused3;
7162306a36Sopenharmony_ci	compat_ulong_t __unused4;
7262306a36Sopenharmony_ci};
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_cistruct compat_msqid64_ds {
7562306a36Sopenharmony_ci	struct compat_ipc64_perm msg_perm;
7662306a36Sopenharmony_ci	unsigned int msg_stime_high;
7762306a36Sopenharmony_ci	unsigned int msg_stime;
7862306a36Sopenharmony_ci	unsigned int msg_rtime_high;
7962306a36Sopenharmony_ci	unsigned int msg_rtime;
8062306a36Sopenharmony_ci	unsigned int msg_ctime_high;
8162306a36Sopenharmony_ci	unsigned int msg_ctime;
8262306a36Sopenharmony_ci	compat_ulong_t msg_cbytes;
8362306a36Sopenharmony_ci	compat_ulong_t msg_qnum;
8462306a36Sopenharmony_ci	compat_ulong_t msg_qbytes;
8562306a36Sopenharmony_ci	compat_pid_t msg_lspid;
8662306a36Sopenharmony_ci	compat_pid_t msg_lrpid;
8762306a36Sopenharmony_ci	compat_ulong_t __unused4;
8862306a36Sopenharmony_ci	compat_ulong_t __unused5;
8962306a36Sopenharmony_ci};
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_cistruct compat_shmid64_ds {
9262306a36Sopenharmony_ci	struct compat_ipc64_perm shm_perm;
9362306a36Sopenharmony_ci	unsigned int shm_atime_high;
9462306a36Sopenharmony_ci	unsigned int shm_atime;
9562306a36Sopenharmony_ci	unsigned int shm_dtime_high;
9662306a36Sopenharmony_ci	unsigned int shm_dtime;
9762306a36Sopenharmony_ci	unsigned int shm_ctime_high;
9862306a36Sopenharmony_ci	unsigned int shm_ctime;
9962306a36Sopenharmony_ci	unsigned int __unused4;
10062306a36Sopenharmony_ci	compat_size_t shm_segsz;
10162306a36Sopenharmony_ci	compat_pid_t shm_cpid;
10262306a36Sopenharmony_ci	compat_pid_t shm_lpid;
10362306a36Sopenharmony_ci	compat_ulong_t shm_nattch;
10462306a36Sopenharmony_ci	compat_ulong_t __unused5;
10562306a36Sopenharmony_ci	compat_ulong_t __unused6;
10662306a36Sopenharmony_ci};
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_cistatic inline int is_compat_task(void)
10962306a36Sopenharmony_ci{
11062306a36Sopenharmony_ci	return is_32bit_task();
11162306a36Sopenharmony_ci}
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci#endif /* __KERNEL__ */
11462306a36Sopenharmony_ci#endif /* _ASM_POWERPC_COMPAT_H */
115