IDE & Max Transfer
I was replying to someone over at Amiga.org about MAX TRANSFER settings for IDE controllers (such as A1200/A600 Gayle IDE) giving them the standard "try 0x1FE00 and if that doesnt work try 0xFE00".
While writing I accidentally worked out the logical reason behind these "Magic numbers".
I noticed that "0x1FE00" is 255 * 512, and that 255 is the largest value that can be represented by 8-bits. So by using "0x1FE00" it prevents the driver (scsi.device) creating malformed IDE commands with sector counts larger than 8-bit. I am positive this is the logical answer as to why MAX TRANSFER should be "0x1FE00" for IDE devices. [EDIT] I was close but not correct. Toni Wilen discovered the true answer : http://eab.abime.net/showpost.php?p=759918&postcount=25 [/EDIT] ------------ Now while the IDE (ATA5 and lower) command set supports an 8-bit sector count, very few operating systems use the maximum value. Windows (and most other operating systems) tend to use 64 or 128 sector commands. I know this because I discovered at work several years ago that PATA hard drives have their cache optimised for 64 sectors while SATA were optimised for 128 sector commands. Back to the plot: The second magic number touted for MAX transfer "0xFE00" is 127 * 512. I am not sure exactly why this value would be more compatible than 0x1FE00, but I imagine it has to do with the fact poor quality IDE devices do not expect sector counts above 128 sectors. You pretty much guarantee "sector count" compatibility with any IDE device with 0xFE00 and I cannot believe that it is slower. Anyhow, hope that has explained things, rather than confused things. |
That's a useful display of detective work, alexh! :agree :bowdown :bowdown :bowdown
Thanks for sharing your thoughts on this with us. :great |
I dunno if my explanation is dumb enough.
You still have to be reasonably computer literate (at a low level) to get it. |
That's very clear and actually explains a lot.
|
I think it should be added to the CF-IDE for the Amiga Wiki...... if we have one....
|
Thanks alexh ! :) I put the magic number in the RDB of my hardfile, and now it works much better! :bowdown
|
Nice one alex,
another good reason to use SCSI on amiga also :) |
Added Alexh's post to Amiga Problems.
|
Nicely reasoned, and makes sense.
However, when I was setting up my CF card, I went with what looked like the most reliable-looking advice I could find at the time and set the Max Transfers value as high as 0x1FE0000. At 256 times more than reasoned above, it seems quite absurd. The magic is it has worked just fine, and apparently also in some cases where 0x1FE00 hasn't. I would like to know why it works, whether it is just waiting to cause trouble, or if there is any other reason to change it. I was thinking perhaps it is not taking the entire 32-bit value into account, but the less significant word is all zeroes so wouldn't it likely result in a MaxTransfer of 0 then? :confused |
Quote:
|
Actually there shouldn't be a problem with MaxTransfer. The device driver should know the hardware limitations and automatically split large packets into smaller ones. Just like ping and MTU in TCP/IP world.
But scsi.device does not do this. If you specify a MaxTransfer value larger than 0x1fe00, it will send a mangled command to the device, resulting in corrupted data. So it is important to set MaxTransfer to a reasonable value when using scsi.device. However, it also depends on the version of scsi.device which is used. For example when using IDEfix, a new scsi.device is used which does automatically split large packets. So with IDEfix MaxTransfer should not be an issue. Finally MaxTransfer issues only arise when using files larger than the critical limit. Files smaller than 127.5K are not affected at all. Similarly large files might not be affected if a copy program is used which does not attempt to write more than 127.5K at a time. |
Where can I set the max transfers properly? I have tried HD tool box but it doesnt save my changes? im trying to put 0x1fe00 but it kees changeing. Do i need to change the mask as well?
|
You have to press the enter button after typing 1fe00, then save the settings.
|
No need to adjust the mask.
|
Thank you Retro-Nerd for the very quick response, that worked. I cant believe thats what I was missing!
Ok Jope thanks. |
Quote:
With 48-bit LBA (what is necessary with drives over 128GB) max count is 65536 as sector count is given as 16-bit value. |
Quote:
Quote:
You would need this version of scsi.device in your Kickstart ROM or eFlash/Kickflash/Deneb to be able to boot from a device with a the MAX TRANSFER set to larger than 0x1FE00. This is going to be a VERY small set of people. I thought that I had used the scsi.device (45.45) with 48-bit LBA support using a MAX TRANSFER larger than 0x1FE00 with a SanDisk CF card and had data corruption. I will be able to confirm soon as I'm making my own KS3.9 EPROMs for my A4000 |
The real problem is not the sector count, but the fact compact flash & microdrives doesn't have a built-in buffer .
Notice that real HD doesn't suffer from this issue, from the old IDE to SCSI drives. So anything over 255 will choke in the Amiga IDE bus (read "Gayle"), who will still try to put more data than the slow IDE channel can really cope. |
???? How did you work that out? I was sure the problem is about malformed commands. The Amiga tries to transfer more data on the bus than the drive is expecting.
AmigaOS tries to send a command for say 131584 bytes (257 sectors). It made sense that scsi.device can only send ATA commands with an 8-bit sector count (and it doesn't check the incoming request size) which gets converted into an ATA command of 1 sector. Quote:
I imagined it was not a problem for SCSI drives because SCSI commands have a bigger (32-bit?) sector count field. |
Really? I never had any issues with standard MaxTransfer settings and PC hard drives. Pure luck?
|
All times are GMT +2. The time now is 16:51. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.