util/cb2replay: Decode known VGA IO accessses

Coreboot has functions for certain VGA IO access patterns. If we
detect such a pattern, convert it to a coreboot call.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
sh/cb2replay: Use a shell variable to denote hex characters

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
util/cb2replay: Convert delay loops to single delay function

Successive reads from port 0x3f54 indicate a delay loop. This seems
to correspond to a 50MHz timer. Convert this access pattern to a
radeon_delay() function.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
util/cb2replay: Group timer control writes in radeon_delay()

Delay loops always start with a write access to what appears to be
the timer control register. Group that access in radeon_delay().

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
.gitignore: Ignore KDevelop project files

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Add initial infrastructure for usermode replay project

This adds an initial radeon_replay program which replays the trace
obtained on an HP Pavilion m6 1035dx laptrop. The trace was converted
to C code using the util/cb2replay script, and the IO helpers were
moved to a separate file.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
radeon_replay: Add VGA IO helpers

These are pulled verbatim from the coreboot tree.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
radeon_replay: Refactor helpers to print the trace on stderr

This crates a trace similar to the one output by cb2replay, and allows
diffing of the two traces. Port IO operations are not output.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
radeon_delay: Fix the return type of radeon_delay() helper

This function does not return a value. Change its return type to void.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
radeon_replay: Provide udelay function with trace output

This function is intended to be used instead of udelay(), as it
provides a trace output identical to radeon_delay().

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
radeon_replay: Provide register access helpers

These helpers take the register number, rather than the register
address as a parameter, and thus match the representation in the atom
tables. Since they use the radeon_[read/write]_sync internally, they
provide identical trace output.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
radeon_replay/radeon_util.h: Provide bitwise set/clear function

This is much simpler to use than writing a read/modify/write sequence
every time we need to modify a register.
radeon_replay/radeon_util.h: Add macros for MIN and MAX

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
radeon_replay: Add preliminary AUX channel transaction handling

This gives us enough of a handler to be able to send and receive
messages via DisplayPort AUX channels.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
radeon_replay: Add function to dump contents of an array

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
radeon_replay: Read DisplayPort configuration data on AUX 0

This uses AUX channel 0 to read the first 356 bytes of the DisplayPort
configuration data (DPCD), and dump the contents.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
radeon_replay: Implement I²C transactions over AUX channel

This enables us to control I²C devices behind the DisplayPort sink,
such as EDID EEPROMs behind LVDS bridges.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
radeon_replay: Read and dump EDID of device connected behind AUX0

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
radeon_replay: Add EDID decoder from coreboot

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
radeon_replay: Decode EDID of devices behind AUX 0

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