Linux 4.1.18
[linux/fpc-iii.git] / arch / powerpc / mm / icswx.h
blob6dedc08e62c874f26d5e57917b79d9bc5f507dae
1 #ifndef _ARCH_POWERPC_MM_ICSWX_H_
2 #define _ARCH_POWERPC_MM_ICSWX_H_
4 /*
5 * ICSWX and ACOP Management
7 * Copyright (C) 2011 Anton Blanchard, IBM Corp. <anton@samba.org>
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.
16 #include <asm/mmu_context.h>
18 /* also used to denote that PIDs are not used */
19 #define COP_PID_NONE 0
21 static inline void sync_cop(void *arg)
23 struct mm_struct *mm = arg;
25 if (mm == current->active_mm)
26 switch_cop(current->active_mm);
29 #ifdef CONFIG_PPC_ICSWX_PID
30 extern int get_cop_pid(struct mm_struct *mm);
31 extern int disable_cop_pid(struct mm_struct *mm);
32 extern void free_cop_pid(int free_pid);
33 #else
34 #define get_cop_pid(m) (COP_PID_NONE)
35 #define disable_cop_pid(m) (COP_PID_NONE)
36 #define free_cop_pid(p)
37 #endif
40 * These are implementation bits for architected registers. If this
41 * ever becomes architecture the should be moved to reg.h et. al.
43 /* UCT is the same bit for Server and Embedded */
44 #define ICSWX_DSI_UCT 0x00004000 /* Unavailable Coprocessor Type */
46 #ifdef CONFIG_PPC_BOOK3E
47 /* Embedded implementation gives us no hints as to what the CT is */
48 #define ICSWX_GET_CT_HINT(x) (-1)
49 #else
50 /* Server implementation contains the CT value in the DSISR */
51 #define ICSWX_DSISR_CTMASK 0x00003f00
52 #define ICSWX_GET_CT_HINT(x) (((x) & ICSWX_DSISR_CTMASK) >> 8)
53 #endif
55 #define ICSWX_RC_STARTED 0x8 /* The request has been started */
56 #define ICSWX_RC_NOT_IDLE 0x4 /* No coprocessor found idle */
57 #define ICSWX_RC_NOT_FOUND 0x2 /* No coprocessor found */
58 #define ICSWX_RC_UNDEFINED 0x1 /* Reserved */
60 extern int acop_handle_fault(struct pt_regs *regs, unsigned long address,
61 unsigned long error_code);
63 static inline u64 acop_copro_type_bit(unsigned int type)
65 return 1ULL << (63 - type);
68 #endif /* !_ARCH_POWERPC_MM_ICSWX_H_ */