From nobody Sun May 5 06:58:33 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1527748507689329.4672313092817; Wed, 30 May 2018 23:35:07 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coreboot.org) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1fOHE3-0001p9-4R; Thu, 31 May 2018 08:38:19 +0200 Received: from mx3-rdu2.redhat.com ([66.187.233.73] helo=mx1.redhat.com) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1fOHDd-0001ks-J8 for seabios@seabios.org; Thu, 31 May 2018 08:38:17 +0200 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4489B818BAED for ; Thu, 31 May 2018 06:34:09 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-13.ams2.redhat.com [10.36.117.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0493710EE6DF; Thu, 31 May 2018 06:34:06 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 34EA5422B8; Thu, 31 May 2018 08:34:06 +0200 (CEST) From: Gerd Hoffmann To: seabios@seabios.org Date: Thu, 31 May 2018 08:33:48 +0200 Message-Id: <20180531063353.21777-2-kraxel@redhat.com> In-Reply-To: <20180531063353.21777-1-kraxel@redhat.com> References: <20180531063353.21777-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 31 May 2018 06:34:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 31 May 2018 06:34:09 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-Spam-Score: -6.2 (------) Subject: [SeaBIOS] [PATCH 1/6] pci, optionrom: enable non-vga display devices 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: , Cc: Gerd Hoffmann 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" In case no VGA device was found look for other display devices, in both pci initialization and in vgabios rom scan. Signed-off-by: Gerd Hoffmann --- src/fw/pciinit.c | 15 +++++++++++---- src/optionroms.c | 29 ++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c index 3a2f747984..e9518741b5 100644 --- a/src/fw/pciinit.c +++ b/src/fw/pciinit.c @@ -431,6 +431,7 @@ static void pci_bios_init_devices(void) static void pci_enable_default_vga(void) { struct pci_device *pci; + int is_vga =3D 1; =20 foreachpci(pci) { if (is_pci_vga(pci)) { @@ -441,16 +442,22 @@ static void pci_enable_default_vga(void) =20 pci =3D pci_find_class(PCI_CLASS_DISPLAY_VGA); if (!pci) { - dprintf(1, "PCI: No VGA devices found\n"); - return; + dprintf(1, "PCI: No VGA devices found, trying other display device= s\n"); + pci =3D pci_find_class(PCI_CLASS_DISPLAY_OTHER); + if (!pci) { + dprintf(1, "PCI: No other display devices found\n"); + return; + } + is_vga =3D 0; } =20 - dprintf(1, "PCI: Enabling %pP for primary VGA\n", pci); + dprintf(1, "PCI: Enabling %pP for primary %s\n", pci + , is_vga ? "VGA" : "display"); =20 pci_config_maskw(pci->bdf, PCI_COMMAND, 0, PCI_COMMAND_IO | PCI_COMMAND_MEMORY); =20 - while (pci->parent) { + while (is_vga && pci->parent) { pci =3D pci->parent; =20 dprintf(1, "PCI: Setting VGA enable on bridge %pP\n", pci); diff --git a/src/optionroms.c b/src/optionroms.c index 092393a56c..7febd7fcf8 100644 --- a/src/optionroms.c +++ b/src/optionroms.c @@ -224,6 +224,17 @@ is_pci_vga(struct pci_device *pci) return 1; } =20 +int +is_pci_display_other(struct pci_device *pci) +{ + if (pci->class !=3D PCI_CLASS_DISPLAY_OTHER) + return 0; + u16 cmd =3D pci_config_readw(pci->bdf, PCI_COMMAND); + if (!(cmd & PCI_COMMAND_IO && cmd & PCI_COMMAND_MEMORY)) + return 0; + return 1; +} + // Copy a rom to its permanent location below 1MiB static struct rom_header * copy_rom(struct rom_header *rom) @@ -350,7 +361,9 @@ optionrom_setup(void) // Find and deploy PCI roms. struct pci_device *pci; foreachpci(pci) { - if (pci->class =3D=3D PCI_CLASS_DISPLAY_VGA || pci->have_driver) + if (pci->class =3D=3D PCI_CLASS_DISPLAY_VGA || + pci->class =3D=3D PCI_CLASS_DISPLAY_OTHER || + pci->have_driver) continue; init_pcirom(pci, 0, sources); } @@ -404,6 +417,8 @@ struct rom_header *VgaROM; void vgarom_setup(void) { + int have_vga =3D 0; + if (! CONFIG_OPTIONROMS) return; =20 @@ -425,8 +440,20 @@ vgarom_setup(void) continue; vgahook_setup(pci); init_pcirom(pci, 1, NULL); + have_vga =3D 1; break; } + if (!have_vga) { + // no VGA, try fallback to display + dprintf(1, "no vga, try display\n"); + foreachpci(pci) { + if (!is_pci_display_other(pci)) + continue; + vgahook_setup(pci); + init_pcirom(pci, 1, NULL); + break; + } + } =20 // Find and deploy CBFS vga-style roms not associated with a device. run_file_roms("vgaroms/", 1, NULL); --=20 2.9.3 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios From nobody Sun May 5 06:58:33 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1527748489232689.6086983976467; Wed, 30 May 2018 23:34:49 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coreboot.org) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1fOHDk-0001m7-Ml; Thu, 31 May 2018 08:38:00 +0200 Received: from mx3-rdu2.redhat.com ([66.187.233.73] helo=mx1.redhat.com) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1fOHDb-0001kp-Hc for seabios@seabios.org; Thu, 31 May 2018 08:37:59 +0200 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4DD2480401A8 for ; Thu, 31 May 2018 06:34:07 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-13.ams2.redhat.com [10.36.117.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 024622157F44; Thu, 31 May 2018 06:34:06 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 3774E423E7; Thu, 31 May 2018 08:34:06 +0200 (CEST) From: Gerd Hoffmann To: seabios@seabios.org Date: Thu, 31 May 2018 08:33:49 +0200 Message-Id: <20180531063353.21777-3-kraxel@redhat.com> In-Reply-To: <20180531063353.21777-1-kraxel@redhat.com> References: <20180531063353.21777-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 31 May 2018 06:34:07 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 31 May 2018 06:34:07 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-Spam-Score: -6.2 (------) Subject: [SeaBIOS] [PATCH 2/6] cbvga: factor out cbvga_setup_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: , Cc: Gerd Hoffmann 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" Factor out generic data structure setup code from cbvga_setup(). Signed-off-by: Gerd Hoffmann --- vgasrc/cbvga.c | 57 ++++++++++++++++++++++++++++++++----------------------= --- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c index f85989a232..9ae97d5f51 100644 --- a/vgasrc/cbvga.c +++ b/vgasrc/cbvga.c @@ -232,10 +232,40 @@ struct cb_framebuffer { u8 reserved_mask_size; }; =20 +void +cbvga_setup_modes(u64 addr, u8 bpp, u32 xlines, u32 ylines, u32 linelength) +{ + int i; + + SET_VGA(CBmode, 0x140); + SET_VGA(VBE_framebuffer, addr); + SET_VGA(VBE_total_memory, linelength * ylines); + SET_VGA(CBlinelength, linelength); + SET_VGA(CBmodeinfo.memmodel, MM_DIRECT); + SET_VGA(CBmodeinfo.width, xlines); + SET_VGA(CBmodeinfo.height, ylines); + SET_VGA(CBmodeinfo.depth, bpp); + SET_VGA(CBmodeinfo.cwidth, 8); + SET_VGA(CBmodeinfo.cheight, 16); + memcpy_far(get_global_seg(), &CBemulinfo + , get_global_seg(), &CBmodeinfo, sizeof(CBemulinfo)); + + // 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); + } + } +} + int cbvga_setup(void) { - int i; dprintf(1, "coreboot vga init\n"); =20 if (GET_GLOBAL(HaveRunInit)) @@ -277,29 +307,6 @@ cbvga_setup(void) return -1; } =20 - SET_VGA(CBmode, 0x140); - SET_VGA(VBE_framebuffer, addr); - SET_VGA(VBE_total_memory, linelength * ylines); - SET_VGA(CBlinelength, linelength); - SET_VGA(CBmodeinfo.memmodel, MM_DIRECT); - SET_VGA(CBmodeinfo.width, xlines); - SET_VGA(CBmodeinfo.height, ylines); - SET_VGA(CBmodeinfo.depth, bpp); - SET_VGA(CBmodeinfo.cwidth, 8); - SET_VGA(CBmodeinfo.cheight, 16); - memcpy_far(get_global_seg(), &CBemulinfo - , get_global_seg(), &CBmodeinfo, sizeof(CBemulinfo)); - - // 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); - } - } + cbvga_setup_modes(addr, bpp, xlines, ylines, linelength); return 0; } --=20 2.9.3 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios From nobody Sun May 5 06:58:33 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1527748499935503.87177819466615; Wed, 30 May 2018 23:34:59 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coreboot.org) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1fOHE5-0001pM-0g; Thu, 31 May 2018 08:38:21 +0200 Received: from mx3-rdu2.redhat.com ([66.187.233.73] helo=mx1.redhat.com) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1fOHDe-0001kt-8R for seabios@seabios.org; Thu, 31 May 2018 08:38:18 +0200 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 914D18082559 for ; Thu, 31 May 2018 06:34:09 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-13.ams2.redhat.com [10.36.117.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 04DDE10EE6E0; Thu, 31 May 2018 06:34:06 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 3B8CF4F278; Thu, 31 May 2018 08:34:06 +0200 (CEST) From: Gerd Hoffmann To: seabios@seabios.org Date: Thu, 31 May 2018 08:33:50 +0200 Message-Id: <20180531063353.21777-4-kraxel@redhat.com> In-Reply-To: <20180531063353.21777-1-kraxel@redhat.com> References: <20180531063353.21777-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 31 May 2018 06:34:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 31 May 2018 06:34:09 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-Spam-Score: -6.5 (------) Subject: [SeaBIOS] [PATCH 3/6] qemu: add bochs-display support 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: , Cc: Gerd Hoffmann 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" Use coreboot text mode emulation to also support the qemu bochs-display device. This is a new display device supporting simple linear framebuffers, using the bochs register interface. No support for legacy vga (text modes, planar modes, cga modes, 8bpp palette modes all dropped). The bochs interface is compatible with the qemu stdvga. Signed-off-by: Gerd Hoffmann --- vgasrc/vgahw.h | 28 +++++++++++++++------------- vgasrc/vgautil.h | 1 + vgasrc/cbvga.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ vgasrc/Kconfig | 17 +++++++++++++++++ 4 files changed, 90 insertions(+), 13 deletions(-) diff --git a/vgasrc/vgahw.h b/vgasrc/vgahw.h index 2a85eba8d7..6d6ff1aa7b 100644 --- a/vgasrc/vgahw.h +++ b/vgasrc/vgahw.h @@ -14,7 +14,7 @@ static inline struct vgamode_s *vgahw_find_mode(int mode)= { return clext_find_mode(mode); if (CONFIG_VGA_BOCHS) return bochsvga_find_mode(mode); - if (CONFIG_VGA_COREBOOT) + if (CONFIG_VGA_COREBOOT || CONFIG_DISPLAY_BOCHS) return cbvga_find_mode(mode); return stdvga_find_mode(mode); } @@ -24,7 +24,7 @@ static inline int vgahw_set_mode(struct vgamode_s *vmode_= g, int flags) { return clext_set_mode(vmode_g, flags); if (CONFIG_VGA_BOCHS) return bochsvga_set_mode(vmode_g, flags); - if (CONFIG_VGA_COREBOOT) + if (CONFIG_VGA_COREBOOT || CONFIG_DISPLAY_BOCHS) return cbvga_set_mode(vmode_g, flags); return stdvga_set_mode(vmode_g, flags); } @@ -34,7 +34,7 @@ static inline void vgahw_list_modes(u16 seg, u16 *dest, u= 16 *last) { clext_list_modes(seg, dest, last); else if (CONFIG_VGA_BOCHS) bochsvga_list_modes(seg, dest, last); - else if (CONFIG_VGA_COREBOOT) + else if (CONFIG_VGA_COREBOOT || CONFIG_DISPLAY_BOCHS) cbvga_list_modes(seg, dest, last); else stdvga_list_modes(seg, dest, last); @@ -49,6 +49,8 @@ static inline int vgahw_setup(void) { return geodevga_setup(); if (CONFIG_VGA_COREBOOT) return cbvga_setup(); + if (CONFIG_DISPLAY_BOCHS) + return bochs_display_setup(); return stdvga_setup(); } =20 @@ -57,7 +59,7 @@ static inline int vgahw_get_window(struct vgamode_s *vmod= e_g, int window) { return clext_get_window(vmode_g, window); if (CONFIG_VGA_BOCHS) return bochsvga_get_window(vmode_g, window); - if (CONFIG_VGA_COREBOOT) + if (CONFIG_VGA_COREBOOT || CONFIG_DISPLAY_BOCHS) return cbvga_get_window(vmode_g, window); return stdvga_get_window(vmode_g, window); } @@ -68,7 +70,7 @@ static inline int vgahw_set_window(struct vgamode_s *vmod= e_g, int window return clext_set_window(vmode_g, window, val); if (CONFIG_VGA_BOCHS) return bochsvga_set_window(vmode_g, window, val); - if (CONFIG_VGA_COREBOOT) + if (CONFIG_VGA_COREBOOT || CONFIG_DISPLAY_BOCHS) return cbvga_set_window(vmode_g, window, val); return stdvga_set_window(vmode_g, window, val); } @@ -78,7 +80,7 @@ static inline int vgahw_get_linelength(struct vgamode_s *= vmode_g) { return clext_get_linelength(vmode_g); if (CONFIG_VGA_BOCHS) return bochsvga_get_linelength(vmode_g); - if (CONFIG_VGA_COREBOOT) + if (CONFIG_VGA_COREBOOT || CONFIG_DISPLAY_BOCHS) return cbvga_get_linelength(vmode_g); return stdvga_get_linelength(vmode_g); } @@ -88,7 +90,7 @@ static inline int vgahw_set_linelength(struct vgamode_s *= vmode_g, int val) { return clext_set_linelength(vmode_g, val); if (CONFIG_VGA_BOCHS) return bochsvga_set_linelength(vmode_g, val); - if (CONFIG_VGA_COREBOOT) + if (CONFIG_VGA_COREBOOT || CONFIG_DISPLAY_BOCHS) return cbvga_set_linelength(vmode_g, val); return stdvga_set_linelength(vmode_g, val); } @@ -98,7 +100,7 @@ static inline int vgahw_get_displaystart(struct vgamode_= s *vmode_g) { return clext_get_displaystart(vmode_g); if (CONFIG_VGA_BOCHS) return bochsvga_get_displaystart(vmode_g); - if (CONFIG_VGA_COREBOOT) + if (CONFIG_VGA_COREBOOT || CONFIG_DISPLAY_BOCHS) return cbvga_get_displaystart(vmode_g); return stdvga_get_displaystart(vmode_g); } @@ -108,7 +110,7 @@ static inline int vgahw_set_displaystart(struct vgamode= _s *vmode_g, int val) { return clext_set_displaystart(vmode_g, val); if (CONFIG_VGA_BOCHS) return bochsvga_set_displaystart(vmode_g, val); - if (CONFIG_VGA_COREBOOT) + if (CONFIG_VGA_COREBOOT || CONFIG_DISPLAY_BOCHS) return cbvga_set_displaystart(vmode_g, val); return stdvga_set_displaystart(vmode_g, val); } @@ -116,7 +118,7 @@ static inline int vgahw_set_displaystart(struct vgamode= _s *vmode_g, int val) { static inline int vgahw_get_dacformat(struct vgamode_s *vmode_g) { if (CONFIG_VGA_BOCHS) return bochsvga_get_dacformat(vmode_g); - if (CONFIG_VGA_COREBOOT) + if (CONFIG_VGA_COREBOOT || CONFIG_DISPLAY_BOCHS) return cbvga_get_dacformat(vmode_g); return stdvga_get_dacformat(vmode_g); } @@ -124,7 +126,7 @@ static inline int vgahw_get_dacformat(struct vgamode_s = *vmode_g) { static inline int vgahw_set_dacformat(struct vgamode_s *vmode_g, int val) { if (CONFIG_VGA_BOCHS) return bochsvga_set_dacformat(vmode_g, val); - if (CONFIG_VGA_COREBOOT) + if (CONFIG_VGA_COREBOOT || CONFIG_DISPLAY_BOCHS) return cbvga_set_dacformat(vmode_g, val); return stdvga_set_dacformat(vmode_g, val); } @@ -134,13 +136,13 @@ static inline int vgahw_save_restore(int cmd, u16 seg= , void *data) { return clext_save_restore(cmd, seg, data); if (CONFIG_VGA_BOCHS) return bochsvga_save_restore(cmd, seg, data); - if (CONFIG_VGA_COREBOOT) + if (CONFIG_VGA_COREBOOT || CONFIG_DISPLAY_BOCHS) return cbvga_save_restore(cmd, seg, data); return stdvga_save_restore(cmd, seg, data); } =20 static inline int vgahw_get_linesize(struct vgamode_s *vmode_g) { - if (CONFIG_VGA_COREBOOT) + if (CONFIG_VGA_COREBOOT || CONFIG_DISPLAY_BOCHS) return cbvga_get_linesize(vmode_g); return stdvga_get_linesize(vmode_g); } diff --git a/vgasrc/vgautil.h b/vgasrc/vgautil.h index fae5fbaeef..563f2fc11f 100644 --- a/vgasrc/vgautil.h +++ b/vgasrc/vgautil.h @@ -19,6 +19,7 @@ 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); +int bochs_display_setup(void); =20 // clext.c struct vgamode_s *clext_find_mode(int mode); diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c index 9ae97d5f51..672daa604c 100644 --- a/vgasrc/cbvga.c +++ b/vgasrc/cbvga.c @@ -8,6 +8,9 @@ #include "biosvar.h" // GET_BDA #include "output.h" // dprintf #include "stdvga.h" // SEG_CTEXT +#include "bochsvga.h" // VBE_BOCHS_* +#include "hw/pci.h" // pci_config_readl +#include "hw/pci_regs.h" // PCI_BASE_ADDRESS_0 #include "string.h" // memset16_far #include "util.h" // find_cb_table #include "vgabios.h" // SET_VGA @@ -310,3 +313,57 @@ cbvga_setup(void) cbvga_setup_modes(addr, bpp, xlines, ylines, linelength); return 0; } + +/* ------------------------------------------------------------------ */ + +#define FRAMEBUFFER_WIDTH 1024 +#define FRAMEBUFFER_HEIGHT 768 +#define FRAMEBUFFER_BPP 4 +#define FRAMEBUFFER_STRIDE (FRAMEBUFFER_BPP * FRAMEBUFFER_WIDTH) +#define FRAMEBUFFER_SIZE (FRAMEBUFFER_STRIDE * FRAMEBUFFER_HEIGHT) + +int +bochs_display_setup(void) +{ + dprintf(1, "bochs-display: setup called\n"); + + if (GET_GLOBAL(HaveRunInit)) + return 0; + + int bdf =3D GET_GLOBAL(VgaBDF); + if (bdf =3D=3D 0) + return 0; + + u32 bar =3D pci_config_readl(bdf, PCI_BASE_ADDRESS_0); + u32 lfb_addr =3D bar & PCI_BASE_ADDRESS_MEM_MASK; + bar =3D pci_config_readl(bdf, PCI_BASE_ADDRESS_2); + u32 io_addr =3D bar & PCI_BASE_ADDRESS_IO_MASK; + dprintf(1, "bochs-display: bdf %02x:%02x.%x, bar 0 at 0x%x, bar 1 at 0= x%x\n" + , pci_bdf_to_bus(bdf) , pci_bdf_to_dev(bdf), pci_bdf_to_fn(bdf= ), + lfb_addr, io_addr); + + u16 *dispi =3D (void*)(io_addr + 0x500); + u8 *vga =3D (void*)(io_addr + 0x400); + u16 id =3D readw(dispi + VBE_DISPI_INDEX_ID); + dprintf(1, "bochs-display: id is 0x%x, %s\n", id + , id =3D=3D VBE_DISPI_ID5 ? "good" : "FAIL"); + if (id !=3D VBE_DISPI_ID5) + return 0; + + dprintf(1, "bochs-display: using %dx%d, %d bpp (%d stride)\n" + , FRAMEBUFFER_WIDTH, FRAMEBUFFER_HEIGHT + , FRAMEBUFFER_BPP * 8, FRAMEBUFFER_STRIDE); + + cbvga_setup_modes(lfb_addr, FRAMEBUFFER_BPP * 8, + FRAMEBUFFER_WIDTH, FRAMEBUFFER_HEIGHT, + FRAMEBUFFER_STRIDE); + + writew(dispi + VBE_DISPI_INDEX_XRES, FRAMEBUFFER_WIDTH); + writew(dispi + VBE_DISPI_INDEX_YRES, FRAMEBUFFER_HEIGHT); + writew(dispi + VBE_DISPI_INDEX_BPP, FRAMEBUFFER_BPP * 8); + writew(dispi + VBE_DISPI_INDEX_ENABLE, VBE_DISPI_ENABLED); + + writeb(vga, 0x20); /* unblank (for qemu -device VGA) */ + + return 0; +} diff --git a/vgasrc/Kconfig b/vgasrc/Kconfig index f5098a4bdd..4443c0b37a 100644 --- a/vgasrc/Kconfig +++ b/vgasrc/Kconfig @@ -55,6 +55,21 @@ menu "VGA ROM" Build support for a vgabios wrapper around video devices initialized using coreboot native vga init. =20 + config DISPLAY_BOCHS + depends on QEMU + bool "qemu bochs-display support" + select VGA_EMULATE_TEXT + help + Build support for the qemu bochs-display device, which + is basically qemu stdvga without the legacy vga + emulation, supporting only 16+32 bpp VESA video modes + in a linear framebuffer. So this uses cbvga text mode + emulation. + + The bochs-display device is available in qemu + v3.0+. The vgabios works with the qemu stdvga too (use + "qemu -device VGA,romfile=3D/path/to/vgabios.bin")". + endchoice =20 choice @@ -166,6 +181,7 @@ menu "VGA ROM" default 0x1af4 if VGA_BOCHS_VIRTIO default 0x100b if VGA_GEODEGX2 default 0x1022 if VGA_GEODELX + default 0x1234 if DISPLAY_BOCHS default 0x0000 help Vendor ID for the PCI ROM @@ -181,6 +197,7 @@ menu "VGA ROM" default 0x1050 if VGA_BOCHS_VIRTIO default 0x0030 if VGA_GEODEGX2 default 0x2081 if VGA_GEODELX + default 0x1111 if DISPLAY_BOCHS default 0x0000 help Device ID for the PCI ROM --=20 2.9.3 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios From nobody Sun May 5 06:58:33 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1527748492905671.1202362857761; Wed, 30 May 2018 23:34:52 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coreboot.org) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1fOHDr-0001my-DT; Thu, 31 May 2018 08:38:07 +0200 Received: from mx3-rdu2.redhat.com ([66.187.233.73] helo=mx1.redhat.com) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1fOHDb-0001kq-S0 for seabios@seabios.org; Thu, 31 May 2018 08:38:06 +0200 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5339D722FC for ; Thu, 31 May 2018 06:34:07 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-13.ams2.redhat.com [10.36.117.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 05781210C6CE; Thu, 31 May 2018 06:34:07 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 3D4004F284; Thu, 31 May 2018 08:34:06 +0200 (CEST) From: Gerd Hoffmann To: seabios@seabios.org Date: Thu, 31 May 2018 08:33:51 +0200 Message-Id: <20180531063353.21777-5-kraxel@redhat.com> In-Reply-To: <20180531063353.21777-1-kraxel@redhat.com> References: <20180531063353.21777-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 31 May 2018 06:34:07 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 31 May 2018 06:34:07 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-Spam-Score: -6.5 (------) Subject: [SeaBIOS] [PATCH 4/6] cbvga_setup_modes: use real mode number instead of 0x140 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: , Cc: Gerd Hoffmann 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" In case the framebuffer size matches one of the cbvga video modes just use that mode number instead of 0x140. Signed-off-by: Gerd Hoffmann --- vgasrc/cbvga.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c index 672daa604c..2139a00904 100644 --- a/vgasrc/cbvga.c +++ b/vgasrc/cbvga.c @@ -263,6 +263,11 @@ cbvga_setup_modes(u64 addr, u8 bpp, u32 xlines, u32 yl= ines, u32 linelength) dprintf(3, "Removing mode %x\n", GET_GLOBAL(cbmode_g->mode)); SET_VGA(cbmode_g->mode, 0xffff); } + if ((GET_GLOBAL(cbmode_g->info.height) =3D=3D ylines) + && (GET_GLOBAL(cbmode_g->info.width) =3D=3D xlines) + && (GET_GLOBAL(cbmode_g->info.depth) =3D=3D bpp)) { + SET_VGA(CBmode, GET_GLOBAL(cbmode_g->mode)); + } } } =20 --=20 2.9.3 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios From nobody Sun May 5 06:58:33 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1527748497892515.8273292732222; Wed, 30 May 2018 23:34:57 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coreboot.org) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1fOHE6-0001pl-2w; Thu, 31 May 2018 08:38:22 +0200 Received: from mx3-rdu2.redhat.com ([66.187.233.73] helo=mx1.redhat.com) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1fOHDh-0001kr-HM for seabios@seabios.org; Thu, 31 May 2018 08:38:18 +0200 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 164EFBB428 for ; Thu, 31 May 2018 06:34:08 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-13.ams2.redhat.com [10.36.117.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB8832023450; Thu, 31 May 2018 06:34:07 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 40CCB50DE5; Thu, 31 May 2018 08:34:06 +0200 (CEST) From: Gerd Hoffmann To: seabios@seabios.org Date: Thu, 31 May 2018 08:33:52 +0200 Message-Id: <20180531063353.21777-6-kraxel@redhat.com> In-Reply-To: <20180531063353.21777-1-kraxel@redhat.com> References: <20180531063353.21777-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 31 May 2018 06:34:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 31 May 2018 06:34:08 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-Spam-Score: -6.5 (------) Subject: [SeaBIOS] [PATCH 5/6] cbvga_list_modes: don't list current mode twice 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: , Cc: Gerd Hoffmann 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" In case we've already added the framebuffer video mode to the list do not add number 0x140. Signed-off-by: Gerd Hoffmann --- vgasrc/cbvga.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c index 2139a00904..13a666b22b 100644 --- a/vgasrc/cbvga.c +++ b/vgasrc/cbvga.c @@ -107,6 +107,8 @@ struct vgamode_s *cbvga_find_mode(int mode) void cbvga_list_modes(u16 seg, u16 *dest, u16 *last) { + int seen =3D 0; + if (GET_GLOBAL(CBmode) !=3D 0x3) { /* Advertise additional SVGA modes for Microsoft NTLDR graphical m= ode. * Microsoft NTLDR: @@ -122,9 +124,11 @@ cbvga_list_modes(u16 seg, u16 *dest, u16 *last) continue; SET_FARVAR(seg, *dest, mode); dest++; + if (GET_GLOBAL(CBmode) =3D=3D mode) + seen =3D 1; } } - if (dest < last) { + if (dest < last && !seen) { SET_FARVAR(seg, *dest, GET_GLOBAL(CBmode)); dest++; } --=20 2.9.3 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios From nobody Sun May 5 06:58:33 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1527748491656339.5532272580182; Wed, 30 May 2018 23:34:51 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coreboot.org) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1fOHDy-0001nC-Fj; Thu, 31 May 2018 08:38:14 +0200 Received: from mx3-rdu2.redhat.com ([66.187.233.73] helo=mx1.redhat.com) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1fOHDe-0001kx-EZ for seabios@seabios.org; Thu, 31 May 2018 08:38:06 +0200 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0DA764022414 for ; Thu, 31 May 2018 06:34:10 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-13.ams2.redhat.com [10.36.117.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id C23BD63532; Thu, 31 May 2018 06:34:07 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 4332E50DE6; Thu, 31 May 2018 08:34:06 +0200 (CEST) From: Gerd Hoffmann To: seabios@seabios.org Date: Thu, 31 May 2018 08:33:53 +0200 Message-Id: <20180531063353.21777-7-kraxel@redhat.com> In-Reply-To: <20180531063353.21777-1-kraxel@redhat.com> References: <20180531063353.21777-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 31 May 2018 06:34:10 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 31 May 2018 06:34:10 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-Spam-Score: -6.5 (------) Subject: [SeaBIOS] [PATCH 6/6] [workaround] cbvga_set_mode: disable clearmem 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: , Cc: Gerd Hoffmann 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" Break windows, memcpy_high call is problematic. Possibly the windows x86 emulator doesn't support int 1587. Signed-off-by: Gerd Hoffmann --- vgasrc/cbvga.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c index 13a666b22b..6933fc72aa 100644 --- a/vgasrc/cbvga.c +++ b/vgasrc/cbvga.c @@ -196,6 +196,7 @@ cbvga_set_mode(struct vgamode_s *vmode_g, int flags) { u8 emul =3D vmode_g =3D=3D &CBemulinfo || GET_GLOBAL(CBmode) =3D=3D 0x= 03; MASK_BDA_EXT(flags, BF_EMULATE_TEXT, emul ? BF_EMULATE_TEXT : 0); +#if 0 if (!(flags & MF_NOCLEARMEM)) { if (GET_GLOBAL(CBmodeinfo.memmodel) =3D=3D MM_TEXT) { memset16_far(SEG_CTEXT, (void*)0, 0x0720, 80*25*2); @@ -209,6 +210,7 @@ cbvga_set_mode(struct vgamode_s *vmode_g, int flags) op.op =3D GO_MEMSET; handle_gfx_op(&op); } +#endif return 0; } =20 --=20 2.9.3 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios