Subversion Repositories Kolibri OS

Rev

Rev 5077 | Rev 5170 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5077 Rev 5168
Line 11... Line 11...
11
        DEBUG = 1
11
        DEBUG = 1
Line 12... Line 12...
12
 
12
 
13
section '.flat' code readable writable executable
13
section '.flat' code readable writable executable
14
include '../proc32.inc'
14
include '../proc32.inc'
-
 
15
include '../struct.inc'
15
include '../struct.inc'
16
include '../pci.inc'
16
include '../macros.inc'
17
include '../macros.inc'
Line 17... Line 18...
17
include '../peimport.inc'
18
include '../peimport.inc'
18
 
19
 
Line 202... Line 203...
202
        xor     eax, eax
203
        xor     eax, eax
203
        mov     [bus], eax
204
        mov     [bus], eax
204
        inc     eax
205
        inc     eax
205
        invoke  PciApi
206
        invoke  PciApi
206
        cmp     eax, -1
207
        cmp     eax, -1
207
        je      .err
208
        je      .no_pci
Line 208... Line 209...
208
 
209
 
Line 209... Line 210...
209
        mov     [last_bus], eax
210
        mov     [last_bus], eax
210
 
211
 
211
  .next_bus:
212
  .next_bus:
212
        and     [devfn], 0
213
        and     [devfn], 0
213
  .next_dev:
214
  .next_dev:
214
        invoke  PciRead32, [bus], [devfn], dword 0
215
        invoke  PciRead32, [bus], [devfn], PCI_header.vendor_id
215
        test    eax, eax
216
        test    eax, eax
216
        jz      .next
217
        jz      .next
Line 225... Line 226...
225
 
226
 
226
        cmp     eax, ebx
227
        cmp     eax, ebx
227
        je      .found
228
        je      .found
228
        add     edi, 8
229
        add     edi, 8
-
 
230
        jmp     @B
229
        jmp     @B
231
 
-
 
232
  .next:
-
 
233
        test    [devfn], 7
-
 
234
        jnz     .next_fn
-
 
235
        invoke  PciRead32, [bus], [devfn], PCI_header.header_type
-
 
236
        test    al, al
-
 
237
        js      .next_fn
-
 
238
        or      [devfn], 7
-
 
239
 
230
  .next:
240
  .next_fn:
231
        inc     [devfn]
241
        inc     [devfn]
232
        cmp     [devfn], 256
242
        cmp     [devfn], 256
233
        jb      .next_dev
243
        jb      .next_dev
234
        mov     eax, [bus]
244
        mov     eax, [bus]
235
        inc     eax
245
        inc     eax
236
        mov     [bus], eax
246
        mov     [bus], eax
237
        cmp     eax, [last_bus]
247
        cmp     eax, [last_bus]
238
        jna     .next_bus
-
 
239
        xor     eax, eax
-
 
240
        ret
-
 
Line -... Line 248...
-
 
248
        jna     .next_bus
241
  .found:
249
 
-
 
250
  .no_pci:
-
 
251
     if DEBUG
-
 
252
        mov     esi, msgFail
242
 
253
        invoke  SysMsgBoardStr
243
     if DEBUG
254
 
Line 244... Line 255...
244
        mov     esi, msgLoading
255
        mov     esi, msgLoading
245
        invoke  SysMsgBoardStr
256
        invoke  SysMsgBoardStr
Line 246... Line 257...
246
 
257
 
247
        mov     esi, dword[edi+4]
258
        mov     esi, sb16
248
        invoke  SysMsgBoardStr
259
        invoke  SysMsgBoardStr
Line 249... Line 260...
249
 
260
 
250
        mov     esi, msgNewline
261
        mov     esi, msgNewline
251
        invoke  SysMsgBoardStr
262
        invoke  SysMsgBoardStr
Line 252... Line 263...
252
     end if
263
     end if
253
 
264
 
254
        invoke  GetService, dword[edi+4]
265
        invoke  GetService, sb16
Line 255... Line 266...
255
        test    eax, eax
266
        test    eax, eax
256
        jz      .err
267
        jz      .fail
257
 
268
 
-
 
269
        mov     edx, [eax+SRV.entry]
-
 
270
        mov     [srv_entry], edx
-
 
271
        ret
-
 
272
 
-
 
273
  .found:
-
 
274
     if DEBUG
258
        mov     edx, [eax+SRV.entry]
275
        mov     esi, msgLoading
259
        mov     [srv_entry], edx
276
        invoke  SysMsgBoardStr
Line -... Line 277...
-
 
277
 
-
 
278
        mov     esi, dword[edi+4]
-
 
279
        invoke  SysMsgBoardStr
-
 
280
 
-
 
281
        mov     esi, msgNewline
-
 
282
        invoke  SysMsgBoardStr
-
 
283
     end if
-
 
284
 
-
 
285
        invoke  GetService, dword[edi+4]
260
        ret
286
        test    eax, eax
261
 
287
        jz      .next
Line 262... Line 288...
262
  .err:
288
 
Line 401... Line 427...
401
sis             db 'SIS', 0
427
sis             db 'SIS', 0
402
fm801           db 'FM801', 0
428
fm801           db 'FM801', 0
403
ensoniq         db 'ENSONIQ', 0
429
ensoniq         db 'ENSONIQ', 0
404
emu10k1x        db 'EMU10K1X', 0
430
emu10k1x        db 'EMU10K1X', 0
405
intelhda        db 'INTEL_HDA', 0
431
intelhda        db 'INTEL_HDA', 0
-
 
432
sb16            db 'SB16', 0
Line 406... Line 433...
406
 
433
 
407
msgInit         db 'Detecting hardware...',13,10,0
434
msgInit         db 'Detecting hardware...',13,10,0
408
msgFail         db 'No compatible soundcard found!',13,10,0
435
msgFail         db 'No compatible PCI soundcard found!',13,10,0
409
msgLoading      db 'Loading ',0
436
msgLoading      db 'Loading ',0
Line 410... Line 437...
410
msgNewline      db 13,10,0
437
msgNewline      db 13,10,0
411
 
438