diff options
Diffstat (limited to 'src/mainboard/intel/wtm2')
-rw-r--r-- | src/mainboard/intel/wtm2/i915.c | 114 |
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, |