diff options
author | Ronald G. Minnich <rminnich@google.com> | 2013-03-05 13:32:24 -0800 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2013-03-20 05:31:04 +0100 |
commit | ec2d914e198928f89928838476ddbd6e5ef61b98 (patch) | |
tree | db35d146e66043efdc7702bff8939a394debd724 /src/mainboard/google/link/i915.c | |
parent | d466d750d71f979ccd6636306b51f2d87cb19cba (diff) |
link/graphics: implement a palette setting operator
Add a new operator, P, for the state machine, meaning
implement a palette fill.
Implement a function (palette) that fills the palette when the
P operator is hit.
This replaces 256 lines in the state machine table with 1.
Change-Id: I67d9219fe7de0ecf1fb9faf92130c00c9f5f8e88
Signed-off-by: Ronald G. Minnich <rminnich@google.com>
Reviewed-on: http://review.coreboot.org/2835
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/mainboard/google/link/i915.c')
-rw-r--r-- | src/mainboard/google/link/i915.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/mainboard/google/link/i915.c b/src/mainboard/google/link/i915.c index d6438cb9d7..1c82e178d4 100644 --- a/src/mainboard/google/link/i915.c +++ b/src/mainboard/google/link/i915.c @@ -95,7 +95,7 @@ setgtt(int start, int end, unsigned long base, int inc) { int i; - for(i = start; i < end; i++){ + for (i = start; i < end; i++){ u32 word = base + i*inc; WRITE32(word|1,(i*4)|1); } @@ -128,6 +128,21 @@ extern struct iodef iodefs[]; static int i915_init_done = 0; +/* fill the palette. This runs when the P opcode is hit. */ +static void palette(void) +{ + int i; + unsigned long color = 0; + + for (i = 0; i < 256; i++, color += 0x010101){ + if (verbose & vio)printk(BIOS_SPEW, + "_LGC_PALETTE_A+%08x: outl %08lx\n", + i<<2, color); + + io_i915_WRITE32(color, _LGC_PALETTE_A + (i<<2)); + } +} + int vbe_mode_info_valid(void); int vbe_mode_info_valid(void) { @@ -178,12 +193,15 @@ int i915lightup(unsigned int pphysbase, globalstart = rdtscll(); /* state machine! */ - for(i = 0, id = iodefs; id->op; i++, id++){ + for (i = 0, id = iodefs; id->op; i++, id++){ switch(id->op){ case M: if (verbose & vmsg) printk(BIOS_SPEW, "%ld: %s\n", globalmicroseconds(), id->msg); break; + case P: + palette(); + break; case R: u = READ32(id->addr); if (verbose & vio)printk(BIOS_SPEW, "%s: Got %08lx, expect %08lx\n", @@ -193,7 +211,7 @@ int i915lightup(unsigned int pphysbase, /* they're going to be polling. * just do it 1000 times */ - for(t = 0; t < 1000 && id->data != u; t++){ + for (t = 0; t < 1000 && id->data != u; t++){ u = READ32(id->addr); } if (verbose & vspin) printk(BIOS_SPEW, @@ -236,7 +254,7 @@ int i915lightup(unsigned int pphysbase, /* optional, we don't even want to take timestamp overhead * if we can avoid it. */ if (0) - for(i = 0, id = iodefs; id->op; i++, id++){ + for (i = 0, id = iodefs; id->op; i++, id++){ switch(id->op){ case R: printk(BIOS_SPEW, "%ld: R %08lx\n", times[i], id->addr); |