blob: 6dedc08e62c874f26d5e57917b79d9bc5f507dae [file] [log] [blame]
Jimi Xenidis9d670282011-09-29 10:55:12 +00001#ifndef _ARCH_POWERPC_MM_ICSWX_H_
2#define _ARCH_POWERPC_MM_ICSWX_H_
3
4/*
5 * ICSWX and ACOP Management
6 *
7 * Copyright (C) 2011 Anton Blanchard, IBM Corp. <anton@samba.org>
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
16#include <asm/mmu_context.h>
17
18/* also used to denote that PIDs are not used */
19#define COP_PID_NONE 0
20
21static inline void sync_cop(void *arg)
22{
23 struct mm_struct *mm = arg;
24
25 if (mm == current->active_mm)
26 switch_cop(current->active_mm);
27}
28
29#ifdef CONFIG_PPC_ICSWX_PID
30extern int get_cop_pid(struct mm_struct *mm);
31extern int disable_cop_pid(struct mm_struct *mm);
32extern 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
38
Jimi Xenidisc3dcf532011-09-29 10:55:14 +000039/*
40 * These are implementation bits for architected registers. If this
41 * ever becomes architecture the should be moved to reg.h et. al.
42 */
43/* UCT is the same bit for Server and Embedded */
44#define ICSWX_DSI_UCT 0x00004000 /* Unavailable Coprocessor Type */
45
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
54
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 */
59
60extern int acop_handle_fault(struct pt_regs *regs, unsigned long address,
61 unsigned long error_code);
Jimi Xenidisde801de2012-02-28 13:27:07 +000062
63static inline u64 acop_copro_type_bit(unsigned int type)
64{
65 return 1ULL << (63 - type);
66}
67
Jimi Xenidis9d670282011-09-29 10:55:12 +000068#endif /* !_ARCH_POWERPC_MM_ICSWX_H_ */