cbgfx: add error code to cbgfx_init

cbgfx_init can fail for multiple reasons. These codes help debugging
cbgfx_init.

BUG=chromium:502066
BRANCH=tot
TEST=Tested on Glados

Change-Id: Ifaa8d91b058bd838a53faf5d803c0337cb1e082c
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 4caf2496f3583e133f3f216ec401515c267e6e7b
Original-Change-Id: I84f60dd961db47fa426442172ab19676253b9495
Original-Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/315550
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/12930
Tested-by: build bot (Jenkins)
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Daisuke Nojiri 2015-12-02 11:42:51 -08:00 committed by Patrick Georgi
parent b87bb29f4f
commit d201e8c38a
2 changed files with 9 additions and 3 deletions

View File

@ -143,11 +143,11 @@ static int cbgfx_init(void)
fbinfo = lib_sysinfo.framebuffer; fbinfo = lib_sysinfo.framebuffer;
if (!fbinfo) if (!fbinfo)
return -1; return CBGFX_ERROR_FRAMEBUFFER_INFO;
fbaddr = phys_to_virt((uint8_t *)(uintptr_t)(fbinfo->physical_address)); fbaddr = phys_to_virt((uint8_t *)(uintptr_t)(fbinfo->physical_address));
if (!fbaddr) if (!fbaddr)
return -1; return CBGFX_ERROR_FRAMEBUFFER_ADDR;
screen.size.width = fbinfo->x_resolution; screen.size.width = fbinfo->x_resolution;
screen.size.height = fbinfo->y_resolution; screen.size.height = fbinfo->y_resolution;
@ -157,7 +157,7 @@ static int cbgfx_init(void)
/* Calculate canvas size & offset, assuming the screen is landscape */ /* Calculate canvas size & offset, assuming the screen is landscape */
if (screen.size.height > screen.size.width) { if (screen.size.height > screen.size.width) {
LOG("Portrait screen not supported\n"); LOG("Portrait screen not supported\n");
return -1; return CBGFX_ERROR_PORTRAIT_SCREEN;
} }
canvas.size.height = screen.size.height; canvas.size.height = screen.size.height;
canvas.size.width = canvas.size.height; canvas.size.width = canvas.size.height;

View File

@ -51,6 +51,12 @@
#define CBGFX_ERROR_BITMAP_DATA 0x12 #define CBGFX_ERROR_BITMAP_DATA 0x12
/* bitmap error: scaling out of range */ /* bitmap error: scaling out of range */
#define CBGFX_ERROR_SCALE_OUT_OF_RANGE 0x13 #define CBGFX_ERROR_SCALE_OUT_OF_RANGE 0x13
/* invalid framebuffer info */
#define CBGFX_ERROR_FRAMEBUFFER_INFO 0x14
/* invalid framebuffer address */
#define CBGFX_ERROR_FRAMEBUFFER_ADDR 0x15
/* portrait screen not supported */
#define CBGFX_ERROR_PORTRAIT_SCREEN 0x16
struct fraction { struct fraction {
int32_t n; int32_t n;