Subversion Repositories Kolibri OS

Rev

Rev 2465 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
802 serge 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
3232 Serge 3
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;;
802 serge 4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
8
format MS COFF
9
 
3232 Serge 10
DEBUG           = 1
802 serge 11
 
12
include 'proc32.inc'
13
include 'imports.inc'
14
 
3232 Serge 15
VID_INTEL         = 0x8086
16
VID_NVIDIA        = 0x10DE
17
VID_VIA           = 0x1106
18
VID_SIS           = 0x1039
19
VID_FM801         = 0x1319
20
VID_CREATIVE      = 0x1102
21
VID_ATI           = 0x1002
22
VID_AMD           = 0x1022
23
VID_ULI           = 0x10B9
24
VID_TERA          = 0x6549
25
VID_RDC           = 0x17F3
26
VID_VMWARE        = 0x15AD
802 serge 27
 
3232 Serge 28
CTRL_ICH          = 0x2415
29
CTRL_ICH0         = 0x2425
30
CTRL_ICH2         = 0x2435
31
CTRL_ICH3         = 0x2445
32
CTRL_ICH4         = 0x24C5
33
CTRL_ICH5         = 0x24D5
34
CTRL_ICH6         = 0x266E
35
CTRL_ICH7         = 0x27DE
802 serge 36
 
3232 Serge 37
CTRL_NFORCE       = 0x01B1
38
CTRL_NFORCE2      = 0x006A
39
CTRL_NFORCE3      = 0x00DA
40
CTRL_MCP04        = 0x003A
41
CTRL_CK804        = 0x0059
42
CTRL_CK8          = 0x008A
43
CTRL_CK8S         = 0x00EA
44
CTRL_MCP51        = 0x026B
802 serge 45
 
3232 Serge 46
CTRL_VT82C686     = 0x3058
47
CTRL_VT8233_5     = 0x3059
802 serge 48
 
3232 Serge 49
CTRL_SIS          = 0x7012
802 serge 50
 
3232 Serge 51
CTRL_FM801        = 0x0801
802 serge 52
 
3232 Serge 53
CTRL_CT0200       = 0x0006  ; Dell OEM version (EMU10K1X)
802 serge 54
 
3232 Serge 55
CTRL_INTEL_SCH2          =  0x080a
56
CTRL_INTEL_HPT           =  0x0c0c
57
CTRL_INTEL_CPT           =  0x1c20
58
CTRL_INTEL_PGB           =  0x1d20
59
CTRL_INTEL_PPT1          =  0x1e20
60
CTRL_INTEL_82801F        =  0x2668
61
CTRL_INTEL_63XXESB       =  0x269a
62
CTRL_INTEL_82801G        =  0x27d8
63
CTRL_INTEL_82801H        =  0x284b
64
CTRL_INTEL_82801_UNK1    =  0x2911
65
CTRL_INTEL_82801I        =  0x293e
66
CTRL_INTEL_82801_UNK2    =  0x293f
67
CTRL_INTEL_82801JI       =  0x3a3e
68
CTRL_INTEL_82801JD       =  0x3a6e
69
CTRL_INTEL_PCH           =  0x3b56
70
CTRL_INTEL_PCH2          =  0x3b57
71
CTRL_INTEL_SCH           =  0x811b
72
CTRL_INTEL_LPT           =  0x8c20
802 serge 73
 
3232 Serge 74
CTRL_NVIDIA_MCP51        =  0x026c
75
CTRL_NVIDIA_MCP55        =  0x0371
76
CTRL_NVIDIA_MCP61_1      =  0x03e4
77
CTRL_NVIDIA_MCP61_2      =  0x03f0
78
CTRL_NVIDIA_MCP65_1      =  0x044a
79
CTRL_NVIDIA_MCP65_2      =  0x044b
80
CTRL_NVIDIA_MCP67_1      =  0x055c
81
CTRL_NVIDIA_MCP67_2      =  0x055d
82
CTRL_NVIDIA_MCP78_1      =  0x0774
83
CTRL_NVIDIA_MCP78_2      =  0x0775
84
CTRL_NVIDIA_MCP78_3      =  0x0776
85
CTRL_NVIDIA_MCP78_4      =  0x0777
86
CTRL_NVIDIA_MCP73_1      =  0x07fc
87
CTRL_NVIDIA_MCP73_2      =  0x07fd
88
CTRL_NVIDIA_MCP79_1      =  0x0ac0
89
CTRL_NVIDIA_MCP79_2      =  0x0ac1
90
CTRL_NVIDIA_MCP79_3      =  0x0ac2
91
CTRL_NVIDIA_MCP79_4      =  0x0ac3
92
CTRL_NVIDIA_0BE2         =  0x0be2
93
CTRL_NVIDIA_0BE3         =  0x0be3
94
CTRL_NVIDIA_0BE4         =  0x0be4
95
CTRL_NVIDIA_GT100        =  0x0be5
96
CTRL_NVIDIA_GT106        =  0x0be9
97
CTRL_NVIDIA_GT108        =  0x0bea
98
CTRL_NVIDIA_GT104        =  0x0beb
99
CTRL_NVIDIA_GT116        =  0x0bee
100
CTRL_NVIDIA_MCP89_1      =  0x0d94
101
CTRL_NVIDIA_MCP89_2      =  0x0d95
102
CTRL_NVIDIA_MCP89_3      =  0x0d96
103
CTRL_NVIDIA_MCP89_4      =  0x0d97
104
CTRL_NVIDIA_GF119        =  0x0e08
105
CTRL_NVIDIA_GF110_1      =  0x0e09
106
CTRL_NVIDIA_GF110_2      =  0x0e0c
802 serge 107
 
3232 Serge 108
CTRL_ATI_SB450           =  0x437b
109
CTRL_ATI_SB600           =  0x4383
802 serge 110
 
3232 Serge 111
CTRL_ATI_RS600           =  0x793b
112
CTRL_ATI_RS690           =  0x7919
113
CTRL_ATI_RS780           =  0x960f
114
CTRL_ATI_RS_UNK1         =  0x970f
115
CTRL_ATI_R600            =  0xaa00
116
CTRL_ATI_RV630           =  0xaa08
117
CTRL_ATI_RV610           =  0xaa10
118
CTRL_ATI_RV670           =  0xaa18
119
CTRL_ATI_RV635           =  0xaa20
120
CTRL_ATI_RV620           =  0xaa28
121
CTRL_ATI_RV770           =  0xaa30
122
CTRL_ATI_RV730           =  0xaa38
123
CTRL_ATI_RV710           =  0xaa40
124
CTRL_ATI_RV740           =  0xaa48
802 serge 125
 
3232 Serge 126
CTRL_AMD_HUDSON          =  0x780d
802 serge 127
 
3232 Serge 128
CTRL_VIA_VT82XX          =  0x3288
129
CTRL_VIA_VT61XX          =  0x9140
130
CTRL_VIA_VT71XX          =  0x9170
802 serge 131
 
3232 Serge 132
CTRL_SIS_966             =  0x7502
802 serge 133
 
3232 Serge 134
CTRL_ULI_M5461           =  0x5461
802 serge 135
 
3232 Serge 136
CTRL_CREATIVE_CA0110_IBG     =  0x0009
137
CTRL_CREATIVE_SOUND_CORE3D_1 =  0x0010
138
CTRL_CREATIVE_SOUND_CORE3D_2 =  0x0012
802 serge 139
 
3232 Serge 140
CTRL_TERA_UNK1           =  0x1200
802 serge 141
 
3232 Serge 142
CTRL_RDC_R3010           =  0x3010
802 serge 143
 
3232 Serge 144
CTRL_VMWARE_UNK1         =  0x1977
802 serge 145
 
3232 Serge 146
API_VERSION             = 0x01000100
802 serge 147
 
148
public START
149
public service_proc
150
public version
151
 
152
section '.flat' code readable align 16
153
 
154
proc START stdcall, state:dword
155
 
2434 Serge 156
        cmp     [state], 1
157
        jne     .stop
802 serge 158
 
159
     if DEBUG
2434 Serge 160
        mov     esi, msgInit
161
        call    SysMsgBoardStr
802 serge 162
     end if
163
 
2434 Serge 164
        call    detect_controller
165
        ret
3232 Serge 166
  .stop:
2434 Serge 167
        xor     eax, eax
168
        ret
802 serge 169
endp
170
 
171
align 4
172
proc service_proc stdcall, ioctl:dword
173
 
2434 Serge 174
        or      eax, -1
175
        ret
802 serge 176
endp
177
 
178
align 4
3232 Serge 179
proc detect_controller
802 serge 180
 
2434 Serge 181
           locals
182
             last_bus dd ?
183
             bus      dd ?
184
             devfn    dd ?
185
           endl
802 serge 186
 
2434 Serge 187
        xor     eax, eax
188
        mov     [bus], eax
189
        inc     eax
190
        call    PciApi
191
        cmp     eax, -1
192
        je      .err
802 serge 193
 
2434 Serge 194
        mov     [last_bus], eax
802 serge 195
 
