mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-27 16:59:41 +03:00
fix for ide_querymedia
git-svn-id: svn://kolibrios.org@6842 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
733620f72e
commit
26611cadd0
@ -10,10 +10,11 @@ $Revision$
|
|||||||
; HDD driver
|
; HDD driver
|
||||||
|
|
||||||
struct HD_DATA
|
struct HD_DATA
|
||||||
hdbase dw ?
|
|
||||||
hdid dw ?
|
|
||||||
hdpos dw ?
|
hdpos dw ?
|
||||||
|
hdid dw ?
|
||||||
|
hdbase dw ?
|
||||||
hd48 dw ?
|
hd48 dw ?
|
||||||
|
sectors dq ?
|
||||||
ends
|
ends
|
||||||
;-----------------------------------------------------------------
|
;-----------------------------------------------------------------
|
||||||
iglobal
|
iglobal
|
||||||
@ -29,18 +30,18 @@ ide_callbacks:
|
|||||||
dd 0 ; use default cache size
|
dd 0 ; use default cache size
|
||||||
.end:
|
.end:
|
||||||
|
|
||||||
hd0_data HD_DATA ?, 0, 1, 0
|
hd0_data HD_DATA 1, 0
|
||||||
hd1_data HD_DATA ?, 16, 2, 0
|
hd1_data HD_DATA 2, 16
|
||||||
hd2_data HD_DATA ?, 0, 3, 0
|
hd2_data HD_DATA 3, 0
|
||||||
hd3_data HD_DATA ?, 16, 4, 0
|
hd3_data HD_DATA 4, 16
|
||||||
hd4_data HD_DATA ?, 0, 5, 0
|
hd4_data HD_DATA 5, 0
|
||||||
hd5_data HD_DATA ?, 16, 6, 0
|
hd5_data HD_DATA 6, 16
|
||||||
hd6_data HD_DATA ?, 0, 7, 0
|
hd6_data HD_DATA 7, 0
|
||||||
hd7_data HD_DATA ?, 16, 8, 0
|
hd7_data HD_DATA 8, 16
|
||||||
hd8_data HD_DATA ?, 0, 9, 0
|
hd8_data HD_DATA 9, 0
|
||||||
hd9_data HD_DATA ?, 16, 10, 0
|
hd9_data HD_DATA 10, 16
|
||||||
hd10_data HD_DATA ?, 0, 11, 0
|
hd10_data HD_DATA 11, 0
|
||||||
hd11_data HD_DATA ?, 16, 12, 0
|
hd11_data HD_DATA 12, 16
|
||||||
|
|
||||||
ide_mutex_table:
|
ide_mutex_table:
|
||||||
dd ide_channel1_mutex
|
dd ide_channel1_mutex
|
||||||
@ -191,13 +192,15 @@ endl
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
;-----------------------------------------------------------------
|
;-----------------------------------------------------------------
|
||||||
; this is a stub
|
|
||||||
proc ide_querymedia stdcall, hd_data, mediainfo
|
proc ide_querymedia stdcall, hd_data, mediainfo
|
||||||
mov eax, [mediainfo]
|
mov eax, [mediainfo]
|
||||||
|
mov edx, [hd_data]
|
||||||
mov [eax+DISKMEDIAINFO.Flags], 0
|
mov [eax+DISKMEDIAINFO.Flags], 0
|
||||||
mov [eax+DISKMEDIAINFO.SectorSize], 512
|
mov [eax+DISKMEDIAINFO.SectorSize], 512
|
||||||
or dword [eax+DISKMEDIAINFO.Capacity], 0xFFFFFFFF
|
mov ecx, dword[edx+HD_DATA.sectors]
|
||||||
or dword [eax+DISKMEDIAINFO.Capacity+4], 0xFFFFFFFF
|
mov dword[eax+DISKMEDIAINFO.Capacity], ecx
|
||||||
|
mov ecx, dword[edx+HD_DATA.sectors+4]
|
||||||
|
mov dword[eax+DISKMEDIAINFO.Capacity+4], ecx
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
@ -12,7 +12,6 @@ $Revision$
|
|||||||
cmp [ecx+IDE_DATA.ProgrammingInterface], 0
|
cmp [ecx+IDE_DATA.ProgrammingInterface], 0
|
||||||
je EndFindHDD
|
je EndFindHDD
|
||||||
FindHDD:
|
FindHDD:
|
||||||
push ecx
|
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
inc ebx
|
inc ebx
|
||||||
mov [DeviceNumber], 0
|
mov [DeviceNumber], 0
|
||||||
@ -28,18 +27,13 @@ FindHDD:
|
|||||||
mov [ChannelNumber], 1
|
mov [ChannelNumber], 1
|
||||||
mov [DiskNumber], 0
|
mov [DiskNumber], 0
|
||||||
call FindHDD_1
|
call FindHDD_1
|
||||||
|
|
||||||
inc [DiskNumber]
|
inc [DiskNumber]
|
||||||
call FindHDD_2
|
call FindHDD_2
|
||||||
|
|
||||||
inc [ChannelNumber]
|
inc [ChannelNumber]
|
||||||
dec [DiskNumber]
|
dec [DiskNumber]
|
||||||
call FindHDD_2
|
call FindHDD_2
|
||||||
|
|
||||||
inc [DiskNumber]
|
inc [DiskNumber]
|
||||||
call FindHDD_2
|
call FindHDD_2
|
||||||
|
|
||||||
pop ecx
|
|
||||||
jmp EndFindHDD
|
jmp EndFindHDD
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
FindHDD_2:
|
FindHDD_2:
|
||||||
@ -48,44 +42,44 @@ FindHDD_2:
|
|||||||
FindHDD_1:
|
FindHDD_1:
|
||||||
DEBUGF 1, "K : Channel %d ",[ChannelNumber]:1
|
DEBUGF 1, "K : Channel %d ",[ChannelNumber]:1
|
||||||
DEBUGF 1, "Disk %d\n",[DiskNumber]:1
|
DEBUGF 1, "Disk %d\n",[DiskNumber]:1
|
||||||
push ebx ecx
|
push ecx ebx
|
||||||
call ReadHDD_ID
|
call ReadHDD_ID
|
||||||
pop ecx ebx
|
|
||||||
cmp [DevErrorCode], 7
|
cmp [DevErrorCode], 7
|
||||||
je .end
|
je .end
|
||||||
cmp [DevErrorCode], 0
|
cmp [DevErrorCode], 0
|
||||||
jne .FindCD
|
jne .FindCD
|
||||||
|
|
||||||
cmp [Sector512+6], word 16
|
cmp [Sector512+6], word 16
|
||||||
ja .FindCD
|
ja .FindCD
|
||||||
|
|
||||||
cmp [Sector512+12], word 255
|
cmp [Sector512+12], word 255
|
||||||
ja .FindCD
|
ja .FindCD
|
||||||
|
pop ebx
|
||||||
inc byte [ebx+DRIVE_DATA]
|
|
||||||
movzx eax, [DeviceNumber]
|
movzx eax, [DeviceNumber]
|
||||||
|
mov ecx, [Sector512+120]
|
||||||
|
mov dword[eax+hd0_data.sectors], ecx
|
||||||
|
and dword[eax+hd0_data.sectors+4], 0
|
||||||
bt word [Sector512+166], 10
|
bt word [Sector512+166], 10
|
||||||
adc [eax+hd0_data.hd48], 0
|
jnc .Print_Device_Name
|
||||||
|
mov [eax+hd0_data.hd48], 1
|
||||||
|
mov ecx, [Sector512+200]
|
||||||
|
mov dword[eax+hd0_data.sectors], ecx
|
||||||
|
mov ecx, [Sector512+204]
|
||||||
|
mov dword[eax+hd0_data.sectors+4], ecx
|
||||||
jmp .Print_Device_Name
|
jmp .Print_Device_Name
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
.FindCD:
|
.FindCD:
|
||||||
push ebx ecx
|
|
||||||
call DeviceReset
|
call DeviceReset
|
||||||
pop ecx ebx
|
|
||||||
cmp [DevErrorCode], 0
|
cmp [DevErrorCode], 0
|
||||||
jne .end
|
jne .end
|
||||||
|
|
||||||
push ebx ecx
|
|
||||||
call ReadCD_ID
|
call ReadCD_ID
|
||||||
pop ecx ebx
|
|
||||||
cmp [DevErrorCode], 0
|
cmp [DevErrorCode], 0
|
||||||
jne .end
|
jne .end
|
||||||
|
pop ebx
|
||||||
add [ebx+DRIVE_DATA], byte 2
|
inc byte [ebx+DRIVE_DATA]
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
.Print_Device_Name:
|
.Print_Device_Name:
|
||||||
|
inc byte [ebx+DRIVE_DATA]
|
||||||
|
pop ecx
|
||||||
pushad
|
pushad
|
||||||
pushfd
|
|
||||||
movzx ebx, [ChannelNumber]
|
movzx ebx, [ChannelNumber]
|
||||||
dec ebx
|
dec ebx
|
||||||
shl ebx, 1
|
shl ebx, 1
|
||||||
@ -104,42 +98,32 @@ FindHDD_1:
|
|||||||
xchg ah, al
|
xchg ah, al
|
||||||
stosw
|
stosw
|
||||||
loop @b
|
loop @b
|
||||||
|
|
||||||
DEBUGF 1, "K : Dev: %s \n", dev_name
|
DEBUGF 1, "K : Dev: %s \n", dev_name
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov ax, [Sector512+64*2]
|
mov ax, [Sector512+64*2]
|
||||||
DEBUGF 1, "K : PIO possible modes %x\n", al
|
DEBUGF 1, "K : PIO possible modes %x\n", al
|
||||||
|
|
||||||
mov ax, [Sector512+51*2]
|
mov ax, [Sector512+51*2]
|
||||||
mov al, ah
|
mov al, ah
|
||||||
call convert_Sector512_value
|
call convert_Sector512_value
|
||||||
DEBUGF 1, "K : PIO set mode %x\n", ah
|
DEBUGF 1, "K : PIO set mode %x\n", ah
|
||||||
|
|
||||||
mov ax, [Sector512+63*2]
|
mov ax, [Sector512+63*2]
|
||||||
DEBUGF 1, "K : Multiword DMA possible modes %x\n", al
|
DEBUGF 1, "K : Multiword DMA possible modes %x\n", al
|
||||||
|
|
||||||
mov al, ah
|
mov al, ah
|
||||||
call convert_Sector512_value
|
call convert_Sector512_value
|
||||||
DEBUGF 1, "K : Multiword DMA set mode %x\n", ah
|
DEBUGF 1, "K : Multiword DMA set mode %x\n", ah
|
||||||
|
|
||||||
mov ax, [Sector512+88*2]
|
mov ax, [Sector512+88*2]
|
||||||
DEBUGF 1, "K : Ultra DMA possible modes %x\n", al
|
DEBUGF 1, "K : Ultra DMA possible modes %x\n", al
|
||||||
|
|
||||||
mov [ebx+IDE_DEVICE.UDMA_possible_modes], al
|
mov [ebx+IDE_DEVICE.UDMA_possible_modes], al
|
||||||
|
|
||||||
mov al, ah
|
mov al, ah
|
||||||
call convert_Sector512_value
|
call convert_Sector512_value
|
||||||
DEBUGF 1, "K : Ultra DMA set mode %x\n", ah
|
DEBUGF 1, "K : Ultra DMA set mode %x\n", ah
|
||||||
|
|
||||||
mov [ebx+IDE_DEVICE.UDMA_set_mode], ah
|
mov [ebx+IDE_DEVICE.UDMA_set_mode], ah
|
||||||
|
|
||||||
popfd
|
|
||||||
popad
|
popad
|
||||||
ret
|
ret
|
||||||
;--------------------------------------
|
|
||||||
.end:
|
.end:
|
||||||
DEBUGF 1, "K : Device not found\n"
|
DEBUGF 1, "K : Device not found\n"
|
||||||
|
pop ebx ecx
|
||||||
ret
|
ret
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
calculate_IDE_device_values_storage:
|
calculate_IDE_device_values_storage:
|
||||||
|
Loading…
Reference in New Issue
Block a user