How to determine MASK & MaxTransfer ?

Overmann

Member
Joined
May 21, 2014
Posts
263
Country
Norway
Region
Oslo
Hi there,

I've been struggling with these settings for YEARS! I've read what I can find about it and for the most part I've managed to get good results, but I'm wondering if anyone would take the time to explain HOW mask and maxtransfer can be determined? Calculated?

I see a LOT of threads asking for help regarding settings for a particular system, and the most common reply is "check the manual, most products have the settings there" but I don't own a single SCSI/IDE-kontroller that has these settings in the manual (except perhaps the GVP HC series II, but it's kind of cryptic). It seems that many members on the forums are able to just calculate, or figure out good values, but I've never understood how thats done.

It has to do with memory adressing? The MASK represents which segment of the memory should be used for DMA? And maxtransfer represents how many bytes can be moved at once? Yeah, I don't know? And I would GREATLY appreciate it if someone took the time to give a proper explenation, or link to one (something might have gone under the radar). How technical is it? Is it really as difficult to understand as it seems?
 
Hi, sorry to point you to another manual lol but this thread had absolutely all the information you could ever need on the subject:

http://eab.abime.net/showthread.php?t=61666

Once you get past the basics I think it does start to get a bit complex.
 
I did stumbled across that thread when looking for info. Lot's of great info on maxtransfer and filesystems, DirectSCSI etc. but I didn't find that much on MASK values for DMA capable controllers. It might be I skimmed it too quickly?
I have three or four DMA capable controllers (A3000, GVP Impact A2000-HC+8 Series II, Masoboshi 702 and Blizzard SCSI kit) and none of them have the MASK values clearly stated (to a lay person like myself) in the manual.

It seems to me that it depends on a number of factors, so giving clear answers would be difficult, but I can't find anything about how to work out a correct MASK value for any given system anywhere. Is it so complicated that such information simply doesn't exist (isn't really all that meaningful/useful)?
 
Hello,

your question about how determine values is right, anyway i can only point you to the manual ( you guess?) of the filesystem you use (i.e. PFS, that explain some things about what are you looking for, inside the guide).
I have coded a device driver for an IDE card, but never seen (at least, by the point of view of the device driver, like buddha.device, scsi.device and so on) this values; so never encountered lines of code where manage MASK and MAXTRANSFER.
So, seems to be a question of FileSystem and old DMA controllers or controllers inside motherboards.

Regards
Stefano
 
Last edited:
Hello,

as reported from the manual of ProfessionalFileSystem 2

.....................

> DMAMask

If you don't have memory problems you should use the same mask as FFS/AFS did. The mask is filesystem independent. For the A1200/A4000 internal IDE controller use 0xfffffffc. For ZorroIII boards (Fastlane, Phase5, 4091) use 0xffffffff. For ZorroII boards and Oktagon 4008 use 0x7ffffffc.

> MaxTransfer

Use the same maxtransfer as FFS/AFS did. Maxtransfer is filesystem independent.

.....................

Seems that Mask is related to memory alignment and addressing capabilities of the controller (i.e. a Zorro II card, that has 24 bit width address bus, needs a Mask of $FFFFFC, that is the union of 'max address' and 'alignment to longword', $FFFFFF&$FFFFFC); MaxTransfer means how much can be transfered in a shoot (it is a limitation of the device driver of the controller; i.e. my ide.device of my IDE card, has no limit).

Regards

Stefano
 
Last edited:
Hello,

the MaxTransfer value could be a pretty test to see how good is a device driver (i mean how much good is his code).
For the IDE port of the A1200, the value to use is $1FE00 (as reported in some documents); you can try to use $FFFF instead. A good code work properly in both cases, because the 'strange' value used for the A1200, tell just to the device driver to use multiple values of 512 (bytes), the size of an hard-disk sector; but this is obvious, because it is not possible to fall in the half of a sector! A good code takes every value and does a mask itself (it means does not expect any MaxTransfer value at all!); it maskes the amount to transfer, and sees if this value is multiple of 512; if not, reject to do the job!

Try this by yourself!

About Mask, this is specific of DMA card, and, maybe, with ram onboard. In PIO mode, when CPU does Read and Write, it knows what to do and does not need any Mask at all...at least, this is my opinion.

Stefano
 
This mysterious value 0x1fe00 for maxtransfer circumvent an incompatibility betwenn old ATA-1 Amiga drivers and ATA-2 Drives caused by a change in the ATA specification: http://eab.abime.net/showpost.php?p=759918&postcount=25
Some IDE drives have Firmware Bugs and need a Maxtransfer of 0xfe00 but these are special cases.

So Maxtransfer is simple, the value is 0xffffff (24MB) for SCSI and 0x1fe00 (127,5KB) for IDE, no need to fiddle around since higher values have no noticeable advantage but can lead to errors.

Mask is much more complex...
With an DMA Conttroller the Base for Mask ist 0xffffff for ZII and 0xffffffff for ZIII/A3000/A4000T Onboard Controller, without DMA it is always 0xffffffff.
All faultless controllers should work with this Mask but depending on the driver/hardware implementation not necessarely with optimal performance.

Some DMA Controller of which i know to run better with a different mask are FastlaneZ3 (0xfffffffc), A3000 SCSI (old DMAC/Ramsey 0xfffffffc new DMAC/Ramsey 0xffffffe)
The A3000 Onboard SCSI hardware can only do Word or Longword Aligned DMA so the driver lets always the CPU copy the Buffer if its not aligned.
The Fastlane can do Byte aligned DMA, but then it do four byte transfers instead of one Longword and barely reach 20% of longword transfervalue. With mask 0xfffffffc and fast cpu (40+) 50...80% are possible since the DMA transfer full Longwords and the CPU copy the Buffer around.

The easiest was to optimal Mask is to get a tool like Diskspeed and test transfer to/from Fastmen with medium Size (32768Byte) for Long, Word and Byte aligned buffer, with the last digit of the mask changed from from f to e and c.
The Longword transferrate should not vary, but if the transfer to word/byte Buffer with a mask ending in c or e is significantly faster than wif f, this is the optimal value for this specific System..
 
Back
Top Bottom