From nobody Fri Apr 26 06:31:08 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+41938+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+41938+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1559733257; cv=none; d=zoho.com; s=zohoarc; b=SEyLRaH/XpNW1wtXa8qq1iW/Qwccu6IyxMpcHuJzTCc3LDNjX5i/2hnOa/duBgtU2yTxIuKZNDa9lCyQr1qPAN2wG3Z6Fmnx5ZvxHHhzH/TNA8SuTDXsn35v8Ox3wM2PcgpYyn83AMv1mdopTUd1wQo9aNNrNsB9xEIErsOg+zg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559733257; 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=g8BHgmSw3Mpm2mCHTrAETscst9C8c8HKqwWG0yWhgVc=; b=KfzD0Year3rkq+mKcaF9KCG+APj/KXiosk6duqYbv3PdWwh/J1S1aTgFqu8pG5AhASw1ETNa7ibVpHwNiiZde1WBSvoE2/r6xpJ/FmmqH1WxFtl0gnFxY2WlF6klol6MCZsXsn6YwV0lO0w3s6kGuOEE06SN1P6ZOASmsmbdMgU= 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+41938+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 1559733257583255.02201115390585; Wed, 5 Jun 2019 04:14:17 -0700 (PDT) Return-Path: X-Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by groups.io with SMTP; Wed, 05 Jun 2019 04:14:16 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jun 2019 04:14:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,550,1549958400"; d="scan'208";a="181895067" X-Received: from chenmarc-mobl.gar.corp.intel.com ([10.5.245.106]) by fmsmga002.fm.intel.com with ESMTP; 05 Jun 2019 04:14:13 -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 19:14:10 +0800 Message-Id: <20190605111410.73564-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=1559733256; bh=kgZjUazD4b0KTQ64ToAvUDPf6yNlE+ha+NGc/mh5N7Y=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=GsjHa5wCMjOybl0XCiQjcmcOvtlZYFUNVTNh29dK4ozQcOVqOQRN1J9083lqTnTgk6H ERGbiseg45B+HdzxVmVj5f2AXXBmJH6OSKKLWT2rOzbE8CHDEAMobRFRAruWal5htKsYT ayW2Motjf1GUdtB70PuWnKjvkDXVqbH3jPs= 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 Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1880 --- 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 (#41938): https://edk2.groups.io/g/devel/message/41938 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-