IDE DMA fix (SATA Native mode).
git-svn-id: svn://kolibrios.org@4291 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
9fc5122eb8
commit
12ea7f0fda
@ -112,6 +112,22 @@ endl
|
||||
ja .nodma
|
||||
cmp [dma_hdd], 1
|
||||
jnz .nodma
|
||||
;--------------------------------------
|
||||
push eax
|
||||
mov eax, [hd_address_table]
|
||||
cmp [hdbase], eax ; 0x1F0
|
||||
pop eax
|
||||
jnz @f
|
||||
|
||||
test [DRIVE_DATA+1], byte 10100000b
|
||||
jnz .nodma
|
||||
|
||||
jmp .dma
|
||||
@@:
|
||||
test [DRIVE_DATA+1], byte 1010b
|
||||
jnz .nodma
|
||||
.dma:
|
||||
;--------------------------------------
|
||||
call hd_read_dma
|
||||
jmp @f
|
||||
.nodma:
|
||||
@ -204,6 +220,22 @@ endl
|
||||
jae .nodma
|
||||
cmp [dma_hdd], 1
|
||||
jnz .nodma
|
||||
;--------------------------------------
|
||||
push eax
|
||||
mov eax, [hd_address_table]
|
||||
cmp [hdbase], eax ; 0x1F0
|
||||
pop eax
|
||||
jnz @f
|
||||
|
||||
test [DRIVE_DATA+1], byte 10100000b
|
||||
jnz .nodma
|
||||
|
||||
jmp .dma
|
||||
@@:
|
||||
test [DRIVE_DATA+1], byte 1010b
|
||||
jnz .nodma
|
||||
.dma:
|
||||
;--------------------------------------
|
||||
call cache_write_dma
|
||||
jmp .common
|
||||
.nodma:
|
||||
@ -803,23 +835,37 @@ IDE_irq_14_handler:
|
||||
pushfd
|
||||
cli
|
||||
pushad
|
||||
; clear Bus Master IDE Command register
|
||||
mov [IDE_common_irq_param], 0
|
||||
mov dx, [IDEContrRegsBaseAddr]
|
||||
mov al, 0
|
||||
out dx, al
|
||||
; test whether it is our interrupt?
|
||||
add edx, 2
|
||||
in al, dx
|
||||
test al, 100b
|
||||
jz @f
|
||||
; clear Bus Master IDE Status register
|
||||
; clear Interrupt bit
|
||||
add edx, 2
|
||||
mov al, 4 ; 100b
|
||||
out dx, al
|
||||
|
||||
; clear Bus Master IDE Command register
|
||||
sub edx, 2
|
||||
xor eax, eax
|
||||
out dx, al
|
||||
; read status register and remove the interrupt request
|
||||
mov edx, [hdbase]
|
||||
add edx, 0x7
|
||||
in al, dx
|
||||
popad
|
||||
popfd
|
||||
mov al, 1
|
||||
ret
|
||||
;--------------------------------------
|
||||
align 4
|
||||
@@:
|
||||
popad
|
||||
popfd
|
||||
;--------------------------------------
|
||||
align 4
|
||||
.exit:
|
||||
mov al, 1
|
||||
mov al, 0
|
||||
ret
|
||||
;-----------------------------------------------------------------------------
|
||||
align 4
|
||||
@ -830,24 +876,38 @@ IDE_irq_15_handler:
|
||||
pushfd
|
||||
cli
|
||||
pushad
|
||||
; clear Bus Master IDE Command register
|
||||
mov [IDE_common_irq_param], 0
|
||||
mov dx, [IDEContrRegsBaseAddr]
|
||||
add dx, 8
|
||||
mov al, 0
|
||||
out dx, al
|
||||
; test whether it is our interrupt?
|
||||
add edx, 2
|
||||
in al, dx
|
||||
test al, 100b
|
||||
jz @f
|
||||
; clear Bus Master IDE Status register
|
||||
; clear Interrupt bit
|
||||
add edx, 2
|
||||
mov al, 4 ; 100b
|
||||
out dx, al
|
||||
|
||||
; clear Bus Master IDE Command register
|
||||
sub edx, 2
|
||||
mov al, 0
|
||||
out dx, al
|
||||
; read status register and remove the interrupt request
|
||||
mov edx, [hdbase]
|
||||
add edx, 0x7
|
||||
in al, dx
|
||||
popad
|
||||
popfd
|
||||
mov al, 1
|
||||
ret
|
||||
;--------------------------------------
|
||||
align 4
|
||||
@@:
|
||||
popad
|
||||
popfd
|
||||
;--------------------------------------
|
||||
align 4
|
||||
.exit:
|
||||
mov al, 1
|
||||
mov al, 0
|
||||
ret
|
||||
;-----------------------------------------------------------------------------
|
||||
align 4
|
||||
@ -858,32 +918,46 @@ IDE_common_irq_handler:
|
||||
pushfd
|
||||
cli
|
||||
pushad
|
||||
; clear Bus Master IDE Command register
|
||||
xor ebx, ebx
|
||||
mov dx, [IDEContrRegsBaseAddr]
|
||||
mov eax, IDE_common_irq_param
|
||||
cmp [eax], irq14_num
|
||||
mov [eax], bl
|
||||
xor eax, eax
|
||||
je @f
|
||||
|
||||
add dx, 8
|
||||
;--------------------------------------
|
||||
align 4
|
||||
@@:
|
||||
out dx, al
|
||||
; test whether it is our interrupt?
|
||||
add edx, 2
|
||||
in al, dx
|
||||
test al, 100b
|
||||
jz @f
|
||||
; clear Bus Master IDE Status register
|
||||
; clear Interrupt bit
|
||||
add edx, 2
|
||||
mov al, 4 ; 100b
|
||||
out dx, al
|
||||
|
||||
; clear Bus Master IDE Command register
|
||||
sub edx, 2
|
||||
xor eax, eax
|
||||
out dx, al
|
||||
; read status register and remove the interrupt request
|
||||
mov edx, [hdbase]
|
||||
add edx, 0x7
|
||||
in al, dx
|
||||
popad
|
||||
popfd
|
||||
mov al, 1
|
||||
ret
|
||||
;--------------------------------------
|
||||
align 4
|
||||
@@:
|
||||
popad
|
||||
popfd
|
||||
;--------------------------------------
|
||||
align 4
|
||||
.exit:
|
||||
mov al, 1
|
||||
mov al, 0
|
||||
ret
|
||||
;-----------------------------------------------------------------------------
|
||||
align 4
|
||||
|
@ -432,14 +432,14 @@ sayerr:
|
||||
mov [es:BOOT_IDE_PI_16], cx
|
||||
xor si, si ; device index = 0
|
||||
int 0x1A
|
||||
jnc .found
|
||||
jnc .found_1
|
||||
; c) class 1, subclass 1, programming interface 0x85
|
||||
mov ax, 0xB103
|
||||
mov ecx, 1*10000h + 1*100h + 0x85
|
||||
mov [es:BOOT_IDE_PI_16], cx
|
||||
xor si, si ; device index = 0
|
||||
int 0x1A
|
||||
jnc .found
|
||||
jnc .found_1
|
||||
; d) class 1, subclass 1, programming interface 0x8A
|
||||
; This is a Parallel IDE Controller which uses IRQs 14 and 15.
|
||||
mov ax, 0xB103
|
||||
@ -447,7 +447,7 @@ sayerr:
|
||||
mov [es:BOOT_IDE_PI_16], cx
|
||||
xor si, si ; device index = 0
|
||||
int 0x1A
|
||||
jnc .found ; Parallel IDE Controller
|
||||
jnc .found_1 ; Parallel IDE Controller
|
||||
; Controller not found!
|
||||
xor ax, ax
|
||||
mov [es:BOOT_IDE_PI_16], ax
|
||||
|
@ -1200,12 +1200,28 @@ set_interrupts_for_IDE_controllers:
|
||||
call boot_log
|
||||
; Enable interrupts in IDE controller for DMA
|
||||
mov al, 0
|
||||
mov ah, [DRIVE_DATA+1]
|
||||
test ah, 10100000b
|
||||
jz @f
|
||||
|
||||
DEBUGF 1, "K : IDE CH1 PIO, because ATAPI drive present\n"
|
||||
jmp .ch2_check
|
||||
@@:
|
||||
mov dx, [IDE_BAR1_val] ;0x3F4
|
||||
add dx, 2 ;0x3F6
|
||||
out dx, al
|
||||
DEBUGF 1, "K : IDE CH1 DMA enabled\n"
|
||||
.ch2_check:
|
||||
test ah, 1010b
|
||||
jz @f
|
||||
|
||||
DEBUGF 1, "K : IDE CH2 PIO, because ATAPI drive present\n"
|
||||
jmp .end_set_interrupts
|
||||
@@:
|
||||
mov dx, [IDE_BAR3_val] ;0x374
|
||||
add dx, 2 ;0x376
|
||||
out dx, al
|
||||
DEBUGF 1, "K : IDE CH2 DMA enabled\n"
|
||||
;--------------------------------------
|
||||
.end_set_interrupts:
|
||||
;-----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user