cs-etm.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright(C) 2015 Linaro Limited. All rights reserved.
  3. * Author: Mathieu Poirier <mathieu.poirier@linaro.org>
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License version 2 as published by
  7. * the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef INCLUDE__UTIL_PERF_CS_ETM_H__
  18. #define INCLUDE__UTIL_PERF_CS_ETM_H__
  19. /* Versionning header in case things need tro change in the future. That way
  20. * decoding of old snapshot is still possible.
  21. */
  22. enum {
  23. /* Starting with 0x0 */
  24. CS_HEADER_VERSION_0,
  25. /* PMU->type (32 bit), total # of CPUs (32 bit) */
  26. CS_PMU_TYPE_CPUS,
  27. CS_ETM_SNAPSHOT,
  28. CS_HEADER_VERSION_0_MAX,
  29. };
  30. /* Beginning of header common to both ETMv3 and V4 */
  31. enum {
  32. CS_ETM_MAGIC,
  33. CS_ETM_CPU,
  34. };
  35. /* ETMv3/PTM metadata */
  36. enum {
  37. /* Dynamic, configurable parameters */
  38. CS_ETM_ETMCR = CS_ETM_CPU + 1,
  39. CS_ETM_ETMTRACEIDR,
  40. /* RO, taken from sysFS */
  41. CS_ETM_ETMCCER,
  42. CS_ETM_ETMIDR,
  43. CS_ETM_PRIV_MAX,
  44. };
  45. /* ETMv4 metadata */
  46. enum {
  47. /* Dynamic, configurable parameters */
  48. CS_ETMV4_TRCCONFIGR = CS_ETM_CPU + 1,
  49. CS_ETMV4_TRCTRACEIDR,
  50. /* RO, taken from sysFS */
  51. CS_ETMV4_TRCIDR0,
  52. CS_ETMV4_TRCIDR1,
  53. CS_ETMV4_TRCIDR2,
  54. CS_ETMV4_TRCIDR8,
  55. CS_ETMV4_TRCAUTHSTATUS,
  56. CS_ETMV4_PRIV_MAX,
  57. };
  58. #define KiB(x) ((x) * 1024)
  59. #define MiB(x) ((x) * 1024 * 1024)
  60. #define CS_ETM_HEADER_SIZE (CS_HEADER_VERSION_0_MAX * sizeof(u64))
  61. static const u64 __perf_cs_etmv3_magic = 0x3030303030303030ULL;
  62. static const u64 __perf_cs_etmv4_magic = 0x4040404040404040ULL;
  63. #define CS_ETMV3_PRIV_SIZE (CS_ETM_PRIV_MAX * sizeof(u64))
  64. #define CS_ETMV4_PRIV_SIZE (CS_ETMV4_PRIV_MAX * sizeof(u64))
  65. #endif