Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 3771 → Rev 3774

/kernel/trunk/blkdev/hd_drv.inc
77,7 → 77,10
call mutex_lock
mov ecx, ide_channel2_mutex
mov eax, [hd_data]
cmp [eax+HD_DATA.hdbase], 0x1F0
push ecx
mov ecx, [hd_address_table]
cmp [eax+HD_DATA.hdbase], ecx ; 0x1F0
pop ecx
jne .IDE_Channel_2
mov ecx, ide_channel1_mutex
.IDE_Channel_2:
158,7 → 161,10
call mutex_lock
mov ecx, ide_channel2_mutex
mov eax, [hd_data]
cmp [eax+HD_DATA.hdbase], 0x1F0
push ecx
mov ecx, [hd_address_table]
cmp [eax+HD_DATA.hdbase], ecx ; 0x1F0
pop ecx
jne .IDE_Channel_2
mov ecx, ide_channel1_mutex
.IDE_Channel_2:
848,7 → 854,10
mov word [eax+4], 0x2000
sub eax, OS_BASE
mov dx, [IDEContrRegsBaseAddr]
cmp [hdbase], 0x1F0
push eax
mov eax, [hd_address_table]
cmp [hdbase], eax ; 0x1F0
pop eax
jz @f
add edx, 8
@@:
1005,7 → 1014,10
popa
sub eax, OS_BASE
mov dx, [IDEContrRegsBaseAddr]
cmp [hdbase], 0x1F0
push eax
mov eax, [hd_address_table]
cmp [hdbase], eax ; 0x1F0
pop eax
jz @f
add edx, 8
@@:
/kernel/trunk/boot/bootcode.inc
434,8 → 434,11
xor si, si ; device index = 0
int 0x1A
jnc .found_1 ; Parallel IDE Controller
 
; Controller not found!
xor ax, ax
mov [es:BOOT_IDE_PI_16], ax
jmp .nopci
;--------------------------------------
.found_1:
; get memory base BAR4
mov ax, 0xB10A
443,10 → 446,11
push cx
int 0x1A
jc .no_BAR4 ;.nopci
and cx, 0xFFF0 ; clear address decode type
and cx, 0xFFFC ; clear address decode type
mov [es:BOOT_IDE_BASE_ADDR], cx
.no_BAR4:
pop cx
;--------------------------------------
.found:
; get Interrupt Line
mov ax, 0xB10A
454,10 → 458,11
push cx
int 0x1A
jc .no_Interrupt ;.nopci
; and cx, 0xFFF0 ; clear address decode type
 
mov [es:BOOT_IDE_INTERR_16], cx
.no_Interrupt:
pop cx
;--------------------------------------
; get memory base BAR0
mov ax, 0xB10A
mov di, 0x10 ; memory base is config register at 0x10
464,9 → 469,11
push cx
int 0x1A
jc .no_BAR0 ;.nopci
 
mov [es:BOOT_IDE_BAR0_16], cx
.no_BAR0:
pop cx
;--------------------------------------
; get memory base BAR1
mov ax, 0xB10A
mov di, 0x14 ; memory base is config register at 0x14
473,9 → 480,11
push cx
int 0x1A
jc .no_BAR1 ;.nopci
 
mov [es:BOOT_IDE_BAR1_16], cx
.no_BAR1:
pop cx
;--------------------------------------
; get memory base BAR2
mov ax, 0xB10A
mov di, 0x18 ; memory base is config register at 0x18
482,9 → 491,11
push cx
int 0x1A
jc .no_BAR2 ;.nopci
 
mov [es:BOOT_IDE_BAR2_16], cx
.no_BAR2:
pop cx
;--------------------------------------
; get memory base BAR3
mov ax, 0xB10A
mov di, 0x1C ; memory base is config register at 0x1c
491,9 → 502,11
push cx
int 0x1A
jc .no_BAR3 ;.nopci
 
mov [es:BOOT_IDE_BAR3_16], cx
.no_BAR3:
pop cx
;--------------------------------------
.nopci:
; \end{Mario79}
 
/kernel/trunk/core/irq.inc
51,6 → 51,8
.irqh dd ?
endl
 
DEBUGF 1, "K : Attach Interrupt %d Handler %x\n", [irq], [handler]
 
and [.irqh], 0
 
push ebx
/kernel/trunk/kernel.asm
362,42 → 362,76
call mutex_init
mov ecx, ide_channel2_mutex
call mutex_init
 
;-----------------------------------------------------------------------------
; SAVE REAL MODE VARIABLES
;-----------------------------------------------------------------------------
save_variables_IDE_controller:
xor eax, eax
mov ax, [BOOT_VARS + BOOT_IDE_INTERR_16]
mov [IDE_Interrupt], ax
;--------------------------------------
mov ax, [BOOT_VARS + BOOT_IDE_PI_16]
mov [IDEContrProgrammingInterface], ax
;--------------------------------------
mov ax, [BOOT_VARS + BOOT_IDE_BASE_ADDR]
mov [IDEContrRegsBaseAddr], ax
;--------------------------------------
mov ax, [BOOT_VARS + BOOT_IDE_BAR0_16]
mov [IDE_BAR0_val], ax
 
cmp ax, 0
je @f
cmp ax, 1
je @f
and ax, 0xfff0
jne .no_PATA_BAR0
@@:
mov ax, 0x1F0
jmp @f
.no_PATA_BAR0:
and ax, 0xFFFC
@@:
mov [StandardATABases], ax
mov [hd_address_table], eax
mov [hd_address_table+8], eax
mov [IDE_BAR0_val], ax
;--------------------------------------
mov ax, [BOOT_VARS + BOOT_IDE_BAR1_16]
cmp ax, 0
je @f
cmp ax, 1
jne .no_PATA_BAR1
@@:
mov ax, [BOOT_VARS + BOOT_IDE_BAR1_16]
mov ax, 0x3F4
jmp @f
.no_PATA_BAR1:
and ax, 0xFFFC
@@:
mov [IDE_BAR1_val], ax
;--------------------------------------
mov ax, [BOOT_VARS + BOOT_IDE_BAR2_16]
mov [IDE_BAR2_val], ax
 
cmp ax, 0
je @f
cmp ax, 1
je @f
and ax, 0xfff0
jne .no_PATA_BAR2
@@:
mov ax, 0x170
jmp @f
.no_PATA_BAR2:
and ax, 0xFFFC
@@:
mov [StandardATABases+2], ax
mov [hd_address_table+16], eax
mov [hd_address_table+24], eax
mov [IDE_BAR2_val], ax
;--------------------------------------
mov ax, [BOOT_VARS + BOOT_IDE_BAR3_16]
cmp ax, 0
je @f
cmp ax, 1
jne .no_PATA_BAR3
@@:
mov ax, [BOOT_VARS + BOOT_IDE_BAR3_16]
mov ax, 0x374
jmp @f
.no_PATA_BAR3:
and ax, 0xFFFC
@@:
mov [IDE_BAR3_val], ax
 
; --------------- APM ---------------------
728,11 → 762,11
.disable_IDE_interrupt:
; Disable interrupts in IDE controller for PIO
mov al, 2
mov dx, [IDE_BAR1_val] ;0x3F6
add dx, 2
mov dx, [IDE_BAR1_val] ;0x3F4
add dx, 2 ;0x3F6
out dx, al
mov dx, [IDE_BAR3_val] ;0x76
add dx, 2
mov dx, [IDE_BAR3_val] ;0x374
add dx, 2 ;0x376
out dx, al
;-----------------------------------------------------------------------------
;!!!!!!!!!!!!!!!!!!!!!!!!!!
983,7 → 1017,7
call set_lights
;// mike.dld ]
stdcall attach_int_handler, 1, irq1, 0
DEBUGF 1, "K : IRQ0 error code %x\n", eax
DEBUGF 1, "K : IRQ1 error code %x\n", eax
.no_keyboard:
 
; SET MOUSE
1108,7 → 1142,7
mov ax, [IDE_Interrupt]
movzx eax, al
stdcall attach_int_handler, eax, IDE_common_irq_handler, 0
DEBUGF 1, "K : Set IDE IRQ%d return code %x\n", [IDE_Interrupt]:2, eax
DEBUGF 1, "K : Set IDE IRQ%d return code %x\n", [IDE_Interrupt]:1, eax
 
stdcall enable_irq, eax
;--------------------------------------
1117,11 → 1151,11
call boot_log
; Enable interrupts in IDE controller for DMA
mov al, 0
mov dx, [IDE_BAR1_val] ;0x3F6
add dx, 2
mov dx, [IDE_BAR1_val] ;0x3F4
add dx, 2 ;0x3F6
out dx, al
mov dx, [IDE_BAR3_val] ;0x76
add dx, 2
mov dx, [IDE_BAR3_val] ;0x374
add dx, 2 ;0x376
out dx, al
;--------------------------------------
.end_set_interrupts: