ReactOS 0.4.16-dev-2293-g4d8327b
hda_registers.h
Go to the documentation of this file.
1#define HDA_REG_GCAP 0x00
2#define HDA_GCAP_64OK (1 << 0) /* 64bit address support */
3#define HDA_GCAP_NSDO (3 << 1) /* # of serial data out signals */
4#define HDA_GCAP_BSS (31 << 3) /* # of bidirectional streams */
5#define HDA_GCAP_ISS (15 << 8) /* # of input streams */
6#define HDA_GCAP_OSS (15 << 12) /* # of output streams */
7#define HDA_REG_VMIN 0x02
8#define HDA_REG_VMAJ 0x03
9#define HDA_REG_OUTPAY 0x04
10#define HDA_REG_INPAY 0x06
11#define HDA_REG_GCTL 0x08
12#define HDA_GCTL_RESET (1 << 0) /* controller reset */
13#define HDA_GCTL_FCNTRL (1 << 1) /* flush control */
14#define HDA_GCTL_UNSOL (1 << 8) /* accept unsol. response enable */
15#define HDA_REG_WAKEEN 0x0c
16#define HDA_REG_STATESTS 0x0e
17#define HDA_REG_GSTS 0x10
18#define HDA_GSTS_FSTS (1 << 1) /* flush status */
19#define HDA_REG_GCAP2 0x12
20#define HDA_REG_LLCH 0x14
21#define HDA_REG_OUTSTRMPAY 0x18
22#define HDA_REG_INSTRMPAY 0x1A
23#define HDA_REG_INTCTL 0x20
24#define HDA_REG_INTSTS 0x24
25#define HDA_REG_WALLCLK 0x30 /* 24Mhz source */
26#define HDA_REG_WALLCLKA 0x2030 /* 24Mhz source */
27#define HDA_REG_OLD_SSYNC 0x34 /* SSYNC for old ICH */
28#define HDA_REG_SSYNC 0x38
29#define HDA_REG_CORBLBASE 0x40
30#define HDA_REG_CORBUBASE 0x44
31#define HDA_REG_CORBWP 0x48
32#define HDA_REG_CORBRP 0x4a
33#define HDA_CORBRP_RST (1 << 15) /* read pointer reset */
34#define HDA_REG_CORBCTL 0x4c
35#define HDA_CORBCTL_RUN (1 << 1) /* enable DMA */
36#define HDA_CORBCTL_CMEIE (1 << 0) /* enable memory error irq */
37#define HDA_REG_CORBSTS 0x4d
38#define HDA_CORBSTS_CMEI (1 << 0) /* memory error indication */
39#define HDA_REG_CORBSIZE 0x4e
40
41#define HDA_REG_RIRBLBASE 0x50
42#define HDA_REG_RIRBUBASE 0x54
43#define HDA_REG_RIRBWP 0x58
44#define HDA_RIRBWP_RST (1 << 15) /* write pointer reset */
45#define HDA_REG_RINTCNT 0x5a
46#define HDA_REG_RIRBCTL 0x5c
47#define HDA_RBCTL_IRQ_EN (1 << 0) /* enable IRQ */
48#define HDA_RBCTL_DMA_EN (1 << 1) /* enable DMA */
49#define HDA_RBCTL_OVERRUN_EN (1 << 2) /* enable overrun irq */
50#define HDA_REG_RIRBSTS 0x5d
51#define HDA_RBSTS_IRQ (1 << 0) /* response irq */
52#define HDA_RBSTS_OVERRUN (1 << 2) /* overrun irq */
53#define HDA_REG_RIRBSIZE 0x5e
54
55#define HDA_REG_IC 0x60
56#define HDA_REG_IR 0x64
57#define HDA_REG_IRS 0x68
58#define HDA_IRS_VALID (1<<1)
59#define HDA_IRS_BUSY (1<<0)
60
61#define HDA_REG_DPLBASE 0x70
62#define HDA_REG_DPUBASE 0x74
63#define HDA_DPLBASE_ENABLE 0x1 /* Enable position buffer */
64
65/* SD offset: SDI0=0x80, SDI1=0xa0, ... SDO3=0x160 */
66enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
67
68/* stream register offsets from stream base */
69#define HDA_REG_SD_CTL 0x00
70#define HDA_REG_SD_CTL_3B 0x02 /* 3rd byte of SD_CTL register */
71#define HDA_REG_SD_STS 0x03
72#define HDA_REG_SD_LPIB 0x04
73#define HDA_REG_SD_CBL 0x08
74#define HDA_REG_SD_LVI 0x0c
75#define HDA_REG_SD_FIFOW 0x0e
76#define HDA_REG_SD_FIFOSIZE 0x10
77#define HDA_REG_SD_FORMAT 0x12
78#define HDA_REG_SD_FIFOL 0x14
79#define HDA_REG_SD_BDLPL 0x18
80#define HDA_REG_SD_BDLPU 0x1c
81#define HDA_REG_SD_LPIBA 0x2004
82
83/* GTS registers */
84#define HDA_REG_LLCH 0x14
85
86#define HDA_REG_GTS_BASE 0x520
87
88#define HDA_REG_GTSCC (HDA_REG_GTS_BASE + 0x00)
89#define HDA_REG_WALFCC (HDA_REG_GTS_BASE + 0x04)
90#define HDA_REG_TSCCL (HDA_REG_GTS_BASE + 0x08)
91#define HDA_REG_TSCCU (HDA_REG_GTS_BASE + 0x0C)
92#define HDA_REG_LLPFOC (HDA_REG_GTS_BASE + 0x14)
93#define HDA_REG_LLPCL (HDA_REG_GTS_BASE + 0x18)
94#define HDA_REG_LLPCU (HDA_REG_GTS_BASE + 0x1C)
95
96/* Haswell/Broadwell display HD-A controller Extended Mode registers */
97#define HDA_REG_HSW_EM4 0x100c
98#define HDA_REG_HSW_EM5 0x1010
99
100/* Skylake/Broxton vendor-specific registers */
101#define HDA_REG_VS_EM1 0x1000
102#define HDA_REG_VS_INRC 0x1004
103#define HDA_REG_VS_OUTRC 0x1008
104#define HDA_REG_VS_FIFOTRK 0x100C
105#define HDA_REG_VS_FIFOTRK2 0x1010
106#define HDA_REG_VS_EM2 0x1030
107#define HDA_REG_VS_EM3L 0x1038
108#define HDA_REG_VS_EM3U 0x103C
109#define HDA_REG_VS_EM4L 0x1040
110#define HDA_REG_VS_EM4U 0x1044
111#define HDA_REG_VS_LTRP 0x1048
112#define HDA_REG_VS_D0I3C 0x104A
113#define HDA_REG_VS_PCE 0x104B
114#define HDA_REG_VS_L2MAGC 0x1050
115#define HDA_REG_VS_L2LAHPT 0x1054
116#define HDA_REG_VS_SDXDPIB_XBASE 0x1084
117#define HDA_REG_VS_SDXDPIB_XINTERVAL 0x20
118#define HDA_REG_VS_SDXEFIFOS_XBASE 0x1094
119#define HDA_REG_VS_SDXEFIFOS_XINTERVAL 0x20
120
121/* PCI space */
122#define HDA_PCIREG_TCSEL 0x44
123
124/*
125 * other constants
126 */
127
128 /* max number of fragments - we may use more if allocating more pages for BDL */
129#define BDL_SIZE 4096
130#define HDA_MAX_BDL_ENTRIES (BDL_SIZE / 16)
131/*
132 * max buffer size - artificial 4MB limit per stream to avoid big allocations
133 * In theory it can be really big, but as it is per stream on systems with many streams memory could
134 * be quickly saturated if userspace requests maximum buffer size for each of them.
135 */
136#define HDA_MAX_BUF_SIZE (4*1024*1024)
137
138 /* RIRB int mask: overrun[2], response[0] */
139#define RIRB_INT_RESPONSE 0x01
140#define RIRB_INT_OVERRUN 0x04
141#define RIRB_INT_MASK 0x05
142
143/* STATESTS int mask: S3,SD2,SD1,SD0 */
144#define STATESTS_INT_MASK ((1 << HDA_MAX_CODECS) - 1)
145
146/* SD_CTL bits */
147#define SD_CTL_STREAM_RESET 0x01 /* stream reset bit */
148#define SD_CTL_DMA_START 0x02 /* stream DMA start bit */
149#define SD_CTL_STRIPE (3 << 16) /* stripe control */
150#define SD_CTL_TRAFFIC_PRIO (1 << 18) /* traffic priority */
151#define SD_CTL_DIR (1 << 19) /* bi-directional stream */
152#define SD_CTL_STREAM_TAG_MASK (0xf << 20)
153#define SD_CTL_STREAM_TAG_SHIFT 20
154
155/* SD_CTL and SD_STS */
156#define SD_INT_DESC_ERR 0x10 /* descriptor error interrupt */
157#define SD_INT_FIFO_ERR 0x08 /* FIFO error interrupt */
158#define SD_INT_COMPLETE 0x04 /* completion interrupt */
159#define SD_INT_MASK (SD_INT_DESC_ERR|SD_INT_FIFO_ERR|\
160 SD_INT_COMPLETE)
161#define SD_CTL_STRIPE_MASK 0x3 /* stripe control mask */
162
163/* SD_STS */
164#define SD_STS_FIFO_READY 0x20 /* FIFO ready */
165
166/* INTCTL and INTSTS */
167#define HDA_INT_ALL_STREAM 0xff /* all stream interrupts */
168#define HDA_INT_CTRL_EN 0x40000000 /* controller interrupt enable bit */
169#define HDA_INT_GLOBAL_EN 0x80000000 /* global interrupt enable bit */
170
171/* below are so far hardcoded - should read registers in future */
172#define HDA_MAX_CORB_ENTRIES 256
173#define HDA_MAX_RIRB_ENTRIES 256
174
175/* Capability header Structure */
176#define HDA_REG_CAP_HDR 0x0
177#define HDA_CAP_HDR_VER_OFF 28
178#define HDA_CAP_HDR_VER_MASK (0xF << HDA_CAP_HDR_VER_OFF)
179#define HDA_CAP_HDR_ID_OFF 16
180#define HDA_CAP_HDR_ID_MASK (0xFFF << HDA_CAP_HDR_ID_OFF)
181#define HDA_CAP_HDR_NXT_PTR_MASK 0xFFFF
182
183/* registers of Software Position Based FIFO Capability Structure */
184#define HDA_SPB_CAP_ID 0x4
185#define HDA_REG_SPB_BASE_ADDR 0x700
186#define HDA_REG_SPB_SPBFCH 0x00
187#define HDA_REG_SPB_SPBFCCTL 0x04
188/* Base used to calculate the iterating register offset */
189#define HDA_SPB_BASE 0x08
190/* Interval used to calculate the iterating register offset */
191#define HDA_SPB_INTERVAL 0x08
192/* SPIB base */
193#define HDA_SPB_SPIB 0x00
194/* SPIB MAXFIFO base*/
195#define HDA_SPB_MAXFIFO 0x04
196
197/* registers of Global Time Synchronization Capability Structure */
198#define HDA_GTS_CAP_ID 0x1
199#define HDA_REG_GTS_GTSCH 0x00
200#define HDA_REG_GTS_GTSCD 0x04
201#define HDA_REG_GTS_GTSCTLAC 0x0C
202#define HDA_GTS_BASE 0x20
203#define HDA_GTS_INTERVAL 0x20
204
205/* registers for Processing Pipe Capability Structure */
206#define HDA_PP_CAP_ID 0x3
207#define HDA_REG_PP_PPCH 0x10
208#define HDA_REG_PP_PPCTL 0x04
209#define HDA_PPCTL_PIE (1<<31)
210#define HDA_PPCTL_GPROCEN (1<<30)
211/* _X_ = dma engine # and cannot * exceed 29 (per spec max 30 dma engines) */
212#define HDA_PPCTL_PROCEN(_X_) (1<<(_X_))
213
214#define HDA_REG_PP_PPSTS 0x08
215
216#define HDA_PPHC_BASE 0x10
217#define HDA_PPHC_INTERVAL 0x10
218
219#define HDA_REG_PPHCLLPL 0x0
220#define HDA_REG_PPHCLLPU 0x4
221#define HDA_REG_PPHCLDPL 0x8
222#define HDA_REG_PPHCLDPU 0xC
223
224#define HDA_PPLC_BASE 0x10
225#define HDA_PPLC_MULTI 0x10
226#define HDA_PPLC_INTERVAL 0x10
227
228#define HDA_REG_PPLCCTL 0x0
229#define HDA_PPLCCTL_STRM_BITS 4
230#define HDA_PPLCCTL_STRM_SHIFT 20
231#define HDA_REG_MASK(bit_num, offset) \
232 (((1 << (bit_num)) - 1) << (offset))
233#define HDA_PPLCCTL_STRM_MASK \
234 HDA_REG_MASK(HDA_PPLCCTL_STRM_BITS, HDA_PPLCCTL_STRM_SHIFT)
235#define HDA_PPLCCTL_RUN (1<<1)
236#define HDA_PPLCCTL_STRST (1<<0)
237
238#define HDA_REG_PPLCFMT 0x4
239#define HDA_REG_PPLCLLPL 0x8
240#define HDA_REG_PPLCLLPU 0xC
241
242/* registers for Multiple Links Capability Structure */
243#define HDA_ML_CAP_ID 0x2
244#define HDA_REG_ML_MLCH 0x00
245#define HDA_REG_ML_MLCD 0x04
246#define HDA_ML_BASE 0x40
247#define HDA_ML_INTERVAL 0x40
248
249#define HDA_REG_ML_LCAP 0x00
250#define HDA_REG_ML_LCTL 0x04
251#define HDA_REG_ML_LOSIDV 0x08
252#define HDA_REG_ML_LSDIID 0x0C
253#define HDA_REG_ML_LPSOO 0x10
254#define HDA_REG_ML_LPSIO 0x12
255#define HDA_REG_ML_LWALFC 0x18
256#define HDA_REG_ML_LOUTPAY 0x20
257#define HDA_REG_ML_LINPAY 0x30
258
259/* bit0 is reserved, with BIT(1) mapping to stream1 */
260#define ML_LOSIDV_STREAM_MASK 0xFFFE
261
262#define ML_LCTL_SCF_MASK 0xF
263#define HDA_MLCTL_SPA (0x1 << 16)
264#define HDA_MLCTL_CPA (0x1 << 23)
265#define HDA_MLCTL_SPA_SHIFT 16
266#define HDA_MLCTL_CPA_SHIFT 23
267
268/* registers for DMA Resume Capability Structure */
269#define HDA_DRSM_CAP_ID 0x5
270#define HDA_REG_DRSM_CTL 0x4
271/* Base used to calculate the iterating register offset */
272#define HDA_DRSM_BASE 0x08
273/* Interval used to calculate the iterating register offset */
274#define HDA_DRSM_INTERVAL 0x08
275
276/* Global time synchronization registers */
277#define GTSCC_TSCCD_MASK 0x80000000
278#define GTSCC_TSCCD_SHIFT BIT(31)
279#define GTSCC_TSCCI_MASK 0x20
280#define GTSCC_CDMAS_DMA_DIR_SHIFT 4
281
282#define WALFCC_CIF_MASK 0x1FF
283#define WALFCC_FN_SHIFT 9
284#define HDA_CLK_CYCLES_PER_FRAME 512
285
286/*
287 * An error occurs near frame "rollover". The clocks in frame value indicates
288 * whether this error may have occurred. Here we use the value of 10. Please
289 * see the errata for the right number [<10]
290 */
291#define HDA_MAX_CYCLE_VALUE 499
292#define HDA_MAX_CYCLE_OFFSET 10
293#define HDA_MAX_CYCLE_READ_RETRY 10
294
295#define TSCCU_CCU_SHIFT 32
296#define LLPC_CCU_SHIFT 32
297
298/* Defines for Intel SCH HDA snoop control */
299#define INTEL_HDA_CGCTL 0x48
300#define INTEL_HDA_CGCTL_MISCBDCGE (0x1 << 6)
301#define INTEL_SCH_HDA_DEVC 0x78
302#define INTEL_SCH_HDA_DEVC_NOSNOOP (0x1<<11)
303
304#define HDA_VS_EM2_DUM (1 << 23)
305
306/* Defines for ATI HD Audio support in SB450 south bridge */
307#define ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR 0x42
308#define ATI_SB450_HDAUDIO_ENABLE_SNOOP 0x02
309
310/* Defines for Nvidia HDA support */
311#define NVIDIA_HDA_TRANSREG_ADDR 0x4e
312#define NVIDIA_HDA_ENABLE_COHBITS 0x0f
313#define NVIDIA_HDA_ISTRM_COH 0x4d
314#define NVIDIA_HDA_OSTRM_COH 0x4c
315#define NVIDIA_HDA_ENABLE_COHBIT 0x01
316
317/* Defines for Intel SCH HDA snoop control */
318#define INTEL_HDA_CGCTL 0x48
319#define INTEL_HDA_CGCTL_MISCBDCGE (0x1 << 6)
320#define INTEL_SCH_HDA_DEVC 0x78
321#define INTEL_SCH_HDA_DEVC_NOSNOOP (0x1<<11)
@ SDI3
Definition: hda_registers.h:66
@ SDO0
Definition: hda_registers.h:66
@ SDI0
Definition: hda_registers.h:66
@ SDO3
Definition: hda_registers.h:66
@ SDI2
Definition: hda_registers.h:66
@ SDI1
Definition: hda_registers.h:66
@ SDO1
Definition: hda_registers.h:66
@ SDO2
Definition: hda_registers.h:66