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