Fix for r.3762 - separate interrupt handlers for the irq14 and irq15.

git-svn-id: svn://kolibrios.org@3870 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2013-08-23 23:22:21 +00:00
parent 5c89df1f48
commit f3bb0969f5
2 changed files with 94 additions and 21 deletions

View File

@ -722,17 +722,20 @@ wait_for_sector_dma_ide0:
align 4 align 4
.wait: .wait:
call change_task call change_task
cmp [IDE_common_irq_param], irq14_num cmp [IDE_common_irq_param], 0
jnz .done jz .done
call check_hd_wait_timeout call check_hd_wait_timeout
cmp [hd_error], 0 cmp [hd_error], 0
jz .wait jz .wait
pushfd
cli
mov [IDE_common_irq_param], 0 mov [IDE_common_irq_param], 0
mov dx, [IDEContrRegsBaseAddr] mov dx, [IDEContrRegsBaseAddr]
mov al, 0 mov al, 0
out dx, al out dx, al
popfd
.done: .done:
pop edx pop edx
pop eax pop eax
@ -747,18 +750,21 @@ wait_for_sector_dma_ide1:
align 4 align 4
.wait: .wait:
call change_task call change_task
cmp [IDE_common_irq_param], irq15_num cmp [IDE_common_irq_param], 0
jnz .done jz .done
call check_hd_wait_timeout call check_hd_wait_timeout
cmp [hd_error], 0 cmp [hd_error], 0
jz .wait jz .wait
pushfd
cli
mov [IDE_common_irq_param], 0 mov [IDE_common_irq_param], 0
mov dx, [IDEContrRegsBaseAddr] mov dx, [IDEContrRegsBaseAddr]
add dx, 8 add dx, 8
mov al, 0 mov al, 0
out dx, al out dx, al
popfd
.done: .done:
pop edx pop edx
pop eax pop eax
@ -791,33 +797,72 @@ allow_dma_access db 0
endg endg
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
align 4 align 4
IDE_irq_14_handler:
cmp [IDE_common_irq_param], irq14_num
jne .exit
pushfd
cli
pushad
mov [IDE_common_irq_param], 0
mov dx, [IDEContrRegsBaseAddr]
mov al, 0
out dx, al
popad
popfd
.exit:
mov al, 1
ret
;-----------------------------------------------------------------------------
align 4
IDE_irq_15_handler:
cmp [IDE_common_irq_param], irq15_num
jne .exit
pushfd
cli
pushad
mov [IDE_common_irq_param], 0
mov dx, [IDEContrRegsBaseAddr]
add dx, 8
mov al, 0
out dx, al
popad
popfd
.exit:
mov al, 1
ret
;-----------------------------------------------------------------------------
align 4
IDE_common_irq_handler: IDE_common_irq_handler:
cmp [IDE_common_irq_param], 0
je .exit
pushfd pushfd
cli cli
pushad pushad
xor ebx, ebx xor ebx, ebx
mov eax, IDE_common_irq_param
cmp [eax], irq15_num
mov [eax], ebx
je @f
;--------------------------------------
mov dx, [IDEContrRegsBaseAddr] mov dx, [IDEContrRegsBaseAddr]
mov al, 0 mov eax, IDE_common_irq_param
out dx, al cmp [eax], irq14_num
jmp .end mov [eax], bl
xor eax, eax
je @f
add dx, 8
;-------------------------------------- ;--------------------------------------
align 4 align 4
@@: @@:
mov dx, [IDEContrRegsBaseAddr]
add dx, 8
mov al, 0
out dx, al out dx, al
;--------------------------------------
align 4
.end:
popad popad
popfd popfd
.exit:
mov al, 1 mov al, 1
ret ret
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
@ -849,10 +894,12 @@ hd_read_dma:
pop eax pop eax
ret ret
.notread: .notread:
; set data for PRD Table
mov eax, IDE_descriptor_table mov eax, IDE_descriptor_table
mov dword [eax], IDE_DMA mov dword [eax], IDE_DMA
mov word [eax+4], 0x2000 mov word [eax+4], 0x2000
sub eax, OS_BASE sub eax, OS_BASE
; select controller Primary or Secondary
mov dx, [IDEContrRegsBaseAddr] mov dx, [IDEContrRegsBaseAddr]
push eax push eax
mov eax, [hd_address_table] mov eax, [hd_address_table]
@ -862,13 +909,21 @@ hd_read_dma:
add edx, 8 add edx, 8
@@: @@:
push edx push edx
; Bus Master IDE PRD Table Address
add edx, 4 add edx, 4
; save IDE_descriptor_table
out dx, eax out dx, eax
pop edx pop edx
; clear Bus Master IDE Command register
mov al, 0 mov al, 0
out dx, al out dx, al
; set write to memory
; mov al, 8 ; 1000b
; out dx, al
; clear Bus Master IDE Status register
; clear Error bit and Interrupt bit
add edx, 2 add edx, 2
mov al, 6 mov al, 6 ; 110b
out dx, al out dx, al
; Select the desired drive ; Select the desired drive
@ -958,18 +1013,23 @@ hd_read_dma:
out dx, al ; ATACommand регистр команд out dx, al ; ATACommand регистр команд
;-------------------------------------- ;--------------------------------------
.continue: .continue:
; select controller Primary or Secondary
mov dx, [IDEContrRegsBaseAddr] mov dx, [IDEContrRegsBaseAddr]
mov eax, [hd_address_table] mov eax, [hd_address_table]
cmp [hdbase], eax ; 0x1F0 cmp [hdbase], eax ; 0x1F0
jz @f jz @f
add dx, 8 add dx, 8
@@: @@:
; set write to memory and Start Bus Master
mov al, 9 mov al, 9
out dx, al out dx, al
mov eax, [CURRENT_TASK] mov eax, [CURRENT_TASK]
mov [dma_process], eax mov [dma_process], eax
mov eax, [TASK_BASE] mov eax, [TASK_BASE]
mov [dma_slot_ptr], eax mov [dma_slot_ptr], eax
mov eax, [hd_address_table] mov eax, [hd_address_table]
cmp [hdbase], eax ; 0x1F0 cmp [hdbase], eax ; 0x1F0
jnz .ide1 jnz .ide1
@ -980,6 +1040,7 @@ hd_read_dma:
mov [IDE_common_irq_param], irq15_num mov [IDE_common_irq_param], irq15_num
@@: @@:
popfd popfd
; wait for interrupt
mov eax, [hd_address_table] mov eax, [hd_address_table]
cmp [hdbase], eax ; 0x1F0 cmp [hdbase], eax ; 0x1F0
jnz .wait_ide1 jnz .wait_ide1

