From nobody Sat May 18 14:10:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109735+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109735+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1697630147; cv=none; d=zohomail.com; s=zohoarc; b=EWioBeLhOT4fXzLsq1nQV9QzuX8s1r5bv2LwuWMnDK+0jmfpIBVNLmCf/YkcbHdDx4YratvOSJg/QqAqLkpht1md3h4YBUDG49fpTj/NSaYpUIYFEl6l/mGsaZ9RSEbeJj0/hq422arfn7zGxFKcqX4mQ2LckAO4KvsR0kiIj2g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697630147; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=/QNnNo8oE8UBbvsgIAxApFcSCYKL7wWHXZQGa/I3eDc=; b=fxbVHqawS+OPc24gAR9ltI+kHuG2NGl5gIzkizF+FBwKO9/38wWmy/6hjVRZH5zf0Z1e42WLLMqt1ogdY0Nuv1dMpTAstaoO5eyRxdv5BgWCQo+kYAolX/7ECyIuQVhzRyX/Et/n4YP4Ucqf8a+8PWO56ldZHgfRfZMPQLJZRDQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109735+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697630147148289.42884160398285; Wed, 18 Oct 2023 04:55:47 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=YZfJasbTjxz4f2SWCidWrnRPn+kv/VHbwTnm5tjsiKc=; c=relaxed/simple; d=groups.io; h=From:Date:Subject:MIME-Version:Message-Id:References:In-Reply-To:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20140610; t=1697630146; v=1; b=irrBLIzjqK7coJreW6vJZwnAgCUHwts5UKUGU5tgNNq3O/Y7luTO9ac7wRr5fQ4/ZdFTONfc fU+z5lKChc7rodHkd7lyQCQpS7DWoKmp8Zgljrqn50KDIPy4WMx6j2eESYKnp+nVf8Of9PJDRgO +J1ewBOH/8UdRuAL3ngqkq/E= X-Received: by 127.0.0.2 with SMTP id aa63YY1788612xuRP89t66HP; Wed, 18 Oct 2023 04:55:46 -0700 X-Received: from muminek.juszkiewicz.com.pl (muminek.juszkiewicz.com.pl [213.251.184.221]) by mx.groups.io with SMTP id smtpd.web11.279385.1697630145855639857 for ; Wed, 18 Oct 2023 04:55:46 -0700 X-Received: from localhost (localhost [127.0.0.1]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTP id 0EE5126110A; Wed, 18 Oct 2023 13:55:42 +0200 (CEST) X-Virus-Scanned: Debian amavis at juszkiewicz.com.pl X-Received: from muminek.juszkiewicz.com.pl ([127.0.0.1]) by localhost (muminek.juszkiewicz.com.pl [127.0.0.1]) (amavis, port 10024) with ESMTP id Z43jUaYRyIZm; Wed, 18 Oct 2023 13:55:41 +0200 (CEST) X-Received: from [172.17.0.1] (83.11.27.172.ipv4.supernova.orange.pl [83.11.27.172]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTPSA id 65620260B8D; Wed, 18 Oct 2023 13:55:40 +0200 (CEST) From: "Marcin Juszkiewicz" Date: Wed, 18 Oct 2023 13:55:38 +0200 Subject: [edk2-devel] [PATCH edk2-platforms v5 1/4] SbsaQemu: introduce macro to compare platform version MIME-Version: 1.0 Message-Id: <20231018-ehci-xhci-fix-v5-1-f42995a3dfd9@linaro.org> References: <20231018-ehci-xhci-fix-v5-0-f42995a3dfd9@linaro.org> In-Reply-To: <20231018-ehci-xhci-fix-v5-0-f42995a3dfd9@linaro.org> To: devel@edk2.groups.io Cc: Leif Lindholm , Ard Biesheuvel , Jeremy Linton , Nhi Pham , Chuong Tran , Rebecca Cran , Marcin Juszkiewicz Precedence: Bulk List-Subscribe: List-Help: 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,marcin.juszkiewicz@linaro.org List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: el13Cg3Lop2d2lzRjWOToeBLx1787277AA= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697630149248100009 We want to check "if platver < 0.3" in an easy way. Signed-off-by: Marcin Juszkiewicz --- .../IndustryStandard/SbsaQemuPlatformVersion.h | 25 ++++++++++++++++= ++++ 1 file changed, 25 insertions(+) diff --git a/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuPlatfor= mVersion.h b/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuPlatfor= mVersion.h new file mode 100644 index 000000000000..dd2483787002 --- /dev/null +++ b/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuPlatformVersio= n.h @@ -0,0 +1,25 @@ +/** @file +* +* Copyright (c) Linaro Limited. All rights reserved. +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef SBSAQEMUPLATFORM_VERSION_H +#define SBSAQEMUPLATFORM_VERSION_H + +/* + * Compare PlatformVersion + * + */ + +#define PLATFORM_VERSION_LESS_THAN(Major, Minor) ( \ + ( \ + ( PcdGet32 (PcdPlatformVersionMajor) < Major) || \ + ( \ + ( PcdGet32 (PcdPlatformVersionMajor) =3D=3D Major) && \ + ( PcdGet32 (PcdPlatformVersionMinor) < Minor) \ + ) \ + ) \ +) +#endif --=20 2.41.0 -=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 (#109735): https://edk2.groups.io/g/devel/message/109735 Mute This Topic: https://groups.io/mt/102037241/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- From nobody Sat May 18 14:10:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109736+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109736+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1697630147; cv=none; d=zohomail.com; s=zohoarc; b=bdb/gWNxwwrubd9tHaDUjz+1jzxqsNNKmj9TELw4DOXt9iviQLC2LVaroed6JrGK96/swPYFoKmh5P6o6My+m/uPKfjbltEg0JIDC2lJMEqvvIpYMOcfHEiUfdX5F9PBA0P0YZbDJ+jEkz2b1yWcQoBx1HbRGPJ9YNlOyaSJwKk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697630147; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=MyB3C+qJWHCUkENYnOk6/1GFhofa+mfJomb9jgB/2o4=; b=mng1OQ17Xj/+enSd+RLFukA2MAR5CKpQxTru4SbLUx1qRVn4cuvecR4int2pvgQiuAUacWoJoDFtUKYq2UMeIysR5A3d/U+LXJPUll9pCExe9hOW2M5S+mMe2wM9CH1+92WLcpH/Qn2FZ3u3GfubejZJGweH8rvBTJq0pguqPpM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109736+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697630147698116.57970769173971; Wed, 18 Oct 2023 04:55:47 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=mCRmvfieEQ46vC+45yQWWZQLD4QM/KFVZBYUPUkxcrk=; c=relaxed/simple; d=groups.io; h=From:Date:Subject:MIME-Version:Message-Id:References:In-Reply-To:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20140610; t=1697630147; v=1; b=KDeuc5FMMmnsZjW/Q5rboHZYnZrZh+7bSuSwFS/Xgfvw8ZwgDeHMMrdwL8Wy64tOqvVVw2xZ kR3VwnJzyKH69eRKBHDdWBNQ0MqRDBYTc2laZ1/K4UZdvJTVRFZxwD9mIyMbtIXqNyGOKwGUV3Y xZ3wd/6V6YU50BPwKgO72XCI= X-Received: by 127.0.0.2 with SMTP id XvFiYY1788612xJfax4hKxjG; Wed, 18 Oct 2023 04:55:47 -0700 X-Received: from muminek.juszkiewicz.com.pl (muminek.juszkiewicz.com.pl [213.251.184.221]) by mx.groups.io with SMTP id smtpd.web11.279386.1697630146242623896 for ; Wed, 18 Oct 2023 04:55:46 -0700 X-Received: from localhost (localhost [127.0.0.1]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTP id 5082E260B8D; Wed, 18 Oct 2023 13:55:44 +0200 (CEST) X-Virus-Scanned: Debian amavis at juszkiewicz.com.pl X-Received: from muminek.juszkiewicz.com.pl ([127.0.0.1]) by localhost (muminek.juszkiewicz.com.pl [127.0.0.1]) (amavis, port 10024) with ESMTP id qMjoWjrFIZWZ; Wed, 18 Oct 2023 13:55:42 +0200 (CEST) X-Received: from [172.17.0.1] (83.11.27.172.ipv4.supernova.orange.pl [83.11.27.172]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTPSA id 43CEA260BB4; Wed, 18 Oct 2023 13:55:41 +0200 (CEST) From: "Marcin Juszkiewicz" Date: Wed, 18 Oct 2023 13:55:39 +0200 Subject: [edk2-devel] [PATCH edk2-platforms v5 2/4] SbsaQemu: add AcpiLib MIME-Version: 1.0 Message-Id: <20231018-ehci-xhci-fix-v5-2-f42995a3dfd9@linaro.org> References: <20231018-ehci-xhci-fix-v5-0-f42995a3dfd9@linaro.org> In-Reply-To: <20231018-ehci-xhci-fix-v5-0-f42995a3dfd9@linaro.org> To: devel@edk2.groups.io Cc: Leif Lindholm , Ard Biesheuvel , Jeremy Linton , Nhi Pham , Chuong Tran , Rebecca Cran , Marcin Juszkiewicz Precedence: Bulk List-Subscribe: List-Help: 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,marcin.juszkiewicz@linaro.org List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: xgGWeUeQLDsMnDPXJJxSWaDex1787277AA= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697630149248100010 It will be needed for playing with disabling XHCI later. Signed-off-by: Marcin Juszkiewicz --- Platform/Qemu/SbsaQemu/SbsaQemu.dsc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc b/Platform/Qemu/SbsaQemu/S= bsaQemu.dsc index 36723e21d7b5..1e650350cb63 100644 --- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc +++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc @@ -172,6 +172,8 @@ [LibraryClasses.common] =20 ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseRepor= tStatusCodeLibNull.inf =20 + AcpiLib|EmbeddedPkg/Library/AcpiLib/AcpiLib.inf + ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf =20 --=20 2.41.0 -=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 (#109736): https://edk2.groups.io/g/devel/message/109736 Mute This Topic: https://groups.io/mt/102037242/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- From nobody Sat May 18 14:10:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109738+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109738+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1697630148; cv=none; d=zohomail.com; s=zohoarc; b=ec/tjx+3j0Hmy3+td/G+2TlOFI5E48lLjRaBPsBiTBJNDtZ1V+2hds8IOISImzU419NA/tjfc1NKL2cz48AkVEQyvYP8l0RCo/Er6vlv6hJbWWmE0P2Cj8vCNoSTOc1MPddJ7cJPV2dC1efK0AtSITLaPGvk+Cf2Cv5+dyNiSmY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697630148; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=YqT0GzFq2OZMC1axMzlAi45KGCSrky5hPJVdPdXuMuc=; b=hcfNNVKMpgRgfHOzwF8I2TYBEaBPnAEsIU2ITNSpuT1CtFB/HMACykOOH5f7KpZDFeJBH4kQe1267+0XTsnliXEYJerdEqTPLK2e8scKtje7OnHVfcxXNrVHaL0OMf8BRHDZRFslt/xEksVOm5X5WZifbPXhGVoZ0EbD2yBl3Uo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109738+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697630148560715.1018869660543; Wed, 18 Oct 2023 04:55:48 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=6KI6OtNQAwjneIC10PP5KAXG1hdNsW0szwXHB664ff4=; c=relaxed/simple; d=groups.io; h=From:Date:Subject:MIME-Version:Message-Id:References:In-Reply-To:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20140610; t=1697630148; v=1; b=vHrcAPz2+7Ozo9y6aFagPiJNJB2UAYokqQjkvZ3rCOgwaXQ5+IvW+VMs52KirHaR+ysUN8Gy jBfgZFkblT3ioO9qeLIzONp2nNEqmnsz6Xy9NdHIMUWu2VxylnkKgle66LoxVtDevQpeTHWBCTO +W/LkfPowvkuIhcvYfZDc8Dc= X-Received: by 127.0.0.2 with SMTP id gtr7YY1788612xtAlxtrdkrT; Wed, 18 Oct 2023 04:55:48 -0700 X-Received: from muminek.juszkiewicz.com.pl (muminek.juszkiewicz.com.pl [213.251.184.221]) by mx.groups.io with SMTP id smtpd.web11.279388.1697630147078100038 for ; Wed, 18 Oct 2023 04:55:47 -0700 X-Received: from localhost (localhost [127.0.0.1]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTP id EAAD8260BB4; Wed, 18 Oct 2023 13:55:44 +0200 (CEST) X-Virus-Scanned: Debian amavis at juszkiewicz.com.pl X-Received: from muminek.juszkiewicz.com.pl ([127.0.0.1]) by localhost (muminek.juszkiewicz.com.pl [127.0.0.1]) (amavis, port 10024) with ESMTP id YC7gLA5r-zBQ; Wed, 18 Oct 2023 13:55:43 +0200 (CEST) X-Received: from [172.17.0.1] (83.11.27.172.ipv4.supernova.orange.pl [83.11.27.172]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTPSA id 3203B260CC8; Wed, 18 Oct 2023 13:55:42 +0200 (CEST) From: "Marcin Juszkiewicz" Date: Wed, 18 Oct 2023 13:55:40 +0200 Subject: [edk2-devel] [PATCH edk2-platforms v5 3/4] SbsaQemu: initialize XHCI only if it exists MIME-Version: 1.0 Message-Id: <20231018-ehci-xhci-fix-v5-3-f42995a3dfd9@linaro.org> References: <20231018-ehci-xhci-fix-v5-0-f42995a3dfd9@linaro.org> In-Reply-To: <20231018-ehci-xhci-fix-v5-0-f42995a3dfd9@linaro.org> To: devel@edk2.groups.io Cc: Leif Lindholm , Ard Biesheuvel , Jeremy Linton , Nhi Pham , Chuong Tran , Rebecca Cran , Marcin Juszkiewicz Precedence: Bulk List-Subscribe: List-Help: 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,marcin.juszkiewicz@linaro.org List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: Bqj0mMUWmiGnWb69sGZ93wSix1787277AA= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697630149263100012 We need platform version to be at least 0.3 to have XHCI in virtual hardware. On older platforms there is non-working EHCI which we ignore. Signed-off-by: Marcin Juszkiewicz --- .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c | 49 +++++++++++-----= ---- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlat= formDxe.c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatf= ormDxe.c index 36ada4270bbf..4ebbe7c93a19 100644 --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe= .c +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe= .c @@ -15,6 +15,7 @@ #include #include #include +#include =20 #include =20 @@ -57,28 +58,6 @@ InitializeSbsaQemuPlatformDxe ( return Status; } =20 - Base =3D (VOID*)(UINTN)PcdGet64 (PcdPlatformXhciBase); - ASSERT (Base !=3D NULL); - Size =3D (UINTN)PcdGet32 (PcdPlatformXhciSize); - ASSERT (Size !=3D 0); - - DEBUG ((DEBUG_INFO, "%a: Got platform XHCI %llx %u\n", - __FUNCTION__, Base, Size)); - - Status =3D RegisterNonDiscoverableMmioDevice ( - NonDiscoverableDeviceTypeXhci, - NonDiscoverableDeviceDmaTypeCoherent, - NULL, - NULL, - 1, - Base, Size); - - if (EFI_ERROR(Status)) { - DEBUG ((DEBUG_ERROR, "%a: NonDiscoverable: Cannot install XHCI device = @%p (Staus =3D=3D %r)\n", - __FUNCTION__, Base, Status)); - return Status; - } - SmcResult =3D ArmCallSmc0 (SIP_SVC_VERSION, &Arg0, &Arg1, NULL); if (SmcResult =3D=3D SMC_ARCH_CALL_SUCCESS) { Result =3D PcdSet32S (PcdPlatformVersionMajor, Arg0); @@ -118,5 +97,31 @@ InitializeSbsaQemuPlatformDxe ( =20 DEBUG ((DEBUG_INFO, "GICI base: 0x%x\n", Arg0)); =20 + if (!PLATFORM_VERSION_LESS_THAN (0, 3)) { + Base =3D (VOID *)(UINTN)PcdGet64 (PcdPlatformXhciBase); + ASSERT (Base !=3D NULL); + Size =3D (UINTN)PcdGet32 (PcdPlatformXhciSize); + ASSERT (Size !=3D 0); + + DEBUG ((DEBUG_INFO, "%a: Got platform XHCI %llx %u\n", + __FUNCTION__, Base, Size)); + + Status =3D RegisterNonDiscoverableMmioDevice ( + NonDiscoverableDeviceTypeX= hci, + NonDiscoverableDeviceDmaTy= peCoherent, + NULL, + NULL, + 1, + Base, + Size + ); + + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: NonDiscoverable: Cannot install XHCI devic= e @%p (Status =3D=3D %r)\n", + __FUNCTION__, Base, Status)); + return Status; + } + } + return EFI_SUCCESS; } --=20 2.41.0 -=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 (#109738): https://edk2.groups.io/g/devel/message/109738 Mute This Topic: https://groups.io/mt/102037245/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- From nobody Sat May 18 14:10:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109739+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109739+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1697630154; cv=none; d=zohomail.com; s=zohoarc; b=U3Loh+mO9PQjde0sXpVIXwE2qyvjSlB6QT5nFB2WTkp+YXqtQas4Vi40SptGcm7PNrpll3MW3wMYwXWvzd/r0BozRTstVI03XZ2Xk/1Od11XsAc3quFwJ+1Kvx6oHReu8g9ozTG1OPYrVad5/n2l3n/iKAs8JekDSb0aSPsEbyk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697630154; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=OhRWsFPbSaLJUrCvngWboozBc0jmP6wFuCuli8LhwD4=; b=W0hmsODkmQ3Wh2EQAPSyKS6uDJ/TmqVotapKYzq4jfwAko1Pq4U5IvAu+/7/WG25YNJS33rB4nIw8S8K3u7gu1jRKMQ4xjV1Lbz2+7UG7inBZWCpzBZXGCPknlCjMhnImTHgSQsBFWGTmzRM2lC1Zmqdm3nCbg67zw8lSRwVdHo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109739+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697630154854404.11055670827625; Wed, 18 Oct 2023 04:55:54 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=LDxA9dDKmI4Ld+UB3aAzOjax868z+M5TYL08K19kWmw=; c=relaxed/simple; d=groups.io; h=From:Date:Subject:MIME-Version:Message-Id:References:In-Reply-To:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20140610; t=1697630149; v=1; b=b3A32iUpM+OJ+cYnDKFbs3KhRCLgt6nANcqsaH0vpNyhW41tFxZClRcw0ifDqeE2NFswE3uH NixmLHVE7rNqxqU4YHXZTxpesdxQz3uKa7umdrt0Z0/Qa+KL0WdQQ2L043um5D+WV//iOX4dzaV Pl5yY/aDzsXc9wnU8+G9km+k= X-Received: by 127.0.0.2 with SMTP id vmmKYY1788612xzsEqsbizkA; Wed, 18 Oct 2023 04:55:49 -0700 X-Received: from muminek.juszkiewicz.com.pl (muminek.juszkiewicz.com.pl [213.251.184.221]) by mx.groups.io with SMTP id smtpd.web10.279893.1697630148699221403 for ; Wed, 18 Oct 2023 04:55:49 -0700 X-Received: from localhost (localhost [127.0.0.1]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTP id 3E76B260CC8; Wed, 18 Oct 2023 13:55:46 +0200 (CEST) X-Virus-Scanned: Debian amavis at juszkiewicz.com.pl X-Received: from muminek.juszkiewicz.com.pl ([127.0.0.1]) by localhost (muminek.juszkiewicz.com.pl [127.0.0.1]) (amavis, port 10024) with ESMTP id TyM_QYdqxhWW; Wed, 18 Oct 2023 13:55:44 +0200 (CEST) X-Received: from [172.17.0.1] (83.11.27.172.ipv4.supernova.orange.pl [83.11.27.172]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTPSA id 0700B2600DA; Wed, 18 Oct 2023 13:55:42 +0200 (CEST) From: "Marcin Juszkiewicz" Date: Wed, 18 Oct 2023 13:55:41 +0200 Subject: [edk2-devel] [PATCH edk2-platforms v5 4/4] SbsaQemu: disable XHCI in DSDT if not present MIME-Version: 1.0 Message-Id: <20231018-ehci-xhci-fix-v5-4-f42995a3dfd9@linaro.org> References: <20231018-ehci-xhci-fix-v5-0-f42995a3dfd9@linaro.org> In-Reply-To: <20231018-ehci-xhci-fix-v5-0-f42995a3dfd9@linaro.org> To: devel@edk2.groups.io Cc: Leif Lindholm , Ard Biesheuvel , Jeremy Linton , Nhi Pham , Chuong Tran , Rebecca Cran , Marcin Juszkiewicz Precedence: Bulk List-Subscribe: List-Help: 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,marcin.juszkiewicz@linaro.org List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: cjuFI8rr6U7XMBQEzjd0l2K4x1787277AA= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697630155196100001 We need platform version to be at least 0.3 to have XHCI in virtual hardware. On older platforms there is non-working EHCI which we ignore. Set DSDT node to be disabled so operating system will not try to initialize not-existing hardware. Signed-off-by: Marcin Juszkiewicz --- .../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf | 4 ++ .../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c | 68 ++++++++++++++++= +++- Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl | 3 +- 3 files changed, 73 insertions(+), 2 deletions(-) diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.= inf b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf index 7c7e08e0fd3a..291743b19115 100644 --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf @@ -29,6 +29,7 @@ [Packages] Silicon/Qemu/SbsaQemu/SbsaQemu.dec =20 [LibraryClasses] + AcpiLib ArmLib BaseMemoryLib BaseLib @@ -49,6 +50,8 @@ [Pcd] gArmTokenSpaceGuid.PcdGicDistributorBase gArmTokenSpaceGuid.PcdGicRedistributorsBase gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdGicItsBase + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdSmmuBase =20 [Depex] @@ -58,6 +61,7 @@ [Guids] gEdkiiPlatformHasAcpiGuid =20 [Protocols] + gEfiAcpiSdtProtocolGuid gEfiAcpiTableProtocolGuid ## CONSUMES =20 [FixedPcd] diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.= c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c index fd849ca1594b..464119de1457 100644 --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -682,6 +683,71 @@ AddGtdtTable ( return Status; } =20 +/* + * A function to disable XHCI node on Platform Version lower than 0.3 + */ +EFI_STATUS +DisableXhciOnOlderPlatVer ( + VOID + ) +{ + EFI_STATUS Status; + EFI_ACPI_SDT_PROTOCOL *AcpiSdtProtocol; + EFI_ACPI_DESCRIPTION_HEADER *Table; + UINTN TableKey; + UINTN TableIndex; + EFI_ACPI_HANDLE TableHandle; + + Status =3D EFI_SUCCESS; + + if ( PLATFORM_VERSION_LESS_THAN (0, 3)) { + DEBUG ((DEBUG_ERROR, "Platform Version < 0.3 - disabling XHCI\n")); + Status =3D gBS->LocateProtocol ( + &gEfiAcpiSdtProtocolGuid, + NULL, + (VOID **)&AcpiSdtProtocol + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Unable to locate ACPI table protocol\n")); + return Status; + } + + Status =3D AcpiLocateTableBySignature ( + AcpiSdtProtocol, + EFI_ACPI_6_3_DIFFERENTIATED_SYSTE= M_DESCRIPTION_TABLE_SIGNATURE, + &TableIndex, + &Table, + &TableKey + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "ACPI DSDT table not found!\n")); + ASSERT_EFI_ERROR (Status); + return Status; + } + + Status =3D AcpiSdtProtocol->OpenSdt (TableKey, &TableHandle); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + AcpiSdtProtocol->Close (TableHandle); + return Status; + } + + Status =3D AcpiAmlObjectUpdateInteger (AcpiSdtProtocol, TableHandle, "= \\_SB.USB0.XHCI", 0x0); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Failed to disable XHCI!\n")); + ASSERT_EFI_ERROR (Status); + AcpiSdtProtocol->Close (TableHandle); + return Status; + } + + AcpiSdtProtocol->Close (TableHandle); + AcpiUpdateChecksum ((UINT8 *)Table, Table->Length); + } + + return Status; +} + + EFI_STATUS EFIAPI InitializeSbsaQemuAcpiDxe ( @@ -738,5 +804,5 @@ InitializeSbsaQemuAcpiDxe ( DEBUG ((DEBUG_ERROR, "Failed to add GTDT table\n")); } =20 - return EFI_SUCCESS; + return DisableXhciOnOlderPlatVer (); } diff --git a/Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl b/Silicon/Qemu/SbsaQ= emu/AcpiTables/Dsdt.asl index 543b5782580a..ba3eefc975a5 100644 --- a/Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl +++ b/Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl @@ -73,8 +73,9 @@ DefinitionBlock ("DsdtTable.aml", "DSDT", Name (_HID, "PNP0D10") // _HID: Hardware ID Name (_UID, 0x00) // _UID: Unique ID Name (_CCA, 0x01) // _CCA: Cache Coherency Attribute + Name (XHCI, 0xF) // will be set using AcpiLib Method (_STA) { - Return (0xF) + Return (XHCI) } Method (_CRS, 0x0, Serialized) { Name (RBUF, ResourceTemplate() { --=20 2.41.0 -=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 (#109739): https://edk2.groups.io/g/devel/message/109739 Mute This Topic: https://groups.io/mt/102037246/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-