cmdq_driver.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #ifndef __CMDQ_DRIVER_H__
  2. #define __CMDQ_DRIVER_H__
  3. #include <linux/kernel.h>
  4. #include "cmdq_def.h"
  5. typedef struct cmdqUsageInfoStruct {
  6. uint32_t count[CMDQ_MAX_ENGINE_COUNT]; /* [OUT] current engine ref count */
  7. } cmdqUsageInfoStruct;
  8. typedef struct cmdqJobStruct {
  9. struct cmdqCommandStruct command; /* [IN] the job to perform */
  10. cmdqJobHandle_t hJob; /* [OUT] handle to resulting job */
  11. } cmdqJobStruct;
  12. typedef struct cmdqJobResultStruct {
  13. cmdqJobHandle_t hJob; /* [IN] Job handle from CMDQ_IOCTL_ASYNC_JOB_EXEC */
  14. uint64_t engineFlag; /* [OUT] engine flag passed down originally */
  15. /* [IN/OUT] read register values, if any. */
  16. /* as input, the "count" field must represent */
  17. /* buffer space pointed by "regValues". */
  18. /* Upon return, CMDQ driver fills "count" with */
  19. /* actual requested register count. */
  20. /* However, if the input "count" is too small, */
  21. /* -ENOMEM is returned, and "count" is filled */
  22. /* with requested register count. */
  23. cmdqRegValueStruct regValue;
  24. cmdqReadAddressStruct readAddress; /* [IN/OUT] physical address to read */
  25. } cmdqJobResultStruct;
  26. typedef struct cmdqWriteAddressStruct {
  27. /* [IN] count of the writable buffer (unit is # of uint32_t, NOT in byte) */
  28. uint32_t count;
  29. /* [OUT] When Alloc, this is the resulting PA. It is guaranteed to be continuous. */
  30. /* [IN] When Free, please pass returned address down to ioctl. */
  31. /* */
  32. /* indeed param startPA should be UNSIGNED LONG type for 64 bit kernel. */
  33. /* Considering our plartform supports max 4GB RAM(upper-32bit don't care for SW) */
  34. /* and consistent common code interface, remain uint32_t type. */
  35. uint32_t startPA;
  36. } cmdqWriteAddressStruct;
  37. #define CMDQ_IOCTL_MAGIC_NUMBER 'x'
  38. #define CMDQ_IOCTL_LOCK_MUTEX _IOW(CMDQ_IOCTL_MAGIC_NUMBER, 1, int)
  39. #define CMDQ_IOCTL_UNLOCK_MUTEX _IOR(CMDQ_IOCTL_MAGIC_NUMBER, 2, int)
  40. #define CMDQ_IOCTL_EXEC_COMMAND _IOW(CMDQ_IOCTL_MAGIC_NUMBER, 3, cmdqCommandStruct)
  41. #define CMDQ_IOCTL_QUERY_USAGE _IOW(CMDQ_IOCTL_MAGIC_NUMBER, 4, cmdqUsageInfoStruct)
  42. /* */
  43. /* Async operations */
  44. /* */
  45. #define CMDQ_IOCTL_ASYNC_JOB_EXEC _IOW(CMDQ_IOCTL_MAGIC_NUMBER, 5, cmdqJobStruct)
  46. #define CMDQ_IOCTL_ASYNC_JOB_WAIT_AND_CLOSE _IOR(CMDQ_IOCTL_MAGIC_NUMBER, 6, cmdqJobResultStruct)
  47. #define CMDQ_IOCTL_ALLOC_WRITE_ADDRESS _IOW(CMDQ_IOCTL_MAGIC_NUMBER, 7, cmdqWriteAddressStruct)
  48. #define CMDQ_IOCTL_FREE_WRITE_ADDRESS _IOW(CMDQ_IOCTL_MAGIC_NUMBER, 8, cmdqWriteAddressStruct)
  49. #define CMDQ_IOCTL_READ_ADDRESS_VALUE _IOW(CMDQ_IOCTL_MAGIC_NUMBER, 9, cmdqReadAddressStruct)
  50. /* */
  51. /* Chip capability query. output parameter is a bit field. */
  52. /* Bit definition is CMDQ_CAP_BITS. */
  53. /* */
  54. #define CMDQ_IOCTL_QUERY_CAP_BITS _IOW(CMDQ_IOCTL_MAGIC_NUMBER, 10, int)
  55. /* */
  56. /* HW info. from DTS */
  57. /* */
  58. #define CMDQ_IOCTL_QUERY_DTS _IOW(CMDQ_IOCTL_MAGIC_NUMBER, 11, cmdqDTSDataStruct)
  59. /* */
  60. /* Notify MDP will use specified engine before really use. */
  61. /* input int is same as EngineFlag. */
  62. /* */
  63. #define CMDQ_IOCTL_NOTIFY_ENGINE _IOW(CMDQ_IOCTL_MAGIC_NUMBER, 12, uint64_t)
  64. #endif /* __CMDQ_DRIVER_H__ */