View File

@ -1112,6 +1112,18 @@ if preboot_blogesc
jne .bll1 jne .bll1
end if end if
push eax edx
mov dx, [IDEContrRegsBaseAddr]
xor eax, eax
add dx, 2
in al, dx
DEBUGF 1, "K : Primary Bus Master IDE Status Register %x\n", eax
add dx, 8
in al, dx
DEBUGF 1, "K : Secondary Bus Master IDE Status Register %x\n", eax
pop edx eax
cmp [IDEContrRegsBaseAddr], 0 cmp [IDEContrRegsBaseAddr], 0
setnz [dma_hdd] setnz [dma_hdd]
@ -1142,9 +1154,9 @@ set_interrupts_for_IDE_controllers:
cmp [IDEContrRegsBaseAddr], 0 cmp [IDEContrRegsBaseAddr], 0
je .end_set_interrupts je .end_set_interrupts
stdcall attach_int_handler, 14, IDE_common_irq_handler, 0 stdcall attach_int_handler, 14, IDE_irq_14_handler, 0
DEBUGF 1, "K : Set IDE IRQ14 return code %x\n", eax DEBUGF 1, "K : Set IDE IRQ14 return code %x\n", eax
stdcall attach_int_handler, 15, IDE_common_irq_handler, 0 stdcall attach_int_handler, 15, IDE_irq_15_handler, 0
DEBUGF 1, "K : Set IDE IRQ15 return code %x\n", eax DEBUGF 1, "K : Set IDE IRQ15 return code %x\n", eax
jmp .enable_IDE_interrupt jmp .enable_IDE_interrupt
;-------------------------------------- ;--------------------------------------