mtm.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright(c) 2015 EZchip Technologies.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms and conditions of the GNU General Public License,
  6. * version 2, as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope it will be useful, but WITHOUT
  9. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. * more details.
  12. *
  13. * The full GNU General Public License is included in this distribution in
  14. * the file called "COPYING".
  15. */
  16. #ifndef _PLAT_EZNPS_MTM_H
  17. #define _PLAT_EZNPS_MTM_H
  18. #include <plat/ctop.h>
  19. static inline void *nps_mtm_reg_addr(u32 cpu, u32 reg)
  20. {
  21. struct global_id gid;
  22. u32 core, blkid;
  23. gid.value = cpu;
  24. core = gid.core;
  25. blkid = (((core & 0x0C) << 2) | (core & 0x03));
  26. return nps_host_reg(cpu, blkid, reg);
  27. }
  28. #ifdef CONFIG_EZNPS_MTM_EXT
  29. #define NPS_CPU_TO_THREAD_NUM(cpu) \
  30. ({ struct global_id gid; gid.value = cpu; gid.thread; })
  31. /* MTM registers */
  32. #define MTM_CFG(cpu) nps_mtm_reg_addr(cpu, 0x81)
  33. #define MTM_THR_INIT(cpu) nps_mtm_reg_addr(cpu, 0x92)
  34. #define MTM_THR_INIT_STS(cpu) nps_mtm_reg_addr(cpu, 0x93)
  35. #define get_thread(map) map.thread
  36. #define eznps_max_cpus 4096
  37. #define eznps_cpus_per_cluster 256
  38. void mtm_enable_core(unsigned int cpu);
  39. int mtm_enable_thread(int cpu);
  40. #else /* !CONFIG_EZNPS_MTM_EXT */
  41. #define get_thread(map) 0
  42. #define eznps_max_cpus 256
  43. #define eznps_cpus_per_cluster 16
  44. #define mtm_enable_core(cpu)
  45. #define mtm_enable_thread(cpu) 1
  46. #define NPS_CPU_TO_THREAD_NUM(cpu) 0
  47. #endif /* CONFIG_EZNPS_MTM_EXT */
  48. #endif /* _PLAT_EZNPS_MTM_H */