Rev 4273 | Rev 4420 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4273 | Rev 4291 | ||
---|---|---|---|
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: 4273 $ |
8 | $Revision: 4291 $ |
9 | 9 | ||
10 | 10 | ||
Line 110... | Line 110... | ||
110 | ; DMA read is permitted if [allow_dma_access]=1 or 2 |
110 | ; DMA read is permitted if [allow_dma_access]=1 or 2 |
111 | cmp [allow_dma_access], 2 |
111 | cmp [allow_dma_access], 2 |
112 | ja .nodma |
112 | ja .nodma |
113 | cmp [dma_hdd], 1 |
113 | cmp [dma_hdd], 1 |
114 | jnz .nodma |
114 | jnz .nodma |
- | 115 | ;-------------------------------------- |
|
- | 116 | push eax |
|
- | 117 | mov eax, [hd_address_table] |
|
- | 118 | cmp [hdbase], eax ; 0x1F0 |
|
- | 119 | pop eax |
|
- | 120 | jnz @f |
|
- | 121 | ||
- | 122 | test [DRIVE_DATA+1], byte 10100000b |
|
- | 123 | jnz .nodma |
|
- | 124 | ||
- | 125 | jmp .dma |
|
- | 126 | @@: |
|
- | 127 | test [DRIVE_DATA+1], byte 1010b |
|
- | 128 | jnz .nodma |
|
- | 129 | .dma: |
|
- | 130 | ;-------------------------------------- |
|
115 | call hd_read_dma |
131 | call hd_read_dma |
116 | jmp @f |
132 | jmp @f |
117 | .nodma: |
133 | .nodma: |
118 | call hd_read_pio |
134 | call hd_read_pio |
119 | @@: |
135 | @@: |
Line 202... | Line 218... | ||
202 | ; DMA write is permitted only if [allow_dma_access]=1 |
218 | ; DMA write is permitted only if [allow_dma_access]=1 |
203 | cmp [allow_dma_access], 2 |
219 | cmp [allow_dma_access], 2 |
204 | jae .nodma |
220 | jae .nodma |
205 | cmp [dma_hdd], 1 |
221 | cmp [dma_hdd], 1 |
206 | jnz .nodma |
222 | jnz .nodma |
- | 223 | ;-------------------------------------- |
|
- | 224 | push eax |
|
- | 225 | mov eax, [hd_address_table] |
|
- | 226 | cmp [hdbase], eax ; 0x1F0 |
|
- | 227 | pop eax |
|
- | 228 | jnz @f |
|
- | 229 | ||
- | 230 | test [DRIVE_DATA+1], byte 10100000b |
|
- | 231 | jnz .nodma |
|
- | 232 | ||
- | 233 | jmp .dma |
|
- | 234 | @@: |
|
- | 235 | test [DRIVE_DATA+1], byte 1010b |
|
- | 236 | jnz .nodma |
|
- | 237 | .dma: |
|
- | 238 | ;-------------------------------------- |
|
207 | call cache_write_dma |
239 | call cache_write_dma |
208 | jmp .common |
240 | jmp .common |
209 | .nodma: |
241 | .nodma: |
210 | mov [cache_chain_size], 1 |
242 | mov [cache_chain_size], 1 |
211 | call cache_write_pio |
243 | call cache_write_pio |
Line 801... | Line 833... | ||
801 | jne .exit |
833 | jne .exit |
Line 802... | Line 834... | ||
802 | 834 | ||
803 | pushfd |
835 | pushfd |
804 | cli |
836 | cli |
805 | pushad |
- | |
806 | ; clear Bus Master IDE Command register |
837 | pushad |
807 | mov [IDE_common_irq_param], 0 |
838 | mov [IDE_common_irq_param], 0 |
- | 839 | mov dx, [IDEContrRegsBaseAddr] |
|
- | 840 | ; test whether it is our interrupt? |
|
808 | mov dx, [IDEContrRegsBaseAddr] |
841 | add edx, 2 |
- | 842 | in al, dx |
|
809 | mov al, 0 |
843 | test al, 100b |
810 | out dx, al |
844 | jz @f |
811 | ; clear Bus Master IDE Status register |
845 | ; clear Bus Master IDE Status register |
812 | ; clear Interrupt bit |
- | |
813 | add edx, 2 |
- | |
814 | mov al, 4 ; 100b |
846 | ; clear Interrupt bit |
- | 847 | out dx, al |
|
- | 848 | ; clear Bus Master IDE Command register |
|
- | 849 | sub edx, 2 |
|
- | 850 | xor eax, eax |
|
- | 851 | out dx, al |
|
- | 852 | ; read status register and remove the interrupt request |
|
- | 853 | mov edx, [hdbase] |
|
- | 854 | add edx, 0x7 |
|
- | 855 | in al, dx |
|
- | 856 | popad |
|
- | 857 | popfd |
|
- | 858 | mov al, 1 |
|
- | 859 | ret |
|
- | 860 | ;-------------------------------------- |
|
815 | out dx, al |
861 | align 4 |
816 | 862 | @@: |
|
817 | popad |
863 | popad |
818 | popfd |
864 | popfd |
819 | ;-------------------------------------- |
865 | ;-------------------------------------- |
820 | align 4 |
866 | align 4 |
821 | .exit: |
867 | .exit: |
822 | mov al, 1 |
868 | mov al, 0 |
823 | ret |
869 | ret |
824 | ;----------------------------------------------------------------------------- |
870 | ;----------------------------------------------------------------------------- |
825 | align 4 |
871 | align 4 |
826 | IDE_irq_15_handler: |
872 | IDE_irq_15_handler: |
827 | cmp [IDE_common_irq_param], irq15_num |
873 | cmp [IDE_common_irq_param], irq15_num |
Line 828... | Line 874... | ||
828 | jne .exit |
874 | jne .exit |
829 | 875 | ||
830 | pushfd |
876 | pushfd |
831 | cli |
- | |
832 | pushad |
877 | cli |
833 | ; clear Bus Master IDE Command register |
878 | pushad |
834 | mov [IDE_common_irq_param], 0 |
879 | mov [IDE_common_irq_param], 0 |
- | 880 | mov dx, [IDEContrRegsBaseAddr] |
|
- | 881 | add dx, 8 |
|
835 | mov dx, [IDEContrRegsBaseAddr] |
882 | ; test whether it is our interrupt? |
- | 883 | add edx, 2 |
|
836 | add dx, 8 |
884 | in al, dx |
837 | mov al, 0 |
885 | test al, 100b |
838 | out dx, al |
886 | jz @f |
839 | ; clear Bus Master IDE Status register |
- | |
840 | ; clear Interrupt bit |
- | |
841 | add edx, 2 |
887 | ; clear Bus Master IDE Status register |
- | 888 | ; clear Interrupt bit |
|
- | 889 | out dx, al |
|
- | 890 | ; clear Bus Master IDE Command register |
|
- | 891 | sub edx, 2 |
|
- | 892 | mov al, 0 |
|
- | 893 | out dx, al |
|
- | 894 | ; read status register and remove the interrupt request |
|
- | 895 | mov edx, [hdbase] |
|
- | 896 | add edx, 0x7 |
|
- | 897 | in al, dx |
|
- | 898 | popad |
|
- | 899 | popfd |
|
- | 900 | mov al, 1 |
|
- | 901 | ret |
|
842 | mov al, 4 ; 100b |
902 | ;-------------------------------------- |
843 | out dx, al |
903 | align 4 |
844 | 904 | @@: |
|
845 | popad |
905 | popad |
846 | popfd |
906 | popfd |
847 | ;-------------------------------------- |
907 | ;-------------------------------------- |
848 | align 4 |
908 | align 4 |
849 | .exit: |
909 | .exit: |
850 | mov al, 1 |
910 | mov al, 0 |
851 | ret |
911 | ret |
852 | ;----------------------------------------------------------------------------- |
912 | ;----------------------------------------------------------------------------- |
853 | align 4 |
913 | align 4 |
854 | IDE_common_irq_handler: |
914 | IDE_common_irq_handler: |
Line 855... | Line 915... | ||
855 | cmp [IDE_common_irq_param], 0 |
915 | cmp [IDE_common_irq_param], 0 |
856 | je .exit |
916 | je .exit |
857 | 917 | ||
858 | pushfd |
- | |
859 | cli |
918 | pushfd |
860 | pushad |
919 | cli |
861 | ; clear Bus Master IDE Command register |
920 | pushad |
862 | xor ebx, ebx |
921 | xor ebx, ebx |
863 | mov dx, [IDEContrRegsBaseAddr] |
922 | mov dx, [IDEContrRegsBaseAddr] |
864 | mov eax, IDE_common_irq_param |
- | |
865 | cmp [eax], irq14_num |
923 | mov eax, IDE_common_irq_param |
Line 866... | Line 924... | ||
866 | mov [eax], bl |
924 | cmp [eax], irq14_num |
867 | xor eax, eax |
925 | mov [eax], bl |
868 | je @f |
926 | je @f |
869 | 927 | ||
- | 928 | add dx, 8 |
|
870 | add dx, 8 |
929 | ;-------------------------------------- |
- | 930 | align 4 |
|
- | 931 | @@: |
|
- | 932 | ; test whether it is our interrupt? |
|
871 | ;-------------------------------------- |
933 | add edx, 2 |
872 | align 4 |
934 | in al, dx |
873 | @@: |
- | |
874 | out dx, al |
- | |
875 | ; clear Bus Master IDE Status register |
935 | test al, 100b |
- | 936 | jz @f |
|
- | 937 | ; clear Bus Master IDE Status register |
|
- | 938 | ; clear Interrupt bit |
|
- | 939 | out dx, al |
|
- | 940 | ; clear Bus Master IDE Command register |
|
- | 941 | sub edx, 2 |
|
- | 942 | xor eax, eax |
|
- | 943 | out dx, al |
|
- | 944 | ; read status register and remove the interrupt request |
|
- | 945 | mov edx, [hdbase] |
|
- | 946 | add edx, 0x7 |
|
- | 947 | in al, dx |
|
- | 948 | popad |
|
- | 949 | popfd |
|
876 | ; clear Interrupt bit |
950 | mov al, 1 |
877 | add edx, 2 |
951 | ret |
878 | mov al, 4 ; 100b |
952 | ;-------------------------------------- |
879 | out dx, al |
953 | align 4 |
880 | 954 | @@: |
|
881 | popad |
955 | popad |
882 | popfd |
956 | popfd |
883 | ;-------------------------------------- |
957 | ;-------------------------------------- |
884 | align 4 |
958 | align 4 |
885 | .exit: |
959 | .exit: |
886 | mov al, 1 |
960 | mov al, 0 |
887 | ret |
961 | ret |