kodiak@amiga.UUCP (Robert R. Burns) (09/04/88)
Software developers of driver code for DMA devices (e.g. me) need a way to
differentiate between memory that is DMA-able vs. not. Specifically, a DMA
SCSI controller can only read/write memory on the bus, but not, for example,
CSA 32-bit memory. There are several ways I could think of to ensure the
memory is DMA-able:
1. For each buffer handed to the driver
a. if a disk write, cache the value at the head of the buffer
b. write a known value to the buffer
c. read that value w/ the DMA circuitry and verify it
d. write another known value to the buffer
e. read that value w/ the DMA circuitry and verify it
f. if a disk write, restore the value at the head of the buffer
You now know of the (head of) the buffer is DMA-able. You can assume
that DMA and non-DMA memory spaces are not coalesced so the entire
buffer shares that attribute.
2. Check if the address is in the range $000000-$ffffff
3. Use a MEMF flag in the BUFMEM field of the environment vector (and thus
the MountList) to specify DMA-able memory. Note that this must be a
*set* bit (only set bits restrict the allocation), and that bit must be
set by exec/expansion for those spaces that it finds. The only bit that
meets this requirement is MEMF_PUBLIC.
1. is too slow and cumbersome, and of 2. and 3., I chose 3.
CSA has made their non-bus memory not public, so it works there. (If you
know of non-DMA memory that is added to the system as MEMF_PUBLIC, please
let me know.) I think making MEMF_PUBLIC mean exactly MEMF_DMA is both a
defensable position (it's cleaner than the address range check and provides
a better growth path) and a historical necessity (there are no other "reserved"
MEMF_ bits set to one, and MEMF_PUBLIC means all things to all people and
thus means nothing to anybody). Note that I am not necessarily representing
Commodore policy here, just making y'all aware of an evolved usage.
- Kodiak
--
| / _ _|' _ |/ Bob Burns . . . . .---. .
|/ (_)(_)|(_\|\ {pyramid|oliveb|cbmvax]! / \ |\ /| | | __ / \
|\ Kodiak \ amiga!kodiak _______/ A \| \/ |_|_|___|/ A \
| \ Software "dedicated to the science of fun"\_________