From nobody Sat Apr 20 00:03:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+41936+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41936+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1559732153; cv=none; d=zoho.com; s=zohoarc; b=jNHtHOPCS8+cx/P0c6fTq0RBK6/AW+ceoxGK/SALZUKeRmvzjGAjZ+nJfJUk+LxYFzdhbE7W0weJKu2P+4vPCIQyYYMHJ4VqOuSNzx6tf9muMn4IYcAzJcGCpHhTP4QUIrX7eqkVGzHrwPiVeO8H/yHRx67lyVaQj0RM2NfJAcE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559732153; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=oYma0RQ+hqmBrQHRkW/5fwqliLgZvmDB5Nb656YRmqU=; b=PpnGvOd9h6PDq+LF/k0rdWNdGwafWuZ/2XkU6CM8eopURyxRPrqmpmHOad//8SybFjdOrQ49+sGEIWn/Ue3SzTf1I4c23C6wo/7A+DbQIAfxPQ69vC7m1zqtN3sgVFyo5I7xbswA16aVlHTb+DMrqT+NUGOGJvGlkmKeWXjAugs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41936+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1559732153608275.96322315256384; Wed, 5 Jun 2019 03:55:53 -0700 (PDT) Return-Path: X-Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by groups.io with SMTP; Wed, 05 Jun 2019 03:55:52 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jun 2019 03:55:51 -0700 X-ExtLoop1: 1 X-Received: from chenmarc-mobl.gar.corp.intel.com ([10.5.245.106]) by orsmga008.jf.intel.com with ESMTP; 05 Jun 2019 03:55:49 -0700 From: "Marc W Chen" To: devel@edk2.groups.io Cc: Marc Chen , Jordan Justen , Laszlo Ersek , Ard Biesheuvel , Anthony Perard , Julien Grall , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Stefan Berger Subject: [edk2-devel] [PATCH] OvmfPkg/QemuVideoDxe: Shouldn't assume system in VGA alias mode. Date: Wed, 5 Jun 2019 18:55:33 +0800 Message-Id: <20190605105533.65212-1-marc.w.chen@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,marc.w.chen@intel.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1559732152; bh=hz1OEq5sGhliV+8BG1Xdd/T1uGxuJjgPm6uYWm701P0=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=mzcrWW40vjcFpt8Ek2hQkA8M6Ir40k2b6eJbU5vPd1yIr5fl3jwnUK5v6ygMX/2OrkF OgWFbET0a2CWfFJDg1oD1ycMUjFl4rLoH5UtFHvbIX2p9v+hKcI6/wE2oiJlqZb19Tc9e OPDF9zWcoY3CPaU+l1isAuUOv6/yfA2WCl8= X-ZohoMail-DKIM: pass (identity @groups.io) Query the supported attributes firstly, then AND (&&) both VGA_IO and VGA_IO_16. Since the supported attributes should only have VGA_IO or VGA_IO_16 set, the result of AND (&&) is either VGA_IO or IO_16. Then the result can be passed to PciIo->Attributes() to set the attributes. Signed-off-by: Marc Chen Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Anthony Perard Cc: Julien Grall Cc: Marc-Andr=C3=A9 Lureau Cc: Stefan Berger --- OvmfPkg/QemuVideoDxe/Driver.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/QemuVideoDxe/Driver.c b/OvmfPkg/QemuVideoDxe/Driver.c index e8a613ef33..ba9210f24b 100644 --- a/OvmfPkg/QemuVideoDxe/Driver.c +++ b/OvmfPkg/QemuVideoDxe/Driver.c @@ -201,6 +201,7 @@ QemuVideoControllerDriverStart ( PCI_TYPE00 Pci; QEMU_VIDEO_CARD *Card; EFI_PCI_IO_PROTOCOL *ChildPciIo; + UINT64 Supports; =20 OldTpl =3D gBS->RaiseTPL (TPL_CALLBACK); =20 @@ -277,13 +278,32 @@ QemuVideoControllerDriverStart ( goto ClosePciIo; } =20 + // + // Get supported PCI attributes + // + Status =3D Private->PciIo->Attributes ( + Private->PciIo, + EfiPciIoAttributeOperationSupported, + 0, + &Supports + ); + if (EFI_ERROR (Status)) { + goto ClosePciIo; + } + + Supports &=3D (UINT64)(EFI_PCI_IO_ATTRIBUTE_VGA_IO | EFI_PCI_IO_ATTRIBUT= E_VGA_IO_16); + if ((Supports =3D=3D 0) || (Supports =3D=3D (EFI_PCI_IO_ATTRIBUTE_VGA_IO= | EFI_PCI_IO_ATTRIBUTE_VGA_IO_16))) { + Status =3D EFI_UNSUPPORTED; + goto ClosePciIo; + } + // // Set new PCI attributes // Status =3D Private->PciIo->Attributes ( Private->PciIo, EfiPciIoAttributeOperationEnable, - EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_V= GA_MEMORY | EFI_PCI_IO_ATTRIBUTE_VGA_IO, + EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_V= GA_MEMORY | Supports, NULL ); if (EFI_ERROR (Status)) { --=20 2.16.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#41936): https://edk2.groups.io/g/devel/message/41936 Mute This Topic: https://groups.io/mt/31935803/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-