forked from KolibriOS/kolibrios
1) The search HDD is improved, earlier by search was made reset only CD, now is made reset and HDD also.
2) Are deleted CLI and STI from procedures of reading and writing of sector on HDD. These of commands are replaced by operation with a port [hdbase]+206h, which disables only interruption for IDE. git-svn-id: svn://kolibrios.org@136 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
65cbed8f0d
commit
334f7721de
@ -11,42 +11,25 @@ FindHDD:
|
|||||||
mov [ChannelNumber],1
|
mov [ChannelNumber],1
|
||||||
mov [DiskNumber],0
|
mov [DiskNumber],0
|
||||||
call FindHDD_3
|
call FindHDD_3
|
||||||
; mov ax,[Sector512+176]
|
|
||||||
; mov [0x40006],ax
|
|
||||||
; mov ax,[Sector512+126]
|
|
||||||
; mov [0x40008],ax
|
|
||||||
; mov ax,[Sector512+128]
|
|
||||||
; mov [0x40008],ax
|
|
||||||
mov [DiskNumber],1
|
mov [DiskNumber],1
|
||||||
call FindHDD_3
|
call FindHDD_3
|
||||||
; mov al,[Sector512+176]
|
|
||||||
; mov [0x40007],al
|
|
||||||
inc [ChannelNumber]
|
inc [ChannelNumber]
|
||||||
mov [DiskNumber],0
|
mov [DiskNumber],0
|
||||||
call FindHDD_3
|
call FindHDD_3
|
||||||
; mov al,[Sector512+176]
|
|
||||||
; mov [0x40008],al
|
|
||||||
mov [DiskNumber],1
|
mov [DiskNumber],1
|
||||||
call FindHDD_1
|
call FindHDD_1
|
||||||
; mov al,[Sector512+176]
|
|
||||||
; mov [0x40009],al
|
|
||||||
|
|
||||||
jmp EndFindHDD
|
jmp EndFindHDD
|
||||||
|
|
||||||
FindHDD_1:
|
FindHDD_1:
|
||||||
call ReadHDD_ID
|
|
||||||
cmp [DevErrorCode],0
|
|
||||||
jne FindHDD_2
|
|
||||||
cmp [Sector512+6],word 16
|
|
||||||
ja FindHDD_2
|
|
||||||
cmp [Sector512+12],word 255
|
|
||||||
ja FindHDD_2
|
|
||||||
inc byte [0x40001]
|
|
||||||
jmp FindHDD_2_2
|
|
||||||
FindHDD_2:
|
|
||||||
call DeviceReset
|
call DeviceReset
|
||||||
cmp [DevErrorCode],0
|
cmp [DevErrorCode],0
|
||||||
jne FindHDD_2_2
|
jne FindHDD_2_2
|
||||||
|
call ReadHDD_ID
|
||||||
|
cmp [DevErrorCode],0
|
||||||
|
jne FindHDD_2
|
||||||
|
inc byte [0x40001]
|
||||||
|
ret
|
||||||
|
FindHDD_2:
|
||||||
call ReadCD_ID
|
call ReadCD_ID
|
||||||
cmp [DevErrorCode],0
|
cmp [DevErrorCode],0
|
||||||
jne FindHDD_2_2
|
jne FindHDD_2_2
|
||||||
|
@ -1973,11 +1973,13 @@ hd_read:
|
|||||||
|
|
||||||
push eax edx
|
push eax edx
|
||||||
|
|
||||||
|
call disable_ide_int
|
||||||
|
|
||||||
call wait_for_hd_idle
|
call wait_for_hd_idle
|
||||||
cmp [hd_error],0
|
cmp [hd_error],0
|
||||||
jne hd_read_error
|
jne hd_read_error
|
||||||
|
|
||||||
cli
|
; cli
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
mov edx,[hdbase]
|
mov edx,[hdbase]
|
||||||
inc edx
|
inc edx
|
||||||
@ -2003,14 +2005,14 @@ hd_read:
|
|||||||
inc edx
|
inc edx
|
||||||
mov al,20h
|
mov al,20h
|
||||||
out dx,al ; ATACommand ॣ¨áâà ª®¬ ¤
|
out dx,al ; ATACommand ॣ¨áâà ª®¬ ¤
|
||||||
sti
|
; sti
|
||||||
|
|
||||||
call wait_for_sector_buffer
|
call wait_for_sector_buffer
|
||||||
|
|
||||||
cmp [hd_error],0
|
cmp [hd_error],0
|
||||||
jne hd_read_error
|
jne hd_read_error
|
||||||
|
|
||||||
cli
|
; cli
|
||||||
push edi
|
push edi
|
||||||
shl edi,9
|
shl edi,9
|
||||||
add edi,0x600000+65536
|
add edi,0x600000+65536
|
||||||
@ -2019,7 +2021,9 @@ hd_read:
|
|||||||
cld
|
cld
|
||||||
rep insw
|
rep insw
|
||||||
pop edi
|
pop edi
|
||||||
sti
|
; sti
|
||||||
|
|
||||||
|
call enable_ide_int
|
||||||
|
|
||||||
pop edx eax
|
pop edx eax
|
||||||
blok_read_2:
|
blok_read_2:
|
||||||
@ -2040,6 +2044,19 @@ hd_read:
|
|||||||
pop edi esi ecx
|
pop edi esi ecx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
disable_ide_int:
|
||||||
|
mov edx,[hdbase]
|
||||||
|
add edx,0x206
|
||||||
|
mov al,2
|
||||||
|
out dx,al
|
||||||
|
ret
|
||||||
|
|
||||||
|
enable_ide_int:
|
||||||
|
mov edx,[hdbase]
|
||||||
|
add edx,0x206
|
||||||
|
mov al,0
|
||||||
|
out dx,al
|
||||||
|
ret
|
||||||
|
|
||||||
hd_write:
|
hd_write:
|
||||||
;-----------------------------------------------------------
|
;-----------------------------------------------------------
|
||||||
@ -2119,11 +2136,13 @@ write_cache:
|
|||||||
cmp eax,[PARTITION_END]
|
cmp eax,[PARTITION_END]
|
||||||
ja danger
|
ja danger
|
||||||
|
|
||||||
|
call disable_ide_int
|
||||||
|
|
||||||
call wait_for_hd_idle
|
call wait_for_hd_idle
|
||||||
cmp [hd_error],0
|
cmp [hd_error],0
|
||||||
jne hd_write_error
|
jne hd_write_error
|
||||||
|
|
||||||
cli
|
; cli
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
mov edx,[hdbase]
|
mov edx,[hdbase]
|
||||||
inc edx
|
inc edx
|
||||||
@ -2149,7 +2168,7 @@ write_cache:
|
|||||||
inc edx
|
inc edx
|
||||||
mov al,30h
|
mov al,30h
|
||||||
out dx,al
|
out dx,al
|
||||||
sti
|
; sti
|
||||||
|
|
||||||
call wait_for_sector_buffer
|
call wait_for_sector_buffer
|
||||||
|
|
||||||
@ -2158,7 +2177,7 @@ write_cache:
|
|||||||
|
|
||||||
push ecx esi
|
push ecx esi
|
||||||
|
|
||||||
cli
|
; cli
|
||||||
mov esi,edi
|
mov esi,edi
|
||||||
shl esi,9
|
shl esi,9
|
||||||
add esi,0x600000+65536 ; esi = from memory position
|
add esi,0x600000+65536 ; esi = from memory position
|
||||||
@ -2166,10 +2185,12 @@ write_cache:
|
|||||||
mov edx,[hdbase]
|
mov edx,[hdbase]
|
||||||
cld
|
cld
|
||||||
rep outsw
|
rep outsw
|
||||||
sti
|
; sti
|
||||||
|
|
||||||
pop esi ecx
|
pop esi ecx
|
||||||
|
|
||||||
|
call enable_ide_int
|
||||||
|
|
||||||
danger:
|
danger:
|
||||||
does_not_need_writing:
|
does_not_need_writing:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user