2 * coreboot Framebuffer driver.
4 * Copyright (C) 2011 The Chromium OS authors
6 * See file CREDITS for list of people who contributed to this
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 #include <asm/arch/tables.h>
27 #include <asm/arch/sysinfo.h>
29 #include "videomodes.h"
36 static int parse_coreboot_table_fb(GraphicDevice *gdev)
38 struct cb_framebuffer *fb = lib_sysinfo.framebuffer;
40 /* If there is no framebuffer structure, bail out and keep
41 * running on the serial console.
46 gdev->winSizeX = fb->x_resolution;
47 gdev->winSizeY = fb->y_resolution;
49 gdev->plnSizeX = fb->x_resolution;
50 gdev->plnSizeY = fb->y_resolution;
52 gdev->gdfBytesPP = fb->bits_per_pixel / 8;
54 switch (fb->bits_per_pixel) {
56 gdev->gdfIndex = GDF_32BIT_X888RGB;
59 gdev->gdfIndex = GDF_16BIT_565RGB;
62 gdev->gdfIndex = GDF__8BIT_INDEX;
66 gdev->isaBase = CONFIG_SYS_ISA_IO_BASE_ADDRESS;
67 gdev->pciBase = (unsigned int)fb->physical_address;
69 gdev->frameAdrs = (unsigned int)fb->physical_address;
70 gdev->memSize = fb->bytes_per_line * fb->y_resolution;
72 gdev->vprBase = (unsigned int)fb->physical_address;
73 gdev->cprBase = (unsigned int)fb->physical_address;
78 void *video_hw_init(void)
80 GraphicDevice *gdev = &ctfb;
85 if (!parse_coreboot_table_fb(gdev)) {
86 printf("No video mode configured in coreboot!\n");
90 bits_per_pixel = gdev->gdfBytesPP * 8;
92 /* fill in Graphic device struct */
93 sprintf(gdev->modeIdent, "%dx%dx%d", gdev->winSizeX, gdev->winSizeY,
95 printf("%s\n", gdev->modeIdent);
97 memset((void *)gdev->pciBase, 0,
98 gdev->winSizeX * gdev->winSizeY * gdev->gdfBytesPP);