forked from KolibriOS/kolibrios
HDD IDE DMA handler - remove the interrupt flag
git-svn-id: svn://kolibrios.org@3881 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
dfbe7a6039
commit
657905b212
@ -536,7 +536,6 @@ cache_write_pio:
|
|||||||
inc edx
|
inc edx
|
||||||
mov al, 30h ; WRITE SECTOR(S)
|
mov al, 30h ; WRITE SECTOR(S)
|
||||||
out dx, al ; ATACommand регистр команд
|
out dx, al ; ATACommand регистр команд
|
||||||
popfd
|
|
||||||
jmp .continue
|
jmp .continue
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
.lba48:
|
.lba48:
|
||||||
@ -576,9 +575,9 @@ cache_write_pio:
|
|||||||
inc edx
|
inc edx
|
||||||
mov al, 34h ; WRITE SECTOR(S) EXT
|
mov al, 34h ; WRITE SECTOR(S) EXT
|
||||||
out dx, al ; ATACommand регистр команд
|
out dx, al ; ATACommand регистр команд
|
||||||
popfd
|
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
.continue:
|
.continue:
|
||||||
|
popfd
|
||||||
call wait_for_sector_buffer
|
call wait_for_sector_buffer
|
||||||
|
|
||||||
cmp [hd_error], 0
|
cmp [hd_error], 0
|
||||||
@ -728,7 +727,7 @@ align 4
|
|||||||
call check_hd_wait_timeout
|
call check_hd_wait_timeout
|
||||||
cmp [hd_error], 0
|
cmp [hd_error], 0
|
||||||
jz .wait
|
jz .wait
|
||||||
|
; clear Bus Master IDE Command register
|
||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
mov [IDE_common_irq_param], 0
|
mov [IDE_common_irq_param], 0
|
||||||
@ -736,6 +735,8 @@ align 4
|
|||||||
mov al, 0
|
mov al, 0
|
||||||
out dx, al
|
out dx, al
|
||||||
popfd
|
popfd
|
||||||
|
;--------------------------------------
|
||||||
|
align 4
|
||||||
.done:
|
.done:
|
||||||
pop edx
|
pop edx
|
||||||
pop eax
|
pop eax
|
||||||
@ -756,7 +757,7 @@ align 4
|
|||||||
call check_hd_wait_timeout
|
call check_hd_wait_timeout
|
||||||
cmp [hd_error], 0
|
cmp [hd_error], 0
|
||||||
jz .wait
|
jz .wait
|
||||||
|
; clear Bus Master IDE Command register
|
||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
mov [IDE_common_irq_param], 0
|
mov [IDE_common_irq_param], 0
|
||||||
@ -765,6 +766,8 @@ align 4
|
|||||||
mov al, 0
|
mov al, 0
|
||||||
out dx, al
|
out dx, al
|
||||||
popfd
|
popfd
|
||||||
|
;--------------------------------------
|
||||||
|
align 4
|
||||||
.done:
|
.done:
|
||||||
pop edx
|
pop edx
|
||||||
pop eax
|
pop eax
|
||||||
@ -804,14 +807,21 @@ IDE_irq_14_handler:
|
|||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
pushad
|
pushad
|
||||||
|
; clear Bus Master IDE Command register
|
||||||
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
|
||||||
|
; clear Bus Master IDE Status register
|
||||||
|
; clear Interrupt bit
|
||||||
|
add edx, 2
|
||||||
|
mov al, 4 ; 100b
|
||||||
|
out dx, al
|
||||||
|
|
||||||
popad
|
popad
|
||||||
popfd
|
popfd
|
||||||
|
;--------------------------------------
|
||||||
|
align 4
|
||||||
.exit:
|
.exit:
|
||||||
mov al, 1
|
mov al, 1
|
||||||
ret
|
ret
|
||||||
@ -824,15 +834,22 @@ IDE_irq_15_handler:
|
|||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
pushad
|
pushad
|
||||||
|
; clear Bus Master IDE Command register
|
||||||
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
|
||||||
|
; clear Bus Master IDE Status register
|
||||||
|
; clear Interrupt bit
|
||||||
|
add edx, 2
|
||||||
|
mov al, 4 ; 100b
|
||||||
|
out dx, al
|
||||||
|
|
||||||
popad
|
popad
|
||||||
popfd
|
popfd
|
||||||
|
;--------------------------------------
|
||||||
|
align 4
|
||||||
.exit:
|
.exit:
|
||||||
mov al, 1
|
mov al, 1
|
||||||
ret
|
ret
|
||||||
@ -845,7 +862,7 @@ IDE_common_irq_handler:
|
|||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
pushad
|
pushad
|
||||||
|
; clear Bus Master IDE Command register
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
mov dx, [IDEContrRegsBaseAddr]
|
mov dx, [IDEContrRegsBaseAddr]
|
||||||
mov eax, IDE_common_irq_param
|
mov eax, IDE_common_irq_param
|
||||||
@ -859,9 +876,16 @@ IDE_common_irq_handler:
|
|||||||
align 4
|
align 4
|
||||||
@@:
|
@@:
|
||||||
out dx, al
|
out dx, al
|
||||||
|
; clear Bus Master IDE Status register
|
||||||
|
; clear Interrupt bit
|
||||||
|
add edx, 2
|
||||||
|
mov al, 4 ; 100b
|
||||||
|
out dx, al
|
||||||
|
|
||||||
popad
|
popad
|
||||||
popfd
|
popfd
|
||||||
|
;--------------------------------------
|
||||||
|
align 4
|
||||||
.exit:
|
.exit:
|
||||||
mov al, 1
|
mov al, 1
|
||||||
ret
|
ret
|
||||||
@ -917,15 +941,11 @@ hd_read_dma:
|
|||||||
; clear Bus Master IDE Command register
|
; 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 Bus Master IDE Status register
|
||||||
; clear Error bit and Interrupt bit
|
; clear Error bit and Interrupt bit
|
||||||
add edx, 2
|
add edx, 2
|
||||||
mov al, 6 ; 110b
|
mov al, 6 ; 110b
|
||||||
out dx, al
|
out dx, al
|
||||||
|
|
||||||
; Select the desired drive
|
; Select the desired drive
|
||||||
mov edx, [hdbase]
|
mov edx, [hdbase]
|
||||||
add edx, 6 ; адрес регистра головок
|
add edx, 6 ; адрес регистра головок
|
||||||
@ -1059,8 +1079,9 @@ hd_read_dma:
|
|||||||
jmp hd_read_dma
|
jmp hd_read_dma
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
cache_write_dma:
|
cache_write_dma:
|
||||||
mov eax, [cache_chain_ptr]
|
mov eax, [cache_chain_ptr] ; for what?
|
||||||
push esi
|
push esi
|
||||||
|
; set data for PRD Table
|
||||||
mov eax, IDE_descriptor_table
|
mov eax, IDE_descriptor_table
|
||||||
mov edx, eax
|
mov edx, eax
|
||||||
pusha
|
pusha
|
||||||
@ -1074,6 +1095,7 @@ cache_write_dma:
|
|||||||
rep movsd
|
rep movsd
|
||||||
popa
|
popa
|
||||||
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]
|
||||||
@ -1083,15 +1105,19 @@ cache_write_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
|
||||||
|
; clear Bus Master IDE Status register
|
||||||
|
; clear Error bit and Interrupt bit
|
||||||
add edx, 2
|
add edx, 2
|
||||||
mov al, 6
|
mov al, 6
|
||||||
out dx, al
|
out dx, al
|
||||||
|
|
||||||
; Select the desired drive
|
; Select the desired drive
|
||||||
mov edx, [hdbase]
|
mov edx, [hdbase]
|
||||||
add edx, 6 ; адрес регистра головок
|
add edx, 6 ; адрес регистра головок
|
||||||
@ -1180,12 +1206,14 @@ cache_write_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 device and Start Bus Master
|
||||||
mov al, 1
|
mov al, 1
|
||||||
out dx, al
|
out dx, al
|
||||||
mov eax, [CURRENT_TASK]
|
mov eax, [CURRENT_TASK]
|
||||||
@ -1202,6 +1230,7 @@ cache_write_dma:
|
|||||||
mov [IDE_common_irq_param], irq15_num
|
mov [IDE_common_irq_param], irq15_num
|
||||||
@@:
|
@@:
|
||||||
popfd
|
popfd
|
||||||
|
; wait for interrupt
|
||||||
mov [dma_cur_sector], not 0x40
|
mov [dma_cur_sector], not 0x40
|
||||||
mov eax, [hd_address_table]
|
mov eax, [hd_address_table]
|
||||||
cmp [hdbase], eax ; 0x1F0
|
cmp [hdbase], eax ; 0x1F0
|
||||||
@ -1217,6 +1246,7 @@ cache_write_dma:
|
|||||||
ret
|
ret
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
uglobal
|
uglobal
|
||||||
|
align 4
|
||||||
IDE_Interrupt dw ?
|
IDE_Interrupt dw ?
|
||||||
IDEContrRegsBaseAddr dw ?
|
IDEContrRegsBaseAddr dw ?
|
||||||
IDEContrProgrammingInterface dw ?
|
IDEContrProgrammingInterface dw ?
|
||||||
|
@ -82,6 +82,14 @@ Print_Device_Name:
|
|||||||
popfd
|
popfd
|
||||||
popad
|
popad
|
||||||
DEBUGF 1, "K : Dev: %s \n", dev_name
|
DEBUGF 1, "K : Dev: %s \n", dev_name
|
||||||
|
|
||||||
|
xor eax, eax
|
||||||
|
mov ax, [Sector512+64*2]
|
||||||
|
DEBUGF 1, "K : PIO mode %x\n", eax
|
||||||
|
mov ax, [Sector512+63*2]
|
||||||
|
DEBUGF 1, "K : Multiword DMA mode %x\n", eax
|
||||||
|
mov ax, [Sector512+88*2]
|
||||||
|
DEBUGF 1, "K : Ultra DMA mode %x\n", eax
|
||||||
FindHDD_2_2:
|
FindHDD_2_2:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user