Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4719 → Rev 4720

/kernel/trunk/blkdev/hd_drv.inc
114,7 → 114,21
cmp [allow_dma_access], 2
ja .nodma
 
cmp [ecx+IDE_DATA.dma_hdd], 1
push eax ecx
mov ecx, [hdpos]
dec ecx
shr ecx, 2
imul ecx, sizeof.IDE_DATA
add ecx, IDE_controller_1
mov [IDE_controller_pointer], ecx
 
mov eax, [hdpos]
dec eax
and eax, 11b
shr eax, 1
add eax, ecx
cmp [eax+IDE_DATA.dma_hdd_channel_1], 1
pop ecx eax
jnz .nodma
 
call hd_read_dma
219,7 → 233,21
cmp [allow_dma_access], 2
jae .nodma
 
cmp [ecx+IDE_DATA.dma_hdd], 1
push eax ecx
mov ecx, [hdpos]
dec ecx
shr ecx, 2
imul ecx, sizeof.IDE_DATA
add ecx, IDE_controller_1
mov [IDE_controller_pointer], ecx
 
mov eax, [hdpos]
dec eax
and eax, 11b
shr eax, 1
add eax, ecx
cmp [eax+IDE_DATA.dma_hdd_channel_1], 1
pop ecx eax
jnz .nodma
 
call cache_write_dma
846,13 → 874,7
mov word [eax+4], 0x2000
sub eax, OS_BASE
; select controller Primary or Secondary
; mov ecx,[IDE_controller_pointer]
mov ecx, [hdpos]
dec ecx
shr ecx, 2
imul ecx, sizeof.IDE_DATA
add ecx, IDE_controller_1
mov [IDE_controller_pointer], ecx
mov ecx, [IDE_controller_pointer]
mov dx, [ecx+IDE_DATA.RegsBaseAddres]
 
push eax
1039,13 → 1061,7
 
sub eax, OS_BASE
; select controller Primary or Secondary
; mov ecx,[IDE_controller_pointer]
mov ecx, [hdpos]
dec ecx
shr ecx, 2
imul ecx, sizeof.IDE_DATA
add ecx, IDE_controller_1
mov [IDE_controller_pointer], ecx
mov ecx, [IDE_controller_pointer]
mov dx, [ecx+IDE_DATA.RegsBaseAddres]
 
push eax
1219,7 → 1235,10
cmp esi, pcidev_list
jz .done
 
cmp [esi+PCIDEV.class], 0x01018F
; cmp [esi+PCIDEV.class], 0x01018F
mov eax, [esi+PCIDEV.class]
shr eax, 4
cmp eax, 0x01018
jnz .loop
 
mov ah, [esi+PCIDEV.bus]
/kernel/trunk/detect/init_ata.inc
146,8 → 146,11
;-----------------------------------------------------------------------------
Init_IDE_ATA_controller:
cmp [ecx+IDE_DATA.ProgrammingInterface], 0
je set_interrupts_for_IDE_controllers.continue
jne @f
 
ret
;--------------------------------------
@@:
mov esi, boot_disabling_ide
call boot_log
;--------------------------------------
173,8 → 176,18
 
mov esi, boot_detecthdcd
call boot_log
;--------------------------------------
include 'dev_hdcd.inc'
;--------------------------------------
ret
;-----------------------------------------------------------------------------
Init_IDE_ATA_controller_2:
cmp [ecx+IDE_DATA.ProgrammingInterface], 0
jne @f
 
ret
;--------------------------------------
@@:
mov dx, [ecx+IDE_DATA.RegsBaseAddres]
; test whether it is our interrupt?
add dx, 2
204,26 → 217,26
add dx, 0x7 ;0x177
in al, dx
;-----------------------------------------------------------------------------
push eax edx
mov dx, [ecx+IDE_DATA.RegsBaseAddres]
xor eax, eax
add dx, 2
in al, dx
; push eax edx
; mov dx, [ecx+IDE_DATA.RegsBaseAddres]
; 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
; add dx, 8
; in al, dx
; DEBUGF 1, "K : Secondary Bus Master IDE Status Register %x\n", eax
pop edx eax
; pop edx eax
 
cmp [ecx+IDE_DATA.RegsBaseAddres], 0
setnz [ecx+IDE_DATA.dma_hdd]
; cmp [ecx+IDE_DATA.RegsBaseAddres], 0
; setnz [ecx+IDE_DATA.dma_hdd]
;-----------------------------------------------------------------------------
; set interrupts for IDE Controller
;-----------------------------------------------------------------------------
mov esi, boot_set_int_IDE
call boot_log
set_interrupts_for_IDE_controllers:
.set_interrupts_for_IDE_controllers:
mov eax, [ecx+IDE_DATA.ProgrammingInterface]
cmp ax, 0x0180
je .pata_ide
286,6 → 299,8
jz @f
 
DEBUGF 1, "K : IDE CH1 PIO, because ATAPI drive present\n"
mov [ecx+IDE_DATA.dma_hdd_channel_1], byte 0
 
jmp .ch2_check
;--------------------------------------
@@:
293,6 → 308,7
add dx, 2 ;0x3F6
out dx, al
DEBUGF 1, "K : IDE CH1 DMA enabled\n"
mov [ecx+IDE_DATA.dma_hdd_channel_1], byte 1
;--------------------------------------
.ch2_check:
test ah, 1010b
299,6 → 315,8
jz @f
 
DEBUGF 1, "K : IDE CH2 PIO, because ATAPI drive present\n"
mov [ecx+IDE_DATA.dma_hdd_channel_2], byte 0
 
jmp .end_set_interrupts
;--------------------------------------
@@:
306,19 → 324,9
add dx, 2 ;0x376
out dx, al
DEBUGF 1, "K : IDE CH2 DMA enabled\n"
mov [ecx+IDE_DATA.dma_hdd_channel_2], byte 1
;--------------------------------------
.end_set_interrupts:
;-----------------------------------------------------------------------------
cmp [ecx+IDE_DATA.dma_hdd], 0
je .print_pio
;--------------------------------------
.print_dma:
DEBUGF 1, "K : IDE DMA mode\n"
jmp .continue
;--------------------------------------
.print_pio:
DEBUGF 1, "K : IDE PIO mode\n"
.continue:
ret
;-----------------------------------------------------------------------------
; END of initialisation IDE ATA code
342,3 → 350,13
call boot_log
include 'sear_par.inc'
;-----------------------------------------------------------------------------
mov ecx, IDE_controller_1
mov [IDE_controller_pointer], ecx
call Init_IDE_ATA_controller_2
mov ecx, IDE_controller_2
mov [IDE_controller_pointer], ecx
call Init_IDE_ATA_controller_2
mov ecx, IDE_controller_3
mov [IDE_controller_pointer], ecx
call Init_IDE_ATA_controller_2
;-----------------------------------------------------------------------------
/kernel/trunk/kernel32.inc
160,7 → 160,8
BAR1_val dw ?
BAR2_val dw ?
BAR3_val dw ?
dma_hdd db ?
dma_hdd_channel_1 db ?
dma_hdd_channel_2 db ?
ends
 
struct IDE_CACHE