Rev 3539 | Rev 3706 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3539 | Rev 3702 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2012. 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: 3539 $ |
8 | $Revision: 3702 $ |
9 | 9 | ||
10 | 10 | ||
Line 48... | Line 48... | ||
48 | jne return_01 |
48 | jne return_01 |
49 | ; Read through BIOS? |
49 | ; Read through BIOS? |
50 | cmp [hdpos], 0x80 |
50 | cmp [hdpos], 0x80 |
51 | jae .bios |
51 | jae .bios |
52 | ; hd_read_{dma,pio} use old ATA with 28 bit for sector number |
52 | ; hd_read_{dma,pio} use old ATA with 28 bit for sector number |
53 | cmp eax, 0x10000000 |
53 | ; cmp eax, 0x10000000 |
54 | jb @f |
54 | ; jb @f |
55 | inc [hd_error] |
55 | ; inc [hd_error] |
56 | jmp return_01 |
56 | ; jmp return_01 |
57 | @@: |
57 | ;@@: |
58 | ; DMA read is permitted if [allow_dma_access]=1 or 2 |
58 | ; DMA read is permitted if [allow_dma_access]=1 or 2 |
59 | cmp [allow_dma_access], 2 |
59 | cmp [allow_dma_access], 2 |
60 | ja .nodma |
60 | ja .nodma |
61 | cmp [dma_hdd], 1 |
61 | cmp [dma_hdd], 1 |
62 | jnz .nodma |
62 | jnz .nodma |
Line 99... | Line 99... | ||
99 | 99 | ||
100 | align 4 |
100 | align 4 |
101 | hd_read_pio: |
101 | hd_read_pio: |
Line -... | Line 102... | ||
- | 102 | push eax edx |
|
- | 103 | ||
- | 104 | ; Выбрать нужный диск |
|
- | 105 | mov edx, [hdbase] |
|
- | 106 | add edx, 6 ;адрес регистра головок |
|
- | 107 | mov al, byte [hdid] |
|
- | 108 | add al, 128+64+32 |
|
102 | push eax edx |
109 | out dx, al; номер головки/номер диска |
103 | 110 | ||
104 | call wait_for_hd_idle |
111 | call wait_for_hd_idle |
Line -... | Line 112... | ||
- | 112 | cmp [hd_error], 0 |
|
- | 113 | jne hd_read_error |
|
- | 114 | ||
- | 115 | ; ATA with 28 or 48 bit for sector number? |
|
- | 116 | mov eax, [esp+4] |
|
105 | cmp [hd_error], 0 |
117 | cmp eax, 0x10000000 |
106 | jne hd_read_error |
118 | jae .lba48 |
107 | 119 | .lba28: |
|
108 | cli |
120 | cli |
109 | xor eax, eax |
121 | xor eax, eax |
Line 130... | Line 142... | ||
130 | out dx, al; номер головки/номер диска |
142 | out dx, al; номер головки/номер диска |
131 | inc edx |
143 | inc edx |
132 | mov al, 20h |
144 | mov al, 20h |
133 | out dx, al; ATACommand регистр команд |
145 | out dx, al; ATACommand регистр команд |
134 | sti |
146 | sti |
- | 147 | jmp .continue |
|
135 | 148 | .lba48: |
|
- | 149 | cli |
|
- | 150 | xor eax, eax |
|
- | 151 | mov edx, [hdbase] |
|
- | 152 | inc edx |
|
- | 153 | out dx, al ; Features Previous Reserved |
|
- | 154 | out dx, al ; Features Current Reserved |
|
- | 155 | inc edx |
|
- | 156 | out dx, al ; Sector Count Previous Sector count (15:8) |
|
- | 157 | inc eax |
|
- | 158 | out dx, al ; Sector Count Current Sector count (7:0) |
|
- | 159 | inc edx |
|
- | 160 | mov eax, [esp+4] |
|
- | 161 | rol eax,8 |
|
- | 162 | out dx, al ; LBA Low Previous LBA (31:24) |
|
- | 163 | xor eax,eax ; because only 32 bit cache |
|
- | 164 | inc edx |
|
- | 165 | out dx, al ; LBA Mid Previous LBA (39:32) |
|
- | 166 | inc edx |
|
- | 167 | out dx, al ; LBA High Previous LBA (47:40) |
|
- | 168 | sub edx,2 |
|
- | 169 | mov eax, [esp+4] |
|
- | 170 | out dx, al ; LBA Low Current LBA (7:0) |
|
- | 171 | shr eax, 8 |
|
- | 172 | inc edx |
|
- | 173 | out dx, al ; LBA Mid Current LBA (15:8) |
|
- | 174 | shr eax, 8 |
|
- | 175 | inc edx |
|
- | 176 | out dx, al ; LBA High Current LBA (23:16) |
|
- | 177 | inc edx |
|
- | 178 | mov al, byte [hdid] |
|
- | 179 | add al, 128+64+32 |
|
- | 180 | out dx, al; номер головки/номер диска |
|
- | 181 | inc edx |
|
- | 182 | mov al, 24h ; READ SECTOR(S) EXT |
|
- | 183 | out dx, al; ATACommand регистр команд |
|
- | 184 | sti |
|
- | 185 | .continue: |
|
136 | call wait_for_sector_buffer |
186 | call wait_for_sector_buffer |
Line 137... | Line 187... | ||
137 | 187 | ||
138 | cmp [hd_error], 0 |
188 | cmp [hd_error], 0 |
Line 243... | Line 293... | ||
243 | cache_write_pio: |
293 | cache_write_pio: |
244 | cmp dword[esi], 0x10000000 |
294 | cmp dword[esi], 0x10000000 |
245 | jae .bad |
295 | jae .bad |
246 | ; call disable_ide_int |
296 | ; call disable_ide_int |
Line -... | Line 297... | ||
- | 297 | ||
- | 298 | ; Выбрать нужный диск |
|
- | 299 | mov edx, [hdbase] |
|
- | 300 | add edx, 6 ;адрес регистра головок |
|
- | 301 | mov al, byte [hdid] |
|
- | 302 | add al, 128+64+32 |
|
- | 303 | out dx, al; номер головки/номер диска |
|
247 | 304 | ||
248 | call wait_for_hd_idle |
305 | call wait_for_hd_idle |
249 | cmp [hd_error], 0 |
306 | cmp [hd_error], 0 |
Line 250... | Line 307... | ||
250 | jne hd_write_error |
307 | jne hd_write_error |
Line 594... | Line 651... | ||
594 | popfd |
651 | popfd |
595 | ret |
652 | ret |
Line 596... | Line 653... | ||
596 | 653 | ||
597 | align 4 |
654 | align 4 |
- | 655 | hd_read_dma: |
|
- | 656 | ; hd_read_dma use old ATA with 28 bit for sector number |
|
- | 657 | cmp eax, 0x10000000 |
|
- | 658 | jb @f |
|
- | 659 | inc [hd_error] |
|
- | 660 | ret |
|
598 | hd_read_dma: |
661 | @@: |
599 | push eax |
662 | push eax |
600 | push edx |
663 | push edx |
601 | mov edx, [dma_hdpos] |
664 | mov edx, [dma_hdpos] |
602 | cmp edx, [hdpos] |
665 | cmp edx, [hdpos] |
Line 817... | Line 880... | ||
817 | inc [hd_error] |
880 | inc [hd_error] |
818 | ret |
881 | ret |
Line 819... | Line 882... | ||
819 | 882 | ||
820 | uglobal |
883 | uglobal |
- | 884 | IDEContrRegsBaseAddr dw ? |
|
- | 885 | IDEContrProgrammingInterface dw ? |
|
- | 886 | IDE_BAR0_val dw ? |
|
- | 887 | IDE_BAR1_val dw ? |
|
- | 888 | IDE_BAR2_val dw ? |
|
821 | IDEContrRegsBaseAddr dw ? |
889 | IDE_BAR3_val dw ? |
822 | endg |
890 | endg |
Line 823... | Line 891... | ||
823 | ; \end{Mario79} |
891 | ; \end{Mario79} |
824 | 892 |