Subversion Repositories Kolibri OS

Rev

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

Rev 4434 Rev 4923
Line 399... Line 399...
399
; set up esp
399
; set up esp
400
        movzx   esp, sp
400
        movzx   esp, sp
Line 401... Line 401...
401
 
401
 
402
        push    0
402
        push    0
403
        pop     es
-
 
404
        xor     ax, ax
-
 
405
        and     word [es:BOOT_IDE_BASE_ADDR], ax        ;0
-
 
406
        and     word [es:BOOT_IDE_BAR0_16], ax  ;0
-
 
407
        and     word [es:BOOT_IDE_BAR1_16], ax  ;0
-
 
408
        and     word [es:BOOT_IDE_BAR2_16], ax  ;0
-
 
409
        and     word [es:BOOT_IDE_BAR3_16], ax  ;0
-
 
410
; \begin{Mario79}
-
 
411
; find HDD IDE DMA PCI device
-
 
412
; check for PCI BIOS
-
 
413
        mov     ax, 0xB101
-
 
414
        int     0x1A
-
 
415
        jc      .nopci
-
 
416
        cmp     edx, 'PCI '
-
 
417
        jnz     .nopci
-
 
418
; find PCI class code
-
 
419
; class 1 = mass storage
-
 
420
; subclass 1 = IDE controller
-
 
421
; a) class 1, subclass 1, programming interface 0x80
-
 
422
; This is a Parallel IDE Controller which uses IRQs 14 and 15.
-
 
423
        mov     ax, 0xB103
-
 
424
        mov     ecx, 1*10000h + 1*100h + 0x80
-
 
425
        mov     [es:BOOT_IDE_PI_16], cx
-
 
426
        xor     si, si  ; device index = 0
-
 
427
        int     0x1A
-
 
428
        jnc     .found_1 ; Parallel IDE Controller
-
 
429
; b) class 1, subclass 1, programming interface 0x8f
-
 
430
        mov     ax, 0xB103
-
 
431
        mov     ecx, 1*10000h + 1*100h + 0x8f
-
 
432
        mov     [es:BOOT_IDE_PI_16], cx
-
 
433
        xor     si, si  ; device index = 0
-
 
434
        int     0x1A
-
 
435
        jnc     .found_1
-
 
436
; c) class 1, subclass 1, programming interface 0x85
-
 
437
        mov     ax, 0xB103
-
 
438
        mov     ecx, 1*10000h + 1*100h + 0x85
-
 
439
        mov     [es:BOOT_IDE_PI_16], cx
-
 
440
        xor     si, si  ; device index = 0
-
 
441
        int     0x1A
-
 
442
        jnc     .found_1
-
 
443
; d) class 1, subclass 1, programming interface 0x8A
-
 
444
; This is a Parallel IDE Controller which uses IRQs 14 and 15.
-
 
445
        mov     ax, 0xB103
-
 
446
        mov     ecx, 1*10000h + 1*100h + 0x8A
-
 
447
        mov     [es:BOOT_IDE_PI_16], cx
-
 
448
        xor     si, si  ; device index = 0
-
 
449
        int     0x1A
-
 
450
        jnc     .found_1 ; Parallel IDE Controller
-
 
451
; Controller not found!
-
 
452
        xor     ax, ax
-
 
453
        mov     [es:BOOT_IDE_PI_16], ax
-
 
454
        jmp     .nopci
-
 
455
;--------------------------------------
-
 
456
.found_1:
-
 
457
; get memory base BAR4
-
 
458
        mov     ax, 0xB10A
-
 
459
        mov     di, 0x20        ; memory base is config register at 0x20
-
 
460
        push    cx
-
 
461
        int     0x1A
-
 
462
        jc      .no_BAR4        ;.nopci
-
 
463
        and     cx, 0xFFFC      ; clear address decode type
-
 
464
        mov     [es:BOOT_IDE_BASE_ADDR], cx
-
 
465
.no_BAR4:
-
 
466
        pop     cx
-
 
467
;--------------------------------------
-
 
468
.found:
-
 
469
; get Interrupt Line
-
 
470
        mov     ax, 0xB10A
-
 
471
        mov     di, 0x3c        ; memory base is config register at 0x3c
-
 
472
        push    cx
-
 
473
        int     0x1A
-
 
474
        jc      .no_Interrupt        ;.nopci
-
 
475
 
-
 
476
        mov     [es:BOOT_IDE_INTERR_16], cx
-
 
477
.no_Interrupt:
-
 
478
        pop     cx
-
 
479
;--------------------------------------
-
 
480
; get memory base BAR0
-
 
481
        mov     ax, 0xB10A
-
 
482
        mov     di, 0x10        ; memory base is config register at 0x10
-
 
483
        push    cx
-
 
484
        int     0x1A
-
 
485
        jc      .no_BAR0        ;.nopci
-
 
486
 
-
 
487
        mov     [es:BOOT_IDE_BAR0_16], cx
-
 
488
.no_BAR0:
-
 
489
        pop     cx
-
 
490
;--------------------------------------
-
 
491
; get memory base BAR1
-
 
492
        mov     ax, 0xB10A
-
 
493
        mov     di, 0x14        ; memory base is config register at 0x14
-
 
494
        push    cx
-
 
495
        int     0x1A
-
 
496
        jc      .no_BAR1        ;.nopci
-
 
497
 
-
 
498
        mov     [es:BOOT_IDE_BAR1_16], cx
-
 
499
.no_BAR1:
-
 
500
        pop     cx
-
 
501
;--------------------------------------
-
 
502
; get memory base BAR2
-
 
503
        mov     ax, 0xB10A
-
 
504
        mov     di, 0x18        ; memory base is config register at 0x18
-
 
505
        push    cx
-
 
506
        int     0x1A
-
 
507
        jc      .no_BAR2        ;.nopci
-
 
508
 
-
 
509
        mov     [es:BOOT_IDE_BAR2_16], cx
-
 
510
.no_BAR2:
-
 
511
        pop     cx
-
 
512
;--------------------------------------
-
 
513
; get memory base BAR3
-
 
514
        mov     ax, 0xB10A
-
 
515
        mov     di, 0x1C        ; memory base is config register at 0x1c
-
 
516
        push    cx
-
 
517
        int     0x1A
-
 
518
        jc      .no_BAR3        ;.nopci
-
 
519
 
-
 
520
        mov     [es:BOOT_IDE_BAR3_16], cx
-
 
521
.no_BAR3:
-
 
522
        pop     cx
-
 
523
;--------------------------------------
-
 
524
.nopci:
-
 
Line 525... Line 403...
525
; \end{Mario79}
403
        pop     es
526
 
404
 
527
        mov     al, 0xf6        ; Сброс клавиатуры, разрешить сканирование
405
        mov     al, 0xf6        ; Сброс клавиатуры, разрешить сканирование
528
        out     0x60, al
406
        out     0x60, al