Subversion Repositories Kolibri OS

Rev

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

Rev 3742 Rev 3762
Line 69... Line 69...
69
format binary as "mnt"
69
format binary as "mnt"
Line 70... Line 70...
70
 
70
 
71
include 'macros.inc'
71
include 'macros.inc'
Line 72... Line 72...
72
include 'struct.inc'
72
include 'struct.inc'
Line 73... Line 73...
73
 
73
 
74
$Revision: 3742 $
74
$Revision: 3762 $
Line 363... Line 363...
363
        mov     ecx, ide_channel2_mutex
363
        mov     ecx, ide_channel2_mutex
364
        call    mutex_init
364
        call    mutex_init
Line 365... Line 365...
365
 
365
 
366
; SAVE REAL MODE VARIABLES
366
; SAVE REAL MODE VARIABLES
-
 
367
        xor     eax, eax
-
 
368
        mov     ax, [BOOT_VARS + BOOT_IDE_INTERR_16]
367
        xor     eax, eax
369
        mov     [IDE_Interrupt], ax
368
        mov     ax, [BOOT_VARS + BOOT_IDE_PI_16]
370
        mov     ax, [BOOT_VARS + BOOT_IDE_PI_16]
369
        mov     [IDEContrProgrammingInterface], ax
371
        mov     [IDEContrProgrammingInterface], ax
370
        mov     ax, [BOOT_VARS + BOOT_IDE_BASE_ADDR]
372
        mov     ax, [BOOT_VARS + BOOT_IDE_BASE_ADDR]
371
        mov     [IDEContrRegsBaseAddr], ax
373
        mov     [IDEContrRegsBaseAddr], ax
Line 715... Line 717...
715
; they are used: when partitions are scanned, hd_read relies on timer
717
; they are used: when partitions are scanned, hd_read relies on timer
716
        call    unmask_timer
718
        call    unmask_timer
717
        stdcall enable_irq, 2               ; @#$%! PIC
719
        stdcall enable_irq, 2               ; @#$%! PIC
718
        stdcall enable_irq, 6               ; FDD
720
        stdcall enable_irq, 6               ; FDD
719
        stdcall enable_irq, 13              ; co-processor
721
        stdcall enable_irq, 13              ; co-processor
720
        stdcall enable_irq, 14
-
 
721
        stdcall enable_irq, 15
-
 
Line 722... Line 722...
722
 
722
 
723
        mov     esi, boot_enablint_ide
723
        mov     esi, boot_disabling_ide
-
 
724
        call    boot_log
-
 
725
;--------------------------------------
-
 
726
; Disable IDE interrupts, because the search
-
 
727
; for IDE partitions is in the PIO mode.
-
 
728
;--------------------------------------
724
        call    boot_log
729
.disable_IDE_interrupt:
725
; Enable interrupts in IDE controller
730
; Disable interrupts in IDE controller for PIO
-
 
731
        mov     al, 2
726
        mov     al, 0
732
        mov     dx, [IDE_BAR1_val] ;0x3F6
727
        mov     dx, 0x3F6
733
        add     dx, 2
-
 
734
        out     dx, al
728
        out     dx, al
735
        mov     dx, [IDE_BAR3_val] ;0x76
729
        mov     dl, 0x76
736
        add     dx, 2
730
        out     dx, al
-
 
-
 
737
        out     dx, al
731
 
738
;-----------------------------------------------------------------------------
732
;!!!!!!!!!!!!!!!!!!!!!!!!!!
739
;!!!!!!!!!!!!!!!!!!!!!!!!!!
733
;        mov     esi, boot_detectdisks
740
;        mov     esi, boot_detectdisks
734
;        call    boot_log
741
;        call    boot_log
735
;include 'detect/disks.inc'
742
;include 'detect/disks.inc'
Line 975... Line 982...
975
;        call  kb_read
982
;        call  kb_read
976
     ;// mike.dld [
983
     ;// mike.dld [
977
        call    set_lights
984
        call    set_lights
978
     ;// mike.dld ]
985
     ;// mike.dld ]
979
        stdcall attach_int_handler, 1, irq1, 0
986
        stdcall attach_int_handler, 1, irq1, 0
-
 
987
        DEBUGF  1, "K : IRQ0 error code %x\n", eax
980
.no_keyboard:
988
.no_keyboard:
Line 981... Line 989...
981
 
989
 
Line 982... Line 990...
982
; SET MOUSE
990
; SET MOUSE
Line 1042... Line 1050...
1042
        DEBUGF  1, "K : BAR1 %x \n", [IDE_BAR1_val]:4
1050
        DEBUGF  1, "K : BAR1 %x \n", [IDE_BAR1_val]:4
1043
        DEBUGF  1, "K : BAR2 %x \n", [IDE_BAR2_val]:4
1051
        DEBUGF  1, "K : BAR2 %x \n", [IDE_BAR2_val]:4
1044
        DEBUGF  1, "K : BAR3 %x \n", [IDE_BAR3_val]:4
1052
        DEBUGF  1, "K : BAR3 %x \n", [IDE_BAR3_val]:4
1045
        DEBUGF  1, "K : BAR4 %x \n", [IDEContrRegsBaseAddr]:4
1053
        DEBUGF  1, "K : BAR4 %x \n", [IDEContrRegsBaseAddr]:4
1046
        DEBUGF  1, "K : IDEContrProgrammingInterface %x \n", [IDEContrProgrammingInterface]:4
1054
        DEBUGF  1, "K : IDEContrProgrammingInterface %x \n", [IDEContrProgrammingInterface]:4
-
 
1055
        DEBUGF  1, "K : IDE_Interrupt %x \n", [IDE_Interrupt]:4
1047
; START MULTITASKING
1056
; START MULTITASKING
Line 1048... Line 1057...
1048
 
1057
 
1049
; A 'All set - press ESC to start' messages if need
1058
; A 'All set - press ESC to start' messages if need
1050
if preboot_blogesc
1059
if preboot_blogesc
Line 1057... Line 1066...
1057
end if
1066
end if
Line 1058... Line 1067...
1058
 
1067
 
1059
        cmp     [IDEContrRegsBaseAddr], 0
1068
        cmp     [IDEContrRegsBaseAddr], 0
Line -... Line 1069...
-
 
1069
        setnz   [dma_hdd]
-
 
1070
 
-
 
1071
;-----------------------------------------------------------------------------
-
 
1072
; set interrupts for IDE Controller
-
 
1073
;-----------------------------------------------------------------------------
-
 
1074
        mov     esi, boot_set_int_IDE
-
 
1075
        call    boot_log
-
 
1076
set_interrupts_for_IDE_controllers:
-
 
1077
        mov     ax, [IDEContrProgrammingInterface]
-
 
1078
        cmp     ax, 0x0180
-
 
1079
        je      .pata_ide
-
 
1080
 
-
 
1081
        cmp     ax, 0x018a
-
 
1082
        jne     .sata_ide
-
 
1083
;--------------------------------------
-
 
1084
.pata_ide:
-
 
1085
        cmp     [IDEContrRegsBaseAddr], 0
-
 
1086
        je      .end_set_interrupts
-
 
1087
 
-
 
1088
        stdcall attach_int_handler, 14, IDE_common_irq_handler, 0
-
 
1089
        DEBUGF  1, "K : Set IDE IRQ14 return code %x\n", eax
-
 
1090
        stdcall attach_int_handler, 15, IDE_common_irq_handler, 0
-
 
1091
        DEBUGF  1, "K : Set IDE IRQ15 return code %x\n", eax
-
 
1092
 
-
 
1093
        stdcall enable_irq, 14
-
 
1094
        stdcall enable_irq, 15
-
 
1095
 
-
 
1096
        jmp     .enable_IDE_interrupt
-
 
1097
;--------------------------------------
-
 
1098
.sata_ide:
-
 
1099
        cmp     ax, 0x0185
-
 
1100
        je      .sata_ide_1
-
 
1101
 
-
 
1102
        cmp     ax, 0x018f
-
 
1103
        jne     .end_set_interrupts
-
 
1104
;--------------------------------------
-
 
1105
.sata_ide_1:
-
 
1106
        cmp     [IDEContrRegsBaseAddr], 0
-
 
1107
        je      .end_set_interrupts
-
 
1108
 
-
 
1109
        mov     ax, [IDE_Interrupt]
-
 
1110
        movzx   eax, al
-
 
1111
        stdcall attach_int_handler, eax, IDE_common_irq_handler, 0
-
 
1112
        DEBUGF  1, "K : Set IDE IRQ%d return code %x\n", [IDE_Interrupt]:2, eax
-
 
1113
 
-
 
1114
        stdcall enable_irq, eax
-
 
1115
;--------------------------------------
-
 
1116
.enable_IDE_interrupt:
-
 
1117
        mov     esi, boot_enabling_ide
-
 
1118
        call    boot_log
-
 
1119
; Enable interrupts in IDE controller for DMA
-
 
1120
        mov     al, 0
-
 
1121
        mov     dx, [IDE_BAR1_val] ;0x3F6
-
 
1122
        add     dx, 2
-
 
1123
        out     dx, al
-
 
1124
        mov     dx, [IDE_BAR3_val] ;0x76
-
 
1125
        add     dx, 2
-
 
1126
        out     dx, al
-
 
1127
;--------------------------------------
1060
        setnz   [dma_hdd]
1128
.end_set_interrupts:
1061
 
1129
;-----------------------------------------------------------------------------
1062
        cmp     [dma_hdd], 0
1130
        cmp     [dma_hdd], 0
1063
        je      .print_pio
1131
        je      .print_pio
1064
.print_dma:
1132
.print_dma: