fix pci irq's

git-svn-id: svn://kolibrios.org@2015 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2011-07-24 07:26:00 +00:00
parent e338e5353f
commit d75c968b8e
5 changed files with 83 additions and 5 deletions

View File

@ -652,3 +652,47 @@ sys_pcibios:
.return_a: .return_a:
mov dword[esp + 32], eax mov dword[esp + 32], eax
ret ret
align 4
pci_irq_fixup:
push ebp
stdcall load_file, dev_data_path
test eax, eax
jz .fail
push eax
mov esi, eax
lea edi, [eax+ebx]
.iterate:
cmp esi, edi
jae .done
mov eax, [esi]
cmp eax, -1
je .done
movzx ebx, al
movzx ebp, ah
stdcall pci_read32, ebp, ebx, 0
cmp eax, [esi+4]
jne .skip
mov eax, [esi+8]
stdcall pci_write8, ebp, ebx, 0x3C, eax
.skip:
add esi, 16
jmp .iterate
.done:
call kernel_free ;and pop file base from stack
.fail:
pop ebp
ret

View File

@ -114,6 +114,7 @@ vmode db '/sys/drivers/VMODE.MDR',0
vrr_m db 'VRR_M',0 vrr_m db 'VRR_M',0
kernel_file db 'KERNEL MNT' kernel_file db 'KERNEL MNT'
dev_data_path db '/RD/1/DRIVERS/DEVICES.DAT',0
align 4 align 4

View File

@ -334,7 +334,37 @@ proc START stdcall, state:dword
mov esi, msgDone mov esi, msgDone
call SysMsgBoardStr call SysMsgBoardStr
stdcall AttachIntHandler, 17, ac97_irq, dword 0 if IRQ_REMAP
pushf
cli
mov ebx, [ctrl.int_line]
in al, 0xA1
mov ah, al
in al, 0x21
test ebx, ebx
jz .skip
bts ax, bx ;mask old line
.skip
bts ax, IRQ_LINE ;mask new ine
out 0x21, al
mov al, ah
out 0xA1, al
;remap IRQ
stdcall PciWrite8, 0, 0xF8, 0x61, IRQ_LINE
mov dx, 0x4d0 ;8259 ELCR1
in al, dx
bts ax, IRQ_LINE
out dx, al ;set level-triggered mode
mov [ctrl.int_line], IRQ_LINE
popf
mov esi, msgRemap
call SysMsgBoardStr
end if
mov ebx, [ctrl.int_line]
stdcall AttachIntHandler, ebx, ac97_irq, dword 0
.reg: .reg:
stdcall RegService, sz_sound_srv, service_proc stdcall RegService, sz_sound_srv, service_proc
ret ret
@ -511,7 +541,7 @@ proc ac97_irq
stdcall [ctrl.user_callback], ebx stdcall [ctrl.user_callback], ebx
.done: .done:
pop eax pop eax
and eax, 0x40 ; and eax, 0x40
mov edx, CTRL_STAT mov edx, CTRL_STAT
call [ctrl.ctrl_write32] call [ctrl.ctrl_write32]
ret ret

View File

@ -306,6 +306,7 @@ mouse._.left_button_release_handler: ;/////////////////////////////////////////
call sys_window_end_moving_handler call sys_window_end_moving_handler
.exit: .exit:
and [mouse.active_sys_window.action], 0
ret ret
align 4 align 4

View File

@ -563,7 +563,7 @@ high_code:
mov edi, irq_tab mov edi, irq_tab
xor eax, eax xor eax, eax
mov ecx, 16 mov ecx, IRQ_RESERVE
rep stosd rep stosd
;Set base of graphic segment to linear address of LFB ;Set base of graphic segment to linear address of LFB
@ -613,6 +613,8 @@ high_code:
; Try to Initialize APIC ; Try to Initialize APIC
call APIC_init call APIC_init
call pci_irq_fixup
; Enable timer IRQ (IRQ0) and hard drives IRQs (IRQ14, IRQ15) ; Enable timer IRQ (IRQ0) and hard drives IRQs (IRQ14, IRQ15)
; they are used: when partitions are scanned, hd_read relies on timer ; they are used: when partitions are scanned, hd_read relies on timer
call unmask_timer call unmask_timer