Subversion Repositories Kolibri OS

Rev

Rev 4772 | Rev 4841 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4772 Rev 4838
Line 236... Line 236...
236
;        cmp     [ecx+IDE_DATA.RegsBaseAddres], 0
236
;        cmp     [ecx+IDE_DATA.RegsBaseAddres], 0
237
;        setnz   [ecx+IDE_DATA.dma_hdd]
237
;        setnz   [ecx+IDE_DATA.dma_hdd]
238
;-----------------------------------------------------------------------------
238
;-----------------------------------------------------------------------------
239
; set interrupts for IDE Controller
239
; set interrupts for IDE Controller
240
;-----------------------------------------------------------------------------
240
;-----------------------------------------------------------------------------
241
        mov     esi, boot_set_int_IDE
-
 
242
        call    boot_log
-
 
243
.set_interrupts_for_IDE_controllers:
-
 
244
        mov     eax, [ecx+IDE_DATA.ProgrammingInterface]
-
 
245
        cmp     ax, 0x0180
-
 
246
        je      .pata_ide
-
 
247
 
-
 
248
        cmp     ax, 0x018a
-
 
249
        jne     .sata_ide
-
 
250
;--------------------------------------
-
 
251
.pata_ide:
-
 
252
        cmp     [ecx+IDE_DATA.RegsBaseAddres], 0
-
 
253
        je      .end_set_interrupts
-
 
254
 
-
 
255
        push    ecx
-
 
256
        stdcall attach_int_handler, 14, IDE_irq_14_handler, 0
-
 
257
        DEBUGF  1, "K : Set IDE IRQ14 return code %x\n", eax
-
 
258
        stdcall attach_int_handler, 15, IDE_irq_15_handler, 0
-
 
259
        DEBUGF  1, "K : Set IDE IRQ15 return code %x\n", eax
-
 
260
        pop     ecx
-
 
261
 
-
 
262
        jmp     .enable_IDE_interrupt
-
 
263
;--------------------------------------
-
 
264
.sata_ide:
-
 
265
        cmp     ax, 0x0185
-
 
266
        je      .sata_ide_1
-
 
267
 
-
 
268
        cmp     ax, 0x018f
-
 
269
        jne     .end_set_interrupts
-
 
270
;--------------------------------------
-
 
271
.sata_ide_1:
-
 
272
        cmp     [ecx+IDE_DATA.RegsBaseAddres], 0
-
 
273
        je      .end_set_interrupts
-
 
274
 
-
 
275
        mov     ax, [ecx+IDE_DATA.Interrupt]
-
 
276
        movzx   eax, al
-
 
277
        push    ecx
241
        pushfd
278
        stdcall attach_int_handler, eax, IDE_common_irq_handler, 0
-
 
279
        pop     ecx
242
        cli
280
        DEBUGF  1, "K : Set IDE IRQ%d return code %x\n", [ecx+IDE_DATA.Interrupt]:1, eax
-
 
281
;--------------------------------------
-
 
282
.enable_IDE_interrupt:
243
.enable_IDE_interrupt:
283
        mov     esi, boot_enabling_ide
244
        mov     esi, boot_enabling_ide
284
        call    boot_log
245
        call    boot_log
285
; Enable interrupts in IDE controller for DMA
246
; Enable interrupts in IDE controller for DMA
286
        xor     ebx, ebx
247
        xor     ebx, ebx
Line 367... Line 328...
367
.ch2_pio_set:
328
.ch2_pio_set:
368
        DEBUGF  1, "K : IDE CH2 PIO because device not support UDMA\n"
329
        DEBUGF  1, "K : IDE CH2 PIO because device not support UDMA\n"
369
;--------------------------------------
330
;--------------------------------------
370
.ch2_pio_set_for_all:
331
.ch2_pio_set_for_all:
371
        mov     [ecx+IDE_DATA.dma_hdd_channel_2], al
332
        mov     [ecx+IDE_DATA.dma_hdd_channel_2], al
372
        jmp     .end_set_interrupts
333
        jmp     .set_interrupts_for_IDE_controllers
373
;--------------------------------------
334
;--------------------------------------
374
@@:
335
@@:
375
        mov     ebx, 4
336
        mov     ebx, 4
376
        call    calculate_IDE_device_values_storage
337
        call    calculate_IDE_device_values_storage
Line 404... Line 365...
404
        add     dx, 2 ;0x376
365
        add     dx, 2 ;0x376
405
        out     dx, al
366
        out     dx, al
406
        DEBUGF  1, "K : IDE CH2 DMA enabled\n"
367
        DEBUGF  1, "K : IDE CH2 DMA enabled\n"
407
        mov     [ecx+IDE_DATA.dma_hdd_channel_2], byte 1
368
        mov     [ecx+IDE_DATA.dma_hdd_channel_2], byte 1
408
;--------------------------------------
369
;--------------------------------------
-
 
370
.set_interrupts_for_IDE_controllers:
-
 
371
        mov     esi, boot_set_int_IDE
-
 
372
        call    boot_log
-
 
373
;--------------------------------------
-
 
374
        mov     eax, [ecx+IDE_DATA.ProgrammingInterface]
-
 
375
        cmp     ax, 0x0180
-
 
376
        je      .pata_ide
-
 
377
 
-
 
378
        cmp     ax, 0x018a
-
 
379
        jne     .sata_ide
-
 
380
;--------------------------------------
-
 
381
.pata_ide:
-
 
382
        cmp     [ecx+IDE_DATA.RegsBaseAddres], 0
-
 
383
        je      .end_set_interrupts
-
 
384
 
-
 
385
        push    ecx
-
 
386
        stdcall attach_int_handler, 14, IDE_irq_14_handler, 0
-
 
387
        DEBUGF  1, "K : Set IDE IRQ14 return code %x\n", eax
-
 
388
        stdcall attach_int_handler, 15, IDE_irq_15_handler, 0
-
 
389
        DEBUGF  1, "K : Set IDE IRQ15 return code %x\n", eax
-
 
390
        pop     ecx
-
 
391
 
-
 
392
        jmp     .end_set_interrupts
-
 
393
;--------------------------------------
-
 
394
.sata_ide:
-
 
395
        cmp     ax, 0x0185
-
 
396
        je      .sata_ide_1
-
 
397
 
-
 
398
        cmp     ax, 0x018f
-
 
399
        jne     .end_set_interrupts
-
 
400
;--------------------------------------
-
 
401
.sata_ide_1:
-
 
402
; Some weird controllers generate an interrupt even if IDE interrupts
-
 
403
; are disabled and no IDE devices. For example, notebook ASUS K72F -
-
 
404
; IDE controller 010185 generates false interrupt when we work with
-
 
405
; the IDE controller 01018f. For this reason, the interrupt handler
-
 
406
; does not need to be installed if both channel IDE controller
-
 
407
; running in PIO mode.
-
 
408
        cmp     [ecx+IDE_DATA.RegsBaseAddres], 0
-
 
409
        je      .end_set_interrupts
-
 
410
 
-
 
411
        cmp     [ecx+IDE_DATA.dma_hdd_channel_1], 0
-
 
412
        jne     @f
-
 
413
 
-
 
414
        cmp     [ecx+IDE_DATA.dma_hdd_channel_2], 0
-
 
415
        je      .end_set_interrupts
-
 
416
;--------------------------------------
-
 
417
@@:
-
 
418
        mov     ax, [ecx+IDE_DATA.Interrupt]
-
 
419
        movzx   eax, al
-
 
420
        push    ecx
-
 
421
        stdcall attach_int_handler, eax, IDE_common_irq_handler, 0
-
 
422
        pop     ecx
-
 
423
        DEBUGF  1, "K : Set IDE IRQ%d return code %x\n", [ecx+IDE_DATA.Interrupt]:1, eax
-
 
424
;--------------------------------------
409
.end_set_interrupts:
425
.end_set_interrupts:
-
 
426
        popfd
410
        ret
427
        ret
411
;-----------------------------------------------------------------------------
428
;-----------------------------------------------------------------------------
412
; END of initialisation IDE ATA code
429
; END of initialisation IDE ATA code
413
;-----------------------------------------------------------------------------
430
;-----------------------------------------------------------------------------
414
find_IDE_controller_done:
431
find_IDE_controller_done: