aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ppc64
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-ppc64')
-rw-r--r--include/asm-ppc64/hvcall.h6
-rw-r--r--include/asm-ppc64/machdep.h5
-rw-r--r--include/asm-ppc64/pci-bridge.h5
-rw-r--r--include/asm-ppc64/plpar_wrappers.h9
-rw-r--r--include/asm-ppc64/processor.h1
-rw-r--r--include/asm-ppc64/ptrace-common.h92
-rw-r--r--include/asm-ppc64/ptrace.h128
-rw-r--r--include/asm-ppc64/system.h3
8 files changed, 193 insertions, 56 deletions
diff --git a/include/asm-ppc64/hvcall.h b/include/asm-ppc64/hvcall.h
index 4f668a4baff0..ab7c3cf24888 100644
--- a/include/asm-ppc64/hvcall.h
+++ b/include/asm-ppc64/hvcall.h
@@ -56,6 +56,11 @@
56#define H_PP1 (1UL<<(63-62)) 56#define H_PP1 (1UL<<(63-62))
57#define H_PP2 (1UL<<(63-63)) 57#define H_PP2 (1UL<<(63-63))
58 58
59/* DABRX flags */
60#define H_DABRX_HYPERVISOR (1UL<<(63-61))
61#define H_DABRX_KERNEL (1UL<<(63-62))
62#define H_DABRX_USER (1UL<<(63-63))
63
59/* pSeries hypervisor opcodes */ 64/* pSeries hypervisor opcodes */
60#define H_REMOVE 0x04 65#define H_REMOVE 0x04
61#define H_ENTER 0x08 66#define H_ENTER 0x08
@@ -101,6 +106,7 @@
101#define H_VIO_SIGNAL 0x104 106#define H_VIO_SIGNAL 0x104
102#define H_SEND_CRQ 0x108 107#define H_SEND_CRQ 0x108
103#define H_COPY_RDMA 0x110 108#define H_COPY_RDMA 0x110
109#define H_SET_XDABR 0x134
104#define H_STUFF_TCE 0x138 110#define H_STUFF_TCE 0x138
105#define H_PUT_TCE_INDIRECT 0x13C 111#define H_PUT_TCE_INDIRECT 0x13C
106#define H_VTERM_PARTNER_INFO 0x150 112#define H_VTERM_PARTNER_INFO 0x150
diff --git a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h
index 9a1ef4427ed2..8027160ec96d 100644
--- a/include/asm-ppc64/machdep.h
+++ b/include/asm-ppc64/machdep.h
@@ -88,6 +88,7 @@ struct machdep_calls {
88 88
89 /* PCI stuff */ 89 /* PCI stuff */
90 void (*pcibios_fixup)(void); 90 void (*pcibios_fixup)(void);
91 int (*pci_probe_mode)(struct pci_bus *);
91 92
92 void (*restart)(char *cmd); 93 void (*restart)(char *cmd);
93 void (*power_off)(void); 94 void (*power_off)(void);
@@ -173,10 +174,6 @@ extern sys_ctrler_t sys_ctrler;
173void ppc64_boot_msg(unsigned int src, const char *msg); 174void ppc64_boot_msg(unsigned int src, const char *msg);
174/* Print a termination message (print only -- does not stop the kernel) */ 175/* Print a termination message (print only -- does not stop the kernel) */
175void ppc64_terminate_msg(unsigned int src, const char *msg); 176void ppc64_terminate_msg(unsigned int src, const char *msg);
176/* Print something that needs attention (device error, etc) */
177void ppc64_attention_msg(unsigned int src, const char *msg);
178/* Print a dump progress message. */
179void ppc64_dump_msg(unsigned int src, const char *msg);
180 177
181static inline void log_error(char *buf, unsigned int err_type, int fatal) 178static inline void log_error(char *buf, unsigned int err_type, int fatal)
182{ 179{
diff --git a/include/asm-ppc64/pci-bridge.h b/include/asm-ppc64/pci-bridge.h
index 6b4a5b1f695e..d8991389ab39 100644
--- a/include/asm-ppc64/pci-bridge.h
+++ b/include/asm-ppc64/pci-bridge.h
@@ -119,5 +119,10 @@ static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
119 return PCI_DN(busdn)->phb; 119 return PCI_DN(busdn)->phb;
120} 120}
121 121
122/* Return values for ppc_md.pci_probe_mode function */
123#define PCI_PROBE_NONE -1 /* Don't look at this bus at all */
124#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */
125#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */
126
122#endif 127#endif
123#endif /* __KERNEL__ */ 128#endif /* __KERNEL__ */
diff --git a/include/asm-ppc64/plpar_wrappers.h b/include/asm-ppc64/plpar_wrappers.h
index f4a5fb7d67c7..72dd2449ee76 100644
--- a/include/asm-ppc64/plpar_wrappers.h
+++ b/include/asm-ppc64/plpar_wrappers.h
@@ -107,5 +107,14 @@ static inline long plpar_put_term_char(unsigned long termno,
107 lbuf[1]); 107 lbuf[1]);
108} 108}
109 109
110static inline long plpar_set_xdabr(unsigned long address, unsigned long flags)
111{
112 return plpar_hcall_norets(H_SET_XDABR, address, flags);
113}
114
115static inline long plpar_set_dabr(unsigned long val)
116{
117 return plpar_hcall_norets(H_SET_DABR, val);
118}
110 119
111#endif /* _PPC64_PLPAR_WRAPPERS_H */ 120#endif /* _PPC64_PLPAR_WRAPPERS_H */
diff --git a/include/asm-ppc64/processor.h b/include/asm-ppc64/processor.h
index 8bd7aa959385..4146189006e3 100644
--- a/include/asm-ppc64/processor.h
+++ b/include/asm-ppc64/processor.h
@@ -433,6 +433,7 @@ struct thread_struct {
433 unsigned long start_tb; /* Start purr when proc switched in */ 433 unsigned long start_tb; /* Start purr when proc switched in */
434 unsigned long accum_tb; /* Total accumilated purr for process */ 434 unsigned long accum_tb; /* Total accumilated purr for process */
435 unsigned long vdso_base; /* base of the vDSO library */ 435 unsigned long vdso_base; /* base of the vDSO library */
436 unsigned long dabr; /* Data address breakpoint register */
436#ifdef CONFIG_ALTIVEC 437#ifdef CONFIG_ALTIVEC
437 /* Complete AltiVec register set */ 438 /* Complete AltiVec register set */
438 vector128 vr[32] __attribute((aligned(16))); 439 vector128 vr[32] __attribute((aligned(16)));
diff --git a/include/asm-ppc64/ptrace-common.h b/include/asm-ppc64/ptrace-common.h
index af03547f9c7e..b1babb729673 100644
--- a/include/asm-ppc64/ptrace-common.h
+++ b/include/asm-ppc64/ptrace-common.h
@@ -11,6 +11,10 @@
11 11
12#ifndef _PPC64_PTRACE_COMMON_H 12#ifndef _PPC64_PTRACE_COMMON_H
13#define _PPC64_PTRACE_COMMON_H 13#define _PPC64_PTRACE_COMMON_H
14
15#include <linux/config.h>
16#include <asm/system.h>
17
14/* 18/*
15 * Set of msr bits that gdb can change on behalf of a process. 19 * Set of msr bits that gdb can change on behalf of a process.
16 */ 20 */
@@ -69,4 +73,92 @@ static inline void clear_single_step(struct task_struct *task)
69 clear_ti_thread_flag(task->thread_info, TIF_SINGLESTEP); 73 clear_ti_thread_flag(task->thread_info, TIF_SINGLESTEP);
70} 74}
71 75
76#ifdef CONFIG_ALTIVEC
77/*
78 * Get/set all the altivec registers vr0..vr31, vscr, vrsave, in one go.
79 * The transfer totals 34 quadword. Quadwords 0-31 contain the
80 * corresponding vector registers. Quadword 32 contains the vscr as the
81 * last word (offset 12) within that quadword. Quadword 33 contains the
82 * vrsave as the first word (offset 0) within the quadword.
83 *
84 * This definition of the VMX state is compatible with the current PPC32
85 * ptrace interface. This allows signal handling and ptrace to use the
86 * same structures. This also simplifies the implementation of a bi-arch
87 * (combined (32- and 64-bit) gdb.
88 */
89
90/*
91 * Get contents of AltiVec register state in task TASK
92 */
93static inline int get_vrregs(unsigned long __user *data,
94 struct task_struct *task)
95{
96 unsigned long regsize;
97
98 /* copy AltiVec registers VR[0] .. VR[31] */
99 regsize = 32 * sizeof(vector128);
100 if (copy_to_user(data, task->thread.vr, regsize))
101 return -EFAULT;
102 data += (regsize / sizeof(unsigned long));
103
104 /* copy VSCR */
105 regsize = 1 * sizeof(vector128);
106 if (copy_to_user(data, &task->thread.vscr, regsize))
107 return -EFAULT;
108 data += (regsize / sizeof(unsigned long));
109
110 /* copy VRSAVE */
111 if (put_user(task->thread.vrsave, (u32 __user *)data))
112 return -EFAULT;
113
114 return 0;
115}
116
117/*
118 * Write contents of AltiVec register state into task TASK.
119 */
120static inline int set_vrregs(struct task_struct *task,
121 unsigned long __user *data)
122{
123 unsigned long regsize;
124
125 /* copy AltiVec registers VR[0] .. VR[31] */
126 regsize = 32 * sizeof(vector128);
127 if (copy_from_user(task->thread.vr, data, regsize))
128 return -EFAULT;
129 data += (regsize / sizeof(unsigned long));
130
131 /* copy VSCR */
132 regsize = 1 * sizeof(vector128);
133 if (copy_from_user(&task->thread.vscr, data, regsize))
134 return -EFAULT;
135 data += (regsize / sizeof(unsigned long));
136
137 /* copy VRSAVE */
138 if (get_user(task->thread.vrsave, (u32 __user *)data))
139 return -EFAULT;
140
141 return 0;
142}
143#endif
144
145static inline int ptrace_set_debugreg(struct task_struct *task,
146 unsigned long addr, unsigned long data)
147{
148 /* We only support one DABR and no IABRS at the moment */
149 if (addr > 0)
150 return -EINVAL;
151
152 /* The bottom 3 bits are flags */
153 if ((data & ~0x7UL) >= TASK_SIZE)
154 return -EIO;
155
156 /* Ensure translation is on */
157 if (data && !(data & DABR_TRANSLATION))
158 return -EIO;
159
160 task->thread.dabr = data;
161 return 0;
162}
163
72#endif /* _PPC64_PTRACE_COMMON_H */ 164#endif /* _PPC64_PTRACE_COMMON_H */
diff --git a/include/asm-ppc64/ptrace.h b/include/asm-ppc64/ptrace.h
index c96aad28fc08..3a55377f1fd3 100644
--- a/include/asm-ppc64/ptrace.h
+++ b/include/asm-ppc64/ptrace.h
@@ -25,56 +25,49 @@
25 */ 25 */
26 26
27#ifndef __ASSEMBLY__ 27#ifndef __ASSEMBLY__
28#define PPC_REG unsigned long 28
29struct pt_regs { 29struct pt_regs {
30 PPC_REG gpr[32]; 30 unsigned long gpr[32];
31 PPC_REG nip; 31 unsigned long nip;
32 PPC_REG msr; 32 unsigned long msr;
33 PPC_REG orig_gpr3; /* Used for restarting system calls */ 33 unsigned long orig_gpr3; /* Used for restarting system calls */
34 PPC_REG ctr; 34 unsigned long ctr;
35 PPC_REG link; 35 unsigned long link;
36 PPC_REG xer; 36 unsigned long xer;
37 PPC_REG ccr; 37 unsigned long ccr;
38 PPC_REG softe; /* Soft enabled/disabled */ 38 unsigned long softe; /* Soft enabled/disabled */
39 PPC_REG trap; /* Reason for being here */ 39 unsigned long trap; /* Reason for being here */
40 PPC_REG dar; /* Fault registers */ 40 unsigned long dar; /* Fault registers */
41 PPC_REG dsisr; 41 unsigned long dsisr;
42 PPC_REG result; /* Result of a system call */ 42 unsigned long result; /* Result of a system call */
43}; 43};
44 44
45#define PPC_REG_32 unsigned int
46struct pt_regs32 { 45struct pt_regs32 {
47 PPC_REG_32 gpr[32]; 46 unsigned int gpr[32];
48 PPC_REG_32 nip; 47 unsigned int nip;
49 PPC_REG_32 msr; 48 unsigned int msr;
50 PPC_REG_32 orig_gpr3; /* Used for restarting system calls */ 49 unsigned int orig_gpr3; /* Used for restarting system calls */
51 PPC_REG_32 ctr; 50 unsigned int ctr;
52 PPC_REG_32 link; 51 unsigned int link;
53 PPC_REG_32 xer; 52 unsigned int xer;
54 PPC_REG_32 ccr; 53 unsigned int ccr;
55 PPC_REG_32 mq; /* 601 only (not used at present) */ 54 unsigned int mq; /* 601 only (not used at present) */
56 /* Used on APUS to hold IPL value. */ 55 unsigned int trap; /* Reason for being here */
57 PPC_REG_32 trap; /* Reason for being here */ 56 unsigned int dar; /* Fault registers */
58 PPC_REG_32 dar; /* Fault registers */ 57 unsigned int dsisr;
59 PPC_REG_32 dsisr; 58 unsigned int result; /* Result of a system call */
60 PPC_REG_32 result; /* Result of a system call */
61}; 59};
62 60
61#ifdef __KERNEL__
62
63#define instruction_pointer(regs) ((regs)->nip) 63#define instruction_pointer(regs) ((regs)->nip)
64
64#ifdef CONFIG_SMP 65#ifdef CONFIG_SMP
65extern unsigned long profile_pc(struct pt_regs *regs); 66extern unsigned long profile_pc(struct pt_regs *regs);
66#else 67#else
67#define profile_pc(regs) instruction_pointer(regs) 68#define profile_pc(regs) instruction_pointer(regs)
68#endif 69#endif
69 70
70#endif /* __ASSEMBLY__ */
71
72#define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */
73
74/* Size of dummy stack frame allocated when calling signal handler. */
75#define __SIGNAL_FRAMESIZE 128
76#define __SIGNAL_FRAMESIZE32 64
77
78#define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1) 71#define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1)
79 72
80#define force_successful_syscall_return() \ 73#define force_successful_syscall_return() \
@@ -89,6 +82,16 @@ extern unsigned long profile_pc(struct pt_regs *regs);
89#define TRAP(regs) ((regs)->trap & ~0xF) 82#define TRAP(regs) ((regs)->trap & ~0xF)
90#define CHECK_FULL_REGS(regs) BUG_ON(regs->trap & 1) 83#define CHECK_FULL_REGS(regs) BUG_ON(regs->trap & 1)
91 84
85#endif /* __KERNEL__ */
86
87#endif /* __ASSEMBLY__ */
88
89#define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */
90
91/* Size of dummy stack frame allocated when calling signal handler. */
92#define __SIGNAL_FRAMESIZE 128
93#define __SIGNAL_FRAMESIZE32 64
94
92/* 95/*
93 * Offsets used by 'ptrace' system call interface. 96 * Offsets used by 'ptrace' system call interface.
94 */ 97 */
@@ -135,17 +138,21 @@ extern unsigned long profile_pc(struct pt_regs *regs);
135#define PT_XER 37 138#define PT_XER 37
136#define PT_CCR 38 139#define PT_CCR 38
137#define PT_SOFTE 39 140#define PT_SOFTE 39
141#define PT_TRAP 40
142#define PT_DAR 41
143#define PT_DSISR 42
138#define PT_RESULT 43 144#define PT_RESULT 43
139 145
140#define PT_FPR0 48 146#define PT_FPR0 48
141 147
142/* Kernel and userspace will both use this PT_FPSCR value. 32-bit apps will have 148/*
143 * visibility to the asm-ppc/ptrace.h header instead of this one. 149 * Kernel and userspace will both use this PT_FPSCR value. 32-bit apps will
150 * have visibility to the asm-ppc/ptrace.h header instead of this one.
144 */ 151 */
145#define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */ 152#define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */
146 153
147#ifdef __KERNEL__ 154#ifdef __KERNEL__
148#define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */ 155#define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */
149#endif 156#endif
150 157
151#define PT_VR0 82 /* each Vector reg occupies 2 slots in 64-bit */ 158#define PT_VR0 82 /* each Vector reg occupies 2 slots in 64-bit */
@@ -173,17 +180,34 @@ extern unsigned long profile_pc(struct pt_regs *regs);
173#define PTRACE_GETVRREGS 18 180#define PTRACE_GETVRREGS 18
174#define PTRACE_SETVRREGS 19 181#define PTRACE_SETVRREGS 19
175 182
176/* Additional PTRACE requests implemented on PowerPC. */ 183/*
177#define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */ 184 * While we dont have 64bit book E processors, we need to reserve the
178#define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */ 185 * relevant ptrace calls for 32bit compatibility.
179#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */ 186 */
180#define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */ 187#if 0
181#define PPC_PTRACE_PEEKTEXT_3264 0x95 /* Read word at location ADDR on a 64-bit process from a 32-bit process. */ 188#define PTRACE_GETEVRREGS 20
182#define PPC_PTRACE_PEEKDATA_3264 0x94 /* Read word at location ADDR on a 64-bit process from a 32-bit process. */ 189#define PTRACE_SETEVRREGS 21
183#define PPC_PTRACE_POKETEXT_3264 0x93 /* Write word at location ADDR on a 64-bit process from a 32-bit process. */ 190#endif
184#define PPC_PTRACE_POKEDATA_3264 0x92 /* Write word at location ADDR on a 64-bit process from a 32-bit process. */
185#define PPC_PTRACE_PEEKUSR_3264 0x91 /* Read a register (specified by ADDR) out of the "user area" on a 64-bit process from a 32-bit process. */
186#define PPC_PTRACE_POKEUSR_3264 0x90 /* Write DATA into location ADDR within the "user area" on a 64-bit process from a 32-bit process. */
187 191
192/*
193 * Get or set a debug register. The first 16 are DABR registers and the
194 * second 16 are IABR registers.
195 */
196#define PTRACE_GET_DEBUGREG 25
197#define PTRACE_SET_DEBUGREG 26
198
199/* Additional PTRACE requests implemented on PowerPC. */
200#define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */
201#define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */
202#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */
203#define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */
204
205/* Calls to trace a 64bit program from a 32bit program */
206#define PPC_PTRACE_PEEKTEXT_3264 0x95
207#define PPC_PTRACE_PEEKDATA_3264 0x94
208#define PPC_PTRACE_POKETEXT_3264 0x93
209#define PPC_PTRACE_POKEDATA_3264 0x92
210#define PPC_PTRACE_PEEKUSR_3264 0x91
211#define PPC_PTRACE_POKEUSR_3264 0x90
188 212
189#endif /* _PPC64_PTRACE_H */ 213#endif /* _PPC64_PTRACE_H */
diff --git a/include/asm-ppc64/system.h b/include/asm-ppc64/system.h
index c0396428cc3c..375015c62f20 100644
--- a/include/asm-ppc64/system.h
+++ b/include/asm-ppc64/system.h
@@ -101,6 +101,9 @@ static inline int debugger_dabr_match(struct pt_regs *regs) { return 0; }
101static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; } 101static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; }
102#endif 102#endif
103 103
104extern int set_dabr(unsigned long dabr);
105extern void _exception(int signr, struct pt_regs *regs, int code,
106 unsigned long addr);
104extern int fix_alignment(struct pt_regs *regs); 107extern int fix_alignment(struct pt_regs *regs);
105extern void bad_page_fault(struct pt_regs *regs, unsigned long address, 108extern void bad_page_fault(struct pt_regs *regs, unsigned long address,
106 int sig); 109 int sig);