aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/uapi
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2012-10-31 08:36:18 -0400
committerAlexander Graf <agraf@suse.de>2012-10-31 08:36:18 -0400
commit0588000eac9ba4178cebade437da3b28e8fad48f (patch)
tree697e514a0a0193f17a54f372dd18c5cd3927e154 /arch/powerpc/include/uapi
parent8b5869ad85f703ffeb25e656eab826f6b85b984c (diff)
parent81c52c56e2b43589091ee29038bcf793d3f184ab (diff)
Merge commit 'origin/queue' into for-queue
Conflicts: arch/powerpc/include/asm/Kbuild arch/powerpc/include/uapi/asm/Kbuild
Diffstat (limited to 'arch/powerpc/include/uapi')
-rw-r--r--arch/powerpc/include/uapi/asm/Kbuild41
-rw-r--r--arch/powerpc/include/uapi/asm/auxvec.h21
-rw-r--r--arch/powerpc/include/uapi/asm/bitsperlong.h12
-rw-r--r--arch/powerpc/include/uapi/asm/bootx.h132
-rw-r--r--arch/powerpc/include/uapi/asm/byteorder.h12
-rw-r--r--arch/powerpc/include/uapi/asm/cputable.h36
-rw-r--r--arch/powerpc/include/uapi/asm/elf.h307
-rw-r--r--arch/powerpc/include/uapi/asm/epapr_hcalls.h478
-rw-r--r--arch/powerpc/include/uapi/asm/errno.h11
-rw-r--r--arch/powerpc/include/uapi/asm/fcntl.h11
-rw-r--r--arch/powerpc/include/uapi/asm/ioctl.h13
-rw-r--r--arch/powerpc/include/uapi/asm/ioctls.h116
-rw-r--r--arch/powerpc/include/uapi/asm/ipcbuf.h34
-rw-r--r--arch/powerpc/include/uapi/asm/kvm.h389
-rw-r--r--arch/powerpc/include/uapi/asm/kvm_para.h91
-rw-r--r--arch/powerpc/include/uapi/asm/linkage.h6
-rw-r--r--arch/powerpc/include/uapi/asm/mman.h31
-rw-r--r--arch/powerpc/include/uapi/asm/msgbuf.h33
-rw-r--r--arch/powerpc/include/uapi/asm/nvram.h62
-rw-r--r--arch/powerpc/include/uapi/asm/param.h1
-rw-r--r--arch/powerpc/include/uapi/asm/poll.h1
-rw-r--r--arch/powerpc/include/uapi/asm/posix_types.h25
-rw-r--r--arch/powerpc/include/uapi/asm/ps3fb.h45
-rw-r--r--arch/powerpc/include/uapi/asm/ptrace.h259
-rw-r--r--arch/powerpc/include/uapi/asm/resource.h1
-rw-r--r--arch/powerpc/include/uapi/asm/seccomp.h16
-rw-r--r--arch/powerpc/include/uapi/asm/sembuf.h36
-rw-r--r--arch/powerpc/include/uapi/asm/setup.h32
-rw-r--r--arch/powerpc/include/uapi/asm/shmbuf.h59
-rw-r--r--arch/powerpc/include/uapi/asm/sigcontext.h87
-rw-r--r--arch/powerpc/include/uapi/asm/siginfo.h20
-rw-r--r--arch/powerpc/include/uapi/asm/signal.h145
-rw-r--r--arch/powerpc/include/uapi/asm/socket.h79
-rw-r--r--arch/powerpc/include/uapi/asm/sockios.h20
-rw-r--r--arch/powerpc/include/uapi/asm/spu_info.h53
-rw-r--r--arch/powerpc/include/uapi/asm/stat.h81
-rw-r--r--arch/powerpc/include/uapi/asm/statfs.h6
-rw-r--r--arch/powerpc/include/uapi/asm/swab.h23
-rw-r--r--arch/powerpc/include/uapi/asm/termbits.h210
-rw-r--r--arch/powerpc/include/uapi/asm/termios.h76
-rw-r--r--arch/powerpc/include/uapi/asm/types.h40
-rw-r--r--arch/powerpc/include/uapi/asm/ucontext.h40
-rw-r--r--arch/powerpc/include/uapi/asm/unistd.h380
43 files changed, 3512 insertions, 59 deletions
diff --git a/arch/powerpc/include/uapi/asm/Kbuild b/arch/powerpc/include/uapi/asm/Kbuild
index e6b5be86e4f..f7bca637074 100644
--- a/arch/powerpc/include/uapi/asm/Kbuild
+++ b/arch/powerpc/include/uapi/asm/Kbuild
@@ -1,4 +1,45 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4header-y += auxvec.h
5header-y += bitsperlong.h
6header-y += bootx.h
7header-y += byteorder.h
8header-y += cputable.h
9header-y += elf.h
4header-y += epapr_hcalls.h 10header-y += epapr_hcalls.h
11header-y += errno.h
12header-y += fcntl.h
13header-y += ioctl.h
14header-y += ioctls.h
15header-y += ipcbuf.h
16header-y += kvm.h
17header-y += kvm_para.h
18header-y += linkage.h
19header-y += mman.h
20header-y += msgbuf.h
21header-y += nvram.h
22header-y += param.h
23header-y += poll.h
24header-y += posix_types.h
25header-y += ps3fb.h
26header-y += ptrace.h
27header-y += resource.h
28header-y += seccomp.h
29header-y += sembuf.h
30header-y += setup.h
31header-y += shmbuf.h
32header-y += sigcontext.h
33header-y += siginfo.h
34header-y += signal.h
35header-y += socket.h
36header-y += sockios.h
37header-y += spu_info.h
38header-y += stat.h
39header-y += statfs.h
40header-y += swab.h
41header-y += termbits.h
42header-y += termios.h
43header-y += types.h
44header-y += ucontext.h
45header-y += unistd.h
diff --git a/arch/powerpc/include/uapi/asm/auxvec.h b/arch/powerpc/include/uapi/asm/auxvec.h
new file mode 100644
index 00000000000..ce17d2c9eb4
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/auxvec.h
@@ -0,0 +1,21 @@
1#ifndef _ASM_POWERPC_AUXVEC_H
2#define _ASM_POWERPC_AUXVEC_H
3
4/*
5 * We need to put in some extra aux table entries to tell glibc what
6 * the cache block size is, so it can use the dcbz instruction safely.
7 */
8#define AT_DCACHEBSIZE 19
9#define AT_ICACHEBSIZE 20
10#define AT_UCACHEBSIZE 21
11/* A special ignored type value for PPC, for glibc compatibility. */
12#define AT_IGNOREPPC 22
13
14/* The vDSO location. We have to use the same value as x86 for glibc's
15 * sake :-)
16 */
17#define AT_SYSINFO_EHDR 33
18
19#define AT_VECTOR_SIZE_ARCH 6 /* entries in ARCH_DLINFO */
20
21#endif
diff --git a/arch/powerpc/include/uapi/asm/bitsperlong.h b/arch/powerpc/include/uapi/asm/bitsperlong.h
new file mode 100644
index 00000000000..5f1659032c4
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/bitsperlong.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_POWERPC_BITSPERLONG_H
2#define __ASM_POWERPC_BITSPERLONG_H
3
4#if defined(__powerpc64__)
5# define __BITS_PER_LONG 64
6#else
7# define __BITS_PER_LONG 32
8#endif
9
10#include <asm-generic/bitsperlong.h>
11
12#endif /* __ASM_POWERPC_BITSPERLONG_H */
diff --git a/arch/powerpc/include/uapi/asm/bootx.h b/arch/powerpc/include/uapi/asm/bootx.h
new file mode 100644
index 00000000000..6e51cf0708a
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/bootx.h
@@ -0,0 +1,132 @@
1/*
2 * This file describes the structure passed from the BootX application
3 * (for MacOS) when it is used to boot Linux.
4 *
5 * Written by Benjamin Herrenschmidt.
6 */
7
8
9#ifndef _UAPI__ASM_BOOTX_H__
10#define _UAPI__ASM_BOOTX_H__
11
12#include <linux/types.h>
13
14#ifdef macintosh
15#include <Types.h>
16#include "linux_type_defs.h"
17#endif
18
19#ifdef macintosh
20/* All this requires PowerPC alignment */
21#pragma options align=power
22#endif
23
24/* On kernel entry:
25 *
26 * r3 = 0x426f6f58 ('BooX')
27 * r4 = pointer to boot_infos
28 * r5 = NULL
29 *
30 * Data and instruction translation disabled, interrupts
31 * disabled, kernel loaded at physical 0x00000000 on PCI
32 * machines (will be different on NuBus).
33 */
34
35#define BOOT_INFO_VERSION 5
36#define BOOT_INFO_COMPATIBLE_VERSION 1
37
38/* Bit in the architecture flag mask. More to be defined in
39 future versions. Note that either BOOT_ARCH_PCI or
40 BOOT_ARCH_NUBUS is set. The other BOOT_ARCH_NUBUS_xxx are
41 set additionally when BOOT_ARCH_NUBUS is set.
42 */
43#define BOOT_ARCH_PCI 0x00000001UL
44#define BOOT_ARCH_NUBUS 0x00000002UL
45#define BOOT_ARCH_NUBUS_PDM 0x00000010UL
46#define BOOT_ARCH_NUBUS_PERFORMA 0x00000020UL
47#define BOOT_ARCH_NUBUS_POWERBOOK 0x00000040UL
48
49/* Maximum number of ranges in phys memory map */
50#define MAX_MEM_MAP_SIZE 26
51
52/* This is the format of an element in the physical memory map. Note that
53 the map is optional and current BootX will only build it for pre-PCI
54 machines */
55typedef struct boot_info_map_entry
56{
57 __u32 physAddr; /* Physical starting address */
58 __u32 size; /* Size in bytes */
59} boot_info_map_entry_t;
60
61
62/* Here are the boot informations that are passed to the bootstrap
63 * Note that the kernel arguments and the device tree are appended
64 * at the end of this structure. */
65typedef struct boot_infos
66{
67 /* Version of this structure */
68 __u32 version;
69 /* backward compatible down to version: */
70 __u32 compatible_version;
71
72 /* NEW (vers. 2) this holds the current _logical_ base addr of
73 the frame buffer (for use by early boot message) */
74 __u8* logicalDisplayBase;
75
76 /* NEW (vers. 4) Apple's machine identification */
77 __u32 machineID;
78
79 /* NEW (vers. 4) Detected hw architecture */
80 __u32 architecture;
81
82 /* The device tree (internal addresses relative to the beginning of the tree,
83 * device tree offset relative to the beginning of this structure).
84 * On pre-PCI macintosh (BOOT_ARCH_PCI bit set to 0 in architecture), this
85 * field is 0.
86 */
87 __u32 deviceTreeOffset; /* Device tree offset */
88 __u32 deviceTreeSize; /* Size of the device tree */
89
90 /* Some infos about the current MacOS display */
91 __u32 dispDeviceRect[4]; /* left,top,right,bottom */
92 __u32 dispDeviceDepth; /* (8, 16 or 32) */
93 __u8* dispDeviceBase; /* base address (physical) */
94 __u32 dispDeviceRowBytes; /* rowbytes (in bytes) */
95 __u32 dispDeviceColorsOffset; /* Colormap (8 bits only) or 0 (*) */
96 /* Optional offset in the registry to the current
97 * MacOS display. (Can be 0 when not detected) */
98 __u32 dispDeviceRegEntryOffset;
99
100 /* Optional pointer to boot ramdisk (offset from this structure) */
101 __u32 ramDisk;
102 __u32 ramDiskSize; /* size of ramdisk image */
103
104 /* Kernel command line arguments (offset from this structure) */
105 __u32 kernelParamsOffset;
106
107 /* ALL BELOW NEW (vers. 4) */
108
109 /* This defines the physical memory. Valid with BOOT_ARCH_NUBUS flag
110 (non-PCI) only. On PCI, memory is contiguous and it's size is in the
111 device-tree. */
112 boot_info_map_entry_t
113 physMemoryMap[MAX_MEM_MAP_SIZE]; /* Where the phys memory is */
114 __u32 physMemoryMapSize; /* How many entries in map */
115
116
117 /* The framebuffer size (optional, currently 0) */
118 __u32 frameBufferSize; /* Represents a max size, can be 0. */
119
120 /* NEW (vers. 5) */
121
122 /* Total params size (args + colormap + device tree + ramdisk) */
123 __u32 totalParamsSize;
124
125} boot_infos_t;
126
127
128#ifdef macintosh
129#pragma options align=reset
130#endif
131
132#endif /* _UAPI__ASM_BOOTX_H__ */
diff --git a/arch/powerpc/include/uapi/asm/byteorder.h b/arch/powerpc/include/uapi/asm/byteorder.h
new file mode 100644
index 00000000000..aa6cc4fac96
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/byteorder.h
@@ -0,0 +1,12 @@
1#ifndef _ASM_POWERPC_BYTEORDER_H
2#define _ASM_POWERPC_BYTEORDER_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10#include <linux/byteorder/big_endian.h>
11
12#endif /* _ASM_POWERPC_BYTEORDER_H */
diff --git a/arch/powerpc/include/uapi/asm/cputable.h b/arch/powerpc/include/uapi/asm/cputable.h
new file mode 100644
index 00000000000..ed9dd815696
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/cputable.h
@@ -0,0 +1,36 @@
1#ifndef _UAPI__ASM_POWERPC_CPUTABLE_H
2#define _UAPI__ASM_POWERPC_CPUTABLE_H
3
4#define PPC_FEATURE_32 0x80000000
5#define PPC_FEATURE_64 0x40000000
6#define PPC_FEATURE_601_INSTR 0x20000000
7#define PPC_FEATURE_HAS_ALTIVEC 0x10000000
8#define PPC_FEATURE_HAS_FPU 0x08000000
9#define PPC_FEATURE_HAS_MMU 0x04000000
10#define PPC_FEATURE_HAS_4xxMAC 0x02000000
11#define PPC_FEATURE_UNIFIED_CACHE 0x01000000
12#define PPC_FEATURE_HAS_SPE 0x00800000
13#define PPC_FEATURE_HAS_EFP_SINGLE 0x00400000
14#define PPC_FEATURE_HAS_EFP_DOUBLE 0x00200000
15#define PPC_FEATURE_NO_TB 0x00100000
16#define PPC_FEATURE_POWER4 0x00080000
17#define PPC_FEATURE_POWER5 0x00040000
18#define PPC_FEATURE_POWER5_PLUS 0x00020000
19#define PPC_FEATURE_CELL 0x00010000
20#define PPC_FEATURE_BOOKE 0x00008000
21#define PPC_FEATURE_SMT 0x00004000
22#define PPC_FEATURE_ICACHE_SNOOP 0x00002000
23#define PPC_FEATURE_ARCH_2_05 0x00001000
24#define PPC_FEATURE_PA6T 0x00000800
25#define PPC_FEATURE_HAS_DFP 0x00000400
26#define PPC_FEATURE_POWER6_EXT 0x00000200
27#define PPC_FEATURE_ARCH_2_06 0x00000100
28#define PPC_FEATURE_HAS_VSX 0x00000080
29
30#define PPC_FEATURE_PSERIES_PERFMON_COMPAT \
31 0x00000040
32
33#define PPC_FEATURE_TRUE_LE 0x00000002
34#define PPC_FEATURE_PPC_LE 0x00000001
35
36#endif /* _UAPI__ASM_POWERPC_CPUTABLE_H */
diff --git a/arch/powerpc/include/uapi/asm/elf.h b/arch/powerpc/include/uapi/asm/elf.h
new file mode 100644
index 00000000000..05b8d560cfb
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/elf.h
@@ -0,0 +1,307 @@
1/*
2 * ELF register definitions..
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#ifndef _UAPI_ASM_POWERPC_ELF_H
10#define _UAPI_ASM_POWERPC_ELF_H
11
12
13#include <linux/types.h>
14
15#include <asm/ptrace.h>
16#include <asm/cputable.h>
17#include <asm/auxvec.h>
18
19/* PowerPC relocations defined by the ABIs */
20#define R_PPC_NONE 0
21#define R_PPC_ADDR32 1 /* 32bit absolute address */
22#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */
23#define R_PPC_ADDR16 3 /* 16bit absolute address */
24#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */
25#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */
26#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */
27#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */
28#define R_PPC_ADDR14_BRTAKEN 8
29#define R_PPC_ADDR14_BRNTAKEN 9
30#define R_PPC_REL24 10 /* PC relative 26 bit */
31#define R_PPC_REL14 11 /* PC relative 16 bit */
32#define R_PPC_REL14_BRTAKEN 12
33#define R_PPC_REL14_BRNTAKEN 13
34#define R_PPC_GOT16 14
35#define R_PPC_GOT16_LO 15
36#define R_PPC_GOT16_HI 16
37#define R_PPC_GOT16_HA 17
38#define R_PPC_PLTREL24 18
39#define R_PPC_COPY 19
40#define R_PPC_GLOB_DAT 20
41#define R_PPC_JMP_SLOT 21
42#define R_PPC_RELATIVE 22
43#define R_PPC_LOCAL24PC 23
44#define R_PPC_UADDR32 24
45#define R_PPC_UADDR16 25
46#define R_PPC_REL32 26
47#define R_PPC_PLT32 27
48#define R_PPC_PLTREL32 28
49#define R_PPC_PLT16_LO 29
50#define R_PPC_PLT16_HI 30
51#define R_PPC_PLT16_HA 31
52#define R_PPC_SDAREL16 32
53#define R_PPC_SECTOFF 33
54#define R_PPC_SECTOFF_LO 34
55#define R_PPC_SECTOFF_HI 35
56#define R_PPC_SECTOFF_HA 36
57
58/* PowerPC relocations defined for the TLS access ABI. */
59#define R_PPC_TLS 67 /* none (sym+add)@tls */
60#define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */
61#define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */
62#define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */
63#define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */
64#define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */
65#define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */
66#define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */
67#define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */
68#define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */
69#define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */
70#define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */
71#define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */
72#define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */
73#define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */
74#define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */
75#define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */
76#define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */
77#define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */
78#define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */
79#define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */
80#define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */
81#define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */
82#define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */
83#define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */
84#define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */
85#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */
86#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */
87
88/* keep this the last entry. */
89#define R_PPC_NUM 95
90
91
92#define ELF_NGREG 48 /* includes nip, msr, lr, etc. */
93#define ELF_NFPREG 33 /* includes fpscr */
94
95typedef unsigned long elf_greg_t64;
96typedef elf_greg_t64 elf_gregset_t64[ELF_NGREG];
97
98typedef unsigned int elf_greg_t32;
99typedef elf_greg_t32 elf_gregset_t32[ELF_NGREG];
100typedef elf_gregset_t32 compat_elf_gregset_t;
101
102/*
103 * ELF_ARCH, CLASS, and DATA are used to set parameters in the core dumps.
104 */
105#ifdef __powerpc64__
106# define ELF_NVRREG32 33 /* includes vscr & vrsave stuffed together */
107# define ELF_NVRREG 34 /* includes vscr & vrsave in split vectors */
108# define ELF_NVSRHALFREG 32 /* Half the vsx registers */
109# define ELF_GREG_TYPE elf_greg_t64
110#else
111# define ELF_NEVRREG 34 /* includes acc (as 2) */
112# define ELF_NVRREG 33 /* includes vscr */
113# define ELF_GREG_TYPE elf_greg_t32
114# define ELF_ARCH EM_PPC
115# define ELF_CLASS ELFCLASS32
116# define ELF_DATA ELFDATA2MSB
117#endif /* __powerpc64__ */
118
119#ifndef ELF_ARCH
120# define ELF_ARCH EM_PPC64
121# define ELF_CLASS ELFCLASS64
122# define ELF_DATA ELFDATA2MSB
123 typedef elf_greg_t64 elf_greg_t;
124 typedef elf_gregset_t64 elf_gregset_t;
125#else
126 /* Assumption: ELF_ARCH == EM_PPC and ELF_CLASS == ELFCLASS32 */
127 typedef elf_greg_t32 elf_greg_t;
128 typedef elf_gregset_t32 elf_gregset_t;
129#endif /* ELF_ARCH */
130
131/* Floating point registers */
132typedef double elf_fpreg_t;
133typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
134
135/* Altivec registers */
136/*
137 * The entries with indexes 0-31 contain the corresponding vector registers.
138 * The entry with index 32 contains the vscr as the last word (offset 12)
139 * within the quadword. This allows the vscr to be stored as either a
140 * quadword (since it must be copied via a vector register to/from storage)
141 * or as a word.
142 *
143 * 64-bit kernel notes: The entry at index 33 contains the vrsave as the first
144 * word (offset 0) within the quadword.
145 *
146 * This definition of the VMX state is compatible with the current PPC32
147 * ptrace interface. This allows signal handling and ptrace to use the same
148 * structures. This also simplifies the implementation of a bi-arch
149 * (combined (32- and 64-bit) gdb.
150 *
151 * Note that it's _not_ compatible with 32 bits ucontext which stuffs the
152 * vrsave along with vscr and so only uses 33 vectors for the register set
153 */
154typedef __vector128 elf_vrreg_t;
155typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG];
156#ifdef __powerpc64__
157typedef elf_vrreg_t elf_vrregset_t32[ELF_NVRREG32];
158typedef elf_fpreg_t elf_vsrreghalf_t32[ELF_NVSRHALFREG];
159#endif
160
161
162/*
163 * The requirements here are:
164 * - keep the final alignment of sp (sp & 0xf)
165 * - make sure the 32-bit value at the first 16 byte aligned position of
166 * AUXV is greater than 16 for glibc compatibility.
167 * AT_IGNOREPPC is used for that.
168 * - for compatibility with glibc ARCH_DLINFO must always be defined on PPC,
169 * even if DLINFO_ARCH_ITEMS goes to zero or is undefined.
170 * update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes
171 */
172#define ARCH_DLINFO \
173do { \
174 /* Handle glibc compatibility. */ \
175 NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC); \
176 NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC); \
177 /* Cache size items */ \
178 NEW_AUX_ENT(AT_DCACHEBSIZE, dcache_bsize); \
179 NEW_AUX_ENT(AT_ICACHEBSIZE, icache_bsize); \
180 NEW_AUX_ENT(AT_UCACHEBSIZE, ucache_bsize); \
181 VDSO_AUX_ENT(AT_SYSINFO_EHDR, current->mm->context.vdso_base); \
182} while (0)
183
184/* PowerPC64 relocations defined by the ABIs */
185#define R_PPC64_NONE R_PPC_NONE
186#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address. */
187#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned. */
188#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address. */
189#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of abs. address. */
190#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of abs. address. */
191#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */
192#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned. */
193#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN
194#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN
195#define R_PPC64_REL24 R_PPC_REL24 /* PC relative 26 bit, word aligned. */
196#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit. */
197#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN
198#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN
199#define R_PPC64_GOT16 R_PPC_GOT16
200#define R_PPC64_GOT16_LO R_PPC_GOT16_LO
201#define R_PPC64_GOT16_HI R_PPC_GOT16_HI
202#define R_PPC64_GOT16_HA R_PPC_GOT16_HA
203
204#define R_PPC64_COPY R_PPC_COPY
205#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT
206#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT
207#define R_PPC64_RELATIVE R_PPC_RELATIVE
208
209#define R_PPC64_UADDR32 R_PPC_UADDR32
210#define R_PPC64_UADDR16 R_PPC_UADDR16
211#define R_PPC64_REL32 R_PPC_REL32
212#define R_PPC64_PLT32 R_PPC_PLT32
213#define R_PPC64_PLTREL32 R_PPC_PLTREL32
214#define R_PPC64_PLT16_LO R_PPC_PLT16_LO
215#define R_PPC64_PLT16_HI R_PPC_PLT16_HI
216#define R_PPC64_PLT16_HA R_PPC_PLT16_HA
217
218#define R_PPC64_SECTOFF R_PPC_SECTOFF
219#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO
220#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI
221#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA
222#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2. */
223#define R_PPC64_ADDR64 38 /* doubleword64 S + A. */
224#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A). */
225#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A). */
226#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A). */
227#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A). */
228#define R_PPC64_UADDR64 43 /* doubleword64 S + A. */
229#define R_PPC64_REL64 44 /* doubleword64 S + A - P. */
230#define R_PPC64_PLT64 45 /* doubleword64 L + A. */
231#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P. */
232#define R_PPC64_TOC16 47 /* half16* S + A - .TOC. */
233#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.). */
234#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.). */
235#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.). */
236#define R_PPC64_TOC 51 /* doubleword64 .TOC. */
237#define R_PPC64_PLTGOT16 52 /* half16* M + A. */
238#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A). */
239#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A). */
240#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A). */
241
242#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2. */
243#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2. */
244#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2. */
245#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2. */
246#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2. */
247#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2. */
248#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2. */
249#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2. */
250#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2. */
251#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2. */
252#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2. */
253
254/* PowerPC64 relocations defined for the TLS access ABI. */
255#define R_PPC64_TLS 67 /* none (sym+add)@tls */
256#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */
257#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */
258#define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */
259#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */
260#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */
261#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */
262#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */
263#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */
264#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */
265#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */
266#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */
267#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */
268#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */
269#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */
270#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */
271#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */
272#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */
273#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */
274#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */
275#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */
276#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */
277#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */
278#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */
279#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */
280#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */
281#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */
282#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */
283#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */
284#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */
285#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */
286#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */
287#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */
288#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */
289#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */
290#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */
291#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */
292#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */
293#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */
294#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */
295
296/* Keep this the last entry. */
297#define R_PPC64_NUM 107
298
299/* There's actually a third entry here, but it's unused */
300struct ppc64_opd_entry
301{
302 unsigned long funcaddr;
303 unsigned long r2;
304};
305
306
307#endif /* _UAPI_ASM_POWERPC_ELF_H */
diff --git a/arch/powerpc/include/uapi/asm/epapr_hcalls.h b/arch/powerpc/include/uapi/asm/epapr_hcalls.h
index 046c79364f8..58997afcd08 100644
--- a/arch/powerpc/include/uapi/asm/epapr_hcalls.h
+++ b/arch/powerpc/include/uapi/asm/epapr_hcalls.h
@@ -37,62 +37,422 @@
37 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 */ 38 */
39 39
40#ifndef _UAPI__EPAPR_HCALLS_H 40/* A "hypercall" is an "sc 1" instruction. This header file file provides C
41#define _UAPI__EPAPR_HCALLS_H 41 * wrapper functions for the ePAPR hypervisor interface. It is inteded
42 42 * for use by Linux device drivers and other operating systems.
43#define EV_BYTE_CHANNEL_SEND 1 43 *
44#define EV_BYTE_CHANNEL_RECEIVE 2 44 * The hypercalls are implemented as inline assembly, rather than assembly
45#define EV_BYTE_CHANNEL_POLL 3 45 * language functions in a .S file, for optimization. It allows
46#define EV_INT_SET_CONFIG 4 46 * the caller to issue the hypercall instruction directly, improving both
47#define EV_INT_GET_CONFIG 5 47 * performance and memory footprint.
48#define EV_INT_SET_MASK 6 48 */
49#define EV_INT_GET_MASK 7 49
50#define EV_INT_IACK 9 50#ifndef _EPAPR_HCALLS_H
51#define EV_INT_EOI 10 51#define _EPAPR_HCALLS_H
52#define EV_INT_SEND_IPI 11 52
53#define EV_INT_SET_TASK_PRIORITY 12 53#include <uapi/asm/epapr_hcalls.h>
54#define EV_INT_GET_TASK_PRIORITY 13 54
55#define EV_DOORBELL_SEND 14 55#ifndef __ASSEMBLY__
56#define EV_MSGSND 15 56#include <linux/types.h>
57#define EV_IDLE 16 57#include <linux/errno.h>
58 58#include <asm/byteorder.h>
59/* vendor ID: epapr */ 59
60#define EV_LOCAL_VENDOR_ID 0 /* for private use */ 60/*
61#define EV_EPAPR_VENDOR_ID 1 61 * Hypercall register clobber list
62#define EV_FSL_VENDOR_ID 2 /* Freescale Semiconductor */ 62 *
63#define EV_IBM_VENDOR_ID 3 /* IBM */ 63 * These macros are used to define the list of clobbered registers during a
64#define EV_GHS_VENDOR_ID 4 /* Green Hills Software */ 64 * hypercall. Technically, registers r0 and r3-r12 are always clobbered,
65#define EV_ENEA_VENDOR_ID 5 /* Enea */ 65 * but the gcc inline assembly syntax does not allow us to specify registers
66#define EV_WR_VENDOR_ID 6 /* Wind River Systems */ 66 * on the clobber list that are also on the input/output list. Therefore,
67#define EV_AMCC_VENDOR_ID 7 /* Applied Micro Circuits */ 67 * the lists of clobbered registers depends on the number of register
68#define EV_KVM_VENDOR_ID 42 /* KVM */ 68 * parmeters ("+r" and "=r") passed to the hypercall.
69 69 *
70/* The max number of bytes that a byte channel can send or receive per call */ 70 * Each assembly block should use one of the HCALL_CLOBBERSx macros. As a
71#define EV_BYTE_CHANNEL_MAX_BYTES 16 71 * general rule, 'x' is the number of parameters passed to the assembly
72 72 * block *except* for r11.
73 73 *
74#define _EV_HCALL_TOKEN(id, num) (((id) << 16) | (num)) 74 * If you're not sure, just use the smallest value of 'x' that does not
75#define EV_HCALL_TOKEN(hcall_num) _EV_HCALL_TOKEN(EV_EPAPR_VENDOR_ID, hcall_num) 75 * generate a compilation error. Because these are static inline functions,
76 76 * the compiler will only check the clobber list for a function if you
77/* epapr return codes */ 77 * compile code that calls that function.
78#define EV_SUCCESS 0 78 *
79#define EV_EPERM 1 /* Operation not permitted */ 79 * r3 and r11 are not included in any clobbers list because they are always
80#define EV_ENOENT 2 /* Entry Not Found */ 80 * listed as output registers.
81#define EV_EIO 3 /* I/O error occured */ 81 *
82#define EV_EAGAIN 4 /* The operation had insufficient 82 * XER, CTR, and LR are currently listed as clobbers because it's uncertain
83 * resources to complete and should be 83 * whether they will be clobbered.
84 * retried 84 *
85 */ 85 * Note that r11 can be used as an output parameter.
86#define EV_ENOMEM 5 /* There was insufficient memory to 86 *
87 * complete the operation */ 87 * The "memory" clobber is only necessary for hcalls where the Hypervisor
88#define EV_EFAULT 6 /* Bad guest address */ 88 * will read or write guest memory. However, we add it to all hcalls because
89#define EV_ENODEV 7 /* No such device */ 89 * the impact is minimal, and we want to ensure that it's present for the
90#define EV_EINVAL 8 /* An argument supplied to the hcall 90 * hcalls that need it.
91 was out of range or invalid */ 91*/
92#define EV_INTERNAL 9 /* An internal error occured */ 92
93#define EV_CONFIG 10 /* A configuration error was detected */ 93/* List of common clobbered registers. Do not use this macro. */
94#define EV_INVALID_STATE 11 /* The object is in an invalid state */ 94#define EV_HCALL_CLOBBERS "r0", "r12", "xer", "ctr", "lr", "cc", "memory"
95#define EV_UNIMPLEMENTED 12 /* Unimplemented hypercall */ 95
96#define EV_BUFFER_OVERFLOW 13 /* Caller-supplied buffer too small */ 96#define EV_HCALL_CLOBBERS8 EV_HCALL_CLOBBERS
97 97#define EV_HCALL_CLOBBERS7 EV_HCALL_CLOBBERS8, "r10"
98#endif /* _UAPI__EPAPR_HCALLS_H */ 98#define EV_HCALL_CLOBBERS6 EV_HCALL_CLOBBERS7, "r9"
99#define EV_HCALL_CLOBBERS5 EV_HCALL_CLOBBERS6, "r8"
100#define EV_HCALL_CLOBBERS4 EV_HCALL_CLOBBERS5, "r7"
101#define EV_HCALL_CLOBBERS3 EV_HCALL_CLOBBERS4, "r6"
102#define EV_HCALL_CLOBBERS2 EV_HCALL_CLOBBERS3, "r5"
103#define EV_HCALL_CLOBBERS1 EV_HCALL_CLOBBERS2, "r4"
104
105extern bool epapr_paravirt_enabled;
106extern u32 epapr_hypercall_start[];
107
108/*
109 * We use "uintptr_t" to define a register because it's guaranteed to be a
110 * 32-bit integer on a 32-bit platform, and a 64-bit integer on a 64-bit
111 * platform.
112 *
113 * All registers are either input/output or output only. Registers that are
114 * initialized before making the hypercall are input/output. All
115 * input/output registers are represented with "+r". Output-only registers
116 * are represented with "=r". Do not specify any unused registers. The
117 * clobber list will tell the compiler that the hypercall modifies those
118 * registers, which is good enough.
119 */
120
121/**
122 * ev_int_set_config - configure the specified interrupt
123 * @interrupt: the interrupt number
124 * @config: configuration for this interrupt
125 * @priority: interrupt priority
126 * @destination: destination CPU number
127 *
128 * Returns 0 for success, or an error code.
129 */
130static inline unsigned int ev_int_set_config(unsigned int interrupt,
131 uint32_t config, unsigned int priority, uint32_t destination)
132{
133 register uintptr_t r11 __asm__("r11");
134 register uintptr_t r3 __asm__("r3");
135 register uintptr_t r4 __asm__("r4");
136 register uintptr_t r5 __asm__("r5");
137 register uintptr_t r6 __asm__("r6");
138
139 r11 = EV_HCALL_TOKEN(EV_INT_SET_CONFIG);
140 r3 = interrupt;
141 r4 = config;
142 r5 = priority;
143 r6 = destination;
144
145 asm volatile("bl epapr_hypercall_start"
146 : "+r" (r11), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6)
147 : : EV_HCALL_CLOBBERS4
148 );
149
150 return r3;
151}
152
153/**
154 * ev_int_get_config - return the config of the specified interrupt
155 * @interrupt: the interrupt number
156 * @config: returned configuration for this interrupt
157 * @priority: returned interrupt priority
158 * @destination: returned destination CPU number
159 *
160 * Returns 0 for success, or an error code.
161 */
162static inline unsigned int ev_int_get_config(unsigned int interrupt,
163 uint32_t *config, unsigned int *priority, uint32_t *destination)
164{
165 register uintptr_t r11 __asm__("r11");
166 register uintptr_t r3 __asm__("r3");
167 register uintptr_t r4 __asm__("r4");
168 register uintptr_t r5 __asm__("r5");
169 register uintptr_t r6 __asm__("r6");
170
171 r11 = EV_HCALL_TOKEN(EV_INT_GET_CONFIG);
172 r3 = interrupt;
173
174 asm volatile("bl epapr_hypercall_start"
175 : "+r" (r11), "+r" (r3), "=r" (r4), "=r" (r5), "=r" (r6)
176 : : EV_HCALL_CLOBBERS4
177 );
178
179 *config = r4;
180 *priority = r5;
181 *destination = r6;
182
183 return r3;
184}
185
186/**
187 * ev_int_set_mask - sets the mask for the specified interrupt source
188 * @interrupt: the interrupt number
189 * @mask: 0=enable interrupts, 1=disable interrupts
190 *
191 * Returns 0 for success, or an error code.
192 */
193static inline unsigned int ev_int_set_mask(unsigned int interrupt,
194 unsigned int mask)
195{
196 register uintptr_t r11 __asm__("r11");
197 register uintptr_t r3 __asm__("r3");
198 register uintptr_t r4 __asm__("r4");
199
200 r11 = EV_HCALL_TOKEN(EV_INT_SET_MASK);
201 r3 = interrupt;
202 r4 = mask;
203
204 asm volatile("bl epapr_hypercall_start"
205 : "+r" (r11), "+r" (r3), "+r" (r4)
206 : : EV_HCALL_CLOBBERS2
207 );
208
209 return r3;
210}
211
212/**
213 * ev_int_get_mask - returns the mask for the specified interrupt source
214 * @interrupt: the interrupt number
215 * @mask: returned mask for this interrupt (0=enabled, 1=disabled)
216 *
217 * Returns 0 for success, or an error code.
218 */
219static inline unsigned int ev_int_get_mask(unsigned int interrupt,
220 unsigned int *mask)
221{
222 register uintptr_t r11 __asm__("r11");
223 register uintptr_t r3 __asm__("r3");
224 register uintptr_t r4 __asm__("r4");
225
226 r11 = EV_HCALL_TOKEN(EV_INT_GET_MASK);
227 r3 = interrupt;
228
229 asm volatile("bl epapr_hypercall_start"
230 : "+r" (r11), "+r" (r3), "=r" (r4)
231 : : EV_HCALL_CLOBBERS2
232 );
233
234 *mask = r4;
235
236 return r3;
237}
238
239/**
240 * ev_int_eoi - signal the end of interrupt processing
241 * @interrupt: the interrupt number
242 *
243 * This function signals the end of processing for the the specified
244 * interrupt, which must be the interrupt currently in service. By
245 * definition, this is also the highest-priority interrupt.
246 *
247 * Returns 0 for success, or an error code.
248 */
249static inline unsigned int ev_int_eoi(unsigned int interrupt)
250{
251 register uintptr_t r11 __asm__("r11");
252 register uintptr_t r3 __asm__("r3");
253
254 r11 = EV_HCALL_TOKEN(EV_INT_EOI);
255 r3 = interrupt;
256
257 asm volatile("bl epapr_hypercall_start"
258 : "+r" (r11), "+r" (r3)
259 : : EV_HCALL_CLOBBERS1
260 );
261
262 return r3;
263}
264
265/**
266 * ev_byte_channel_send - send characters to a byte stream
267 * @handle: byte stream handle
268 * @count: (input) num of chars to send, (output) num chars sent
269 * @buffer: pointer to a 16-byte buffer
270 *
271 * @buffer must be at least 16 bytes long, because all 16 bytes will be
272 * read from memory into registers, even if count < 16.
273 *
274 * Returns 0 for success, or an error code.
275 */
276static inline unsigned int ev_byte_channel_send(unsigned int handle,
277 unsigned int *count, const char buffer[EV_BYTE_CHANNEL_MAX_BYTES])
278{
279 register uintptr_t r11 __asm__("r11");
280 register uintptr_t r3 __asm__("r3");
281 register uintptr_t r4 __asm__("r4");
282 register uintptr_t r5 __asm__("r5");
283 register uintptr_t r6 __asm__("r6");
284 register uintptr_t r7 __asm__("r7");
285 register uintptr_t r8 __asm__("r8");
286 const uint32_t *p = (const uint32_t *) buffer;
287
288 r11 = EV_HCALL_TOKEN(EV_BYTE_CHANNEL_SEND);
289 r3 = handle;
290 r4 = *count;
291 r5 = be32_to_cpu(p[0]);
292 r6 = be32_to_cpu(p[1]);
293 r7 = be32_to_cpu(p[2]);
294 r8 = be32_to_cpu(p[3]);
295
296 asm volatile("bl epapr_hypercall_start"
297 : "+r" (r11), "+r" (r3),
298 "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7), "+r" (r8)
299 : : EV_HCALL_CLOBBERS6
300 );
301
302 *count = r4;
303
304 return r3;
305}
306
307/**
308 * ev_byte_channel_receive - fetch characters from a byte channel
309 * @handle: byte channel handle
310 * @count: (input) max num of chars to receive, (output) num chars received
311 * @buffer: pointer to a 16-byte buffer
312 *
313 * The size of @buffer must be at least 16 bytes, even if you request fewer
314 * than 16 characters, because we always write 16 bytes to @buffer. This is
315 * for performance reasons.
316 *
317 * Returns 0 for success, or an error code.
318 */
319static inline unsigned int ev_byte_channel_receive(unsigned int handle,
320 unsigned int *count, char buffer[EV_BYTE_CHANNEL_MAX_BYTES])
321{
322 register uintptr_t r11 __asm__("r11");
323 register uintptr_t r3 __asm__("r3");
324 register uintptr_t r4 __asm__("r4");
325 register uintptr_t r5 __asm__("r5");
326 register uintptr_t r6 __asm__("r6");
327 register uintptr_t r7 __asm__("r7");
328 register uintptr_t r8 __asm__("r8");
329 uint32_t *p = (uint32_t *) buffer;
330
331 r11 = EV_HCALL_TOKEN(EV_BYTE_CHANNEL_RECEIVE);
332 r3 = handle;
333 r4 = *count;
334
335 asm volatile("bl epapr_hypercall_start"
336 : "+r" (r11), "+r" (r3), "+r" (r4),
337 "=r" (r5), "=r" (r6), "=r" (r7), "=r" (r8)
338 : : EV_HCALL_CLOBBERS6
339 );
340
341 *count = r4;
342 p[0] = cpu_to_be32(r5);
343 p[1] = cpu_to_be32(r6);
344 p[2] = cpu_to_be32(r7);
345 p[3] = cpu_to_be32(r8);
346
347 return r3;
348}
349
350/**
351 * ev_byte_channel_poll - returns the status of the byte channel buffers
352 * @handle: byte channel handle
353 * @rx_count: returned count of bytes in receive queue
354 * @tx_count: returned count of free space in transmit queue
355 *
356 * This function reports the amount of data in the receive queue (i.e. the
357 * number of bytes you can read), and the amount of free space in the transmit
358 * queue (i.e. the number of bytes you can write).
359 *
360 * Returns 0 for success, or an error code.
361 */
362static inline unsigned int ev_byte_channel_poll(unsigned int handle,
363 unsigned int *rx_count, unsigned int *tx_count)
364{
365 register uintptr_t r11 __asm__("r11");
366 register uintptr_t r3 __asm__("r3");
367 register uintptr_t r4 __asm__("r4");
368 register uintptr_t r5 __asm__("r5");
369
370 r11 = EV_HCALL_TOKEN(EV_BYTE_CHANNEL_POLL);
371 r3 = handle;
372
373 asm volatile("bl epapr_hypercall_start"
374 : "+r" (r11), "+r" (r3), "=r" (r4), "=r" (r5)
375 : : EV_HCALL_CLOBBERS3
376 );
377
378 *rx_count = r4;
379 *tx_count = r5;
380
381 return r3;
382}
383
384/**
385 * ev_int_iack - acknowledge an interrupt
386 * @handle: handle to the target interrupt controller
387 * @vector: returned interrupt vector
388 *
389 * If handle is zero, the function returns the next interrupt source
390 * number to be handled irrespective of the hierarchy or cascading
391 * of interrupt controllers. If non-zero, specifies a handle to the
392 * interrupt controller that is the target of the acknowledge.
393 *
394 * Returns 0 for success, or an error code.
395 */
396static inline unsigned int ev_int_iack(unsigned int handle,
397 unsigned int *vector)
398{
399 register uintptr_t r11 __asm__("r11");
400 register uintptr_t r3 __asm__("r3");
401 register uintptr_t r4 __asm__("r4");
402
403 r11 = EV_HCALL_TOKEN(EV_INT_IACK);
404 r3 = handle;
405
406 asm volatile("bl epapr_hypercall_start"
407 : "+r" (r11), "+r" (r3), "=r" (r4)
408 : : EV_HCALL_CLOBBERS2
409 );
410
411 *vector = r4;
412
413 return r3;
414}
415
416/**
417 * ev_doorbell_send - send a doorbell to another partition
418 * @handle: doorbell send handle
419 *
420 * Returns 0 for success, or an error code.
421 */
422static inline unsigned int ev_doorbell_send(unsigned int handle)
423{
424 register uintptr_t r11 __asm__("r11");
425 register uintptr_t r3 __asm__("r3");
426
427 r11 = EV_HCALL_TOKEN(EV_DOORBELL_SEND);
428 r3 = handle;
429
430 asm volatile("bl epapr_hypercall_start"
431 : "+r" (r11), "+r" (r3)
432 : : EV_HCALL_CLOBBERS1
433 );
434
435 return r3;
436}
437
438/**
439 * ev_idle -- wait for next interrupt on this core
440 *
441 * Returns 0 for success, or an error code.
442 */
443static inline unsigned int ev_idle(void)
444{
445 register uintptr_t r11 __asm__("r11");
446 register uintptr_t r3 __asm__("r3");
447
448 r11 = EV_HCALL_TOKEN(EV_IDLE);
449
450 asm volatile("bl epapr_hypercall_start"
451 : "+r" (r11), "=r" (r3)
452 : : EV_HCALL_CLOBBERS1
453 );
454
455 return r3;
456}
457#endif /* !__ASSEMBLY__ */
458#endif
diff --git a/arch/powerpc/include/uapi/asm/errno.h b/arch/powerpc/include/uapi/asm/errno.h
new file mode 100644
index 00000000000..8c145fd17d8
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/errno.h
@@ -0,0 +1,11 @@
1#ifndef _ASM_POWERPC_ERRNO_H
2#define _ASM_POWERPC_ERRNO_H
3
4#include <asm-generic/errno.h>
5
6#undef EDEADLOCK
7#define EDEADLOCK 58 /* File locking deadlock error */
8
9#define _LAST_ERRNO 516
10
11#endif /* _ASM_POWERPC_ERRNO_H */
diff --git a/arch/powerpc/include/uapi/asm/fcntl.h b/arch/powerpc/include/uapi/asm/fcntl.h
new file mode 100644
index 00000000000..ce5c4516d40
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/fcntl.h
@@ -0,0 +1,11 @@
1#ifndef _ASM_FCNTL_H
2#define _ASM_FCNTL_H
3
4#define O_DIRECTORY 040000 /* must be a directory */
5#define O_NOFOLLOW 0100000 /* don't follow links */
6#define O_LARGEFILE 0200000
7#define O_DIRECT 0400000 /* direct disk access hint */
8
9#include <asm-generic/fcntl.h>
10
11#endif /* _ASM_FCNTL_H */
diff --git a/arch/powerpc/include/uapi/asm/ioctl.h b/arch/powerpc/include/uapi/asm/ioctl.h
new file mode 100644
index 00000000000..57d68304218
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/ioctl.h
@@ -0,0 +1,13 @@
1#ifndef _ASM_POWERPC_IOCTL_H
2#define _ASM_POWERPC_IOCTL_H
3
4#define _IOC_SIZEBITS 13
5#define _IOC_DIRBITS 3
6
7#define _IOC_NONE 1U
8#define _IOC_READ 2U
9#define _IOC_WRITE 4U
10
11#include <asm-generic/ioctl.h>
12
13#endif /* _ASM_POWERPC_IOCTL_H */
diff --git a/arch/powerpc/include/uapi/asm/ioctls.h b/arch/powerpc/include/uapi/asm/ioctls.h
new file mode 100644
index 00000000000..e9b78870aaa
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/ioctls.h
@@ -0,0 +1,116 @@
1#ifndef _ASM_POWERPC_IOCTLS_H
2#define _ASM_POWERPC_IOCTLS_H
3
4#include <asm/ioctl.h>
5
6#define FIOCLEX _IO('f', 1)
7#define FIONCLEX _IO('f', 2)
8#define FIOASYNC _IOW('f', 125, int)
9#define FIONBIO _IOW('f', 126, int)
10#define FIONREAD _IOR('f', 127, int)
11#define TIOCINQ FIONREAD
12#define FIOQSIZE _IOR('f', 128, loff_t)
13
14#define TIOCGETP _IOR('t', 8, struct sgttyb)
15#define TIOCSETP _IOW('t', 9, struct sgttyb)
16#define TIOCSETN _IOW('t', 10, struct sgttyb) /* TIOCSETP wo flush */
17
18#define TIOCSETC _IOW('t', 17, struct tchars)
19#define TIOCGETC _IOR('t', 18, struct tchars)
20#define TCGETS _IOR('t', 19, struct termios)
21#define TCSETS _IOW('t', 20, struct termios)
22#define TCSETSW _IOW('t', 21, struct termios)
23#define TCSETSF _IOW('t', 22, struct termios)
24
25#define TCGETA _IOR('t', 23, struct termio)
26#define TCSETA _IOW('t', 24, struct termio)
27#define TCSETAW _IOW('t', 25, struct termio)
28#define TCSETAF _IOW('t', 28, struct termio)
29
30#define TCSBRK _IO('t', 29)
31#define TCXONC _IO('t', 30)
32#define TCFLSH _IO('t', 31)
33
34#define TIOCSWINSZ _IOW('t', 103, struct winsize)
35#define TIOCGWINSZ _IOR('t', 104, struct winsize)
36#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
37#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
38#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
39
40#define TIOCGLTC _IOR('t', 116, struct ltchars)
41#define TIOCSLTC _IOW('t', 117, struct ltchars)
42#define TIOCSPGRP _IOW('t', 118, int)
43#define TIOCGPGRP _IOR('t', 119, int)
44
45#define TIOCEXCL 0x540C
46#define TIOCNXCL 0x540D
47#define TIOCSCTTY 0x540E
48
49#define TIOCSTI 0x5412
50#define TIOCMGET 0x5415
51#define TIOCMBIS 0x5416
52#define TIOCMBIC 0x5417
53#define TIOCMSET 0x5418
54# define TIOCM_LE 0x001
55# define TIOCM_DTR 0x002
56# define TIOCM_RTS 0x004
57# define TIOCM_ST 0x008
58# define TIOCM_SR 0x010
59# define TIOCM_CTS 0x020
60# define TIOCM_CAR 0x040
61# define TIOCM_RNG 0x080
62# define TIOCM_DSR 0x100
63# define TIOCM_CD TIOCM_CAR
64# define TIOCM_RI TIOCM_RNG
65#define TIOCM_OUT1 0x2000
66#define TIOCM_OUT2 0x4000
67#define TIOCM_LOOP 0x8000
68
69#define TIOCGSOFTCAR 0x5419
70#define TIOCSSOFTCAR 0x541A
71#define TIOCLINUX 0x541C
72#define TIOCCONS 0x541D
73#define TIOCGSERIAL 0x541E
74#define TIOCSSERIAL 0x541F
75#define TIOCPKT 0x5420
76# define TIOCPKT_DATA 0
77# define TIOCPKT_FLUSHREAD 1
78# define TIOCPKT_FLUSHWRITE 2
79# define TIOCPKT_STOP 4
80# define TIOCPKT_START 8
81# define TIOCPKT_NOSTOP 16
82# define TIOCPKT_DOSTOP 32
83# define TIOCPKT_IOCTL 64
84
85
86#define TIOCNOTTY 0x5422
87#define TIOCSETD 0x5423
88#define TIOCGETD 0x5424
89#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
90#define TIOCSBRK 0x5427 /* BSD compatibility */
91#define TIOCCBRK 0x5428 /* BSD compatibility */
92#define TIOCGSID 0x5429 /* Return the session ID of FD */
93#define TIOCGRS485 0x542e
94#define TIOCSRS485 0x542f
95#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
96#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
97#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
98#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
99#define TIOCVHANGUP 0x5437
100
101#define TIOCSERCONFIG 0x5453
102#define TIOCSERGWILD 0x5454
103#define TIOCSERSWILD 0x5455
104#define TIOCGLCKTRMIOS 0x5456
105#define TIOCSLCKTRMIOS 0x5457
106#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
107#define TIOCSERGETLSR 0x5459 /* Get line status register */
108 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
109# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
110#define TIOCSERGETMULTI 0x545A /* Get multiport config */
111#define TIOCSERSETMULTI 0x545B /* Set multiport config */
112
113#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
114#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
115
116#endif /* _ASM_POWERPC_IOCTLS_H */
diff --git a/arch/powerpc/include/uapi/asm/ipcbuf.h b/arch/powerpc/include/uapi/asm/ipcbuf.h
new file mode 100644
index 00000000000..2c3e1d94db1
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/ipcbuf.h
@@ -0,0 +1,34 @@
1#ifndef _ASM_POWERPC_IPCBUF_H
2#define _ASM_POWERPC_IPCBUF_H
3
4/*
5 * The ipc64_perm structure for the powerpc is identical to
6 * kern_ipc_perm as we have always had 32-bit UIDs and GIDs in the
7 * kernel. Note extra padding because this structure is passed back
8 * and forth between kernel and user space. Pad space is left for:
9 * - 1 32-bit value to fill up for 8-byte alignment
10 * - 2 miscellaneous 64-bit values
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17
18#include <linux/types.h>
19
20struct ipc64_perm
21{
22 __kernel_key_t key;
23 __kernel_uid_t uid;
24 __kernel_gid_t gid;
25 __kernel_uid_t cuid;
26 __kernel_gid_t cgid;
27 __kernel_mode_t mode;
28 unsigned int seq;
29 unsigned int __pad1;
30 unsigned long long __unused1;
31 unsigned long long __unused2;
32};
33
34#endif /* _ASM_POWERPC_IPCBUF_H */
diff --git a/arch/powerpc/include/uapi/asm/kvm.h b/arch/powerpc/include/uapi/asm/kvm.h
new file mode 100644
index 00000000000..b89ae4db45c
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/kvm.h
@@ -0,0 +1,389 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2007
16 *
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18 */
19
20#ifndef __LINUX_KVM_POWERPC_H
21#define __LINUX_KVM_POWERPC_H
22
23#include <linux/types.h>
24
25/* Select powerpc specific features in <linux/kvm.h> */
26#define __KVM_HAVE_SPAPR_TCE
27#define __KVM_HAVE_PPC_SMT
28
29struct kvm_regs {
30 __u64 pc;
31 __u64 cr;
32 __u64 ctr;
33 __u64 lr;
34 __u64 xer;
35 __u64 msr;
36 __u64 srr0;
37 __u64 srr1;
38 __u64 pid;
39
40 __u64 sprg0;
41 __u64 sprg1;
42 __u64 sprg2;
43 __u64 sprg3;
44 __u64 sprg4;
45 __u64 sprg5;
46 __u64 sprg6;
47 __u64 sprg7;
48
49 __u64 gpr[32];
50};
51
52#define KVM_SREGS_E_IMPL_NONE 0
53#define KVM_SREGS_E_IMPL_FSL 1
54
55#define KVM_SREGS_E_FSL_PIDn (1 << 0) /* PID1/PID2 */
56
57/*
58 * Feature bits indicate which sections of the sregs struct are valid,
59 * both in KVM_GET_SREGS and KVM_SET_SREGS. On KVM_SET_SREGS, registers
60 * corresponding to unset feature bits will not be modified. This allows
61 * restoring a checkpoint made without that feature, while keeping the
62 * default values of the new registers.
63 *
64 * KVM_SREGS_E_BASE contains:
65 * CSRR0/1 (refers to SRR2/3 on 40x)
66 * ESR
67 * DEAR
68 * MCSR
69 * TSR
70 * TCR
71 * DEC
72 * TB
73 * VRSAVE (USPRG0)
74 */
75#define KVM_SREGS_E_BASE (1 << 0)
76
77/*
78 * KVM_SREGS_E_ARCH206 contains:
79 *
80 * PIR
81 * MCSRR0/1
82 * DECAR
83 * IVPR
84 */
85#define KVM_SREGS_E_ARCH206 (1 << 1)
86
87/*
88 * Contains EPCR, plus the upper half of 64-bit registers
89 * that are 32-bit on 32-bit implementations.
90 */
91#define KVM_SREGS_E_64 (1 << 2)
92
93#define KVM_SREGS_E_SPRG8 (1 << 3)
94#define KVM_SREGS_E_MCIVPR (1 << 4)
95
96/*
97 * IVORs are used -- contains IVOR0-15, plus additional IVORs
98 * in combination with an appropriate feature bit.
99 */
100#define KVM_SREGS_E_IVOR (1 << 5)
101
102/*
103 * Contains MAS0-4, MAS6-7, TLBnCFG, MMUCFG.
104 * Also TLBnPS if MMUCFG[MAVN] = 1.
105 */
106#define KVM_SREGS_E_ARCH206_MMU (1 << 6)
107
108/* DBSR, DBCR, IAC, DAC, DVC */
109#define KVM_SREGS_E_DEBUG (1 << 7)
110
111/* Enhanced debug -- DSRR0/1, SPRG9 */
112#define KVM_SREGS_E_ED (1 << 8)
113
114/* Embedded Floating Point (SPE) -- IVOR32-34 if KVM_SREGS_E_IVOR */
115#define KVM_SREGS_E_SPE (1 << 9)
116
117/* External Proxy (EXP) -- EPR */
118#define KVM_SREGS_EXP (1 << 10)
119
120/* External PID (E.PD) -- EPSC/EPLC */
121#define KVM_SREGS_E_PD (1 << 11)
122
123/* Processor Control (E.PC) -- IVOR36-37 if KVM_SREGS_E_IVOR */
124#define KVM_SREGS_E_PC (1 << 12)
125
126/* Page table (E.PT) -- EPTCFG */
127#define KVM_SREGS_E_PT (1 << 13)
128
129/* Embedded Performance Monitor (E.PM) -- IVOR35 if KVM_SREGS_E_IVOR */
130#define KVM_SREGS_E_PM (1 << 14)
131
132/*
133 * Special updates:
134 *
135 * Some registers may change even while a vcpu is not running.
136 * To avoid losing these changes, by default these registers are
137 * not updated by KVM_SET_SREGS. To force an update, set the bit
138 * in u.e.update_special corresponding to the register to be updated.
139 *
140 * The update_special field is zero on return from KVM_GET_SREGS.
141 *
142 * When restoring a checkpoint, the caller can set update_special
143 * to 0xffffffff to ensure that everything is restored, even new features
144 * that the caller doesn't know about.
145 */
146#define KVM_SREGS_E_UPDATE_MCSR (1 << 0)
147#define KVM_SREGS_E_UPDATE_TSR (1 << 1)
148#define KVM_SREGS_E_UPDATE_DEC (1 << 2)
149#define KVM_SREGS_E_UPDATE_DBSR (1 << 3)
150
151/*
152 * In KVM_SET_SREGS, reserved/pad fields must be left untouched from a
153 * previous KVM_GET_REGS.
154 *
155 * Unless otherwise indicated, setting any register with KVM_SET_SREGS
156 * directly sets its value. It does not trigger any special semantics such
157 * as write-one-to-clear. Calling KVM_SET_SREGS on an unmodified struct
158 * just received from KVM_GET_SREGS is always a no-op.
159 */
160struct kvm_sregs {
161 __u32 pvr;
162 union {
163 struct {
164 __u64 sdr1;
165 struct {
166 struct {
167 __u64 slbe;
168 __u64 slbv;
169 } slb[64];
170 } ppc64;
171 struct {
172 __u32 sr[16];
173 __u64 ibat[8];
174 __u64 dbat[8];
175 } ppc32;
176 } s;
177 struct {
178 union {
179 struct { /* KVM_SREGS_E_IMPL_FSL */
180 __u32 features; /* KVM_SREGS_E_FSL_ */
181 __u32 svr;
182 __u64 mcar;
183 __u32 hid0;
184
185 /* KVM_SREGS_E_FSL_PIDn */
186 __u32 pid1, pid2;
187 } fsl;
188 __u8 pad[256];
189 } impl;
190
191 __u32 features; /* KVM_SREGS_E_ */
192 __u32 impl_id; /* KVM_SREGS_E_IMPL_ */
193 __u32 update_special; /* KVM_SREGS_E_UPDATE_ */
194 __u32 pir; /* read-only */
195 __u64 sprg8;
196 __u64 sprg9; /* E.ED */
197 __u64 csrr0;
198 __u64 dsrr0; /* E.ED */
199 __u64 mcsrr0;
200 __u32 csrr1;
201 __u32 dsrr1; /* E.ED */
202 __u32 mcsrr1;
203 __u32 esr;
204 __u64 dear;
205 __u64 ivpr;
206 __u64 mcivpr;
207 __u64 mcsr; /* KVM_SREGS_E_UPDATE_MCSR */
208
209 __u32 tsr; /* KVM_SREGS_E_UPDATE_TSR */
210 __u32 tcr;
211 __u32 decar;
212 __u32 dec; /* KVM_SREGS_E_UPDATE_DEC */
213
214 /*
215 * Userspace can read TB directly, but the
216 * value reported here is consistent with "dec".
217 *
218 * Read-only.
219 */
220 __u64 tb;
221
222 __u32 dbsr; /* KVM_SREGS_E_UPDATE_DBSR */
223 __u32 dbcr[3];
224 /*
225 * iac/dac registers are 64bit wide, while this API
226 * interface provides only lower 32 bits on 64 bit
227 * processors. ONE_REG interface is added for 64bit
228 * iac/dac registers.
229 */
230 __u32 iac[4];
231 __u32 dac[2];
232 __u32 dvc[2];
233 __u8 num_iac; /* read-only */
234 __u8 num_dac; /* read-only */
235 __u8 num_dvc; /* read-only */
236 __u8 pad;
237
238 __u32 epr; /* EXP */
239 __u32 vrsave; /* a.k.a. USPRG0 */
240 __u32 epcr; /* KVM_SREGS_E_64 */
241
242 __u32 mas0;
243 __u32 mas1;
244 __u64 mas2;
245 __u64 mas7_3;
246 __u32 mas4;
247 __u32 mas6;
248
249 __u32 ivor_low[16]; /* IVOR0-15 */
250 __u32 ivor_high[18]; /* IVOR32+, plus room to expand */
251
252 __u32 mmucfg; /* read-only */
253 __u32 eptcfg; /* E.PT, read-only */
254 __u32 tlbcfg[4];/* read-only */
255 __u32 tlbps[4]; /* read-only */
256
257 __u32 eplc, epsc; /* E.PD */
258 } e;
259 __u8 pad[1020];
260 } u;
261};
262
263struct kvm_fpu {
264 __u64 fpr[32];
265};
266
267struct kvm_debug_exit_arch {
268};
269
270/* for KVM_SET_GUEST_DEBUG */
271struct kvm_guest_debug_arch {
272};
273
274/* definition of registers in kvm_run */
275struct kvm_sync_regs {
276};
277
278#define KVM_INTERRUPT_SET -1U
279#define KVM_INTERRUPT_UNSET -2U
280#define KVM_INTERRUPT_SET_LEVEL -3U
281
282#define KVM_CPU_440 1
283#define KVM_CPU_E500V2 2
284#define KVM_CPU_3S_32 3
285#define KVM_CPU_3S_64 4
286#define KVM_CPU_E500MC 5
287
288/* for KVM_CAP_SPAPR_TCE */
289struct kvm_create_spapr_tce {
290 __u64 liobn;
291 __u32 window_size;
292};
293
294/* for KVM_ALLOCATE_RMA */
295struct kvm_allocate_rma {
296 __u64 rma_size;
297};
298
299struct kvm_book3e_206_tlb_entry {
300 __u32 mas8;
301 __u32 mas1;
302 __u64 mas2;
303 __u64 mas7_3;
304};
305
306struct kvm_book3e_206_tlb_params {
307 /*
308 * For mmu types KVM_MMU_FSL_BOOKE_NOHV and KVM_MMU_FSL_BOOKE_HV:
309 *
310 * - The number of ways of TLB0 must be a power of two between 2 and
311 * 16.
312 * - TLB1 must be fully associative.
313 * - The size of TLB0 must be a multiple of the number of ways, and
314 * the number of sets must be a power of two.
315 * - The size of TLB1 may not exceed 64 entries.
316 * - TLB0 supports 4 KiB pages.
317 * - The page sizes supported by TLB1 are as indicated by
318 * TLB1CFG (if MMUCFG[MAVN] = 0) or TLB1PS (if MMUCFG[MAVN] = 1)
319 * as returned by KVM_GET_SREGS.
320 * - TLB2 and TLB3 are reserved, and their entries in tlb_sizes[]
321 * and tlb_ways[] must be zero.
322 *
323 * tlb_ways[n] = tlb_sizes[n] means the array is fully associative.
324 *
325 * KVM will adjust TLBnCFG based on the sizes configured here,
326 * though arrays greater than 2048 entries will have TLBnCFG[NENTRY]
327 * set to zero.
328 */
329 __u32 tlb_sizes[4];
330 __u32 tlb_ways[4];
331 __u32 reserved[8];
332};
333
334#define KVM_REG_PPC_HIOR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x1)
335#define KVM_REG_PPC_IAC1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x2)
336#define KVM_REG_PPC_IAC2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x3)
337#define KVM_REG_PPC_IAC3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x4)
338#define KVM_REG_PPC_IAC4 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x5)
339#define KVM_REG_PPC_DAC1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x6)
340#define KVM_REG_PPC_DAC2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x7)
341#define KVM_REG_PPC_DABR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8)
342#define KVM_REG_PPC_DSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x9)
343#define KVM_REG_PPC_PURR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa)
344#define KVM_REG_PPC_SPURR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb)
345#define KVM_REG_PPC_DAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc)
346#define KVM_REG_PPC_DSISR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xd)
347#define KVM_REG_PPC_AMR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xe)
348#define KVM_REG_PPC_UAMOR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xf)
349
350#define KVM_REG_PPC_MMCR0 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x10)
351#define KVM_REG_PPC_MMCR1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x11)
352#define KVM_REG_PPC_MMCRA (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x12)
353
354#define KVM_REG_PPC_PMC1 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x18)
355#define KVM_REG_PPC_PMC2 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x19)
356#define KVM_REG_PPC_PMC3 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1a)
357#define KVM_REG_PPC_PMC4 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1b)
358#define KVM_REG_PPC_PMC5 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1c)
359#define KVM_REG_PPC_PMC6 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1d)
360#define KVM_REG_PPC_PMC7 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1e)
361#define KVM_REG_PPC_PMC8 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1f)
362
363/* 32 floating-point registers */
364#define KVM_REG_PPC_FPR0 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x20)
365#define KVM_REG_PPC_FPR(n) (KVM_REG_PPC_FPR0 + (n))
366#define KVM_REG_PPC_FPR31 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x3f)
367
368/* 32 VMX/Altivec vector registers */
369#define KVM_REG_PPC_VR0 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x40)
370#define KVM_REG_PPC_VR(n) (KVM_REG_PPC_VR0 + (n))
371#define KVM_REG_PPC_VR31 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x5f)
372
373/* 32 double-width FP registers for VSX */
374/* High-order halves overlap with FP regs */
375#define KVM_REG_PPC_VSR0 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x60)
376#define KVM_REG_PPC_VSR(n) (KVM_REG_PPC_VSR0 + (n))
377#define KVM_REG_PPC_VSR31 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x7f)
378
379/* FP and vector status/control registers */
380#define KVM_REG_PPC_FPSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x80)
381#define KVM_REG_PPC_VSCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x81)
382
383/* Virtual processor areas */
384/* For SLB & DTL, address in high (first) half, length in low half */
385#define KVM_REG_PPC_VPA_ADDR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x82)
386#define KVM_REG_PPC_VPA_SLB (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x83)
387#define KVM_REG_PPC_VPA_DTL (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x84)
388
389#endif /* __LINUX_KVM_POWERPC_H */
diff --git a/arch/powerpc/include/uapi/asm/kvm_para.h b/arch/powerpc/include/uapi/asm/kvm_para.h
new file mode 100644
index 00000000000..ed0e0254b47
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/kvm_para.h
@@ -0,0 +1,91 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2008
16 *
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18 */
19
20#ifndef _UAPI__POWERPC_KVM_PARA_H__
21#define _UAPI__POWERPC_KVM_PARA_H__
22
23#include <linux/types.h>
24
25/*
26 * Additions to this struct must only occur at the end, and should be
27 * accompanied by a KVM_MAGIC_FEAT flag to advertise that they are present
28 * (albeit not necessarily relevant to the current target hardware platform).
29 *
30 * Struct fields are always 32 or 64 bit aligned, depending on them being 32
31 * or 64 bit wide respectively.
32 *
33 * See Documentation/virtual/kvm/ppc-pv.txt
34 */
35struct kvm_vcpu_arch_shared {
36 __u64 scratch1;
37 __u64 scratch2;
38 __u64 scratch3;
39 __u64 critical; /* Guest may not get interrupts if == r1 */
40 __u64 sprg0;
41 __u64 sprg1;
42 __u64 sprg2;
43 __u64 sprg3;
44 __u64 srr0;
45 __u64 srr1;
46 __u64 dar; /* dear on BookE */
47 __u64 msr;
48 __u32 dsisr;
49 __u32 int_pending; /* Tells the guest if we have an interrupt */
50 __u32 sr[16];
51 __u32 mas0;
52 __u32 mas1;
53 __u64 mas7_3;
54 __u64 mas2;
55 __u32 mas4;
56 __u32 mas6;
57 __u32 esr;
58 __u32 pir;
59
60 /*
61 * SPRG4-7 are user-readable, so we can only keep these consistent
62 * between the shared area and the real registers when there's an
63 * intervening exit to KVM. This also applies to SPRG3 on some
64 * chips.
65 *
66 * This suffices for access by guest userspace, since in PR-mode
67 * KVM, an exit must occur when changing the guest's MSR[PR].
68 * If the guest kernel writes to SPRG3-7 via the shared area, it
69 * must also use the shared area for reading while in kernel space.
70 */
71 __u64 sprg4;
72 __u64 sprg5;
73 __u64 sprg6;
74 __u64 sprg7;
75};
76
77#define KVM_SC_MAGIC_R0 0x4b564d21 /* "KVM!" */
78
79#define KVM_HCALL_TOKEN(num) _EV_HCALL_TOKEN(EV_KVM_VENDOR_ID, num)
80
81#include <uapi/asm/epapr_hcalls.h>
82
83#define KVM_FEATURE_MAGIC_PAGE 1
84
85#define KVM_MAGIC_FEAT_SR (1 << 0)
86
87/* MASn, ESR, PIR, and high SPRGs */
88#define KVM_MAGIC_FEAT_MAS0_TO_SPRG7 (1 << 1)
89
90
91#endif /* _UAPI__POWERPC_KVM_PARA_H__ */
diff --git a/arch/powerpc/include/uapi/asm/linkage.h b/arch/powerpc/include/uapi/asm/linkage.h
new file mode 100644
index 00000000000..e1c4ac1cc4b
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/linkage.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_POWERPC_LINKAGE_H
2#define _ASM_POWERPC_LINKAGE_H
3
4/* Nothing to see here... */
5
6#endif /* _ASM_POWERPC_LINKAGE_H */
diff --git a/arch/powerpc/include/uapi/asm/mman.h b/arch/powerpc/include/uapi/asm/mman.h
new file mode 100644
index 00000000000..6ea26df0a73
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/mman.h
@@ -0,0 +1,31 @@
1/*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version
5 * 2 of the License, or (at your option) any later version.
6 */
7#ifndef _UAPI_ASM_POWERPC_MMAN_H
8#define _UAPI_ASM_POWERPC_MMAN_H
9
10#include <asm-generic/mman-common.h>
11
12
13#define PROT_SAO 0x10 /* Strong Access Ordering */
14
15#define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */
16#define MAP_NORESERVE 0x40 /* don't reserve swap pages */
17#define MAP_LOCKED 0x80
18
19#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
20#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
21#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
22
23#define MCL_CURRENT 0x2000 /* lock all currently mapped pages */
24#define MCL_FUTURE 0x4000 /* lock all additions to address space */
25
26#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
27#define MAP_NONBLOCK 0x10000 /* do not block on IO */
28#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */
29#define MAP_HUGETLB 0x40000 /* create a huge page mapping */
30
31#endif /* _UAPI_ASM_POWERPC_MMAN_H */
diff --git a/arch/powerpc/include/uapi/asm/msgbuf.h b/arch/powerpc/include/uapi/asm/msgbuf.h
new file mode 100644
index 00000000000..dd76743c753
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/msgbuf.h
@@ -0,0 +1,33 @@
1#ifndef _ASM_POWERPC_MSGBUF_H
2#define _ASM_POWERPC_MSGBUF_H
3
4/*
5 * The msqid64_ds structure for the PowerPC architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 */
9
10struct msqid64_ds {
11 struct ipc64_perm msg_perm;
12#ifndef __powerpc64__
13 unsigned int __unused1;
14#endif
15 __kernel_time_t msg_stime; /* last msgsnd time */
16#ifndef __powerpc64__
17 unsigned int __unused2;
18#endif
19 __kernel_time_t msg_rtime; /* last msgrcv time */
20#ifndef __powerpc64__
21 unsigned int __unused3;
22#endif
23 __kernel_time_t msg_ctime; /* last change time */
24 unsigned long msg_cbytes; /* current number of bytes on queue */
25 unsigned long msg_qnum; /* number of messages in queue */
26 unsigned long msg_qbytes; /* max number of bytes on queue */
27 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
28 __kernel_pid_t msg_lrpid; /* last receive pid */
29 unsigned long __unused4;
30 unsigned long __unused5;
31};
32
33#endif /* _ASM_POWERPC_MSGBUF_H */
diff --git a/arch/powerpc/include/uapi/asm/nvram.h b/arch/powerpc/include/uapi/asm/nvram.h
new file mode 100644
index 00000000000..608bdc8aedd
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/nvram.h
@@ -0,0 +1,62 @@
1/*
2 * NVRAM definitions and access functions.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9
10#ifndef _UAPI_ASM_POWERPC_NVRAM_H
11#define _UAPI_ASM_POWERPC_NVRAM_H
12
13/* Signatures for nvram partitions */
14#define NVRAM_SIG_SP 0x02 /* support processor */
15#define NVRAM_SIG_OF 0x50 /* open firmware config */
16#define NVRAM_SIG_FW 0x51 /* general firmware */
17#define NVRAM_SIG_HW 0x52 /* hardware (VPD) */
18#define NVRAM_SIG_FLIP 0x5a /* Apple flip/flop header */
19#define NVRAM_SIG_APPL 0x5f /* Apple "system" (???) */
20#define NVRAM_SIG_SYS 0x70 /* system env vars */
21#define NVRAM_SIG_CFG 0x71 /* config data */
22#define NVRAM_SIG_ELOG 0x72 /* error log */
23#define NVRAM_SIG_VEND 0x7e /* vendor defined */
24#define NVRAM_SIG_FREE 0x7f /* Free space */
25#define NVRAM_SIG_OS 0xa0 /* OS defined */
26#define NVRAM_SIG_PANIC 0xa1 /* Apple OSX "panic" */
27
28
29/* PowerMac specific nvram stuffs */
30
31enum {
32 pmac_nvram_OF, /* Open Firmware partition */
33 pmac_nvram_XPRAM, /* MacOS XPRAM partition */
34 pmac_nvram_NR /* MacOS Name Registry partition */
35};
36
37
38/* Some offsets in XPRAM */
39#define PMAC_XPRAM_MACHINE_LOC 0xe4
40#define PMAC_XPRAM_SOUND_VOLUME 0x08
41
42/* Machine location structure in PowerMac XPRAM */
43struct pmac_machine_location {
44 unsigned int latitude; /* 2+30 bit Fractional number */
45 unsigned int longitude; /* 2+30 bit Fractional number */
46 unsigned int delta; /* mix of GMT delta and DLS */
47};
48
49/*
50 * /dev/nvram ioctls
51 *
52 * Note that PMAC_NVRAM_GET_OFFSET is still supported, but is
53 * definitely obsolete. Do not use it if you can avoid it
54 */
55
56#define OBSOLETE_PMAC_NVRAM_GET_OFFSET \
57 _IOWR('p', 0x40, int)
58
59#define IOC_NVRAM_GET_OFFSET _IOWR('p', 0x42, int) /* Get NVRAM partition offset */
60#define IOC_NVRAM_SYNC _IO('p', 0x43) /* Sync NVRAM image */
61
62#endif /* _UAPI_ASM_POWERPC_NVRAM_H */
diff --git a/arch/powerpc/include/uapi/asm/param.h b/arch/powerpc/include/uapi/asm/param.h
new file mode 100644
index 00000000000..965d4542797
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/param.h
@@ -0,0 +1 @@
#include <asm-generic/param.h>
diff --git a/arch/powerpc/include/uapi/asm/poll.h b/arch/powerpc/include/uapi/asm/poll.h
new file mode 100644
index 00000000000..c98509d3149
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/poll.h
@@ -0,0 +1 @@
#include <asm-generic/poll.h>
diff --git a/arch/powerpc/include/uapi/asm/posix_types.h b/arch/powerpc/include/uapi/asm/posix_types.h
new file mode 100644
index 00000000000..2958c5b97b2
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/posix_types.h
@@ -0,0 +1,25 @@
1#ifndef _ASM_POWERPC_POSIX_TYPES_H
2#define _ASM_POWERPC_POSIX_TYPES_H
3
4/*
5 * This file is generally used by user-level software, so you need to
6 * be a little careful about namespace pollution etc. Also, we cannot
7 * assume GCC is being used.
8 */
9
10#ifdef __powerpc64__
11typedef unsigned long __kernel_old_dev_t;
12#define __kernel_old_dev_t __kernel_old_dev_t
13#else
14typedef unsigned int __kernel_size_t;
15typedef int __kernel_ssize_t;
16typedef long __kernel_ptrdiff_t;
17#define __kernel_size_t __kernel_size_t
18
19typedef short __kernel_ipc_pid_t;
20#define __kernel_ipc_pid_t __kernel_ipc_pid_t
21#endif
22
23#include <asm-generic/posix_types.h>
24
25#endif /* _ASM_POWERPC_POSIX_TYPES_H */
diff --git a/arch/powerpc/include/uapi/asm/ps3fb.h b/arch/powerpc/include/uapi/asm/ps3fb.h
new file mode 100644
index 00000000000..e7233a84968
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/ps3fb.h
@@ -0,0 +1,45 @@
1/*
2 * Copyright (C) 2006 Sony Computer Entertainment Inc.
3 * Copyright 2006, 2007 Sony Corporation
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published
7 * by the Free Software Foundation; version 2 of the License.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#ifndef _ASM_POWERPC_PS3FB_H_
20#define _ASM_POWERPC_PS3FB_H_
21
22#include <linux/types.h>
23#include <linux/ioctl.h>
24
25/* ioctl */
26#define PS3FB_IOCTL_SETMODE _IOW('r', 1, int) /* set video mode */
27#define PS3FB_IOCTL_GETMODE _IOR('r', 2, int) /* get video mode */
28#define PS3FB_IOCTL_SCREENINFO _IOR('r', 3, int) /* get screen info */
29#define PS3FB_IOCTL_ON _IO('r', 4) /* use IOCTL_FSEL */
30#define PS3FB_IOCTL_OFF _IO('r', 5) /* return to normal-flip */
31#define PS3FB_IOCTL_FSEL _IOW('r', 6, int) /* blit and flip request */
32
33#ifndef FBIO_WAITFORVSYNC
34#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) /* wait for vsync */
35#endif
36
37struct ps3fb_ioctl_res {
38 __u32 xres; /* frame buffer x_size */
39 __u32 yres; /* frame buffer y_size */
40 __u32 xoff; /* margine x */
41 __u32 yoff; /* margine y */
42 __u32 num_frames; /* num of frame buffers */
43};
44
45#endif /* _ASM_POWERPC_PS3FB_H_ */
diff --git a/arch/powerpc/include/uapi/asm/ptrace.h b/arch/powerpc/include/uapi/asm/ptrace.h
new file mode 100644
index 00000000000..ee67a2bc91b
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/ptrace.h
@@ -0,0 +1,259 @@
1/*
2 * Copyright (C) 2001 PPC64 Team, IBM Corp
3 *
4 * This struct defines the way the registers are stored on the
5 * kernel stack during a system call or other kernel entry.
6 *
7 * this should only contain volatile regs
8 * since we can keep non-volatile in the thread_struct
9 * should set this up when only volatiles are saved
10 * by intr code.
11 *
12 * Since this is going on the stack, *CARE MUST BE TAKEN* to insure
13 * that the overall structure is a multiple of 16 bytes in length.
14 *
15 * Note that the offsets of the fields in this struct correspond with
16 * the PT_* values below. This simplifies arch/powerpc/kernel/ptrace.c.
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version
21 * 2 of the License, or (at your option) any later version.
22 */
23#ifndef _UAPI_ASM_POWERPC_PTRACE_H
24#define _UAPI_ASM_POWERPC_PTRACE_H
25
26
27#include <linux/types.h>
28
29#ifndef __ASSEMBLY__
30
31struct pt_regs {
32 unsigned long gpr[32];
33 unsigned long nip;
34 unsigned long msr;
35 unsigned long orig_gpr3; /* Used for restarting system calls */
36 unsigned long ctr;
37 unsigned long link;
38 unsigned long xer;
39 unsigned long ccr;
40#ifdef __powerpc64__
41 unsigned long softe; /* Soft enabled/disabled */
42#else
43 unsigned long mq; /* 601 only (not used at present) */
44 /* Used on APUS to hold IPL value. */
45#endif
46 unsigned long trap; /* Reason for being here */
47 /* N.B. for critical exceptions on 4xx, the dar and dsisr
48 fields are overloaded to hold srr0 and srr1. */
49 unsigned long dar; /* Fault registers */
50 unsigned long dsisr; /* on 4xx/Book-E used for ESR */
51 unsigned long result; /* Result of a system call */
52};
53
54#endif /* __ASSEMBLY__ */
55
56
57/*
58 * Offsets used by 'ptrace' system call interface.
59 * These can't be changed without breaking binary compatibility
60 * with MkLinux, etc.
61 */
62#define PT_R0 0
63#define PT_R1 1
64#define PT_R2 2
65#define PT_R3 3
66#define PT_R4 4
67#define PT_R5 5
68#define PT_R6 6
69#define PT_R7 7
70#define PT_R8 8
71#define PT_R9 9
72#define PT_R10 10
73#define PT_R11 11
74#define PT_R12 12
75#define PT_R13 13
76#define PT_R14 14
77#define PT_R15 15
78#define PT_R16 16
79#define PT_R17 17
80#define PT_R18 18
81#define PT_R19 19
82#define PT_R20 20
83#define PT_R21 21
84#define PT_R22 22
85#define PT_R23 23
86#define PT_R24 24
87#define PT_R25 25
88#define PT_R26 26
89#define PT_R27 27
90#define PT_R28 28
91#define PT_R29 29
92#define PT_R30 30
93#define PT_R31 31
94
95#define PT_NIP 32
96#define PT_MSR 33
97#define PT_ORIG_R3 34
98#define PT_CTR 35
99#define PT_LNK 36
100#define PT_XER 37
101#define PT_CCR 38
102#ifndef __powerpc64__
103#define PT_MQ 39
104#else
105#define PT_SOFTE 39
106#endif
107#define PT_TRAP 40
108#define PT_DAR 41
109#define PT_DSISR 42
110#define PT_RESULT 43
111#define PT_REGS_COUNT 44
112
113#define PT_FPR0 48 /* each FP reg occupies 2 slots in this space */
114
115#ifndef __powerpc64__
116
117#define PT_FPR31 (PT_FPR0 + 2*31)
118#define PT_FPSCR (PT_FPR0 + 2*32 + 1)
119
120#else /* __powerpc64__ */
121
122#define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */
123
124
125#define PT_VR0 82 /* each Vector reg occupies 2 slots in 64-bit */
126#define PT_VSCR (PT_VR0 + 32*2 + 1)
127#define PT_VRSAVE (PT_VR0 + 33*2)
128
129
130/*
131 * Only store first 32 VSRs here. The second 32 VSRs in VR0-31
132 */
133#define PT_VSR0 150 /* each VSR reg occupies 2 slots in 64-bit */
134#define PT_VSR31 (PT_VSR0 + 2*31)
135#endif /* __powerpc64__ */
136
137/*
138 * Get/set all the altivec registers vr0..vr31, vscr, vrsave, in one go.
139 * The transfer totals 34 quadword. Quadwords 0-31 contain the
140 * corresponding vector registers. Quadword 32 contains the vscr as the
141 * last word (offset 12) within that quadword. Quadword 33 contains the
142 * vrsave as the first word (offset 0) within the quadword.
143 *
144 * This definition of the VMX state is compatible with the current PPC32
145 * ptrace interface. This allows signal handling and ptrace to use the same
146 * structures. This also simplifies the implementation of a bi-arch
147 * (combined (32- and 64-bit) gdb.
148 */
149#define PTRACE_GETVRREGS 18
150#define PTRACE_SETVRREGS 19
151
152/* Get/set all the upper 32-bits of the SPE registers, accumulator, and
153 * spefscr, in one go */
154#define PTRACE_GETEVRREGS 20
155#define PTRACE_SETEVRREGS 21
156
157/* Get the first 32 128bit VSX registers */
158#define PTRACE_GETVSRREGS 27
159#define PTRACE_SETVSRREGS 28
160
161/*
162 * Get or set a debug register. The first 16 are DABR registers and the
163 * second 16 are IABR registers.
164 */
165#define PTRACE_GET_DEBUGREG 25
166#define PTRACE_SET_DEBUGREG 26
167
168/* (new) PTRACE requests using the same numbers as x86 and the same
169 * argument ordering. Additionally, they support more registers too
170 */
171#define PTRACE_GETREGS 12
172#define PTRACE_SETREGS 13
173#define PTRACE_GETFPREGS 14
174#define PTRACE_SETFPREGS 15
175#define PTRACE_GETREGS64 22
176#define PTRACE_SETREGS64 23
177
178/* Calls to trace a 64bit program from a 32bit program */
179#define PPC_PTRACE_PEEKTEXT_3264 0x95
180#define PPC_PTRACE_PEEKDATA_3264 0x94
181#define PPC_PTRACE_POKETEXT_3264 0x93
182#define PPC_PTRACE_POKEDATA_3264 0x92
183#define PPC_PTRACE_PEEKUSR_3264 0x91
184#define PPC_PTRACE_POKEUSR_3264 0x90
185
186#define PTRACE_SINGLEBLOCK 0x100 /* resume execution until next branch */
187
188#define PPC_PTRACE_GETHWDBGINFO 0x89
189#define PPC_PTRACE_SETHWDEBUG 0x88
190#define PPC_PTRACE_DELHWDEBUG 0x87
191
192#ifndef __ASSEMBLY__
193
194struct ppc_debug_info {
195 __u32 version; /* Only version 1 exists to date */
196 __u32 num_instruction_bps;
197 __u32 num_data_bps;
198 __u32 num_condition_regs;
199 __u32 data_bp_alignment;
200 __u32 sizeof_condition; /* size of the DVC register */
201 __u64 features;
202};
203
204#endif /* __ASSEMBLY__ */
205
206/*
207 * features will have bits indication whether there is support for:
208 */
209#define PPC_DEBUG_FEATURE_INSN_BP_RANGE 0x0000000000000001
210#define PPC_DEBUG_FEATURE_INSN_BP_MASK 0x0000000000000002
211#define PPC_DEBUG_FEATURE_DATA_BP_RANGE 0x0000000000000004
212#define PPC_DEBUG_FEATURE_DATA_BP_MASK 0x0000000000000008
213
214#ifndef __ASSEMBLY__
215
216struct ppc_hw_breakpoint {
217 __u32 version; /* currently, version must be 1 */
218 __u32 trigger_type; /* only some combinations allowed */
219 __u32 addr_mode; /* address match mode */
220 __u32 condition_mode; /* break/watchpoint condition flags */
221 __u64 addr; /* break/watchpoint address */
222 __u64 addr2; /* range end or mask */
223 __u64 condition_value; /* contents of the DVC register */
224};
225
226#endif /* __ASSEMBLY__ */
227
228/*
229 * Trigger Type
230 */
231#define PPC_BREAKPOINT_TRIGGER_EXECUTE 0x00000001
232#define PPC_BREAKPOINT_TRIGGER_READ 0x00000002
233#define PPC_BREAKPOINT_TRIGGER_WRITE 0x00000004
234#define PPC_BREAKPOINT_TRIGGER_RW \
235 (PPC_BREAKPOINT_TRIGGER_READ | PPC_BREAKPOINT_TRIGGER_WRITE)
236
237/*
238 * Address Mode
239 */
240#define PPC_BREAKPOINT_MODE_EXACT 0x00000000
241#define PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE 0x00000001
242#define PPC_BREAKPOINT_MODE_RANGE_EXCLUSIVE 0x00000002
243#define PPC_BREAKPOINT_MODE_MASK 0x00000003
244
245/*
246 * Condition Mode
247 */
248#define PPC_BREAKPOINT_CONDITION_MODE 0x00000003
249#define PPC_BREAKPOINT_CONDITION_NONE 0x00000000
250#define PPC_BREAKPOINT_CONDITION_AND 0x00000001
251#define PPC_BREAKPOINT_CONDITION_EXACT PPC_BREAKPOINT_CONDITION_AND
252#define PPC_BREAKPOINT_CONDITION_OR 0x00000002
253#define PPC_BREAKPOINT_CONDITION_AND_OR 0x00000003
254#define PPC_BREAKPOINT_CONDITION_BE_ALL 0x00ff0000
255#define PPC_BREAKPOINT_CONDITION_BE_SHIFT 16
256#define PPC_BREAKPOINT_CONDITION_BE(n) \
257 (1<<((n)+PPC_BREAKPOINT_CONDITION_BE_SHIFT))
258
259#endif /* _UAPI_ASM_POWERPC_PTRACE_H */
diff --git a/arch/powerpc/include/uapi/asm/resource.h b/arch/powerpc/include/uapi/asm/resource.h
new file mode 100644
index 00000000000..04bc4db8921
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/resource.h
@@ -0,0 +1 @@
#include <asm-generic/resource.h>
diff --git a/arch/powerpc/include/uapi/asm/seccomp.h b/arch/powerpc/include/uapi/asm/seccomp.h
new file mode 100644
index 00000000000..00c1d9133cf
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/seccomp.h
@@ -0,0 +1,16 @@
1#ifndef _ASM_POWERPC_SECCOMP_H
2#define _ASM_POWERPC_SECCOMP_H
3
4#include <linux/unistd.h>
5
6#define __NR_seccomp_read __NR_read
7#define __NR_seccomp_write __NR_write
8#define __NR_seccomp_exit __NR_exit
9#define __NR_seccomp_sigreturn __NR_rt_sigreturn
10
11#define __NR_seccomp_read_32 __NR_read
12#define __NR_seccomp_write_32 __NR_write
13#define __NR_seccomp_exit_32 __NR_exit
14#define __NR_seccomp_sigreturn_32 __NR_sigreturn
15
16#endif /* _ASM_POWERPC_SECCOMP_H */
diff --git a/arch/powerpc/include/uapi/asm/sembuf.h b/arch/powerpc/include/uapi/asm/sembuf.h
new file mode 100644
index 00000000000..99a41938ae3
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/sembuf.h
@@ -0,0 +1,36 @@
1#ifndef _ASM_POWERPC_SEMBUF_H
2#define _ASM_POWERPC_SEMBUF_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11/*
12 * The semid64_ds structure for PPC architecture.
13 * Note extra padding because this structure is passed back and forth
14 * between kernel and user space.
15 *
16 * Pad space is left for:
17 * - 64-bit time_t to solve y2038 problem
18 * - 2 miscellaneous 32-bit values
19 */
20
21struct semid64_ds {
22 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
23#ifndef __powerpc64__
24 unsigned long __unused1;
25#endif
26 __kernel_time_t sem_otime; /* last semop time */
27#ifndef __powerpc64__
28 unsigned long __unused2;
29#endif
30 __kernel_time_t sem_ctime; /* last change time */
31 unsigned long sem_nsems; /* no. of semaphores in array */
32 unsigned long __unused3;
33 unsigned long __unused4;
34};
35
36#endif /* _ASM_POWERPC_SEMBUF_H */
diff --git a/arch/powerpc/include/uapi/asm/setup.h b/arch/powerpc/include/uapi/asm/setup.h
new file mode 100644
index 00000000000..8b9a306260b
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/setup.h
@@ -0,0 +1,32 @@
1#ifndef _ASM_POWERPC_SETUP_H
2#define _ASM_POWERPC_SETUP_H
3
4#include <asm-generic/setup.h>
5
6#ifndef __ASSEMBLY__
7extern void ppc_printk_progress(char *s, unsigned short hex);
8
9extern unsigned int rtas_data;
10extern int mem_init_done; /* set on boot once kmalloc can be called */
11extern int init_bootmem_done; /* set once bootmem is available */
12extern unsigned long long memory_limit;
13extern unsigned long klimit;
14extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
15
16extern void via_cuda_init(void);
17extern void read_rtc_time(void);
18extern void pmac_find_display(void);
19
20struct device_node;
21extern void note_scsi_host(struct device_node *, void *);
22
23/* Used in very early kernel initialization. */
24extern unsigned long reloc_offset(void);
25extern unsigned long add_reloc_offset(unsigned long);
26extern void reloc_got2(unsigned long);
27
28#define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x)))
29
30#endif /* !__ASSEMBLY__ */
31
32#endif /* _ASM_POWERPC_SETUP_H */
diff --git a/arch/powerpc/include/uapi/asm/shmbuf.h b/arch/powerpc/include/uapi/asm/shmbuf.h
new file mode 100644
index 00000000000..8efa39698b6
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/shmbuf.h
@@ -0,0 +1,59 @@
1#ifndef _ASM_POWERPC_SHMBUF_H
2#define _ASM_POWERPC_SHMBUF_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11/*
12 * The shmid64_ds structure for PPC architecture.
13 *
14 * Note extra padding because this structure is passed back and forth
15 * between kernel and user space.
16 *
17 * Pad space is left for:
18 * - 64-bit time_t to solve y2038 problem
19 * - 2 miscellaneous 32-bit values
20 */
21
22struct shmid64_ds {
23 struct ipc64_perm shm_perm; /* operation perms */
24#ifndef __powerpc64__
25 unsigned long __unused1;
26#endif
27 __kernel_time_t shm_atime; /* last attach time */
28#ifndef __powerpc64__
29 unsigned long __unused2;
30#endif
31 __kernel_time_t shm_dtime; /* last detach time */
32#ifndef __powerpc64__
33 unsigned long __unused3;
34#endif
35 __kernel_time_t shm_ctime; /* last change time */
36#ifndef __powerpc64__
37 unsigned long __unused4;
38#endif
39 size_t shm_segsz; /* size of segment (bytes) */
40 __kernel_pid_t shm_cpid; /* pid of creator */
41 __kernel_pid_t shm_lpid; /* pid of last operator */
42 unsigned long shm_nattch; /* no. of current attaches */
43 unsigned long __unused5;
44 unsigned long __unused6;
45};
46
47struct shminfo64 {
48 unsigned long shmmax;
49 unsigned long shmmin;
50 unsigned long shmmni;
51 unsigned long shmseg;
52 unsigned long shmall;
53 unsigned long __unused1;
54 unsigned long __unused2;
55 unsigned long __unused3;
56 unsigned long __unused4;
57};
58
59#endif /* _ASM_POWERPC_SHMBUF_H */
diff --git a/arch/powerpc/include/uapi/asm/sigcontext.h b/arch/powerpc/include/uapi/asm/sigcontext.h
new file mode 100644
index 00000000000..9c1f24fd5d1
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/sigcontext.h
@@ -0,0 +1,87 @@
1#ifndef _ASM_POWERPC_SIGCONTEXT_H
2#define _ASM_POWERPC_SIGCONTEXT_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10#include <linux/compiler.h>
11#include <asm/ptrace.h>
12#ifdef __powerpc64__
13#include <asm/elf.h>
14#endif
15
16struct sigcontext {
17 unsigned long _unused[4];
18 int signal;
19#ifdef __powerpc64__
20 int _pad0;
21#endif
22 unsigned long handler;
23 unsigned long oldmask;
24 struct pt_regs __user *regs;
25#ifdef __powerpc64__
26 elf_gregset_t gp_regs;
27 elf_fpregset_t fp_regs;
28/*
29 * To maintain compatibility with current implementations the sigcontext is
30 * extended by appending a pointer (v_regs) to a quadword type (elf_vrreg_t)
31 * followed by an unstructured (vmx_reserve) field of 69 doublewords. This
32 * allows the array of vector registers to be quadword aligned independent of
33 * the alignment of the containing sigcontext or ucontext. It is the
34 * responsibility of the code setting the sigcontext to set this pointer to
35 * either NULL (if this processor does not support the VMX feature) or the
36 * address of the first quadword within the allocated (vmx_reserve) area.
37 *
38 * The pointer (v_regs) of vector type (elf_vrreg_t) is type compatible with
39 * an array of 34 quadword entries (elf_vrregset_t). The entries with
40 * indexes 0-31 contain the corresponding vector registers. The entry with
41 * index 32 contains the vscr as the last word (offset 12) within the
42 * quadword. This allows the vscr to be stored as either a quadword (since
43 * it must be copied via a vector register to/from storage) or as a word.
44 * The entry with index 33 contains the vrsave as the first word (offset 0)
45 * within the quadword.
46 *
47 * Part of the VSX data is stored here also by extending vmx_restore
48 * by an additional 32 double words. Architecturally the layout of
49 * the VSR registers and how they overlap on top of the legacy FPR and
50 * VR registers is shown below:
51 *
52 * VSR doubleword 0 VSR doubleword 1
53 * ----------------------------------------------------------------
54 * VSR[0] | FPR[0] | |
55 * ----------------------------------------------------------------
56 * VSR[1] | FPR[1] | |
57 * ----------------------------------------------------------------
58 * | ... | |
59 * | ... | |
60 * ----------------------------------------------------------------
61 * VSR[30] | FPR[30] | |
62 * ----------------------------------------------------------------
63 * VSR[31] | FPR[31] | |
64 * ----------------------------------------------------------------
65 * VSR[32] | VR[0] |
66 * ----------------------------------------------------------------
67 * VSR[33] | VR[1] |
68 * ----------------------------------------------------------------
69 * | ... |
70 * | ... |
71 * ----------------------------------------------------------------
72 * VSR[62] | VR[30] |
73 * ----------------------------------------------------------------
74 * VSR[63] | VR[31] |
75 * ----------------------------------------------------------------
76 *
77 * FPR/VSR 0-31 doubleword 0 is stored in fp_regs, and VMX/VSR 32-63
78 * is stored at the start of vmx_reserve. vmx_reserve is extended for
79 * backwards compatility to store VSR 0-31 doubleword 1 after the VMX
80 * registers and vscr/vrsave.
81 */
82 elf_vrreg_t __user *v_regs;
83 long vmx_reserve[ELF_NVRREG+ELF_NVRREG+32+1];
84#endif
85};
86
87#endif /* _ASM_POWERPC_SIGCONTEXT_H */
diff --git a/arch/powerpc/include/uapi/asm/siginfo.h b/arch/powerpc/include/uapi/asm/siginfo.h
new file mode 100644
index 00000000000..ccce3ef5cd8
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/siginfo.h
@@ -0,0 +1,20 @@
1#ifndef _ASM_POWERPC_SIGINFO_H
2#define _ASM_POWERPC_SIGINFO_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#ifdef __powerpc64__
12# define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
13#endif
14
15#include <asm-generic/siginfo.h>
16
17#undef NSIGTRAP
18#define NSIGTRAP 4
19
20#endif /* _ASM_POWERPC_SIGINFO_H */
diff --git a/arch/powerpc/include/uapi/asm/signal.h b/arch/powerpc/include/uapi/asm/signal.h
new file mode 100644
index 00000000000..48fa8d3f2f9
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/signal.h
@@ -0,0 +1,145 @@
1#ifndef _UAPI_ASM_POWERPC_SIGNAL_H
2#define _UAPI_ASM_POWERPC_SIGNAL_H
3
4#include <linux/types.h>
5
6#define _NSIG 64
7#ifdef __powerpc64__
8#define _NSIG_BPW 64
9#else
10#define _NSIG_BPW 32
11#endif
12#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
13
14typedef unsigned long old_sigset_t; /* at least 32 bits */
15
16typedef struct {
17 unsigned long sig[_NSIG_WORDS];
18} sigset_t;
19
20#define SIGHUP 1
21#define SIGINT 2
22#define SIGQUIT 3
23#define SIGILL 4
24#define SIGTRAP 5
25#define SIGABRT 6
26#define SIGIOT 6
27#define SIGBUS 7
28#define SIGFPE 8
29#define SIGKILL 9
30#define SIGUSR1 10
31#define SIGSEGV 11
32#define SIGUSR2 12
33#define SIGPIPE 13
34#define SIGALRM 14
35#define SIGTERM 15
36#define SIGSTKFLT 16
37#define SIGCHLD 17
38#define SIGCONT 18
39#define SIGSTOP 19
40#define SIGTSTP 20
41#define SIGTTIN 21
42#define SIGTTOU 22
43#define SIGURG 23
44#define SIGXCPU 24
45#define SIGXFSZ 25
46#define SIGVTALRM 26
47#define SIGPROF 27
48#define SIGWINCH 28
49#define SIGIO 29
50#define SIGPOLL SIGIO
51/*
52#define SIGLOST 29
53*/
54#define SIGPWR 30
55#define SIGSYS 31
56#define SIGUNUSED 31
57
58/* These should not be considered constants from userland. */
59#define SIGRTMIN 32
60#define SIGRTMAX _NSIG
61
62/*
63 * SA_FLAGS values:
64 *
65 * SA_ONSTACK is not currently supported, but will allow sigaltstack(2).
66 * SA_RESTART flag to get restarting signals (which were the default long ago)
67 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
68 * SA_RESETHAND clears the handler when the signal is delivered.
69 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
70 * SA_NODEFER prevents the current signal from being masked in the handler.
71 *
72 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
73 * Unix names RESETHAND and NODEFER respectively.
74 */
75#define SA_NOCLDSTOP 0x00000001U
76#define SA_NOCLDWAIT 0x00000002U
77#define SA_SIGINFO 0x00000004U
78#define SA_ONSTACK 0x08000000U
79#define SA_RESTART 0x10000000U
80#define SA_NODEFER 0x40000000U
81#define SA_RESETHAND 0x80000000U
82
83#define SA_NOMASK SA_NODEFER
84#define SA_ONESHOT SA_RESETHAND
85
86#define SA_RESTORER 0x04000000U
87
88/*
89 * sigaltstack controls
90 */
91#define SS_ONSTACK 1
92#define SS_DISABLE 2
93
94#define MINSIGSTKSZ 2048
95#define SIGSTKSZ 8192
96
97#include <asm-generic/signal-defs.h>
98
99struct old_sigaction {
100 __sighandler_t sa_handler;
101 old_sigset_t sa_mask;
102 unsigned long sa_flags;
103 __sigrestore_t sa_restorer;
104};
105
106struct sigaction {
107 __sighandler_t sa_handler;
108 unsigned long sa_flags;
109 __sigrestore_t sa_restorer;
110 sigset_t sa_mask; /* mask last for extensibility */
111};
112
113struct k_sigaction {
114 struct sigaction sa;
115};
116
117typedef struct sigaltstack {
118 void __user *ss_sp;
119 int ss_flags;
120 size_t ss_size;
121} stack_t;
122
123
124#ifndef __powerpc64__
125/*
126 * These are parameters to dbg_sigreturn syscall. They enable or
127 * disable certain debugging things that can be done from signal
128 * handlers. The dbg_sigreturn syscall *must* be called from a
129 * SA_SIGINFO signal so the ucontext can be passed to it. It takes an
130 * array of struct sig_dbg_op, which has the debug operations to
131 * perform before returning from the signal.
132 */
133struct sig_dbg_op {
134 int dbg_type;
135 unsigned long dbg_value;
136};
137
138/* Enable or disable single-stepping. The value sets the state. */
139#define SIG_DBG_SINGLE_STEPPING 1
140
141/* Enable or disable branch tracing. The value sets the state. */
142#define SIG_DBG_BRANCH_TRACING 2
143#endif /* ! __powerpc64__ */
144
145#endif /* _UAPI_ASM_POWERPC_SIGNAL_H */
diff --git a/arch/powerpc/include/uapi/asm/socket.h b/arch/powerpc/include/uapi/asm/socket.h
new file mode 100644
index 00000000000..3d5179bb122
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/socket.h
@@ -0,0 +1,79 @@
1#ifndef _ASM_POWERPC_SOCKET_H
2#define _ASM_POWERPC_SOCKET_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include <asm/sockios.h>
12
13/* For setsockopt(2) */
14#define SOL_SOCKET 1
15
16#define SO_DEBUG 1
17#define SO_REUSEADDR 2
18#define SO_TYPE 3
19#define SO_ERROR 4
20#define SO_DONTROUTE 5
21#define SO_BROADCAST 6
22#define SO_SNDBUF 7
23#define SO_RCVBUF 8
24#define SO_SNDBUFFORCE 32
25#define SO_RCVBUFFORCE 33
26#define SO_KEEPALIVE 9
27#define SO_OOBINLINE 10
28#define SO_NO_CHECK 11
29#define SO_PRIORITY 12
30#define SO_LINGER 13
31#define SO_BSDCOMPAT 14
32/* To add :#define SO_REUSEPORT 15 */
33#define SO_RCVLOWAT 16
34#define SO_SNDLOWAT 17
35#define SO_RCVTIMEO 18
36#define SO_SNDTIMEO 19
37#define SO_PASSCRED 20
38#define SO_PEERCRED 21
39
40/* Security levels - as per NRL IPv6 - don't actually do anything */
41#define SO_SECURITY_AUTHENTICATION 22
42#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
43#define SO_SECURITY_ENCRYPTION_NETWORK 24
44
45#define SO_BINDTODEVICE 25
46
47/* Socket filtering */
48#define SO_ATTACH_FILTER 26
49#define SO_DETACH_FILTER 27
50
51#define SO_PEERNAME 28
52#define SO_TIMESTAMP 29
53#define SCM_TIMESTAMP SO_TIMESTAMP
54
55#define SO_ACCEPTCONN 30
56
57#define SO_PEERSEC 31
58#define SO_PASSSEC 34
59#define SO_TIMESTAMPNS 35
60#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
61
62#define SO_MARK 36
63
64#define SO_TIMESTAMPING 37
65#define SCM_TIMESTAMPING SO_TIMESTAMPING
66
67#define SO_PROTOCOL 38
68#define SO_DOMAIN 39
69
70#define SO_RXQ_OVFL 40
71
72#define SO_WIFI_STATUS 41
73#define SCM_WIFI_STATUS SO_WIFI_STATUS
74#define SO_PEEK_OFF 42
75
76/* Instruct lower device to use last 4-bytes of skb data as FCS */
77#define SO_NOFCS 43
78
79#endif /* _ASM_POWERPC_SOCKET_H */
diff --git a/arch/powerpc/include/uapi/asm/sockios.h b/arch/powerpc/include/uapi/asm/sockios.h
new file mode 100644
index 00000000000..55cef7675a3
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/sockios.h
@@ -0,0 +1,20 @@
1#ifndef _ASM_POWERPC_SOCKIOS_H
2#define _ASM_POWERPC_SOCKIOS_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11/* Socket-level I/O control calls. */
12#define FIOSETOWN 0x8901
13#define SIOCSPGRP 0x8902
14#define FIOGETOWN 0x8903
15#define SIOCGPGRP 0x8904
16#define SIOCATMARK 0x8905
17#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
18#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
19
20#endif /* _ASM_POWERPC_SOCKIOS_H */
diff --git a/arch/powerpc/include/uapi/asm/spu_info.h b/arch/powerpc/include/uapi/asm/spu_info.h
new file mode 100644
index 00000000000..ed071bf9770
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/spu_info.h
@@ -0,0 +1,53 @@
1/*
2 * SPU info structures
3 *
4 * (C) Copyright 2006 IBM Corp.
5 *
6 * Author: Dwayne Grant McConnell <decimal@us.ibm.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#ifndef _UAPI_SPU_INFO_H
24#define _UAPI_SPU_INFO_H
25
26#include <linux/types.h>
27
28#ifndef __KERNEL__
29struct mfc_cq_sr {
30 __u64 mfc_cq_data0_RW;
31 __u64 mfc_cq_data1_RW;
32 __u64 mfc_cq_data2_RW;
33 __u64 mfc_cq_data3_RW;
34};
35#endif /* __KERNEL__ */
36
37struct spu_dma_info {
38 __u64 dma_info_type;
39 __u64 dma_info_mask;
40 __u64 dma_info_status;
41 __u64 dma_info_stall_and_notify;
42 __u64 dma_info_atomic_command_status;
43 struct mfc_cq_sr dma_info_command_data[16];
44};
45
46struct spu_proxydma_info {
47 __u64 proxydma_info_type;
48 __u64 proxydma_info_mask;
49 __u64 proxydma_info_status;
50 struct mfc_cq_sr proxydma_info_command_data[8];
51};
52
53#endif /* _UAPI_SPU_INFO_H */
diff --git a/arch/powerpc/include/uapi/asm/stat.h b/arch/powerpc/include/uapi/asm/stat.h
new file mode 100644
index 00000000000..84880b80cc1
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/stat.h
@@ -0,0 +1,81 @@
1#ifndef _ASM_POWERPC_STAT_H
2#define _ASM_POWERPC_STAT_H
3/*
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#include <linux/types.h>
10
11#define STAT_HAVE_NSEC 1
12
13#ifndef __powerpc64__
14struct __old_kernel_stat {
15 unsigned short st_dev;
16 unsigned short st_ino;
17 unsigned short st_mode;
18 unsigned short st_nlink;
19 unsigned short st_uid;
20 unsigned short st_gid;
21 unsigned short st_rdev;
22 unsigned long st_size;
23 unsigned long st_atime;
24 unsigned long st_mtime;
25 unsigned long st_ctime;
26};
27#endif /* !__powerpc64__ */
28
29struct stat {
30 unsigned long st_dev;
31 ino_t st_ino;
32#ifdef __powerpc64__
33 unsigned long st_nlink;
34 mode_t st_mode;
35#else
36 mode_t st_mode;
37 unsigned short st_nlink;
38#endif
39 uid_t st_uid;
40 gid_t st_gid;
41 unsigned long st_rdev;
42 off_t st_size;
43 unsigned long st_blksize;
44 unsigned long st_blocks;
45 unsigned long st_atime;
46 unsigned long st_atime_nsec;
47 unsigned long st_mtime;
48 unsigned long st_mtime_nsec;
49 unsigned long st_ctime;
50 unsigned long st_ctime_nsec;
51 unsigned long __unused4;
52 unsigned long __unused5;
53#ifdef __powerpc64__
54 unsigned long __unused6;
55#endif
56};
57
58/* This matches struct stat64 in glibc2.1. Only used for 32 bit. */
59struct stat64 {
60 unsigned long long st_dev; /* Device. */
61 unsigned long long st_ino; /* File serial number. */
62 unsigned int st_mode; /* File mode. */
63 unsigned int st_nlink; /* Link count. */
64 unsigned int st_uid; /* User ID of the file's owner. */
65 unsigned int st_gid; /* Group ID of the file's group. */
66 unsigned long long st_rdev; /* Device number, if device. */
67 unsigned short __pad2;
68 long long st_size; /* Size of file, in bytes. */
69 int st_blksize; /* Optimal block size for I/O. */
70 long long st_blocks; /* Number 512-byte blocks allocated. */
71 int st_atime; /* Time of last access. */
72 unsigned int st_atime_nsec;
73 int st_mtime; /* Time of last modification. */
74 unsigned int st_mtime_nsec;
75 int st_ctime; /* Time of last status change. */
76 unsigned int st_ctime_nsec;
77 unsigned int __unused4;
78 unsigned int __unused5;
79};
80
81#endif /* _ASM_POWERPC_STAT_H */
diff --git a/arch/powerpc/include/uapi/asm/statfs.h b/arch/powerpc/include/uapi/asm/statfs.h
new file mode 100644
index 00000000000..5244834583a
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/statfs.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_POWERPC_STATFS_H
2#define _ASM_POWERPC_STATFS_H
3
4#include <asm-generic/statfs.h>
5
6#endif
diff --git a/arch/powerpc/include/uapi/asm/swab.h b/arch/powerpc/include/uapi/asm/swab.h
new file mode 100644
index 00000000000..b6c368aa5c0
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/swab.h
@@ -0,0 +1,23 @@
1/*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version
5 * 2 of the License, or (at your option) any later version.
6 */
7#ifndef _UAPI_ASM_POWERPC_SWAB_H
8#define _UAPI_ASM_POWERPC_SWAB_H
9
10
11#include <linux/types.h>
12#include <linux/compiler.h>
13
14#ifdef __GNUC__
15
16#ifndef __powerpc64__
17#define __SWAB_64_THRU_32__
18#endif /* __powerpc64__ */
19
20
21#endif /* __GNUC__ */
22
23#endif /* _UAPI_ASM_POWERPC_SWAB_H */
diff --git a/arch/powerpc/include/uapi/asm/termbits.h b/arch/powerpc/include/uapi/asm/termbits.h
new file mode 100644
index 00000000000..549d700e18f
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/termbits.h
@@ -0,0 +1,210 @@
1#ifndef _ASM_POWERPC_TERMBITS_H
2#define _ASM_POWERPC_TERMBITS_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11typedef unsigned char cc_t;
12typedef unsigned int speed_t;
13typedef unsigned int tcflag_t;
14
15/*
16 * termios type and macro definitions. Be careful about adding stuff
17 * to this file since it's used in GNU libc and there are strict rules
18 * concerning namespace pollution.
19 */
20
21#define NCCS 19
22struct termios {
23 tcflag_t c_iflag; /* input mode flags */
24 tcflag_t c_oflag; /* output mode flags */
25 tcflag_t c_cflag; /* control mode flags */
26 tcflag_t c_lflag; /* local mode flags */
27 cc_t c_cc[NCCS]; /* control characters */
28 cc_t c_line; /* line discipline (== c_cc[19]) */
29 speed_t c_ispeed; /* input speed */
30 speed_t c_ospeed; /* output speed */
31};
32
33/* For PowerPC the termios and ktermios are the same */
34
35struct ktermios {
36 tcflag_t c_iflag; /* input mode flags */
37 tcflag_t c_oflag; /* output mode flags */
38 tcflag_t c_cflag; /* control mode flags */
39 tcflag_t c_lflag; /* local mode flags */
40 cc_t c_cc[NCCS]; /* control characters */
41 cc_t c_line; /* line discipline (== c_cc[19]) */
42 speed_t c_ispeed; /* input speed */
43 speed_t c_ospeed; /* output speed */
44};
45
46/* c_cc characters */
47#define VINTR 0
48#define VQUIT 1
49#define VERASE 2
50#define VKILL 3
51#define VEOF 4
52#define VMIN 5
53#define VEOL 6
54#define VTIME 7
55#define VEOL2 8
56#define VSWTC 9
57#define VWERASE 10
58#define VREPRINT 11
59#define VSUSP 12
60#define VSTART 13
61#define VSTOP 14
62#define VLNEXT 15
63#define VDISCARD 16
64
65/* c_iflag bits */
66#define IGNBRK 0000001
67#define BRKINT 0000002
68#define IGNPAR 0000004
69#define PARMRK 0000010
70#define INPCK 0000020
71#define ISTRIP 0000040
72#define INLCR 0000100
73#define IGNCR 0000200
74#define ICRNL 0000400
75#define IXON 0001000
76#define IXOFF 0002000
77#define IXANY 0004000
78#define IUCLC 0010000
79#define IMAXBEL 0020000
80#define IUTF8 0040000
81
82/* c_oflag bits */
83#define OPOST 0000001
84#define ONLCR 0000002
85#define OLCUC 0000004
86
87#define OCRNL 0000010
88#define ONOCR 0000020
89#define ONLRET 0000040
90
91#define OFILL 00000100
92#define OFDEL 00000200
93#define NLDLY 00001400
94#define NL0 00000000
95#define NL1 00000400
96#define NL2 00001000
97#define NL3 00001400
98#define TABDLY 00006000
99#define TAB0 00000000
100#define TAB1 00002000
101#define TAB2 00004000
102#define TAB3 00006000
103#define XTABS 00006000 /* required by POSIX to == TAB3 */
104#define CRDLY 00030000
105#define CR0 00000000
106#define CR1 00010000
107#define CR2 00020000
108#define CR3 00030000
109#define FFDLY 00040000
110#define FF0 00000000
111#define FF1 00040000
112#define BSDLY 00100000
113#define BS0 00000000
114#define BS1 00100000
115#define VTDLY 00200000
116#define VT0 00000000
117#define VT1 00200000
118
119/* c_cflag bit meaning */
120#define CBAUD 0000377
121#define B0 0000000 /* hang up */
122#define B50 0000001
123#define B75 0000002
124#define B110 0000003
125#define B134 0000004
126#define B150 0000005
127#define B200 0000006
128#define B300 0000007
129#define B600 0000010
130#define B1200 0000011
131#define B1800 0000012
132#define B2400 0000013
133#define B4800 0000014
134#define B9600 0000015
135#define B19200 0000016
136#define B38400 0000017
137#define EXTA B19200
138#define EXTB B38400
139#define CBAUDEX 0000000
140#define B57600 00020
141#define B115200 00021
142#define B230400 00022
143#define B460800 00023
144#define B500000 00024
145#define B576000 00025
146#define B921600 00026
147#define B1000000 00027
148#define B1152000 00030
149#define B1500000 00031
150#define B2000000 00032
151#define B2500000 00033
152#define B3000000 00034
153#define B3500000 00035
154#define B4000000 00036
155#define BOTHER 00037
156
157#define CIBAUD 077600000
158#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
159
160#define CSIZE 00001400
161#define CS5 00000000
162#define CS6 00000400
163#define CS7 00001000
164#define CS8 00001400
165
166#define CSTOPB 00002000
167#define CREAD 00004000
168#define PARENB 00010000
169#define PARODD 00020000
170#define HUPCL 00040000
171
172#define CLOCAL 00100000
173#define CMSPAR 010000000000 /* mark or space (stick) parity */
174#define CRTSCTS 020000000000 /* flow control */
175
176/* c_lflag bits */
177#define ISIG 0x00000080
178#define ICANON 0x00000100
179#define XCASE 0x00004000
180#define ECHO 0x00000008
181#define ECHOE 0x00000002
182#define ECHOK 0x00000004
183#define ECHONL 0x00000010
184#define NOFLSH 0x80000000
185#define TOSTOP 0x00400000
186#define ECHOCTL 0x00000040
187#define ECHOPRT 0x00000020
188#define ECHOKE 0x00000001
189#define FLUSHO 0x00800000
190#define PENDIN 0x20000000
191#define IEXTEN 0x00000400
192#define EXTPROC 0x10000000
193
194/* Values for the ACTION argument to `tcflow'. */
195#define TCOOFF 0
196#define TCOON 1
197#define TCIOFF 2
198#define TCION 3
199
200/* Values for the QUEUE_SELECTOR argument to `tcflush'. */
201#define TCIFLUSH 0
202#define TCOFLUSH 1
203#define TCIOFLUSH 2
204
205/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */
206#define TCSANOW 0
207#define TCSADRAIN 1
208#define TCSAFLUSH 2
209
210#endif /* _ASM_POWERPC_TERMBITS_H */
diff --git a/arch/powerpc/include/uapi/asm/termios.h b/arch/powerpc/include/uapi/asm/termios.h
new file mode 100644
index 00000000000..6cca5cdfec0
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/termios.h
@@ -0,0 +1,76 @@
1/*
2 * Liberally adapted from alpha/termios.h. In particular, the c_cc[]
3 * fields have been reordered so that termio & termios share the
4 * common subset in the same order (for brain dead programs that don't
5 * know or care about the differences).
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12#ifndef _UAPI_ASM_POWERPC_TERMIOS_H
13#define _UAPI_ASM_POWERPC_TERMIOS_H
14
15
16#include <asm/ioctls.h>
17#include <asm/termbits.h>
18
19struct sgttyb {
20 char sg_ispeed;
21 char sg_ospeed;
22 char sg_erase;
23 char sg_kill;
24 short sg_flags;
25};
26
27struct tchars {
28 char t_intrc;
29 char t_quitc;
30 char t_startc;
31 char t_stopc;
32 char t_eofc;
33 char t_brkc;
34};
35
36struct ltchars {
37 char t_suspc;
38 char t_dsuspc;
39 char t_rprntc;
40 char t_flushc;
41 char t_werasc;
42 char t_lnextc;
43};
44
45struct winsize {
46 unsigned short ws_row;
47 unsigned short ws_col;
48 unsigned short ws_xpixel;
49 unsigned short ws_ypixel;
50};
51
52#define NCC 10
53struct termio {
54 unsigned short c_iflag; /* input mode flags */
55 unsigned short c_oflag; /* output mode flags */
56 unsigned short c_cflag; /* control mode flags */
57 unsigned short c_lflag; /* local mode flags */
58 unsigned char c_line; /* line discipline */
59 unsigned char c_cc[NCC]; /* control characters */
60};
61
62/* c_cc characters */
63#define _VINTR 0
64#define _VQUIT 1
65#define _VERASE 2
66#define _VKILL 3
67#define _VEOF 4
68#define _VMIN 5
69#define _VEOL 6
70#define _VTIME 7
71#define _VEOL2 8
72#define _VSWTC 9
73
74
75
76#endif /* _UAPI_ASM_POWERPC_TERMIOS_H */
diff --git a/arch/powerpc/include/uapi/asm/types.h b/arch/powerpc/include/uapi/asm/types.h
new file mode 100644
index 00000000000..4b8ab990a3c
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/types.h
@@ -0,0 +1,40 @@
1/*
2 * This file is never included by application software unless
3 * explicitly requested (e.g., via linux/types.h) in which case the
4 * application is Linux specific so (user-) name space pollution is
5 * not a major issue. However, for interoperability, libraries still
6 * need to be careful to avoid a name clashes.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13#ifndef _UAPI_ASM_POWERPC_TYPES_H
14#define _UAPI_ASM_POWERPC_TYPES_H
15
16/*
17 * This is here because we used to use l64 for 64bit powerpc
18 * and we don't want to impact user mode with our change to ll64
19 * in the kernel.
20 *
21 * However, some user programs are fine with this. They can
22 * flag __SANE_USERSPACE_TYPES__ to get int-ll64.h here.
23 */
24#if !defined(__SANE_USERSPACE_TYPES__) && defined(__powerpc64__) && !defined(__KERNEL__)
25# include <asm-generic/int-l64.h>
26#else
27# include <asm-generic/int-ll64.h>
28#endif
29
30#ifndef __ASSEMBLY__
31
32
33typedef struct {
34 __u32 u[4];
35} __attribute__((aligned(16))) __vector128;
36
37#endif /* __ASSEMBLY__ */
38
39
40#endif /* _UAPI_ASM_POWERPC_TYPES_H */
diff --git a/arch/powerpc/include/uapi/asm/ucontext.h b/arch/powerpc/include/uapi/asm/ucontext.h
new file mode 100644
index 00000000000..d9a4ddf0cc8
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/ucontext.h
@@ -0,0 +1,40 @@
1#ifndef _ASM_POWERPC_UCONTEXT_H
2#define _ASM_POWERPC_UCONTEXT_H
3
4#ifdef __powerpc64__
5#include <asm/sigcontext.h>
6#else
7#include <asm/elf.h>
8#endif
9#include <asm/signal.h>
10
11#ifndef __powerpc64__
12struct mcontext {
13 elf_gregset_t mc_gregs;
14 elf_fpregset_t mc_fregs;
15 unsigned long mc_pad[2];
16 elf_vrregset_t mc_vregs __attribute__((__aligned__(16)));
17};
18#endif
19
20struct ucontext {
21 unsigned long uc_flags;
22 struct ucontext __user *uc_link;
23 stack_t uc_stack;
24#ifndef __powerpc64__
25 int uc_pad[7];
26 struct mcontext __user *uc_regs;/* points to uc_mcontext field */
27#endif
28 sigset_t uc_sigmask;
29 /* glibc has 1024-bit signal masks, ours are 64-bit */
30#ifdef __powerpc64__
31 sigset_t __unused[15]; /* Allow for uc_sigmask growth */
32 struct sigcontext uc_mcontext; /* last for extensibility */
33#else
34 int uc_maskext[30];
35 int uc_pad2[3];
36 struct mcontext uc_mcontext;
37#endif
38};
39
40#endif /* _ASM_POWERPC_UCONTEXT_H */
diff --git a/arch/powerpc/include/uapi/asm/unistd.h b/arch/powerpc/include/uapi/asm/unistd.h
new file mode 100644
index 00000000000..380b5d37a90
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/unistd.h
@@ -0,0 +1,380 @@
1/*
2 * This file contains the system call numbers.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#ifndef _UAPI_ASM_POWERPC_UNISTD_H_
10#define _UAPI_ASM_POWERPC_UNISTD_H_
11
12
13#define __NR_restart_syscall 0
14#define __NR_exit 1
15#define __NR_fork 2
16#define __NR_read 3
17#define __NR_write 4
18#define __NR_open 5
19#define __NR_close 6
20#define __NR_waitpid 7
21#define __NR_creat 8
22#define __NR_link 9
23#define __NR_unlink 10
24#define __NR_execve 11
25#define __NR_chdir 12
26#define __NR_time 13
27#define __NR_mknod 14
28#define __NR_chmod 15
29#define __NR_lchown 16
30#define __NR_break 17
31#define __NR_oldstat 18
32#define __NR_lseek 19
33#define __NR_getpid 20
34#define __NR_mount 21
35#define __NR_umount 22
36#define __NR_setuid 23
37#define __NR_getuid 24
38#define __NR_stime 25
39#define __NR_ptrace 26
40#define __NR_alarm 27
41#define __NR_oldfstat 28
42#define __NR_pause 29
43#define __NR_utime 30
44#define __NR_stty 31
45#define __NR_gtty 32
46#define __NR_access 33
47#define __NR_nice 34
48#define __NR_ftime 35
49#define __NR_sync 36
50#define __NR_kill 37
51#define __NR_rename 38
52#define __NR_mkdir 39
53#define __NR_rmdir 40
54#define __NR_dup 41
55#define __NR_pipe 42
56#define __NR_times 43
57#define __NR_prof 44
58#define __NR_brk 45
59#define __NR_setgid 46
60#define __NR_getgid 47
61#define __NR_signal 48
62#define __NR_geteuid 49
63#define __NR_getegid 50
64#define __NR_acct 51
65#define __NR_umount2 52
66#define __NR_lock 53
67#define __NR_ioctl 54
68#define __NR_fcntl 55
69#define __NR_mpx 56
70#define __NR_setpgid 57
71#define __NR_ulimit 58
72#define __NR_oldolduname 59
73#define __NR_umask 60
74#define __NR_chroot 61
75#define __NR_ustat 62
76#define __NR_dup2 63
77#define __NR_getppid 64
78#define __NR_getpgrp 65
79#define __NR_setsid 66
80#define __NR_sigaction 67
81#define __NR_sgetmask 68
82#define __NR_ssetmask 69
83#define __NR_setreuid 70
84#define __NR_setregid 71
85#define __NR_sigsuspend 72
86#define __NR_sigpending 73
87#define __NR_sethostname 74
88#define __NR_setrlimit 75
89#define __NR_getrlimit 76
90#define __NR_getrusage 77
91#define __NR_gettimeofday 78
92#define __NR_settimeofday 79
93#define __NR_getgroups 80
94#define __NR_setgroups 81
95#define __NR_select 82
96#define __NR_symlink 83
97#define __NR_oldlstat 84
98#define __NR_readlink 85
99#define __NR_uselib 86
100#define __NR_swapon 87
101#define __NR_reboot 88
102#define __NR_readdir 89
103#define __NR_mmap 90
104#define __NR_munmap 91
105#define __NR_truncate 92
106#define __NR_ftruncate 93
107#define __NR_fchmod 94
108#define __NR_fchown 95
109#define __NR_getpriority 96
110#define __NR_setpriority 97
111#define __NR_profil 98
112#define __NR_statfs 99
113#define __NR_fstatfs 100
114#define __NR_ioperm 101
115#define __NR_socketcall 102
116#define __NR_syslog 103
117#define __NR_setitimer 104
118#define __NR_getitimer 105
119#define __NR_stat 106
120#define __NR_lstat 107
121#define __NR_fstat 108
122#define __NR_olduname 109
123#define __NR_iopl 110
124#define __NR_vhangup 111
125#define __NR_idle 112
126#define __NR_vm86 113
127#define __NR_wait4 114
128#define __NR_swapoff 115
129#define __NR_sysinfo 116
130#define __NR_ipc 117
131#define __NR_fsync 118
132#define __NR_sigreturn 119
133#define __NR_clone 120
134#define __NR_setdomainname 121
135#define __NR_uname 122
136#define __NR_modify_ldt 123
137#define __NR_adjtimex 124
138#define __NR_mprotect 125
139#define __NR_sigprocmask 126
140#define __NR_create_module 127
141#define __NR_init_module 128
142#define __NR_delete_module 129
143#define __NR_get_kernel_syms 130
144#define __NR_quotactl 131
145#define __NR_getpgid 132
146#define __NR_fchdir 133
147#define __NR_bdflush 134
148#define __NR_sysfs 135
149#define __NR_personality 136
150#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
151#define __NR_setfsuid 138
152#define __NR_setfsgid 139
153#define __NR__llseek 140
154#define __NR_getdents 141
155#define __NR__newselect 142
156#define __NR_flock 143
157#define __NR_msync 144
158#define __NR_readv 145
159#define __NR_writev 146
160#define __NR_getsid 147
161#define __NR_fdatasync 148
162#define __NR__sysctl 149
163#define __NR_mlock 150
164#define __NR_munlock 151
165#define __NR_mlockall 152
166#define __NR_munlockall 153
167#define __NR_sched_setparam 154
168#define __NR_sched_getparam 155
169#define __NR_sched_setscheduler 156
170#define __NR_sched_getscheduler 157
171#define __NR_sched_yield 158
172#define __NR_sched_get_priority_max 159
173#define __NR_sched_get_priority_min 160
174#define __NR_sched_rr_get_interval 161
175#define __NR_nanosleep 162
176#define __NR_mremap 163
177#define __NR_setresuid 164
178#define __NR_getresuid 165
179#define __NR_query_module 166
180#define __NR_poll 167
181#define __NR_nfsservctl 168
182#define __NR_setresgid 169
183#define __NR_getresgid 170
184#define __NR_prctl 171
185#define __NR_rt_sigreturn 172
186#define __NR_rt_sigaction 173
187#define __NR_rt_sigprocmask 174
188#define __NR_rt_sigpending 175
189#define __NR_rt_sigtimedwait 176
190#define __NR_rt_sigqueueinfo 177
191#define __NR_rt_sigsuspend 178
192#define __NR_pread64 179
193#define __NR_pwrite64 180
194#define __NR_chown 181
195#define __NR_getcwd 182
196#define __NR_capget 183
197#define __NR_capset 184
198#define __NR_sigaltstack 185
199#define __NR_sendfile 186
200#define __NR_getpmsg 187 /* some people actually want streams */
201#define __NR_putpmsg 188 /* some people actually want streams */
202#define __NR_vfork 189
203#define __NR_ugetrlimit 190 /* SuS compliant getrlimit */
204#define __NR_readahead 191
205#ifndef __powerpc64__ /* these are 32-bit only */
206#define __NR_mmap2 192
207#define __NR_truncate64 193
208#define __NR_ftruncate64 194
209#define __NR_stat64 195
210#define __NR_lstat64 196
211#define __NR_fstat64 197
212#endif
213#define __NR_pciconfig_read 198
214#define __NR_pciconfig_write 199
215#define __NR_pciconfig_iobase 200
216#define __NR_multiplexer 201
217#define __NR_getdents64 202
218#define __NR_pivot_root 203
219#ifndef __powerpc64__
220#define __NR_fcntl64 204
221#endif
222#define __NR_madvise 205
223#define __NR_mincore 206
224#define __NR_gettid 207
225#define __NR_tkill 208
226#define __NR_setxattr 209
227#define __NR_lsetxattr 210
228#define __NR_fsetxattr 211
229#define __NR_getxattr 212
230#define __NR_lgetxattr 213
231#define __NR_fgetxattr 214
232#define __NR_listxattr 215
233#define __NR_llistxattr 216
234#define __NR_flistxattr 217
235#define __NR_removexattr 218
236#define __NR_lremovexattr 219
237#define __NR_fremovexattr 220
238#define __NR_futex 221
239#define __NR_sched_setaffinity 222
240#define __NR_sched_getaffinity 223
241/* 224 currently unused */
242#define __NR_tuxcall 225
243#ifndef __powerpc64__
244#define __NR_sendfile64 226
245#endif
246#define __NR_io_setup 227
247#define __NR_io_destroy 228
248#define __NR_io_getevents 229
249#define __NR_io_submit 230
250#define __NR_io_cancel 231
251#define __NR_set_tid_address 232
252#define __NR_fadvise64 233
253#define __NR_exit_group 234
254#define __NR_lookup_dcookie 235
255#define __NR_epoll_create 236
256#define __NR_epoll_ctl 237
257#define __NR_epoll_wait 238
258#define __NR_remap_file_pages 239
259#define __NR_timer_create 240
260#define __NR_timer_settime 241
261#define __NR_timer_gettime 242
262#define __NR_timer_getoverrun 243
263#define __NR_timer_delete 244
264#define __NR_clock_settime 245
265#define __NR_clock_gettime 246
266#define __NR_clock_getres 247
267#define __NR_clock_nanosleep 248
268#define __NR_swapcontext 249
269#define __NR_tgkill 250
270#define __NR_utimes 251
271#define __NR_statfs64 252
272#define __NR_fstatfs64 253
273#ifndef __powerpc64__
274#define __NR_fadvise64_64 254
275#endif
276#define __NR_rtas 255
277#define __NR_sys_debug_setcontext 256
278/* Number 257 is reserved for vserver */
279#define __NR_migrate_pages 258
280#define __NR_mbind 259
281#define __NR_get_mempolicy 260
282#define __NR_set_mempolicy 261
283#define __NR_mq_open 262
284#define __NR_mq_unlink 263
285#define __NR_mq_timedsend 264
286#define __NR_mq_timedreceive 265
287#define __NR_mq_notify 266
288#define __NR_mq_getsetattr 267
289#define __NR_kexec_load 268
290#define __NR_add_key 269
291#define __NR_request_key 270
292#define __NR_keyctl 271
293#define __NR_waitid 272
294#define __NR_ioprio_set 273
295#define __NR_ioprio_get 274
296#define __NR_inotify_init 275
297#define __NR_inotify_add_watch 276
298#define __NR_inotify_rm_watch 277
299#define __NR_spu_run 278
300#define __NR_spu_create 279
301#define __NR_pselect6 280
302#define __NR_ppoll 281
303#define __NR_unshare 282
304#define __NR_splice 283
305#define __NR_tee 284
306#define __NR_vmsplice 285
307#define __NR_openat 286
308#define __NR_mkdirat 287
309#define __NR_mknodat 288
310#define __NR_fchownat 289
311#define __NR_futimesat 290
312#ifdef __powerpc64__
313#define __NR_newfstatat 291
314#else
315#define __NR_fstatat64 291
316#endif
317#define __NR_unlinkat 292
318#define __NR_renameat 293
319#define __NR_linkat 294
320#define __NR_symlinkat 295
321#define __NR_readlinkat 296
322#define __NR_fchmodat 297
323#define __NR_faccessat 298
324#define __NR_get_robust_list 299
325#define __NR_set_robust_list 300
326#define __NR_move_pages 301
327#define __NR_getcpu 302
328#define __NR_epoll_pwait 303
329#define __NR_utimensat 304
330#define __NR_signalfd 305
331#define __NR_timerfd_create 306
332#define __NR_eventfd 307
333#define __NR_sync_file_range2 308
334#define __NR_fallocate 309
335#define __NR_subpage_prot 310
336#define __NR_timerfd_settime 311
337#define __NR_timerfd_gettime 312
338#define __NR_signalfd4 313
339#define __NR_eventfd2 314
340#define __NR_epoll_create1 315
341#define __NR_dup3 316
342#define __NR_pipe2 317
343#define __NR_inotify_init1 318
344#define __NR_perf_event_open 319
345#define __NR_preadv 320
346#define __NR_pwritev 321
347#define __NR_rt_tgsigqueueinfo 322
348#define __NR_fanotify_init 323
349#define __NR_fanotify_mark 324
350#define __NR_prlimit64 325
351#define __NR_socket 326
352#define __NR_bind 327
353#define __NR_connect 328
354#define __NR_listen 329
355#define __NR_accept 330
356#define __NR_getsockname 331
357#define __NR_getpeername 332
358#define __NR_socketpair 333
359#define __NR_send 334
360#define __NR_sendto 335
361#define __NR_recv 336
362#define __NR_recvfrom 337
363#define __NR_shutdown 338
364#define __NR_setsockopt 339
365#define __NR_getsockopt 340
366#define __NR_sendmsg 341
367#define __NR_recvmsg 342
368#define __NR_recvmmsg 343
369#define __NR_accept4 344
370#define __NR_name_to_handle_at 345
371#define __NR_open_by_handle_at 346
372#define __NR_clock_adjtime 347
373#define __NR_syncfs 348
374#define __NR_sendmmsg 349
375#define __NR_setns 350
376#define __NR_process_vm_readv 351
377#define __NR_process_vm_writev 352
378
379
380#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */