1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
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.
6 * Copyright(c) 2022 Intel Corporation. All rights reserved.
9 #ifndef __IPC4_FW_REG_H__
10 #define __IPC4_FW_REG_H__
12 #define SOF_IPC4_INVALID_STREAM_POSITION ULLONG_MAX
15 * struct sof_ipc4_pipeline_registers - Pipeline start and end information in fw
16 * @stream_start_offset: Stream start offset (LPIB) reported by mixin
17 * module allocated on pipeline attached to Host Output Gateway when
18 * first data is being mixed to mixout module. When data is not mixed
19 * (right after creation/after reset) value "(u64)-1" is reported
20 * @stream_end_offset: Stream end offset (LPIB) reported by mixin
21 * module allocated on pipeline attached to Host Output Gateway
22 * during transition from RUNNING to PAUSED. When data is not mixed
23 * (right after creation or after reset) value "(u64)-1" is reported.
24 * When first data is mixed then value "0"is reported.
26 struct sof_ipc4_pipeline_registers {
27 u64 stream_start_offset;
28 u64 stream_end_offset;
29 } __packed __aligned(4);
31 #define SOF_IPC4_PV_MAX_SUPPORTED_CHANNELS 8
34 * struct sof_ipc4_peak_volume_regs - Volume information in fw
35 * @peak_meter: Peak volume value in fw
36 * @current_volume: Current volume value in fw
37 * @target_volume: Target volume value in fw
39 struct sof_ipc4_peak_volume_regs {
40 u32 peak_meter[SOF_IPC4_PV_MAX_SUPPORTED_CHANNELS];
41 u32 current_volume[SOF_IPC4_PV_MAX_SUPPORTED_CHANNELS];
42 u32 target_volume[SOF_IPC4_PV_MAX_SUPPORTED_CHANNELS];
43 } __packed __aligned(4);
46 * struct sof_ipc4_llp_reading - Llp information in fw
47 * @llp_l: Lower part of 64-bit LLP
48 * @llp_u: Upper part of 64-bit LLP
49 * @wclk_l: Lower part of 64-bit Wallclock
50 * @wclk_u: Upper part of 64-bit Wallclock
52 struct sof_ipc4_llp_reading {
57 } __packed __aligned(4);
60 * struct of sof_ipc4_llp_reading_extended - Extended llp info
61 * @llp_reading: Llp information in memory window
62 * @tpd_low: Total processed data (low part)
63 * @tpd_high: Total processed data (high part)
65 struct sof_ipc4_llp_reading_extended {
66 struct sof_ipc4_llp_reading llp_reading;
69 } __packed __aligned(4);
72 * struct sof_ipc4_llp_reading_slot - Llp slot information in memory window
73 * @node_id: Dai gateway node id
74 * @reading: Llp information in memory window
76 struct sof_ipc4_llp_reading_slot {
78 struct sof_ipc4_llp_reading reading;
79 } __packed __aligned(4);
82 #define SOF_IPC4_FW_FUSE_VALUE_MASK GENMASK(7, 0)
83 #define SOF_IPC4_FW_LOAD_METHOD_MASK BIT(8)
84 #define SOF_IPC4_FW_DOWNLINK_IPC_USE_DMA_MASK BIT(9)
85 #define SOF_IPC4_FW_LOAD_METHOD_REV_MASK GENMASK(11, 10)
86 #define SOF_IPC4_FW_REVISION_MIN_MASK GENMASK(15, 12)
87 #define SOF_IPC4_FW_REVISION_MAJ_MASK GENMASK(19, 16)
88 #define SOF_IPC4_FW_VERSION_MIN_MASK GENMASK(23, 20)
89 #define SOF_IPC4_FW_VERSION_MAJ_MASK GENMASK(27, 24)
91 /* Number of dsp core supported in FW Regs. */
92 #define SOF_IPC4_MAX_SUPPORTED_ADSP_CORES 8
94 /* Number of host pipeline registers slots in FW Regs. */
95 #define SOF_IPC4_MAX_PIPELINE_REG_SLOTS 16
97 /* Number of PeakVol registers slots in FW Regs. */
98 #define SOF_IPC4_MAX_PEAK_VOL_REG_SLOTS 16
100 /* Number of GPDMA LLP Reading slots in FW Regs. */
101 #define SOF_IPC4_MAX_LLP_GPDMA_READING_SLOTS 24
103 /* Number of Aggregated SNDW Reading slots in FW Regs. */
104 #define SOF_IPC4_MAX_LLP_SNDW_READING_SLOTS 15
106 /* Current ABI version of the Fw registers layout. */
107 #define SOF_IPC4_FW_REGS_ABI_VER 1
110 * struct sof_ipc4_fw_registers - FW Registers exposes additional
111 * DSP / FW state information to the driver
112 * @fw_status: Current ROM / FW status
113 * @lec: Last ROM / FW error code
114 * @fps: Current DSP clock status
115 * @lnec: Last Native Error Code(from external library)
116 * @ltr: Copy of LTRC HW register value(FW only)
118 * @rom_info: ROM info
119 * @abi_ver: Version of the layout, set to the current FW_REGS_ABI_VER
120 * @slave_core_sts: Slave core states
122 * @pipeline_regs: State of pipelines attached to host output gateways
123 * @peak_vol_regs: State of PeakVol instances indexed by the PeakVol's instance_id
124 * @llp_gpdma_reading_slots: LLP Readings for single link gateways
125 * @llp_sndw_reading_slots: SNDW aggregated link gateways
126 * @llp_evad_reading_slot: LLP Readings for EVAD gateway
128 struct sof_ipc4_fw_registers {
137 u8 slave_core_sts[SOF_IPC4_MAX_SUPPORTED_ADSP_CORES];
140 struct sof_ipc4_pipeline_registers
141 pipeline_regs[SOF_IPC4_MAX_PIPELINE_REG_SLOTS];
143 struct sof_ipc4_peak_volume_regs
144 peak_vol_regs[SOF_IPC4_MAX_PEAK_VOL_REG_SLOTS];
146 struct sof_ipc4_llp_reading_slot
147 llp_gpdma_reading_slots[SOF_IPC4_MAX_LLP_GPDMA_READING_SLOTS];
149 struct sof_ipc4_llp_reading_slot
150 llp_sndw_reading_slots[SOF_IPC4_MAX_LLP_SNDW_READING_SLOTS];
152 struct sof_ipc4_llp_reading_slot llp_evad_reading_slot;
153 } __packed __aligned(4);