During some tests of ATA devices detection and identification, I've found strange thing: after I reset devices on channel 1 in VMWare by setting and clearing SRST bit of device control register, DRDY bit of device 0 on the channel is never set. But if I remove code resetting the channel, problem with DRDY disappears. It happens only with channel 1, and there is no problem with channel 0.
Is it a problem of VMWare, or I have a bug in my code? I've wrote the simplest piece of code demonstrating the problem, could someone to look at it and to run it under VMWare:
Code: Select all
org 0x7C00
xor ax, ax
mov ds, ax
mov es, ax
mov ss, ax
mov sp, 0x7C00
;Set SRST:
mov dx, 0x376
mov al, 0x4
out dx, al
;Wait a little
sti
hlt
hlt
;Clear SRST
xor al, al
out dx, al
;Wait again
hlt
hlt
hlt
hlt
hlt
hlt
hlt
hlt
hlt
hlt
;Select device
mov dx, 0x176
mov al, 0x0
out dx, al
;Wait BSY
mov dx, 0x177
.wait_BSY1:
mov si, str_wait_BSY
call print_str
in al, dx
test al, 0x80
jnz .wait_BSY1
;Check DRDY
mov dx, 0x177
in al, dx
test al, 0x40
jz .error_DRDY
mov si, str_ok_DRDY
call print_err_str
.error_DRDY:
mov si, str_error_DRDY
call print_err_str
print_str:
.l00p:
lodsb
or al, al
jz .exit
mov ah, 0xE
mov bx, 0x7
int 0x10
jmp .l00p
.exit:
ret
print_err_str:
.l00p:
lodsb
or al, al
jz .exit
mov ah, 0xE
mov bx, 0x7
int 0x10
jmp .l00p
.exit:
jmp $
str_wait_BSY: db 'Waiting BSY', 0xA, 0xD, 0x0
str_error_DRDY: db 'No DRDY', 0xA, 0xD, 0x0
str_ok_DRDY: db 'DRDY Ok', 0xA, 0xD, 0x0
times 510 - ($ - $$) db 0xFF
dw 0xAA55
Configuration of my virtual machine is:
channel 0, device 0: ATA device
channel 0, device 1: empty
channel 1, device 0: ATAPI device
channel 1, device 1: empty
Version of VMWare is: VMWare Workstation 5.5.1 build-19175.
So, what may be the problem?..
TIA, Mikae.