From nobody Fri Apr 26 00:46:38 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1496078743872180.84927117807229; Mon, 29 May 2017 10:25:43 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coresystems.de) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1dFOPW-0002on-4p; Mon, 29 May 2017 19:24:54 +0200 Received: from das-labor.org ([188.40.89.130]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1dFOPL-0002mi-Je for seabios@seabios.org; Mon, 29 May 2017 19:24:51 +0200 From: Patrick Rudolph Authentication-Results: das-labor.org; dkim=permerror (bad message/signature format) To: seabios@seabios.org Date: Mon, 29 May 2017 19:25:10 +0200 Message-ID: <20170529172514.8308-2-siro@das-labor.org> In-Reply-To: <20170529172514.8308-1-siro@das-labor.org> References: <20170529172514.8308-1-siro@das-labor.org> X-Spam-Score: -2.7 (--) Subject: [SeaBIOS] [PATCH 1/5] SeaVGABios/cbvga: Advertise correct pixel format X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Accumulate the pixel format's bits instead relying on coreboot's bits_per_pixel, which says nothing about the active pixel format. Allows VBE to correctly advertise XRGB8 and BGRX8 framebuffer formats, commonly used by coreboot. Fixes at least Windows Bootloader and gfxboot. Signed-off-by: Patrick Rudolph --- vgasrc/cbvga.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c index b8216a9..39ffdbb 100644 --- a/vgasrc/cbvga.c +++ b/vgasrc/cbvga.c @@ -1,6 +1,7 @@ // Simple framebuffer vgabios for use with coreboot native vga init. // // Copyright (C) 2014 Kevin O'Connor +// Copyright (C) 2017 Patrick Rudolph // // This file may be distributed under the terms of the GNU LGPLv3 license. =20 @@ -164,7 +165,8 @@ cbvga_setup(void) } =20 u64 addr =3D GET_FARVAR(0, cbfb->physical_address); - u8 bpp =3D GET_FARVAR(0, cbfb->bits_per_pixel); + u8 bpp =3D cbfb->blue_mask_size + cbfb->green_mask_size + + cbfb->red_mask_size + cbfb->reserved_mask_size; u32 xlines =3D GET_FARVAR(0, cbfb->x_resolution); u32 ylines =3D GET_FARVAR(0, cbfb->y_resolution); u32 linelength =3D GET_FARVAR(0, cbfb->bytes_per_line); --=20 2.9.3 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios From nobody Fri Apr 26 00:46:38 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 14960787402531015.5670127736352; Mon, 29 May 2017 10:25:40 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coresystems.de) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1dFOPa-0002pR-RA; Mon, 29 May 2017 19:24:58 +0200 Received: from das-labor.org ([188.40.89.130]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1dFOPL-0002mm-RS for seabios@seabios.org; Mon, 29 May 2017 19:24:57 +0200 From: Patrick Rudolph Authentication-Results: das-labor.org; dkim=permerror (bad message/signature format) To: seabios@seabios.org Date: Mon, 29 May 2017 19:25:11 +0200 Message-ID: <20170529172514.8308-3-siro@das-labor.org> In-Reply-To: <20170529172514.8308-1-siro@das-labor.org> References: <20170529172514.8308-1-siro@das-labor.org> X-Spam-Score: -2.7 (--) Subject: [SeaBIOS] [PATCH 2/5] SeaVGABios/cbvga: Assume VGA compatible GPU in text-mode X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Assume the GPU is VGA compatible when running in text-mode. Advertise VGA modes. Microsoft Windows relies on graphics mode 12 as last resort when running in text mode. It is used even when not advertised. Allows to boot Windows 7 in "Safe Mode" and shows the boot splash. While the stdvga driver could be used instead, implementing it properly in the cbvga driver allows to switch between text and gfx mode using NVRAM option. Signed-off-by: Patrick Rudolph --- vgasrc/cbvga.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c index 39ffdbb..49af7f9 100644 --- a/vgasrc/cbvga.c +++ b/vgasrc/cbvga.c @@ -21,6 +21,10 @@ static u32 CBlinelength VAR16; =20 struct vgamode_s *cbvga_find_mode(int mode) { + /* Assume VGA compatible hardware in text-mode. */ + if (GET_GLOBAL(CBmode) =3D=3D 0x3) + return stdvga_find_mode(mode); + if (mode =3D=3D GET_GLOBAL(CBmode)) return &CBmodeinfo; if (mode =3D=3D 0x03) @@ -31,11 +35,11 @@ struct vgamode_s *cbvga_find_mode(int mode) void cbvga_list_modes(u16 seg, u16 *dest, u16 *last) { - if (dest Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1496078741122873.5893550617467; Mon, 29 May 2017 10:25:41 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coresystems.de) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1dFOPb-0002pd-En; Mon, 29 May 2017 19:24:59 +0200 Received: from das-labor.org ([188.40.89.130]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1dFOPR-0002ms-23 for seabios@seabios.org; Mon, 29 May 2017 19:24:57 +0200 From: Patrick Rudolph Authentication-Results: das-labor.org; dkim=permerror (bad message/signature format) To: seabios@seabios.org Date: Mon, 29 May 2017 19:25:12 +0200 Message-ID: <20170529172514.8308-4-siro@das-labor.org> In-Reply-To: <20170529172514.8308-1-siro@das-labor.org> References: <20170529172514.8308-1-siro@das-labor.org> X-Spam-Score: -2.7 (--) Subject: [SeaBIOS] [PATCH 3/5] SeaVGABIOS/vbe: Query driver for scanline pitch v2 X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Query the driver for the real scanline pitch in bytes. As cbvga doesn't change the pitch on mode change, always return the same pitch, that might exceed width times Bytes-per-pixel. Report the default stdvga pitch for all other drivers. Signed-off-by: Patrick Rudolph --- vgasrc/cbvga.c | 7 +++++++ vgasrc/stdvga.c | 5 +++++ vgasrc/vbe.c | 2 +- vgasrc/vgahw.h | 6 ++++++ vgasrc/vgautil.h | 2 ++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c index 49af7f9..6b3233e 100644 --- a/vgasrc/cbvga.c +++ b/vgasrc/cbvga.c @@ -124,6 +124,13 @@ cbvga_set_mode(struct vgamode_s *vmode_g, int flags) return 0; } =20 +int +cbvga_get_linesize(struct vgamode_s *vmode_g) +{ + /* Can't change mode, always report active pitch. */ + return GET_GLOBAL(CBlinelength); +} + #define CB_TAG_FRAMEBUFFER 0x0012 struct cb_framebuffer { u32 tag; diff --git a/vgasrc/stdvga.c b/vgasrc/stdvga.c index 886deca..0e24297 100644 --- a/vgasrc/stdvga.c +++ b/vgasrc/stdvga.c @@ -321,6 +321,11 @@ stdvga_set_dacformat(struct vgamode_s *vmode_g, int va= l) return -1; } =20 +int +stdvga_get_linesize(struct vgamode_s *vmode_g) +{ + return DIV_ROUND_UP(vmode_g->width * vga_bpp(vmode_g), 8); +} =20 /**************************************************************** * Save/Restore state diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c index facad19..724c1ba 100644 --- a/vgasrc/vbe.c +++ b/vgasrc/vbe.c @@ -107,7 +107,7 @@ vbe_104f01(struct bregs *regs) // Basic information about mode. int width =3D GET_GLOBAL(vmode_g->width); int height =3D GET_GLOBAL(vmode_g->height); - int linesize =3D DIV_ROUND_UP(width * vga_bpp(vmode_g), 8); + int linesize =3D vgahw_get_linesize(vmode_g); SET_FARVAR(seg, info->bytes_per_scanline, linesize); SET_FARVAR(seg, info->xres, width); SET_FARVAR(seg, info->yres, height); diff --git a/vgasrc/vgahw.h b/vgasrc/vgahw.h index dab2b4d..2a85eba 100644 --- a/vgasrc/vgahw.h +++ b/vgasrc/vgahw.h @@ -139,4 +139,10 @@ static inline int vgahw_save_restore(int cmd, u16 seg,= void *data) { return stdvga_save_restore(cmd, seg, data); } =20 +static inline int vgahw_get_linesize(struct vgamode_s *vmode_g) { + if (CONFIG_VGA_COREBOOT) + return cbvga_get_linesize(vmode_g); + return stdvga_get_linesize(vmode_g); +} + #endif // vgahw.h diff --git a/vgasrc/vgautil.h b/vgasrc/vgautil.h index 08c4e8d..fae5fba 100644 --- a/vgasrc/vgautil.h +++ b/vgasrc/vgautil.h @@ -17,6 +17,7 @@ int cbvga_get_dacformat(struct vgamode_s *vmode_g); int cbvga_set_dacformat(struct vgamode_s *vmode_g, int val); int cbvga_save_restore(int cmd, u16 seg, void *data); int cbvga_set_mode(struct vgamode_s *vmode_g, int flags); +int cbvga_get_linesize(struct vgamode_s *vmode_g); int cbvga_setup(void); =20 // clext.c @@ -63,6 +64,7 @@ void stdvga_list_modes(u16 seg, u16 *dest, u16 *last); void stdvga_build_video_param(void); void stdvga_override_crtc(int mode, u8 *crtc); int stdvga_set_mode(struct vgamode_s *vmode_g, int flags); +int stdvga_get_linesize(struct vgamode_s *vmode_g); void stdvga_set_packed_palette(void); =20 // swcursor.c --=20 2.9.3 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios From nobody Fri Apr 26 00:46:38 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1496078750332951.4201385912053; Mon, 29 May 2017 10:25:50 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coresystems.de) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1dFOPc-0002pv-AG; Mon, 29 May 2017 19:25:00 +0200 Received: from das-labor.org ([188.40.89.130]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1dFOPM-0002mx-8Z for seabios@seabios.org; Mon, 29 May 2017 19:24:57 +0200 From: Patrick Rudolph Authentication-Results: das-labor.org; dkim=permerror (bad message/signature format) To: seabios@seabios.org Date: Mon, 29 May 2017 19:25:13 +0200 Message-ID: <20170529172514.8308-5-siro@das-labor.org> In-Reply-To: <20170529172514.8308-1-siro@das-labor.org> References: <20170529172514.8308-1-siro@das-labor.org> X-Spam-Score: -2.7 (--) Subject: [SeaBIOS] [PATCH 4/5] SeaVGABios/cbvga: Use active mode to clear screen X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" As coreboot framebuffer is immutable always use CBmodeinfo. Signed-off-by: Patrick Rudolph --- vgasrc/cbvga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c index 6b3233e..ae2bd4a 100644 --- a/vgasrc/cbvga.c +++ b/vgasrc/cbvga.c @@ -114,7 +114,7 @@ cbvga_set_mode(struct vgamode_s *vmode_g, int flags) return 0; } struct gfx_op op; - init_gfx_op(&op, vmode_g); + init_gfx_op(&op, &CBmodeinfo); op.x =3D op.y =3D 0; op.xlen =3D GET_GLOBAL(CBmodeinfo.width); op.ylen =3D GET_GLOBAL(CBmodeinfo.height); --=20 2.9.3 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios From nobody Fri Apr 26 00:46:38 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 14960787502141.8607171551536794; Mon, 29 May 2017 10:25:50 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coresystems.de) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1dFOPc-0002q9-Rf; Mon, 29 May 2017 19:25:00 +0200 Received: from das-labor.org ([188.40.89.130]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1dFOPS-0002o1-Td for seabios@seabios.org; Mon, 29 May 2017 19:24:58 +0200 From: Patrick Rudolph Authentication-Results: das-labor.org; dkim=permerror (bad message/signature format) To: seabios@seabios.org Date: Mon, 29 May 2017 19:25:14 +0200 Message-ID: <20170529172514.8308-6-siro@das-labor.org> In-Reply-To: <20170529172514.8308-1-siro@das-labor.org> References: <20170529172514.8308-1-siro@das-labor.org> X-Spam-Score: -2.7 (--) Subject: [SeaBIOS] [PATCH 5/5] SeaVGABios/cbvga: Advertise compatible VESA modes X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Advertise compatible VESA modes, that are smaller or equal to coreboot's active framebuffer. Only modes that have the same Bpp are advertise and can be selected. Allows the Windows 7 bootloader NTLDR to show up in VESA mode. Allows to show the Windows 7 boot logo. Allows Windows to boot in safe mode and in normal boot using VgaSave driver with resolution up to 1600x1200. This fixes most likely other bootloader and operating systems as well, in case the are relying on VESA framebuffer support. v2: Invalidate modes in cbvga_setup. Signed-off-by: Patrick Rudolph --- vgasrc/cbvga.c | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 106 insertions(+) diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c index ae2bd4a..42a50f7 100644 --- a/vgasrc/cbvga.c +++ b/vgasrc/cbvga.c @@ -19,8 +19,73 @@ static struct vgamode_s CBmodeinfo VAR16; static struct vgamode_s CBemulinfo VAR16; static u32 CBlinelength VAR16; =20 +static struct cbvga_mode_s +{ + u16 mode; + struct vgamode_s info; +} cbvesa_modes[] VAR16 =3D { + /* VESA 1.0 modes */ + { 0x110, { MM_DIRECT, 640, 480, 15, 8, 16, SEG_GRAPH } }, + { 0x111, { MM_DIRECT, 640, 480, 16, 8, 16, SEG_GRAPH } }, + { 0x112, { MM_DIRECT, 640, 480, 24, 8, 16, SEG_GRAPH } }, + { 0x113, { MM_DIRECT, 800, 600, 15, 8, 16, SEG_GRAPH } }, + { 0x114, { MM_DIRECT, 800, 600, 16, 8, 16, SEG_GRAPH } }, + { 0x115, { MM_DIRECT, 800, 600, 24, 8, 16, SEG_GRAPH } }, + { 0x116, { MM_DIRECT, 1024, 768, 15, 8, 16, SEG_GRAPH } }, + { 0x117, { MM_DIRECT, 1024, 768, 16, 8, 16, SEG_GRAPH } }, + { 0x118, { MM_DIRECT, 1024, 768, 24, 8, 16, SEG_GRAPH } }, + { 0x119, { MM_DIRECT, 1280, 1024, 15, 8, 16, SEG_GRAPH } }, + { 0x11A, { MM_DIRECT, 1280, 1024, 16, 8, 16, SEG_GRAPH } }, + { 0x11B, { MM_DIRECT, 1280, 1024, 24, 8, 16, SEG_GRAPH } }, + { 0x11D, { MM_DIRECT, 1600, 1200, 15, 8, 16, SEG_GRAPH } }, + { 0x11E, { MM_DIRECT, 1600, 1200, 16, 8, 16, SEG_GRAPH } }, + { 0x11F, { MM_DIRECT, 1600, 1200, 24, 8, 16, SEG_GRAPH } }, + /* VESA 2.0 modes */ + { 0x141, { MM_DIRECT, 640, 400, 32, 8, 16, SEG_GRAPH } }, + { 0x142, { MM_DIRECT, 640, 480, 32, 8, 16, SEG_GRAPH } }, + { 0x143, { MM_DIRECT, 800, 600, 32, 8, 16, SEG_GRAPH } }, + { 0x144, { MM_DIRECT, 1024, 768, 32, 8, 16, SEG_GRAPH } }, + { 0x145, { MM_DIRECT, 1280, 1024, 32, 8, 16, SEG_GRAPH } }, + { 0x147, { MM_DIRECT, 1600, 1200, 32, 8, 16, SEG_GRAPH } }, + { 0x149, { MM_DIRECT, 1152, 864, 15, 8, 16, SEG_GRAPH } }, + { 0x14a, { MM_DIRECT, 1152, 864, 16, 8, 16, SEG_GRAPH } }, + { 0x14b, { MM_DIRECT, 1152, 864, 24, 8, 16, SEG_GRAPH } }, + { 0x14c, { MM_DIRECT, 1152, 864, 32, 8, 16, SEG_GRAPH } }, + { 0x175, { MM_DIRECT, 1280, 768, 16, 8, 16, SEG_GRAPH } }, + { 0x176, { MM_DIRECT, 1280, 768, 24, 8, 16, SEG_GRAPH } }, + { 0x177, { MM_DIRECT, 1280, 768, 32, 8, 16, SEG_GRAPH } }, + { 0x178, { MM_DIRECT, 1280, 800, 16, 8, 16, SEG_GRAPH } }, + { 0x179, { MM_DIRECT, 1280, 800, 24, 8, 16, SEG_GRAPH } }, + { 0x17a, { MM_DIRECT, 1280, 800, 32, 8, 16, SEG_GRAPH } }, + { 0x17b, { MM_DIRECT, 1280, 960, 16, 8, 16, SEG_GRAPH } }, + { 0x17c, { MM_DIRECT, 1280, 960, 24, 8, 16, SEG_GRAPH } }, + { 0x17d, { MM_DIRECT, 1280, 960, 32, 8, 16, SEG_GRAPH } }, + { 0x17e, { MM_DIRECT, 1440, 900, 16, 8, 16, SEG_GRAPH } }, + { 0x17f, { MM_DIRECT, 1440, 900, 24, 8, 16, SEG_GRAPH } }, + { 0x180, { MM_DIRECT, 1440, 900, 32, 8, 16, SEG_GRAPH } }, + { 0x181, { MM_DIRECT, 1400, 1050, 16, 8, 16, SEG_GRAPH } }, + { 0x182, { MM_DIRECT, 1400, 1050, 24, 8, 16, SEG_GRAPH } }, + { 0x183, { MM_DIRECT, 1400, 1050, 32, 8, 16, SEG_GRAPH } }, + { 0x184, { MM_DIRECT, 1680, 1050, 16, 8, 16, SEG_GRAPH } }, + { 0x185, { MM_DIRECT, 1680, 1050, 24, 8, 16, SEG_GRAPH } }, + { 0x186, { MM_DIRECT, 1680, 1050, 32, 8, 16, SEG_GRAPH } }, + { 0x187, { MM_DIRECT, 1920, 1200, 16, 8, 16, SEG_GRAPH } }, + { 0x188, { MM_DIRECT, 1920, 1200, 24, 8, 16, SEG_GRAPH } }, + { 0x189, { MM_DIRECT, 1920, 1200, 32, 8, 16, SEG_GRAPH } }, + { 0x18a, { MM_DIRECT, 2560, 1600, 16, 8, 16, SEG_GRAPH } }, + { 0x18b, { MM_DIRECT, 2560, 1600, 24, 8, 16, SEG_GRAPH } }, + { 0x18c, { MM_DIRECT, 2560, 1600, 32, 8, 16, SEG_GRAPH } }, + { 0x18d, { MM_DIRECT, 1280, 720, 16, 8, 16, SEG_GRAPH } }, + { 0x18e, { MM_DIRECT, 1280, 720, 24, 8, 16, SEG_GRAPH } }, + { 0x18f, { MM_DIRECT, 1280, 720, 32, 8, 16, SEG_GRAPH } }, + { 0x190, { MM_DIRECT, 1920, 1080, 16, 8, 16, SEG_GRAPH } }, + { 0x191, { MM_DIRECT, 1920, 1080, 24, 8, 16, SEG_GRAPH } }, + { 0x192, { MM_DIRECT, 1920, 1080, 32, 8, 16, SEG_GRAPH } }, +}; + struct vgamode_s *cbvga_find_mode(int mode) { + int i; /* Assume VGA compatible hardware in text-mode. */ if (GET_GLOBAL(CBmode) =3D=3D 0x3) return stdvga_find_mode(mode); @@ -29,16 +94,45 @@ struct vgamode_s *cbvga_find_mode(int mode) return &CBmodeinfo; if (mode =3D=3D 0x03) return &CBemulinfo; + + for (i =3D 0; i < ARRAY_SIZE(cbvesa_modes); i++) { + struct cbvga_mode_s *cbmode_g =3D &cbvesa_modes[i]; + if (GET_GLOBAL(cbmode_g->mode) =3D=3D 0xffff) + continue; + if (GET_GLOBAL(cbmode_g->mode) =3D=3D mode) + return &cbmode_g->info; + } return NULL; } =20 void cbvga_list_modes(u16 seg, u16 *dest, u16 *last) { + int i; =20 /* Assume VGA compatible hardware in text-mode. */ if (GET_GLOBAL(CBmode) =3D=3D 0x3) { stdvga_list_modes(seg, dest, last); + } else { + /* Advertise additional SVGA modes for Microsoft NTLDR graphical m= ode. + * Microsoft NTLDR: + * + Graphical mode uses a maximum resolution of 1600x1200. + * + Expects to find VESA mode with 800x600 or 1024x768. + * + 24 Bpp and 32 Bpp are supported + */ + for (i =3D 0; i < ARRAY_SIZE(cbvesa_modes) && dest < last; i++) { + struct cbvga_mode_s *cbmode_g =3D &cbvesa_modes[i]; + u16 mode =3D GET_GLOBAL(cbmode_g->mode); + if (mode =3D=3D 0xffff) + continue; + SET_FARVAR(seg, *dest, mode); + dest++; + } + if (dest < last) { + SET_FARVAR(seg, *dest, GET_GLOBAL(CBmode)); + dest++; + } + SET_FARVAR(seg, *dest, 0xffff); } } =20 @@ -154,6 +248,7 @@ struct cb_framebuffer { int cbvga_setup(void) { + int i; dprintf(1, "coreboot vga init\n"); =20 if (GET_GLOBAL(HaveRunInit)) @@ -208,5 +303,16 @@ cbvga_setup(void) memcpy_far(get_global_seg(), &CBemulinfo , get_global_seg(), &CBmodeinfo, sizeof(CBemulinfo)); =20 + // Validate modes + for (i =3D 0; i < ARRAY_SIZE(cbvesa_modes); i++) { + struct cbvga_mode_s *cbmode_g =3D &cbvesa_modes[i]; + /* Skip VBE modes that doesn't fit into coreboot's framebuffer */ + if ((GET_GLOBAL(cbmode_g->info.height) > ylines) + || (GET_GLOBAL(cbmode_g->info.width) > xlines) + || (GET_GLOBAL(cbmode_g->info.depth) !=3D bpp)) { + dprintf(3, "Removing mode %x\n", GET_GLOBAL(cbmode_g->mode)); + SET_VGA(cbmode_g->mode, 0xffff); + } + } return 0; } --=20 2.9.3 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios