Subversion Repositories Kolibri OS

Rev

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

Rev 4720 Rev 4772
Line 138... Line 138...
138
cache_ide8  IDE_CACHE
138
cache_ide8  IDE_CACHE
139
cache_ide9  IDE_CACHE
139
cache_ide9  IDE_CACHE
140
cache_ide10 IDE_CACHE
140
cache_ide10 IDE_CACHE
141
cache_ide11 IDE_CACHE
141
cache_ide11 IDE_CACHE
142
;--------------------------------------
142
;--------------------------------------
-
 
143
IDE_device_1 rd 2
-
 
144
IDE_device_2 rd 2
-
 
145
IDE_device_3 rd 2
-
 
146
;--------------------------------------
143
endg
147
endg
144
;-----------------------------------------------------------------------------
148
;-----------------------------------------------------------------------------
145
; START of initialisation IDE ATA code
149
; START of initialisation IDE ATA code
146
;-----------------------------------------------------------------------------
150
;-----------------------------------------------------------------------------
147
Init_IDE_ATA_controller:
151
Init_IDE_ATA_controller:
Line 293... Line 297...
293
        add     ebx, 10
297
        add     ebx, 10
294
;--------------------------------------
298
;--------------------------------------
295
.check_DRIVE_DATA:
299
.check_DRIVE_DATA:
296
        mov     al, 0
300
        mov     al, 0
297
        mov     ah, [ebx+DRIVE_DATA+1]
301
        mov     ah, [ebx+DRIVE_DATA+1]
298
        test    ah, 10100000b
302
        test    ah, 10100000b ; check for ATAPI devices
299
        jz      @f
303
        jz      @f
300
 
-
 
-
 
304
;--------------------------------------
-
 
305
.ch1_pio_set_ATAPI:
301
        DEBUGF  1, "K : IDE CH1 PIO, because ATAPI drive present\n"
306
        DEBUGF  1, "K : IDE CH1 PIO, because ATAPI drive present\n"
-
 
307
        jmp     .ch1_pio_set_for_all
-
 
308
;--------------------------------------
-
 
309
.ch1_pio_set_no_devices:
-
 
310
        DEBUGF  1, "K : IDE CH1 PIO because no devices\n"
-
 
311
        jmp     .ch1_pio_set_for_all
-
 
312
;-------------------------------------
-
 
313
.ch1_pio_set:
-
 
314
        DEBUGF  1, "K : IDE CH1 PIO because device not support UDMA\n"
-
 
315
;-------------------------------------
-
 
316
.ch1_pio_set_for_all:
302
        mov     [ecx+IDE_DATA.dma_hdd_channel_1], byte 0
317
        mov     [ecx+IDE_DATA.dma_hdd_channel_1], al
303
 
-
 
304
        jmp     .ch2_check
318
        jmp     .ch2_check
305
;--------------------------------------
319
;--------------------------------------
306
@@:
320
@@:
-
 
321
        xor     ebx, ebx
-
 
322
        call    calculate_IDE_device_values_storage
-
 
323
 
-
 
324
        test    ah, 1010000b
-
 
325
        jz      .ch1_pio_set_no_devices
-
 
326
 
-
 
327
        test    ah, 1000000b
-
 
328
        jz      @f
-
 
329
 
-
 
330
        cmp     [ebx+IDE_DEVICE.UDMA_possible_modes], al
-
 
331
        je      .ch1_pio_set
-
 
332
 
-
 
333
        cmp     [ebx+IDE_DEVICE.UDMA_set_mode], al
-
 
334
        je      .ch1_pio_set
-
 
335
;--------------------------------------
-
 
336
@@:
-
 
337
        test    ah, 10000b
-
 
338
        jz      @f
-
 
339
 
-
 
340
        add     ebx, 2
-
 
341
 
-
 
342
        cmp     [ebx+IDE_DEVICE.UDMA_possible_modes], al
-
 
343
        je      .ch1_pio_set
-
 
344
 
-
 
345
        cmp     [ebx+IDE_DEVICE.UDMA_set_mode], al
-
 
346
        je      .ch1_pio_set
-
 
347
;--------------------------------------
-
 
348
@@:
307
        mov     dx, [ecx+IDE_DATA.BAR1_val] ;0x3F4
349
        mov     dx, [ecx+IDE_DATA.BAR1_val] ;0x3F4
308
        add     dx, 2 ;0x3F6
350
        add     dx, 2 ;0x3F6
309
        out     dx, al
351
        out     dx, al
310
        DEBUGF  1, "K : IDE CH1 DMA enabled\n"
352
        DEBUGF  1, "K : IDE CH1 DMA enabled\n"
311
        mov     [ecx+IDE_DATA.dma_hdd_channel_1], byte 1
353
        mov     [ecx+IDE_DATA.dma_hdd_channel_1], byte 1
312
;--------------------------------------
354
;--------------------------------------
313
.ch2_check:
355
.ch2_check:
314
        test    ah, 1010b
356
        test    ah, 1010b ; check for ATAPI devices
315
        jz      @f
357
        jz      @f
316
 
-
 
-
 
358
;--------------------------------------
-
 
359
.ch2_pio_set_ATAPI:
317
        DEBUGF  1, "K : IDE CH2 PIO, because ATAPI drive present\n"
360
        DEBUGF  1, "K : IDE CH2 PIO, because ATAPI drive present\n"
-
 
361
        jmp     .ch2_pio_set_for_all
-
 
362
;--------------------------------------
-
 
363
.ch2_pio_set_no_devices:
-
 
364
        DEBUGF  1, "K : IDE CH2 PIO because no devices\n"
-
 
365
        jmp     .ch2_pio_set_for_all
-
 
366
;--------------------------------------
-
 
367
.ch2_pio_set:
-
 
368
        DEBUGF  1, "K : IDE CH2 PIO because device not support UDMA\n"
-
 
369
;--------------------------------------
-
 
370
.ch2_pio_set_for_all:
318
        mov     [ecx+IDE_DATA.dma_hdd_channel_2], byte 0
371
        mov     [ecx+IDE_DATA.dma_hdd_channel_2], al
319
 
-
 
320
        jmp     .end_set_interrupts
372
        jmp     .end_set_interrupts
321
;--------------------------------------
373
;--------------------------------------
322
@@:
374
@@:
-
 
375
        mov     ebx, 4
-
 
376
        call    calculate_IDE_device_values_storage
-
 
377
 
-
 
378
        test    ah, 101b
-
 
379
        jz      .ch2_pio_set_no_devices
-
 
380
 
-
 
381
        test    ah, 100b
-
 
382
        jz      @f
-
 
383
 
-
 
384
        cmp     [ebx+IDE_DEVICE.UDMA_possible_modes], al
-
 
385
        je      .ch2_pio_set
-
 
386
 
-
 
387
        cmp     [ebx+IDE_DEVICE.UDMA_set_mode], al
-
 
388
        je      .ch2_pio_set
-
 
389
;--------------------------------------
-
 
390
@@:
-
 
391
        test    ah, 1b
-
 
392
        jz      @f
-
 
393
 
-
 
394
        add     ebx, 2
-
 
395
 
-
 
396
        cmp     [ebx+IDE_DEVICE.UDMA_possible_modes], al
-
 
397
        je      .ch2_pio_set
-
 
398
 
-
 
399
        cmp     [ebx+IDE_DEVICE.UDMA_set_mode], al
-
 
400
        je      .ch2_pio_set
-
 
401
;--------------------------------------
-
 
402
@@:
323
        mov     dx, [ecx+IDE_DATA.BAR3_val] ;0x374
403
        mov     dx, [ecx+IDE_DATA.BAR3_val] ;0x374
324
        add     dx, 2 ;0x376
404
        add     dx, 2 ;0x376
325
        out     dx, al
405
        out     dx, al
326
        DEBUGF  1, "K : IDE CH2 DMA enabled\n"
406
        DEBUGF  1, "K : IDE CH2 DMA enabled\n"
327
        mov     [ecx+IDE_DATA.dma_hdd_channel_2], byte 1
407
        mov     [ecx+IDE_DATA.dma_hdd_channel_2], byte 1
Line 348... Line 428...
348
;-----------------------------------------------------------------------------
428
;-----------------------------------------------------------------------------
349
        mov     esi, boot_detectpart
429
        mov     esi, boot_detectpart
350
        call    boot_log
430
        call    boot_log
351
include 'sear_par.inc'
431
include 'sear_par.inc'
352
;-----------------------------------------------------------------------------
432
;-----------------------------------------------------------------------------
-
 
433
        mov     esi, boot_init_sys
-
 
434
        call    boot_log
-
 
435
        call    Parser_params
-
 
436
 
-
 
437
if ~ defined extended_primary_loader
-
 
438
; ramdisk image should be loaded by extended primary loader if it exists
-
 
439
; READ RAMDISK IMAGE FROM HD
-
 
440
include '../boot/rdload.inc'
-
 
441
end if
-
 
442
;-----------------------------------------------------------------------------
353
        mov     ecx, IDE_controller_1
443
        mov     ecx, IDE_controller_1
354
        mov     [IDE_controller_pointer], ecx
444
        mov     [IDE_controller_pointer], ecx
355
        call    Init_IDE_ATA_controller_2
445
        call    Init_IDE_ATA_controller_2
356
        mov     ecx, IDE_controller_2
446
        mov     ecx, IDE_controller_2
357
        mov     [IDE_controller_pointer], ecx
447
        mov     [IDE_controller_pointer], ecx