icswx.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef _ARCH_POWERPC_MM_ICSWX_H_
  2. #define _ARCH_POWERPC_MM_ICSWX_H_
  3. /*
  4. * ICSWX and ACOP Management
  5. *
  6. * Copyright (C) 2011 Anton Blanchard, IBM Corp. <anton@samba.org>
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version
  11. * 2 of the License, or (at your option) any later version.
  12. *
  13. */
  14. #include <asm/mmu_context.h>
  15. /* also used to denote that PIDs are not used */
  16. #define COP_PID_NONE 0
  17. static inline void sync_cop(void *arg)
  18. {
  19. struct mm_struct *mm = arg;
  20. if (mm == current->active_mm)
  21. switch_cop(current->active_mm);
  22. }
  23. #ifdef CONFIG_PPC_ICSWX_PID
  24. extern int get_cop_pid(struct mm_struct *mm);
  25. extern int disable_cop_pid(struct mm_struct *mm);
  26. extern void free_cop_pid(int free_pid);
  27. #else
  28. #define get_cop_pid(m) (COP_PID_NONE)
  29. #define disable_cop_pid(m) (COP_PID_NONE)
  30. #define free_cop_pid(p)
  31. #endif
  32. /*
  33. * These are implementation bits for architected registers. If this
  34. * ever becomes architecture the should be moved to reg.h et. al.
  35. */
  36. /* UCT is the same bit for Server and Embedded */
  37. #define ICSWX_DSI_UCT 0x00004000 /* Unavailable Coprocessor Type */
  38. #ifdef CONFIG_PPC_BOOK3E
  39. /* Embedded implementation gives us no hints as to what the CT is */
  40. #define ICSWX_GET_CT_HINT(x) (-1)
  41. #else
  42. /* Server implementation contains the CT value in the DSISR */
  43. #define ICSWX_DSISR_CTMASK 0x00003f00
  44. #define ICSWX_GET_CT_HINT(x) (((x) & ICSWX_DSISR_CTMASK) >> 8)
  45. #endif
  46. #define ICSWX_RC_STARTED 0x8 /* The request has been started */
  47. #define ICSWX_RC_NOT_IDLE 0x4 /* No coprocessor found idle */
  48. #define ICSWX_RC_NOT_FOUND 0x2 /* No coprocessor found */
  49. #define ICSWX_RC_UNDEFINED 0x1 /* Reserved */
  50. extern int acop_handle_fault(struct pt_regs *regs, unsigned long address,
  51. unsigned long error_code);
  52. static inline u64 acop_copro_type_bit(unsigned int type)
  53. {
  54. return 1ULL << (63 - type);
  55. }
  56. #endif /* !_ARCH_POWERPC_MM_ICSWX_H_ */