coresight-priv.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef _CORESIGHT_PRIV_H
  13. #define _CORESIGHT_PRIV_H
  14. #include <linux/bitops.h>
  15. /* Coresight management registers (0xF00-0xFCC)
  16. * 0xFA0 - 0xFA4: Management registers in PFTv1.0
  17. * Trace registers in PFTv1.1
  18. */
  19. #define CORESIGHT_ITCTRL (0xF00)
  20. #define CORESIGHT_CLAIMSET (0xFA0)
  21. #define CORESIGHT_CLAIMCLR (0xFA4)
  22. #define CORESIGHT_LAR (0xFB0)
  23. #define CORESIGHT_LSR (0xFB4)
  24. #define CORESIGHT_AUTHSTATUS (0xFB8)
  25. #define CORESIGHT_DEVID (0xFC8)
  26. #define CORESIGHT_DEVTYPE (0xFCC)
  27. #define CORESIGHT_UNLOCK (0xC5ACCE55)
  28. #define TIMEOUT_US (100)
  29. #define BM(lsb, msb) ((BIT(msb) - BIT(lsb)) + BIT(msb))
  30. #define BMVAL(val, lsb, msb) ((val & BM(lsb, msb)) >> lsb)
  31. #define BVAL(val, n) ((val & BIT(n)) >> n)
  32. #ifdef CONFIG_CORESIGHT_FUSE
  33. extern bool coresight_fuse_access_disabled(void);
  34. extern bool coresight_fuse_apps_access_disabled(void);
  35. #else
  36. static inline bool coresight_fuse_access_disabled(void) { return false; }
  37. static inline bool coresight_fuse_apps_access_disabled(void) { return false; }
  38. #endif
  39. #ifdef CONFIG_CORESIGHT_CSR
  40. extern void msm_qdss_csr_enable_bam_to_usb(void);
  41. extern void msm_qdss_csr_disable_bam_to_usb(void);
  42. extern void msm_qdss_csr_disable_flush(void);
  43. extern int coresight_csr_hwctrl_set(uint64_t addr, uint32_t val);
  44. extern void coresight_csr_set_byte_cntr(uint32_t);
  45. #else
  46. static inline void msm_qdss_csr_enable_bam_to_usb(void) {}
  47. static inline void msm_qdss_csr_disable_bam_to_usb(void) {}
  48. static inline void msm_qdss_csr_disable_flush(void) {}
  49. static inline int coresight_csr_hwctrl_set(uint64_t addr,
  50. uint32_t val) { return -ENOSYS; }
  51. static inline void coresight_csr_set_byte_cntr(uint32_t val) {}
  52. #endif
  53. #ifdef CONFIG_CORESIGHT_ETM
  54. extern unsigned int etm_readl_cp14(uint32_t off);
  55. extern void etm_writel_cp14(uint32_t val, uint32_t off);
  56. #else
  57. static inline unsigned int etm_readl_cp14(uint32_t off) { return 0; }
  58. static inline void etm_writel_cp14(uint32_t val, uint32_t off) {}
  59. #endif
  60. #endif