Subversion Repositories Kolibri OS

Rev

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

Rev 3555 Rev 3725
Line 9... Line 9...
9
;;  KolibriOS 16-bit loader,                                    ;;
9
;;  KolibriOS 16-bit loader,                                    ;;
10
;;                        based on bootcode for MenuetOS        ;;
10
;;                        based on bootcode for MenuetOS        ;;
11
;;                                                              ;;
11
;;                                                              ;;
12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 13... Line 13...
13
 
13
 
Line 14... Line 14...
14
$Revision: 3555 $
14
$Revision: 3725 $
15
 
15
 
16
 
16
 
Line 385... Line 385...
385
; set up esp
385
; set up esp
386
        movzx   esp, sp
386
        movzx   esp, sp
Line 387... Line 387...
387
 
387
 
388
        push    0
388
        push    0
-
 
389
        pop     es
389
        pop     es
390
        xor     ax, ax
-
 
391
        and     word [es:BOOT_IDE_BASE_ADDR], ax        ;0
-
 
392
        and     word [es:BOOT_IDE_BAR0_16], ax  ;0
-
 
393
        and     word [es:BOOT_IDE_BAR1_16], ax  ;0
-
 
394
        and     word [es:BOOT_IDE_BAR2_16], ax  ;0
390
        and     word [es:BOOT_IDE_BASE_ADDR], 0
395
        and     word [es:BOOT_IDE_BAR3_16], ax  ;0
391
; \begin{Mario79}
396
; \begin{Mario79}
392
; find HDD IDE DMA PCI device
397
; find HDD IDE DMA PCI device
393
; check for PCI BIOS
398
; check for PCI BIOS
394
        mov     ax, 0xB101
399
        mov     ax, 0xB101
Line 398... Line 403...
398
        jnz     .nopci
403
        jnz     .nopci
399
; find PCI class code
404
; find PCI class code
400
; class 1 = mass storage
405
; class 1 = mass storage
401
; subclass 1 = IDE controller
406
; subclass 1 = IDE controller
402
; a) class 1, subclass 1, programming interface 0x80
407
; a) class 1, subclass 1, programming interface 0x80
-
 
408
; This is a Parallel IDE Controller which uses IRQs 14 and 15.
403
        mov     ax, 0xB103
409
        mov     ax, 0xB103
404
        mov     ecx, 1*10000h + 1*100h + 0x80
410
        mov     ecx, 1*10000h + 1*100h + 0x80
-
 
411
        mov     [es:BOOT_IDE_PI_16], cx
405
        xor     si, si  ; device index = 0
412
        xor     si, si  ; device index = 0
406
        int     0x1A
413
        int     0x1A
407
        jnc     .found
414
        jnc     .found_1 ; Parallel IDE Controller
408
; b) class 1, subclass 1, programming interface 0x8A
415
; b) class 1, subclass 1, programming interface 0x8f
409
        mov     ax, 0xB103
416
        mov     ax, 0xB103
410
        mov     ecx, 1*10000h + 1*100h + 0x8A
417
        mov     ecx, 1*10000h + 1*100h + 0x8f
-
 
418
        mov     [es:BOOT_IDE_PI_16], cx
411
        xor     si, si  ; device index = 0
419
        xor     si, si  ; device index = 0
412
        int     0x1A
420
        int     0x1A
413
        jnc     .found
421
        jnc     .found
414
; c) class 1, subclass 1, programming interface 0x85
422
; c) class 1, subclass 1, programming interface 0x85
415
        mov     ax, 0xB103
423
        mov     ax, 0xB103
416
        mov     ecx, 1*10000h + 1*100h + 0x85
424
        mov     ecx, 1*10000h + 1*100h + 0x85
-
 
425
        mov     [es:BOOT_IDE_PI_16], cx
417
        xor     si, si
426
        xor     si, si  ; device index = 0
418
        int     0x1A
427
        int     0x1A
-
 
428
        jnc     .found
-
 
429
; d) class 1, subclass 1, programming interface 0x8A
-
 
430
; This is a Parallel IDE Controller which uses IRQs 14 and 15.
-
 
431
        mov     ax, 0xB103
-
 
432
        mov     ecx, 1*10000h + 1*100h + 0x8A
-
 
433
        mov     [es:BOOT_IDE_PI_16], cx
-
 
434
        xor     si, si  ; device index = 0
-
 
435
        int     0x1A
-
 
436
        jnc     .found_1 ; Parallel IDE Controller
-
 
437
 
419
        jc      .nopci
438
        jmp     .nopci
420
.found:
439
.found_1:
421
; get memory base
440
; get memory base BAR4
422
        mov     ax, 0xB10A
441
        mov     ax, 0xB10A
423
        mov     di, 0x20        ; memory base is config register at 0x20
442
        mov     di, 0x20        ; memory base is config register at 0x20
-
 
443
        push    cx
424
        int     0x1A
444
        int     0x1A
425
        jc      .nopci
445
        jc      .no_BAR4        ;.nopci
426
        and     cx, 0xFFF0      ; clear address decode type
446
        and     cx, 0xFFF0      ; clear address decode type
427
        mov     [es:BOOT_IDE_BASE_ADDR], cx
447
        mov     [es:BOOT_IDE_BASE_ADDR], cx
-
 
448
.no_BAR4:
-
 
449
        pop     cx
-
 
450
.found: 
-
 
451
; get memory base BAR0
-
 
452
        mov     ax, 0xB10A
-
 
453
        mov     di, 0x10        ; memory base is config register at 0x10
-
 
454
        push    cx
-
 
455
        int     0x1A
-
 
456
        jc      .no_BAR0        ;.nopci
-
 
457
        mov     [es:BOOT_IDE_BAR0_16], cx
-
 
458
.no_BAR0:
-
 
459
        pop     cx
-
 
460
; get memory base BAR1
-
 
461
        mov     ax, 0xB10A
-
 
462
        mov     di, 0x14        ; memory base is config register at 0x14
-
 
463
        push    cx
-
 
464
        int     0x1A
-
 
465
        jc      .no_BAR1        ;.nopci
-
 
466
        mov     [es:BOOT_IDE_BAR1_16], cx
-
 
467
.no_BAR1:
-
 
468
        pop     cx
-
 
469
; get memory base BAR2
-
 
470
        mov     ax, 0xB10A
-
 
471
        mov     di, 0x18        ; memory base is config register at 0x18
-
 
472
        push    cx
-
 
473
        int     0x1A
-
 
474
        jc      .no_BAR2        ;.nopci
-
 
475
        mov     [es:BOOT_IDE_BAR2_16], cx
-
 
476
.no_BAR2:
-
 
477
        pop     cx
-
 
478
; get memory base BAR3
-
 
479
        mov     ax, 0xB10A
-
 
480
        mov     di, 0x1C        ; memory base is config register at 0x1c
-
 
481
        push    cx
-
 
482
        int     0x1A
-
 
483
        jc      .no_BAR3        ;.nopci
-
 
484
        mov     [es:BOOT_IDE_BAR3_16], cx
-
 
485
.no_BAR3:
-
 
486
        pop     cx
428
.nopci:
487
.nopci:
429
; \end{Mario79}
488
; \end{Mario79}
Line 430... Line 489...
430
 
489
 
431
        mov     al, 0xf6        ; Сброс клавиатуры, разрешить сканирование
490
        mov     al, 0xf6        ; Сброс клавиатуры, разрешить сканирование
Line 548... Line 607...
548
end if
607
end if
549
.preboot_device_inited:
608
.preboot_device_inited:
550
; following 4 lines set variables to 1 if its current value is 0
609
; following 4 lines set variables to 1 if its current value is 0
551
        cmp     byte [di+preboot_dma-preboot_device], 1
610
        cmp     byte [di+preboot_dma-preboot_device], 1
552
        adc     byte [di+preboot_dma-preboot_device], 0
611
        adc     byte [di+preboot_dma-preboot_device], 0
553
        cmp     byte [di+preboot_biosdisk-preboot_device], 1
612
;        cmp     byte [di+preboot_biosdisk-preboot_device], 1
554
        adc     byte [di+preboot_biosdisk-preboot_device], 0
613
;        adc     byte [di+preboot_biosdisk-preboot_device], 0
555
;; default value for VRR is OFF
614
;; default value for VRR is OFF
556
;        cmp     byte [di+preboot_vrrm-preboot_device], 0
615
;        cmp     byte [di+preboot_vrrm-preboot_device], 0
557
;        jnz	@f
616
;        jnz	@f
558
;        mov	byte [di+preboot_vrrm-preboot_device], 2
617
;        mov	byte [di+preboot_vrrm-preboot_device], 2
559
;@@:
618
;@@: