summaryrefslogtreecommitdiff
path: root/src/mainboard/intel
diff options
context:
space:
mode:
authorRonald G. Minnich <rminnich@google.com>2013-04-23 10:59:11 -0700
committerStefan Reinauer <stefan.reinauer@coreboot.org>2013-07-10 02:39:28 +0200
commitb2893a0169ce603926bf13465432a15c4526de97 (patch)
tree6c5bd8c303154406da53fd76a24aff081ac52694 /src/mainboard/intel
parent3fb30eeb147fecb4124b63c353a7b8aac61d4c2a (diff)
downloadcoreboot-b2893a0169ce603926bf13465432a15c4526de97.tar.xz
Provide support for setting up the framebuffer from EDID
Add three functions to edid.c: void set_vbe_mode_info_valid(struct edid *edid, uintptr_t fb_addr) takes an edid and uintptr_t, and fills in a static lb_framebuffer struct as well as setting the static vbe_valid to 1 unless some problem is found in the edid. The intent here is that this could be called from the native graphics setup code on both ARM and x86. int vbe_mode_info_valid(void) returns value of the static vbe_valid. void fill_lb_framebuffer(struct lb_framebuffer *framebuffer) copies the static edid_fb to lb_framebuffer. There is now a common vbe.h in src/include, removed the two special ones. In general, graphics in coreboot is a mess, but graphics is always a mess. We don't have a clean way to try two different ways to turn on a device and use the one that works. One battle at a time. Overall, things are much better. The best part: this code would also work for ARM, which also uses EDID. Change-Id: Id23eb61498b331d44ab064b8fb4cb10f07cff7f3 Signed-off-by: Ronald G. Minnich <rminnich@google.com> Signed-off-by: Gabe Black <gabeblack@chromium.org> Reviewed-on: http://review.coreboot.org/3636 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/mainboard/intel')
-rw-r--r--src/mainboard/intel/wtm2/i915.c114
1 files changed, 84 insertions, 30 deletions
diff --git a/src/mainboard/intel/wtm2/i915.c b/src/mainboard/intel/wtm2/i915.c
index 8103016c51..9d0c27d850 100644
--- a/src/mainboard/intel/wtm2/i915.c
+++ b/src/mainboard/intel/wtm2/i915.c
@@ -139,42 +139,96 @@ static unsigned long globalmicroseconds(void)
static int i915_init_done = 0;
-int vbe_mode_info_valid(void)
+/* fill the palette. This runs when the P opcode is hit. */
+static void palette(void)
{
- return i915_init_done;
+ int i;
+ unsigned long color = 0;
+
+ for(i = 0; i < 256; i++, color += 0x010101){
+ io_i915_WRITE32(color, _LGC_PALETTE_A + (i<<2));
+ }
}
-void fill_lb_framebuffer(struct lb_framebuffer *framebuffer)
-{
- printk(BIOS_SPEW, "fill_lb_framebuffer: graphics is %p\n",
- (void *)graphics);
- /* Please note: these will be filled from EDID.
- * these values are a placeholder.
- */
- framebuffer->physical_address = graphics;
- /* these are a fantasy, but will be fixed once we're getting
- * info from the hardware. Hard to get from the device tree,
- * which is arguably a defect of the device tree. Bear with me,
- * this Will Get Fixed.
- */
- framebuffer->x_resolution = 1960;
- framebuffer->y_resolution = 1700;
- framebuffer->bytes_per_line = 1960*4;
- framebuffer->bits_per_pixel = 32;
- framebuffer->red_mask_pos = 16;
- framebuffer->red_mask_size = 8;
- framebuffer->green_mask_pos = 8;
- framebuffer->green_mask_size = 8;
- framebuffer->blue_mask_pos = 0;
- framebuffer->blue_mask_size = 8;
- framebuffer->reserved_mask_pos = 0;
- framebuffer->reserved_mask_size = 0;
+static unsigned long times[4096];
+static int run(int index)
+{
+ int i, prev = 0;
+ struct iodef *id, *lastidread = 0;
+ unsigned long u, t;
+ if (index >= niodefs)
+ return index;
+ /* state machine! */
+ for(i = index, id = &iodefs[i]; 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, "\texpect %08lx\n", id->data);
+ /* we're looking for something. */
+ if (lastidread->addr == id->addr){
+ /* they're going to be polling.
+ * just do it 1000 times
+ */
+ for(t = 0; t < 1000 && id->data != u; t++){
+ u = READ32(id->addr);
+ }
+ if (verbose & vspin) printk(BIOS_SPEW,
+ "%s: # loops %ld got %08lx want %08lx\n",
+ regname(id->addr),
+ t, u, id->data);
+ }
+ lastidread = id;
+ break;
+ case W:
+ WRITE32(id->data, id->addr);
+ if (id->addr == PCH_PP_CONTROL){
+ if (verbose & vio)
+ printk(BIOS_SPEW, "PCH_PP_CONTROL\n");
+ switch(id->data & 0xf){
+ case 8: break;
+ case 7: break;
+ default: udelay(100000);
+ if (verbose & vio)
+ printk(BIOS_SPEW, "U %d\n", 100000);
+ }
+ }
+ break;
+ case V:
+ if (id->count < 8){
+ prev = verbose;
+ verbose = id->count;
+ } else {
+ verbose = prev;
+ }
+ printk(BIOS_SPEW, "Change verbosity to %d\n", verbose);
+ break;
+ case I:
+ printk(BIOS_SPEW, "run: return %d\n", i+1);
+ return i+1;
+ break;
+ default:
+ printk(BIOS_SPEW, "BAD TABLE, opcode %d @ %d\n", id->op, i);
+ return -1;
+ }
+ if (id->udelay)
+ udelay(id->udelay);
+ if (i < ARRAY_SIZE(times))
+ times[i] = globalmicroseconds();
+ }
+ printk(BIOS_SPEW, "run: return %d\n", i);
+ return i+1;
}
-int i915lightup(unsigned int physbase,
- unsigned int iobase,
- unsigned int mmio,
+int i915lightup(unsigned int physbase, unsigned int iobase, unsigned int mmio,
unsigned int gfx);
int i915lightup(unsigned int pphysbase, unsigned int piobase,