Rev 5363 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3083 | leency | 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
||
5363 | yogev_ezra | 3 | ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
3083 | leency | 4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
||
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
7 | |||
5048 | Asper | 8 | format PE DLL native 0.05 |
9 | section '.flat' code readable writable executable |
||
3083 | leency | 10 | |
11 | DEBUG equ 1 |
||
3498 | mario79 | 12 | FDEBUG equ 0 |
3083 | leency | 13 | DEBUG_IRQ equ 0 |
14 | |||
5048 | Asper | 15 | USE_SINGLE_MODE equ 0 ; 1 = Single mode; 0 = Normal mode. |
16 | USE_UNSOL_EV equ 1 ; 1 = Use unsolicited events; 0 = Do not use unsolicited events. |
||
3083 | leency | 17 | |
5048 | Asper | 18 | TEST_VERSION_NUMBER equ '019' |
3083 | leency | 19 | |
20 | ;Asper+ [ |
||
5048 | Asper | 21 | SDO_TAG equ 1 ;Output stream tag id (any number except 0) |
22 | SDO_IDX equ 4 ;Output stream index |
||
3083 | leency | 23 | ;According to "Intel® I/O Controller Hub 6 (ICH6) High Definition Audio / AC ’97 Programmer’s Reference Manual (PRM) May 2005 Document" |
24 | ;and "Intel® I/O Controller Hub 6 (ICH6) Family Datasheet" SDO0=4, |
||
25 | ;but according to "High Definition Audio Specification Revision 1.0a June 17, 2010" SDO0 depends on the number of SDIs. |
||
26 | |||
5048 | Asper | 27 | SDO_INT equ 1 shl SDO_IDX ;Output stream interrupt (must be power of 2) |
28 | SDO_OFS equ 0x80+(SDO_IDX*0x20) ;Output stream offset |
||
3083 | leency | 29 | ;Asper+ ] |
30 | |||
31 | CURRENT_API equ 0x0100 ;1.00 |
||
32 | COMPATIBLE_API equ 0x0101 ;1.01 |
||
33 | API_VERSION equ (COMPATIBLE_API shl 16) or CURRENT_API |
||
34 | |||
35 | IRQ_REMAP equ 0 |
||
36 | IRQ_LINE equ 0 |
||
37 | |||
38 | CPU_FREQ equ 2600d |
||
39 | |||
40 | ; Vendors |
||
41 | VID_INTEL equ 0x8086 |
||
42 | VID_NVIDIA equ 0x10DE |
||
43 | VID_ATI equ 0x1002 |
||
44 | VID_AMD equ 0x1022 |
||
3170 | hidnplayr | 45 | VID_VIA equ 0x1106 |
3083 | leency | 46 | VID_SIS equ 0x1039 |
47 | VID_ULI equ 0x10B9 |
||
48 | VID_CREATIVE equ 0x1102 |
||
49 | VID_TERA equ 0x6549 |
||
50 | VID_RDC equ 0x17F3 |
||
51 | VID_VMWARE equ 0x15AD |
||
52 | |||
53 | ; Devices |
||
54 | ; Intel |
||
6299 | serge | 55 | CTRL_INTEL_SCH2 equ 0x080a |
56 | CTRL_INTEL_HPT equ 0x0c0c |
||
57 | CTRL_INTEL_0F04 equ 0x0F04 |
||
58 | CTRL_INTEL_CPT equ 0x1c20 |
||
59 | CTRL_INTEL_PGB equ 0x1d20 |
||
60 | CTRL_INTEL_PPT1 equ 0x1e20 |
||
61 | CTRL_INTEL_2284 equ 0x2284 |
||
62 | CTRL_INTEL_ICH6 equ 0x2668 |
||
63 | CTRL_INTEL_63XXESB equ 0x269a |
||
64 | CTRL_INTEL_ICH7 equ 0x27d8 |
||
65 | CTRL_INTEL_ICH8 equ 0x284b |
||
66 | CTRL_INTEL_82801_UNK1 equ 0x2911 |
||
67 | CTRL_INTEL_ICH9 equ 0x293e |
||
68 | CTRL_INTEL_ICH9_2 equ 0x293f |
||
69 | CTRL_INTEL_ICH10 equ 0x3a3e |
||
70 | CTRL_INTEL_ICH10_2 equ 0x3a6e |
||
71 | CTRL_INTEL_PCH equ 0x3b56 |
||
72 | CTRL_INTEL_PCH2 equ 0x3b57 |
||
73 | CTRL_INTEL_SCH equ 0x811b |
||
74 | CTRL_INTEL_LPT equ 0x8c20 |
||
75 | CTRL_INTEL_8ca0 equ 0x8cA0 |
||
76 | CTRL_INTEL_8d20 equ 0x8d20 |
||
77 | CTRL_INTEL_8d21 equ 0x8d21 |
||
78 | CTRL_INTEL_A1F0 equ 0xA1F0 |
||
79 | CTRL_INTEL_A270 equ 0xA270 |
||
80 | CTRL_INTEL_9C20 equ 0x9c20 |
||
81 | CTRL_INTEL_9C21 equ 0x9c21 |
||
82 | CTRL_INTEL_9CA0 equ 0x9cA0 |
||
83 | CTRL_INTEL_A170 equ 0xA170 |
||
84 | CTRL_INTEL_9D70 equ 0x9D70 |
||
85 | CTRL_INTEL_5A98 equ 0x5A98 |
||
3083 | leency | 86 | ; Nvidia |
87 | CTRL_NVIDIA_MCP51 equ 0x026c |
||
88 | CTRL_NVIDIA_MCP55 equ 0x0371 |
||
89 | CTRL_NVIDIA_MCP61_1 equ 0x03e4 |
||
90 | CTRL_NVIDIA_MCP61_2 equ 0x03f0 |
||
91 | CTRL_NVIDIA_MCP65_1 equ 0x044a |
||
92 | CTRL_NVIDIA_MCP65_2 equ 0x044b |
||
93 | CTRL_NVIDIA_MCP67_1 equ 0x055c |
||
94 | CTRL_NVIDIA_MCP67_2 equ 0x055d |
||
95 | CTRL_NVIDIA_MCP78_1 equ 0x0774 |
||
96 | CTRL_NVIDIA_MCP78_2 equ 0x0775 |
||
97 | CTRL_NVIDIA_MCP78_3 equ 0x0776 |
||
98 | CTRL_NVIDIA_MCP78_4 equ 0x0777 |
||
99 | CTRL_NVIDIA_MCP73_1 equ 0x07fc |
||
100 | CTRL_NVIDIA_MCP73_2 equ 0x07fd |
||
101 | CTRL_NVIDIA_MCP79_1 equ 0x0ac0 |
||
102 | CTRL_NVIDIA_MCP79_2 equ 0x0ac1 |
||
103 | CTRL_NVIDIA_MCP79_3 equ 0x0ac2 |
||
104 | CTRL_NVIDIA_MCP79_4 equ 0x0ac3 |
||
105 | CTRL_NVIDIA_0BE2 equ 0x0be2 |
||
106 | CTRL_NVIDIA_0BE3 equ 0x0be3 |
||
107 | CTRL_NVIDIA_0BE4 equ 0x0be4 |
||
108 | CTRL_NVIDIA_GT100 equ 0x0be5 |
||
109 | CTRL_NVIDIA_GT106 equ 0x0be9 |
||
110 | CTRL_NVIDIA_GT108 equ 0x0bea |
||
111 | CTRL_NVIDIA_GT104 equ 0x0beb |
||
112 | CTRL_NVIDIA_GT116 equ 0x0bee |
||
113 | CTRL_NVIDIA_MCP89_1 equ 0x0d94 |
||
114 | CTRL_NVIDIA_MCP89_2 equ 0x0d95 |
||
115 | CTRL_NVIDIA_MCP89_3 equ 0x0d96 |
||
116 | CTRL_NVIDIA_MCP89_4 equ 0x0d97 |
||
117 | CTRL_NVIDIA_GF119 equ 0x0e08 |
||
118 | CTRL_NVIDIA_GF110_1 equ 0x0e09 |
||
119 | CTRL_NVIDIA_GF110_2 equ 0x0e0c |
||
120 | ; ATI |
||
121 | CTRL_ATI_SB450 equ 0x437b |
||
122 | CTRL_ATI_SB600 equ 0x4383 |
||
123 | ; ATI HDMI |
||
124 | CTRL_ATI_RS600 equ 0x793b |
||
125 | CTRL_ATI_RS690 equ 0x7919 |
||
126 | CTRL_ATI_RS780 equ 0x960f |
||
127 | CTRL_ATI_RS_UNK1 equ 0x970f |
||
128 | CTRL_ATI_R600 equ 0xaa00 |
||
129 | CTRL_ATI_RV630 equ 0xaa08 |
||
130 | CTRL_ATI_RV610 equ 0xaa10 |
||
131 | CTRL_ATI_RV670 equ 0xaa18 |
||
132 | CTRL_ATI_RV635 equ 0xaa20 |
||
133 | CTRL_ATI_RV620 equ 0xaa28 |
||
134 | CTRL_ATI_RV770 equ 0xaa30 |
||
135 | CTRL_ATI_RV730 equ 0xaa38 |
||
136 | CTRL_ATI_RV710 equ 0xaa40 |
||
137 | CTRL_ATI_RV740 equ 0xaa48 |
||
138 | ; AMD |
||
139 | CTRL_AMD_HUDSON equ 0x780d |
||
140 | ; VIA |
||
141 | CTRL_VIA_VT82XX equ 0x3288 |
||
142 | CTRL_VIA_VT61XX equ 0x9140 |
||
143 | CTRL_VIA_VT71XX equ 0x9170 |
||
144 | ; SiS |
||
145 | CTRL_SIS_966 equ 0x7502 |
||
146 | ; ULI |
||
147 | CTRL_ULI_M5461 equ 0x5461 |
||
148 | ; Creative |
||
149 | CTRL_CREATIVE_CA0110_IBG equ 0x0009 |
||
150 | CTRL_CREATIVE_SOUND_CORE3D_1 equ 0x0010 |
||
151 | CTRL_CREATIVE_SOUND_CORE3D_2 equ 0x0012 |
||
152 | ; Teradici |
||
153 | CTRL_TERA_UNK1 equ 0x1200 |
||
154 | ; RDC Semiconductor |
||
155 | CTRL_RDC_R3010 equ 0x3010 |
||
156 | ;VMware |
||
157 | CTRL_VMWARE_UNK1 equ 0x1977 |
||
158 | |||
159 | |||
160 | ; driver types |
||
161 | AZX_DRIVER_ICH equ 0 |
||
162 | AZX_DRIVER_PCH equ 1 |
||
163 | AZX_DRIVER_SCH equ 2 |
||
164 | AZX_DRIVER_ATI equ 3 |
||
165 | AZX_DRIVER_ATIHDMI equ 4 |
||
166 | AZX_DRIVER_VIA equ 5 |
||
167 | AZX_DRIVER_SIS equ 6 |
||
168 | AZX_DRIVER_ULI equ 7 |
||
169 | AZX_DRIVER_NVIDIA equ 8 |
||
170 | AZX_DRIVER_TERA equ 9 |
||
171 | AZX_DRIVER_CTX equ 10 |
||
172 | AZX_DRIVER_GENERIC equ 11 |
||
173 | AZX_NUM_DRIVERS equ 12 |
||
174 | |||
175 | |||
176 | ; registers |
||
177 | |||
178 | ICH6_REG_GCAP equ 0x00 |
||
179 | ICH6_REG_VMIN equ 0x02 |
||
180 | ICH6_REG_VMAJ equ 0x03 |
||
181 | ICH6_REG_OUTPAY equ 0x04 |
||
182 | ICH6_REG_INPAY equ 0x06 |
||
183 | ICH6_REG_GCTL equ 0x08 |
||
184 | ICH6_GCTL_RESET equ (1 shl 0) ; controller reset |
||
185 | ICH6_GCTL_FCNTRL equ (1 shl 1) ; flush control |
||
186 | ICH6_GCTL_UNSOL equ (1 shl 8) ; accept unsol. response enable |
||
187 | ICH6_REG_WAKEEN equ 0x0c |
||
188 | ICH6_REG_STATESTS equ 0x0e |
||
189 | ICH6_REG_GSTS equ 0x10 |
||
190 | ICH6_GSTS_FSTS equ (1 shl 1) ; flush status |
||
191 | ICH6_REG_INTCTL equ 0x20 |
||
192 | ICH6_REG_INTSTS equ 0x24 |
||
193 | ICH6_REG_WALLCLK equ 0x30 ; 24Mhz source |
||
194 | ICH6_REG_OLD_SSYNC equ 0x34 ; SSYNC for old ICH |
||
195 | ICH6_REG_SSYNC equ 0x38 |
||
196 | ICH6_REG_CORBLBASE equ 0x40 |
||
197 | ICH6_REG_CORBUBASE equ 0x44 |
||
198 | ICH6_REG_CORBWP equ 0x48 |
||
199 | ICH6_REG_CORBRP equ 0x4A |
||
200 | ICH6_CORBRP_RST equ (1 shl 15) ; read pointer reset |
||
201 | ICH6_REG_CORBCTL equ 0x4c |
||
202 | ICH6_CORBCTL_RUN equ (1 shl 1) ; enable DMA |
||
203 | ICH6_CORBCTL_CMEIE equ (1 shl 0) ; enable memory error irq |
||
204 | ICH6_REG_CORBSTS equ 0x4d |
||
205 | ICH6_CORBSTS_CMEI equ (1 shl 0) ; memory error indication |
||
206 | ICH6_REG_CORBSIZE equ 0x4e |
||
207 | |||
208 | ICH6_REG_RIRBLBASE equ 0x50 |
||
209 | ICH6_REG_RIRBUBASE equ 0x54 |
||
210 | ICH6_REG_RIRBWP equ 0x58 |
||
211 | ICH6_RIRBWP_RST equ (1 shl 15) ; write pointer reset |
||
212 | ICH6_REG_RINTCNT equ 0x5a |
||
213 | ICH6_REG_RIRBCTL equ 0x5c |
||
214 | ICH6_RBCTL_IRQ_EN equ (1 shl 0) ; enable IRQ |
||
215 | ICH6_RBCTL_DMA_EN equ (1 shl 1) ; enable DMA |
||
216 | ICH6_RBCTL_OVERRUN_EN equ (1 shl 2) ; enable overrun irq |
||
217 | ICH6_REG_RIRBSTS equ 0x5d |
||
218 | ICH6_RBSTS_IRQ equ (1 shl 0) ; response irq |
||
219 | ICH6_RBSTS_OVERRUN equ (1 shl 2) ; overrun irq |
||
220 | ICH6_REG_RIRBSIZE equ 0x5e |
||
221 | |||
222 | ICH6_REG_IC equ 0x60 |
||
223 | ICH6_REG_IR equ 0x64 |
||
224 | ICH6_REG_IRS equ 0x68 |
||
225 | ICH6_IRS_VALID equ 2 |
||
226 | ICH6_IRS_BUSY equ 1 |
||
227 | |||
228 | ICH6_REG_DPLBASE equ 0x70 |
||
229 | ICH6_REG_DPUBASE equ 0x74 |
||
230 | ICH6_DPLBASE_ENABLE equ 1 ; Enable position buffer |
||
231 | |||
232 | ; SD offset: SDI0=0x80, SDI1=0xa0, ... SDO3=0x160 */ |
||
233 | SDI0_SD_OFFSET equ 0x80 |
||
234 | SDI1_SD_OFFSET equ 0xA0 |
||
235 | SDI2_SD_OFFSET equ 0xC0 |
||
236 | SDI3_SD_OFFSET equ 0xE0 |
||
237 | SDO0_SD_OFFSET equ 0x100 |
||
238 | SDO1_SD_OFFSET equ 0x120 |
||
239 | SDO2_SD_OFFSET equ 0X140 |
||
240 | SDO3_SD_OFFSET equ 0x160 |
||
241 | |||
242 | ; stream register offsets from stream base |
||
243 | ICH6_REG_SD_CTL equ 0x00 |
||
244 | ICH6_REG_SD_STS equ 0x03 |
||
245 | ICH6_REG_SD_LPIB equ 0x04 |
||
246 | ICH6_REG_SD_CBL equ 0x08 |
||
247 | ICH6_REG_SD_LVI equ 0x0c |
||
248 | ICH6_REG_SD_FIFOW equ 0x0e |
||
249 | ICH6_REG_SD_FIFOSIZE equ 0x10 |
||
250 | ICH6_REG_SD_FORMAT equ 0x12 |
||
251 | ICH6_REG_SD_BDLPL equ 0x18 |
||
252 | ICH6_REG_SD_BDLPU equ 0x1c |
||
253 | |||
254 | ; PCI space |
||
255 | ICH6_PCIREG_TCSEL equ 0x44 |
||
256 | |||
257 | ; other constants |
||
258 | ICH6_RIRB_EX_UNSOL_EV equ (1 shl 4) |
||
259 | |||
260 | ; max number of SDs |
||
261 | MAX_ICH6_DEV equ 8 |
||
262 | ; max number of fragments - we may use more if allocating more pages for BDL |
||
263 | AZX_MAX_FRAG equ (4096 / (MAX_ICH6_DEV * 16)) |
||
264 | ; max buffer size - no h/w limit, you can increase as you like |
||
265 | AZX_MAX_BUF_SIZE equ (1024*1024*1024) |
||
266 | ; max number of PCM devices per card |
||
267 | AZX_MAX_PCMS equ 8 |
||
268 | |||
269 | ; RIRB int mask: overrun[2], response[0] |
||
270 | RIRB_INT_RESPONSE equ 0x01 |
||
271 | RIRB_INT_OVERRUN equ 0x04 |
||
272 | RIRB_INT_MASK equ 0x05 |
||
273 | |||
274 | ; STATESTS int mask: SD2,SD1,SD0 |
||
275 | STATESTS_INT_MASK equ 0x07 |
||
276 | AZX_MAX_CODECS equ 4 |
||
277 | |||
278 | ; SD_CTL bits |
||
279 | SD_CTL_STREAM_RESET equ 0x01 ; stream reset bit |
||
280 | SD_CTL_DMA_START equ 0x02 ; stream DMA start bit |
||
281 | SD_CTL_STREAM_TAG_MASK equ (0xf shl 20) |
||
282 | SD_CTL_STREAM_TAG_SHIFT equ 20 |
||
283 | |||
284 | ; SD_CTL and SD_STS |
||
285 | SD_INT_DESC_ERR equ 0x10 ; descriptor error interrupt |
||
286 | SD_INT_FIFO_ERR equ 0x08 ; FIFO error interrupt |
||
287 | SD_INT_COMPLETE equ 0x04 ; completion interrupt |
||
288 | SD_INT_MASK equ (SD_INT_DESC_ERR or SD_INT_FIFO_ERR or SD_INT_COMPLETE) |
||
289 | |||
290 | ; SD_STS |
||
291 | SD_STS_FIFO_READY equ 0x20 ; FIFO ready |
||
292 | |||
293 | ; INTCTL and INTSTS |
||
294 | ICH6_INT_ALL_STREAM equ 0xff ; all stream interrupts |
||
295 | ICH6_INT_CTRL_EN equ 0x40000000 ; controller interrupt enable bit |
||
296 | ICH6_INT_GLOBAL_EN equ 0x80000000 ; global interrupt enable bit |
||
297 | |||
298 | ; GCTL reset bit |
||
299 | ICH6_GCTL_RESET equ 1 |
||
300 | |||
301 | ; CORB/RIRB control, read/write pointer |
||
302 | ICH6_RBCTL_DMA_EN equ 0x02 ; enable DMA |
||
303 | ICH6_RBCTL_IRQ_EN equ 0x01 ; enable IRQ |
||
304 | ICH6_RBRWP_CLR equ 0x8000 ; read/write pointer clear |
||
305 | ; below are so far hardcoded - should read registers in future |
||
306 | ICH6_MAX_CORB_ENTRIES equ 256 |
||
307 | ICH6_MAX_RIRB_ENTRIES equ 256 |
||
308 | |||
309 | ; position fix mode |
||
5048 | Asper | 310 | POS_FIX_AUTO equ 0 |
311 | POS_FIX_LPIB equ 1 |
||
312 | POS_FIX_POSBUF equ 2 |
||
313 | POS_FIX_VIACOMBO equ 4 |
||
314 | POS_FIX_COMBO equ 8 |
||
3083 | leency | 315 | |
316 | ; Defines for ATI HD Audio support in SB450 south bridge |
||
317 | ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR equ 0x42 |
||
318 | ATI_SB450_HDAUDIO_ENABLE_SNOOP equ 0x02 |
||
319 | |||
320 | ; Defines for Nvidia HDA support |
||
321 | NVIDIA_HDA_TRANSREG_ADDR equ 0x4e |
||
322 | NVIDIA_HDA_ENABLE_COHBITS equ 0x0f |
||
323 | NVIDIA_HDA_ISTRM_COH equ 0x4d |
||
324 | NVIDIA_HDA_OSTRM_COH equ 0x4c |
||
325 | NVIDIA_HDA_ENABLE_COHBIT equ 0x01 |
||
326 | |||
327 | ; Defines for Intel SCH HDA snoop control |
||
328 | INTEL_SCH_HDA_DEVC equ 0x78 |
||
329 | INTEL_SCH_HDA_DEVC_NOSNOOP equ (0x1 shl 11) |
||
330 | |||
331 | ; Define IN stream 0 FIFO size offset in VIA controller |
||
332 | VIA_IN_STREAM0_FIFO_SIZE_OFFSET equ 0x90 |
||
333 | ; Define VIA HD Audio Device ID |
||
334 | VIA_HDAC_DEVICE_ID equ 0x3288 |
||
335 | |||
336 | ; HD Audio class code |
||
337 | PCI_CLASS_MULTIMEDIA_HD_AUDIO equ 0x0403 |
||
338 | |||
339 | |||
340 | SRV_GETVERSION equ 0 |
||
341 | DEV_PLAY equ 1 |
||
342 | DEV_STOP equ 2 |
||
343 | DEV_CALLBACK equ 3 |
||
344 | DEV_SET_BUFF equ 4 |
||
345 | DEV_NOTIFY equ 5 |
||
346 | DEV_SET_MASTERVOL equ 6 |
||
347 | DEV_GET_MASTERVOL equ 7 |
||
348 | DEV_GET_INFO equ 8 |
||
349 | DEV_GET_POS equ 9 |
||
350 | DEV_SET_CHANNEL_VOLUME equ 10 |
||
351 | DEV_GET_CHANNEL_VOLUME equ 11 |
||
352 | ;Asper: Non standard system service. For the tests only! [ |
||
353 | DEV_EXEC_CODEC_CMD equ 100 |
||
354 | ;Asper: Non standard system service. For the tests only! ] |
||
355 | |||
356 | struc AC_CNTRL ;AC controller base class |
||
5048 | Asper | 357 | { |
358 | .bus dd ? |
||
359 | .devfn dd ? |
||
3083 | leency | 360 | |
5048 | Asper | 361 | .vendor dw ? |
362 | .dev_id dw ? |
||
363 | .pci_cmd dd ? |
||
364 | .pci_stat dd ? |
||
3083 | leency | 365 | |
5048 | Asper | 366 | .ctrl_io_base dd ? |
367 | .ctrl_mem_base dd ? |
||
368 | .cfg_reg dd ? |
||
369 | .int_line dd ? |
||
3083 | leency | 370 | |
5048 | Asper | 371 | .vendor_ids dd ? ;vendor id string |
372 | .ctrl_ids dd ? ;hub id string |
||
3083 | leency | 373 | |
5048 | Asper | 374 | .buffer dd ? |
3083 | leency | 375 | |
5048 | Asper | 376 | .notify_pos dd ? |
377 | .notify_task dd ? |
||
3083 | leency | 378 | |
5048 | Asper | 379 | .lvi_reg dd ? |
380 | .civ_val dd 1 |
||
381 | .user_callback dd ? |
||
3083 | leency | 382 | |
5048 | Asper | 383 | .ctrl_read8 dd ? |
384 | .ctrl_read16 dd ? |
||
385 | .ctrl_read32 dd ? |
||
3083 | leency | 386 | |
5048 | Asper | 387 | .ctrl_write8 dd ? |
388 | .ctrl_write16 dd ? |
||
389 | .ctrl_write32 dd ? |
||
3083 | leency | 390 | |
5048 | Asper | 391 | .codec_mask dd ? |
392 | .rb dd ? |
||
393 | .rirb_rp dw 0 |
||
394 | .rirb_wp dw 0 |
||
395 | .corb_rp dw 0 |
||
396 | .corb_wp dw 0 |
||
397 | .rirb_cmd dd 0 |
||
398 | .rirb_res dd 0 |
||
399 | .rirb_error dd 0 |
||
400 | .response_reset dd 0 |
||
401 | .polling_mode db 0 |
||
402 | .poll_count db 0 |
||
403 | .posbuf dd ? |
||
404 | .start_wallclk dd ? ; start + minimum wallclk |
||
405 | .period_wallclk dd ? ; wallclk for period |
||
406 | .position_fix db ? |
||
3083 | leency | 407 | } |
408 | |||
409 | struc CODEC ;Audio Chip base class |
||
410 | { |
||
5048 | Asper | 411 | .addr dd ? ; codec slot index (codec address) |
412 | .afg dd ? ; AFG node id |
||
413 | .mfg dd ? ; MFG node id |
||
3083 | leency | 414 | |
5048 | Asper | 415 | .function_id dd ? |
416 | .subsystem_id dd ? |
||
417 | .revision_id dd ? |
||
418 | .chip_id dw ? |
||
419 | .vendor_id dw ? |
||
3083 | leency | 420 | |
5048 | Asper | 421 | ; widget capabilities cache |
422 | .num_nodes dw ? |
||
423 | .start_nid dw ? |
||
424 | .wcaps dd ? |
||
3083 | leency | 425 | |
5048 | Asper | 426 | .init_pins dd ? ; initial (BIOS) pin configurations |
427 | .num_pins dd ? ;Asper + : word is enough, but for align... |
||
428 | .beeper_nid dw ? |
||
429 | .pad dw ? |
||
3083 | leency | 430 | |
5048 | Asper | 431 | .ac_vendor_ids dd ? ;ac vendor id string |
432 | .chip_ids dd ? ;chip model string |
||
3083 | leency | 433 | } |
434 | |||
435 | struc CTRL_INFO |
||
5048 | Asper | 436 | { |
437 | .pci_cmd dd ? |
||
438 | .irq dd ? |
||
439 | .glob_cntrl dd ? |
||
440 | .glob_sta dd ? |
||
441 | .codec_io_base dd ? |
||
442 | .ctrl_io_base dd ? |
||
443 | .codec_mem_base dd ? |
||
444 | .ctrl_mem_base dd ? |
||
445 | .codec_id dd ? |
||
3083 | leency | 446 | } |
447 | |||
448 | struc IOCTL |
||
5048 | Asper | 449 | { |
450 | .handle dd ? |
||
451 | .io_code dd ? |
||
452 | .input dd ? |
||
453 | .inp_size dd ? |
||
454 | .output dd ? |
||
455 | .out_size dd ? |
||
3083 | leency | 456 | } |
457 | |||
458 | EVENT_NOTIFY equ 0x00000200 |
||
459 | |||
3496 | Asper | 460 | ; Macroses by CleverMouse |
461 | ; The following macro assume that we are on uniprocessor machine. |
||
462 | ; Serious work is needed for multiprocessor machines. |
||
463 | macro spin_lock_irqsave spinlock |
||
464 | { |
||
465 | pushf |
||
466 | cli |
||
467 | } |
||
468 | macro spin_unlock_irqrestore spinlock |
||
469 | { |
||
470 | popf |
||
471 | } |
||
472 | macro spin_lock_irq spinlock |
||
473 | { |
||
474 | cli |
||
475 | } |
||
476 | macro spin_unlock_irq spinlock |
||
477 | { |
||
478 | sti |
||
479 | } |
||
480 | |||
481 | SPINLOCK_BUSY = 1 |
||
482 | SPINLOCK_FREE = 0 |
||
483 | |||
484 | macro spin_lock |
||
485 | { |
||
486 | push eax ebx |
||
487 | mov eax, aspinlock |
||
488 | mov ebx, SPINLOCK_BUSY |
||
5048 | Asper | 489 | @@: |
3496 | Asper | 490 | lock xchg [eax], ebx |
491 | cmp ebx, SPINLOCK_FREE |
||
492 | jnz @b |
||
493 | pop ebx eax |
||
494 | } |
||
495 | |||
496 | macro spin_unlock |
||
497 | { |
||
498 | push eax ebx |
||
499 | mov eax, aspinlock |
||
500 | mov eax, aspinlock |
||
501 | mov ebx, SPINLOCK_FREE |
||
5048 | Asper | 502 | lock xchg [eax], ebx |
3496 | Asper | 503 | pop ebx eax |
504 | } |
||
505 | |||
5048 | Asper | 506 | data fixups |
507 | end data |
||
3083 | leency | 508 | |
5048 | Asper | 509 | include '../../struct.inc' |
510 | include '../../macros.inc' |
||
511 | include '../../proc32.inc' |
||
512 | include '../../peimport.inc' |
||
513 | include 'CODEC_H.INC' |
||
3083 | leency | 514 | |
5048 | Asper | 515 | entry START |
3083 | leency | 516 | |
5077 | clevermous | 517 | ;proc START c, reason:dword, cmdline:dword |
518 | proc START |
||
5048 | Asper | 519 | push ebx esi ; save used registers to be stdcall |
520 | virtual at esp |
||
521 | rd 2 ; saved registers |
||
522 | dd ? ; return address |
||
523 | .reason dd ? ; DRV_ENTRY or DRV_EXIT |
||
524 | .cmdline dd ? ; normally NULL |
||
525 | end virtual |
||
526 | ; 1. Check the reason for the call, do nothing unless initializing. |
||
5077 | clevermous | 527 | cmp [.reason], DRV_ENTRY |
528 | jne .stop |
||
3083 | leency | 529 | |
5048 | Asper | 530 | if DEBUG |
531 | mov esi, msgTV |
||
532 | invoke SysMsgBoardStr |
||
3083 | leency | 533 | |
5048 | Asper | 534 | mov esi, msgInit |
535 | invoke SysMsgBoardStr |
||
536 | end if |
||
3083 | leency | 537 | |
5048 | Asper | 538 | call detect_controller |
539 | test eax, eax |
||
540 | jz .fail |
||
3083 | leency | 541 | |
5048 | Asper | 542 | mov esi,[ctrl.vendor_ids] |
543 | invoke SysMsgBoardStr |
||
544 | mov esi, [ctrl.ctrl_ids] |
||
545 | invoke SysMsgBoardStr |
||
3083 | leency | 546 | |
5048 | Asper | 547 | call init_controller |
548 | test eax, eax |
||
549 | jz .fail |
||
3083 | leency | 550 | |
551 | ;Asper This part is from "azx_create" proc. [ |
||
5048 | Asper | 552 | mov [ctrl.position_fix], POS_FIX_LPIB |
553 | cmp [driver_type], AZX_DRIVER_VIA |
||
554 | je .set_via_patch |
||
555 | cmp [driver_type], AZX_DRIVER_ATI |
||
556 | jne .no_via_patch |
||
557 | .set_via_patch: |
||
558 | or [ctrl.position_fix], POS_FIX_VIACOMBO |
||
559 | .no_via_patch: |
||
560 | ; codec detection |
||
561 | mov eax, [ctrl.codec_mask] |
||
562 | test eax, eax |
||
563 | jnz @f |
||
564 | if DEBUG |
||
565 | mov esi, msgNoCodecsFound |
||
566 | jmp .fail_msg |
||
567 | else |
||
568 | jmp .fail |
||
569 | end if |
||
570 | @@: |
||
3083 | leency | 571 | ;Asper ] |
572 | |||
5048 | Asper | 573 | mov esi, msgPrimBuff |
574 | invoke SysMsgBoardStr |
||
575 | call create_primary_buff |
||
576 | mov esi, msgDone |
||
577 | invoke SysMsgBoardStr |
||
3083 | leency | 578 | |
5048 | Asper | 579 | if IRQ_REMAP |
580 | pushf |
||
581 | cli |
||
3083 | leency | 582 | |
5048 | Asper | 583 | mov ebx, [ctrl.int_line] |
584 | in al, 0xA1 |
||
585 | mov ah, al |
||
586 | in al, 0x21 |
||
587 | test ebx, ebx |
||
588 | jz .skip |
||
589 | bts ax, bx ;mask old line |
||
3083 | leency | 590 | .skip |
5048 | Asper | 591 | bts ax, IRQ_LINE ;mask new line |
592 | out 0x21, al |
||
593 | mov al, ah |
||
594 | out 0xA1, al |
||
3083 | leency | 595 | ;remap IRQ |
5048 | Asper | 596 | invoke PciWrite8, 0, 0xF8, 0x61, IRQ_LINE |
3083 | leency | 597 | |
5048 | Asper | 598 | mov dx, 0x4d0 ;8259 ELCR1 |
599 | in al, dx |
||
600 | bts ax, IRQ_LINE |
||
601 | out dx, al ;set level-triggered mode |
||
602 | mov [ctrl.int_line], IRQ_LINE |
||
603 | popf |
||
604 | mov esi, msgRemap |
||
605 | invoke SysMsgBoardStr |
||
606 | end if |
||
3083 | leency | 607 | |
5048 | Asper | 608 | mov ebx, [ctrl.int_line] |
609 | invoke AttachIntHandler, ebx, hda_irq, dword 0 |
||
3083 | leency | 610 | |
611 | ;Asper This part is from "azx_probe" proc. [ |
||
5048 | Asper | 612 | call azx_codec_create |
613 | cmp eax, 0 |
||
614 | jl .fail |
||
3083 | leency | 615 | |
5048 | Asper | 616 | call azx_codec_configure |
617 | cmp eax, 0 |
||
618 | jl .fail |
||
3083 | leency | 619 | ;] Asper |
620 | |||
5048 | Asper | 621 | ; create PCM streams |
3083 | leency | 622 | ;Asper+ [ |
5048 | Asper | 623 | mov eax, [spec.dac_node] |
624 | if DEBUG ;- |
||
625 | push eax esi |
||
626 | mov esi, msgVal |
||
627 | invoke SysMsgBoardStr |
||
628 | stdcall fdword2str, 3 |
||
629 | invoke SysMsgBoardStr |
||
630 | pop esi eax |
||
631 | end if |
||
3083 | leency | 632 | |
5048 | Asper | 633 | test eax, eax |
634 | jz .fail |
||
635 | mov ebx, [spec.dac_node+4] |
||
636 | if DEBUG ;- |
||
637 | push eax esi |
||
638 | mov esi, msgVal |
||
639 | invoke SysMsgBoardStr |
||
640 | mov eax, [spec.dac_node+4] |
||
641 | stdcall fdword2str, 3 |
||
642 | invoke SysMsgBoardStr |
||
643 | pop esi eax |
||
644 | end if |
||
3083 | leency | 645 | |
5048 | Asper | 646 | test ebx, ebx |
647 | jz @f |
||
648 | cmp eax, ebx |
||
649 | je @f |
||
650 | stdcall hda_codec_setup_stream, ebx, SDO_TAG, 0, 0x11 ; Left & Right channels (Front panel) |
||
651 | @@: |
||
652 | stdcall hda_codec_setup_stream, eax, SDO_TAG, 0, 0x11 ; Left & Right channels (Back panel) |
||
3083 | leency | 653 | ;Asper+ ] |
654 | |||
5048 | Asper | 655 | if USE_SINGLE_MODE |
656 | mov esi, msgSingleMode |
||
657 | invoke SysMsgBoardStr |
||
658 | else |
||
659 | mov esi, msgNormalMode |
||
660 | invoke SysMsgBoardStr |
||
661 | end if |
||
3083 | leency | 662 | |
663 | .reg: |
||
5048 | Asper | 664 | invoke RegService, sz_sound_srv, service_proc |
665 | pop esi ebx |
||
666 | ret |
||
3083 | leency | 667 | .fail: |
5048 | Asper | 668 | mov esi, msgFail |
3083 | leency | 669 | .fail_msg: |
5048 | Asper | 670 | invoke SysMsgBoardStr |
671 | pop esi ebx |
||
672 | xor eax, eax |
||
673 | ret |
||
3083 | leency | 674 | .stop: |
5048 | Asper | 675 | call stop |
676 | pop esi ebx |
||
677 | xor eax, eax |
||
678 | ret |
||
3083 | leency | 679 | endp |
680 | |||
681 | handle equ IOCTL.handle |
||
682 | io_code equ IOCTL.io_code |
||
683 | input equ IOCTL.input |
||
684 | inp_size equ IOCTL.inp_size |
||
685 | output equ IOCTL.output |
||
686 | out_size equ IOCTL.out_size |
||
687 | |||
688 | align 4 |
||
689 | proc service_proc stdcall, ioctl:dword |
||
5048 | Asper | 690 | mov edi, [ioctl] |
691 | mov eax, [edi+io_code] |
||
3083 | leency | 692 | |
5048 | Asper | 693 | cmp eax, SRV_GETVERSION |
694 | jne @F |
||
3083 | leency | 695 | |
5048 | Asper | 696 | mov eax, [edi+output] |
697 | cmp [edi+out_size], 4 |
||
698 | jne .fail |
||
3083 | leency | 699 | |
5048 | Asper | 700 | mov [eax], dword API_VERSION |
701 | xor eax, eax |
||
702 | ret |
||
3083 | leency | 703 | @@: |
5048 | Asper | 704 | cmp eax, DEV_PLAY |
705 | jne @F |
||
706 | if DEBUG |
||
707 | mov esi, msgPlay |
||
708 | invoke SysMsgBoardStr |
||
709 | end if |
||
710 | call play |
||
711 | xor eax, eax |
||
712 | ret |
||
3083 | leency | 713 | @@: |
5048 | Asper | 714 | cmp eax, DEV_STOP |
715 | jne @F |
||
716 | if DEBUG |
||
717 | mov esi, msgStop |
||
718 | invoke SysMsgBoardStr |
||
719 | end if |
||
720 | call stop |
||
721 | xor eax, eax |
||
722 | ret |
||
3083 | leency | 723 | @@: |
5048 | Asper | 724 | cmp eax, DEV_CALLBACK |
725 | jne @f |
||
726 | mov ebx, [edi+input] |
||
727 | stdcall set_callback, [ebx] |
||
728 | xor eax, eax |
||
729 | ret |
||
3083 | leency | 730 | @@: |
5048 | Asper | 731 | cmp eax, DEV_SET_MASTERVOL |
732 | jne @f |
||
733 | mov eax, [edi+input] |
||
734 | mov eax, [eax] |
||
735 | call set_master_vol |
||
736 | xor eax, eax |
||
737 | ret |
||
3083 | leency | 738 | @@: |
5048 | Asper | 739 | cmp eax, DEV_GET_MASTERVOL |
740 | jne @f |
||
741 | mov ebx, [edi+output] |
||
742 | stdcall get_master_vol, ebx |
||
743 | xor eax, eax |
||
744 | ret |
||
3083 | leency | 745 | ;@@: |
5048 | Asper | 746 | ; cmp eax, DEV_GET_INFO |
747 | ; jne @f |
||
748 | ; mov ebx, [edi+output] |
||
749 | ; stdcall get_dev_info, ebx |
||
750 | ; xor eax, eax |
||
751 | ; ret |
||
3083 | leency | 752 | @@: |
5048 | Asper | 753 | cmp eax, DEV_GET_POS |
754 | jne @f |
||
755 | stdcall azx_get_position |
||
756 | shr eax, 2 |
||
757 | mov ebx, [edi+output] |
||
758 | mov [ebx], eax |
||
759 | xor eax, eax |
||
760 | ret |
||
3083 | leency | 761 | @@: |
5048 | Asper | 762 | ; cmp eax, DEV_SET_CHANNEL_VOLUME |
763 | ; jne @f |
||
764 | ;if DEBUG |
||
765 | ; mov esi, msgSetChannelVolume |
||
766 | ; invoke SysMsgBoardStr |
||
767 | ;end if |
||
768 | ; mov ebx, [edi+input] |
||
769 | ; mov cl, byte [ebx] ; cl=channel |
||
770 | ; mov eax, dword [ebx+1] ; eax=volume in Db |
||
771 | ;if DEBUG |
||
772 | ; push eax esi |
||
773 | ; mov esi, msgYAHOO1 |
||
774 | ; invoke SysMsgBoardStr |
||
775 | ; stdcall fdword2str, 1 |
||
776 | ; invoke SysMsgBoardStr |
||
777 | ; mov esi, strSemicolon |
||
778 | ; invoke SysMsgBoardStr |
||
779 | ; movzx eax, cl |
||
780 | ; stdcall fdword2str, 3 |
||
781 | ; invoke SysMsgBoardStr |
||
782 | ; pop esi eax |
||
783 | ;end if |
||
784 | ; ; call set_channel_volume |
||
785 | ; xor eax, eax |
||
786 | ; ret |
||
3083 | leency | 787 | ;@@: |
5048 | Asper | 788 | ; cmp eax, DEV_GET_CHANNEL_VOLUME |
789 | ; jne @f |
||
790 | ; mov cl, byte [edi+input] ; cl=channel |
||
791 | ; call get_channel_volume |
||
792 | ; mov ebx, [edi+output] |
||
793 | ; mov [ebx], eax |
||
794 | ; xor eax, eax |
||
795 | ; ret |
||
3083 | leency | 796 | ;@@: |
797 | |||
798 | ;Asper: Non standard system service. For the tests only! [ |
||
799 | @@: |
||
5048 | Asper | 800 | cmp eax, DEV_EXEC_CODEC_CMD |
801 | jne @f |
||
3083 | leency | 802 | |
5048 | Asper | 803 | mov eax, [edi+input] |
804 | mov eax, [eax] |
||
805 | stdcall codec_exec_verb, eax |
||
806 | xor eax, eax |
||
807 | ret |
||
3083 | leency | 808 | @@: |
809 | ;Asper: Non standard system service. For the tests only! ] |
||
810 | |||
811 | .fail: |
||
5048 | Asper | 812 | or eax, -1 |
813 | ret |
||
3083 | leency | 814 | endp |
815 | |||
5048 | Asper | 816 | restore handle |
817 | restore io_code |
||
818 | restore input |
||
819 | restore inp_size |
||
820 | restore output |
||
821 | restore out_size |
||
3083 | leency | 822 | |
823 | |||
824 | align 4 |
||
825 | proc hda_irq ;+ |
||
5048 | Asper | 826 | spin_lock |
827 | if DEBUG_IRQ |
||
828 | push eax esi |
||
829 | ;mov esi, msgIRQ |
||
830 | ;invoke SysMsgBoardStr |
||
831 | call GetTimerTicks |
||
832 | stdcall fdword2str, 2 |
||
833 | invoke SysMsgBoardStr |
||
834 | pop esi eax |
||
835 | end if |
||
836 | mov edx, ICH6_REG_INTSTS |
||
837 | call azx_readl |
||
838 | test eax, eax |
||
839 | jnz @f |
||
840 | spin_unlock |
||
841 | ret |
||
842 | @@: |
||
843 | mov ebx, eax ; status |
||
844 | mov eax, SDO_INT |
||
845 | test ebx, eax |
||
846 | jz @f |
||
3083 | leency | 847 | |
5048 | Asper | 848 | mov edx, ICH6_REG_SD_STS + SDO_OFS |
849 | call azx_readb |
||
850 | mov bl, al |
||
3083 | leency | 851 | |
5048 | Asper | 852 | mov al, SD_INT_MASK |
853 | mov edx, ICH6_REG_SD_STS + SDO_OFS |
||
854 | call azx_writeb |
||
3083 | leency | 855 | |
5048 | Asper | 856 | test bl, SD_INT_COMPLETE |
857 | jz @f |
||
3083 | leency | 858 | |
5048 | Asper | 859 | mov eax, [ctrl.civ_val] |
860 | inc eax |
||
861 | and eax, 4-1 ;2-1 |
||
862 | mov [ctrl.civ_val], eax |
||
3083 | leency | 863 | |
5048 | Asper | 864 | mov ebx, dword [buff_list+eax*4] |
865 | cmp [ctrl.user_callback], 0 |
||
866 | je @f |
||
867 | stdcall [ctrl.user_callback], ebx |
||
868 | @@: |
||
869 | ; clear rirb int |
||
870 | mov edx, ICH6_REG_RIRBSTS |
||
871 | call azx_readb |
||
3083 | leency | 872 | |
5048 | Asper | 873 | test al, RIRB_INT_MASK |
874 | jz .l1 |
||
875 | test al, RIRB_INT_RESPONSE |
||
876 | jz .l2 |
||
3083 | leency | 877 | |
5048 | Asper | 878 | cmp byte [driver_type], AZX_DRIVER_CTX |
879 | jne @f |
||
880 | mov eax, 80 ; wait 80 us |
||
881 | call StallExec |
||
882 | @@: |
||
883 | call azx_update_rirb |
||
884 | .l2: |
||
885 | mov al, RIRB_INT_MASK |
||
886 | mov edx, ICH6_REG_RIRBSTS |
||
887 | call azx_writeb |
||
888 | .l1: |
||
3083 | leency | 889 | |
890 | ;if 0 |
||
891 | ; clear state status int |
||
5048 | Asper | 892 | mov edx, ICH6_REG_STATESTS |
893 | call azx_readb |
||
894 | test al, 0x04 |
||
895 | jz @f |
||
3083 | leency | 896 | |
5048 | Asper | 897 | mov al, 0x04 |
898 | mov edx, ICH6_REG_STATESTS |
||
899 | call azx_writeb |
||
900 | @@: |
||
3083 | leency | 901 | ;end if |
5048 | Asper | 902 | or eax, 1 |
903 | spin_unlock |
||
904 | ret |
||
3083 | leency | 905 | endp |
906 | |||
907 | |||
908 | align 4 |
||
909 | proc create_primary_buff |
||
910 | |||
5048 | Asper | 911 | invoke KernelAlloc, 4096 |
912 | mov [ctrl.posbuf], eax |
||
3083 | leency | 913 | |
5048 | Asper | 914 | invoke KernelAlloc, 0x10000 ;0x8000 |
915 | mov [ctrl.buffer], eax |
||
3083 | leency | 916 | |
5048 | Asper | 917 | mov edi, eax |
918 | mov ecx, 0x10000/4 ;0x8000/4 |
||
919 | xor eax, eax |
||
920 | cld |
||
921 | rep stosd |
||
3083 | leency | 922 | |
5048 | Asper | 923 | invoke KernelAlloc, 4096 |
924 | mov [pcmout_bdl], eax |
||
3083 | leency | 925 | |
5048 | Asper | 926 | mov edi, eax |
927 | mov ecx, 4096/4 |
||
928 | xor eax, eax |
||
929 | cld |
||
930 | rep stosd |
||
3083 | leency | 931 | |
5048 | Asper | 932 | ; reset BDL address |
933 | xor eax, eax |
||
934 | mov edx, ICH6_REG_SD_BDLPL + SDO_OFS |
||
935 | call azx_writel |
||
936 | xor eax, eax |
||
937 | mov edx, ICH6_REG_SD_BDLPU + SDO_OFS |
||
938 | call azx_writel |
||
3083 | leency | 939 | |
5048 | Asper | 940 | ; program the initial BDL entries |
941 | mov eax, [ctrl.buffer] |
||
942 | mov ebx, eax |
||
943 | invoke GetPgAddr |
||
944 | and ebx, 0xFFF |
||
945 | add eax, ebx |
||
3083 | leency | 946 | |
5048 | Asper | 947 | mov ebx, 0x4000 ;buffer size |
948 | mov ecx, 8 ;number of periods |
||
949 | mov edi, [pcmout_bdl] ;pcmout_bdl |
||
950 | .next_period: |
||
951 | push eax ecx |
||
952 | mov ecx, 4 ;2 ;number of bdl in a period |
||
953 | .next_bdl: |
||
954 | ; program the address field of the BDL entry |
||
955 | mov dword [edi], eax |
||
956 | mov dword [edi+4], 0 |
||
957 | ; program the size field of the BDL entry |
||
958 | mov dword [edi+8], ebx |
||
959 | ; program the IOC to enable interrupt when buffer completes |
||
960 | mov dword [edi+12], 0x01 |
||
3083 | leency | 961 | |
5048 | Asper | 962 | add eax, ebx |
963 | add edi, 16 |
||
964 | dec ecx |
||
965 | jnz .next_bdl |
||
3083 | leency | 966 | |
5048 | Asper | 967 | pop ecx eax |
968 | dec ecx |
||
969 | jnz .next_period |
||
3083 | leency | 970 | |
5048 | Asper | 971 | mov edi, buff_list |
972 | mov eax, [ctrl.buffer] |
||
973 | mov ecx, 4 ;2 |
||
3083 | leency | 974 | @@: |
5048 | Asper | 975 | mov [edi], eax |
976 | mov [edi+8], eax |
||
977 | mov [edi+16], eax |
||
978 | mov [edi+24], eax |
||
979 | mov [edi+32], eax |
||
980 | mov [edi+40], eax |
||
981 | mov [edi+48], eax |
||
982 | mov [edi+56], eax |
||
3083 | leency | 983 | |
5048 | Asper | 984 | add eax, ebx |
985 | add edi, 4 |
||
986 | loop @B |
||
3083 | leency | 987 | |
5048 | Asper | 988 | ; wallclk has 24Mhz clock source |
989 | mov [ctrl.period_wallclk], ((0x4000 * 24000) / 48000) * 1000 |
||
3083 | leency | 990 | |
5048 | Asper | 991 | call azx_stream_reset |
992 | call azx_setup_controller |
||
993 | ret |
||
3083 | leency | 994 | endp |
995 | |||
996 | align 4 |
||
997 | proc detect_controller |
||
5048 | Asper | 998 | locals |
999 | last_bus dd ? |
||
1000 | bus dd ? |
||
1001 | devfn dd ? |
||
1002 | endl |
||
1003 | xor eax, eax |
||
1004 | mov [bus], eax |
||
1005 | inc eax |
||
1006 | invoke PciApi |
||
1007 | cmp eax, -1 |
||
1008 | je .err |
||
3083 | leency | 1009 | |
5048 | Asper | 1010 | mov [last_bus], eax |
3083 | leency | 1011 | |
5048 | Asper | 1012 | .next_bus: |
1013 | and [devfn], 0 |
||
1014 | .next_dev: |
||
1015 | invoke PciRead32, [bus], [devfn], dword 0 |
||
1016 | test eax, eax |
||
1017 | jz .next |
||
1018 | cmp eax, -1 |
||
1019 | je .next |
||
3083 | leency | 1020 | |
5048 | Asper | 1021 | mov edi, devices |
1022 | @@: |
||
1023 | mov ebx, [edi] |
||
1024 | test ebx, ebx |
||
1025 | jz .next |
||
3083 | leency | 1026 | |
5048 | Asper | 1027 | cmp eax, ebx |
1028 | je .found |
||
1029 | add edi, 12 |
||
1030 | jmp @b |
||
1031 | .next: |
||
1032 | inc [devfn] |
||
1033 | cmp [devfn], 256 |
||
1034 | jb .next_dev |
||
1035 | mov eax, [bus] |
||
1036 | inc eax |
||
1037 | mov [bus], eax |
||
1038 | cmp eax, [last_bus] |
||
1039 | jna .next_bus |
||
1040 | xor eax, eax |
||
1041 | ret |
||
1042 | .found: |
||
1043 | mov ebx, [bus] |
||
1044 | mov [ctrl.bus], ebx |
||
3083 | leency | 1045 | |
5048 | Asper | 1046 | mov ecx, [devfn] |
1047 | mov [ctrl.devfn], ecx |
||
3083 | leency | 1048 | |
5048 | Asper | 1049 | mov edx, eax |
1050 | and edx, 0xFFFF |
||
1051 | mov [ctrl.vendor], dx |
||
1052 | shr eax, 16 |
||
1053 | mov [ctrl.dev_id], ax |
||
3083 | leency | 1054 | |
5048 | Asper | 1055 | mov ebx, [edi+4] |
1056 | mov [ctrl.ctrl_ids], ebx |
||
3083 | leency | 1057 | |
5048 | Asper | 1058 | cmp edx, VID_INTEL |
1059 | jne @f |
||
1060 | mov [ctrl.vendor_ids], msg_Intel |
||
1061 | jmp .ok |
||
1062 | @@: |
||
1063 | cmp edx, VID_NVIDIA |
||
1064 | jne @f |
||
1065 | mov [ctrl.vendor_ids], msg_NVidia |
||
1066 | jmp .ok |
||
1067 | @@: |
||
1068 | cmp edx, VID_ATI |
||
1069 | jne @f |
||
1070 | cmp eax, 0x4383 |
||
1071 | jg .ati_hdmi |
||
1072 | mov [ctrl.vendor_ids], msg_ATI |
||
1073 | jmp .ok |
||
1074 | .ati_hdmi: |
||
1075 | mov [ctrl.vendor_ids], msg_ATI_HDMI |
||
1076 | jmp .ok |
||
1077 | @@: |
||
1078 | cmp edx, VID_AMD |
||
1079 | jne @f |
||
1080 | mov [ctrl.vendor_ids], msg_AMD |
||
1081 | jmp .ok |
||
1082 | @@: |
||
1083 | cmp edx, VID_VIA |
||
1084 | jne @f |
||
1085 | mov [ctrl.vendor_ids], msg_VIA |
||
1086 | jmp .ok |
||
1087 | @@: |
||
1088 | cmp edx, VID_SIS |
||
1089 | jne @f |
||
1090 | mov [ctrl.vendor_ids], msg_SIS |
||
1091 | jmp .ok |
||
1092 | @@: |
||
1093 | cmp edx, VID_ULI |
||
1094 | jne @f |
||
1095 | mov [ctrl.vendor_ids], msg_ULI |
||
1096 | jmp .ok |
||
1097 | @@: |
||
1098 | cmp edx, VID_TERA |
||
1099 | jne @f |
||
1100 | mov [ctrl.vendor_ids], msg_TERA |
||
1101 | jmp .ok |
||
1102 | @@: |
||
1103 | cmp edx, VID_CREATIVE |
||
1104 | jne @f |
||
1105 | mov [ctrl.vendor_ids], msg_CREATIVE |
||
1106 | jmp .ok |
||
1107 | @@: |
||
1108 | cmp edx, VID_RDC |
||
1109 | jne @f |
||
1110 | mov [ctrl.vendor_ids], msg_RDC |
||
1111 | jmp .ok |
||
1112 | @@: |
||
1113 | cmp edx, VID_VMWARE |
||
1114 | jne @f |
||
1115 | mov [ctrl.vendor_ids], msg_VMWARE |
||
1116 | jmp .ok |
||
1117 | @@: |
||
1118 | .err: |
||
1119 | xor eax, eax |
||
1120 | mov [ctrl.vendor_ids], eax ;something wrong ? |
||
1121 | mov [driver_type], -1 |
||
1122 | ret |
||
1123 | .ok: |
||
1124 | mov ebx, [edi+8] |
||
1125 | mov [driver_type], ebx |
||
1126 | ret |
||
3083 | leency | 1127 | endp |
1128 | |||
1129 | align 4 |
||
1130 | proc init_controller |
||
1131 | |||
5048 | Asper | 1132 | invoke PciRead32, [ctrl.bus], [ctrl.devfn], dword 4 |
1133 | test eax, 0x4 ; Test Master bit |
||
1134 | jnz @f |
||
1135 | or eax, 0x4 ; Set Master bit |
||
1136 | invoke PciWrite32, [ctrl.bus], [ctrl.devfn], dword 4, eax |
||
1137 | invoke PciRead32, [ctrl.bus], [ctrl.devfn], dword 4 |
||
1138 | @@: |
||
1139 | mov ebx, eax |
||
1140 | and eax, 0xFFFF |
||
1141 | mov [ctrl.pci_cmd], eax |
||
1142 | shr ebx, 16 |
||
1143 | mov [ctrl.pci_stat], ebx |
||
3083 | leency | 1144 | |
5048 | Asper | 1145 | mov esi, msgPciCmd |
1146 | invoke SysMsgBoardStr |
||
1147 | stdcall fdword2str, 2 |
||
1148 | invoke SysMsgBoardStr |
||
3083 | leency | 1149 | |
5048 | Asper | 1150 | mov esi, msgPciStat |
1151 | invoke SysMsgBoardStr |
||
1152 | mov eax, [ctrl.pci_stat] |
||
1153 | stdcall fdword2str, 2 |
||
1154 | invoke SysMsgBoardStr |
||
3083 | leency | 1155 | |
5048 | Asper | 1156 | mov esi, msgHDALowMMIo |
1157 | invoke SysMsgBoardStr |
||
1158 | invoke PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x10 |
||
1159 | stdcall fdword2str, 2 |
||
1160 | invoke SysMsgBoardStr |
||
3083 | leency | 1161 | |
5048 | Asper | 1162 | and eax, 0xFFFFC000 |
1163 | mov [ctrl.ctrl_mem_base], eax |
||
3083 | leency | 1164 | |
5048 | Asper | 1165 | mov esi, msgHDAUpMMIo |
1166 | invoke SysMsgBoardStr |
||
1167 | invoke PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x14 |
||
1168 | ;-mov [ctrl.hda_upper_mem_base], eax |
||
1169 | stdcall fdword2str, 2 |
||
1170 | invoke SysMsgBoardStr |
||
3083 | leency | 1171 | |
5048 | Asper | 1172 | .default: |
1173 | invoke PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C |
||
1174 | and eax, 0xFF |
||
1175 | @@: |
||
1176 | mov [ctrl.int_line], eax |
||
1177 | mov [ctrl.user_callback], 0 |
||
3083 | leency | 1178 | |
5048 | Asper | 1179 | call set_HDA |
3083 | leency | 1180 | ;Asper This is from "azx_create" proc. [ |
5048 | Asper | 1181 | xor eax, eax |
1182 | mov edx, ICH6_REG_GCAP |
||
1183 | call azx_readw |
||
1184 | if DEBUG |
||
1185 | mov esi, msgGCap |
||
1186 | invoke SysMsgBoardStr |
||
1187 | stdcall fdword2str, 2 |
||
1188 | invoke SysMsgBoardStr |
||
1189 | end if |
||
1190 | ; allocate CORB/RIRB |
||
1191 | call azx_alloc_cmd_io |
||
3083 | leency | 1192 | |
5048 | Asper | 1193 | ; initialize chip |
1194 | call azx_init_pci |
||
3083 | leency | 1195 | |
5048 | Asper | 1196 | xor eax, eax |
1197 | call azx_init_chip |
||
3083 | leency | 1198 | ;] Asper |
1199 | |||
5048 | Asper | 1200 | xor eax, eax |
1201 | inc eax |
||
1202 | ret |
||
3083 | leency | 1203 | endp |
1204 | |||
1205 | |||
1206 | |||
5048 | Asper | 1207 | PG_SW equ 0x003 |
1208 | PG_NOCACHE equ 0x018 |
||
3083 | leency | 1209 | |
1210 | align 4 |
||
1211 | proc set_HDA |
||
5048 | Asper | 1212 | invoke MapIoMem,[ctrl.ctrl_mem_base],0x1000,PG_SW+PG_NOCACHE |
1213 | mov [ctrl.ctrl_mem_base], eax |
||
1214 | ret |
||
3083 | leency | 1215 | endp |
1216 | |||
1217 | |||
1218 | ; in: eax - fullreset_flag |
||
1219 | ; |
||
1220 | ; reset codec link |
||
1221 | align 4 |
||
1222 | proc reset_controller |
||
5048 | Asper | 1223 | locals |
1224 | counter dd ? |
||
1225 | endl |
||
3083 | leency | 1226 | |
5048 | Asper | 1227 | test eax, eax |
1228 | jz .skip |
||
3083 | leency | 1229 | |
5048 | Asper | 1230 | ; clear STATESTS |
1231 | mov eax, STATESTS_INT_MASK |
||
1232 | mov edx, ICH6_REG_STATESTS |
||
1233 | call azx_writeb |
||
3083 | leency | 1234 | |
5048 | Asper | 1235 | ; reset controller |
1236 | mov edx, ICH6_REG_GCTL |
||
1237 | call azx_readl |
||
1238 | mov ebx, ICH6_GCTL_RESET |
||
1239 | xor ebx, -1 |
||
1240 | and eax, ebx |
||
1241 | mov edx, ICH6_REG_GCTL |
||
1242 | call azx_writel |
||
3083 | leency | 1243 | |
5048 | Asper | 1244 | mov [counter], 50 ; total 50*100 us = 0.5s |
1245 | .wait0: |
||
3083 | leency | 1246 | |
5048 | Asper | 1247 | mov edx, ICH6_REG_GCTL |
1248 | call azx_readb |
||
1249 | test eax, eax |
||
1250 | jz @f |
||
3083 | leency | 1251 | |
5048 | Asper | 1252 | mov eax, 100 ; wait 100 us |
1253 | call StallExec |
||
3083 | leency | 1254 | |
5048 | Asper | 1255 | dec [counter] |
1256 | jnz .wait0 |
||
1257 | @@: |
||
1258 | ; delay for >= 100us for codec PLL to settle per spec |
||
1259 | ; Rev 0.9 section 5.5.1 |
||
1260 | mov eax, 100 ; wait 100 us |
||
1261 | call StallExec |
||
3083 | leency | 1262 | |
5048 | Asper | 1263 | ; Bring controller out of reset |
1264 | mov edx, ICH6_REG_GCTL |
||
1265 | call azx_readb |
||
1266 | or eax, ICH6_GCTL_RESET |
||
1267 | mov edx, ICH6_REG_GCTL |
||
1268 | call azx_writeb |
||
3083 | leency | 1269 | |
5048 | Asper | 1270 | mov [counter], 50 ; total 50*100 us = 0.5s |
1271 | .wait1: |
||
3083 | leency | 1272 | |
5048 | Asper | 1273 | mov edx, ICH6_REG_GCTL |
1274 | call azx_readb |
||
1275 | test eax, eax |
||
1276 | jnz @f |
||
3083 | leency | 1277 | |
5048 | Asper | 1278 | mov eax, 100 ; wait 100 us |
1279 | call StallExec |
||
3083 | leency | 1280 | |
5048 | Asper | 1281 | dec [counter] |
1282 | jnz .wait1 |
||
1283 | @@: |
||
3083 | leency | 1284 | |
5048 | Asper | 1285 | ; Brent Chartrand said to wait >= 540us for codecs to intialize |
1286 | mov eax, 540 ; wait 540 us |
||
1287 | call StallExec |
||
3083 | leency | 1288 | |
5048 | Asper | 1289 | .skip: |
1290 | ; check to see if controller is ready |
||
1291 | mov edx, ICH6_REG_GCTL |
||
1292 | call azx_readb |
||
1293 | test eax, eax |
||
1294 | jz .fail |
||
3083 | leency | 1295 | |
5048 | Asper | 1296 | ; Accept unsolicited responses |
1297 | if USE_SINGLE_MODE |
||
1298 | else if USE_UNSOL_EV |
||
3083 | leency | 1299 | ;UNSUPPORTED YET! [ |
5048 | Asper | 1300 | mov edx, ICH6_REG_GCTL |
1301 | call azx_readl |
||
1302 | or eax, ICH6_GCTL_UNSOL |
||
1303 | mov edx, ICH6_REG_GCTL |
||
1304 | call azx_writel |
||
3083 | leency | 1305 | ;UNSUPPORTED YET! ] |
5048 | Asper | 1306 | end if |
3083 | leency | 1307 | |
5048 | Asper | 1308 | ; detect codecs |
1309 | mov eax, [ctrl.codec_mask] |
||
1310 | test ax, ax |
||
1311 | jnz @f |
||
3083 | leency | 1312 | |
5048 | Asper | 1313 | mov edx, ICH6_REG_STATESTS |
1314 | call azx_readw |
||
1315 | mov [ctrl.codec_mask], eax |
||
3083 | leency | 1316 | |
5048 | Asper | 1317 | if DEBUG |
1318 | mov esi, msgCodecMask |
||
1319 | invoke SysMsgBoardStr |
||
1320 | stdcall fdword2str, 2 |
||
1321 | invoke SysMsgBoardStr |
||
1322 | end if |
||
3083 | leency | 1323 | |
5048 | Asper | 1324 | @@: |
3083 | leency | 1325 | |
5048 | Asper | 1326 | .ok: |
1327 | clc |
||
1328 | ret |
||
1329 | .fail: |
||
1330 | if DEBUG |
||
1331 | mov esi, msgHDARFail |
||
1332 | invoke SysMsgBoardStr |
||
1333 | end if |
||
1334 | stc |
||
1335 | ret |
||
3083 | leency | 1336 | endp |
1337 | |||
1338 | |||
1339 | align 4 |
||
1340 | play: |
||
5048 | Asper | 1341 | spin_lock_irq |
1342 | mov edx, ICH6_REG_WALLCLK |
||
1343 | call azx_readl |
||
1344 | mov [ctrl.start_wallclk], eax |
||
3083 | leency | 1345 | |
5048 | Asper | 1346 | call azx_stream_start |
1347 | xor eax, eax |
||
1348 | spin_unlock_irq |
||
1349 | ret |
||
3083 | leency | 1350 | |
1351 | align 4 |
||
1352 | stop: |
||
5048 | Asper | 1353 | spin_lock_irq |
1354 | ;* call azx_stream_stop ;Asper: Hangs system |
||
1355 | ;R push ebx ecx edx |
||
1356 | ;R ; stop DMA |
||
1357 | ;R mov edx, ICH6_REG_SD_CTL |
||
1358 | ;R call azx_sd_readb |
||
1359 | ;R mov bl, SD_CTL_DMA_START or SD_INT_MASK |
||
1360 | ;R xor bl, -1 |
||
1361 | ;R and al, bl |
||
1362 | ;R mov edx, ICH6_REG_SD_CTL |
||
1363 | ;R call azx_sd_writeb |
||
1364 | ;R mov edx, ICH6_REG_SD_STS |
||
1365 | ;R mov al, SD_INT_MASK |
||
1366 | ;R call azx_sd_writeb ; to be sure |
||
1367 | ; disable SIE |
||
1368 | ;N mov edx, ICH6_REG_INTCTL |
||
1369 | ;N call azx_readb |
||
1370 | ;N mov bl, SDO_INT ;shl azx_dev->index |
||
1371 | ;N xor bl, -1 |
||
1372 | ;N and al, bl |
||
1373 | ;N mov edx, ICH6_REG_INTCTL |
||
1374 | ;N call azx_writeb |
||
3083 | leency | 1375 | |
5048 | Asper | 1376 | ; int timeout = 5000; |
1377 | ; while (azx_sd_readb(azx_dev, SD_CTL) & SD_CTL_DMA_START && --timeout) ; |
||
3083 | leency | 1378 | ;Asper: Hangs system [ |
5048 | Asper | 1379 | ;* mov ecx, 5000 |
1380 | ;*.l1: |
||
1381 | ;* mov edx, ICH6_REG_SD_CTL |
||
1382 | ;* call azx_sd_readb |
||
1383 | ;* test al, SD_CTL_DMA_START |
||
1384 | ;* jz @f |
||
1385 | ;* dec ecx |
||
1386 | ;* jnz .l1 |
||
1387 | ;*@@: |
||
3083 | leency | 1388 | ;* |
5048 | Asper | 1389 | ;* pop edx ecx ebx |
3083 | leency | 1390 | ;Asper ] |
1391 | |||
5048 | Asper | 1392 | xor eax, eax |
1393 | spin_unlock_irq |
||
1394 | ret |
||
3083 | leency | 1395 | |
1396 | ;align 4 |
||
5048 | Asper | 1397 | ;proc get_dev_info stdcall, p_info:dword ;deprecated |
1398 | ;virtual at esi |
||
1399 | ; CTRL_INFO CTRL_INFO |
||
1400 | ;end virtual |
||
3083 | leency | 1401 | ; |
5048 | Asper | 1402 | ; mov esi, [p_info] |
1403 | ; mov eax, [ctrl.int_line] |
||
1404 | ; mov bx, [ctrl.dev_id] |
||
1405 | ; shl ebx, 16 |
||
1406 | ; and bx, [ctrl.vendor] |
||
1407 | ; mov ecx, [ctrl.pci_cmd] |
||
1408 | ; mov edx, [ctrl.codec_mem_base] ;[ctrl.hda_lower_mem_base] |
||
1409 | ; mov edi, [ctrl.ctrl_mem_base] ;[ctrl.hda_upper_mem_base] |
||
3083 | leency | 1410 | ; |
5048 | Asper | 1411 | ; mov [CTRL_INFO.irq], eax |
1412 | ; mov [CTRL_INFO.codec_id], ebx |
||
1413 | ; mov [CTRL_INFO.pci_cmd], ecx |
||
1414 | ; mov [CTRL_INFO.codec_mem_base], edx |
||
1415 | ; mov [CTRL_INFO.ctrl_mem_base], edi |
||
3083 | leency | 1416 | ; |
5048 | Asper | 1417 | ; xor eax, eax |
1418 | ; mov [CTRL_INFO.codec_io_base], eax |
||
1419 | ; mov [CTRL_INFO.ctrl_io_base], eax |
||
1420 | ; mov [CTRL_INFO.glob_cntrl], eax |
||
1421 | ; mov [CTRL_INFO.glob_sta], eax |
||
1422 | ; ret |
||
3083 | leency | 1423 | ;endp |
1424 | |||
1425 | align 4 |
||
1426 | proc set_callback stdcall, handler:dword |
||
5048 | Asper | 1427 | mov eax, [handler] |
1428 | mov [ctrl.user_callback], eax |
||
1429 | ret |
||
3083 | leency | 1430 | endp |
1431 | |||
1432 | |||
1433 | |||
1434 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
1435 | ;; Interface for HD codec ;; |
||
1436 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
1437 | |||
1438 | ;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
1439 | ;; CORB / RIRB interface ;; |
||
1440 | ;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
1441 | |||
5048 | Asper | 1442 | proc azx_alloc_cmd_io |
1443 | push eax ecx edx |
||
1444 | ; single page (at least 4096 bytes) must suffice for both ringbuffers |
||
1445 | invoke KernelAlloc, 4096 |
||
1446 | mov [ctrl.rb], eax |
||
3083 | leency | 1447 | |
5048 | Asper | 1448 | mov edi, eax |
1449 | mov ecx, 4096/4 |
||
1450 | xor eax, eax |
||
1451 | cld |
||
1452 | rep stosd |
||
3083 | leency | 1453 | |
5048 | Asper | 1454 | pop edx ecx eax |
1455 | ret |
||
3083 | leency | 1456 | endp |
1457 | |||
5048 | Asper | 1458 | proc azx_init_cmd_io |
1459 | spin_lock_irq |
||
1460 | pusha |
||
1461 | ; CORB set up |
||
1462 | mov eax, [ctrl.rb] |
||
1463 | mov ebx, eax |
||
1464 | invoke GetPgAddr |
||
1465 | and ebx, 0xFFF |
||
1466 | add eax, ebx |
||
1467 | push eax ; save corb address |
||
1468 | mov edx, ICH6_REG_CORBLBASE |
||
1469 | call azx_writel |
||
1470 | xor eax, eax |
||
1471 | mov edx, ICH6_REG_CORBUBASE |
||
1472 | call azx_writel |
||
3083 | leency | 1473 | |
5048 | Asper | 1474 | ; set the corb size to 256 entries (ULI requires explicitly) |
1475 | mov al, 0x02 |
||
1476 | mov edx, ICH6_REG_CORBSIZE |
||
1477 | call azx_writeb |
||
1478 | ; set the corb write pointer to 0 |
||
1479 | xor ax, ax |
||
1480 | mov edx, ICH6_REG_CORBWP |
||
1481 | call azx_writew |
||
1482 | ; reset the corb hw read pointer |
||
1483 | mov ax, ICH6_CORBRP_RST |
||
1484 | mov edx, ICH6_REG_CORBRP |
||
1485 | call azx_writew |
||
1486 | ; enable corb dma |
||
1487 | mov al, ICH6_CORBCTL_RUN |
||
1488 | mov edx, ICH6_REG_CORBCTL |
||
1489 | call azx_writeb |
||
3083 | leency | 1490 | |
5048 | Asper | 1491 | ; RIRB set up |
1492 | mov [ctrl.rirb_rp], 0 |
||
1493 | mov [ctrl.rirb_wp], 0 |
||
1494 | mov [ctrl.rirb_cmd], 0 |
||
3083 | leency | 1495 | |
5048 | Asper | 1496 | pop eax ; restore corb address |
1497 | add eax, 2048 |
||
1498 | mov edx, ICH6_REG_RIRBLBASE |
||
1499 | call azx_writel |
||
1500 | xor eax, eax |
||
1501 | mov edx, ICH6_REG_RIRBUBASE |
||
1502 | call azx_writel |
||
3083 | leency | 1503 | |
5048 | Asper | 1504 | ; set the rirb size to 256 entries (ULI requires explicitly) |
1505 | mov al, 0x02 |
||
1506 | mov edx, ICH6_REG_RIRBSIZE |
||
1507 | call azx_writeb |
||
1508 | ; reset the rirb hw write pointer |
||
1509 | mov ax, ICH6_RIRBWP_RST |
||
1510 | mov edx, ICH6_REG_RIRBWP |
||
1511 | call azx_writew |
||
1512 | ; set N=1, get RIRB response interrupt for new entry |
||
1513 | xor ax, ax |
||
1514 | cmp byte [driver_type], AZX_DRIVER_CTX |
||
1515 | jne @f |
||
1516 | mov ax, 0xC0-1 |
||
3083 | leency | 1517 | @@: |
5048 | Asper | 1518 | inc ax |
1519 | mov edx, ICH6_REG_RINTCNT |
||
1520 | call azx_writew |
||
1521 | ; enable rirb dma and response irq |
||
1522 | mov al, ICH6_RBCTL_DMA_EN or ICH6_RBCTL_IRQ_EN |
||
1523 | mov edx, ICH6_REG_RIRBCTL |
||
1524 | call azx_writeb |
||
3083 | leency | 1525 | |
5048 | Asper | 1526 | popa |
1527 | spin_unlock_irq |
||
1528 | ret |
||
3083 | leency | 1529 | endp |
1530 | |||
5048 | Asper | 1531 | proc azx_free_cmd_io |
1532 | spin_lock_irq |
||
1533 | push eax edx |
||
1534 | ; disable ringbuffer DMAs |
||
1535 | xor al, al |
||
1536 | mov edx, ICH6_REG_RIRBCTL |
||
1537 | call azx_writeb |
||
1538 | mov edx, ICH6_REG_CORBCTL |
||
1539 | call azx_writeb |
||
1540 | pop edx eax |
||
1541 | spin_unlock_irq |
||
1542 | ret |
||
3083 | leency | 1543 | endp |
1544 | |||
1545 | |||
1546 | ; send a command |
||
5048 | Asper | 1547 | proc azx_corb_send_cmd stdcall, val:dword |
1548 | spin_lock_irq |
||
1549 | push edx edi |
||
1550 | xor eax, eax |
||
1551 | ; add command to corb |
||
1552 | mov edx, ICH6_REG_CORBWP |
||
1553 | call azx_readb |
||
1554 | inc al |
||
1555 | inc dword [ctrl.rirb_cmd] |
||
1556 | mov edi, dword [ctrl.rb] |
||
3083 | leency | 1557 | |
5048 | Asper | 1558 | push eax |
1559 | shl eax, 2 ;wp=wp*sizeof(corb entry)=wp*4 |
||
1560 | add edi, eax |
||
1561 | mov eax, dword [val] |
||
1562 | stosd |
||
1563 | pop eax |
||
1564 | mov edx, ICH6_REG_CORBWP |
||
1565 | call azx_writel |
||
3083 | leency | 1566 | |
5048 | Asper | 1567 | pop edi edx |
1568 | xor eax, eax ;Asper+ |
||
1569 | spin_unlock_irq |
||
1570 | ret |
||
3083 | leency | 1571 | endp |
1572 | |||
1573 | |||
1574 | ; retrieve RIRB entry - called from interrupt handler |
||
5048 | Asper | 1575 | proc azx_update_rirb |
1576 | pusha |
||
1577 | xor eax, eax |
||
1578 | mov edx, ICH6_REG_RIRBWP |
||
1579 | call azx_readb ;call azx_readw |
||
3083 | leency | 1580 | |
5048 | Asper | 1581 | cmp ax, [ctrl.rirb_wp] |
1582 | je .done |
||
1583 | mov [ctrl.rirb_wp], ax |
||
1584 | mov bx, [ctrl.rirb_rp] |
||
3083 | leency | 1585 | |
5048 | Asper | 1586 | .l1: |
1587 | cmp bx, [ctrl.rirb_wp] |
||
1588 | je .l3 |
||
3083 | leency | 1589 | |
5048 | Asper | 1590 | inc bl |
1591 | .l2: |
||
1592 | cmp bx, ICH6_MAX_RIRB_ENTRIES |
||
1593 | jl @f |
||
1594 | sub bx, ICH6_MAX_RIRB_ENTRIES |
||
1595 | jmp .l2 |
||
1596 | @@: |
||
3083 | leency | 1597 | |
5048 | Asper | 1598 | movzx edx, bx |
1599 | shl edx, 1 + 2 ; an RIRB entry is 8-bytes |
||
1600 | mov esi, dword [ctrl.rb] |
||
1601 | add esi, 2048 |
||
1602 | add esi, edx |
||
1603 | lodsd ; res |
||
1604 | mov edx, eax |
||
1605 | lodsd ; res_ex |
||
3083 | leency | 1606 | |
5048 | Asper | 1607 | test eax, ICH6_RIRB_EX_UNSOL_EV |
1608 | jz @f |
||
1609 | stdcall snd_hda_queue_unsol_event, edx, eax |
||
1610 | jmp .l1 |
||
1611 | @@: |
||
1612 | mov ecx, [ctrl.rirb_cmd] |
||
1613 | test ecx, ecx |
||
1614 | jz @f |
||
1615 | mov [ctrl.rirb_res], edx |
||
1616 | dec dword [ctrl.rirb_cmd] |
||
1617 | jmp .l1 |
||
1618 | @@: |
||
1619 | if DEBUG |
||
1620 | push esi |
||
1621 | mov esi, msgSpuriousResponce |
||
1622 | invoke SysMsgBoardStr |
||
1623 | pop esi |
||
1624 | end if |
||
1625 | jmp .l1 |
||
1626 | .l3: |
||
1627 | mov [ctrl.rirb_rp], bx |
||
1628 | .done: |
||
1629 | popa |
||
1630 | ret |
||
3083 | leency | 1631 | endp |
1632 | |||
1633 | ; receive a response |
||
5048 | Asper | 1634 | proc azx_rirb_get_response |
1635 | locals |
||
1636 | do_poll db 0 |
||
1637 | endl |
||
3083 | leency | 1638 | |
5048 | Asper | 1639 | push ebx ecx edx |
1640 | .again: |
||
1641 | mov ecx, 1000;+1000 |
||
1642 | .next_try: |
||
1643 | mov al, [ctrl.polling_mode] |
||
1644 | test al, al |
||
1645 | jnz .poll |
||
1646 | mov ah, [do_poll] |
||
1647 | test ah, ah |
||
1648 | jz @f |
||
1649 | .poll: |
||
1650 | spin_lock_irq |
||
1651 | call azx_update_rirb |
||
1652 | spin_unlock_irq |
||
1653 | @@: |
||
1654 | mov eax, [ctrl.rirb_cmd] |
||
1655 | test eax, eax |
||
1656 | jnz .l1 |
||
1657 | mov [ctrl.rirb_error], 0 |
||
1658 | mov al, [do_poll] |
||
1659 | test al, al |
||
1660 | jnz @f |
||
1661 | mov [ctrl.poll_count], 0 |
||
1662 | @@: |
||
1663 | mov eax, [ctrl.rirb_res] ; the last value |
||
1664 | jmp .out |
||
1665 | .l1: |
||
1666 | push eax |
||
1667 | mov eax, 2000 ; temporary workaround |
||
1668 | call StallExec |
||
1669 | pop eax |
||
1670 | dec ecx |
||
1671 | jnz .next_try |
||
1672 | .no_next_try: |
||
1673 | mov al, [ctrl.polling_mode] |
||
1674 | test al, al |
||
1675 | jnz .no_poll |
||
3083 | leency | 1676 | |
5048 | Asper | 1677 | mov al, [ctrl.poll_count] |
1678 | cmp al, 2 |
||
1679 | jge .poll_count_overflow |
||
1680 | if DEBUG |
||
1681 | push eax esi |
||
1682 | mov esi, msgGetResponceTimeout |
||
1683 | invoke SysMsgBoardStr |
||
1684 | mov esi, msgPollingCodecOnce |
||
1685 | invoke SysMsgBoardStr |
||
1686 | pop esi eax |
||
1687 | end if |
||
1688 | mov [do_poll], 1 |
||
1689 | inc [ctrl.poll_count] |
||
1690 | jmp .again |
||
3083 | leency | 1691 | |
5048 | Asper | 1692 | .poll_count_overflow: |
1693 | if DEBUG |
||
1694 | push eax esi |
||
1695 | mov esi, msgGetResponceTimeout |
||
1696 | invoke SysMsgBoardStr |
||
1697 | mov esi, msgSwitchToPollMode |
||
1698 | invoke SysMsgBoardStr |
||
1699 | pop esi eax |
||
1700 | end if |
||
1701 | mov [ctrl.polling_mode], 1 |
||
1702 | jmp .again |
||
3083 | leency | 1703 | |
5048 | Asper | 1704 | .no_poll: |
3083 | leency | 1705 | |
5048 | Asper | 1706 | mov al, [ctrl.polling_mode] |
1707 | test al, al |
||
1708 | jz @f |
||
1709 | mov eax, -1 |
||
1710 | jmp .out |
||
1711 | @@: |
||
3083 | leency | 1712 | |
5048 | Asper | 1713 | ; a fatal communication error; need either to reset or to fallback |
1714 | ; to the single_cmd mode |
||
1715 | mov [ctrl.rirb_error], 1 |
||
1716 | ;Asper~ -? [ |
||
1717 | mov [ctrl.response_reset], 1 |
||
1718 | mov eax, -1 ; give a chance to retry |
||
1719 | jmp .out |
||
1720 | ;Asper~ -? ] |
||
3083 | leency | 1721 | |
5048 | Asper | 1722 | ;-? mov [ctrl.single_cmd], 1 |
1723 | mov [ctrl.response_reset], 0 |
||
3083 | leency | 1724 | |
5048 | Asper | 1725 | ; release CORB/RIRB |
1726 | call azx_free_cmd_io |
||
1727 | ; disable unsolicited responses |
||
1728 | mov edx, ICH6_REG_GCTL |
||
1729 | call azx_readl |
||
1730 | mov ebx, ICH6_GCTL_UNSOL |
||
1731 | xor ebx, -1 |
||
1732 | and eax, ebx |
||
1733 | mov edx, ICH6_REG_GCTL |
||
1734 | call azx_writel |
||
1735 | mov eax, -1 |
||
1736 | .out: |
||
1737 | pop edx ecx ebx |
||
1738 | ret |
||
3083 | leency | 1739 | endp |
1740 | |||
1741 | ; |
||
1742 | ; Use the single immediate command instead of CORB/RIRB for simplicity |
||
1743 | ; |
||
1744 | ; Note: according to Intel, this is not preferred use. The command was |
||
1745 | ; intended for the BIOS only, and may get confused with unsolicited |
||
1746 | ; responses. So, we shouldn't use it for normal operation from the |
||
1747 | ; driver. |
||
1748 | ; I left the codes, however, for debugging/testing purposes. |
||
1749 | ; |
||
1750 | |||
1751 | ; receive a response |
||
5048 | Asper | 1752 | proc azx_single_wait_for_response |
1753 | push ecx edx esi |
||
3083 | leency | 1754 | |
5048 | Asper | 1755 | mov ecx, 50 |
1756 | .l1: |
||
1757 | test ecx, ecx |
||
1758 | jz .timeout |
||
3083 | leency | 1759 | |
1760 | ; check IRV busy bit |
||
5048 | Asper | 1761 | mov edx, ICH6_REG_IRS |
1762 | call azx_readw |
||
1763 | test ax, ICH6_IRS_VALID |
||
1764 | jz @f |
||
3083 | leency | 1765 | ; reuse rirb.res as the response return value |
5048 | Asper | 1766 | mov edx, ICH6_REG_IR |
1767 | call azx_readl |
||
1768 | mov [ctrl.rirb_res], eax |
||
3083 | leency | 1769 | |
5048 | Asper | 1770 | pop esi edx ecx |
1771 | xor eax, eax |
||
3083 | leency | 1772 | ret |
5048 | Asper | 1773 | @@: |
1774 | xor eax, eax |
||
1775 | inc eax |
||
1776 | call StallExec |
||
3083 | leency | 1777 | |
5048 | Asper | 1778 | dec ecx |
1779 | jmp .l1 |
||
1780 | .timeout: |
||
1781 | if DEBUG |
||
1782 | xor eax, eax |
||
1783 | mov edx, ICH6_REG_IRS |
||
1784 | call azx_readw |
||
1785 | mov esi, msgGetResponceTimeout |
||
1786 | invoke SysMsgBoardStr |
||
1787 | mov esi, msgIRS |
||
1788 | invoke SysMsgBoardStr |
||
1789 | stdcall fdword2str, 2 |
||
1790 | invoke SysMsgBoardStr |
||
1791 | end if |
||
3083 | leency | 1792 | |
5048 | Asper | 1793 | pop esi edx ecx |
1794 | mov eax, -1 |
||
1795 | mov [ctrl.rirb_res], eax |
||
3083 | leency | 1796 | ret |
1797 | endp |
||
1798 | |||
1799 | ; send a command |
||
5048 | Asper | 1800 | proc azx_single_send_cmd stdcall, val:dword |
3083 | leency | 1801 | push ecx edx esi |
1802 | |||
1803 | mov ecx, 50 |
||
5048 | Asper | 1804 | .l1: |
3083 | leency | 1805 | test ecx, ecx |
1806 | jz .timeout |
||
1807 | |||
1808 | ; check ICB busy bit |
||
5048 | Asper | 1809 | mov edx, ICH6_REG_IRS |
1810 | call azx_readw |
||
1811 | test ax, ICH6_IRS_BUSY |
||
1812 | jnz @f |
||
3083 | leency | 1813 | ; Clear IRV valid bit |
5048 | Asper | 1814 | mov edx, ICH6_REG_IRS |
1815 | call azx_readw |
||
1816 | or ax, ICH6_IRS_VALID |
||
1817 | mov edx, ICH6_REG_IRS |
||
1818 | call azx_writew |
||
3083 | leency | 1819 | |
5048 | Asper | 1820 | mov eax, dword [val] |
1821 | mov edx, ICH6_REG_IC |
||
1822 | call azx_writel |
||
3083 | leency | 1823 | |
5048 | Asper | 1824 | mov edx, ICH6_REG_IRS |
1825 | call azx_readw |
||
1826 | or ax, ICH6_IRS_BUSY |
||
1827 | mov edx, ICH6_REG_IRS |
||
1828 | call azx_writew |
||
3083 | leency | 1829 | |
1830 | stdcall azx_single_wait_for_response |
||
5048 | Asper | 1831 | pop esi edx ecx |
3083 | leency | 1832 | ret |
5048 | Asper | 1833 | @@: |
3083 | leency | 1834 | dec ecx |
1835 | jmp .l1 |
||
5048 | Asper | 1836 | .timeout: |
1837 | if DEBUG |
||
1838 | xor eax, eax |
||
1839 | mov edx, ICH6_REG_IRS |
||
1840 | call azx_readw |
||
1841 | mov esi, msgSendCmdTimeout |
||
1842 | invoke SysMsgBoardStr |
||
1843 | stdcall fdword2str, 2 |
||
1844 | invoke SysMsgBoardStr |
||
1845 | mov esi, msgVal |
||
1846 | invoke SysMsgBoardStr |
||
1847 | mov eax, dword [val] |
||
1848 | stdcall fdword2str, 2 |
||
1849 | invoke SysMsgBoardStr |
||
1850 | end if |
||
3083 | leency | 1851 | |
5048 | Asper | 1852 | pop esi edx ecx |
1853 | mov eax, -1 |
||
3083 | leency | 1854 | ret |
1855 | endp |
||
1856 | |||
1857 | ; receive a response |
||
5048 | Asper | 1858 | proc azx_single_get_response |
1859 | mov eax, [ctrl.rirb_res] |
||
3083 | leency | 1860 | ret |
1861 | endp |
||
1862 | |||
1863 | ; |
||
1864 | ; The below are the main callbacks from hda_codec. |
||
1865 | ; |
||
1866 | ; They are just the skeleton to call sub-callbacks according to the |
||
1867 | ; current setting of chip->single_cmd. |
||
1868 | ; |
||
1869 | |||
1870 | ; send a command |
||
5048 | Asper | 1871 | proc azx_send_cmd stdcall, val:dword |
1872 | if USE_SINGLE_MODE |
||
1873 | stdcall azx_single_send_cmd, [val] |
||
1874 | else |
||
1875 | stdcall azx_corb_send_cmd, [val] |
||
1876 | end if |
||
1877 | ret |
||
3083 | leency | 1878 | endp |
1879 | |||
1880 | ; get a response |
||
5048 | Asper | 1881 | proc azx_get_response |
1882 | if USE_SINGLE_MODE |
||
1883 | call azx_single_get_response |
||
1884 | else |
||
1885 | call azx_rirb_get_response |
||
1886 | end if |
||
1887 | ret |
||
3083 | leency | 1888 | endp |
1889 | |||
1890 | |||
1891 | ;;;;;;;;;;;;;;;;;;;;;;;; |
||
1892 | ;; Lowlevel interface ;; |
||
1893 | ;;;;;;;;;;;;;;;;;;;;;;;; |
||
1894 | |||
1895 | ; enable interrupts |
||
5048 | Asper | 1896 | proc azx_int_enable |
1897 | push eax edx |
||
1898 | ; enable controller CIE and GIE |
||
1899 | mov edx, ICH6_REG_INTCTL |
||
1900 | call azx_readl |
||
1901 | or eax, ICH6_INT_CTRL_EN or ICH6_INT_GLOBAL_EN |
||
1902 | mov edx, ICH6_REG_INTCTL |
||
1903 | call azx_writel |
||
1904 | pop edx eax |
||
1905 | ret |
||
3083 | leency | 1906 | endp |
1907 | |||
1908 | ; disable interrupts |
||
5048 | Asper | 1909 | proc azx_int_disable |
1910 | push eax ebx edx |
||
3083 | leency | 1911 | |
5048 | Asper | 1912 | ; disable interrupts in stream descriptor |
1913 | mov edx, ICH6_REG_SD_CTL + SDO_OFS |
||
1914 | call azx_readb |
||
1915 | mov bl, SD_INT_MASK |
||
1916 | xor bl, -1 |
||
1917 | and al, bl |
||
1918 | mov edx, ICH6_REG_SD_CTL + SDO_OFS |
||
1919 | call azx_writeb |
||
3083 | leency | 1920 | |
5048 | Asper | 1921 | ; disable SIE for all streams |
1922 | xor al, al |
||
1923 | mov edx, ICH6_REG_INTCTL |
||
1924 | call azx_writeb |
||
3083 | leency | 1925 | |
5048 | Asper | 1926 | ; disable controller CIE and GIE |
1927 | mov edx, ICH6_REG_INTCTL |
||
1928 | call azx_readl |
||
1929 | mov ebx, ICH6_INT_CTRL_EN or ICH6_INT_GLOBAL_EN |
||
1930 | xor ebx, -1 |
||
1931 | and eax, ebx |
||
1932 | call azx_writel |
||
1933 | pop edx ebx eax |
||
1934 | ret |
||
3083 | leency | 1935 | endp |
1936 | |||
1937 | ; clear interrupts |
||
5048 | Asper | 1938 | proc azx_int_clear |
1939 | push eax edx |
||
3083 | leency | 1940 | |
5048 | Asper | 1941 | ; clear stream status |
1942 | mov al, SD_INT_MASK |
||
1943 | mov edx, ICH6_REG_SD_STS + SDO_OFS |
||
1944 | call azx_writeb |
||
3083 | leency | 1945 | |
5048 | Asper | 1946 | ; clear STATESTS |
1947 | mov al, STATESTS_INT_MASK |
||
1948 | mov edx, ICH6_REG_STATESTS |
||
1949 | call azx_writeb |
||
3083 | leency | 1950 | |
5048 | Asper | 1951 | ; clear rirb status |
1952 | mov al, RIRB_INT_MASK |
||
1953 | mov edx, ICH6_REG_RIRBSTS |
||
1954 | call azx_writeb |
||
3083 | leency | 1955 | |
5048 | Asper | 1956 | ; clear int status |
1957 | mov eax, ICH6_INT_CTRL_EN or ICH6_INT_ALL_STREAM |
||
1958 | mov edx, ICH6_REG_INTSTS |
||
1959 | call azx_writel |
||
1960 | pop edx eax |
||
1961 | ret |
||
3083 | leency | 1962 | endp |
1963 | |||
1964 | |||
1965 | ; start a stream |
||
5048 | Asper | 1966 | proc azx_stream_start |
1967 | push eax edx |
||
3083 | leency | 1968 | |
5048 | Asper | 1969 | ; enable SIE |
1970 | mov edx, ICH6_REG_INTCTL |
||
1971 | call azx_readl |
||
3083 | leency | 1972 | |
5048 | Asper | 1973 | or eax, 0xC0000000 ;Asper+ |
1974 | or eax, SDO_INT ; Asper: output stream interrupt index |
||
1975 | mov edx, ICH6_REG_INTCTL |
||
1976 | call azx_writel |
||
1977 | ; set DMA start and interrupt mask |
||
1978 | mov edx, ICH6_REG_SD_CTL + SDO_OFS |
||
1979 | call azx_readb |
||
3083 | leency | 1980 | |
5048 | Asper | 1981 | or al, SD_CTL_DMA_START or SD_INT_MASK |
3083 | leency | 1982 | |
5048 | Asper | 1983 | mov edx, ICH6_REG_SD_CTL + SDO_OFS |
1984 | call azx_writeb |
||
3083 | leency | 1985 | |
5048 | Asper | 1986 | pop edx eax |
1987 | ret |
||
3083 | leency | 1988 | endp |
1989 | |||
1990 | ; stop DMA |
||
5048 | Asper | 1991 | proc azx_stream_clear |
1992 | push eax ebx edx |
||
1993 | mov edx, ICH6_REG_SD_CTL + SDO_OFS |
||
1994 | call azx_readb |
||
1995 | mov bl, SD_CTL_DMA_START or SD_INT_MASK |
||
1996 | xor bl, -1 |
||
1997 | and al, bl |
||
1998 | mov edx, ICH6_REG_SD_CTL + SDO_OFS |
||
1999 | call azx_writeb |
||
2000 | mov al, SD_INT_MASK |
||
2001 | mov edx, ICH6_REG_SD_STS + SDO_OFS |
||
2002 | call azx_writeb |
||
2003 | pop edx ebx eax |
||
2004 | ret |
||
3083 | leency | 2005 | endp |
2006 | |||
2007 | ; stop a stream |
||
5048 | Asper | 2008 | proc azx_stream_stop |
2009 | push eax ebx edx |
||
2010 | call azx_stream_clear |
||
2011 | ; disable SIE |
||
2012 | mov edx, ICH6_REG_INTCTL |
||
2013 | call azx_readl |
||
2014 | mov ebx, (SDO_INT) |
||
2015 | xor ebx, -1 |
||
2016 | and eax, ebx |
||
2017 | mov edx, ICH6_REG_INTCTL |
||
2018 | call azx_writel |
||
2019 | pop edx ebx eax |
||
2020 | ret |
||
3083 | leency | 2021 | endp |
2022 | |||
2023 | ; |
||
2024 | ;in: eax = full_reset |
||
2025 | ; |
||
2026 | ; initialize the chip |
||
5048 | Asper | 2027 | proc azx_init_chip |
2028 | push eax |
||
3083 | leency | 2029 | |
5048 | Asper | 2030 | ; reset controller |
2031 | mov eax, 1 ;full reset |
||
2032 | call reset_controller |
||
3083 | leency | 2033 | |
5048 | Asper | 2034 | ; initialize interrupts |
2035 | call azx_int_clear |
||
2036 | call azx_int_enable |
||
3083 | leency | 2037 | |
5048 | Asper | 2038 | ; initialize the codec command I/O |
2039 | if USE_SINGLE_MODE |
||
2040 | else |
||
2041 | call azx_init_cmd_io |
||
2042 | end if |
||
3083 | leency | 2043 | |
5048 | Asper | 2044 | ; program the position buffer |
2045 | mov eax, dword [ctrl.posbuf] |
||
2046 | mov ebx, eax |
||
2047 | invoke GetPgAddr |
||
2048 | and ebx, 0xFFF |
||
2049 | add eax, ebx |
||
2050 | mov edx, ICH6_REG_DPLBASE |
||
2051 | call azx_writel |
||
2052 | xor eax, eax |
||
2053 | mov edx, ICH6_REG_DPUBASE |
||
2054 | call azx_writel |
||
3083 | leency | 2055 | |
5048 | Asper | 2056 | pop eax |
2057 | ret |
||
3083 | leency | 2058 | endp |
2059 | |||
2060 | |||
2061 | ; initialize the PCI registers |
||
2062 | |||
2063 | ; update bits in a PCI register byte |
||
5048 | Asper | 2064 | proc update_pci_byte stdcall, reg:dword, mask:dword, val:dword |
2065 | push ax bx |
||
2066 | invoke PciRead8, [ctrl.bus], [ctrl.devfn], [reg] |
||
2067 | mov bl, byte [mask] |
||
2068 | mov bh, bl |
||
2069 | xor bl, -1 |
||
2070 | and al, bl |
||
2071 | shr bx, 8 |
||
2072 | and bl, byte [val] |
||
2073 | or al, bl |
||
2074 | invoke PciWrite8, [ctrl.bus], [ctrl.devfn], [reg], eax |
||
2075 | pop bx ax |
||
2076 | ret |
||
3083 | leency | 2077 | endp |
2078 | |||
2079 | |||
5048 | Asper | 2080 | proc azx_init_pci |
2081 | ; Clear bits 0-2 of PCI register TCSEL (at offset 0x44) |
||
2082 | ; TCSEL == Traffic Class Select Register, which sets PCI express QOS |
||
2083 | ; Ensuring these bits are 0 clears playback static on some HD Audio |
||
2084 | ; codecs |
||
2085 | push eax |
||
2086 | stdcall update_pci_byte, ICH6_PCIREG_TCSEL, 0x07, 0 |
||
3083 | leency | 2087 | |
5048 | Asper | 2088 | mov eax, [driver_type] |
2089 | cmp eax, AZX_DRIVER_ATI |
||
2090 | jne @f |
||
2091 | ; For ATI SB450 azalia HD audio, we need to enable snoop |
||
2092 | stdcall update_pci_byte, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, 0x07, ATI_SB450_HDAUDIO_ENABLE_SNOOP |
||
2093 | jmp .done |
||
2094 | @@: |
||
2095 | cmp eax, AZX_DRIVER_NVIDIA |
||
2096 | jne @f |
||
2097 | ; For NVIDIA HDA, enable snoop |
||
2098 | stdcall update_pci_byte, NVIDIA_HDA_TRANSREG_ADDR, 0x0f, NVIDIA_HDA_ENABLE_COHBITS |
||
2099 | stdcall update_pci_byte, NVIDIA_HDA_ISTRM_COH, 0x01, NVIDIA_HDA_ENABLE_COHBIT |
||
2100 | stdcall update_pci_byte, NVIDIA_HDA_OSTRM_COH, 0x01, NVIDIA_HDA_ENABLE_COHBIT |
||
2101 | jmp .done |
||
2102 | @@: |
||
2103 | cmp eax, AZX_DRIVER_SCH |
||
2104 | je .l1 |
||
2105 | cmp eax, AZX_DRIVER_PCH |
||
2106 | jne @f |
||
2107 | .l1: |
||
2108 | invoke PciRead16, [ctrl.bus], [ctrl.devfn], dword INTEL_SCH_HDA_DEVC |
||
2109 | test ax, INTEL_SCH_HDA_DEVC_NOSNOOP |
||
2110 | jz @f |
||
2111 | push ebx |
||
2112 | mov ebx, INTEL_SCH_HDA_DEVC_NOSNOOP |
||
2113 | xor ebx, -1 |
||
2114 | and eax, ebx |
||
2115 | pop ebx |
||
2116 | invoke PciWrite16, [ctrl.bus], [ctrl.devfn], dword INTEL_SCH_HDA_DEVC, eax |
||
2117 | invoke PciRead16, [ctrl.bus], [ctrl.devfn], dword INTEL_SCH_HDA_DEVC |
||
3083 | leency | 2118 | |
5048 | Asper | 2119 | if DEBUG |
2120 | push esi |
||
2121 | mov esi, msgHDASnoopDisabled |
||
2122 | invoke SysMsgBoardStr |
||
2123 | mov esi, msg_OK |
||
2124 | test ax, INTEL_SCH_HDA_DEVC_NOSNOOP |
||
2125 | jz .snoop_ok |
||
2126 | mov esi, msg_Fail |
||
2127 | .snoop_ok: |
||
2128 | invoke SysMsgBoardStr |
||
2129 | pop esi |
||
2130 | end if |
||
2131 | @@: |
||
2132 | .done: |
||
2133 | pop eax |
||
2134 | ret |
||
3083 | leency | 2135 | endp |
2136 | |||
2137 | |||
2138 | ; reset stream |
||
5048 | Asper | 2139 | proc azx_stream_reset |
2140 | push eax ebx ecx edx |
||
3083 | leency | 2141 | |
5048 | Asper | 2142 | call azx_stream_clear |
3083 | leency | 2143 | |
5048 | Asper | 2144 | mov edx, ICH6_REG_SD_CTL + SDO_OFS |
2145 | call azx_readb |
||
2146 | or al, SD_CTL_STREAM_RESET |
||
2147 | mov edx, ICH6_REG_SD_CTL + SDO_OFS |
||
2148 | call azx_writeb |
||
3083 | leency | 2149 | |
5048 | Asper | 2150 | mov eax, 3 |
2151 | call StallExec |
||
3083 | leency | 2152 | |
5048 | Asper | 2153 | mov ecx, 300 |
2154 | .l1: |
||
2155 | mov edx, ICH6_REG_SD_CTL + SDO_OFS |
||
2156 | call azx_readb |
||
2157 | test al, SD_CTL_STREAM_RESET |
||
2158 | jnz @f |
||
2159 | dec ecx |
||
2160 | jnz .l1 |
||
2161 | @@: |
||
2162 | mov bl, SD_CTL_STREAM_RESET |
||
2163 | xor bl, -1 |
||
2164 | and al, bl |
||
2165 | mov edx, ICH6_REG_SD_CTL + SDO_OFS |
||
2166 | call azx_writeb |
||
3083 | leency | 2167 | |
5048 | Asper | 2168 | mov eax, 3 |
2169 | call StallExec |
||
3083 | leency | 2170 | |
5048 | Asper | 2171 | mov ecx, 300 |
2172 | ; waiting for hardware to report that the stream is out of reset |
||
2173 | .l2: |
||
2174 | mov edx, ICH6_REG_SD_CTL + SDO_OFS |
||
2175 | call azx_readb |
||
2176 | test al, SD_CTL_STREAM_RESET |
||
2177 | jnz @f |
||
2178 | dec ecx |
||
2179 | jnz .l2 |
||
2180 | @@: |
||
2181 | ; reset first position - may not be synced with hw at this time |
||
2182 | mov edx, [ctrl.posbuf] |
||
2183 | mov dword [edx], 0 |
||
2184 | pop edx ecx ebx eax |
||
2185 | ret |
||
3083 | leency | 2186 | endp |
2187 | |||
2188 | |||
2189 | ; set up the SD for streaming |
||
2190 | proc azx_setup_controller |
||
5048 | Asper | 2191 | push eax ebx ecx edx |
2192 | ; make sure the run bit is zero for SD |
||
2193 | call azx_stream_clear |
||
3083 | leency | 2194 | |
5048 | Asper | 2195 | ; program the stream_tag |
2196 | mov edx, ICH6_REG_SD_CTL + SDO_OFS |
||
2197 | call azx_readl |
||
2198 | mov ecx, SD_CTL_STREAM_TAG_MASK |
||
2199 | xor ecx, -1 |
||
2200 | and eax, ecx |
||
2201 | mov ecx, SDO_TAG |
||
2202 | shl ecx, SD_CTL_STREAM_TAG_SHIFT |
||
2203 | or eax, ecx |
||
2204 | ; Asper stream_tag = SDO_TAG |
||
2205 | mov edx, ICH6_REG_SD_CTL + SDO_OFS |
||
2206 | call azx_writel |
||
3083 | leency | 2207 | |
5048 | Asper | 2208 | ; program the length of samples in cyclic buffer |
2209 | mov eax, 0x4000*32 |
||
2210 | mov edx, ICH6_REG_SD_CBL + SDO_OFS |
||
2211 | call azx_writel |
||
3083 | leency | 2212 | |
5048 | Asper | 2213 | ; program the stream format |
2214 | ; this value needs to be the same as the one programmed |
||
2215 | mov ax, 0x11 |
||
2216 | mov edx, ICH6_REG_SD_FORMAT + SDO_OFS |
||
2217 | call azx_writew |
||
3083 | leency | 2218 | |
5048 | Asper | 2219 | ; program the stream LVI (last valid index) of the BDL |
2220 | mov eax, 32-1 ;4-1 ;2-1 |
||
2221 | mov [ctrl.lvi_reg], eax |
||
2222 | mov edx, ICH6_REG_SD_LVI + SDO_OFS |
||
2223 | call azx_writew |
||
3083 | leency | 2224 | |
5048 | Asper | 2225 | ; program the BDL address |
2226 | ; lower BDL address |
||
2227 | mov eax, [pcmout_bdl] |
||
2228 | mov ebx, eax |
||
2229 | invoke GetPgAddr |
||
2230 | and ebx, 0xFFF |
||
2231 | add eax, ebx |
||
2232 | mov edx, ICH6_REG_SD_BDLPL + SDO_OFS |
||
2233 | call azx_writel |
||
2234 | ; upper BDL address |
||
2235 | xor eax, eax ;upper_32bit(azx_dev->bdl_addr) |
||
2236 | mov edx, ICH6_REG_SD_BDLPU + SDO_OFS |
||
2237 | call azx_writel |
||
3083 | leency | 2238 | |
5048 | Asper | 2239 | ; enable the position buffer |
2240 | cmp [ctrl.position_fix], POS_FIX_LPIB |
||
2241 | jz @f |
||
2242 | mov edx, ICH6_REG_DPLBASE |
||
2243 | call azx_readl |
||
2244 | and eax, ICH6_DPLBASE_ENABLE |
||
2245 | jnz @f |
||
2246 | mov eax, dword [ctrl.posbuf] |
||
2247 | mov ebx, eax |
||
2248 | invoke GetPgAddr |
||
2249 | and ebx, 0xFFF |
||
2250 | add eax, ebx |
||
2251 | or eax, ICH6_DPLBASE_ENABLE |
||
2252 | mov edx, ICH6_REG_DPLBASE |
||
2253 | call azx_writel |
||
2254 | @@: |
||
2255 | ; set the interrupt enable bits in the descriptor control register |
||
2256 | mov edx, ICH6_REG_SD_CTL + SDO_OFS |
||
2257 | call azx_readl |
||
2258 | or eax, SD_INT_MASK |
||
2259 | mov edx, ICH6_REG_SD_CTL + SDO_OFS |
||
2260 | call azx_writel |
||
3083 | leency | 2261 | |
5048 | Asper | 2262 | pop edx ecx ebx eax |
2263 | ret |
||
3083 | leency | 2264 | endp |
2265 | |||
2266 | |||
2267 | ;(...) |
||
2268 | |||
2269 | ; Probe the given codec address |
||
2270 | proc probe_codec, addr:dword |
||
5048 | Asper | 2271 | push edx |
2272 | mov eax, [addr] |
||
2273 | shl eax, 28 |
||
2274 | mov edx, (AC_NODE_ROOT shl 20) or (AC_VERB_PARAMETERS shl 8) or AC_PAR_VENDOR_ID |
||
2275 | or eax, edx |
||
2276 | stdcall azx_send_cmd, eax |
||
2277 | stdcall azx_get_response |
||
3083 | leency | 2278 | |
5048 | Asper | 2279 | cmp eax, -1 |
2280 | je .out |
||
2281 | mov eax, [addr] |
||
2282 | mov [codec.addr], eax ;Asper+ |
||
2283 | if DEBUG |
||
2284 | push esi |
||
2285 | mov esi, msgCodecOK |
||
2286 | invoke SysMsgBoardStr |
||
2287 | mov esi, msgCAd |
||
2288 | invoke SysMsgBoardStr |
||
2289 | stdcall fdword2str, 3 |
||
2290 | invoke SysMsgBoardStr |
||
2291 | pop esi |
||
2292 | end if |
||
2293 | xor eax, eax |
||
2294 | .out: |
||
2295 | pop edx |
||
2296 | ret |
||
3083 | leency | 2297 | endp |
2298 | |||
2299 | |||
2300 | proc azx_bus_reset |
||
5048 | Asper | 2301 | call azx_stop_chip |
2302 | call azx_init_chip |
||
3083 | leency | 2303 | endp |
2304 | |||
2305 | |||
2306 | ; Codec initialization |
||
5048 | Asper | 2307 | proc azx_codec_create |
2308 | push ebx ecx edx |
||
2309 | ;(...) |
||
3083 | leency | 2310 | ; First try to probe all given codec slots |
2311 | ; Asper: We asume for now that max slots for codecs = 4 |
||
5048 | Asper | 2312 | xor ecx, ecx |
2313 | xor edx, edx |
||
2314 | inc edx |
||
2315 | .next_slot: |
||
2316 | test edx, [ctrl.codec_mask] |
||
2317 | jz @f |
||
2318 | stdcall probe_codec, ecx |
||
2319 | test eax, eax |
||
2320 | jz .init ;@f |
||
2321 | ; Some BIOSen give you wrong codec addresses that don't exist |
||
2322 | if DEBUG |
||
2323 | mov esi, msgCodecError |
||
2324 | invoke SysMsgBoardStr |
||
2325 | end if |
||
2326 | mov ebx, edx |
||
2327 | xor ebx, -1 |
||
2328 | and [ctrl.codec_mask], ebx |
||
3083 | leency | 2329 | |
5048 | Asper | 2330 | ; More badly, accessing to a non-existing |
2331 | ; codec often screws up the controller chip, |
||
2332 | ; and disturbs the further communications. |
||
2333 | ; Thus if an error occurs during probing, |
||
2334 | ; better to reset the controller chip to |
||
2335 | ; get back to the sanity state. |
||
2336 | ;call azx_bus_reset |
||
2337 | @@: |
||
2338 | shl edx, 1 |
||
2339 | inc ecx |
||
2340 | ;if USE_FIRST_CODEC |
||
2341 | ; cmp ecx, 1 |
||
2342 | ;else |
||
2343 | cmp ecx, 4 |
||
2344 | ;end if |
||
2345 | jl .next_slot |
||
2346 | mov eax, -1 |
||
2347 | jmp .out |
||
2348 | .init: |
||
2349 | push ecx edx |
||
2350 | stdcall snd_hda_codec_init |
||
2351 | pop edx ecx |
||
2352 | test eax, eax |
||
2353 | jnz @b |
||
2354 | .out: |
||
2355 | pop edx ecx ebx |
||
2356 | ret |
||
3083 | leency | 2357 | endp |
2358 | |||
2359 | |||
5048 | Asper | 2360 | proc azx_codec_configure |
2361 | ;(...) |
||
2362 | call snd_hda_codec_configure |
||
2363 | ret |
||
3083 | leency | 2364 | endp |
2365 | |||
2366 | |||
5048 | Asper | 2367 | proc azx_get_position |
2368 | test [ctrl.position_fix], POS_FIX_LPIB |
||
2369 | jz @f |
||
2370 | ; read LPIB |
||
2371 | mov edx, ICH6_REG_SD_LPIB + SDO_OFS |
||
2372 | call azx_readl |
||
2373 | jmp .out |
||
2374 | @@: |
||
2375 | test [ctrl.position_fix], POS_FIX_VIACOMBO |
||
2376 | jz @f |
||
2377 | ; call azx_get_via_position |
||
2378 | ; jmp .out |
||
2379 | @@: |
||
2380 | ; use the position buffer |
||
2381 | push edx |
||
2382 | mov edx, dword [ctrl.posbuf] |
||
2383 | mov eax, dword [edx] |
||
2384 | pop edx |
||
2385 | .out: |
||
2386 | cmp eax, 0x4000 ; bufsize |
||
2387 | jl @f |
||
2388 | xor eax, eax |
||
2389 | @@: |
||
2390 | ret |
||
3083 | leency | 2391 | endp |
2392 | |||
2393 | |||
5048 | Asper | 2394 | proc azx_stop_chip |
2395 | push eax edx |
||
3083 | leency | 2396 | |
5048 | Asper | 2397 | ; disable interrupts |
2398 | call azx_int_disable |
||
2399 | call azx_int_clear |
||
3083 | leency | 2400 | |
5048 | Asper | 2401 | ; disable CORB/RIRB |
2402 | call azx_free_cmd_io |
||
2403 | |||
2404 | ; disable position buffer |
||
2405 | xor eax, eax |
||
2406 | mov edx, ICH6_REG_DPLBASE |
||
2407 | call azx_writel |
||
2408 | mov edx, ICH6_REG_DPUBASE |
||
2409 | call azx_writel |
||
2410 | pop edx eax |
||
2411 | ret |
||
3083 | leency | 2412 | endp |
2413 | |||
2414 | |||
2415 | ; in: eax = volume (-10000 - 0) |
||
2416 | align 4 |
||
2417 | set_master_vol: |
||
5048 | Asper | 2418 | mov ecx, 3 |
2419 | call set_channel_volume |
||
2420 | ret |
||
3083 | leency | 2421 | |
2422 | |||
2423 | ; out: [pvol] = volume (-10000 - 0) |
||
2424 | align 4 |
||
2425 | proc get_master_vol stdcall, pvol:dword |
||
5048 | Asper | 2426 | xor ecx, ecx |
2427 | call get_channel_volume |
||
2428 | mov ebx, [pvol] |
||
2429 | mov [ebx], eax |
||
2430 | xor eax, eax |
||
2431 | ret |
||
3083 | leency | 2432 | endp |
2433 | |||
2434 | |||
2435 | ; in: ecx = channel mask (1 - Left; 2 - Right; 3-Both) |
||
2436 | ; eax = volume (-10000 - 0) |
||
2437 | align 4 |
||
2438 | set_channel_volume: |
||
5048 | Asper | 2439 | push eax ebx ecx edx |
2440 | mov ebx, [volume.maxDb] |
||
2441 | neg eax |
||
2442 | if DEBUG ;- |
||
2443 | push eax esi |
||
2444 | mov esi, msgNewVolume |
||
2445 | invoke SysMsgBoardStr |
||
2446 | stdcall fdword2str, 2 |
||
2447 | invoke SysMsgBoardStr |
||
3083 | leency | 2448 | |
5048 | Asper | 2449 | mov esi, msgMinVolume |
2450 | invoke SysMsgBoardStr |
||
2451 | mov eax, ebx |
||
2452 | stdcall fdword2str, 2 |
||
2453 | invoke SysMsgBoardStr |
||
2454 | pop esi eax |
||
2455 | end if |
||
2456 | test ebx, ebx |
||
2457 | jz .err_out |
||
3083 | leency | 2458 | |
5048 | Asper | 2459 | cmp eax, 0 |
2460 | jg @f |
||
2461 | xor eax, eax |
||
2462 | jmp .set |
||
2463 | @@: |
||
2464 | cmp eax, ebx |
||
2465 | jng .set |
||
2466 | mov eax, ebx |
||
2467 | .set: |
||
2468 | sub ebx, eax |
||
2469 | mov eax, ebx |
||
2470 | ;cdq |
||
2471 | xor edx, edx |
||
2472 | push eax |
||
2473 | movzx eax, [volume.step_size] |
||
2474 | imul eax, (100/4) |
||
2475 | mov ebx, eax |
||
2476 | pop eax |
||
2477 | xor edx, edx |
||
2478 | idiv ebx |
||
3083 | leency | 2479 | |
5048 | Asper | 2480 | mov edx, [volume.out_amp_node] |
2481 | test edx, edx |
||
2482 | jz .out |
||
2483 | movzx ebx, [edx+HDA_GNODE.nid] |
||
3083 | leency | 2484 | |
5048 | Asper | 2485 | test ecx, 1 ; Left channel ? |
2486 | jz @f |
||
2487 | stdcall put_volume_mute, ebx, 0, HDA_OUTPUT, 0, eax |
||
2488 | @@: |
||
2489 | test ecx, 2 ; Right channel ? |
||
2490 | jz .out |
||
2491 | stdcall put_volume_mute, ebx, 1, HDA_OUTPUT, 0, eax |
||
2492 | .out: |
||
2493 | pop edx ecx ebx eax |
||
2494 | ret |
||
2495 | .err_out: |
||
2496 | if DEBUG ;- |
||
2497 | push esi |
||
2498 | mov esi, emsgNoVolCtrl |
||
2499 | invoke SysMsgBoardStr |
||
2500 | pop esi |
||
2501 | end if |
||
2502 | jmp .out |
||
3083 | leency | 2503 | |
2504 | ; in: ecx = channel (1 - Left; 2 - Right) |
||
2505 | ; out: eax = volume (-10000 - 0) |
||
2506 | align 4 |
||
2507 | get_channel_volume: |
||
5048 | Asper | 2508 | push ebx ecx edx |
2509 | cmp ecx, 2 |
||
2510 | jg .out |
||
2511 | dec cl |
||
2512 | xor eax, eax |
||
2513 | mov edx, [volume.out_amp_node] |
||
2514 | test edx, edx |
||
2515 | jz .out |
||
2516 | movzx ebx, [edx+HDA_GNODE.nid] |
||
2517 | stdcall get_volume_mute, ebx, ecx, HDA_OUTPUT, 0 |
||
2518 | and eax, 0x7F ;get gain |
||
2519 | mov cl, [volume.step_size] |
||
2520 | mul cl |
||
2521 | imul eax, (-100/4) |
||
2522 | .out: |
||
2523 | pop edx ecx ebx |
||
2524 | ret |
||
3083 | leency | 2525 | |
2526 | |||
2527 | ; in: ecx = delay |
||
2528 | udelay: |
||
3496 | Asper | 2529 | push eax ecx edx |
2530 | test ecx, ecx |
||
2531 | jnz @f |
||
2532 | inc ecx |
||
5048 | Asper | 2533 | @@: |
3496 | Asper | 2534 | mov eax, ecx |
2535 | mov cx, 500 |
||
2536 | mul cl |
||
2537 | mov ecx, edx |
||
2538 | shl ecx, 16 |
||
2539 | or ecx, eax |
||
5048 | Asper | 2540 | @@: |
3496 | Asper | 2541 | xor eax, eax |
2542 | cpuid |
||
2543 | dec ecx |
||
2544 | jz @b |
||
2545 | pop edx ecx eax |
||
2546 | ret |
||
3083 | leency | 2547 | |
2548 | align 4 |
||
2549 | proc StallExec |
||
3496 | Asper | 2550 | push ecx edx ebx eax |
3083 | leency | 2551 | |
3496 | Asper | 2552 | mov ecx, CPU_FREQ |
2553 | mul ecx |
||
2554 | mov ebx, eax ;low |
||
2555 | mov ecx, edx ;high |
||
2556 | rdtsc |
||
2557 | add ebx, eax |
||
2558 | adc ecx,edx |
||
5048 | Asper | 2559 | @@: |
3496 | Asper | 2560 | rdtsc |
2561 | sub eax, ebx |
||
2562 | sbb edx, ecx |
||
2563 | js @B |
||
3083 | leency | 2564 | |
3496 | Asper | 2565 | pop eax ebx edx ecx |
2566 | ret |
||
3083 | leency | 2567 | endp |
2568 | |||
2569 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
2570 | ; MEMORY MAPPED IO (os depended) ; |
||
2571 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
2572 | |||
2573 | align 4 |
||
2574 | proc azx_readb |
||
3496 | Asper | 2575 | add edx, [ctrl.ctrl_mem_base] |
2576 | mov al, [edx] |
||
2577 | ret |
||
3083 | leency | 2578 | endp |
2579 | |||
2580 | align 4 |
||
2581 | proc azx_readw |
||
3496 | Asper | 2582 | add edx, [ctrl.ctrl_mem_base] |
2583 | mov ax, [edx] |
||
2584 | ret |
||
3083 | leency | 2585 | endp |
2586 | |||
2587 | align 4 |
||
2588 | proc azx_readl |
||
3496 | Asper | 2589 | add edx, [ctrl.ctrl_mem_base] |
2590 | mov eax, [edx] |
||
2591 | ret |
||
3083 | leency | 2592 | endp |
2593 | |||
2594 | align 4 |
||
2595 | proc azx_writeb |
||
3496 | Asper | 2596 | add edx, [ctrl.ctrl_mem_base] |
2597 | mov [edx], al |
||
2598 | ret |
||
3083 | leency | 2599 | endp |
2600 | |||
2601 | align 4 |
||
2602 | proc azx_writew |
||
3496 | Asper | 2603 | add edx, [ctrl.ctrl_mem_base] |
2604 | mov [edx], ax |
||
2605 | ret |
||
3083 | leency | 2606 | endp |
2607 | |||
2608 | align 4 |
||
2609 | proc azx_writel |
||
3496 | Asper | 2610 | add edx, [ctrl.ctrl_mem_base] |
2611 | mov [edx], eax |
||
2612 | ret |
||
3083 | leency | 2613 | endp |
2614 | |||
2615 | ;_______ |
||
2616 | |||
2617 | |||
2618 | ;Asper remember to add this functions: |
||
2619 | proc snd_hda_queue_unsol_event stdcall, par1:dword, par2:dword |
||
5048 | Asper | 2620 | if DEBUG |
3496 | Asper | 2621 | push esi |
2622 | mov esi, msgUnsolEvent |
||
5048 | Asper | 2623 | invoke SysMsgBoardStr |
3496 | Asper | 2624 | pop esi |
5048 | Asper | 2625 | end if |
2626 | if USE_UNSOL_EV = 0 |
||
2627 | ;Test. Do not make queue, process immediately! |
||
2628 | ;stdcall here snd_hda_read_pin_sense stdcall, nid:dword, trigger_sense:dword |
||
2629 | ;and then mute/unmute pin based on the results |
||
2630 | end if |
||
3496 | Asper | 2631 | ret |
3083 | leency | 2632 | endp |
2633 | ;... |
||
2634 | |||
2635 | |||
2636 | align 4 |
||
2637 | proc fdword2str stdcall, flags:dword ; bit 0 - skipLeadZeroes; bit 1 - newLine; other bits undefined |
||
3496 | Asper | 2638 | push eax ebx ecx |
2639 | mov esi, hex_buff |
||
2640 | mov ecx, -8 |
||
2641 | push eax |
||
5048 | Asper | 2642 | @@: |
3496 | Asper | 2643 | rol eax, 4 |
2644 | mov ebx, eax |
||
2645 | and ebx, 0x0F |
||
2646 | mov bl, [ebx+hexletters] |
||
2647 | mov [8+esi+ecx], bl |
||
2648 | inc ecx |
||
2649 | jnz @b |
||
2650 | pop eax |
||
3083 | leency | 2651 | |
3496 | Asper | 2652 | mov dword [esi+8], 0 |
2653 | test [flags], 0x2 ; new line ? |
||
2654 | jz .no_newline |
||
2655 | mov dword [esi+8], 0x00000A0D |
||
5048 | Asper | 2656 | .no_newline: |
3083 | leency | 2657 | |
3496 | Asper | 2658 | push eax |
2659 | test [flags], 0x1 ; skip zero bits ? |
||
2660 | jz .no_skipz |
||
2661 | mov ecx, 8 |
||
5048 | Asper | 2662 | @@: |
3496 | Asper | 2663 | test eax, 0xF0000000 |
2664 | jnz .skipz_done |
||
2665 | rol eax, 4 |
||
2666 | inc esi |
||
2667 | dec ecx |
||
2668 | jnz @b |
||
2669 | dec esi |
||
5048 | Asper | 2670 | .skipz_done: |
2671 | .no_skipz: |
||
3496 | Asper | 2672 | pop eax |
3083 | leency | 2673 | |
3496 | Asper | 2674 | pop ecx ebx eax |
2675 | ret |
||
3083 | leency | 2676 | endp |
2677 | |||
2678 | hexletters db '0123456789ABCDEF' |
||
2679 | hex_buff db 8 dup(0),13,10,0,0 |
||
2680 | |||
2681 | |||
3085 | leency | 2682 | include "CODEC.INC" |
3083 | leency | 2683 | include "hda_generic.inc" |
2684 | |||
2685 | align 4 |
||
2686 | devices: |
||
2687 | ; Intel |
||
5048 | Asper | 2688 | dd (CTRL_INTEL_SCH2 shl 16)+VID_INTEL,msg_INTEL_SCH2, AZX_DRIVER_SCH |
2689 | dd (CTRL_INTEL_HPT shl 16)+VID_INTEL,msg_INTEL_HPT, AZX_DRIVER_SCH |
||
2690 | dd (CTRL_INTEL_CPT shl 16)+VID_INTEL,msg_INTEL_CPT, AZX_DRIVER_PCH |
||
2691 | dd (CTRL_INTEL_PGB shl 16)+VID_INTEL,msg_INTEL_PGB, AZX_DRIVER_PCH |
||
2692 | dd (CTRL_INTEL_PPT1 shl 16)+VID_INTEL,msg_INTEL_PPT1, AZX_DRIVER_PCH |
||
6299 | serge | 2693 | dd (CTRL_INTEL_ICH6 shl 16)+VID_INTEL,msg_INTEL_ICH6, AZX_DRIVER_ICH |
5048 | Asper | 2694 | dd (CTRL_INTEL_63XXESB shl 16)+VID_INTEL,msg_INTEL_63XXESB, AZX_DRIVER_ICH |
6299 | serge | 2695 | dd (CTRL_INTEL_ICH7 shl 16)+VID_INTEL,msg_INTEL_ICH7, AZX_DRIVER_ICH |
2696 | dd (CTRL_INTEL_ICH8 shl 16)+VID_INTEL,msg_INTEL_ICH8, AZX_DRIVER_ICH |
||
5048 | Asper | 2697 | dd (CTRL_INTEL_82801_UNK1 shl 16)+VID_INTEL,msg_INTEL_82801_UNK1, AZX_DRIVER_ICH |
6299 | serge | 2698 | dd (CTRL_INTEL_ICH9 shl 16)+VID_INTEL,msg_INTEL_ICH9, AZX_DRIVER_ICH |
2699 | dd (CTRL_INTEL_ICH9_2 shl 16)+VID_INTEL,msg_INTEL_ICH9, AZX_DRIVER_ICH |
||
2700 | dd (CTRL_INTEL_ICH10 shl 16)+VID_INTEL,msg_INTEL_ICH10, AZX_DRIVER_ICH |
||
2701 | dd (CTRL_INTEL_ICH10_2 shl 16)+VID_INTEL,msg_INTEL_ICH10, AZX_DRIVER_ICH |
||
5048 | Asper | 2702 | dd (CTRL_INTEL_PCH shl 16)+VID_INTEL,msg_INTEL_PCH, AZX_DRIVER_PCH |
2703 | dd (CTRL_INTEL_PCH2 shl 16)+VID_INTEL,msg_INTEL_PCH2, AZX_DRIVER_PCH |
||
2704 | dd (CTRL_INTEL_SCH shl 16)+VID_INTEL,msg_INTEL_SCH, AZX_DRIVER_SCH |
||
2705 | dd (CTRL_INTEL_LPT shl 16)+VID_INTEL,msg_INTEL_LPT, AZX_DRIVER_PCH |
||
6299 | serge | 2706 | dd (CTRL_INTEL_0F04 shl 16)+VID_INTEL,msg_INTEL_BAYTRAIL, AZX_DRIVER_PCH |
2707 | dd (CTRL_INTEL_2284 shl 16)+VID_INTEL,msg_INTEL_BRASWELL, AZX_DRIVER_PCH |
||
2708 | dd (CTRL_INTEL_8ca0 shl 16)+VID_INTEL,msg_INTEL_9SERIES, AZX_DRIVER_PCH |
||
2709 | dd (CTRL_INTEL_8d20 shl 16)+VID_INTEL,msg_INTEL_WELLSBURG, AZX_DRIVER_PCH |
||
2710 | dd (CTRL_INTEL_8d21 shl 16)+VID_INTEL,msg_INTEL_WELLSBURG, AZX_DRIVER_PCH |
||
2711 | dd (CTRL_INTEL_A1F0 shl 16)+VID_INTEL,msg_INTEL_LEWISBURG, AZX_DRIVER_PCH |
||
2712 | dd (CTRL_INTEL_A270 shl 16)+VID_INTEL,msg_INTEL_LEWISBURG, AZX_DRIVER_PCH |
||
2713 | dd (CTRL_INTEL_9C20 shl 16)+VID_INTEL,msg_INTEL_LYNX_LP, AZX_DRIVER_PCH |
||
2714 | dd (CTRL_INTEL_9C21 shl 16)+VID_INTEL,msg_INTEL_LYNX_LP, AZX_DRIVER_PCH |
||
2715 | dd (CTRL_INTEL_9CA0 shl 16)+VID_INTEL,msg_INTEL_WILD_LP, AZX_DRIVER_PCH |
||
2716 | dd (CTRL_INTEL_A170 shl 16)+VID_INTEL,msg_INTEL_SUNRISE, AZX_DRIVER_PCH |
||
2717 | dd (CTRL_INTEL_9D70 shl 16)+VID_INTEL,msg_INTEL_SUN_LP, AZX_DRIVER_PCH |
||
2718 | dd (CTRL_INTEL_5A98 shl 16)+VID_INTEL,msg_INTEL_BROXTON, AZX_DRIVER_PCH |
||
2719 | |||
3083 | leency | 2720 | ; Nvidia |
5048 | Asper | 2721 | dd (CTRL_NVIDIA_MCP51 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP51, AZX_DRIVER_NVIDIA |
2722 | dd (CTRL_NVIDIA_MCP55 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP55, AZX_DRIVER_NVIDIA |
||
2723 | dd (CTRL_NVIDIA_MCP61_1 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP61, AZX_DRIVER_NVIDIA |
||
2724 | dd (CTRL_NVIDIA_MCP61_2 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP61, AZX_DRIVER_NVIDIA |
||
2725 | dd (CTRL_NVIDIA_MCP65_1 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP65, AZX_DRIVER_NVIDIA |
||
2726 | dd (CTRL_NVIDIA_MCP65_2 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP65, AZX_DRIVER_NVIDIA |
||
2727 | dd (CTRL_NVIDIA_MCP67_1 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP67, AZX_DRIVER_NVIDIA |
||
2728 | dd (CTRL_NVIDIA_MCP67_2 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP67, AZX_DRIVER_NVIDIA |
||
2729 | dd (CTRL_NVIDIA_MCP73_1 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP73, AZX_DRIVER_NVIDIA |
||
2730 | dd (CTRL_NVIDIA_MCP73_2 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP73, AZX_DRIVER_NVIDIA |
||
2731 | dd (CTRL_NVIDIA_MCP78_1 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP78, AZX_DRIVER_NVIDIA |
||
2732 | dd (CTRL_NVIDIA_MCP78_2 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP78, AZX_DRIVER_NVIDIA |
||
2733 | dd (CTRL_NVIDIA_MCP78_3 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP78, AZX_DRIVER_NVIDIA |
||
2734 | dd (CTRL_NVIDIA_MCP78_4 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP78, AZX_DRIVER_NVIDIA |
||
2735 | dd (CTRL_NVIDIA_MCP79_1 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP79, AZX_DRIVER_NVIDIA |
||
2736 | dd (CTRL_NVIDIA_MCP79_2 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP79, AZX_DRIVER_NVIDIA |
||
2737 | dd (CTRL_NVIDIA_MCP79_3 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP79, AZX_DRIVER_NVIDIA |
||
2738 | dd (CTRL_NVIDIA_MCP79_4 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP79, AZX_DRIVER_NVIDIA |
||
2739 | dd (CTRL_NVIDIA_0BE2 shl 16)+VID_NVIDIA,msg_NVIDIA_0BE2, AZX_DRIVER_NVIDIA |
||
2740 | dd (CTRL_NVIDIA_0BE3 shl 16)+VID_NVIDIA,msg_NVIDIA_0BE3, AZX_DRIVER_NVIDIA |
||
2741 | dd (CTRL_NVIDIA_0BE4 shl 16)+VID_NVIDIA,msg_NVIDIA_0BE4, AZX_DRIVER_NVIDIA |
||
2742 | dd (CTRL_NVIDIA_GT100 shl 16)+VID_NVIDIA,msg_NVIDIA_GT100, AZX_DRIVER_NVIDIA |
||
2743 | dd (CTRL_NVIDIA_GT106 shl 16)+VID_NVIDIA,msg_NVIDIA_GT106, AZX_DRIVER_NVIDIA |
||
2744 | dd (CTRL_NVIDIA_GT108 shl 16)+VID_NVIDIA,msg_NVIDIA_GT108, AZX_DRIVER_NVIDIA |
||
2745 | dd (CTRL_NVIDIA_GT104 shl 16)+VID_NVIDIA,msg_NVIDIA_GT104, AZX_DRIVER_NVIDIA |
||
2746 | dd (CTRL_NVIDIA_GT116 shl 16)+VID_NVIDIA,msg_NVIDIA_GT116, AZX_DRIVER_NVIDIA |
||
2747 | dd (CTRL_NVIDIA_MCP89_1 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP89, AZX_DRIVER_NVIDIA |
||
2748 | dd (CTRL_NVIDIA_MCP89_2 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP89, AZX_DRIVER_NVIDIA |
||
2749 | dd (CTRL_NVIDIA_MCP89_3 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP89, AZX_DRIVER_NVIDIA |
||
2750 | dd (CTRL_NVIDIA_MCP89_4 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP89, AZX_DRIVER_NVIDIA |
||
2751 | dd (CTRL_NVIDIA_GF119 shl 16)+VID_NVIDIA,msg_NVIDIA_GF119, AZX_DRIVER_NVIDIA |
||
2752 | dd (CTRL_NVIDIA_GF110_1 shl 16)+VID_NVIDIA,msg_NVIDIA_GF110, AZX_DRIVER_NVIDIA |
||
2753 | dd (CTRL_NVIDIA_GF110_2 shl 16)+VID_NVIDIA,msg_NVIDIA_GF110, AZX_DRIVER_NVIDIA |
||
3083 | leency | 2754 | ; ATI |
5048 | Asper | 2755 | dd (CTRL_ATI_SB450 shl 16)+VID_ATI,msg_ATI_SB450, AZX_DRIVER_ATI |
2756 | dd (CTRL_ATI_SB600 shl 16)+VID_ATI,msg_ATI_SB600, AZX_DRIVER_ATI |
||
2757 | dd (CTRL_ATI_RS600 shl 16)+VID_ATI,msg_ATI_RS600, AZX_DRIVER_ATIHDMI |
||
2758 | dd (CTRL_ATI_RS690 shl 16)+VID_ATI,msg_ATI_RS690, AZX_DRIVER_ATIHDMI |
||
2759 | dd (CTRL_ATI_RS780 shl 16)+VID_ATI,msg_ATI_RS780, AZX_DRIVER_ATIHDMI |
||
2760 | dd (CTRL_ATI_RS_UNK1 shl 16)+VID_ATI,msg_ATI_RS_UNK1, AZX_DRIVER_ATIHDMI |
||
2761 | dd (CTRL_ATI_R600 shl 16)+VID_ATI,msg_ATI_R600, AZX_DRIVER_ATIHDMI |
||
2762 | dd (CTRL_ATI_RV610 shl 16)+VID_ATI,msg_ATI_RV610, AZX_DRIVER_ATIHDMI |
||
2763 | dd (CTRL_ATI_RV620 shl 16)+VID_ATI,msg_ATI_RV620, AZX_DRIVER_ATIHDMI |
||
2764 | dd (CTRL_ATI_RV630 shl 16)+VID_ATI,msg_ATI_RV630, AZX_DRIVER_ATIHDMI |
||
2765 | dd (CTRL_ATI_RV635 shl 16)+VID_ATI,msg_ATI_RV635, AZX_DRIVER_ATIHDMI |
||
2766 | dd (CTRL_ATI_RV670 shl 16)+VID_ATI,msg_ATI_RV670, AZX_DRIVER_ATIHDMI |
||
2767 | dd (CTRL_ATI_RV710 shl 16)+VID_ATI,msg_ATI_RV710, AZX_DRIVER_ATIHDMI |
||
2768 | dd (CTRL_ATI_RV730 shl 16)+VID_ATI,msg_ATI_RV730, AZX_DRIVER_ATIHDMI |
||
2769 | dd (CTRL_ATI_RV740 shl 16)+VID_ATI,msg_ATI_RV740, AZX_DRIVER_ATIHDMI |
||
2770 | dd (CTRL_ATI_RV770 shl 16)+VID_ATI,msg_ATI_RV770, AZX_DRIVER_ATIHDMI |
||
3083 | leency | 2771 | ; AMD |
5048 | Asper | 2772 | dd (CTRL_AMD_HUDSON shl 16)+VID_AMD,msg_AMD_HUDSON, AZX_DRIVER_GENERIC |
3083 | leency | 2773 | ; VIA |
5048 | Asper | 2774 | dd (CTRL_VIA_VT82XX shl 16)+VID_VIA,msg_VIA_VT82XX, AZX_DRIVER_VIA |
2775 | dd (CTRL_VIA_VT61XX shl 16)+VID_VIA,msg_VIA_VT61XX, AZX_DRIVER_GENERIC |
||
2776 | dd (CTRL_VIA_VT71XX shl 16)+VID_VIA,msg_VIA_VT71XX, AZX_DRIVER_GENERIC |
||
3083 | leency | 2777 | ; SiS |
5048 | Asper | 2778 | dd (CTRL_SIS_966 shl 16)+VID_SIS,msg_SIS_966, AZX_DRIVER_SIS |
3083 | leency | 2779 | ; ULI |
5048 | Asper | 2780 | dd (CTRL_ULI_M5461 shl 16)+VID_ULI,msg_ULI_M5461, AZX_DRIVER_ULI |
3083 | leency | 2781 | ; Teradici |
5048 | Asper | 2782 | dd (CTRL_TERA_UNK1 shl 16)+VID_ULI,msg_TERA_UNK1, AZX_DRIVER_TERA |
3083 | leency | 2783 | ; Creative |
5048 | Asper | 2784 | dd (CTRL_CREATIVE_CA0110_IBG shl 16)+VID_CREATIVE,msg_CREATIVE_CA0110_IBG, AZX_DRIVER_CTX |
2785 | dd (CTRL_CREATIVE_SOUND_CORE3D_1 shl 16)+VID_CREATIVE,msg_CREATIVE_SOUND_CORE3D, AZX_DRIVER_GENERIC |
||
2786 | dd (CTRL_CREATIVE_SOUND_CORE3D_2 shl 16)+VID_CREATIVE,msg_CREATIVE_SOUND_CORE3D, AZX_DRIVER_GENERIC |
||
3083 | leency | 2787 | ; RDC Semiconductor |
5048 | Asper | 2788 | dd (CTRL_RDC_R3010 shl 16)+VID_RDC,msg_RDC_R3010, AZX_DRIVER_GENERIC |
3083 | leency | 2789 | ; VMware |
5048 | Asper | 2790 | dd (CTRL_VMWARE_UNK1 shl 16)+VID_VMWARE,msg_VMWARE_UNK1, AZX_DRIVER_GENERIC |
3083 | leency | 2791 | |
5048 | Asper | 2792 | dd 0 ;terminator |
3083 | leency | 2793 | |
2794 | |||
2795 | version dd (5 shl 16) or (API_VERSION and 0xFFFF) |
||
2796 | |||
2797 | msg_Intel db 'Intel ',0 |
||
2798 | msg_INTEL_CPT db 'Cougar Point',13,10,0 |
||
2799 | msg_INTEL_PGB db 'Patsburg',13,10,0 |
||
2800 | msg_INTEL_PPT1 db 'Panther Point',13,10,0 |
||
2801 | msg_INTEL_LPT db 'Lynx Point',13,10,0 |
||
2802 | msg_INTEL_HPT db 'Haswell',13,10,0 |
||
6299 | serge | 2803 | msg_INTEL_ICH6 db 'ICH6',13,10,0 |
3083 | leency | 2804 | msg_INTEL_63XXESB db '631x/632xESB',13,10,0 |
6299 | serge | 2805 | msg_INTEL_ICH7 db 'ICH7', 13,10,0 |
2806 | msg_INTEL_ICH8 db 'ICH8', 13,10,0 |
||
2807 | msg_INTEL_ICH9 db 'ICH9', 13,10,0 |
||
2808 | msg_INTEL_ICH10 db 'ICH10',13,10,0 |
||
3083 | leency | 2809 | msg_INTEL_PCH db 'PCH',13,10,0 |
2810 | msg_INTEL_PCH2 db 'PCH2',13,10,0 |
||
2811 | msg_INTEL_SCH db 'Poulsbo',13,10,0 |
||
2812 | msg_INTEL_SCH2 db 'Oaktrail',13,10,0 |
||
6299 | serge | 2813 | msg_INTEL_BAYTRAIL db 'BayTrail', 13,10,0 |
2814 | msg_INTEL_BRASWELL db 'Braswell', 13,10,0 |
||
2815 | msg_INTEL_9SERIES db '9 Series', 13,10,0 |
||
2816 | msg_INTEL_WELLSBURG db 'Wellsburg', 13,10,0 |
||
2817 | msg_INTEL_LEWISBURG db 'Lewisburg', 13,10,0 |
||
2818 | msg_INTEL_LYNX_LP db 'Lynx Point-LP',13,10,0 |
||
2819 | msg_INTEL_WILD_LP db 'Wildcat Point-LP',13,10,0 |
||
2820 | msg_INTEL_SUNRISE db 'Sunrise Point',13,10,0 |
||
2821 | msg_INTEL_SUN_LP db 'Sunrise Point-LP',13,10,0 |
||
2822 | msg_INTEL_BROXTON db 'Broxton-P',13,10,0 |
||
2823 | |||
3083 | leency | 2824 | msg_INTEL_82801_UNK1 db '82801_UNK1', 13,10,0 |
2825 | |||
2826 | msg_NVidia db 'NVidia ',0 |
||
2827 | msg_NVIDIA_MCP51 db 'MCP51', 13,10,0 |
||
2828 | msg_NVIDIA_MCP55 db 'MCP55', 13,10,0 |
||
2829 | msg_NVIDIA_MCP61 db 'MCP61', 13,10,0 |
||
2830 | msg_NVIDIA_MCP65 db 'MCP65', 13,10,0 |
||
2831 | msg_NVIDIA_MCP67 db 'MCP67', 13,10,0 |
||
2832 | msg_NVIDIA_MCP73 db 'MCP73', 13,10,0 |
||
2833 | msg_NVIDIA_MCP78 db 'MCP78', 13,10,0 |
||
2834 | msg_NVIDIA_MCP79 db 'MCP79', 13,10,0 |
||
2835 | msg_NVIDIA_MCP89 db 'MCP89', 13,10,0 |
||
2836 | msg_NVIDIA_0BE2 db '(0x0be2)', 13,10,0 |
||
2837 | msg_NVIDIA_0BE3 db '(0x0be3)', 13,10,0 |
||
2838 | msg_NVIDIA_0BE4 db '(0x0be4)', 13,10,0 |
||
2839 | msg_NVIDIA_GT100 db 'GT100', 13,10,0 |
||
2840 | msg_NVIDIA_GT104 db 'GT104', 13,10,0 |
||
2841 | msg_NVIDIA_GT106 db 'GT106', 13,10,0 |
||
2842 | msg_NVIDIA_GT108 db 'GT108', 13,10,0 |
||
2843 | msg_NVIDIA_GT116 db 'GT116', 13,10,0 |
||
2844 | msg_NVIDIA_GF119 db 'GF119', 13,10,0 |
||
2845 | msg_NVIDIA_GF110 db 'GF110', 13,10,0 |
||
2846 | |||
2847 | msg_ATI db 'ATI ',0 |
||
2848 | msg_ATI_SB450 db 'SB450', 13,10,0 |
||
2849 | msg_ATI_SB600 db 'SB600', 13,10,0 |
||
2850 | |||
2851 | msg_ATI_HDMI db 'ATI HDMI ',0 |
||
2852 | msg_ATI_RS600 db 'RS600', 13,10,0 |
||
2853 | msg_ATI_RS690 db 'RS690', 13,10,0 |
||
2854 | msg_ATI_RS780 db 'RS780', 13,10,0 |
||
2855 | msg_ATI_RS_UNK1 db 'RS_UNK1', 13,10,0 |
||
2856 | msg_ATI_R600 db 'R600', 13,10,0 |
||
2857 | msg_ATI_RV610 db 'RV610', 13,10,0 |
||
2858 | msg_ATI_RV620 db 'RV620', 13,10,0 |
||
2859 | msg_ATI_RV630 db 'RV630', 13,10,0 |
||
2860 | msg_ATI_RV635 db 'RV635', 13,10,0 |
||
2861 | msg_ATI_RV670 db 'RV670', 13,10,0 |
||
2862 | msg_ATI_RV710 db 'RV710', 13,10,0 |
||
2863 | msg_ATI_RV730 db 'RV730', 13,10,0 |
||
2864 | msg_ATI_RV740 db 'RV740', 13,10,0 |
||
2865 | msg_ATI_RV770 db 'RV770', 13,10,0 |
||
2866 | |||
2867 | msg_AMD db 'AMD ',0 |
||
2868 | msg_AMD_HUDSON db 'Hudson', 13,10,0 |
||
2869 | |||
2870 | msg_VIA db 'VIA ',0 |
||
2871 | msg_VIA_VT82XX db 'VT8251/8237A', 13,10,0 |
||
2872 | msg_VIA_VT61XX db 'GFX VT6122/VX11', 13,10,0 |
||
2873 | msg_VIA_VT71XX db 'GFX VT7122/VX900', 13,10,0 |
||
2874 | |||
2875 | msg_SIS db 'SIS ',0 |
||
2876 | msg_SIS_966 db '966', 13,10,0 |
||
2877 | |||
2878 | msg_ULI db 'ULI ',0 |
||
2879 | msg_ULI_M5461 db 'M5461', 13,10,0 |
||
2880 | |||
2881 | msg_TERA db 'Teradici ',0 |
||
2882 | msg_TERA_UNK1 db 'UNK1', 13,10,0 |
||
2883 | |||
2884 | msg_CREATIVE db 'Creative ',0 |
||
2885 | msg_CREATIVE_CA0110_IBG db 'CA0110-IBG',13,10,0 ;SB X-Fi Xtreme Audio |
||
2886 | msg_CREATIVE_SOUND_CORE3D db 'Sound Core3D' |
||
2887 | |||
2888 | msg_RDC db 'RDC ',0 |
||
2889 | msg_RDC_R3010 db 'R3010', 13,10,0 |
||
2890 | |||
2891 | msg_VMWARE db 'VMware ',0 |
||
2892 | msg_VMWARE_UNK1 db 'UNK1', 13,10,0 |
||
2893 | |||
2894 | szKernel db 'KERNEL',0 |
||
2895 | sz_sound_srv db 'SOUND',0 |
||
2896 | |||
2897 | msgInit db 'detect hardware...',13,10,0 |
||
2898 | msgFail db 'device not found',13,10,0 |
||
2899 | msgAttchIRQ db 'IRQ line not supported', 13,10,0 |
||
2900 | msgInvIRQ db 'IRQ line not assigned or invalid', 13,10,0 |
||
2901 | msgPlay db 'start play', 13,10,0 |
||
2902 | msgStop db 'stop play', 13,10,0 |
||
2903 | msgSetChannelVolume db 'Set Channel Volume', 13,10,0 |
||
2904 | msgIRQ db 'HDA IRQ', 13,10,0 |
||
2905 | msgInitCtrl db 'init controller',13,10,0 |
||
2906 | msgPrimBuff db 'create primary buffer ...',0 |
||
2907 | msgDone db 'done',13,10,0 |
||
2908 | msgRemap db 'Remap IRQ',13,10,0 |
||
2909 | msgOk db 'service installed',13,10,0 |
||
2910 | msgCold db 'cold reset',13,10,0 |
||
2911 | msgHDARFail db 'controller not ready',13,10,0 |
||
2912 | msgCFail db 'codec not ready',13,10,0 |
||
2913 | msgResetOk db 'reset complete',13,10,0 |
||
2914 | msgPciCmd db 'PCI command ',0 |
||
2915 | msgPciStat db 'PCI status ',0 |
||
2916 | msgHDALowMMIo db 'lower mmio base ',0 |
||
2917 | msgHDAUpMMIo db 'upper mmio base ',0 |
||
2918 | msgIrqMap db 'HDA irq map as ',0 |
||
2919 | |||
2920 | ;Asper [ |
||
2921 | if DEBUG |
||
2922 | msgCodecMask db 'codec_mask = ',0 |
||
2923 | msgNoCodecsFound db 'no codecs found!',13,10,0 |
||
2924 | msgHDASnoopDisabled db 'HDA snoop disabled, enabling ... ',0 |
||
2925 | msg_OK db 'OK',13,10,0 |
||
2926 | msg_Fail db 'Failed',13,10,0 |
||
2927 | msgSpuriousResponce db 'spurious responce ',0 |
||
2928 | emsgInvalidAFGSubtree db 'Invalid AFG subtree',13,10,0 |
||
2929 | emsgConnListNotAvailable db 'connection list not available for ',0 |
||
2930 | msgUnmuteOut db 'UNMUTE OUT: NID=',0 |
||
2931 | msgUnmuteIn db 'UNMUTE IN: NID=',0 |
||
2932 | msgGetResponceTimeout db 'get_response timeout: ',0 |
||
2933 | msgVal db ' val=',0 |
||
2934 | emsgBusResetFatalComm db 'resetting BUS due to fatal communication error',13,10,0 |
||
2935 | msgCodecOK db 'codec probed OK',13,10,0 |
||
2936 | msgCodecError db 'codec probe error disabling it...',13,10,0 |
||
2937 | emsgNoAFGorMFGFound db 'no AFG or MFG node found',13,10,0 |
||
4324 | Asper | 2938 | msgNoAFGFound db 'no AFG node found, trying another codec',13,10,0 |
3083 | leency | 2939 | emsgNoMem db 'hda_codec: cannot malloc',13,10,0 |
2940 | msgConnect db 'CONNECT: NID=',0 |
||
2941 | msgIdx db ' IDX=',0 |
||
2942 | msgSkipDigitalOutNode db 'Skip Digital OUT node ',0 |
||
2943 | msgAudOutFound db 'AUD_OUT found ',0 |
||
2944 | emsgNoParserAvailable db 'No codec parser is available',13,10,0 |
||
2945 | emsgNoProperOutputPathFound db 'hda_generic: no proper output path found',13,10,0 |
||
2946 | emsgInvConnList db 'hda_codec: invalid CONNECT_LIST verb ',0 |
||
2947 | emsgInvDepRangeVal db 'hda_codec: invalid dep_range_val ',0 |
||
2948 | emsgTooManyConns db 'Too many connections',13,10,0 |
||
2949 | emsgNoVolCtrl db 'No volume control',13,10,0 |
||
2950 | msgHDACodecSetupStream db 'hda_codec_setup_stream: NID=',0 |
||
2951 | msgStream db 'stream=',0 |
||
2952 | msgChannel db 'channel=',0 |
||
2953 | msgFormat db 'format=',0 |
||
2954 | |||
2955 | msgPollingCodecOnce db 'polling the codec once',13,10,0 ;Asper~ |
||
2956 | msgSwitchToPollMode db 'switching to polling mode',13,10,0 ;Asper~ |
||
2957 | |||
2958 | msgUnsolEvent db 'Unsolicited event!',13,10,0 |
||
2959 | strSemicolon db ':',0 |
||
2960 | msgSETUP_FG_NODES db 'Setup FG nodes = start_nid:total_nodes = ',0 |
||
2961 | msgFG_TYPE db 'FG type = ',0 |
||
2962 | msgPinCfgs db 'Pin configurations:',13,10,0 |
||
2963 | msgWCaps db 'Widget capabilities:',13,10,0 |
||
2964 | msgCAd db 'CAd = ',0 |
||
2965 | msgTCSEL db 'PCI TCSEL ',0 |
||
2966 | msgTV db 'HDA test version ',TEST_VERSION_NUMBER,13,10,0 |
||
2967 | msgGCap db 'GCAP = ',0 |
||
2968 | end if |
||
2969 | |||
2970 | if USE_SINGLE_MODE |
||
2971 | msgSingleMode db 'Single mode !',13,10,0 |
||
2972 | msgIRS db 'IRS=',0 |
||
2973 | msgSendCmdTimeout db 'send_cmd timeout: IRS=',0 |
||
2974 | else |
||
2975 | msgNormalMode db 'Normal mode !',13,10,0 |
||
2976 | end if |
||
2977 | |||
2978 | if DEBUG |
||
2979 | msgYAHOO2 db 'YAHOO2: ',0 |
||
5048 | Asper | 2980 | msgMinVolume db 'MinVolume: ',0 |
3083 | leency | 2981 | msgNewVolume db 'NewVolume: ',0 |
2982 | |||
2983 | msgVerbQuery db 'Q: ',0 |
||
2984 | msgVerbAnswer db 'A: ',0 |
||
2985 | msgPin_Nid db 'Pin Nid = ',0 |
||
2986 | msgPin_Ctl db 'Pin Control = ',0 |
||
2987 | msgPin_Caps db 'Pin Capabilities = ',0 |
||
2988 | msgDef_Cfg db 'Pin def_cfg = ',0 |
||
2989 | msgAmp_Out_Caps db 'Pin Amp Out caps = ',0 |
||
2990 | msgAmpVal db 'Amp val = ',0 |
||
2991 | msgEnableEAPD db 'Enable EAPD: NID=',0 |
||
2992 | msgBeeperNid db 'Beeper found: NID=',0 |
||
2993 | msgBeeperValue db 'Beeper initial value: ',0 |
||
2994 | msgBeepNow db 'Beep!',13,10,0 |
||
5048 | Asper | 2995 | |
2996 | msgNodeSeq db 'Sequence of codec nodes:',13,10,0 |
||
2997 | msgNID db 'NID: 0x',0 |
||
3083 | leency | 2998 | end if |
2999 | |||
3000 | ;] Asper |
||
3001 | |||
3496 | Asper | 3002 | aspinlock dd SPINLOCK_FREE |
3083 | leency | 3003 | |
3004 | codec CODEC |
||
3005 | ctrl AC_CNTRL |
||
3006 | |||
3007 | ;Asper: BDL must be aligned to 128 according to HDA specification. |
||
3008 | pcmout_bdl rd 1 |
||
3009 | buff_list rd 32 |
||
3010 | |||
3011 | driver_type rd 1 |