Rev 565 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 565 | Rev 566 | ||
---|---|---|---|
Line 12... | Line 12... | ||
12 | include 'imports.inc' |
12 | include 'imports.inc' |
Line 13... | Line 13... | ||
13 | 13 | ||
Line 14... | Line 14... | ||
14 | API_VERSION equ 0x01000100 |
14 | API_VERSION equ 0x01000100 |
- | 15 | ||
Line -... | Line 16... | ||
- | 16 | DEBUG equ 1 |
|
15 | 17 | DEBUG_IRQ equ 0 |
|
16 | DEBUG equ 1 |
18 | |
Line -... | Line 19... | ||
- | 19 | USE_COM_IRQ equ 0 ;make irq 3 and irq 4 available for PCI devices |
|
17 | 20 | IRQ_REMAP equ 0 |
|
18 | REMAP_IRQ equ 0 |
21 | IRQ_LINE equ 0 |
19 | IRQ_LINE equ 0 |
22 | |
20 | 23 | ||
Line -... | Line 24... | ||
- | 24 | ;irq 0,1,2,8,12,13 íåäîñòóïíû |
|
- | 25 | ; FEDCBA9876543210 |
|
- | 26 | VALID_IRQ equ 1100111011111000b |
|
Line 21... | Line 27... | ||
21 | ;irq 0,1,2,8,12,13 íåäîñòóïíû |
27 | ATTCH_IRQ equ 0000111010100000b |
Line 22... | Line 28... | ||
22 | ; FEDCBA9876543210 |
28 | |
23 | VALID_IRQ equ 1100111011111000b |
29 | if USE_COM_IRQ |
Line 312... | Line 318... | ||
312 | 318 | ||
313 | call init_controller |
319 | call init_controller |
314 | test eax, eax |
320 | test eax, eax |
Line 315... | Line -... | ||
315 | jz .fail |
- | |
316 | - | ||
317 | ; if DEBUG |
- | |
318 | ; mov esi, msgInitCodec |
- | |
319 | ; call SysMsgBoardStr |
- | |
320 | ; end if |
321 | jz .fail |
321 | 322 | ||
322 | call init_codec |
323 | call init_codec |
Line 323... | Line 324... | ||
323 | test eax, eax |
324 | test eax, eax |
324 | jz .fail |
325 | jz .fail |
Line 325... | Line 326... | ||
325 | 326 | ||
326 | call reset_controller |
327 | call reset_controller |
327 | call setup_codec |
- | |
328 | 328 | call setup_codec |
|
- | 329 | ||
- | 330 | mov esi, msgPrimBuff |
|
- | 331 | call SysMsgBoardStr |
|
- | 332 | call create_primary_buff |
|
- | 333 | mov esi, msgDone |
|
- | 334 | call SysMsgBoardStr |
|
- | 335 | ||
- | 336 | if IRQ_REMAP |
|
- | 337 | pushf |
|
- | 338 | cli |
|
- | 339 | ||
- | 340 | mov ebx, [ctrl.int_line] |
|
- | 341 | in al, 0xA1 |
|
- | 342 | mov ah, al |
|
- | 343 | in al, 0x21 |
|
- | 344 | test ebx, ebx |
|
- | 345 | jz .skip |
|
- | 346 | bts ax, bx |
|
- | 347 | .skip |
|
Line 329... | Line 348... | ||
329 | mov esi, msgPrimBuff |
348 | bts ax, IRQ_LINE |
Line -... | Line 349... | ||
- | 349 | out 0x21, al |
|
- | 350 | mov al, ah |
|
330 | call SysMsgBoardStr |
351 | out 0xA1, al |
- | 352 | ||
331 | 353 | stdcall PciWrite8, 0, 0xF8, 0x61, IRQ_LINE |
|
332 | call create_primary_buff |
354 | |
333 | 355 | mov dx, 0x4d0 |
|
334 | if REMAP_IRQ |
356 | in al, dx |
335 | 357 | bts ax, IRQ_LINE |
|
Line 336... | Line 358... | ||
336 | ; call get_LPC_bus ;ïðîâåðêà íà èíòåëëîâñêèé ÷èïñåò |
358 | out dx, al |
337 | ; cmp eax, -1 ;ìîæíî ïðîïóñòèòü |
359 | mov [ctrl.int_line], IRQ_LINE |
338 | ; jz .fail |
360 | popf |
Line 448... | Line 470... | ||
448 | restore input |
470 | restore input |
449 | restore inp_size |
471 | restore inp_size |
450 | restore output |
472 | restore output |
451 | restore out_size |
473 | restore out_size |
Line 452... | Line -... | ||
452 | - | ||
453 | - | ||
454 | align 4 |
- | |
455 | proc remap_irq ;for Intel chipsets ONLY !!! |
- | |
456 | mov eax, VALID_IRQ |
- | |
457 | bt eax, IRQ_LINE |
- | |
458 | jnc .exit |
- | |
459 | - | ||
460 | mov edx, 0x4D0 |
- | |
461 | in ax,dx |
- | |
462 | bts ax, IRQ_LINE |
- | |
463 | out dx, aX |
- | |
464 | - | ||
465 | stdcall PciWrite8, dword 0, dword 0xF8, dword 0x61, dword IRQ_LINE |
- | |
466 | mov [ctrl.int_line], IRQ_LINE |
- | |
467 | - | ||
468 | .exit: |
- | |
469 | ret |
- | |
470 | endp |
- | |
471 | 474 | ||
472 | align 4 |
475 | align 4 |
Line 473... | Line 476... | ||
473 | proc ac97_irq |
476 | proc ac97_irq |
474 | 477 | ||
475 | ; if DEBUG |
478 | if DEBUG_IRQ |
476 | ; mov esi, msgIRQ |
479 | mov esi, msgIRQ |
Line 477... | Line 480... | ||
477 | ; call SysMsgBoardStr |
480 | call SysMsgBoardStr |
478 | ; end if |
481 | end if |
479 | 482 | ||
Line 684... | Line 687... | ||
684 | mov [ctrl.vendor_ids], eax ;something wrong ? |
687 | mov [ctrl.vendor_ids], eax ;something wrong ? |
685 | ret |
688 | ret |
686 | endp |
689 | endp |
Line 687... | Line 690... | ||
687 | 690 | ||
688 | align 4 |
- | |
689 | proc get_LPC_bus ;for Intel chipsets ONLY !!! |
- | |
690 | locals |
- | |
691 | last_bus dd ? |
- | |
692 | bus dd ? |
- | |
693 | endl |
- | |
694 | - | ||
695 | xor eax, eax |
- | |
696 | mov [bus], eax |
- | |
697 | inc eax |
- | |
698 | call PciApi |
- | |
699 | cmp eax, -1 |
- | |
700 | je .err |
- | |
701 | - | ||
702 | mov [last_bus], eax |
- | |
703 | .next_bus: |
- | |
704 | stdcall PciRead32, [bus], dword 0xF8, dword 0 |
- | |
705 | test eax, eax |
- | |
706 | jz .next |
- | |
707 | cmp eax, -1 |
- | |
708 | je .next |
- | |
709 | - | ||
710 | cmp eax, 0x24D08086 |
- | |
711 | je .found |
- | |
712 | .next: |
- | |
713 | mov eax, [bus] |
- | |
714 | inc eax |
- | |
715 | cmp eax, [last_bus] |
- | |
716 | mov [bus], eax |
- | |
717 | jna .next_bus |
- | |
718 | .err: |
- | |
719 | xor eax, eax |
- | |
720 | dec eax |
- | |
721 | ret |
- | |
722 | .found: |
- | |
723 | mov eax, [bus] |
- | |
724 | ret |
- | |
725 | endp |
- | |
726 | - | ||
727 | align 4 |
691 | align 4 |
Line 728... | Line 692... | ||
728 | proc init_controller |
692 | proc init_controller |
729 | 693 | ||
730 | stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 4 |
694 | stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 4 |
Line 783... | Line 747... | ||
783 | mov [ctrl.ctrl_mem_base], eax |
747 | mov [ctrl.ctrl_mem_base], eax |
Line 784... | Line 748... | ||
784 | 748 | ||
785 | call dword2str |
749 | call dword2str |
Line -... | Line 750... | ||
- | 750 | call SysMsgBoardStr |
|
- | 751 | ||
- | 752 | ;;patch for some ugly BIOS |
|
- | 753 | cmp [ctrl.vendor], VID_INTEL |
|
- | 754 | jne .default |
|
- | 755 | ||
- | 756 | mov esi, msgIrqMap |
|
- | 757 | call SysMsgBoardStr |
|
- | 758 | stdcall PciRead8, 0, 0xF8, 0x61 |
|
- | 759 | and eax, 0xFF |
|
- | 760 | call dword2str |
|
- | 761 | call SysMsgBoardStr |
|
- | 762 | btr eax, 7 ;when bit 7 set remap disabled |
|
- | 763 | jnc @F |
|
- | 764 | xor eax, eax |
|
786 | call SysMsgBoardStr |
765 | jmp @F |
787 | 766 | .default: |
|
- | 767 | stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C |
|
788 | stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C |
768 | and eax, 0xFF |
Line 789... | Line 769... | ||
789 | and eax, 0xFF |
769 | @@: |
790 | mov [ctrl.int_line], eax |
770 | mov [ctrl.int_line], eax |
791 | 771 | ||
Line 1464... | Line 1444... | ||
1464 | msgAttchIRQ db 'IRQ line not supported', 13,10, 0 |
1444 | msgAttchIRQ db 'IRQ line not supported', 13,10, 0 |
1465 | msgInvIRQ db 'IRQ line not assigned or invalid', 13,10, 0 |
1445 | msgInvIRQ db 'IRQ line not assigned or invalid', 13,10, 0 |
1466 | msgPlay db 'start play', 13,10,0 |
1446 | msgPlay db 'start play', 13,10,0 |
1467 | msgStop db 'stop play', 13,10,0 |
1447 | msgStop db 'stop play', 13,10,0 |
1468 | ;msgNotify db 'call notify',13,10,0 |
1448 | ;msgNotify db 'call notify',13,10,0 |
1469 | ;msgIRQ db 'AC97 IRQ', 13,10,0 |
1449 | msgIRQ db 'AC97 IRQ', 13,10,0 |
1470 | msgInitCtrl db 'init controller',13,10,0 |
1450 | msgInitCtrl db 'init controller',13,10,0 |
1471 | ;msgInitCodec db 'init codec',13,10,0 |
1451 | ;msgInitCodec db 'init codec',13,10,0 |
1472 | msgPrimBuff db 'create primary buffer',13,10,0 |
1452 | msgPrimBuff db 'create primary buffer ...',0 |
- | 1453 | msgDone db 'done',13,10,0 |
|
- | 1454 | msgRemap db 'Remap IRQ',13,10,0 |
|
- | 1455 | msgIrqMap db 'irq remap ',0 |
|
1473 | ;msgReg db 'set service handler',13,10,0 |
1456 | ;msgReg db 'set service handler',13,10,0 |
1474 | msgOk db 'service installed',13,10,0 |
1457 | msgOk db 'service installed',13,10,0 |
1475 | msgCold db 'cold reset',13,10,0 |
1458 | msgCold db 'cold reset',13,10,0 |
1476 | msgWarm db 'warm reset',13,10,0 |
1459 | msgWarm db 'warm reset',13,10,0 |
1477 | msgWRFail db 'warm reset failed',13,10,0 |
1460 | msgWRFail db 'warm reset failed',13,10,0 |