link/graphics: New state machine

This is a new state machine. It is more programmatic, in the
case of auxio, and has much more symbolic naming, and very few
"magic" numbers, except in the case of undocumented settings.

As before, the 'pre-computed' IO ops are encoded in the iodefs
table. A function, run, is passed and index into the table and
runs the ops.

A new operator, I, has been added. When the I operator is hit,
run() returns the index of the next operator in the table.

The i915lightup function runs the table. All the AUX channel ops
have been removed from the table, however, and are now called as
functions, using the previously committed auxio function.

The iodefs table has been grouped into blocks of ops, which end in
an I operator. As the lightup function progresses through startup,
and the run() returns, the lightup function performs aux channel
operations.

This code is symbolic enough, I hope, that it will make haswell
graphics bringup simpler.

i915io.c, and the core of the code in i915lightup.c, were
programatically generated, starting with IO logs from the DRM
startup code in the kernel. It is possible to apply the tools that
do this generation to newer IO logs from the kernel.

Change-Id: I8a8e121dc0d9674f0c6a866343b28e179a1e3d8a
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Reviewed-on: http://review.coreboot.org/2836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
diff --git a/src/mainboard/google/link/i915io.h b/src/mainboard/google/link/i915io.h
index 06114c4..dd97fff 100644
--- a/src/mainboard/google/link/i915io.h
+++ b/src/mainboard/google/link/i915io.h
@@ -18,6 +18,21 @@
  */
 
 #include "i915_reg.h"
+#include "drm_dp_helper.h"
+
+/* things that are, strangely, not defined anywhere? */
+#define PCH_PP_UNLOCK 0xabcd0000
+#define WMx_LP_SR_EN (1<<31)
+
+/* Google Link-specific defines */
+/* how many 4096-byte pages do we need for the framebuffer?
+ * There are 32 bits per pixel, or 4 bytes,
+ * which means 1024 pixels per page.
+ * HencetThere are 4250 GTTs on Link:
+ * 2650 (X) * 1700 (Y) pixels / 1024 pixels per page.
+ */
+#define FRAME_BUFFER_PAGES ((2560*1700)/1024)
+#define FRAME_BUFFER_BYTES (FRAME_BUFFER_PAGES*4096)
 
 /* One-letter commands for code not meant to be ready for humans.
  * The code was generated by a set of programs/scripts.
@@ -46,10 +61,10 @@
  */
 #define M 1
 #define R 2
-#define W 3
-#define V 4
-#define I 8
-#define P 16
+#define W 4
+#define V 8
+#define I 16
+#define P 32
 
 struct iodef {
 	unsigned char op;
@@ -65,8 +80,8 @@
 void io_i915_WRITE32(unsigned long val, unsigned long addr);
 
 /* intel_dp.c */
-u32 pack_aux(u8 *src, int src_bytes);
-void unpack_aux(u32 src, u8 *dst, int dst_bytes);
-int intel_dp_aux_ch(u32 ch_ctl, u32 ch_data, u8 *send, int send_bytes,
-	u8 *recv, int recv_size);
+u32 pack_aux(u32 *src, int src_bytes);
+void unpack_aux(u32 src, u32 *dst, int dst_bytes);
+int intel_dp_aux_ch(u32 ch_ctl, u32 ch_data, u32 *send, int send_bytes,
+	u32 *recv, int recv_size);