| 1 |
|
| 2 |
|
| 3 |
#include <console/console.h> |
| 4 |
#include <device/device.h> |
| 5 |
#include <halt.h> |
| 6 |
#include <device/mmio.h> |
| 7 |
#include <ramdetect.h> |
| 8 |
#include <symbols.h> |
| 9 |
#include <framebuffer_info.h> |
| 10 |
|
| 11 |
static void init_gfx(void) |
| 12 |
{ |
| 13 |
uint32_t *pl111; |
| 14 |
|
| 15 |
|
| 16 |
int width = 800, height = 600; |
| 17 |
uint32_t framebuffer = 0x4c000000; |
| 18 |
pl111 = (uint32_t *)0x10020000; |
| 19 |
write32(pl111, (width / 4) - 4); |
| 20 |
write32(pl111 + 1, height - 1); |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
write32(pl111 + 4, framebuffer); |
| 25 |
write32(pl111 + 7, 0); |
| 26 |
write32(pl111 + 10, 0xff); |
| 27 |
write32(pl111 + 6, (5 << 1) | 0x801); |
| 28 |
|
| 29 |
fb_add_framebuffer_info(framebuffer, width, height, 4 * width, 32); |
| 30 |
} |
| 31 |
|
| 32 |
static void mainboard_enable(struct device *dev) |
| 33 |
{ |
| 34 |
int discovered; |
| 35 |
if (!dev) { |
| 36 |
printk(BIOS_EMERG, "No dev0; die\n"); |
| 37 |
halt(); |
| 38 |
} |
| 39 |
|
| 40 |
discovered = probe_ramsize((uintptr_t)_dram, CONFIG_DRAM_SIZE_MB); |
| 41 |
printk(BIOS_DEBUG, "%d MiB of RAM discovered\n", discovered); |
| 42 |
ram_range(dev, 0, 0x60000000, discovered * MiB); |
| 43 |
init_gfx(); |
| 44 |
} |
| 45 |
|
| 46 |
struct chip_operations mainboard_ops = { |
| 47 |
.enable_dev = mainboard_enable, |
| 48 |
}; |