Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 3761 → Rev 3762

/kernel/trunk/blkdev/hd_drv.inc
704,6 → 704,9
pop edx eax
ret
;-----------------------------------------------------------------------------
irq14_num equ byte 14
irq15_num equ byte 15
;-----------------------------------------------------------------------------
align 4
wait_for_sector_dma_ide0:
push eax
713,12 → 716,14
align 4
.wait:
call change_task
cmp [irq14_func], hdd_irq14
cmp [IDE_common_irq_param], irq14_num
jnz .done
 
call check_hd_wait_timeout
cmp [hd_error], 0
jz .wait
mov [irq14_func], hdd_irq_null
 
mov [IDE_common_irq_param], 0
mov dx, [IDEContrRegsBaseAddr]
mov al, 0
out dx, al
736,12 → 741,14
align 4
.wait:
call change_task
cmp [irq15_func], hdd_irq15
cmp [IDE_common_irq_param], irq15_num
jnz .done
 
call check_hd_wait_timeout
cmp [hd_error], 0
jz .wait
mov [irq15_func], hdd_irq_null
 
mov [IDE_common_irq_param], 0
mov dx, [IDEContrRegsBaseAddr]
add dx, 8
mov al, 0
761,8 → 768,7
 
dma_cur_sector dd not 40h
dma_hdpos dd 0
irq14_func dd hdd_irq_null
irq15_func dd hdd_irq_null
IDE_common_irq_param db 0
endg
;-----------------------------------------------------------------------------
uglobal
779,32 → 785,34
endg
;-----------------------------------------------------------------------------
align 4
hdd_irq14:
IDE_common_irq_handler:
pushfd
cli
pushad
mov [irq14_func], hdd_irq_null
 
xor ebx, ebx
mov eax, IDE_common_irq_param
cmp [eax], irq15_num
mov [eax], ebx
je @f
;--------------------------------------
mov dx, [IDEContrRegsBaseAddr]
mov al, 0
out dx, al
popad
popfd
jmp .end
;--------------------------------------
align 4
hdd_irq_null:
ret
;-----------------------------------------------------------------------------
align 4
hdd_irq15:
pushfd
cli
pushad
mov [irq15_func], hdd_irq_null
@@:
mov dx, [IDEContrRegsBaseAddr]
add dx, 8
mov al, 0
out dx, al
;--------------------------------------
align 4
.end:
popad
popfd
mov al, 1
ret
;-----------------------------------------------------------------------------
align 4
956,10 → 964,11
mov eax, [hd_address_table]
cmp [hdbase], eax ; 0x1F0
jnz .ide1
mov [irq14_func], hdd_irq14
 
mov [IDE_common_irq_param], irq14_num
jmp @f
.ide1:
mov [irq15_func], hdd_irq15
mov [IDE_common_irq_param], irq15_num
@@:
popfd
mov eax, [hd_address_table]
1113,10 → 1122,11
mov eax, [hd_address_table]
cmp [hdbase], eax ; 0x1F0
jnz .ide1
mov [irq14_func], hdd_irq14
 
mov [IDE_common_irq_param], irq14_num
jmp @f
.ide1:
mov [irq15_func], hdd_irq15
mov [IDE_common_irq_param], irq15_num
@@:
popfd
mov [dma_cur_sector], not 0x40
1134,6 → 1144,7
ret
;-----------------------------------------------------------------------------
uglobal
IDE_Interrupt dw ?
IDEContrRegsBaseAddr dw ?
IDEContrProgrammingInterface dw ?
IDE_BAR0_val dw ?
/kernel/trunk/boot/bootcode.inc
448,6 → 448,16
.no_BAR4:
pop cx
.found:
; get Interrupt Line
mov ax, 0xB10A
mov di, 0x3c ; memory base is config register at 0x3c
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
/kernel/trunk/const.inc
314,6 → 314,7
BOOT_IDE_BAR2_16 equ 0x905A
BOOT_IDE_BAR3_16 equ 0x905C
BOOT_IDE_PI_16 equ 0x905E
BOOT_IDE_INTERR_16 equ 0x9060
 
TMP_FILE_NAME equ 0
TMP_CMD_LINE equ 1024
/kernel/trunk/core/irq.inc
160,19 → 160,6
call [fdc_irq_func]
pop ebp
@@:
 
cmp bp, 14
jnz @f
push ebp
call [irq14_func]
pop ebp
@@:
cmp bp, 15
jnz @f
push ebp
call [irq15_func]
pop ebp
@@:
bts [irq_active_set], ebp
 
lea esi, [irqh_tab+ebp*8] ; esi= list head
234,6 → 221,10
jz .try_next_irq
cmp ebp, 12
jz .try_next_irq
cmp ebp, 14
jz .try_next_irq
cmp ebp, 15
jz .try_next_irq
lea esi, [irqh_tab+ebp*8]
mov ebx, esi
.try_next_handler:
/kernel/trunk/data32.inc
55,7 → 55,9
boot_inittimer: cp866 'Инициализация системного таймера (IRQ0)',0
boot_initapic: cp866 'Попытка инициализации APIC',0
boot_enableirq: cp866 'Включить прерывания 2, 6, 13, 14, 15',0
boot_enablint_ide:cp866 'Разрешение прерываний в контроллере IDE',0
boot_disabling_ide:cp866 'Запрещение прерываний в контроллере IDE',0
boot_enabling_ide:cp866 'Разрешение прерываний в контроллере IDE',0
boot_set_int_IDE: cp866 'Установка обработчиков прерываний для контроллера IDE',0
boot_detectfloppy:cp866 'Поиск floppy дисководов',0
boot_detecthdcd: cp866 'Поиск жестких дисков и ATAPI приводов',0
boot_getcache: cp866 'Получение памяти для кэша',0
96,7 → 98,9
boot_inittimer db 'Initialize system timer (IRQ0)',0
boot_initapic db 'Try to initialize APIC',0
boot_enableirq db 'Enable interrupts 2, 6, 13, 14, 15',0
boot_enablint_ide db 'Enable interrupts in IDE controller',0
boot_disabling_ide db 'Disable interrupts in IDE controller',0
boot_enabling_ide db 'Enable interrupts in IDE controller',0
boot_set_int_IDE db 'Set handler of interrupts for IDE controller',0
boot_detectfloppy db 'Search floppy drives',0
boot_detecthdcd db 'Search hard drives and ATAPI drives',0
boot_getcache db 'Get memory for cache',0
/kernel/trunk/data32sp.inc
4,7 → 4,9
boot_inittimer: cp850 'Inicializar reloj del sistema (IRQ0)',0
boot_initapic: cp850 'Prueba inicializar APIC',0
boot_enableirq: cp850 'Habilitar interrupciones 2, 6, 13, 14, 15',0
boot_enablint_ide:cp850 'Habiliar interrupciones en controladores IDE',0
boot_disabling_ide:cp850 'Habiliar interrupciones en controladores IDE',0
boot_enabling_ide:cp850 'Habilitar interrupciones en controladores IDE',0
boot_set_int_IDE: cp850 'Configuración del controlador de interrupciones para el controlador IDE',0
boot_detectfloppy:cp850 'Buscar unidades de disquete',0
boot_detecthdcd: cp850 'Buscar discos duros y unidades ATAPI',0
boot_getcache: cp850 'Tomar memoria para caché',0
/kernel/trunk/kernel.asm
365,6 → 365,8
 
; SAVE REAL MODE VARIABLES
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]
717,18 → 719,23
stdcall enable_irq, 2 ; @#$%! PIC
stdcall enable_irq, 6 ; FDD
stdcall enable_irq, 13 ; co-processor
stdcall enable_irq, 14
stdcall enable_irq, 15
 
mov esi, boot_enablint_ide
mov esi, boot_disabling_ide
call boot_log
; Enable interrupts in IDE controller
mov al, 0
mov dx, 0x3F6
;--------------------------------------
; Disable IDE interrupts, because the search
; for IDE partitions is in the PIO mode.
;--------------------------------------
.disable_IDE_interrupt:
; Disable interrupts in IDE controller for PIO
mov al, 2
mov dx, [IDE_BAR1_val] ;0x3F6
add dx, 2
out dx, al
mov dl, 0x76
mov dx, [IDE_BAR3_val] ;0x76
add dx, 2
out dx, al
 
;-----------------------------------------------------------------------------
;!!!!!!!!!!!!!!!!!!!!!!!!!!
; mov esi, boot_detectdisks
; call boot_log
977,6 → 984,7
call set_lights
;// mike.dld ]
stdcall attach_int_handler, 1, irq1, 0
DEBUGF 1, "K : IRQ0 error code %x\n", eax
.no_keyboard:
 
; SET MOUSE
1044,6 → 1052,7
DEBUGF 1, "K : BAR3 %x \n", [IDE_BAR3_val]:4
DEBUGF 1, "K : BAR4 %x \n", [IDEContrRegsBaseAddr]:4
DEBUGF 1, "K : IDEContrProgrammingInterface %x \n", [IDEContrProgrammingInterface]:4
DEBUGF 1, "K : IDE_Interrupt %x \n", [IDE_Interrupt]:4
; START MULTITASKING
 
; A 'All set - press ESC to start' messages if need
1059,6 → 1068,65
cmp [IDEContrRegsBaseAddr], 0
setnz [dma_hdd]
 
;-----------------------------------------------------------------------------
; set interrupts for IDE Controller
;-----------------------------------------------------------------------------
mov esi, boot_set_int_IDE
call boot_log
set_interrupts_for_IDE_controllers:
mov ax, [IDEContrProgrammingInterface]
cmp ax, 0x0180
je .pata_ide
 
cmp ax, 0x018a
jne .sata_ide
;--------------------------------------
.pata_ide:
cmp [IDEContrRegsBaseAddr], 0
je .end_set_interrupts
 
stdcall attach_int_handler, 14, IDE_common_irq_handler, 0
DEBUGF 1, "K : Set IDE IRQ14 return code %x\n", eax
stdcall attach_int_handler, 15, IDE_common_irq_handler, 0
DEBUGF 1, "K : Set IDE IRQ15 return code %x\n", eax
 
stdcall enable_irq, 14
stdcall enable_irq, 15
 
jmp .enable_IDE_interrupt
;--------------------------------------
.sata_ide:
cmp ax, 0x0185
je .sata_ide_1
 
cmp ax, 0x018f
jne .end_set_interrupts
;--------------------------------------
.sata_ide_1:
cmp [IDEContrRegsBaseAddr], 0
je .end_set_interrupts
 
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
 
stdcall enable_irq, eax
;--------------------------------------
.enable_IDE_interrupt:
mov esi, boot_enabling_ide
call boot_log
; Enable interrupts in IDE controller for DMA
mov al, 0
mov dx, [IDE_BAR1_val] ;0x3F6
add dx, 2
out dx, al
mov dx, [IDE_BAR3_val] ;0x76
add dx, 2
out dx, al
;--------------------------------------
.end_set_interrupts:
;-----------------------------------------------------------------------------
cmp [dma_hdd], 0
je .print_pio
.print_dma: