Subversion Repositories Kolibri OS

Rev

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

Rev 3742 Rev 3762
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2013. 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: 3742 $
8
$Revision: 3762 $
9
 
9
 
10
 
10
 
Line 702... Line 702...
702
 
702
 
703
buf_wait_ok:
703
buf_wait_ok:
704
        pop     edx eax
704
        pop     edx eax
705
        ret
705
        ret
-
 
706
;-----------------------------------------------------------------------------
-
 
707
irq14_num equ byte 14
-
 
708
irq15_num equ byte 15
706
;-----------------------------------------------------------------------------
709
;-----------------------------------------------------------------------------
707
align 4
710
align 4
708
wait_for_sector_dma_ide0:
711
wait_for_sector_dma_ide0:
709
        push    eax
712
        push    eax
710
        push    edx
713
        push    edx
711
        call    save_hd_wait_timeout
714
        call    save_hd_wait_timeout
712
;--------------------------------------
715
;--------------------------------------
713
align 4
716
align 4
714
.wait:
717
.wait:
715
        call    change_task
718
        call    change_task
716
        cmp     [irq14_func], hdd_irq14
719
        cmp     [IDE_common_irq_param], irq14_num
-
 
720
        jnz     .done
717
        jnz     .done
721
 
718
        call    check_hd_wait_timeout
722
        call    check_hd_wait_timeout
719
        cmp     [hd_error], 0
723
        cmp     [hd_error], 0
-
 
724
        jz      .wait
720
        jz      .wait
725
 
721
        mov     [irq14_func], hdd_irq_null
726
        mov     [IDE_common_irq_param], 0
722
        mov     dx, [IDEContrRegsBaseAddr]
727
        mov     dx, [IDEContrRegsBaseAddr]
723
        mov     al, 0
728
        mov     al, 0
724
        out     dx, al
729
        out     dx, al
725
.done:
730
.done:
Line 734... Line 739...
734
        call    save_hd_wait_timeout
739
        call    save_hd_wait_timeout
735
;--------------------------------------
740
;--------------------------------------
736
align 4
741
align 4
737
.wait:
742
.wait:
738
        call    change_task
743
        call    change_task
739
        cmp     [irq15_func], hdd_irq15
744
        cmp     [IDE_common_irq_param], irq15_num
740
        jnz     .done
745
        jnz     .done
-
 
746
 
741
        call    check_hd_wait_timeout
747
        call    check_hd_wait_timeout
742
        cmp     [hd_error], 0
748
        cmp     [hd_error], 0
743
        jz      .wait
749
        jz      .wait
-
 
750
 
744
        mov     [irq15_func], hdd_irq_null
751
        mov     [IDE_common_irq_param], 0
745
        mov     dx, [IDEContrRegsBaseAddr]
752
        mov     dx, [IDEContrRegsBaseAddr]
746
        add     dx, 8
753
        add     dx, 8
747
        mov     al, 0
754
        mov     al, 0
748
        out     dx, al
755
        out     dx, al
749
.done:
756
.done:
Line 759... Line 766...
759
        dw 0x2000
766
        dw 0x2000
760
        dw 0x8000
767
        dw 0x8000
Line 761... Line 768...
761
 
768
 
762
dma_cur_sector  dd not 40h
769
dma_cur_sector  dd not 40h
763
dma_hdpos       dd 0
-
 
764
irq14_func      dd hdd_irq_null
770
dma_hdpos       dd 0
765
irq15_func      dd hdd_irq_null
771
IDE_common_irq_param db 0
766
endg
772
endg
767
;-----------------------------------------------------------------------------
773
;-----------------------------------------------------------------------------
768
uglobal
774
uglobal
769
; all uglobals are zeroed at boot
775
; all uglobals are zeroed at boot
Line 777... Line 783...
777
dma_hdd             db 0
783
dma_hdd             db 0
778
allow_dma_access    db 0
784
allow_dma_access    db 0
779
endg
785
endg
780
;-----------------------------------------------------------------------------
786
;-----------------------------------------------------------------------------
781
align 4
787
align 4
782
hdd_irq14:
788
IDE_common_irq_handler:
783
        pushfd
789
        pushfd
784
        cli
790
        cli
785
        pushad
791
        pushad
-
 
792
 
-
 
793
        xor     ebx, ebx
786
        mov     [irq14_func], hdd_irq_null
794
        mov     eax, IDE_common_irq_param
-
 
795
        cmp     [eax], irq15_num
-
 
796
        mov     [eax], ebx
-
 
797
        je      @f
-
 
798
;--------------------------------------
787
        mov     dx, [IDEContrRegsBaseAddr]
799
        mov     dx, [IDEContrRegsBaseAddr]
788
        mov     al, 0
800
        mov     al, 0
789
        out     dx, al
801
        out     dx, al
790
        popad
-
 
791
        popfd
802
        jmp     .end
792
align 4
-
 
793
hdd_irq_null:
-
 
794
        ret
-
 
795
;-----------------------------------------------------------------------------
803
;--------------------------------------
796
align 4
804
align 4
797
hdd_irq15:
805
@@:
798
        pushfd
-
 
799
        cli
-
 
800
        pushad
-
 
801
        mov     [irq15_func], hdd_irq_null
-
 
802
        mov     dx, [IDEContrRegsBaseAddr]
806
        mov     dx, [IDEContrRegsBaseAddr]
803
        add     dx, 8
807
        add     dx, 8
804
        mov     al, 0
808
        mov     al, 0
805
        out     dx, al
809
        out     dx, al
-
 
810
;--------------------------------------
-
 
811
align 4
-
 
812
.end:
806
        popad
813
        popad
807
        popfd
814
        popfd
-
 
815
        mov     al, 1
808
        ret
816
        ret
809
;-----------------------------------------------------------------------------
817
;-----------------------------------------------------------------------------
810
align 4
818
align 4
811
hd_read_dma:
819
hd_read_dma:
812
        push    eax
820
        push    eax
Line 954... Line 962...
954
        mov     eax, [TASK_BASE]
962
        mov     eax, [TASK_BASE]
955
        mov     [dma_slot_ptr], eax
963
        mov     [dma_slot_ptr], eax
956
        mov     eax, [hd_address_table]
964
        mov     eax, [hd_address_table]
957
        cmp     [hdbase], eax ; 0x1F0
965
        cmp     [hdbase], eax ; 0x1F0
958
        jnz     .ide1
966
        jnz     .ide1
-
 
967
 
959
        mov     [irq14_func], hdd_irq14
968
        mov     [IDE_common_irq_param], irq14_num
960
        jmp     @f
969
        jmp     @f
961
.ide1:
970
.ide1:
962
        mov     [irq15_func], hdd_irq15
971
        mov     [IDE_common_irq_param], irq15_num
963
@@:
972
@@:
964
        popfd
973
        popfd
965
        mov     eax, [hd_address_table]
974
        mov     eax, [hd_address_table]
966
        cmp     [hdbase], eax ; 0x1F0
975
        cmp     [hdbase], eax ; 0x1F0
967
        jnz     .wait_ide1
976
        jnz     .wait_ide1
Line 1111... Line 1120...
1111
        mov     eax, [TASK_BASE]
1120
        mov     eax, [TASK_BASE]
1112
        mov     [dma_slot_ptr], eax
1121
        mov     [dma_slot_ptr], eax
1113
        mov     eax, [hd_address_table]
1122
        mov     eax, [hd_address_table]
1114
        cmp     [hdbase], eax ; 0x1F0
1123
        cmp     [hdbase], eax ; 0x1F0
1115
        jnz     .ide1
1124
        jnz     .ide1
-
 
1125
 
1116
        mov     [irq14_func], hdd_irq14
1126
        mov     [IDE_common_irq_param], irq14_num
1117
        jmp     @f
1127
        jmp     @f
1118
.ide1:
1128
.ide1:
1119
        mov     [irq15_func], hdd_irq15
1129
        mov     [IDE_common_irq_param], irq15_num
1120
@@:
1130
@@:
1121
        popfd
1131
        popfd
1122
        mov     [dma_cur_sector], not 0x40
1132
        mov     [dma_cur_sector], not 0x40
1123
        mov     eax, [hd_address_table]
1133
        mov     eax, [hd_address_table]
1124
        cmp     [hdbase], eax ; 0x1F0
1134
        cmp     [hdbase], eax ; 0x1F0
Line 1132... Line 1142...
1132
        jnz     hd_write_error_dma
1142
        jnz     hd_write_error_dma
1133
        pop     esi
1143
        pop     esi
1134
        ret
1144
        ret
1135
;-----------------------------------------------------------------------------
1145
;-----------------------------------------------------------------------------
1136
uglobal
1146
uglobal
-
 
1147
IDE_Interrupt   dw ?
1137
IDEContrRegsBaseAddr         dw ?
1148
IDEContrRegsBaseAddr         dw ?
1138
IDEContrProgrammingInterface dw ?
1149
IDEContrProgrammingInterface dw ?
1139
IDE_BAR0_val    dw ?
1150
IDE_BAR0_val    dw ?
1140
IDE_BAR1_val    dw ?
1151
IDE_BAR1_val    dw ?
1141
IDE_BAR2_val    dw ?
1152
IDE_BAR2_val    dw ?