ipc4-fw-reg.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
  2. /*
  3. * This file is provided under a dual BSD/GPLv2 license. When using or
  4. * redistributing this file, you may do so under either license.
  5. *
  6. * Copyright(c) 2022 Intel Corporation
  7. */
  8. #ifndef __IPC4_FW_REG_H__
  9. #define __IPC4_FW_REG_H__
  10. #define SOF_IPC4_INVALID_STREAM_POSITION ULLONG_MAX
  11. /**
  12. * struct sof_ipc4_pipeline_registers - Pipeline start and end information in fw
  13. * @stream_start_offset: Stream start offset (LPIB) reported by mixin
  14. * module allocated on pipeline attached to Host Output Gateway when
  15. * first data is being mixed to mixout module. When data is not mixed
  16. * (right after creation/after reset) value "(u64)-1" is reported
  17. * @stream_end_offset: Stream end offset (LPIB) reported by mixin
  18. * module allocated on pipeline attached to Host Output Gateway
  19. * during transition from RUNNING to PAUSED. When data is not mixed
  20. * (right after creation or after reset) value "(u64)-1" is reported.
  21. * When first data is mixed then value "0"is reported.
  22. */
  23. struct sof_ipc4_pipeline_registers {
  24. u64 stream_start_offset;
  25. u64 stream_end_offset;
  26. } __packed __aligned(4);
  27. #define SOF_IPC4_PV_MAX_SUPPORTED_CHANNELS 8
  28. /**
  29. * struct sof_ipc4_peak_volume_regs - Volume information in fw
  30. * @peak_meter: Peak volume value in fw
  31. * @current_volume: Current volume value in fw
  32. * @target_volume: Target volume value in fw
  33. */
  34. struct sof_ipc4_peak_volume_regs {
  35. u32 peak_meter[SOF_IPC4_PV_MAX_SUPPORTED_CHANNELS];
  36. u32 current_volume[SOF_IPC4_PV_MAX_SUPPORTED_CHANNELS];
  37. u32 target_volume[SOF_IPC4_PV_MAX_SUPPORTED_CHANNELS];
  38. } __packed __aligned(4);
  39. /**
  40. * struct sof_ipc4_llp_reading - Llp information in fw
  41. * @llp_l: Lower part of 64-bit LLP
  42. * @llp_u: Upper part of 64-bit LLP
  43. * @wclk_l: Lower part of 64-bit Wallclock
  44. * @wclk_u: Upper part of 64-bit Wallclock
  45. */
  46. struct sof_ipc4_llp_reading {
  47. u32 llp_l;
  48. u32 llp_u;
  49. u32 wclk_l;
  50. u32 wclk_u;
  51. } __packed __aligned(4);
  52. /**
  53. * struct of sof_ipc4_llp_reading_extended - Extended llp info
  54. * @llp_reading: Llp information in memory window
  55. * @tpd_low: Total processed data (low part)
  56. * @tpd_high: Total processed data (high part)
  57. */
  58. struct sof_ipc4_llp_reading_extended {
  59. struct sof_ipc4_llp_reading llp_reading;
  60. u32 tpd_low;
  61. u32 tpd_high;
  62. } __packed __aligned(4);
  63. /**
  64. * struct sof_ipc4_llp_reading_slot - Llp slot information in memory window
  65. * @node_id: Dai gateway node id
  66. * @reading: Llp information in memory window
  67. */
  68. struct sof_ipc4_llp_reading_slot {
  69. u32 node_id;
  70. struct sof_ipc4_llp_reading reading;
  71. } __packed __aligned(4);
  72. /* ROM information */
  73. #define SOF_IPC4_FW_FUSE_VALUE_MASK GENMASK(7, 0)
  74. #define SOF_IPC4_FW_LOAD_METHOD_MASK BIT(8)
  75. #define SOF_IPC4_FW_DOWNLINK_IPC_USE_DMA_MASK BIT(9)
  76. #define SOF_IPC4_FW_LOAD_METHOD_REV_MASK GENMASK(11, 10)
  77. #define SOF_IPC4_FW_REVISION_MIN_MASK GENMASK(15, 12)
  78. #define SOF_IPC4_FW_REVISION_MAJ_MASK GENMASK(19, 16)
  79. #define SOF_IPC4_FW_VERSION_MIN_MASK GENMASK(23, 20)
  80. #define SOF_IPC4_FW_VERSION_MAJ_MASK GENMASK(27, 24)
  81. /* Number of dsp core supported in FW Regs. */
  82. #define SOF_IPC4_MAX_SUPPORTED_ADSP_CORES 8
  83. /* Number of host pipeline registers slots in FW Regs. */
  84. #define SOF_IPC4_MAX_PIPELINE_REG_SLOTS 16
  85. /* Number of PeakVol registers slots in FW Regs. */
  86. #define SOF_IPC4_MAX_PEAK_VOL_REG_SLOTS 16
  87. /* Number of GPDMA LLP Reading slots in FW Regs. */
  88. #define SOF_IPC4_MAX_LLP_GPDMA_READING_SLOTS 24
  89. /* Number of Aggregated SNDW Reading slots in FW Regs. */
  90. #define SOF_IPC4_MAX_LLP_SNDW_READING_SLOTS 15
  91. /* Current ABI version of the Fw registers layout. */
  92. #define SOF_IPC4_FW_REGS_ABI_VER 1
  93. /**
  94. * struct sof_ipc4_fw_registers - FW Registers exposes additional
  95. * DSP / FW state information to the driver
  96. * @fw_status: Current ROM / FW status
  97. * @lec: Last ROM / FW error code
  98. * @fps: Current DSP clock status
  99. * @lnec: Last Native Error Code(from external library)
  100. * @ltr: Copy of LTRC HW register value(FW only)
  101. * @rsvd0: Reserved0
  102. * @rom_info: ROM info
  103. * @abi_ver: Version of the layout, set to the current FW_REGS_ABI_VER
  104. * @slave_core_sts: Slave core states
  105. * @rsvd2: Reserved2
  106. * @pipeline_regs: State of pipelines attached to host output gateways
  107. * @peak_vol_regs: State of PeakVol instances indexed by the PeakVol's instance_id
  108. * @llp_gpdma_reading_slots: LLP Readings for single link gateways
  109. * @llp_sndw_reading_slots: SNDW aggregated link gateways
  110. * @llp_evad_reading_slot: LLP Readings for EVAD gateway
  111. */
  112. struct sof_ipc4_fw_registers {
  113. u32 fw_status;
  114. u32 lec;
  115. u32 fps;
  116. u32 lnec;
  117. u32 ltr;
  118. u32 rsvd0;
  119. u32 rom_info;
  120. u32 abi_ver;
  121. u8 slave_core_sts[SOF_IPC4_MAX_SUPPORTED_ADSP_CORES];
  122. u32 rsvd2[6];
  123. struct sof_ipc4_pipeline_registers
  124. pipeline_regs[SOF_IPC4_MAX_PIPELINE_REG_SLOTS];
  125. struct sof_ipc4_peak_volume_regs
  126. peak_vol_regs[SOF_IPC4_MAX_PEAK_VOL_REG_SLOTS];
  127. struct sof_ipc4_llp_reading_slot
  128. llp_gpdma_reading_slots[SOF_IPC4_MAX_LLP_GPDMA_READING_SLOTS];
  129. struct sof_ipc4_llp_reading_slot
  130. llp_sndw_reading_slots[SOF_IPC4_MAX_LLP_SNDW_READING_SLOTS];
  131. struct sof_ipc4_llp_reading_slot llp_evad_reading_slot;
  132. } __packed __aligned(4);
  133. #endif