3232 Serge 196
  .next_bus:
2434 Serge 197
        and     [devfn], 0
3232 Serge 198
  .next_dev:
2434 Serge 199
        stdcall PciRead32, [bus], [devfn], dword 0
200
        test    eax, eax
201
        jz      .next
202
        cmp     eax, -1
203
        je      .next
802 serge 204
 
2434 Serge 205
        mov     edi, devices
3232 Serge 206
  @@:
2434 Serge 207
        mov     ebx, [edi]
208
        test    ebx, ebx
209
        jz      .next
802 serge 210
 
2434 Serge 211
        cmp     eax, ebx
212
        je      .found
3232 Serge 213
        add     edi, 8
2434 Serge 214
        jmp     @B
3232 Serge 215
  .next:
2434 Serge 216
        inc     [devfn]
217
        cmp     [devfn], 256
218
        jb      .next_dev
219
        mov     eax, [bus]
220
        inc     eax
221
        mov     [bus], eax
222
        cmp     eax, [last_bus]
223
        jna     .next_bus
224
        xor     eax, eax
225
        ret
3232 Serge 226
  .found:
802 serge 227
 
3232 Serge 228
     if DEBUG
229
        mov     esi, msgLoading
2434 Serge 230
        call    SysMsgBoardStr
802 serge 231
 
3232 Serge 232
        mov     esi, dword[edi+4]
2434 Serge 233
        call    SysMsgBoardStr
802 serge 234
 
3232 Serge 235
        mov     esi, msgNewline
2434 Serge 236
        call    SysMsgBoardStr
802 serge 237
     end if
238
 
3232 Serge 239
        stdcall GetService, dword[edi+4]
802 serge 240
 
2434 Serge 241
        ret
802 serge 242
 
3232 Serge 243
  .err:
802 serge 244
     if DEBUG
3232 Serge 245
        mov     esi, msgFail
2434 Serge 246
        call    SysMsgBoardStr
802 serge 247
     end if
248
 
2434 Serge 249
        xor     eax, eax
250
        ret
802 serge 251
 
252
endp
253
 
254
align 4
3232 Serge 255
devices dd (CTRL_ICH  shl 16)+VID_INTEL, intelac97
256
        dd (CTRL_ICH0 shl 16)+VID_INTEL, intelac97
257
        dd (CTRL_ICH2 shl 16)+VID_INTEL, intelac97
258
        dd (CTRL_ICH3 shl 16)+VID_INTEL, intelac97
259
        dd (CTRL_ICH4 shl 16)+VID_INTEL, intelac97
260
        dd (CTRL_ICH5 shl 16)+VID_INTEL, intelac97
261
        dd (CTRL_ICH6 shl 16)+VID_INTEL, intelac97
262
        dd (CTRL_ICH7 shl 16)+VID_INTEL, intelac97
802 serge 263
 
3232 Serge 264
        dd (CTRL_NFORCE  shl 16)+VID_NVIDIA, intelac97
265
        dd (CTRL_NFORCE2 shl 16)+VID_NVIDIA, intelac97
266
        dd (CTRL_NFORCE3 shl 16)+VID_NVIDIA, intelac97
267
        dd (CTRL_MCP04   shl 16)+VID_NVIDIA, intelac97
268
        dd (CTRL_CK804   shl 16)+VID_NVIDIA, intelac97
269
        dd (CTRL_CK8     shl 16)+VID_NVIDIA, intelac97
270
        dd (CTRL_CK8S    shl 16)+VID_NVIDIA, intelac97
271
        dd (CTRL_MCP51   shl 16)+VID_NVIDIA, intelac97
802 serge 272
 
3232 Serge 273
        dd (CTRL_VT82C686  shl 16)+VID_VIA, vt823x
274
        dd (CTRL_VT8233_5  shl 16)+VID_VIA, vt823x
802 serge 275
 
3232 Serge 276
        dd (CTRL_SIS  shl 16)+VID_SIS, sis
802 serge 277
 
3232 Serge 278
        dd (CTRL_FM801 shl 16)+VID_FM801, fm801
802 serge 279
 
3232 Serge 280
        dd (0x5000 shl 16)+0x1274, ensoniq
281
        dd (0x5880 shl 16)+0x1274, ensoniq
802 serge 282
 
3232 Serge 283
        dd (CTRL_CT0200 shl 16)+VID_CREATIVE, emu10k1x
284
; Intel
285
         dd (CTRL_INTEL_SCH2    shl 16)+VID_INTEL, intelhda
286
         dd (CTRL_INTEL_HPT     shl 16)+VID_INTEL, intelhda
287
         dd (CTRL_INTEL_CPT     shl 16)+VID_INTEL, intelhda
288
         dd (CTRL_INTEL_PGB     shl 16)+VID_INTEL, intelhda
289
         dd (CTRL_INTEL_PPT1    shl 16)+VID_INTEL, intelhda
290
         dd (CTRL_INTEL_82801F  shl 16)+VID_INTEL, intelhda
291
         dd (CTRL_INTEL_63XXESB shl 16)+VID_INTEL, intelhda
292
         dd (CTRL_INTEL_82801G  shl 16)+VID_INTEL, intelhda
293
         dd (CTRL_INTEL_82801H  shl 16)+VID_INTEL, intelhda
294
         dd (CTRL_INTEL_82801_UNK1  shl 16)+VID_INTEL, intelhda
295
         dd (CTRL_INTEL_82801I  shl 16)+VID_INTEL, intelhda
296
         dd (CTRL_INTEL_82801_UNK2  shl 16)+VID_INTEL, intelhda
297
         dd (CTRL_INTEL_82801JI shl 16)+VID_INTEL, intelhda
298
         dd (CTRL_INTEL_82801JD shl 16)+VID_INTEL, intelhda
299
         dd (CTRL_INTEL_PCH     shl 16)+VID_INTEL, intelhda
300
         dd (CTRL_INTEL_PCH2    shl 16)+VID_INTEL, intelhda
301
         dd (CTRL_INTEL_SCH     shl 16)+VID_INTEL, intelhda
302
         dd (CTRL_INTEL_LPT     shl 16)+VID_INTEL, intelhda
303
; Nvidia
304
         dd (CTRL_NVIDIA_MCP51    shl 16)+VID_NVIDIA, intelhda
305
         dd (CTRL_NVIDIA_MCP55    shl 16)+VID_NVIDIA, intelhda
306
         dd (CTRL_NVIDIA_MCP61_1  shl 16)+VID_NVIDIA, intelhda
307
         dd (CTRL_NVIDIA_MCP61_2  shl 16)+VID_NVIDIA, intelhda
308
         dd (CTRL_NVIDIA_MCP65_1  shl 16)+VID_NVIDIA, intelhda
309
         dd (CTRL_NVIDIA_MCP65_2  shl 16)+VID_NVIDIA, intelhda
310
         dd (CTRL_NVIDIA_MCP67_1  shl 16)+VID_NVIDIA, intelhda
311
         dd (CTRL_NVIDIA_MCP67_2  shl 16)+VID_NVIDIA, intelhda
312
         dd (CTRL_NVIDIA_MCP73_1  shl 16)+VID_NVIDIA, intelhda
313
         dd (CTRL_NVIDIA_MCP73_2  shl 16)+VID_NVIDIA, intelhda
314
         dd (CTRL_NVIDIA_MCP78_1  shl 16)+VID_NVIDIA, intelhda
315
         dd (CTRL_NVIDIA_MCP78_2  shl 16)+VID_NVIDIA, intelhda
316
         dd (CTRL_NVIDIA_MCP78_3  shl 16)+VID_NVIDIA, intelhda
317
         dd (CTRL_NVIDIA_MCP78_4  shl 16)+VID_NVIDIA, intelhda
318
         dd (CTRL_NVIDIA_MCP79_1  shl 16)+VID_NVIDIA, intelhda
319
         dd (CTRL_NVIDIA_MCP79_2  shl 16)+VID_NVIDIA, intelhda
320
         dd (CTRL_NVIDIA_MCP79_3  shl 16)+VID_NVIDIA, intelhda
321
         dd (CTRL_NVIDIA_MCP79_4  shl 16)+VID_NVIDIA, intelhda
322
         dd (CTRL_NVIDIA_0BE2     shl 16)+VID_NVIDIA, intelhda
323
         dd (CTRL_NVIDIA_0BE3     shl 16)+VID_NVIDIA, intelhda
324
         dd (CTRL_NVIDIA_0BE4     shl 16)+VID_NVIDIA, intelhda
325
         dd (CTRL_NVIDIA_GT100    shl 16)+VID_NVIDIA, intelhda
326
         dd (CTRL_NVIDIA_GT106    shl 16)+VID_NVIDIA, intelhda
327
         dd (CTRL_NVIDIA_GT108    shl 16)+VID_NVIDIA, intelhda
328
         dd (CTRL_NVIDIA_GT104    shl 16)+VID_NVIDIA, intelhda
329
         dd (CTRL_NVIDIA_GT116    shl 16)+VID_NVIDIA, intelhda
330
         dd (CTRL_NVIDIA_MCP89_1  shl 16)+VID_NVIDIA, intelhda
331
         dd (CTRL_NVIDIA_MCP89_2  shl 16)+VID_NVIDIA, intelhda
332
         dd (CTRL_NVIDIA_MCP89_3  shl 16)+VID_NVIDIA, intelhda
333
         dd (CTRL_NVIDIA_MCP89_4  shl 16)+VID_NVIDIA, intelhda
334
         dd (CTRL_NVIDIA_GF119    shl 16)+VID_NVIDIA, intelhda
335
         dd (CTRL_NVIDIA_GF110_1  shl 16)+VID_NVIDIA, intelhda
336
         dd (CTRL_NVIDIA_GF110_2  shl 16)+VID_NVIDIA, intelhda
337
; ATI
338
         dd (CTRL_ATI_SB450   shl 16)+VID_ATI, intelhda
339
         dd (CTRL_ATI_SB600   shl 16)+VID_ATI, intelhda
340
         dd (CTRL_ATI_RS600   shl 16)+VID_ATI, intelhda
341
         dd (CTRL_ATI_RS690   shl 16)+VID_ATI, intelhda
342
         dd (CTRL_ATI_RS780   shl 16)+VID_ATI, intelhda
343
         dd (CTRL_ATI_RS_UNK1 shl 16)+VID_ATI, intelhda
344
         dd (CTRL_ATI_R600    shl 16)+VID_ATI, intelhda
345
         dd (CTRL_ATI_RV610   shl 16)+VID_ATI, intelhda
346
         dd (CTRL_ATI_RV620   shl 16)+VID_ATI, intelhda
347
         dd (CTRL_ATI_RV630   shl 16)+VID_ATI, intelhda
348
         dd (CTRL_ATI_RV635   shl 16)+VID_ATI, intelhda
349
         dd (CTRL_ATI_RV670   shl 16)+VID_ATI, intelhda
350
         dd (CTRL_ATI_RV710   shl 16)+VID_ATI, intelhda
351
         dd (CTRL_ATI_RV730   shl 16)+VID_ATI, intelhda
352
         dd (CTRL_ATI_RV740   shl 16)+VID_ATI, intelhda
353
         dd (CTRL_ATI_RV770   shl 16)+VID_ATI, intelhda
354
; AMD
355
         dd (CTRL_AMD_HUDSON shl 16)+VID_AMD, intelhda
356
; VIA
357
         dd (CTRL_VIA_VT82XX shl 16)+VID_VIA, intelhda
358
         dd (CTRL_VIA_VT61XX shl 16)+VID_VIA, intelhda
359
         dd (CTRL_VIA_VT71XX shl 16)+VID_VIA, intelhda
360
; SiS
361
         dd (CTRL_SIS_966    shl 16)+VID_SIS, intelhda
362
; ULI
363
         dd (CTRL_ULI_M5461  shl 16)+VID_ULI, intelhda
364
; Teradici
365
         dd (CTRL_TERA_UNK1  shl 16)+VID_ULI, intelhda
366
; Creative
367
         dd (CTRL_CREATIVE_CA0110_IBG     shl 16)+VID_CREATIVE, intelhda
368
         dd (CTRL_CREATIVE_SOUND_CORE3D_1 shl 16)+VID_CREATIVE, intelhda
369
         dd (CTRL_CREATIVE_SOUND_CORE3D_2 shl 16)+VID_CREATIVE, intelhda
370
; RDC Semiconductor
371
         dd (CTRL_RDC_R3010  shl 16)+VID_RDC, intelhda
372
; VMware
373
         dd (CTRL_VMWARE_UNK1  shl 16)+VID_VMWARE, intelhda
802 serge 374
 
2434 Serge 375
        dd 0    ;terminator
802 serge 376
 
377
 
378
version      dd (5 shl 16) or (API_VERSION and 0xFFFF)
379
 
3232 Serge 380
intelac97       db 'INTELAC97', 0
381
vt823x          db 'VT823X', 0
382
sis             db 'SIS', 0
383
fm801           db 'FM801', 0
384
ensoniq         db 'ENSONIQ', 0
385
emu10k1x        db 'EMU10K1X', 0
386
intelhda        db 'INTEL_HDA', 0
802 serge 387
 
3232 Serge 388
msgInit         db 'Detecting hardware...',13,10,0
389
msgFail         db 'No compatible soundcard found!',13,10,0
390
msgLoading      db 'Loading ',0
391
msgNewline      db 13,10,0
802 serge 392
 
393
section '.data' data readable writable align 16