Subversion Repositories Kolibri OS

Rev

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

Rev 4711 Rev 4720
Line 144... Line 144...
144
;-----------------------------------------------------------------------------
144
;-----------------------------------------------------------------------------
145
; START of initialisation IDE ATA code
145
; START of initialisation IDE ATA code
146
;-----------------------------------------------------------------------------
146
;-----------------------------------------------------------------------------
147
Init_IDE_ATA_controller:
147
Init_IDE_ATA_controller:
148
        cmp     [ecx+IDE_DATA.ProgrammingInterface], 0
148
        cmp     [ecx+IDE_DATA.ProgrammingInterface], 0
149
        je      set_interrupts_for_IDE_controllers.continue
149
        jne     @f
Line -... Line 150...
-
 
150
 
-
 
151
        ret
-
 
152
;--------------------------------------
150
 
153
@@:
151
        mov     esi, boot_disabling_ide
154
        mov     esi, boot_disabling_ide
152
        call    boot_log
155
        call    boot_log
153
;--------------------------------------
156
;--------------------------------------
154
; Disable IDE interrupts, because the search
157
; Disable IDE interrupts, because the search
Line 171... Line 174...
171
        mov     ax, [ecx+IDE_DATA.BAR2_val]
174
        mov     ax, [ecx+IDE_DATA.BAR2_val]
172
        mov     [StandardATABases+2], ax
175
        mov     [StandardATABases+2], ax
Line 173... Line 176...
173
 
176
 
174
        mov     esi, boot_detecthdcd
177
        mov     esi, boot_detecthdcd
-
 
178
        call    boot_log
175
        call    boot_log
179
;--------------------------------------
-
 
180
include 'dev_hdcd.inc'
-
 
181
;--------------------------------------
176
include 'dev_hdcd.inc'
182
        ret
-
 
183
;-----------------------------------------------------------------------------
-
 
184
Init_IDE_ATA_controller_2:
-
 
185
        cmp     [ecx+IDE_DATA.ProgrammingInterface], 0
-
 
186
        jne     @f
-
 
187
 
-
 
188
        ret
-
 
189
;--------------------------------------
177
;-----------------------------------------------------------------------------
190
@@:
178
        mov     dx, [ecx+IDE_DATA.RegsBaseAddres]
191
        mov     dx, [ecx+IDE_DATA.RegsBaseAddres]
179
; test whether it is our interrupt?
192
; test whether it is our interrupt?
180
        add     dx, 2
193
        add     dx, 2
181
        in      al, dx
194
        in      al, dx
Line 202... Line 215...
202
        in      al, dx
215
        in      al, dx
203
        mov     dx, [ecx+IDE_DATA.BAR2_val] ;0x170
216
        mov     dx, [ecx+IDE_DATA.BAR2_val] ;0x170
204
        add     dx, 0x7 ;0x177
217
        add     dx, 0x7 ;0x177
205
        in      al, dx
218
        in      al, dx
206
;-----------------------------------------------------------------------------
219
;-----------------------------------------------------------------------------
207
        push    eax edx
220
;        push    eax edx
208
        mov     dx, [ecx+IDE_DATA.RegsBaseAddres]
221
;        mov     dx, [ecx+IDE_DATA.RegsBaseAddres]
209
        xor     eax, eax
222
;        xor     eax, eax
210
        add     dx, 2
223
;        add     dx, 2
211
        in      al, dx
224
;        in      al, dx
212
;        DEBUGF  1, "K : Primary Bus Master IDE Status Register %x\n", eax
225
;        DEBUGF  1, "K : Primary Bus Master IDE Status Register %x\n", eax
Line 213... Line 226...
213
 
226
 
214
        add     dx, 8
227
;        add     dx, 8
215
        in      al, dx
228
;        in      al, dx
216
;        DEBUGF  1, "K : Secondary Bus Master IDE Status Register %x\n", eax
229
;        DEBUGF  1, "K : Secondary Bus Master IDE Status Register %x\n", eax
Line 217... Line 230...
217
        pop     edx eax
230
;        pop     edx eax
218
 
231
 
219
        cmp     [ecx+IDE_DATA.RegsBaseAddres], 0
232
;        cmp     [ecx+IDE_DATA.RegsBaseAddres], 0
220
        setnz   [ecx+IDE_DATA.dma_hdd]
233
;        setnz   [ecx+IDE_DATA.dma_hdd]
221
;-----------------------------------------------------------------------------
234
;-----------------------------------------------------------------------------
222
; set interrupts for IDE Controller
235
; set interrupts for IDE Controller
223
;-----------------------------------------------------------------------------
236
;-----------------------------------------------------------------------------
224
        mov     esi, boot_set_int_IDE
237
        mov     esi, boot_set_int_IDE
225
        call    boot_log
238
        call    boot_log
226
set_interrupts_for_IDE_controllers:
239
.set_interrupts_for_IDE_controllers:
227
        mov     eax, [ecx+IDE_DATA.ProgrammingInterface]
240
        mov     eax, [ecx+IDE_DATA.ProgrammingInterface]
Line 228... Line 241...
228
        cmp     ax, 0x0180
241
        cmp     ax, 0x0180
Line 284... Line 297...
284
        mov     ah, [ebx+DRIVE_DATA+1]
297
        mov     ah, [ebx+DRIVE_DATA+1]
285
        test    ah, 10100000b
298
        test    ah, 10100000b
286
        jz      @f
299
        jz      @f
Line 287... Line 300...
287
 
300
 
-
 
301
        DEBUGF  1, "K : IDE CH1 PIO, because ATAPI drive present\n"
-
 
302
        mov     [ecx+IDE_DATA.dma_hdd_channel_1], byte 0
288
        DEBUGF  1, "K : IDE CH1 PIO, because ATAPI drive present\n"
303
 
289
        jmp     .ch2_check
304
        jmp     .ch2_check
290
;--------------------------------------
305
;--------------------------------------
291
@@:
306
@@:
292
        mov     dx, [ecx+IDE_DATA.BAR1_val] ;0x3F4
307
        mov     dx, [ecx+IDE_DATA.BAR1_val] ;0x3F4
293
        add     dx, 2 ;0x3F6
308
        add     dx, 2 ;0x3F6
294
        out     dx, al
309
        out     dx, al
-
 
310
        DEBUGF  1, "K : IDE CH1 DMA enabled\n"
295
        DEBUGF  1, "K : IDE CH1 DMA enabled\n"
311
        mov     [ecx+IDE_DATA.dma_hdd_channel_1], byte 1
296
;--------------------------------------
312
;--------------------------------------
297
.ch2_check:
313
.ch2_check:
298
        test    ah, 1010b
314
        test    ah, 1010b
Line 299... Line 315...
299
        jz      @f
315
        jz      @f
-
 
316
 
-
 
317
        DEBUGF  1, "K : IDE CH2 PIO, because ATAPI drive present\n"
300
 
318
        mov     [ecx+IDE_DATA.dma_hdd_channel_2], byte 0
301
        DEBUGF  1, "K : IDE CH2 PIO, because ATAPI drive present\n"
319
 
302
        jmp     .end_set_interrupts
320
        jmp     .end_set_interrupts
303
;--------------------------------------
321
;--------------------------------------
304
@@:
322
@@:
305
        mov     dx, [ecx+IDE_DATA.BAR3_val] ;0x374
323
        mov     dx, [ecx+IDE_DATA.BAR3_val] ;0x374
306
        add     dx, 2 ;0x376
324
        add     dx, 2 ;0x376
-
 
325
        out     dx, al
307
        out     dx, al
326
        DEBUGF  1, "K : IDE CH2 DMA enabled\n"
308
        DEBUGF  1, "K : IDE CH2 DMA enabled\n"
327
        mov     [ecx+IDE_DATA.dma_hdd_channel_2], byte 1
309
;--------------------------------------
-
 
310
.end_set_interrupts:
-
 
311
;-----------------------------------------------------------------------------
-
 
312
        cmp     [ecx+IDE_DATA.dma_hdd], 0
-
 
313
        je      .print_pio
-
 
314
;--------------------------------------
-
 
315
.print_dma:
-
 
316
        DEBUGF  1, "K : IDE DMA mode\n"
-
 
317
        jmp     .continue
-
 
318
;--------------------------------------
-
 
319
.print_pio:
-
 
320
        DEBUGF  1, "K : IDE PIO mode\n"
328
;--------------------------------------
321
.continue:
329
.end_set_interrupts:
322
        ret
330
        ret
323
;-----------------------------------------------------------------------------
331
;-----------------------------------------------------------------------------
324
; END of initialisation IDE ATA code
332
; END of initialisation IDE ATA code
Line 340... Line 348...
340
;-----------------------------------------------------------------------------
348
;-----------------------------------------------------------------------------
341
        mov     esi, boot_detectpart
349
        mov     esi, boot_detectpart
342
        call    boot_log
350
        call    boot_log
343
include 'sear_par.inc'
351
include 'sear_par.inc'
344
;-----------------------------------------------------------------------------
352
;-----------------------------------------------------------------------------
-
 
353
        mov     ecx, IDE_controller_1
-
 
354
        mov     [IDE_controller_pointer], ecx
-
 
355
        call    Init_IDE_ATA_controller_2
-
 
356
        mov     ecx, IDE_controller_2
-
 
357
        mov     [IDE_controller_pointer], ecx
-
 
358
        call    Init_IDE_ATA_controller_2
-
 
359
        mov     ecx, IDE_controller_3
-
 
360
        mov     [IDE_controller_pointer], ecx
-
 
361
        call    Init_IDE_ATA_controller_2
-
 
362
;-----------------------------------------------------------------------------