diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /arch/powerpc/include/asm | |
parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) |
Diffstat (limited to 'arch/powerpc/include/asm')
47 files changed, 3679 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/abs_addr.h b/arch/powerpc/include/asm/abs_addr.h new file mode 100644 index 00000000000..5ab0b71531b --- /dev/null +++ b/arch/powerpc/include/asm/abs_addr.h | |||
@@ -0,0 +1,75 @@ | |||
1 | #ifndef _ASM_POWERPC_ABS_ADDR_H | ||
2 | #define _ASM_POWERPC_ABS_ADDR_H | ||
3 | #ifdef __KERNEL__ | ||
4 | |||
5 | |||
6 | /* | ||
7 | * c 2001 PPC 64 Team, IBM Corp | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * as published by the Free Software Foundation; either version | ||
12 | * 2 of the License, or (at your option) any later version. | ||
13 | */ | ||
14 | |||
15 | #include <linux/memblock.h> | ||
16 | |||
17 | #include <asm/types.h> | ||
18 | #include <asm/page.h> | ||
19 | #include <asm/prom.h> | ||
20 | #include <asm/firmware.h> | ||
21 | |||
22 | struct mschunks_map { | ||
23 | unsigned long num_chunks; | ||
24 | unsigned long chunk_size; | ||
25 | unsigned long chunk_shift; | ||
26 | unsigned long chunk_mask; | ||
27 | u32 *mapping; | ||
28 | }; | ||
29 | |||
30 | extern struct mschunks_map mschunks_map; | ||
31 | |||
32 | /* Chunks are 256 KB */ | ||
33 | #define MSCHUNKS_CHUNK_SHIFT (18) | ||
34 | #define MSCHUNKS_CHUNK_SIZE (1UL << MSCHUNKS_CHUNK_SHIFT) | ||
35 | #define MSCHUNKS_OFFSET_MASK (MSCHUNKS_CHUNK_SIZE - 1) | ||
36 | |||
37 | static inline unsigned long chunk_to_addr(unsigned long chunk) | ||
38 | { | ||
39 | return chunk << MSCHUNKS_CHUNK_SHIFT; | ||
40 | } | ||
41 | |||
42 | static inline unsigned long addr_to_chunk(unsigned long addr) | ||
43 | { | ||
44 | return addr >> MSCHUNKS_CHUNK_SHIFT; | ||
45 | } | ||
46 | |||
47 | static inline unsigned long phys_to_abs(unsigned long pa) | ||
48 | { | ||
49 | unsigned long chunk; | ||
50 | |||
51 | /* This is a no-op on non-iSeries */ | ||
52 | if (!firmware_has_feature(FW_FEATURE_ISERIES)) | ||
53 | return pa; | ||
54 | |||
55 | chunk = addr_to_chunk(pa); | ||
56 | |||
57 | if (chunk < mschunks_map.num_chunks) | ||
58 | chunk = mschunks_map.mapping[chunk]; | ||
59 | |||
60 | return chunk_to_addr(chunk) + (pa & MSCHUNKS_OFFSET_MASK); | ||
61 | } | ||
62 | |||
63 | /* Convenience macros */ | ||
64 | #define virt_to_abs(va) phys_to_abs(__pa(va)) | ||
65 | #define abs_to_virt(aa) __va(aa) | ||
66 | |||
67 | /* | ||
68 | * Converts Virtual Address to Real Address for | ||
69 | * Legacy iSeries Hypervisor calls | ||
70 | */ | ||
71 | #define iseries_hv_addr(virtaddr) \ | ||
72 | (0x8000000000000000UL | virt_to_abs(virtaddr)) | ||
73 | |||
74 | #endif /* __KERNEL__ */ | ||
75 | #endif /* _ASM_POWERPC_ABS_ADDR_H */ | ||
diff --git a/arch/powerpc/include/asm/auxvec.h b/arch/powerpc/include/asm/auxvec.h new file mode 100644 index 00000000000..19a099b62cd --- /dev/null +++ b/arch/powerpc/include/asm/auxvec.h | |||
@@ -0,0 +1,19 @@ | |||
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 | #endif | ||
diff --git a/arch/powerpc/include/asm/bitsperlong.h b/arch/powerpc/include/asm/bitsperlong.h new file mode 100644 index 00000000000..5f1659032c4 --- /dev/null +++ b/arch/powerpc/include/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/asm/byteorder.h b/arch/powerpc/include/asm/byteorder.h new file mode 100644 index 00000000000..aa6cc4fac96 --- /dev/null +++ b/arch/powerpc/include/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/asm/errno.h b/arch/powerpc/include/asm/errno.h new file mode 100644 index 00000000000..8c145fd17d8 --- /dev/null +++ b/arch/powerpc/include/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/asm/fcntl.h b/arch/powerpc/include/asm/fcntl.h new file mode 100644 index 00000000000..ce5c4516d40 --- /dev/null +++ b/arch/powerpc/include/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/asm/ioctl.h b/arch/powerpc/include/asm/ioctl.h new file mode 100644 index 00000000000..57d68304218 --- /dev/null +++ b/arch/powerpc/include/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/asm/ioctls.h b/arch/powerpc/include/asm/ioctls.h new file mode 100644 index 00000000000..e9b78870aaa --- /dev/null +++ b/arch/powerpc/include/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/asm/ipcbuf.h b/arch/powerpc/include/asm/ipcbuf.h new file mode 100644 index 00000000000..2c3e1d94db1 --- /dev/null +++ b/arch/powerpc/include/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 | |||
20 | struct 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/asm/iseries/alpaca.h b/arch/powerpc/include/asm/iseries/alpaca.h new file mode 100644 index 00000000000..c0cce6727a6 --- /dev/null +++ b/arch/powerpc/include/asm/iseries/alpaca.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * Copyright © 2008 Stephen Rothwell IBM Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | */ | ||
18 | #ifndef _ASM_POWERPC_ISERIES_ALPACA_H | ||
19 | #define _ASM_POWERPC_ISERIES_ALPACA_H | ||
20 | |||
21 | /* | ||
22 | * This is the part of the paca that the iSeries hypervisor | ||
23 | * needs to be statically initialised. Immediately after boot | ||
24 | * we switch to the normal Linux paca. | ||
25 | */ | ||
26 | struct alpaca { | ||
27 | struct lppaca *lppaca_ptr; /* Pointer to LpPaca for PLIC */ | ||
28 | const void *reg_save_ptr; /* Pointer to LpRegSave for PLIC */ | ||
29 | }; | ||
30 | |||
31 | #endif /* _ASM_POWERPC_ISERIES_ALPACA_H */ | ||
diff --git a/arch/powerpc/include/asm/iseries/hv_call.h b/arch/powerpc/include/asm/iseries/hv_call.h new file mode 100644 index 00000000000..162d653ad51 --- /dev/null +++ b/arch/powerpc/include/asm/iseries/hv_call.h | |||
@@ -0,0 +1,111 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | * | ||
18 | * This file contains the "hypervisor call" interface which is used to | ||
19 | * drive the hypervisor from the OS. | ||
20 | */ | ||
21 | #ifndef _ASM_POWERPC_ISERIES_HV_CALL_H | ||
22 | #define _ASM_POWERPC_ISERIES_HV_CALL_H | ||
23 | |||
24 | #include <asm/iseries/hv_call_sc.h> | ||
25 | #include <asm/iseries/hv_types.h> | ||
26 | #include <asm/paca.h> | ||
27 | |||
28 | /* Type of yield for HvCallBaseYieldProcessor */ | ||
29 | #define HvCall_YieldTimed 0 /* Yield until specified time (tb) */ | ||
30 | #define HvCall_YieldToActive 1 /* Yield until all active procs have run */ | ||
31 | #define HvCall_YieldToProc 2 /* Yield until the specified processor has run */ | ||
32 | |||
33 | /* interrupt masks for setEnabledInterrupts */ | ||
34 | #define HvCall_MaskIPI 0x00000001 | ||
35 | #define HvCall_MaskLpEvent 0x00000002 | ||
36 | #define HvCall_MaskLpProd 0x00000004 | ||
37 | #define HvCall_MaskTimeout 0x00000008 | ||
38 | |||
39 | /* Log buffer formats */ | ||
40 | #define HvCall_LogBuffer_ASCII 0 | ||
41 | #define HvCall_LogBuffer_EBCDIC 1 | ||
42 | |||
43 | #define HvCallBaseAckDeferredInts HvCallBase + 0 | ||
44 | #define HvCallBaseCpmPowerOff HvCallBase + 1 | ||
45 | #define HvCallBaseGetHwPatch HvCallBase + 2 | ||
46 | #define HvCallBaseReIplSpAttn HvCallBase + 3 | ||
47 | #define HvCallBaseSetASR HvCallBase + 4 | ||
48 | #define HvCallBaseSetASRAndRfi HvCallBase + 5 | ||
49 | #define HvCallBaseSetIMR HvCallBase + 6 | ||
50 | #define HvCallBaseSendIPI HvCallBase + 7 | ||
51 | #define HvCallBaseTerminateMachine HvCallBase + 8 | ||
52 | #define HvCallBaseTerminateMachineSrc HvCallBase + 9 | ||
53 | #define HvCallBaseProcessPlicInterrupts HvCallBase + 10 | ||
54 | #define HvCallBaseIsPrimaryCpmOrMsdIpl HvCallBase + 11 | ||
55 | #define HvCallBaseSetVirtualSIT HvCallBase + 12 | ||
56 | #define HvCallBaseVaryOffThisProcessor HvCallBase + 13 | ||
57 | #define HvCallBaseVaryOffMemoryChunk HvCallBase + 14 | ||
58 | #define HvCallBaseVaryOffInteractivePercentage HvCallBase + 15 | ||
59 | #define HvCallBaseSendLpProd HvCallBase + 16 | ||
60 | #define HvCallBaseSetEnabledInterrupts HvCallBase + 17 | ||
61 | #define HvCallBaseYieldProcessor HvCallBase + 18 | ||
62 | #define HvCallBaseVaryOffSharedProcUnits HvCallBase + 19 | ||
63 | #define HvCallBaseSetVirtualDecr HvCallBase + 20 | ||
64 | #define HvCallBaseClearLogBuffer HvCallBase + 21 | ||
65 | #define HvCallBaseGetLogBufferCodePage HvCallBase + 22 | ||
66 | #define HvCallBaseGetLogBufferFormat HvCallBase + 23 | ||
67 | #define HvCallBaseGetLogBufferLength HvCallBase + 24 | ||
68 | #define HvCallBaseReadLogBuffer HvCallBase + 25 | ||
69 | #define HvCallBaseSetLogBufferFormatAndCodePage HvCallBase + 26 | ||
70 | #define HvCallBaseWriteLogBuffer HvCallBase + 27 | ||
71 | #define HvCallBaseRouter28 HvCallBase + 28 | ||
72 | #define HvCallBaseRouter29 HvCallBase + 29 | ||
73 | #define HvCallBaseRouter30 HvCallBase + 30 | ||
74 | #define HvCallBaseSetDebugBus HvCallBase + 31 | ||
75 | |||
76 | #define HvCallCcSetDABR HvCallCc + 7 | ||
77 | |||
78 | static inline void HvCall_setVirtualDecr(void) | ||
79 | { | ||
80 | /* | ||
81 | * Ignore any error return codes - most likely means that the | ||
82 | * target value for the LP has been increased and this vary off | ||
83 | * would bring us below the new target. | ||
84 | */ | ||
85 | HvCall0(HvCallBaseSetVirtualDecr); | ||
86 | } | ||
87 | |||
88 | static inline void HvCall_yieldProcessor(unsigned typeOfYield, u64 yieldParm) | ||
89 | { | ||
90 | HvCall2(HvCallBaseYieldProcessor, typeOfYield, yieldParm); | ||
91 | } | ||
92 | |||
93 | static inline void HvCall_setEnabledInterrupts(u64 enabledInterrupts) | ||
94 | { | ||
95 | HvCall1(HvCallBaseSetEnabledInterrupts, enabledInterrupts); | ||
96 | } | ||
97 | |||
98 | static inline void HvCall_setLogBufferFormatAndCodepage(int format, | ||
99 | u32 codePage) | ||
100 | { | ||
101 | HvCall2(HvCallBaseSetLogBufferFormatAndCodePage, format, codePage); | ||
102 | } | ||
103 | |||
104 | extern void HvCall_writeLogBuffer(const void *buffer, u64 bufLen); | ||
105 | |||
106 | static inline void HvCall_sendIPI(struct paca_struct *targetPaca) | ||
107 | { | ||
108 | HvCall1(HvCallBaseSendIPI, targetPaca->paca_index); | ||
109 | } | ||
110 | |||
111 | #endif /* _ASM_POWERPC_ISERIES_HV_CALL_H */ | ||
diff --git a/arch/powerpc/include/asm/iseries/hv_call_event.h b/arch/powerpc/include/asm/iseries/hv_call_event.h new file mode 100644 index 00000000000..cc029d388e1 --- /dev/null +++ b/arch/powerpc/include/asm/iseries/hv_call_event.h | |||
@@ -0,0 +1,201 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | * | ||
18 | * This file contains the "hypervisor call" interface which is used to | ||
19 | * drive the hypervisor from the OS. | ||
20 | */ | ||
21 | #ifndef _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H | ||
22 | #define _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H | ||
23 | |||
24 | #include <linux/types.h> | ||
25 | #include <linux/dma-mapping.h> | ||
26 | |||
27 | #include <asm/iseries/hv_call_sc.h> | ||
28 | #include <asm/iseries/hv_types.h> | ||
29 | #include <asm/abs_addr.h> | ||
30 | |||
31 | struct HvLpEvent; | ||
32 | |||
33 | typedef u8 HvLpEvent_Type; | ||
34 | typedef u8 HvLpEvent_AckInd; | ||
35 | typedef u8 HvLpEvent_AckType; | ||
36 | |||
37 | typedef u8 HvLpDma_Direction; | ||
38 | typedef u8 HvLpDma_AddressType; | ||
39 | |||
40 | typedef u64 HvLpEvent_Rc; | ||
41 | typedef u64 HvLpDma_Rc; | ||
42 | |||
43 | #define HvCallEventAckLpEvent HvCallEvent + 0 | ||
44 | #define HvCallEventCancelLpEvent HvCallEvent + 1 | ||
45 | #define HvCallEventCloseLpEventPath HvCallEvent + 2 | ||
46 | #define HvCallEventDmaBufList HvCallEvent + 3 | ||
47 | #define HvCallEventDmaSingle HvCallEvent + 4 | ||
48 | #define HvCallEventDmaToSp HvCallEvent + 5 | ||
49 | #define HvCallEventGetOverflowLpEvents HvCallEvent + 6 | ||
50 | #define HvCallEventGetSourceLpInstanceId HvCallEvent + 7 | ||
51 | #define HvCallEventGetTargetLpInstanceId HvCallEvent + 8 | ||
52 | #define HvCallEventOpenLpEventPath HvCallEvent + 9 | ||
53 | #define HvCallEventSetLpEventStack HvCallEvent + 10 | ||
54 | #define HvCallEventSignalLpEvent HvCallEvent + 11 | ||
55 | #define HvCallEventSignalLpEventParms HvCallEvent + 12 | ||
56 | #define HvCallEventSetInterLpQueueIndex HvCallEvent + 13 | ||
57 | #define HvCallEventSetLpEventQueueInterruptProc HvCallEvent + 14 | ||
58 | #define HvCallEventRouter15 HvCallEvent + 15 | ||
59 | |||
60 | static inline void HvCallEvent_getOverflowLpEvents(u8 queueIndex) | ||
61 | { | ||
62 | HvCall1(HvCallEventGetOverflowLpEvents, queueIndex); | ||
63 | } | ||
64 | |||
65 | static inline void HvCallEvent_setInterLpQueueIndex(u8 queueIndex) | ||
66 | { | ||
67 | HvCall1(HvCallEventSetInterLpQueueIndex, queueIndex); | ||
68 | } | ||
69 | |||
70 | static inline void HvCallEvent_setLpEventStack(u8 queueIndex, | ||
71 | char *eventStackAddr, u32 eventStackSize) | ||
72 | { | ||
73 | HvCall3(HvCallEventSetLpEventStack, queueIndex, | ||
74 | virt_to_abs(eventStackAddr), eventStackSize); | ||
75 | } | ||
76 | |||
77 | static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex, | ||
78 | u16 lpLogicalProcIndex) | ||
79 | { | ||
80 | HvCall2(HvCallEventSetLpEventQueueInterruptProc, queueIndex, | ||
81 | lpLogicalProcIndex); | ||
82 | } | ||
83 | |||
84 | static inline HvLpEvent_Rc HvCallEvent_signalLpEvent(struct HvLpEvent *event) | ||
85 | { | ||
86 | return HvCall1(HvCallEventSignalLpEvent, virt_to_abs(event)); | ||
87 | } | ||
88 | |||
89 | static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp, | ||
90 | HvLpEvent_Type type, u16 subtype, HvLpEvent_AckInd ackInd, | ||
91 | HvLpEvent_AckType ackType, HvLpInstanceId sourceInstanceId, | ||
92 | HvLpInstanceId targetInstanceId, u64 correlationToken, | ||
93 | u64 eventData1, u64 eventData2, u64 eventData3, | ||
94 | u64 eventData4, u64 eventData5) | ||
95 | { | ||
96 | /* Pack the misc bits into a single Dword to pass to PLIC */ | ||
97 | union { | ||
98 | struct { | ||
99 | u8 ack_and_target; | ||
100 | u8 type; | ||
101 | u16 subtype; | ||
102 | HvLpInstanceId src_inst; | ||
103 | HvLpInstanceId target_inst; | ||
104 | } parms; | ||
105 | u64 dword; | ||
106 | } packed; | ||
107 | |||
108 | packed.parms.ack_and_target = (ackType << 7) | (ackInd << 6) | targetLp; | ||
109 | packed.parms.type = type; | ||
110 | packed.parms.subtype = subtype; | ||
111 | packed.parms.src_inst = sourceInstanceId; | ||
112 | packed.parms.target_inst = targetInstanceId; | ||
113 | |||
114 | return HvCall7(HvCallEventSignalLpEventParms, packed.dword, | ||
115 | correlationToken, eventData1, eventData2, | ||
116 | eventData3, eventData4, eventData5); | ||
117 | } | ||
118 | |||
119 | extern void *iseries_hv_alloc(size_t size, dma_addr_t *dma_handle, gfp_t flag); | ||
120 | extern void iseries_hv_free(size_t size, void *vaddr, dma_addr_t dma_handle); | ||
121 | extern dma_addr_t iseries_hv_map(void *vaddr, size_t size, | ||
122 | enum dma_data_direction direction); | ||
123 | extern void iseries_hv_unmap(dma_addr_t dma_handle, size_t size, | ||
124 | enum dma_data_direction direction); | ||
125 | |||
126 | static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event) | ||
127 | { | ||
128 | return HvCall1(HvCallEventAckLpEvent, virt_to_abs(event)); | ||
129 | } | ||
130 | |||
131 | static inline HvLpEvent_Rc HvCallEvent_cancelLpEvent(struct HvLpEvent *event) | ||
132 | { | ||
133 | return HvCall1(HvCallEventCancelLpEvent, virt_to_abs(event)); | ||
134 | } | ||
135 | |||
136 | static inline HvLpInstanceId HvCallEvent_getSourceLpInstanceId( | ||
137 | HvLpIndex targetLp, HvLpEvent_Type type) | ||
138 | { | ||
139 | return HvCall2(HvCallEventGetSourceLpInstanceId, targetLp, type); | ||
140 | } | ||
141 | |||
142 | static inline HvLpInstanceId HvCallEvent_getTargetLpInstanceId( | ||
143 | HvLpIndex targetLp, HvLpEvent_Type type) | ||
144 | { | ||
145 | return HvCall2(HvCallEventGetTargetLpInstanceId, targetLp, type); | ||
146 | } | ||
147 | |||
148 | static inline void HvCallEvent_openLpEventPath(HvLpIndex targetLp, | ||
149 | HvLpEvent_Type type) | ||
150 | { | ||
151 | HvCall2(HvCallEventOpenLpEventPath, targetLp, type); | ||
152 | } | ||
153 | |||
154 | static inline void HvCallEvent_closeLpEventPath(HvLpIndex targetLp, | ||
155 | HvLpEvent_Type type) | ||
156 | { | ||
157 | HvCall2(HvCallEventCloseLpEventPath, targetLp, type); | ||
158 | } | ||
159 | |||
160 | static inline HvLpDma_Rc HvCallEvent_dmaBufList(HvLpEvent_Type type, | ||
161 | HvLpIndex remoteLp, HvLpDma_Direction direction, | ||
162 | HvLpInstanceId localInstanceId, | ||
163 | HvLpInstanceId remoteInstanceId, | ||
164 | HvLpDma_AddressType localAddressType, | ||
165 | HvLpDma_AddressType remoteAddressType, | ||
166 | /* Do these need to be converted to absolute addresses? */ | ||
167 | u64 localBufList, u64 remoteBufList, u32 transferLength) | ||
168 | { | ||
169 | /* Pack the misc bits into a single Dword to pass to PLIC */ | ||
170 | union { | ||
171 | struct { | ||
172 | u8 flags; | ||
173 | HvLpIndex remote; | ||
174 | u8 type; | ||
175 | u8 reserved; | ||
176 | HvLpInstanceId local_inst; | ||
177 | HvLpInstanceId remote_inst; | ||
178 | } parms; | ||
179 | u64 dword; | ||
180 | } packed; | ||
181 | |||
182 | packed.parms.flags = (direction << 7) | | ||
183 | (localAddressType << 6) | (remoteAddressType << 5); | ||
184 | packed.parms.remote = remoteLp; | ||
185 | packed.parms.type = type; | ||
186 | packed.parms.reserved = 0; | ||
187 | packed.parms.local_inst = localInstanceId; | ||
188 | packed.parms.remote_inst = remoteInstanceId; | ||
189 | |||
190 | return HvCall4(HvCallEventDmaBufList, packed.dword, localBufList, | ||
191 | remoteBufList, transferLength); | ||
192 | } | ||
193 | |||
194 | static inline HvLpDma_Rc HvCallEvent_dmaToSp(void *local, u32 remote, | ||
195 | u32 length, HvLpDma_Direction dir) | ||
196 | { | ||
197 | return HvCall4(HvCallEventDmaToSp, virt_to_abs(local), remote, | ||
198 | length, dir); | ||
199 | } | ||
200 | |||
201 | #endif /* _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H */ | ||
diff --git a/arch/powerpc/include/asm/iseries/hv_call_sc.h b/arch/powerpc/include/asm/iseries/hv_call_sc.h new file mode 100644 index 00000000000..f5d21095925 --- /dev/null +++ b/arch/powerpc/include/asm/iseries/hv_call_sc.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | */ | ||
18 | #ifndef _ASM_POWERPC_ISERIES_HV_CALL_SC_H | ||
19 | #define _ASM_POWERPC_ISERIES_HV_CALL_SC_H | ||
20 | |||
21 | #include <linux/types.h> | ||
22 | |||
23 | #define HvCallBase 0x8000000000000000ul | ||
24 | #define HvCallCc 0x8001000000000000ul | ||
25 | #define HvCallCfg 0x8002000000000000ul | ||
26 | #define HvCallEvent 0x8003000000000000ul | ||
27 | #define HvCallHpt 0x8004000000000000ul | ||
28 | #define HvCallPci 0x8005000000000000ul | ||
29 | #define HvCallSm 0x8007000000000000ul | ||
30 | #define HvCallXm 0x8009000000000000ul | ||
31 | |||
32 | extern u64 HvCall0(u64); | ||
33 | extern u64 HvCall1(u64, u64); | ||
34 | extern u64 HvCall2(u64, u64, u64); | ||
35 | extern u64 HvCall3(u64, u64, u64, u64); | ||
36 | extern u64 HvCall4(u64, u64, u64, u64, u64); | ||
37 | extern u64 HvCall5(u64, u64, u64, u64, u64, u64); | ||
38 | extern u64 HvCall6(u64, u64, u64, u64, u64, u64, u64); | ||
39 | extern u64 HvCall7(u64, u64, u64, u64, u64, u64, u64, u64); | ||
40 | |||
41 | extern u64 HvCall0Ret16(u64, void *); | ||
42 | extern u64 HvCall1Ret16(u64, void *, u64); | ||
43 | extern u64 HvCall2Ret16(u64, void *, u64, u64); | ||
44 | extern u64 HvCall3Ret16(u64, void *, u64, u64, u64); | ||
45 | extern u64 HvCall4Ret16(u64, void *, u64, u64, u64, u64); | ||
46 | extern u64 HvCall5Ret16(u64, void *, u64, u64, u64, u64, u64); | ||
47 | extern u64 HvCall6Ret16(u64, void *, u64, u64, u64, u64, u64, u64); | ||
48 | extern u64 HvCall7Ret16(u64, void *, u64, u64 ,u64 ,u64 ,u64 ,u64 ,u64); | ||
49 | |||
50 | #endif /* _ASM_POWERPC_ISERIES_HV_CALL_SC_H */ | ||
diff --git a/arch/powerpc/include/asm/iseries/hv_call_xm.h b/arch/powerpc/include/asm/iseries/hv_call_xm.h new file mode 100644 index 00000000000..392ac3f54df --- /dev/null +++ b/arch/powerpc/include/asm/iseries/hv_call_xm.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * This file contains the "hypervisor call" interface which is used to | ||
3 | * drive the hypervisor from SLIC. | ||
4 | */ | ||
5 | #ifndef _ASM_POWERPC_ISERIES_HV_CALL_XM_H | ||
6 | #define _ASM_POWERPC_ISERIES_HV_CALL_XM_H | ||
7 | |||
8 | #include <asm/iseries/hv_call_sc.h> | ||
9 | #include <asm/iseries/hv_types.h> | ||
10 | |||
11 | #define HvCallXmGetTceTableParms HvCallXm + 0 | ||
12 | #define HvCallXmTestBus HvCallXm + 1 | ||
13 | #define HvCallXmConnectBusUnit HvCallXm + 2 | ||
14 | #define HvCallXmLoadTod HvCallXm + 8 | ||
15 | #define HvCallXmTestBusUnit HvCallXm + 9 | ||
16 | #define HvCallXmSetTce HvCallXm + 11 | ||
17 | #define HvCallXmSetTces HvCallXm + 13 | ||
18 | |||
19 | static inline void HvCallXm_getTceTableParms(u64 cb) | ||
20 | { | ||
21 | HvCall1(HvCallXmGetTceTableParms, cb); | ||
22 | } | ||
23 | |||
24 | static inline u64 HvCallXm_setTce(u64 tceTableToken, u64 tceOffset, u64 tce) | ||
25 | { | ||
26 | return HvCall3(HvCallXmSetTce, tceTableToken, tceOffset, tce); | ||
27 | } | ||
28 | |||
29 | static inline u64 HvCallXm_setTces(u64 tceTableToken, u64 tceOffset, | ||
30 | u64 numTces, u64 tce1, u64 tce2, u64 tce3, u64 tce4) | ||
31 | { | ||
32 | return HvCall7(HvCallXmSetTces, tceTableToken, tceOffset, numTces, | ||
33 | tce1, tce2, tce3, tce4); | ||
34 | } | ||
35 | |||
36 | static inline u64 HvCallXm_testBus(u16 busNumber) | ||
37 | { | ||
38 | return HvCall1(HvCallXmTestBus, busNumber); | ||
39 | } | ||
40 | |||
41 | static inline u64 HvCallXm_testBusUnit(u16 busNumber, u8 subBusNumber, | ||
42 | u8 deviceId) | ||
43 | { | ||
44 | return HvCall2(HvCallXmTestBusUnit, busNumber, | ||
45 | (subBusNumber << 8) | deviceId); | ||
46 | } | ||
47 | |||
48 | static inline u64 HvCallXm_connectBusUnit(u16 busNumber, u8 subBusNumber, | ||
49 | u8 deviceId, u64 interruptToken) | ||
50 | { | ||
51 | return HvCall5(HvCallXmConnectBusUnit, busNumber, | ||
52 | (subBusNumber << 8) | deviceId, interruptToken, 0, | ||
53 | 0 /* HvLpConfig::mapDsaToQueueIndex(HvLpDSA(busNumber, xBoard, xCard)) */); | ||
54 | } | ||
55 | |||
56 | static inline u64 HvCallXm_loadTod(void) | ||
57 | { | ||
58 | return HvCall0(HvCallXmLoadTod); | ||
59 | } | ||
60 | |||
61 | #endif /* _ASM_POWERPC_ISERIES_HV_CALL_XM_H */ | ||
diff --git a/arch/powerpc/include/asm/iseries/hv_lp_config.h b/arch/powerpc/include/asm/iseries/hv_lp_config.h new file mode 100644 index 00000000000..a006fd1e4a2 --- /dev/null +++ b/arch/powerpc/include/asm/iseries/hv_lp_config.h | |||
@@ -0,0 +1,128 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | */ | ||
18 | #ifndef _ASM_POWERPC_ISERIES_HV_LP_CONFIG_H | ||
19 | #define _ASM_POWERPC_ISERIES_HV_LP_CONFIG_H | ||
20 | |||
21 | /* | ||
22 | * This file contains the interface to the LPAR configuration data | ||
23 | * to determine which resources should be allocated to each partition. | ||
24 | */ | ||
25 | |||
26 | #include <asm/iseries/hv_call_sc.h> | ||
27 | #include <asm/iseries/hv_types.h> | ||
28 | |||
29 | enum { | ||
30 | HvCallCfg_Cur = 0, | ||
31 | HvCallCfg_Init = 1, | ||
32 | HvCallCfg_Max = 2, | ||
33 | HvCallCfg_Min = 3 | ||
34 | }; | ||
35 | |||
36 | #define HvCallCfgGetSystemPhysicalProcessors HvCallCfg + 6 | ||
37 | #define HvCallCfgGetPhysicalProcessors HvCallCfg + 7 | ||
38 | #define HvCallCfgGetMsChunks HvCallCfg + 9 | ||
39 | #define HvCallCfgGetSharedPoolIndex HvCallCfg + 20 | ||
40 | #define HvCallCfgGetSharedProcUnits HvCallCfg + 21 | ||
41 | #define HvCallCfgGetNumProcsInSharedPool HvCallCfg + 22 | ||
42 | #define HvCallCfgGetVirtualLanIndexMap HvCallCfg + 30 | ||
43 | #define HvCallCfgGetHostingLpIndex HvCallCfg + 32 | ||
44 | |||
45 | extern HvLpIndex HvLpConfig_getLpIndex_outline(void); | ||
46 | extern HvLpIndex HvLpConfig_getLpIndex(void); | ||
47 | extern HvLpIndex HvLpConfig_getPrimaryLpIndex(void); | ||
48 | |||
49 | static inline u64 HvLpConfig_getMsChunks(void) | ||
50 | { | ||
51 | return HvCall2(HvCallCfgGetMsChunks, HvLpConfig_getLpIndex(), | ||
52 | HvCallCfg_Cur); | ||
53 | } | ||
54 | |||
55 | static inline u64 HvLpConfig_getSystemPhysicalProcessors(void) | ||
56 | { | ||
57 | return HvCall0(HvCallCfgGetSystemPhysicalProcessors); | ||
58 | } | ||
59 | |||
60 | static inline u64 HvLpConfig_getNumProcsInSharedPool(HvLpSharedPoolIndex sPI) | ||
61 | { | ||
62 | return (u16)HvCall1(HvCallCfgGetNumProcsInSharedPool, sPI); | ||
63 | } | ||
64 | |||
65 | static inline u64 HvLpConfig_getPhysicalProcessors(void) | ||
66 | { | ||
67 | return HvCall2(HvCallCfgGetPhysicalProcessors, HvLpConfig_getLpIndex(), | ||
68 | HvCallCfg_Cur); | ||
69 | } | ||
70 | |||
71 | static inline HvLpSharedPoolIndex HvLpConfig_getSharedPoolIndex(void) | ||
72 | { | ||
73 | return HvCall1(HvCallCfgGetSharedPoolIndex, HvLpConfig_getLpIndex()); | ||
74 | } | ||
75 | |||
76 | static inline u64 HvLpConfig_getSharedProcUnits(void) | ||
77 | { | ||
78 | return HvCall2(HvCallCfgGetSharedProcUnits, HvLpConfig_getLpIndex(), | ||
79 | HvCallCfg_Cur); | ||
80 | } | ||
81 | |||
82 | static inline u64 HvLpConfig_getMaxSharedProcUnits(void) | ||
83 | { | ||
84 | return HvCall2(HvCallCfgGetSharedProcUnits, HvLpConfig_getLpIndex(), | ||
85 | HvCallCfg_Max); | ||
86 | } | ||
87 | |||
88 | static inline u64 HvLpConfig_getMaxPhysicalProcessors(void) | ||
89 | { | ||
90 | return HvCall2(HvCallCfgGetPhysicalProcessors, HvLpConfig_getLpIndex(), | ||
91 | HvCallCfg_Max); | ||
92 | } | ||
93 | |||
94 | static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMapForLp( | ||
95 | HvLpIndex lp) | ||
96 | { | ||
97 | /* | ||
98 | * This is a new function in V5R1 so calls to this on older | ||
99 | * hypervisors will return -1 | ||
100 | */ | ||
101 | u64 retVal = HvCall1(HvCallCfgGetVirtualLanIndexMap, lp); | ||
102 | if (retVal == -1) | ||
103 | retVal = 0; | ||
104 | return retVal; | ||
105 | } | ||
106 | |||
107 | static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMap(void) | ||
108 | { | ||
109 | return HvLpConfig_getVirtualLanIndexMapForLp( | ||
110 | HvLpConfig_getLpIndex_outline()); | ||
111 | } | ||
112 | |||
113 | static inline int HvLpConfig_doLpsCommunicateOnVirtualLan(HvLpIndex lp1, | ||
114 | HvLpIndex lp2) | ||
115 | { | ||
116 | HvLpVirtualLanIndexMap virtualLanIndexMap1 = | ||
117 | HvLpConfig_getVirtualLanIndexMapForLp(lp1); | ||
118 | HvLpVirtualLanIndexMap virtualLanIndexMap2 = | ||
119 | HvLpConfig_getVirtualLanIndexMapForLp(lp2); | ||
120 | return ((virtualLanIndexMap1 & virtualLanIndexMap2) != 0); | ||
121 | } | ||
122 | |||
123 | static inline HvLpIndex HvLpConfig_getHostingLpIndex(HvLpIndex lp) | ||
124 | { | ||
125 | return HvCall1(HvCallCfgGetHostingLpIndex, lp); | ||
126 | } | ||
127 | |||
128 | #endif /* _ASM_POWERPC_ISERIES_HV_LP_CONFIG_H */ | ||
diff --git a/arch/powerpc/include/asm/iseries/hv_lp_event.h b/arch/powerpc/include/asm/iseries/hv_lp_event.h new file mode 100644 index 00000000000..8f5da7d7720 --- /dev/null +++ b/arch/powerpc/include/asm/iseries/hv_lp_event.h | |||
@@ -0,0 +1,162 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | */ | ||
18 | |||
19 | /* This file contains the class for HV events in the system. */ | ||
20 | |||
21 | #ifndef _ASM_POWERPC_ISERIES_HV_LP_EVENT_H | ||
22 | #define _ASM_POWERPC_ISERIES_HV_LP_EVENT_H | ||
23 | |||
24 | #include <asm/types.h> | ||
25 | #include <asm/ptrace.h> | ||
26 | #include <asm/iseries/hv_types.h> | ||
27 | #include <asm/iseries/hv_call_event.h> | ||
28 | |||
29 | /* | ||
30 | * HvLpEvent is the structure for Lp Event messages passed between | ||
31 | * partitions through PLIC. | ||
32 | */ | ||
33 | |||
34 | struct HvLpEvent { | ||
35 | u8 flags; /* Event flags x00-x00 */ | ||
36 | u8 xType; /* Type of message x01-x01 */ | ||
37 | u16 xSubtype; /* Subtype for event x02-x03 */ | ||
38 | u8 xSourceLp; /* Source LP x04-x04 */ | ||
39 | u8 xTargetLp; /* Target LP x05-x05 */ | ||
40 | u8 xSizeMinus1; /* Size of Derived class - 1 x06-x06 */ | ||
41 | u8 xRc; /* RC for Ack flows x07-x07 */ | ||
42 | u16 xSourceInstanceId; /* Source sides instance id x08-x09 */ | ||
43 | u16 xTargetInstanceId; /* Target sides instance id x0A-x0B */ | ||
44 | union { | ||
45 | u32 xSubtypeData; /* Data usable by the subtype x0C-x0F */ | ||
46 | u16 xSubtypeDataShort[2]; /* Data as 2 shorts */ | ||
47 | u8 xSubtypeDataChar[4]; /* Data as 4 chars */ | ||
48 | } x; | ||
49 | |||
50 | u64 xCorrelationToken; /* Unique value for source/type x10-x17 */ | ||
51 | }; | ||
52 | |||
53 | typedef void (*LpEventHandler)(struct HvLpEvent *); | ||
54 | |||
55 | /* Register a handler for an event type - returns 0 on success */ | ||
56 | extern int HvLpEvent_registerHandler(HvLpEvent_Type eventType, | ||
57 | LpEventHandler hdlr); | ||
58 | |||
59 | /* | ||
60 | * Unregister a handler for an event type | ||
61 | * | ||
62 | * This call will sleep until the handler being removed is guaranteed to | ||
63 | * be no longer executing on any CPU. Do not call with locks held. | ||
64 | * | ||
65 | * returns 0 on success | ||
66 | * Unregister will fail if there are any paths open for the type | ||
67 | */ | ||
68 | extern int HvLpEvent_unregisterHandler(HvLpEvent_Type eventType); | ||
69 | |||
70 | /* | ||
71 | * Open an Lp Event Path for an event type | ||
72 | * returns 0 on success | ||
73 | * openPath will fail if there is no handler registered for the event type. | ||
74 | * The lpIndex specified is the partition index for the target partition | ||
75 | * (for VirtualIo, VirtualLan and SessionMgr) other types specify zero) | ||
76 | */ | ||
77 | extern int HvLpEvent_openPath(HvLpEvent_Type eventType, HvLpIndex lpIndex); | ||
78 | |||
79 | /* | ||
80 | * Close an Lp Event Path for a type and partition | ||
81 | * returns 0 on success | ||
82 | */ | ||
83 | extern int HvLpEvent_closePath(HvLpEvent_Type eventType, HvLpIndex lpIndex); | ||
84 | |||
85 | #define HvLpEvent_Type_Hypervisor 0 | ||
86 | #define HvLpEvent_Type_MachineFac 1 | ||
87 | #define HvLpEvent_Type_SessionMgr 2 | ||
88 | #define HvLpEvent_Type_SpdIo 3 | ||
89 | #define HvLpEvent_Type_VirtualBus 4 | ||
90 | #define HvLpEvent_Type_PciIo 5 | ||
91 | #define HvLpEvent_Type_RioIo 6 | ||
92 | #define HvLpEvent_Type_VirtualLan 7 | ||
93 | #define HvLpEvent_Type_VirtualIo 8 | ||
94 | #define HvLpEvent_Type_NumTypes 9 | ||
95 | |||
96 | #define HvLpEvent_Rc_Good 0 | ||
97 | #define HvLpEvent_Rc_BufferNotAvailable 1 | ||
98 | #define HvLpEvent_Rc_Cancelled 2 | ||
99 | #define HvLpEvent_Rc_GenericError 3 | ||
100 | #define HvLpEvent_Rc_InvalidAddress 4 | ||
101 | #define HvLpEvent_Rc_InvalidPartition 5 | ||
102 | #define HvLpEvent_Rc_InvalidSize 6 | ||
103 | #define HvLpEvent_Rc_InvalidSubtype 7 | ||
104 | #define HvLpEvent_Rc_InvalidSubtypeData 8 | ||
105 | #define HvLpEvent_Rc_InvalidType 9 | ||
106 | #define HvLpEvent_Rc_PartitionDead 10 | ||
107 | #define HvLpEvent_Rc_PathClosed 11 | ||
108 | #define HvLpEvent_Rc_SubtypeError 12 | ||
109 | |||
110 | #define HvLpEvent_Function_Ack 0 | ||
111 | #define HvLpEvent_Function_Int 1 | ||
112 | |||
113 | #define HvLpEvent_AckInd_NoAck 0 | ||
114 | #define HvLpEvent_AckInd_DoAck 1 | ||
115 | |||
116 | #define HvLpEvent_AckType_ImmediateAck 0 | ||
117 | #define HvLpEvent_AckType_DeferredAck 1 | ||
118 | |||
119 | #define HV_LP_EVENT_INT 0x01 | ||
120 | #define HV_LP_EVENT_DO_ACK 0x02 | ||
121 | #define HV_LP_EVENT_DEFERRED_ACK 0x04 | ||
122 | #define HV_LP_EVENT_VALID 0x80 | ||
123 | |||
124 | #define HvLpDma_Direction_LocalToRemote 0 | ||
125 | #define HvLpDma_Direction_RemoteToLocal 1 | ||
126 | |||
127 | #define HvLpDma_AddressType_TceIndex 0 | ||
128 | #define HvLpDma_AddressType_RealAddress 1 | ||
129 | |||
130 | #define HvLpDma_Rc_Good 0 | ||
131 | #define HvLpDma_Rc_Error 1 | ||
132 | #define HvLpDma_Rc_PartitionDead 2 | ||
133 | #define HvLpDma_Rc_PathClosed 3 | ||
134 | #define HvLpDma_Rc_InvalidAddress 4 | ||
135 | #define HvLpDma_Rc_InvalidLength 5 | ||
136 | |||
137 | static inline int hvlpevent_is_valid(struct HvLpEvent *h) | ||
138 | { | ||
139 | return h->flags & HV_LP_EVENT_VALID; | ||
140 | } | ||
141 | |||
142 | static inline void hvlpevent_invalidate(struct HvLpEvent *h) | ||
143 | { | ||
144 | h->flags &= ~ HV_LP_EVENT_VALID; | ||
145 | } | ||
146 | |||
147 | static inline int hvlpevent_is_int(struct HvLpEvent *h) | ||
148 | { | ||
149 | return h->flags & HV_LP_EVENT_INT; | ||
150 | } | ||
151 | |||
152 | static inline int hvlpevent_is_ack(struct HvLpEvent *h) | ||
153 | { | ||
154 | return !hvlpevent_is_int(h); | ||
155 | } | ||
156 | |||
157 | static inline int hvlpevent_need_ack(struct HvLpEvent *h) | ||
158 | { | ||
159 | return h->flags & HV_LP_EVENT_DO_ACK; | ||
160 | } | ||
161 | |||
162 | #endif /* _ASM_POWERPC_ISERIES_HV_LP_EVENT_H */ | ||
diff --git a/arch/powerpc/include/asm/iseries/hv_types.h b/arch/powerpc/include/asm/iseries/hv_types.h new file mode 100644 index 00000000000..c3e6d2a1d1c --- /dev/null +++ b/arch/powerpc/include/asm/iseries/hv_types.h | |||
@@ -0,0 +1,112 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | */ | ||
18 | #ifndef _ASM_POWERPC_ISERIES_HV_TYPES_H | ||
19 | #define _ASM_POWERPC_ISERIES_HV_TYPES_H | ||
20 | |||
21 | /* | ||
22 | * General typedefs for the hypervisor. | ||
23 | */ | ||
24 | |||
25 | #include <asm/types.h> | ||
26 | |||
27 | typedef u8 HvLpIndex; | ||
28 | typedef u16 HvLpInstanceId; | ||
29 | typedef u64 HvLpTOD; | ||
30 | typedef u64 HvLpSystemSerialNum; | ||
31 | typedef u8 HvLpDeviceSerialNum[12]; | ||
32 | typedef u16 HvLpSanHwSet; | ||
33 | typedef u16 HvLpBus; | ||
34 | typedef u16 HvLpBoard; | ||
35 | typedef u16 HvLpCard; | ||
36 | typedef u8 HvLpDeviceType[4]; | ||
37 | typedef u8 HvLpDeviceModel[3]; | ||
38 | typedef u64 HvIoToken; | ||
39 | typedef u8 HvLpName[8]; | ||
40 | typedef u32 HvIoId; | ||
41 | typedef u64 HvRealMemoryIndex; | ||
42 | typedef u32 HvLpIndexMap; /* Must hold HVMAXARCHITECTEDLPS bits!!! */ | ||
43 | typedef u16 HvLpVrmIndex; | ||
44 | typedef u32 HvXmGenerationId; | ||
45 | typedef u8 HvLpBusPool; | ||
46 | typedef u8 HvLpSharedPoolIndex; | ||
47 | typedef u16 HvLpSharedProcUnitsX100; | ||
48 | typedef u8 HvLpVirtualLanIndex; | ||
49 | typedef u16 HvLpVirtualLanIndexMap; /* Must hold HVMAXARCHITECTEDVIRTUALLANS bits!!! */ | ||
50 | typedef u16 HvBusNumber; /* Hypervisor Bus Number */ | ||
51 | typedef u8 HvSubBusNumber; /* Hypervisor SubBus Number */ | ||
52 | typedef u8 HvAgentId; /* Hypervisor DevFn */ | ||
53 | |||
54 | |||
55 | #define HVMAXARCHITECTEDLPS 32 | ||
56 | #define HVMAXARCHITECTEDVIRTUALLANS 16 | ||
57 | #define HVMAXARCHITECTEDVIRTUALDISKS 32 | ||
58 | #define HVMAXARCHITECTEDVIRTUALCDROMS 8 | ||
59 | #define HVMAXARCHITECTEDVIRTUALTAPES 8 | ||
60 | #define HVCHUNKSIZE (256 * 1024) | ||
61 | #define HVPAGESIZE (4 * 1024) | ||
62 | #define HVLPMINMEGSPRIMARY 256 | ||
63 | #define HVLPMINMEGSSECONDARY 64 | ||
64 | #define HVCHUNKSPERMEG 4 | ||
65 | #define HVPAGESPERMEG 256 | ||
66 | #define HVPAGESPERCHUNK 64 | ||
67 | |||
68 | #define HvLpIndexInvalid ((HvLpIndex)0xff) | ||
69 | |||
70 | /* | ||
71 | * Enums for the sub-components under PLIC | ||
72 | * Used in HvCall and HvPrimaryCall | ||
73 | */ | ||
74 | enum { | ||
75 | HvCallCompId = 0, | ||
76 | HvCallCpuCtlsCompId = 1, | ||
77 | HvCallCfgCompId = 2, | ||
78 | HvCallEventCompId = 3, | ||
79 | HvCallHptCompId = 4, | ||
80 | HvCallPciCompId = 5, | ||
81 | HvCallSlmCompId = 6, | ||
82 | HvCallSmCompId = 7, | ||
83 | HvCallSpdCompId = 8, | ||
84 | HvCallXmCompId = 9, | ||
85 | HvCallRioCompId = 10, | ||
86 | HvCallRsvd3CompId = 11, | ||
87 | HvCallRsvd2CompId = 12, | ||
88 | HvCallRsvd1CompId = 13, | ||
89 | HvCallMaxCompId = 14, | ||
90 | HvPrimaryCallCompId = 0, | ||
91 | HvPrimaryCallCfgCompId = 1, | ||
92 | HvPrimaryCallPciCompId = 2, | ||
93 | HvPrimaryCallSmCompId = 3, | ||
94 | HvPrimaryCallSpdCompId = 4, | ||
95 | HvPrimaryCallXmCompId = 5, | ||
96 | HvPrimaryCallRioCompId = 6, | ||
97 | HvPrimaryCallRsvd7CompId = 7, | ||
98 | HvPrimaryCallRsvd6CompId = 8, | ||
99 | HvPrimaryCallRsvd5CompId = 9, | ||
100 | HvPrimaryCallRsvd4CompId = 10, | ||
101 | HvPrimaryCallRsvd3CompId = 11, | ||
102 | HvPrimaryCallRsvd2CompId = 12, | ||
103 | HvPrimaryCallRsvd1CompId = 13, | ||
104 | HvPrimaryCallMaxCompId = HvCallMaxCompId | ||
105 | }; | ||
106 | |||
107 | struct HvLpBufferList { | ||
108 | u64 addr; | ||
109 | u64 len; | ||
110 | }; | ||
111 | |||
112 | #endif /* _ASM_POWERPC_ISERIES_HV_TYPES_H */ | ||
diff --git a/arch/powerpc/include/asm/iseries/iommu.h b/arch/powerpc/include/asm/iseries/iommu.h new file mode 100644 index 00000000000..1b9692c6089 --- /dev/null +++ b/arch/powerpc/include/asm/iseries/iommu.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #ifndef _ASM_POWERPC_ISERIES_IOMMU_H | ||
2 | #define _ASM_POWERPC_ISERIES_IOMMU_H | ||
3 | |||
4 | /* | ||
5 | * Copyright (C) 2005 Stephen Rothwell, IBM Corporation | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the: | ||
19 | * Free Software Foundation, Inc., | ||
20 | * 59 Temple Place, Suite 330, | ||
21 | * Boston, MA 02111-1307 USA | ||
22 | */ | ||
23 | |||
24 | struct pci_dev; | ||
25 | struct vio_dev; | ||
26 | struct device_node; | ||
27 | struct iommu_table; | ||
28 | |||
29 | /* Get table parameters from HV */ | ||
30 | extern void iommu_table_getparms_iSeries(unsigned long busno, | ||
31 | unsigned char slotno, unsigned char virtbus, | ||
32 | struct iommu_table *tbl); | ||
33 | |||
34 | extern struct iommu_table *vio_build_iommu_table_iseries(struct vio_dev *dev); | ||
35 | extern void iommu_vio_init(void); | ||
36 | |||
37 | #endif /* _ASM_POWERPC_ISERIES_IOMMU_H */ | ||
diff --git a/arch/powerpc/include/asm/iseries/it_lp_queue.h b/arch/powerpc/include/asm/iseries/it_lp_queue.h new file mode 100644 index 00000000000..42827883882 --- /dev/null +++ b/arch/powerpc/include/asm/iseries/it_lp_queue.h | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | */ | ||
18 | #ifndef _ASM_POWERPC_ISERIES_IT_LP_QUEUE_H | ||
19 | #define _ASM_POWERPC_ISERIES_IT_LP_QUEUE_H | ||
20 | |||
21 | /* | ||
22 | * This control block defines the simple LP queue structure that is | ||
23 | * shared between the hypervisor (PLIC) and the OS in order to send | ||
24 | * events to an LP. | ||
25 | */ | ||
26 | |||
27 | #include <asm/types.h> | ||
28 | #include <asm/ptrace.h> | ||
29 | |||
30 | #define IT_LP_MAX_QUEUES 8 | ||
31 | |||
32 | #define IT_LP_NOT_USED 0 /* Queue will not be used by PLIC */ | ||
33 | #define IT_LP_DEDICATED_IO 1 /* Queue dedicated to IO processor specified */ | ||
34 | #define IT_LP_DEDICATED_LP 2 /* Queue dedicated to LP specified */ | ||
35 | #define IT_LP_SHARED 3 /* Queue shared for both IO and LP */ | ||
36 | |||
37 | #define IT_LP_EVENT_STACK_SIZE 4096 | ||
38 | #define IT_LP_EVENT_MAX_SIZE 256 | ||
39 | #define IT_LP_EVENT_ALIGN 64 | ||
40 | |||
41 | struct hvlpevent_queue { | ||
42 | /* | ||
43 | * The hq_current_event is the pointer to the next event stack entry | ||
44 | * that will become valid. The OS must peek at this entry to determine | ||
45 | * if it is valid. PLIC will set the valid indicator as the very last | ||
46 | * store into that entry. | ||
47 | * | ||
48 | * When the OS has completed processing of the event then it will mark | ||
49 | * the event as invalid so that PLIC knows it can store into that event | ||
50 | * location again. | ||
51 | * | ||
52 | * If the event stack fills and there are overflow events, then PLIC | ||
53 | * will set the hq_overflow_pending flag in which case the OS will | ||
54 | * have to fetch the additional LP events once they have drained the | ||
55 | * event stack. | ||
56 | * | ||
57 | * The first 16-bytes are known by both the OS and PLIC. The remainder | ||
58 | * of the cache line is for use by the OS. | ||
59 | */ | ||
60 | u8 hq_overflow_pending; /* 0x00 Overflow events are pending */ | ||
61 | u8 hq_status; /* 0x01 DedicatedIo or DedicatedLp or NotUsed */ | ||
62 | u16 hq_proc_index; /* 0x02 Logical Proc Index for correlation */ | ||
63 | u8 hq_reserved1[12]; /* 0x04 */ | ||
64 | char *hq_current_event; /* 0x10 */ | ||
65 | char *hq_last_event; /* 0x18 */ | ||
66 | char *hq_event_stack; /* 0x20 */ | ||
67 | u8 hq_index; /* 0x28 unique sequential index. */ | ||
68 | u8 hq_reserved2[3]; /* 0x29-2b */ | ||
69 | spinlock_t hq_lock; | ||
70 | }; | ||
71 | |||
72 | extern struct hvlpevent_queue hvlpevent_queue; | ||
73 | |||
74 | extern int hvlpevent_is_pending(void); | ||
75 | extern void process_hvlpevents(void); | ||
76 | extern void setup_hvlpevent_queue(void); | ||
77 | |||
78 | #endif /* _ASM_POWERPC_ISERIES_IT_LP_QUEUE_H */ | ||
diff --git a/arch/powerpc/include/asm/iseries/lpar_map.h b/arch/powerpc/include/asm/iseries/lpar_map.h new file mode 100644 index 00000000000..5e9f3e128ee --- /dev/null +++ b/arch/powerpc/include/asm/iseries/lpar_map.h | |||
@@ -0,0 +1,85 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | */ | ||
18 | #ifndef _ASM_POWERPC_ISERIES_LPAR_MAP_H | ||
19 | #define _ASM_POWERPC_ISERIES_LPAR_MAP_H | ||
20 | |||
21 | #ifndef __ASSEMBLY__ | ||
22 | |||
23 | #include <asm/types.h> | ||
24 | |||
25 | #endif | ||
26 | |||
27 | /* | ||
28 | * The iSeries hypervisor will set up mapping for one or more | ||
29 | * ESID/VSID pairs (in SLB/segment registers) and will set up | ||
30 | * mappings of one or more ranges of pages to VAs. | ||
31 | * We will have the hypervisor set up the ESID->VSID mapping | ||
32 | * for the four kernel segments (C-F). With shared processors, | ||
33 | * the hypervisor will clear all segment registers and reload | ||
34 | * these four whenever the processor is switched from one | ||
35 | * partition to another. | ||
36 | */ | ||
37 | |||
38 | /* The Vsid and Esid identified below will be used by the hypervisor | ||
39 | * to set up a memory mapping for part of the load area before giving | ||
40 | * control to the Linux kernel. The load area is 64 MB, but this must | ||
41 | * not attempt to map the whole load area. The Hashed Page Table may | ||
42 | * need to be located within the load area (if the total partition size | ||
43 | * is 64 MB), but cannot be mapped. Typically, this should specify | ||
44 | * to map half (32 MB) of the load area. | ||
45 | * | ||
46 | * The hypervisor will set up page table entries for the number of | ||
47 | * pages specified. | ||
48 | * | ||
49 | * In 32-bit mode, the hypervisor will load all four of the | ||
50 | * segment registers (identified by the low-order four bits of the | ||
51 | * Esid field. In 64-bit mode, the hypervisor will load one SLB | ||
52 | * entry to map the Esid to the Vsid. | ||
53 | */ | ||
54 | |||
55 | #define HvEsidsToMap 2 | ||
56 | #define HvRangesToMap 1 | ||
57 | |||
58 | /* Hypervisor initially maps 32MB of the load area */ | ||
59 | #define HvPagesToMap 8192 | ||
60 | |||
61 | #ifndef __ASSEMBLY__ | ||
62 | struct LparMap { | ||
63 | u64 xNumberEsids; // Number of ESID/VSID pairs | ||
64 | u64 xNumberRanges; // Number of VA ranges to map | ||
65 | u64 xSegmentTableOffs; // Page number within load area of seg table | ||
66 | u64 xRsvd[5]; | ||
67 | struct { | ||
68 | u64 xKernelEsid; // Esid used to map kernel load | ||
69 | u64 xKernelVsid; // Vsid used to map kernel load | ||
70 | } xEsids[HvEsidsToMap]; | ||
71 | struct { | ||
72 | u64 xPages; // Number of pages to be mapped | ||
73 | u64 xOffset; // Offset from start of load area | ||
74 | u64 xVPN; // Virtual Page Number | ||
75 | } xRanges[HvRangesToMap]; | ||
76 | }; | ||
77 | |||
78 | extern const struct LparMap xLparMap; | ||
79 | |||
80 | #endif /* __ASSEMBLY__ */ | ||
81 | |||
82 | /* the fixed address where the LparMap exists */ | ||
83 | #define LPARMAP_PHYS 0x7000 | ||
84 | |||
85 | #endif /* _ASM_POWERPC_ISERIES_LPAR_MAP_H */ | ||
diff --git a/arch/powerpc/include/asm/iseries/mf.h b/arch/powerpc/include/asm/iseries/mf.h new file mode 100644 index 00000000000..eb851a9c9e5 --- /dev/null +++ b/arch/powerpc/include/asm/iseries/mf.h | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 Troy D. Armstrong IBM Corporation | ||
3 | * Copyright (C) 2004 Stephen Rothwell IBM Corporation | ||
4 | * | ||
5 | * This modules exists as an interface between a Linux secondary partition | ||
6 | * running on an iSeries and the primary partition's Virtual Service | ||
7 | * Processor (VSP) object. The VSP has final authority over powering on/off | ||
8 | * all partitions in the iSeries. It also provides miscellaneous low-level | ||
9 | * machine facility type operations. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; if not, write to the Free Software | ||
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
24 | */ | ||
25 | #ifndef _ASM_POWERPC_ISERIES_MF_H | ||
26 | #define _ASM_POWERPC_ISERIES_MF_H | ||
27 | |||
28 | #include <linux/types.h> | ||
29 | |||
30 | #include <asm/iseries/hv_types.h> | ||
31 | #include <asm/iseries/hv_call_event.h> | ||
32 | |||
33 | struct rtc_time; | ||
34 | |||
35 | typedef void (*MFCompleteHandler)(void *clientToken, int returnCode); | ||
36 | |||
37 | extern void mf_allocate_lp_events(HvLpIndex targetLp, HvLpEvent_Type type, | ||
38 | unsigned size, unsigned amount, MFCompleteHandler hdlr, | ||
39 | void *userToken); | ||
40 | extern void mf_deallocate_lp_events(HvLpIndex targetLp, HvLpEvent_Type type, | ||
41 | unsigned count, MFCompleteHandler hdlr, void *userToken); | ||
42 | |||
43 | extern void mf_power_off(void); | ||
44 | extern void mf_reboot(char *cmd); | ||
45 | |||
46 | extern void mf_display_src(u32 word); | ||
47 | extern void mf_display_progress(u16 value); | ||
48 | |||
49 | extern void mf_init(void); | ||
50 | |||
51 | #endif /* _ASM_POWERPC_ISERIES_MF_H */ | ||
diff --git a/arch/powerpc/include/asm/iseries/vio.h b/arch/powerpc/include/asm/iseries/vio.h new file mode 100644 index 00000000000..f9ac0d00b95 --- /dev/null +++ b/arch/powerpc/include/asm/iseries/vio.h | |||
@@ -0,0 +1,265 @@ | |||
1 | /* -*- linux-c -*- | ||
2 | * | ||
3 | * iSeries Virtual I/O Message Path header | ||
4 | * | ||
5 | * Authors: Dave Boutcher <boutcher@us.ibm.com> | ||
6 | * Ryan Arnold <ryanarn@us.ibm.com> | ||
7 | * Colin Devilbiss <devilbis@us.ibm.com> | ||
8 | * | ||
9 | * (C) Copyright 2000 IBM Corporation | ||
10 | * | ||
11 | * This header file is used by the iSeries virtual I/O device | ||
12 | * drivers. It defines the interfaces to the common functions | ||
13 | * (implemented in drivers/char/viopath.h) as well as defining | ||
14 | * common functions and structures. Currently (at the time I | ||
15 | * wrote this comment) the iSeries virtual I/O device drivers | ||
16 | * that use this are | ||
17 | * drivers/block/viodasd.c | ||
18 | * drivers/char/viocons.c | ||
19 | * drivers/char/viotape.c | ||
20 | * drivers/cdrom/viocd.c | ||
21 | * | ||
22 | * The iSeries virtual ethernet support (veth.c) uses a whole | ||
23 | * different set of functions. | ||
24 | * | ||
25 | * This program is free software; you can redistribute it and/or | ||
26 | * modify it under the terms of the GNU General Public License as | ||
27 | * published by the Free Software Foundation; either version 2 of the | ||
28 | * License, or (at your option) anyu later version. | ||
29 | * | ||
30 | * This program is distributed in the hope that it will be useful, but | ||
31 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
32 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
33 | * General Public License for more details. | ||
34 | * | ||
35 | * You should have received a copy of the GNU General Public License | ||
36 | * along with this program; if not, write to the Free Software Foundation, | ||
37 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
38 | * | ||
39 | */ | ||
40 | #ifndef _ASM_POWERPC_ISERIES_VIO_H | ||
41 | #define _ASM_POWERPC_ISERIES_VIO_H | ||
42 | |||
43 | #include <asm/iseries/hv_types.h> | ||
44 | #include <asm/iseries/hv_lp_event.h> | ||
45 | |||
46 | /* | ||
47 | * iSeries virtual I/O events use the subtype field in | ||
48 | * HvLpEvent to figure out what kind of vio event is coming | ||
49 | * in. We use a table to route these, and this defines | ||
50 | * the maximum number of distinct subtypes | ||
51 | */ | ||
52 | #define VIO_MAX_SUBTYPES 8 | ||
53 | |||
54 | #define VIOMAXBLOCKDMA 12 | ||
55 | |||
56 | struct open_data { | ||
57 | u64 disk_size; | ||
58 | u16 max_disk; | ||
59 | u16 cylinders; | ||
60 | u16 tracks; | ||
61 | u16 sectors; | ||
62 | u16 bytes_per_sector; | ||
63 | }; | ||
64 | |||
65 | struct rw_data { | ||
66 | u64 offset; | ||
67 | struct { | ||
68 | u32 token; | ||
69 | u32 reserved; | ||
70 | u64 len; | ||
71 | } dma_info[VIOMAXBLOCKDMA]; | ||
72 | }; | ||
73 | |||
74 | struct vioblocklpevent { | ||
75 | struct HvLpEvent event; | ||
76 | u32 reserved; | ||
77 | u16 version; | ||
78 | u16 sub_result; | ||
79 | u16 disk; | ||
80 | u16 flags; | ||
81 | union { | ||
82 | struct open_data open_data; | ||
83 | struct rw_data rw_data; | ||
84 | u64 changed; | ||
85 | } u; | ||
86 | }; | ||
87 | |||
88 | #define vioblockflags_ro 0x0001 | ||
89 | |||
90 | enum vioblocksubtype { | ||
91 | vioblockopen = 0x0001, | ||
92 | vioblockclose = 0x0002, | ||
93 | vioblockread = 0x0003, | ||
94 | vioblockwrite = 0x0004, | ||
95 | vioblockflush = 0x0005, | ||
96 | vioblockcheck = 0x0007 | ||
97 | }; | ||
98 | |||
99 | struct viocdlpevent { | ||
100 | struct HvLpEvent event; | ||
101 | u32 reserved; | ||
102 | u16 version; | ||
103 | u16 sub_result; | ||
104 | u16 disk; | ||
105 | u16 flags; | ||
106 | u32 token; | ||
107 | u64 offset; /* On open, max number of disks */ | ||
108 | u64 len; /* On open, size of the disk */ | ||
109 | u32 block_size; /* Only set on open */ | ||
110 | u32 media_size; /* Only set on open */ | ||
111 | }; | ||
112 | |||
113 | enum viocdsubtype { | ||
114 | viocdopen = 0x0001, | ||
115 | viocdclose = 0x0002, | ||
116 | viocdread = 0x0003, | ||
117 | viocdwrite = 0x0004, | ||
118 | viocdlockdoor = 0x0005, | ||
119 | viocdgetinfo = 0x0006, | ||
120 | viocdcheck = 0x0007 | ||
121 | }; | ||
122 | |||
123 | struct viotapelpevent { | ||
124 | struct HvLpEvent event; | ||
125 | u32 reserved; | ||
126 | u16 version; | ||
127 | u16 sub_type_result; | ||
128 | u16 tape; | ||
129 | u16 flags; | ||
130 | u32 token; | ||
131 | u64 len; | ||
132 | union { | ||
133 | struct { | ||
134 | u32 tape_op; | ||
135 | u32 count; | ||
136 | } op; | ||
137 | struct { | ||
138 | u32 type; | ||
139 | u32 resid; | ||
140 | u32 dsreg; | ||
141 | u32 gstat; | ||
142 | u32 erreg; | ||
143 | u32 file_no; | ||
144 | u32 block_no; | ||
145 | } get_status; | ||
146 | struct { | ||
147 | u32 block_no; | ||
148 | } get_pos; | ||
149 | } u; | ||
150 | }; | ||
151 | |||
152 | enum viotapesubtype { | ||
153 | viotapeopen = 0x0001, | ||
154 | viotapeclose = 0x0002, | ||
155 | viotaperead = 0x0003, | ||
156 | viotapewrite = 0x0004, | ||
157 | viotapegetinfo = 0x0005, | ||
158 | viotapeop = 0x0006, | ||
159 | viotapegetpos = 0x0007, | ||
160 | viotapesetpos = 0x0008, | ||
161 | viotapegetstatus = 0x0009 | ||
162 | }; | ||
163 | |||
164 | /* | ||
165 | * Each subtype can register a handler to process their events. | ||
166 | * The handler must have this interface. | ||
167 | */ | ||
168 | typedef void (vio_event_handler_t) (struct HvLpEvent * event); | ||
169 | |||
170 | extern int viopath_open(HvLpIndex remoteLp, int subtype, int numReq); | ||
171 | extern int viopath_close(HvLpIndex remoteLp, int subtype, int numReq); | ||
172 | extern int vio_setHandler(int subtype, vio_event_handler_t * beh); | ||
173 | extern int vio_clearHandler(int subtype); | ||
174 | extern int viopath_isactive(HvLpIndex lp); | ||
175 | extern HvLpInstanceId viopath_sourceinst(HvLpIndex lp); | ||
176 | extern HvLpInstanceId viopath_targetinst(HvLpIndex lp); | ||
177 | extern void vio_set_hostlp(void); | ||
178 | extern void *vio_get_event_buffer(int subtype); | ||
179 | extern void vio_free_event_buffer(int subtype, void *buffer); | ||
180 | |||
181 | extern struct vio_dev *vio_create_viodasd(u32 unit); | ||
182 | |||
183 | extern HvLpIndex viopath_hostLp; | ||
184 | extern HvLpIndex viopath_ourLp; | ||
185 | |||
186 | #define VIOCHAR_MAX_DATA 200 | ||
187 | |||
188 | #define VIOMAJOR_SUBTYPE_MASK 0xff00 | ||
189 | #define VIOMINOR_SUBTYPE_MASK 0x00ff | ||
190 | #define VIOMAJOR_SUBTYPE_SHIFT 8 | ||
191 | |||
192 | #define VIOVERSION 0x0101 | ||
193 | |||
194 | /* | ||
195 | * This is the general structure for VIO errors; each module should have | ||
196 | * a table of them, and each table should be terminated by an entry of | ||
197 | * { 0, 0, NULL }. Then, to find a specific error message, a module | ||
198 | * should pass its local table and the return code. | ||
199 | */ | ||
200 | struct vio_error_entry { | ||
201 | u16 rc; | ||
202 | int errno; | ||
203 | const char *msg; | ||
204 | }; | ||
205 | extern const struct vio_error_entry *vio_lookup_rc( | ||
206 | const struct vio_error_entry *local_table, u16 rc); | ||
207 | |||
208 | enum viosubtypes { | ||
209 | viomajorsubtype_monitor = 0x0100, | ||
210 | viomajorsubtype_blockio = 0x0200, | ||
211 | viomajorsubtype_chario = 0x0300, | ||
212 | viomajorsubtype_config = 0x0400, | ||
213 | viomajorsubtype_cdio = 0x0500, | ||
214 | viomajorsubtype_tape = 0x0600, | ||
215 | viomajorsubtype_scsi = 0x0700 | ||
216 | }; | ||
217 | |||
218 | enum vioconfigsubtype { | ||
219 | vioconfigget = 0x0001, | ||
220 | }; | ||
221 | |||
222 | enum viorc { | ||
223 | viorc_good = 0x0000, | ||
224 | viorc_noConnection = 0x0001, | ||
225 | viorc_noReceiver = 0x0002, | ||
226 | viorc_noBufferAvailable = 0x0003, | ||
227 | viorc_invalidMessageType = 0x0004, | ||
228 | viorc_invalidRange = 0x0201, | ||
229 | viorc_invalidToken = 0x0202, | ||
230 | viorc_DMAError = 0x0203, | ||
231 | viorc_useError = 0x0204, | ||
232 | viorc_releaseError = 0x0205, | ||
233 | viorc_invalidDisk = 0x0206, | ||
234 | viorc_openRejected = 0x0301 | ||
235 | }; | ||
236 | |||
237 | /* | ||
238 | * The structure of the events that flow between us and OS/400 for chario | ||
239 | * events. You can't mess with this unless the OS/400 side changes too. | ||
240 | */ | ||
241 | struct viocharlpevent { | ||
242 | struct HvLpEvent event; | ||
243 | u32 reserved; | ||
244 | u16 version; | ||
245 | u16 subtype_result_code; | ||
246 | u8 virtual_device; | ||
247 | u8 len; | ||
248 | u8 data[VIOCHAR_MAX_DATA]; | ||
249 | }; | ||
250 | |||
251 | #define VIOCHAR_WINDOW 10 | ||
252 | |||
253 | enum viocharsubtype { | ||
254 | viocharopen = 0x0001, | ||
255 | viocharclose = 0x0002, | ||
256 | viochardata = 0x0003, | ||
257 | viocharack = 0x0004, | ||
258 | viocharconfig = 0x0005 | ||
259 | }; | ||
260 | |||
261 | enum viochar_rc { | ||
262 | viochar_rc_ebusy = 1 | ||
263 | }; | ||
264 | |||
265 | #endif /* _ASM_POWERPC_ISERIES_VIO_H */ | ||
diff --git a/arch/powerpc/include/asm/kvm.h b/arch/powerpc/include/asm/kvm.h new file mode 100644 index 00000000000..a4f6c85431f --- /dev/null +++ b/arch/powerpc/include/asm/kvm.h | |||
@@ -0,0 +1,290 @@ | |||
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 | |||
29 | struct 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 | */ | ||
160 | struct 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 | __u32 iac[4]; | ||
225 | __u32 dac[2]; | ||
226 | __u32 dvc[2]; | ||
227 | __u8 num_iac; /* read-only */ | ||
228 | __u8 num_dac; /* read-only */ | ||
229 | __u8 num_dvc; /* read-only */ | ||
230 | __u8 pad; | ||
231 | |||
232 | __u32 epr; /* EXP */ | ||
233 | __u32 vrsave; /* a.k.a. USPRG0 */ | ||
234 | __u32 epcr; /* KVM_SREGS_E_64 */ | ||
235 | |||
236 | __u32 mas0; | ||
237 | __u32 mas1; | ||
238 | __u64 mas2; | ||
239 | __u64 mas7_3; | ||
240 | __u32 mas4; | ||
241 | __u32 mas6; | ||
242 | |||
243 | __u32 ivor_low[16]; /* IVOR0-15 */ | ||
244 | __u32 ivor_high[18]; /* IVOR32+, plus room to expand */ | ||
245 | |||
246 | __u32 mmucfg; /* read-only */ | ||
247 | __u32 eptcfg; /* E.PT, read-only */ | ||
248 | __u32 tlbcfg[4];/* read-only */ | ||
249 | __u32 tlbps[4]; /* read-only */ | ||
250 | |||
251 | __u32 eplc, epsc; /* E.PD */ | ||
252 | } e; | ||
253 | __u8 pad[1020]; | ||
254 | } u; | ||
255 | }; | ||
256 | |||
257 | struct kvm_fpu { | ||
258 | __u64 fpr[32]; | ||
259 | }; | ||
260 | |||
261 | struct kvm_debug_exit_arch { | ||
262 | }; | ||
263 | |||
264 | /* for KVM_SET_GUEST_DEBUG */ | ||
265 | struct kvm_guest_debug_arch { | ||
266 | }; | ||
267 | |||
268 | #define KVM_REG_MASK 0x001f | ||
269 | #define KVM_REG_EXT_MASK 0xffe0 | ||
270 | #define KVM_REG_GPR 0x0000 | ||
271 | #define KVM_REG_FPR 0x0020 | ||
272 | #define KVM_REG_QPR 0x0040 | ||
273 | #define KVM_REG_FQPR 0x0060 | ||
274 | |||
275 | #define KVM_INTERRUPT_SET -1U | ||
276 | #define KVM_INTERRUPT_UNSET -2U | ||
277 | #define KVM_INTERRUPT_SET_LEVEL -3U | ||
278 | |||
279 | /* for KVM_CAP_SPAPR_TCE */ | ||
280 | struct kvm_create_spapr_tce { | ||
281 | __u64 liobn; | ||
282 | __u32 window_size; | ||
283 | }; | ||
284 | |||
285 | /* for KVM_ALLOCATE_RMA */ | ||
286 | struct kvm_allocate_rma { | ||
287 | __u64 rma_size; | ||
288 | }; | ||
289 | |||
290 | #endif /* __LINUX_KVM_POWERPC_H */ | ||
diff --git a/arch/powerpc/include/asm/kvm_e500.h b/arch/powerpc/include/asm/kvm_e500.h new file mode 100644 index 00000000000..adbfca9dd10 --- /dev/null +++ b/arch/powerpc/include/asm/kvm_e500.h | |||
@@ -0,0 +1,84 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2008-2011 Freescale Semiconductor, Inc. All rights reserved. | ||
3 | * | ||
4 | * Author: Yu Liu, <yu.liu@freescale.com> | ||
5 | * | ||
6 | * Description: | ||
7 | * This file is derived from arch/powerpc/include/asm/kvm_44x.h, | ||
8 | * by Hollis Blanchard <hollisb@us.ibm.com>. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License, version 2, as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | #ifndef __ASM_KVM_E500_H__ | ||
16 | #define __ASM_KVM_E500_H__ | ||
17 | |||
18 | #include <linux/kvm_host.h> | ||
19 | |||
20 | #define BOOKE_INTERRUPT_SIZE 36 | ||
21 | |||
22 | #define E500_PID_NUM 3 | ||
23 | #define E500_TLB_NUM 2 | ||
24 | |||
25 | struct tlbe{ | ||
26 | u32 mas1; | ||
27 | u32 mas2; | ||
28 | u32 mas3; | ||
29 | u32 mas7; | ||
30 | }; | ||
31 | |||
32 | #define E500_TLB_VALID 1 | ||
33 | #define E500_TLB_DIRTY 2 | ||
34 | |||
35 | struct tlbe_priv { | ||
36 | pfn_t pfn; | ||
37 | unsigned int flags; /* E500_TLB_* */ | ||
38 | }; | ||
39 | |||
40 | struct vcpu_id_table; | ||
41 | |||
42 | struct kvmppc_vcpu_e500 { | ||
43 | /* Unmodified copy of the guest's TLB. */ | ||
44 | struct tlbe *gtlb_arch[E500_TLB_NUM]; | ||
45 | |||
46 | /* KVM internal information associated with each guest TLB entry */ | ||
47 | struct tlbe_priv *gtlb_priv[E500_TLB_NUM]; | ||
48 | |||
49 | unsigned int gtlb_size[E500_TLB_NUM]; | ||
50 | unsigned int gtlb_nv[E500_TLB_NUM]; | ||
51 | |||
52 | u32 host_pid[E500_PID_NUM]; | ||
53 | u32 pid[E500_PID_NUM]; | ||
54 | u32 svr; | ||
55 | |||
56 | u32 mas0; | ||
57 | u32 mas1; | ||
58 | u32 mas2; | ||
59 | u32 mas3; | ||
60 | u32 mas4; | ||
61 | u32 mas5; | ||
62 | u32 mas6; | ||
63 | u32 mas7; | ||
64 | |||
65 | /* vcpu id table */ | ||
66 | struct vcpu_id_table *idt; | ||
67 | |||
68 | u32 l1csr0; | ||
69 | u32 l1csr1; | ||
70 | u32 hid0; | ||
71 | u32 hid1; | ||
72 | u32 tlb0cfg; | ||
73 | u32 tlb1cfg; | ||
74 | u64 mcar; | ||
75 | |||
76 | struct kvm_vcpu vcpu; | ||
77 | }; | ||
78 | |||
79 | static inline struct kvmppc_vcpu_e500 *to_e500(struct kvm_vcpu *vcpu) | ||
80 | { | ||
81 | return container_of(vcpu, struct kvmppc_vcpu_e500, vcpu); | ||
82 | } | ||
83 | |||
84 | #endif /* __ASM_KVM_E500_H__ */ | ||
diff --git a/arch/powerpc/include/asm/linkage.h b/arch/powerpc/include/asm/linkage.h new file mode 100644 index 00000000000..e1c4ac1cc4b --- /dev/null +++ b/arch/powerpc/include/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/asm/memblock.h b/arch/powerpc/include/asm/memblock.h new file mode 100644 index 00000000000..43efc345065 --- /dev/null +++ b/arch/powerpc/include/asm/memblock.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _ASM_POWERPC_MEMBLOCK_H | ||
2 | #define _ASM_POWERPC_MEMBLOCK_H | ||
3 | |||
4 | #include <asm/udbg.h> | ||
5 | |||
6 | #define MEMBLOCK_DBG(fmt...) udbg_printf(fmt) | ||
7 | |||
8 | #endif /* _ASM_POWERPC_MEMBLOCK_H */ | ||
diff --git a/arch/powerpc/include/asm/msgbuf.h b/arch/powerpc/include/asm/msgbuf.h new file mode 100644 index 00000000000..dd76743c753 --- /dev/null +++ b/arch/powerpc/include/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 | |||
10 | struct 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/asm/pSeries_reconfig.h b/arch/powerpc/include/asm/pSeries_reconfig.h new file mode 100644 index 00000000000..23cd6cc30bc --- /dev/null +++ b/arch/powerpc/include/asm/pSeries_reconfig.h | |||
@@ -0,0 +1,35 @@ | |||
1 | #ifndef _PPC64_PSERIES_RECONFIG_H | ||
2 | #define _PPC64_PSERIES_RECONFIG_H | ||
3 | #ifdef __KERNEL__ | ||
4 | |||
5 | #include <linux/notifier.h> | ||
6 | |||
7 | /* | ||
8 | * Use this API if your code needs to know about OF device nodes being | ||
9 | * added or removed on pSeries systems. | ||
10 | */ | ||
11 | |||
12 | #define PSERIES_RECONFIG_ADD 0x0001 | ||
13 | #define PSERIES_RECONFIG_REMOVE 0x0002 | ||
14 | #define PSERIES_DRCONF_MEM_ADD 0x0003 | ||
15 | #define PSERIES_DRCONF_MEM_REMOVE 0x0004 | ||
16 | |||
17 | #ifdef CONFIG_PPC_PSERIES | ||
18 | extern int pSeries_reconfig_notifier_register(struct notifier_block *); | ||
19 | extern void pSeries_reconfig_notifier_unregister(struct notifier_block *); | ||
20 | extern int pSeries_reconfig_notify(unsigned long action, void *p); | ||
21 | /* Not the best place to put this, will be fixed when we move some | ||
22 | * of the rtas suspend-me stuff to pseries */ | ||
23 | extern void pSeries_coalesce_init(void); | ||
24 | #else /* !CONFIG_PPC_PSERIES */ | ||
25 | static inline int pSeries_reconfig_notifier_register(struct notifier_block *nb) | ||
26 | { | ||
27 | return 0; | ||
28 | } | ||
29 | static inline void pSeries_reconfig_notifier_unregister(struct notifier_block *nb) { } | ||
30 | static inline void pSeries_coalesce_init(void) { } | ||
31 | #endif /* CONFIG_PPC_PSERIES */ | ||
32 | |||
33 | |||
34 | #endif /* __KERNEL__ */ | ||
35 | #endif /* _PPC64_PSERIES_RECONFIG_H */ | ||
diff --git a/arch/powerpc/include/asm/param.h b/arch/powerpc/include/asm/param.h new file mode 100644 index 00000000000..965d4542797 --- /dev/null +++ b/arch/powerpc/include/asm/param.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/param.h> | |||
diff --git a/arch/powerpc/include/asm/phyp_dump.h b/arch/powerpc/include/asm/phyp_dump.h new file mode 100644 index 00000000000..fa74c6c3e10 --- /dev/null +++ b/arch/powerpc/include/asm/phyp_dump.h | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * Hypervisor-assisted dump | ||
3 | * | ||
4 | * Linas Vepstas, Manish Ahuja 2008 | ||
5 | * Copyright 2008 IBM Corp. | ||
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 | |||
13 | #ifndef _PPC64_PHYP_DUMP_H | ||
14 | #define _PPC64_PHYP_DUMP_H | ||
15 | |||
16 | #ifdef CONFIG_PHYP_DUMP | ||
17 | |||
18 | /* The RMR region will be saved for later dumping | ||
19 | * whenever the kernel crashes. Set this to 256MB. */ | ||
20 | #define PHYP_DUMP_RMR_START 0x0 | ||
21 | #define PHYP_DUMP_RMR_END (1UL<<28) | ||
22 | |||
23 | struct phyp_dump { | ||
24 | /* Memory that is reserved during very early boot. */ | ||
25 | unsigned long init_reserve_start; | ||
26 | unsigned long init_reserve_size; | ||
27 | /* cmd line options during boot */ | ||
28 | unsigned long reserve_bootvar; | ||
29 | unsigned long phyp_dump_at_boot; | ||
30 | /* Check status during boot if dump supported, active & present*/ | ||
31 | unsigned long phyp_dump_configured; | ||
32 | unsigned long phyp_dump_is_active; | ||
33 | /* store cpu & hpte size */ | ||
34 | unsigned long cpu_state_size; | ||
35 | unsigned long hpte_region_size; | ||
36 | /* previous scratch area values */ | ||
37 | unsigned long reserved_scratch_addr; | ||
38 | unsigned long reserved_scratch_size; | ||
39 | }; | ||
40 | |||
41 | extern struct phyp_dump *phyp_dump_info; | ||
42 | |||
43 | int early_init_dt_scan_phyp_dump(unsigned long node, | ||
44 | const char *uname, int depth, void *data); | ||
45 | |||
46 | #endif /* CONFIG_PHYP_DUMP */ | ||
47 | #endif /* _PPC64_PHYP_DUMP_H */ | ||
diff --git a/arch/powerpc/include/asm/poll.h b/arch/powerpc/include/asm/poll.h new file mode 100644 index 00000000000..c98509d3149 --- /dev/null +++ b/arch/powerpc/include/asm/poll.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/poll.h> | |||
diff --git a/arch/powerpc/include/asm/posix_types.h b/arch/powerpc/include/asm/posix_types.h new file mode 100644 index 00000000000..c4e396b540d --- /dev/null +++ b/arch/powerpc/include/asm/posix_types.h | |||
@@ -0,0 +1,128 @@ | |||
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 | typedef unsigned long __kernel_ino_t; | ||
11 | typedef unsigned int __kernel_mode_t; | ||
12 | typedef long __kernel_off_t; | ||
13 | typedef int __kernel_pid_t; | ||
14 | typedef unsigned int __kernel_uid_t; | ||
15 | typedef unsigned int __kernel_gid_t; | ||
16 | typedef long __kernel_ptrdiff_t; | ||
17 | typedef long __kernel_time_t; | ||
18 | typedef long __kernel_clock_t; | ||
19 | typedef int __kernel_timer_t; | ||
20 | typedef int __kernel_clockid_t; | ||
21 | typedef long __kernel_suseconds_t; | ||
22 | typedef int __kernel_daddr_t; | ||
23 | typedef char * __kernel_caddr_t; | ||
24 | typedef unsigned short __kernel_uid16_t; | ||
25 | typedef unsigned short __kernel_gid16_t; | ||
26 | typedef unsigned int __kernel_uid32_t; | ||
27 | typedef unsigned int __kernel_gid32_t; | ||
28 | typedef unsigned int __kernel_old_uid_t; | ||
29 | typedef unsigned int __kernel_old_gid_t; | ||
30 | |||
31 | #ifdef __powerpc64__ | ||
32 | typedef unsigned long __kernel_nlink_t; | ||
33 | typedef int __kernel_ipc_pid_t; | ||
34 | typedef unsigned long __kernel_size_t; | ||
35 | typedef long __kernel_ssize_t; | ||
36 | typedef unsigned long __kernel_old_dev_t; | ||
37 | #else | ||
38 | typedef unsigned short __kernel_nlink_t; | ||
39 | typedef short __kernel_ipc_pid_t; | ||
40 | typedef unsigned int __kernel_size_t; | ||
41 | typedef int __kernel_ssize_t; | ||
42 | typedef unsigned int __kernel_old_dev_t; | ||
43 | #endif | ||
44 | |||
45 | #ifdef __powerpc64__ | ||
46 | typedef long long __kernel_loff_t; | ||
47 | #else | ||
48 | #ifdef __GNUC__ | ||
49 | typedef long long __kernel_loff_t; | ||
50 | #endif | ||
51 | #endif | ||
52 | |||
53 | typedef struct { | ||
54 | int val[2]; | ||
55 | } __kernel_fsid_t; | ||
56 | |||
57 | #ifndef __GNUC__ | ||
58 | |||
59 | #define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) | ||
60 | #define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) | ||
61 | #define __FD_ISSET(d, set) (((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) != 0) | ||
62 | #define __FD_ZERO(set) \ | ||
63 | ((void) memset ((void *) (set), 0, sizeof (__kernel_fd_set))) | ||
64 | |||
65 | #else /* __GNUC__ */ | ||
66 | |||
67 | #if defined(__KERNEL__) | ||
68 | /* With GNU C, use inline functions instead so args are evaluated only once: */ | ||
69 | |||
70 | #undef __FD_SET | ||
71 | static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp) | ||
72 | { | ||
73 | unsigned long _tmp = fd / __NFDBITS; | ||
74 | unsigned long _rem = fd % __NFDBITS; | ||
75 | fdsetp->fds_bits[_tmp] |= (1UL<<_rem); | ||
76 | } | ||
77 | |||
78 | #undef __FD_CLR | ||
79 | static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp) | ||
80 | { | ||
81 | unsigned long _tmp = fd / __NFDBITS; | ||
82 | unsigned long _rem = fd % __NFDBITS; | ||
83 | fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem); | ||
84 | } | ||
85 | |||
86 | #undef __FD_ISSET | ||
87 | static __inline__ int __FD_ISSET(unsigned long fd, __kernel_fd_set *p) | ||
88 | { | ||
89 | unsigned long _tmp = fd / __NFDBITS; | ||
90 | unsigned long _rem = fd % __NFDBITS; | ||
91 | return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0; | ||
92 | } | ||
93 | |||
94 | /* | ||
95 | * This will unroll the loop for the normal constant case (8 ints, | ||
96 | * for a 256-bit fd_set) | ||
97 | */ | ||
98 | #undef __FD_ZERO | ||
99 | static __inline__ void __FD_ZERO(__kernel_fd_set *p) | ||
100 | { | ||
101 | unsigned long *tmp = (unsigned long *)p->fds_bits; | ||
102 | int i; | ||
103 | |||
104 | if (__builtin_constant_p(__FDSET_LONGS)) { | ||
105 | switch (__FDSET_LONGS) { | ||
106 | case 16: | ||
107 | tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0; | ||
108 | tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0; | ||
109 | |||
110 | case 8: | ||
111 | tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0; | ||
112 | |||
113 | case 4: | ||
114 | tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0; | ||
115 | return; | ||
116 | } | ||
117 | } | ||
118 | i = __FDSET_LONGS; | ||
119 | while (i) { | ||
120 | i--; | ||
121 | *tmp = 0; | ||
122 | tmp++; | ||
123 | } | ||
124 | } | ||
125 | |||
126 | #endif /* defined(__KERNEL__) */ | ||
127 | #endif /* __GNUC__ */ | ||
128 | #endif /* _ASM_POWERPC_POSIX_TYPES_H */ | ||
diff --git a/arch/powerpc/include/asm/ps3fb.h b/arch/powerpc/include/asm/ps3fb.h new file mode 100644 index 00000000000..e7233a84968 --- /dev/null +++ b/arch/powerpc/include/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 | |||
37 | struct 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/asm/resource.h b/arch/powerpc/include/asm/resource.h new file mode 100644 index 00000000000..04bc4db8921 --- /dev/null +++ b/arch/powerpc/include/asm/resource.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/resource.h> | |||
diff --git a/arch/powerpc/include/asm/rwsem.h b/arch/powerpc/include/asm/rwsem.h new file mode 100644 index 00000000000..bb1e2cdeb9b --- /dev/null +++ b/arch/powerpc/include/asm/rwsem.h | |||
@@ -0,0 +1,132 @@ | |||
1 | #ifndef _ASM_POWERPC_RWSEM_H | ||
2 | #define _ASM_POWERPC_RWSEM_H | ||
3 | |||
4 | #ifndef _LINUX_RWSEM_H | ||
5 | #error "Please don't include <asm/rwsem.h> directly, use <linux/rwsem.h> instead." | ||
6 | #endif | ||
7 | |||
8 | #ifdef __KERNEL__ | ||
9 | |||
10 | /* | ||
11 | * R/W semaphores for PPC using the stuff in lib/rwsem.c. | ||
12 | * Adapted largely from include/asm-i386/rwsem.h | ||
13 | * by Paul Mackerras <paulus@samba.org>. | ||
14 | */ | ||
15 | |||
16 | /* | ||
17 | * the semaphore definition | ||
18 | */ | ||
19 | #ifdef CONFIG_PPC64 | ||
20 | # define RWSEM_ACTIVE_MASK 0xffffffffL | ||
21 | #else | ||
22 | # define RWSEM_ACTIVE_MASK 0x0000ffffL | ||
23 | #endif | ||
24 | |||
25 | #define RWSEM_UNLOCKED_VALUE 0x00000000L | ||
26 | #define RWSEM_ACTIVE_BIAS 0x00000001L | ||
27 | #define RWSEM_WAITING_BIAS (-RWSEM_ACTIVE_MASK-1) | ||
28 | #define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS | ||
29 | #define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) | ||
30 | |||
31 | /* | ||
32 | * lock for reading | ||
33 | */ | ||
34 | static inline void __down_read(struct rw_semaphore *sem) | ||
35 | { | ||
36 | if (unlikely(atomic_long_inc_return((atomic_long_t *)&sem->count) <= 0)) | ||
37 | rwsem_down_read_failed(sem); | ||
38 | } | ||
39 | |||
40 | static inline int __down_read_trylock(struct rw_semaphore *sem) | ||
41 | { | ||
42 | long tmp; | ||
43 | |||
44 | while ((tmp = sem->count) >= 0) { | ||
45 | if (tmp == cmpxchg(&sem->count, tmp, | ||
46 | tmp + RWSEM_ACTIVE_READ_BIAS)) { | ||
47 | return 1; | ||
48 | } | ||
49 | } | ||
50 | return 0; | ||
51 | } | ||
52 | |||
53 | /* | ||
54 | * lock for writing | ||
55 | */ | ||
56 | static inline void __down_write_nested(struct rw_semaphore *sem, int subclass) | ||
57 | { | ||
58 | long tmp; | ||
59 | |||
60 | tmp = atomic_long_add_return(RWSEM_ACTIVE_WRITE_BIAS, | ||
61 | (atomic_long_t *)&sem->count); | ||
62 | if (unlikely(tmp != RWSEM_ACTIVE_WRITE_BIAS)) | ||
63 | rwsem_down_write_failed(sem); | ||
64 | } | ||
65 | |||
66 | static inline void __down_write(struct rw_semaphore *sem) | ||
67 | { | ||
68 | __down_write_nested(sem, 0); | ||
69 | } | ||
70 | |||
71 | static inline int __down_write_trylock(struct rw_semaphore *sem) | ||
72 | { | ||
73 | long tmp; | ||
74 | |||
75 | tmp = cmpxchg(&sem->count, RWSEM_UNLOCKED_VALUE, | ||
76 | RWSEM_ACTIVE_WRITE_BIAS); | ||
77 | return tmp == RWSEM_UNLOCKED_VALUE; | ||
78 | } | ||
79 | |||
80 | /* | ||
81 | * unlock after reading | ||
82 | */ | ||
83 | static inline void __up_read(struct rw_semaphore *sem) | ||
84 | { | ||
85 | long tmp; | ||
86 | |||
87 | tmp = atomic_long_dec_return((atomic_long_t *)&sem->count); | ||
88 | if (unlikely(tmp < -1 && (tmp & RWSEM_ACTIVE_MASK) == 0)) | ||
89 | rwsem_wake(sem); | ||
90 | } | ||
91 | |||
92 | /* | ||
93 | * unlock after writing | ||
94 | */ | ||
95 | static inline void __up_write(struct rw_semaphore *sem) | ||
96 | { | ||
97 | if (unlikely(atomic_long_sub_return(RWSEM_ACTIVE_WRITE_BIAS, | ||
98 | (atomic_long_t *)&sem->count) < 0)) | ||
99 | rwsem_wake(sem); | ||
100 | } | ||
101 | |||
102 | /* | ||
103 | * implement atomic add functionality | ||
104 | */ | ||
105 | static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem) | ||
106 | { | ||
107 | atomic_long_add(delta, (atomic_long_t *)&sem->count); | ||
108 | } | ||
109 | |||
110 | /* | ||
111 | * downgrade write lock to read lock | ||
112 | */ | ||
113 | static inline void __downgrade_write(struct rw_semaphore *sem) | ||
114 | { | ||
115 | long tmp; | ||
116 | |||
117 | tmp = atomic_long_add_return(-RWSEM_WAITING_BIAS, | ||
118 | (atomic_long_t *)&sem->count); | ||
119 | if (tmp < 0) | ||
120 | rwsem_downgrade_wake(sem); | ||
121 | } | ||
122 | |||
123 | /* | ||
124 | * implement exchange and add functionality | ||
125 | */ | ||
126 | static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem) | ||
127 | { | ||
128 | return atomic_long_add_return(delta, (atomic_long_t *)&sem->count); | ||
129 | } | ||
130 | |||
131 | #endif /* __KERNEL__ */ | ||
132 | #endif /* _ASM_POWERPC_RWSEM_H */ | ||
diff --git a/arch/powerpc/include/asm/seccomp.h b/arch/powerpc/include/asm/seccomp.h new file mode 100644 index 00000000000..00c1d9133cf --- /dev/null +++ b/arch/powerpc/include/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/asm/sembuf.h b/arch/powerpc/include/asm/sembuf.h new file mode 100644 index 00000000000..99a41938ae3 --- /dev/null +++ b/arch/powerpc/include/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 | |||
21 | struct 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/asm/shmbuf.h b/arch/powerpc/include/asm/shmbuf.h new file mode 100644 index 00000000000..8efa39698b6 --- /dev/null +++ b/arch/powerpc/include/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 | |||
22 | struct 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 | |||
47 | struct 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/asm/sigcontext.h b/arch/powerpc/include/asm/sigcontext.h new file mode 100644 index 00000000000..9c1f24fd5d1 --- /dev/null +++ b/arch/powerpc/include/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 | |||
16 | struct 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/asm/siginfo.h b/arch/powerpc/include/asm/siginfo.h new file mode 100644 index 00000000000..49495b0534e --- /dev/null +++ b/arch/powerpc/include/asm/siginfo.h | |||
@@ -0,0 +1,21 @@ | |||
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 | # define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3) | ||
14 | #endif | ||
15 | |||
16 | #include <asm-generic/siginfo.h> | ||
17 | |||
18 | #undef NSIGTRAP | ||
19 | #define NSIGTRAP 4 | ||
20 | |||
21 | #endif /* _ASM_POWERPC_SIGINFO_H */ | ||
diff --git a/arch/powerpc/include/asm/socket.h b/arch/powerpc/include/asm/socket.h new file mode 100644 index 00000000000..866f7606da6 --- /dev/null +++ b/arch/powerpc/include/asm/socket.h | |||
@@ -0,0 +1,72 @@ | |||
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 | #endif /* _ASM_POWERPC_SOCKET_H */ | ||
diff --git a/arch/powerpc/include/asm/sockios.h b/arch/powerpc/include/asm/sockios.h new file mode 100644 index 00000000000..55cef7675a3 --- /dev/null +++ b/arch/powerpc/include/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/asm/stat.h b/arch/powerpc/include/asm/stat.h new file mode 100644 index 00000000000..e4edc510b53 --- /dev/null +++ b/arch/powerpc/include/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__ | ||
14 | struct __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 | |||
29 | struct stat { | ||
30 | unsigned long st_dev; | ||
31 | ino_t st_ino; | ||
32 | #ifdef __powerpc64__ | ||
33 | nlink_t st_nlink; | ||
34 | mode_t st_mode; | ||
35 | #else | ||
36 | mode_t st_mode; | ||
37 | nlink_t 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. */ | ||
59 | struct 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/asm/statfs.h b/arch/powerpc/include/asm/statfs.h new file mode 100644 index 00000000000..5244834583a --- /dev/null +++ b/arch/powerpc/include/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/asm/system.h b/arch/powerpc/include/asm/system.h new file mode 100644 index 00000000000..e30a13d1ee7 --- /dev/null +++ b/arch/powerpc/include/asm/system.h | |||
@@ -0,0 +1,545 @@ | |||
1 | /* | ||
2 | * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu> | ||
3 | */ | ||
4 | #ifndef _ASM_POWERPC_SYSTEM_H | ||
5 | #define _ASM_POWERPC_SYSTEM_H | ||
6 | |||
7 | #include <linux/kernel.h> | ||
8 | #include <linux/irqflags.h> | ||
9 | |||
10 | #include <asm/hw_irq.h> | ||
11 | |||
12 | /* | ||
13 | * Memory barrier. | ||
14 | * The sync instruction guarantees that all memory accesses initiated | ||
15 | * by this processor have been performed (with respect to all other | ||
16 | * mechanisms that access memory). The eieio instruction is a barrier | ||
17 | * providing an ordering (separately) for (a) cacheable stores and (b) | ||
18 | * loads and stores to non-cacheable memory (e.g. I/O devices). | ||
19 | * | ||
20 | * mb() prevents loads and stores being reordered across this point. | ||
21 | * rmb() prevents loads being reordered across this point. | ||
22 | * wmb() prevents stores being reordered across this point. | ||
23 | * read_barrier_depends() prevents data-dependent loads being reordered | ||
24 | * across this point (nop on PPC). | ||
25 | * | ||
26 | * *mb() variants without smp_ prefix must order all types of memory | ||
27 | * operations with one another. sync is the only instruction sufficient | ||
28 | * to do this. | ||
29 | * | ||
30 | * For the smp_ barriers, ordering is for cacheable memory operations | ||
31 | * only. We have to use the sync instruction for smp_mb(), since lwsync | ||
32 | * doesn't order loads with respect to previous stores. Lwsync can be | ||
33 | * used for smp_rmb() and smp_wmb(). | ||
34 | * | ||
35 | * However, on CPUs that don't support lwsync, lwsync actually maps to a | ||
36 | * heavy-weight sync, so smp_wmb() can be a lighter-weight eieio. | ||
37 | */ | ||
38 | #define mb() __asm__ __volatile__ ("sync" : : : "memory") | ||
39 | #define rmb() __asm__ __volatile__ ("sync" : : : "memory") | ||
40 | #define wmb() __asm__ __volatile__ ("sync" : : : "memory") | ||
41 | #define read_barrier_depends() do { } while(0) | ||
42 | |||
43 | #define set_mb(var, value) do { var = value; mb(); } while (0) | ||
44 | |||
45 | #ifdef __KERNEL__ | ||
46 | #define AT_VECTOR_SIZE_ARCH 6 /* entries in ARCH_DLINFO */ | ||
47 | #ifdef CONFIG_SMP | ||
48 | |||
49 | #ifdef __SUBARCH_HAS_LWSYNC | ||
50 | # define SMPWMB LWSYNC | ||
51 | #else | ||
52 | # define SMPWMB eieio | ||
53 | #endif | ||
54 | |||
55 | #define smp_mb() mb() | ||
56 | #define smp_rmb() __asm__ __volatile__ (stringify_in_c(LWSYNC) : : :"memory") | ||
57 | #define smp_wmb() __asm__ __volatile__ (stringify_in_c(SMPWMB) : : :"memory") | ||
58 | #define smp_read_barrier_depends() read_barrier_depends() | ||
59 | #else | ||
60 | #define smp_mb() barrier() | ||
61 | #define smp_rmb() barrier() | ||
62 | #define smp_wmb() barrier() | ||
63 | #define smp_read_barrier_depends() do { } while(0) | ||
64 | #endif /* CONFIG_SMP */ | ||
65 | |||
66 | /* | ||
67 | * This is a barrier which prevents following instructions from being | ||
68 | * started until the value of the argument x is known. For example, if | ||
69 | * x is a variable loaded from memory, this prevents following | ||
70 | * instructions from being executed until the load has been performed. | ||
71 | */ | ||
72 | #define data_barrier(x) \ | ||
73 | asm volatile("twi 0,%0,0; isync" : : "r" (x) : "memory"); | ||
74 | |||
75 | struct task_struct; | ||
76 | struct pt_regs; | ||
77 | |||
78 | #if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC) | ||
79 | |||
80 | extern int (*__debugger)(struct pt_regs *regs); | ||
81 | extern int (*__debugger_ipi)(struct pt_regs *regs); | ||
82 | extern int (*__debugger_bpt)(struct pt_regs *regs); | ||
83 | extern int (*__debugger_sstep)(struct pt_regs *regs); | ||
84 | extern int (*__debugger_iabr_match)(struct pt_regs *regs); | ||
85 | extern int (*__debugger_dabr_match)(struct pt_regs *regs); | ||
86 | extern int (*__debugger_fault_handler)(struct pt_regs *regs); | ||
87 | |||
88 | #define DEBUGGER_BOILERPLATE(__NAME) \ | ||
89 | static inline int __NAME(struct pt_regs *regs) \ | ||
90 | { \ | ||
91 | if (unlikely(__ ## __NAME)) \ | ||
92 | return __ ## __NAME(regs); \ | ||
93 | return 0; \ | ||
94 | } | ||
95 | |||
96 | DEBUGGER_BOILERPLATE(debugger) | ||
97 | DEBUGGER_BOILERPLATE(debugger_ipi) | ||
98 | DEBUGGER_BOILERPLATE(debugger_bpt) | ||
99 | DEBUGGER_BOILERPLATE(debugger_sstep) | ||
100 | DEBUGGER_BOILERPLATE(debugger_iabr_match) | ||
101 | DEBUGGER_BOILERPLATE(debugger_dabr_match) | ||
102 | DEBUGGER_BOILERPLATE(debugger_fault_handler) | ||
103 | |||
104 | #else | ||
105 | static inline int debugger(struct pt_regs *regs) { return 0; } | ||
106 | static inline int debugger_ipi(struct pt_regs *regs) { return 0; } | ||
107 | static inline int debugger_bpt(struct pt_regs *regs) { return 0; } | ||
108 | static inline int debugger_sstep(struct pt_regs *regs) { return 0; } | ||
109 | static inline int debugger_iabr_match(struct pt_regs *regs) { return 0; } | ||
110 | static inline int debugger_dabr_match(struct pt_regs *regs) { return 0; } | ||
111 | static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; } | ||
112 | #endif | ||
113 | |||
114 | extern int set_dabr(unsigned long dabr); | ||
115 | #ifdef CONFIG_PPC_ADV_DEBUG_REGS | ||
116 | extern void do_send_trap(struct pt_regs *regs, unsigned long address, | ||
117 | unsigned long error_code, int signal_code, int brkpt); | ||
118 | #else | ||
119 | extern void do_dabr(struct pt_regs *regs, unsigned long address, | ||
120 | unsigned long error_code); | ||
121 | #endif | ||
122 | extern void print_backtrace(unsigned long *); | ||
123 | extern void flush_instruction_cache(void); | ||
124 | extern void hard_reset_now(void); | ||
125 | extern void poweroff_now(void); | ||
126 | |||
127 | #ifdef CONFIG_6xx | ||
128 | extern long _get_L2CR(void); | ||
129 | extern long _get_L3CR(void); | ||
130 | extern void _set_L2CR(unsigned long); | ||
131 | extern void _set_L3CR(unsigned long); | ||
132 | #else | ||
133 | #define _get_L2CR() 0L | ||
134 | #define _get_L3CR() 0L | ||
135 | #define _set_L2CR(val) do { } while(0) | ||
136 | #define _set_L3CR(val) do { } while(0) | ||
137 | #endif | ||
138 | |||
139 | extern void via_cuda_init(void); | ||
140 | extern void read_rtc_time(void); | ||
141 | extern void pmac_find_display(void); | ||
142 | extern void giveup_fpu(struct task_struct *); | ||
143 | extern void disable_kernel_fp(void); | ||
144 | extern void enable_kernel_fp(void); | ||
145 | extern void flush_fp_to_thread(struct task_struct *); | ||
146 | extern void enable_kernel_altivec(void); | ||
147 | extern void giveup_altivec(struct task_struct *); | ||
148 | extern void load_up_altivec(struct task_struct *); | ||
149 | extern int emulate_altivec(struct pt_regs *); | ||
150 | extern void __giveup_vsx(struct task_struct *); | ||
151 | extern void giveup_vsx(struct task_struct *); | ||
152 | extern void enable_kernel_spe(void); | ||
153 | extern void giveup_spe(struct task_struct *); | ||
154 | extern void load_up_spe(struct task_struct *); | ||
155 | extern int fix_alignment(struct pt_regs *); | ||
156 | extern void cvt_fd(float *from, double *to); | ||
157 | extern void cvt_df(double *from, float *to); | ||
158 | |||
159 | #ifndef CONFIG_SMP | ||
160 | extern void discard_lazy_cpu_state(void); | ||
161 | #else | ||
162 | static inline void discard_lazy_cpu_state(void) | ||
163 | { | ||
164 | } | ||
165 | #endif | ||
166 | |||
167 | #ifdef CONFIG_ALTIVEC | ||
168 | extern void flush_altivec_to_thread(struct task_struct *); | ||
169 | #else | ||
170 | static inline void flush_altivec_to_thread(struct task_struct *t) | ||
171 | { | ||
172 | } | ||
173 | #endif | ||
174 | |||
175 | #ifdef CONFIG_VSX | ||
176 | extern void flush_vsx_to_thread(struct task_struct *); | ||
177 | #else | ||
178 | static inline void flush_vsx_to_thread(struct task_struct *t) | ||
179 | { | ||
180 | } | ||
181 | #endif | ||
182 | |||
183 | #ifdef CONFIG_SPE | ||
184 | extern void flush_spe_to_thread(struct task_struct *); | ||
185 | #else | ||
186 | static inline void flush_spe_to_thread(struct task_struct *t) | ||
187 | { | ||
188 | } | ||
189 | #endif | ||
190 | |||
191 | extern int call_rtas(const char *, int, int, unsigned long *, ...); | ||
192 | extern void cacheable_memzero(void *p, unsigned int nb); | ||
193 | extern void *cacheable_memcpy(void *, const void *, unsigned int); | ||
194 | extern int do_page_fault(struct pt_regs *, unsigned long, unsigned long); | ||
195 | extern void bad_page_fault(struct pt_regs *, unsigned long, int); | ||
196 | extern int die(const char *, struct pt_regs *, long); | ||
197 | extern void _exception(int, struct pt_regs *, int, unsigned long); | ||
198 | extern void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val); | ||
199 | |||
200 | #ifdef CONFIG_BOOKE_WDT | ||
201 | extern u32 booke_wdt_enabled; | ||
202 | extern u32 booke_wdt_period; | ||
203 | #endif /* CONFIG_BOOKE_WDT */ | ||
204 | |||
205 | struct device_node; | ||
206 | extern void note_scsi_host(struct device_node *, void *); | ||
207 | |||
208 | extern struct task_struct *__switch_to(struct task_struct *, | ||
209 | struct task_struct *); | ||
210 | #define switch_to(prev, next, last) ((last) = __switch_to((prev), (next))) | ||
211 | |||
212 | struct thread_struct; | ||
213 | extern struct task_struct *_switch(struct thread_struct *prev, | ||
214 | struct thread_struct *next); | ||
215 | |||
216 | extern unsigned int rtas_data; | ||
217 | extern int mem_init_done; /* set on boot once kmalloc can be called */ | ||
218 | extern int init_bootmem_done; /* set once bootmem is available */ | ||
219 | extern phys_addr_t memory_limit; | ||
220 | extern unsigned long klimit; | ||
221 | extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask); | ||
222 | |||
223 | extern int powersave_nap; /* set if nap mode can be used in idle loop */ | ||
224 | |||
225 | /* | ||
226 | * Atomic exchange | ||
227 | * | ||
228 | * Changes the memory location '*ptr' to be val and returns | ||
229 | * the previous value stored there. | ||
230 | */ | ||
231 | static __always_inline unsigned long | ||
232 | __xchg_u32(volatile void *p, unsigned long val) | ||
233 | { | ||
234 | unsigned long prev; | ||
235 | |||
236 | __asm__ __volatile__( | ||
237 | PPC_RELEASE_BARRIER | ||
238 | "1: lwarx %0,0,%2 \n" | ||
239 | PPC405_ERR77(0,%2) | ||
240 | " stwcx. %3,0,%2 \n\ | ||
241 | bne- 1b" | ||
242 | PPC_ACQUIRE_BARRIER | ||
243 | : "=&r" (prev), "+m" (*(volatile unsigned int *)p) | ||
244 | : "r" (p), "r" (val) | ||
245 | : "cc", "memory"); | ||
246 | |||
247 | return prev; | ||
248 | } | ||
249 | |||
250 | /* | ||
251 | * Atomic exchange | ||
252 | * | ||
253 | * Changes the memory location '*ptr' to be val and returns | ||
254 | * the previous value stored there. | ||
255 | */ | ||
256 | static __always_inline unsigned long | ||
257 | __xchg_u32_local(volatile void *p, unsigned long val) | ||
258 | { | ||
259 | unsigned long prev; | ||
260 | |||
261 | __asm__ __volatile__( | ||
262 | "1: lwarx %0,0,%2 \n" | ||
263 | PPC405_ERR77(0,%2) | ||
264 | " stwcx. %3,0,%2 \n\ | ||
265 | bne- 1b" | ||
266 | : "=&r" (prev), "+m" (*(volatile unsigned int *)p) | ||
267 | : "r" (p), "r" (val) | ||
268 | : "cc", "memory"); | ||
269 | |||
270 | return prev; | ||
271 | } | ||
272 | |||
273 | #ifdef CONFIG_PPC64 | ||
274 | static __always_inline unsigned long | ||
275 | __xchg_u64(volatile void *p, unsigned long val) | ||
276 | { | ||
277 | unsigned long prev; | ||
278 | |||
279 | __asm__ __volatile__( | ||
280 | PPC_RELEASE_BARRIER | ||
281 | "1: ldarx %0,0,%2 \n" | ||
282 | PPC405_ERR77(0,%2) | ||
283 | " stdcx. %3,0,%2 \n\ | ||
284 | bne- 1b" | ||
285 | PPC_ACQUIRE_BARRIER | ||
286 | : "=&r" (prev), "+m" (*(volatile unsigned long *)p) | ||
287 | : "r" (p), "r" (val) | ||
288 | : "cc", "memory"); | ||
289 | |||
290 | return prev; | ||
291 | } | ||
292 | |||
293 | static __always_inline unsigned long | ||
294 | __xchg_u64_local(volatile void *p, unsigned long val) | ||
295 | { | ||
296 | unsigned long prev; | ||
297 | |||
298 | __asm__ __volatile__( | ||
299 | "1: ldarx %0,0,%2 \n" | ||
300 | PPC405_ERR77(0,%2) | ||
301 | " stdcx. %3,0,%2 \n\ | ||
302 | bne- 1b" | ||
303 | : "=&r" (prev), "+m" (*(volatile unsigned long *)p) | ||
304 | : "r" (p), "r" (val) | ||
305 | : "cc", "memory"); | ||
306 | |||
307 | return prev; | ||
308 | } | ||
309 | #endif | ||
310 | |||
311 | /* | ||
312 | * This function doesn't exist, so you'll get a linker error | ||
313 | * if something tries to do an invalid xchg(). | ||
314 | */ | ||
315 | extern void __xchg_called_with_bad_pointer(void); | ||
316 | |||
317 | static __always_inline unsigned long | ||
318 | __xchg(volatile void *ptr, unsigned long x, unsigned int size) | ||
319 | { | ||
320 | switch (size) { | ||
321 | case 4: | ||
322 | return __xchg_u32(ptr, x); | ||
323 | #ifdef CONFIG_PPC64 | ||
324 | case 8: | ||
325 | return __xchg_u64(ptr, x); | ||
326 | #endif | ||
327 | } | ||
328 | __xchg_called_with_bad_pointer(); | ||
329 | return x; | ||
330 | } | ||
331 | |||
332 | static __always_inline unsigned long | ||
333 | __xchg_local(volatile void *ptr, unsigned long x, unsigned int size) | ||
334 | { | ||
335 | switch (size) { | ||
336 | case 4: | ||
337 | return __xchg_u32_local(ptr, x); | ||
338 | #ifdef CONFIG_PPC64 | ||
339 | case 8: | ||
340 | return __xchg_u64_local(ptr, x); | ||
341 | #endif | ||
342 | } | ||
343 | __xchg_called_with_bad_pointer(); | ||
344 | return x; | ||
345 | } | ||
346 | #define xchg(ptr,x) \ | ||
347 | ({ \ | ||
348 | __typeof__(*(ptr)) _x_ = (x); \ | ||
349 | (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, sizeof(*(ptr))); \ | ||
350 | }) | ||
351 | |||
352 | #define xchg_local(ptr,x) \ | ||
353 | ({ \ | ||
354 | __typeof__(*(ptr)) _x_ = (x); \ | ||
355 | (__typeof__(*(ptr))) __xchg_local((ptr), \ | ||
356 | (unsigned long)_x_, sizeof(*(ptr))); \ | ||
357 | }) | ||
358 | |||
359 | /* | ||
360 | * Compare and exchange - if *p == old, set it to new, | ||
361 | * and return the old value of *p. | ||
362 | */ | ||
363 | #define __HAVE_ARCH_CMPXCHG 1 | ||
364 | |||
365 | static __always_inline unsigned long | ||
366 | __cmpxchg_u32(volatile unsigned int *p, unsigned long old, unsigned long new) | ||
367 | { | ||
368 | unsigned int prev; | ||
369 | |||
370 | __asm__ __volatile__ ( | ||
371 | PPC_RELEASE_BARRIER | ||
372 | "1: lwarx %0,0,%2 # __cmpxchg_u32\n\ | ||
373 | cmpw 0,%0,%3\n\ | ||
374 | bne- 2f\n" | ||
375 | PPC405_ERR77(0,%2) | ||
376 | " stwcx. %4,0,%2\n\ | ||
377 | bne- 1b" | ||
378 | PPC_ACQUIRE_BARRIER | ||
379 | "\n\ | ||
380 | 2:" | ||
381 | : "=&r" (prev), "+m" (*p) | ||
382 | : "r" (p), "r" (old), "r" (new) | ||
383 | : "cc", "memory"); | ||
384 | |||
385 | return prev; | ||
386 | } | ||
387 | |||
388 | static __always_inline unsigned long | ||
389 | __cmpxchg_u32_local(volatile unsigned int *p, unsigned long old, | ||
390 | unsigned long new) | ||
391 | { | ||
392 | unsigned int prev; | ||
393 | |||
394 | __asm__ __volatile__ ( | ||
395 | "1: lwarx %0,0,%2 # __cmpxchg_u32\n\ | ||
396 | cmpw 0,%0,%3\n\ | ||
397 | bne- 2f\n" | ||
398 | PPC405_ERR77(0,%2) | ||
399 | " stwcx. %4,0,%2\n\ | ||
400 | bne- 1b" | ||
401 | "\n\ | ||
402 | 2:" | ||
403 | : "=&r" (prev), "+m" (*p) | ||
404 | : "r" (p), "r" (old), "r" (new) | ||
405 | : "cc", "memory"); | ||
406 | |||
407 | return prev; | ||
408 | } | ||
409 | |||
410 | #ifdef CONFIG_PPC64 | ||
411 | static __always_inline unsigned long | ||
412 | __cmpxchg_u64(volatile unsigned long *p, unsigned long old, unsigned long new) | ||
413 | { | ||
414 | unsigned long prev; | ||
415 | |||
416 | __asm__ __volatile__ ( | ||
417 | PPC_RELEASE_BARRIER | ||
418 | "1: ldarx %0,0,%2 # __cmpxchg_u64\n\ | ||
419 | cmpd 0,%0,%3\n\ | ||
420 | bne- 2f\n\ | ||
421 | stdcx. %4,0,%2\n\ | ||
422 | bne- 1b" | ||
423 | PPC_ACQUIRE_BARRIER | ||
424 | "\n\ | ||
425 | 2:" | ||
426 | : "=&r" (prev), "+m" (*p) | ||
427 | : "r" (p), "r" (old), "r" (new) | ||
428 | : "cc", "memory"); | ||
429 | |||
430 | return prev; | ||
431 | } | ||
432 | |||
433 | static __always_inline unsigned long | ||
434 | __cmpxchg_u64_local(volatile unsigned long *p, unsigned long old, | ||
435 | unsigned long new) | ||
436 | { | ||
437 | unsigned long prev; | ||
438 | |||
439 | __asm__ __volatile__ ( | ||
440 | "1: ldarx %0,0,%2 # __cmpxchg_u64\n\ | ||
441 | cmpd 0,%0,%3\n\ | ||
442 | bne- 2f\n\ | ||
443 | stdcx. %4,0,%2\n\ | ||
444 | bne- 1b" | ||
445 | "\n\ | ||
446 | 2:" | ||
447 | : "=&r" (prev), "+m" (*p) | ||
448 | : "r" (p), "r" (old), "r" (new) | ||
449 | : "cc", "memory"); | ||
450 | |||
451 | return prev; | ||
452 | } | ||
453 | #endif | ||
454 | |||
455 | /* This function doesn't exist, so you'll get a linker error | ||
456 | if something tries to do an invalid cmpxchg(). */ | ||
457 | extern void __cmpxchg_called_with_bad_pointer(void); | ||
458 | |||
459 | static __always_inline unsigned long | ||
460 | __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, | ||
461 | unsigned int size) | ||
462 | { | ||
463 | switch (size) { | ||
464 | case 4: | ||
465 | return __cmpxchg_u32(ptr, old, new); | ||
466 | #ifdef CONFIG_PPC64 | ||
467 | case 8: | ||
468 | return __cmpxchg_u64(ptr, old, new); | ||
469 | #endif | ||
470 | } | ||
471 | __cmpxchg_called_with_bad_pointer(); | ||
472 | return old; | ||
473 | } | ||
474 | |||
475 | static __always_inline unsigned long | ||
476 | __cmpxchg_local(volatile void *ptr, unsigned long old, unsigned long new, | ||
477 | unsigned int size) | ||
478 | { | ||
479 | switch (size) { | ||
480 | case 4: | ||
481 | return __cmpxchg_u32_local(ptr, old, new); | ||
482 | #ifdef CONFIG_PPC64 | ||
483 | case 8: | ||
484 | return __cmpxchg_u64_local(ptr, old, new); | ||
485 | #endif | ||
486 | } | ||
487 | __cmpxchg_called_with_bad_pointer(); | ||
488 | return old; | ||
489 | } | ||
490 | |||
491 | #define cmpxchg(ptr, o, n) \ | ||
492 | ({ \ | ||
493 | __typeof__(*(ptr)) _o_ = (o); \ | ||
494 | __typeof__(*(ptr)) _n_ = (n); \ | ||
495 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ | ||
496 | (unsigned long)_n_, sizeof(*(ptr))); \ | ||
497 | }) | ||
498 | |||
499 | |||
500 | #define cmpxchg_local(ptr, o, n) \ | ||
501 | ({ \ | ||
502 | __typeof__(*(ptr)) _o_ = (o); \ | ||
503 | __typeof__(*(ptr)) _n_ = (n); \ | ||
504 | (__typeof__(*(ptr))) __cmpxchg_local((ptr), (unsigned long)_o_, \ | ||
505 | (unsigned long)_n_, sizeof(*(ptr))); \ | ||
506 | }) | ||
507 | |||
508 | #ifdef CONFIG_PPC64 | ||
509 | /* | ||
510 | * We handle most unaligned accesses in hardware. On the other hand | ||
511 | * unaligned DMA can be very expensive on some ppc64 IO chips (it does | ||
512 | * powers of 2 writes until it reaches sufficient alignment). | ||
513 | * | ||
514 | * Based on this we disable the IP header alignment in network drivers. | ||
515 | */ | ||
516 | #define NET_IP_ALIGN 0 | ||
517 | |||
518 | #define cmpxchg64(ptr, o, n) \ | ||
519 | ({ \ | ||
520 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ | ||
521 | cmpxchg((ptr), (o), (n)); \ | ||
522 | }) | ||
523 | #define cmpxchg64_local(ptr, o, n) \ | ||
524 | ({ \ | ||
525 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ | ||
526 | cmpxchg_local((ptr), (o), (n)); \ | ||
527 | }) | ||
528 | #else | ||
529 | #include <asm-generic/cmpxchg-local.h> | ||
530 | #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) | ||
531 | #endif | ||
532 | |||
533 | extern unsigned long arch_align_stack(unsigned long sp); | ||
534 | |||
535 | /* Used in very early kernel initialization. */ | ||
536 | extern unsigned long reloc_offset(void); | ||
537 | extern unsigned long add_reloc_offset(unsigned long); | ||
538 | extern void reloc_got2(unsigned long); | ||
539 | |||
540 | #define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x))) | ||
541 | |||
542 | extern struct dentry *powerpc_debugfs_root; | ||
543 | |||
544 | #endif /* __KERNEL__ */ | ||
545 | #endif /* _ASM_POWERPC_SYSTEM_H */ | ||
diff --git a/arch/powerpc/include/asm/termbits.h b/arch/powerpc/include/asm/termbits.h new file mode 100644 index 00000000000..549d700e18f --- /dev/null +++ b/arch/powerpc/include/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 | |||
11 | typedef unsigned char cc_t; | ||
12 | typedef unsigned int speed_t; | ||
13 | typedef 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 | ||
22 | struct 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 | |||
35 | struct 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/asm/ucontext.h b/arch/powerpc/include/asm/ucontext.h new file mode 100644 index 00000000000..d9a4ddf0cc8 --- /dev/null +++ b/arch/powerpc/include/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__ | ||
12 | struct 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 | |||
20 | struct 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 */ | ||