ven-el3-debugfs.rst 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. DebugFS interface
  2. =================
  3. The optional DebugFS interface is accessed through a Vendor specific EL3 service. Refer
  4. to the component documentation for details.
  5. String parameters are passed through a shared buffer using a specific union:
  6. .. code:: c
  7. union debugfs_parms {
  8. struct {
  9. char fname[MAX_PATH_LEN];
  10. } open;
  11. struct mount {
  12. char srv[MAX_PATH_LEN];
  13. char where[MAX_PATH_LEN];
  14. char spec[MAX_PATH_LEN];
  15. } mount;
  16. struct {
  17. char path[MAX_PATH_LEN];
  18. dir_t dir;
  19. } stat;
  20. struct {
  21. char oldpath[MAX_PATH_LEN];
  22. char newpath[MAX_PATH_LEN];
  23. } bind;
  24. };
  25. Format of the dir_t structure as such:
  26. .. code:: c
  27. typedef struct {
  28. char name[NAMELEN];
  29. long length;
  30. unsigned char mode;
  31. unsigned char index;
  32. unsigned char dev;
  33. qid_t qid;
  34. } dir_t;
  35. * Identifiers
  36. ======================== =============================================
  37. SMC_OK 0
  38. SMC_UNK -1
  39. DEBUGFS_E_INVALID_PARAMS -2
  40. ======================== =============================================
  41. ======================== =============================================
  42. MOUNT 0
  43. CREATE 1
  44. OPEN 2
  45. CLOSE 3
  46. READ 4
  47. WRITE 5
  48. SEEK 6
  49. BIND 7
  50. STAT 8
  51. INIT 10
  52. VERSION 11
  53. ======================== =============================================
  54. MOUNT
  55. ~~~~~
  56. Description
  57. ^^^^^^^^^^^
  58. This operation mounts a blob of data pointed to by path stored in `src`, at
  59. filesystem location pointed to by path stored in `where`, using driver pointed
  60. to by path in `spec`.
  61. Parameters
  62. ^^^^^^^^^^
  63. ======== ============================================================
  64. uint32_t FunctionID (0x87000010 / 0xC7000010)
  65. uint32_t ``MOUNT``
  66. ======== ============================================================
  67. Return values
  68. ^^^^^^^^^^^^^
  69. =============== ==========================================================
  70. int32_t w0 == SMC_OK on success
  71. w0 == DEBUGFS_E_INVALID_PARAMS if mount operation failed
  72. =============== ==========================================================
  73. OPEN
  74. ~~~~
  75. Description
  76. ^^^^^^^^^^^
  77. This operation opens the file path pointed to by `fname`.
  78. Parameters
  79. ^^^^^^^^^^
  80. ======== ============================================================
  81. uint32_t FunctionID (0x87000010 / 0xC7000010)
  82. uint32_t ``OPEN``
  83. uint32_t mode
  84. ======== ============================================================
  85. mode can be one of:
  86. .. code:: c
  87. enum mode {
  88. O_READ = 1 << 0,
  89. O_WRITE = 1 << 1,
  90. O_RDWR = 1 << 2,
  91. O_BIND = 1 << 3,
  92. O_DIR = 1 << 4,
  93. O_STAT = 1 << 5
  94. };
  95. Return values
  96. ^^^^^^^^^^^^^
  97. =============== ==========================================================
  98. int32_t w0 == SMC_OK on success
  99. w0 == DEBUGFS_E_INVALID_PARAMS if open operation failed
  100. uint32_t w1: file descriptor id on success.
  101. =============== ==========================================================
  102. CLOSE
  103. ~~~~~
  104. Description
  105. ^^^^^^^^^^^
  106. This operation closes a file described by a file descriptor obtained by a
  107. previous call to OPEN.
  108. Parameters
  109. ^^^^^^^^^^
  110. ======== ============================================================
  111. uint32_t FunctionID (0x87000010 / 0xC7000010)
  112. uint32_t ``CLOSE``
  113. uint32_t File descriptor id returned by OPEN
  114. ======== ============================================================
  115. Return values
  116. ^^^^^^^^^^^^^
  117. =============== ==========================================================
  118. int32_t w0 == SMC_OK on success
  119. w0 == DEBUGFS_E_INVALID_PARAMS if close operation failed
  120. =============== ==========================================================
  121. READ
  122. ~~~~
  123. Description
  124. ^^^^^^^^^^^
  125. This operation reads a number of bytes from a file descriptor obtained by
  126. a previous call to OPEN.
  127. Parameters
  128. ^^^^^^^^^^
  129. ======== ============================================================
  130. uint32_t FunctionID (0x87000010 / 0xC7000010)
  131. uint32_t ``READ``
  132. uint32_t File descriptor id returned by OPEN
  133. uint32_t Number of bytes to read
  134. ======== ============================================================
  135. Return values
  136. ^^^^^^^^^^^^^
  137. On success, the read data is retrieved from the shared buffer after the
  138. operation.
  139. =============== ==========================================================
  140. int32_t w0 == SMC_OK on success
  141. w0 == DEBUGFS_E_INVALID_PARAMS if read operation failed
  142. uint32_t w1: number of bytes read on success.
  143. =============== ==========================================================
  144. SEEK
  145. ~~~~
  146. Description
  147. ^^^^^^^^^^^
  148. Move file pointer for file described by given `file descriptor` of given
  149. `offset` related to `whence`.
  150. Parameters
  151. ^^^^^^^^^^
  152. ======== ============================================================
  153. uint32_t FunctionID (0x87000010 / 0xC7000010)
  154. uint32_t ``SEEK``
  155. uint32_t File descriptor id returned by OPEN
  156. sint32_t offset in the file relative to whence
  157. uint32_t whence
  158. ======== ============================================================
  159. whence can be one of:
  160. ========= ============================================================
  161. KSEEK_SET 0
  162. KSEEK_CUR 1
  163. KSEEK_END 2
  164. ========= ============================================================
  165. Return values
  166. ^^^^^^^^^^^^^
  167. =============== ==========================================================
  168. int32_t w0 == SMC_OK on success
  169. w0 == DEBUGFS_E_INVALID_PARAMS if seek operation failed
  170. =============== ==========================================================
  171. BIND
  172. ~~~~
  173. Description
  174. ^^^^^^^^^^^
  175. Create a link from `oldpath` to `newpath`.
  176. Parameters
  177. ^^^^^^^^^^
  178. ======== ============================================================
  179. uint32_t FunctionID (0x87000010 / 0xC7000010)
  180. uint32_t ``BIND``
  181. ======== ============================================================
  182. Return values
  183. ^^^^^^^^^^^^^
  184. =============== ==========================================================
  185. int32_t w0 == SMC_OK on success
  186. w0 == DEBUGFS_E_INVALID_PARAMS if bind operation failed
  187. =============== ==========================================================
  188. STAT
  189. ~~~~
  190. Description
  191. ^^^^^^^^^^^
  192. Perform a stat operation on provided file `name` and returns the directory
  193. entry statistics into `dir`.
  194. Parameters
  195. ^^^^^^^^^^
  196. ======== ============================================================
  197. uint32_t FunctionID (0x87000010 / 0xC7000010)
  198. uint32_t ``STAT``
  199. ======== ============================================================
  200. Return values
  201. ^^^^^^^^^^^^^
  202. =============== ==========================================================
  203. int32_t w0 == SMC_OK on success
  204. w0 == DEBUGFS_E_INVALID_PARAMS if stat operation failed
  205. =============== ==========================================================
  206. INIT
  207. ~~~~
  208. Description
  209. ^^^^^^^^^^^
  210. Initial call to setup the shared exchange buffer. Notice if successful once,
  211. subsequent calls fail after a first initialization. The caller maps the same
  212. page frame in its virtual space and uses this buffer to exchange string
  213. parameters with filesystem primitives.
  214. Parameters
  215. ^^^^^^^^^^
  216. ======== ============================================================
  217. uint32_t FunctionID (0x87000010 / 0xC7000010)
  218. uint32_t ``INIT``
  219. uint64_t Physical address of the shared buffer.
  220. ======== ============================================================
  221. Return values
  222. ^^^^^^^^^^^^^
  223. =============== ======================================================
  224. int32_t w0 == SMC_OK on success
  225. w0 == DEBUGFS_E_INVALID_PARAMS if already initialized,
  226. or internal error occurred.
  227. =============== ======================================================
  228. VERSION
  229. ~~~~~~~
  230. Description
  231. ^^^^^^^^^^^
  232. Returns the debugfs interface version if implemented in TF-A.
  233. Parameters
  234. ^^^^^^^^^^
  235. ======== ============================================================
  236. uint32_t FunctionID (0x87000010 / 0xC7000010)
  237. uint32_t ``VERSION``
  238. ======== ============================================================
  239. Return values
  240. ^^^^^^^^^^^^^
  241. =============== ======================================================
  242. int32_t w0 == SMC_OK on success
  243. w0 == SMC_UNK if interface is not implemented
  244. uint32_t w1: On success, debugfs interface version, 32 bits
  245. value with major version number in upper 16 bits and
  246. minor version in lower 16 bits.
  247. =============== ======================================================
  248. * CREATE(1) and WRITE (5) command identifiers are unimplemented and
  249. return `SMC_UNK`.
  250. --------------
  251. *Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.*