Subversion Repositories Kolibri OS

Rev

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

Rev 6015 Rev 6816
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2014-2015. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2014-2015. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 6015 $
8
$Revision: 6816 $
9
 
9
 
10
 
10
 
Line 29... Line 29...
29
;--------------------------------------
29
;--------------------------------------
30
.found:
30
.found:
31
        mov     eax, [esi+PCIDEV.class]
31
        mov     eax, [esi+PCIDEV.class]
32
        DEBUGF  1, 'K : IDE controller programming interface %x\n', eax
32
        DEBUGF  1, 'K : IDE controller programming interface %x\n', eax
33
        mov     [ecx+IDE_DATA.ProgrammingInterface], eax
33
        mov     [ecx+IDE_DATA.ProgrammingInterface], eax
-
 
34
        mov     [ecx+IDE_DATA.pcidev], esi
Line 34... Line 35...
34
 
35
 
35
        mov     ah, [esi+PCIDEV.bus]
36
        mov     ah, [esi+PCIDEV.bus]
36
        mov     al, 2
37
        mov     al, 2
37
        mov     bh, [esi+PCIDEV.devfn]
38
        mov     bh, [esi+PCIDEV.devfn]
Line 135... Line 136...
135
IDE_device_1 rd 2
136
IDE_device_1 rd 2
136
IDE_device_2 rd 2
137
IDE_device_2 rd 2
137
IDE_device_3 rd 2
138
IDE_device_3 rd 2
138
;--------------------------------------
139
;--------------------------------------
139
endg
140
endg
-
 
141
 
-
 
142
;--------------------------------------
-
 
143
; set Bus Master bit of Command PCI register
-
 
144
;--------------------------------------
-
 
145
set_pci_command_bus_master:
-
 
146
PCI_COMMAND_BUS_MASTER = 0x0004
-
 
147
        push    eax ecx
-
 
148
 
-
 
149
        mov     ecx, [ecx+IDE_DATA.pcidev]
-
 
150
        mov     ah, [ecx+PCIDEV.bus]
-
 
151
        mov     al, 1   ; word
-
 
152
        mov     bh, [ecx+PCIDEV.devfn]
-
 
153
        mov     bl, 0x4 ; Command register
-
 
154
        push    eax
-
 
155
        call    pci_read_reg
-
 
156
        mov     ecx, eax
-
 
157
        pop     eax
-
 
158
        test    ecx, PCI_COMMAND_BUS_MASTER     ; already set?
-
 
159
        jnz     @f
-
 
160
        or      ecx, PCI_COMMAND_BUS_MASTER
-
 
161
        call    pci_write_reg
-
 
162
@@:
-
 
163
        pop     ecx eax
-
 
164
        ret
-
 
165
 
140
;-----------------------------------------------------------------------------
166
;-----------------------------------------------------------------------------
141
; START of initialisation IDE ATA code
167
; START of initialisation IDE ATA code
142
;-----------------------------------------------------------------------------
168
;-----------------------------------------------------------------------------
143
Init_IDE_ATA_controller:
169
Init_IDE_ATA_controller:
144
        cmp     [ecx+IDE_DATA.ProgrammingInterface], 0
170
        cmp     [ecx+IDE_DATA.ProgrammingInterface], 0
Line 300... Line 326...
300
;--------------------------------------
326
;--------------------------------------
301
@@:
327
@@:
302
        mov     dx, [ecx+IDE_DATA.BAR1_val] ;0x3F4
328
        mov     dx, [ecx+IDE_DATA.BAR1_val] ;0x3F4
303
        add     dx, 2 ;0x3F6
329
        add     dx, 2 ;0x3F6
304
        out     dx, al
330
        out     dx, al
-
 
331
        call    set_pci_command_bus_master
305
        DEBUGF  1, "K : IDE CH1 DMA enabled\n"
332
        DEBUGF  1, "K : IDE CH1 DMA enabled\n"
306
        mov     [ecx+IDE_DATA.dma_hdd_channel_1], byte 1
333
        mov     [ecx+IDE_DATA.dma_hdd_channel_1], byte 1
307
;--------------------------------------
334
;--------------------------------------
308
.ch2_check:
335
.ch2_check:
309
        test    ah, 1010b ; check for ATAPI devices
336
        test    ah, 1010b ; check for ATAPI devices
Line 354... Line 381...
354
;--------------------------------------
381
;--------------------------------------
355
@@:
382
@@:
356
        mov     dx, [ecx+IDE_DATA.BAR3_val] ;0x374
383
        mov     dx, [ecx+IDE_DATA.BAR3_val] ;0x374
357
        add     dx, 2 ;0x376
384
        add     dx, 2 ;0x376
358
        out     dx, al
385
        out     dx, al
-
 
386
        call    set_pci_command_bus_master
359
        DEBUGF  1, "K : IDE CH2 DMA enabled\n"
387
        DEBUGF  1, "K : IDE CH2 DMA enabled\n"
360
        mov     [ecx+IDE_DATA.dma_hdd_channel_2], byte 1
388
        mov     [ecx+IDE_DATA.dma_hdd_channel_2], byte 1
361
;--------------------------------------
389
;--------------------------------------
362
.set_interrupts_for_IDE_controllers:
390
.set_interrupts_for_IDE_controllers:
363
        mov     esi, boot_set_int_IDE
391
        mov     esi, boot_set_int_IDE