- Make the method call less confusing.
- Use cur_host instead of passing cmd_struct.
- Pass a boolean to differentiate LOAD_QUAD and STORE_QUAD.
- Use xfer_size instead of req_count for res_count.
- Don't LOAD_QUAD to read-only DBDMA command.
We were treating resCount as a "result" count, but it's actually a "residual"
count that reports how many bytes from a descriptor were not transferred
when processing a command. We now correctly handle partial descriptors.
This ended up being necessary for the 10.0 public beta bringup too (the
`AppleUltra66ATA::stopDma` implementation in xnu-103 computes the number
of bytes transferred by subtracting `resCount` from `reqCount`).
If queue_len is a flag to determine when data is queued, then it
probably should be set last so that the other fields are valid when
another thread decides to act on the queued data.
Some Apple docs state that the CommandPtrLo can be written
if both the run and active bits are cleared.
Later docs say that only the active bit needs to be cleared.
Fix the code to conform to the logic of the latter.
Have the entire dbdma program executed by scheduling each iteration in the CPU loop.
This is done only for devices that use the dbdma program to drive data input/output (has_data_callbacks) rather than have the device drive the dbdma program.
The active flag is cleared when the pause flag is set, so why shouldn't the active flag be cleared when the start flag is set with the pause flag is already set?
Allow the dbdma program to initiate reading/writing by adding in and out callbacks.
Support the DBDMA flush command by adding a flush callback. If the transfer completes, then clear the flush flag, otherwise leave it unchanged.
Clear the flush flag after it is copied to the xferStatus of the DBDMA command.