radeon_replay/radeon_dp_aux: Use same DP_AUX defines as linux

This allows us to more easily integrate the code into linux.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
radeon_replay/radeon_dp_aux: Rename 'ack' field to 'reply'

This makes it more consistent with the naming in linux.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
radeon_replay/radeon_dp_aux: Immitate linux context information

This allows us to more easily integrate the code into linux.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
radeon_replay/radeon_dp_aux: Immitate DRM_DEBUG_KMS macro

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
radeon_replay: Convert min and max macros to lowercase

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
radeon_replay/radeon_dp_aux.c: rename to aruba_dp_aux.c

From now on, we want to prefix all the code that we later want to
integrate into coreboot and linux to something that distinguishes it.

The functions in this file are specific to Radeon GPUs codenamed ARUBA,
hence the tropical filename.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
radeon_replay/aruba_dp_aux: Add parentheses around bitwise shift

Fix the register write in aux_channel_fifo_write_start() to include
parentheses around "data << 8". There were no problems associated
with this line, but it makes the statement symmetrical wrt to also
setting of bit 31.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
radeon_replay/aruba_dp_aux: Do not set default for 'reply' field

Don't set the 'reply' field to 0xff if we get an error from
do_aux_tran(). An error means we haven't received a reply, and we
shouldn't use that field anyway on errors.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
radeon_replay/aruba_dp_aux: Move retry loop to separate function

Move the retry loop out of radeon_process_aux_ch_wrapper(). This
function is designed to plug into linux, but linux already has a retry
loop, and expects us to only try the transaction once.

For our internal purposes, call the wrapper which handles the retries.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
replay/aruba_dp_aux: Return number of recv bytes in do_aux_tran()

This function started out as the first serious RE effort. At that
time, it seemed that what we now know as the 'reply' field was a
status code, and it made sense to return it rather than the number of
incoming bytes. Now we know this field actually represents a byte on
the AUX bus.

It thus makes more sense to not mangle the reply field with possible
error codes. This makes do_aux_tran() symmetrical with the wrappers,
where the return value is either the number of bytes transferred, or
an error code. The reply field is now transferred via a pointer, in
the same manner that the wrappers do it.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
replay/aruba_dp_aux: Mask hpd_id and ch_id to three bits

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>