ssi_pal_perf.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /**************************************************************************************
  2. * Copyright (c) 2016-2017, ARM Limited or its affiliates. All rights reserved *
  3. * *
  4. * This file and the related binary are licensed under the following license: *
  5. * *
  6. * ARM Object Code and Header Files License, v1.0 Redistribution. *
  7. * *
  8. * Redistribution and use of object code, header files, and documentation, without *
  9. * modification, are permitted provided that the following conditions are met: *
  10. * *
  11. * 1) Redistributions must reproduce the above copyright notice and the *
  12. * following disclaimer in the documentation and/or other materials *
  13. * provided with the distribution. *
  14. * *
  15. * 2) Unless to the extent explicitly permitted by law, no reverse *
  16. * engineering, decompilation, or disassembly of is permitted. *
  17. * *
  18. * 3) Redistribution and use is permitted solely for the purpose of *
  19. * developing or executing applications that are targeted for use *
  20. * on an ARM-based product. *
  21. * *
  22. * DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
  23. * CONTRIBUTORS "AS IS." ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT *
  24. * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, *
  25. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
  26. * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
  27. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED *
  28. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
  29. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
  30. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
  31. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
  32. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
  33. **************************************************************************************/
  34. #ifndef _SSI_PAL_PERF_H_
  35. #define _SSI_PAL_PERF_H_
  36. #ifdef LIB_PERF
  37. #include "ssi_pal_perf_plat.h"
  38. #endif
  39. typedef enum {
  40. PERF_TEST_TYPE_CRYS_AES_INTGR = 0x1,
  41. PERF_TEST_TYPE_CRYS_AES_INIT = 0x2,
  42. PERF_TEST_TYPE_CRYS_AES_BLOCK = 0x3,
  43. PERF_TEST_TYPE_CRYS_AES_FIN = 0x4,
  44. PERF_TEST_TYPE_HW_CMPLT = 0x5,
  45. PERF_TEST_TYPE_PAL_MAP = 0x6,
  46. PERF_TEST_TYPE_PAL_UNMAP = 0x7,
  47. PERF_TEST_TYPE_MLLI_BUILD = 0x8,
  48. PERF_TEST_TYPE_SYM_DRV_INIT = 0x9,
  49. PERF_TEST_TYPE_SYM_DRV_PROC = 0xA,
  50. PERF_TEST_TYPE_SYM_DRV_FIN = 0xB,
  51. PERF_TEST_TYPE_CRYS_HASH_INIT = 0xC,
  52. PERF_TEST_TYPE_CRYS_HASH_UPDATE=0xD,
  53. PERF_TEST_TYPE_CRYS_HASH_FIN = 0xE,
  54. PERF_TEST_TYPE_CRYS_HMAC_INIT = 0xF,
  55. PERF_TEST_TYPE_CRYS_HMAC_UPDATE=0x10,
  56. PERF_TEST_TYPE_CRYS_HMAC_FIN = 0x11,
  57. PERF_TEST_TYPE_CMPLT_SLEEP = 0x12,
  58. PERF_TEST_TYPE_CRYS_AES_SET_KEY = 0x13,
  59. PERF_TEST_TYPE_PKA_ModExp = 0x30,
  60. PERF_TEST_TYPE_TEST_BASE = 0x100,
  61. PERF_TEST_TYPE_MAX,
  62. PERF_TEST_TYPE_RESERVE32 = 0x7FFFFFFF
  63. }SaSiPalPerfType_t;
  64. #ifdef LIB_PERF
  65. #define SASI_PAL_PERF_INIT SaSi_PalPerfInit
  66. #define SASI_PAL_PERF_OPEN_NEW_ENTRY(num, type) \
  67. num = SaSi_PalPerfOpenNewEntry(type)
  68. #define SASI_PAL_PERF_CLOSE_ENTRY(num, type) \
  69. SaSi_PalPerfCloseEntry(num, type)
  70. #define SASI_PAL_PERF_DUMP SaSi_PalPerfDump
  71. #define SASI_PAL_PERF_FIN SaSi_PalPerfFin
  72. /**
  73. * @brief initialize performance test mechanism
  74. *
  75. * @param[in]
  76. * *
  77. * @return None
  78. */
  79. void SaSi_PalPerfInit(void);
  80. /**
  81. * @brief opens new entry in perf buffer to record new entry
  82. *
  83. * @param[in] entryType - entry type (defined in ssi_pal_perf.h) to be recorded in buffer
  84. *
  85. * @return A non-zero value in case of failure.
  86. */
  87. SaSi_PalPerfData_t SaSi_PalPerfOpenNewEntry(SaSiPalPerfType_t entryType);
  88. /**
  89. * @brief closes entry in perf buffer previously opened by SaSi_PalPerfOpenNewEntry
  90. *
  91. * @param[in] idx - index of the entry to be closed, the return value of SaSi_PalPerfOpenNewEntry
  92. * @param[in] entryType - entry type (defined in ssi_pal_perf.h) to be recorded in buffer
  93. *
  94. * @return A non-zero value in case of failure.
  95. */
  96. void SaSi_PalPerfCloseEntry(SaSi_PalPerfData_t idx, SaSiPalPerfType_t entryType);
  97. /**
  98. * @brief dumps the performance buffer
  99. *
  100. * @param[in] None
  101. *
  102. * @return None
  103. */
  104. void SaSi_PalPerfDump(void);
  105. /**
  106. * @brief terminates resources used for performance tests
  107. *
  108. * @param[in]
  109. * *
  110. * @return None
  111. */
  112. void SaSi_PalPerfFin(void);
  113. #else //LIB_PERF
  114. #define SASI_PAL_PERF_INIT()
  115. #define SASI_PAL_PERF_OPEN_NEW_ENTRY(num, type) (num=num)
  116. #define SASI_PAL_PERF_CLOSE_ENTRY(num, type)
  117. #define SASI_PAL_PERF_DUMP()
  118. #define SASI_PAL_PERF_FIN()
  119. typedef uint32_t SaSi_PalPerfData_t;
  120. #endif //LIB_PERF
  121. #endif /*_SSI_PAL_PERF_H__*/