From nobody Sat May 10 11:42:24 2025 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