Re: [hatari-devel] ACSI: READ/WRITE (10) incorrectly evaluate block number |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] ACSI: READ/WRITE (10) incorrectly evaluate block number
- From: Uwe Seimet <Uwe.Seimet@xxxxxxxxx>
- Date: Sat, 26 Oct 2013 23:55:00 +0200
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1382824500; l=1763; s=domk; d=seimet.de; h=In-Reply-To:Content-Type:MIME-Version:References:Subject:To:From: Date:X-RZG-CLASS-ID:X-RZG-AUTH; bh=FMtNhHvx0OMwiVUL/YV9zX2VGHM=; b=CSQ6sxvJcWjAR4w6FbGQYUkkcDZ9y48huMLn1OSsMupAnvO0dIatKtOkMUz3DZ8i2mv iQZOeQKvHtLVx6PEIwZ5m2ZRjlCygyqpO5tW5cFLCNnELkciQ1r0A4yjuMhAl8slaiRjv BO/COqj/C9SwW2hRmuqSM+pHh46hbLHKtCA=
Hi,
>
> > Hm, but root sector has address 0, right? So the shift should not
> > matter anyway. Could you maybe HDC_VERBOSE and HDC_REALLY_VERBOSE in
> > hdc.c and send me the output that corresponds to the two read commands?
>
> After turning on debugging I found that the READ commands (the comparisons
> of the data returned) only fail when READ CAPACITY was executed before.
> After that the READ commands are not even logged anymore, but the log
> output shows TEST UNIT READY commands instead. It looks as if the
> command sent are not analyzed correctly anymore. My guess is that the
> DMA address counter does not always work correctly.
I can see now what's wrong: When Hatari receives an unknown opcode it
stops processing the CDB, and the remaining bytes from the old CDB are
read later, when a new command is sent. So the ACSI emulation gets out of
sync, and any command sent from now on results in unpredictable behavior,
which also explains the wrong/missing logging information.
In order to solve this problem the emulation would have to always read the
*complete* CDB, so that no bytes are left over from previous CDBs.
Provided all non-CDB transfers are done using DMA the end of the CDB
transfer can be detected by the fact that the last CDB byte is sent with
bit 7 of the DMA mode register cleared, which starts the DMA transfer.
This would not work, though, if after sending the CDB there is no DMA
but only a PIO transfer.
The best solution would probably be to have a table with the byte count
of *all* SCSI commands, so that Hatari can exactly determine the number of
bytes in a CDB. If somebody would like to set up the code infrastructure
for that I would later fill in the missing data.
Take care
Uwe