From nobody Thu May 16 08:07:13 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+110134+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+110134+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1698341642; cv=none; d=zohomail.com; s=zohoarc; b=knoZ9vBlT/ncwN2vMLyk95pzXPhm2PaSZ2nMdKYbYLy4w2BodHwoln7zd3nlV1sRsM7CzCNziNcIjdWuEY6xxTXEZOsM7JQxPL0INFmelcHcIf0c0EJqRBvZ/lVNdyOgu5pmDyELrbxoM3MRQVZmuPtGUDyeBhY5qLYiHcpbZGk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698341642; 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=F9ydredUDAOyfh0gf/WkACXoCWe3mPlNKCYoYC6ZjTc=; b=TvedN/HR2G/YH1MhYbR8hnwZGhzq0P19Jc8NlHCUYmoSiLs53HTzr9Hyhda4YqEigZ8WhcPBL+xHr5mAvsKFj6nINWgqXlm0HRJqauYHIetEGNknhOKWFDi0mpQgs0TnauPUwxpS3KRGO3i0KVGj0/HcJqrV8rCF2dyT1sA09n8= 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+110134+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 1698341642215653.9998086554443; Thu, 26 Oct 2023 10:34:02 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=k+fQMhKoKosoMCvaM0HY3pvdfrKt2C0/33VrlP5DKBQ=; 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=1698341641; v=1; b=KiTl3pIHtUNPhIYTfeGjGXCGTN6OrpoWqg2dQVoQP/z8sCFZlwuRKVhUBVO54zKHwKrVgvNp Gx/qJ1oFvHQ9bgDDLbvvdg6+rY7B1IcBcJWvv7iWLCaQrOKSOynrSJ/89SLvV341eiUCy5kI+Ck byHenCeZ2JFP8FyrlB0Ij3ls= X-Received: by 127.0.0.2 with SMTP id 8qHoYY1788612xU9rMMojvWz; Thu, 26 Oct 2023 10:34:01 -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.206877.1698341641215793085 for ; Thu, 26 Oct 2023 10:34:01 -0700 X-Received: from localhost (localhost [127.0.0.1]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTP id 6D3E42600A6; Thu, 26 Oct 2023 19:33:58 +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 vEN0a592BSCm; Thu, 26 Oct 2023 19:33:56 +0200 (CEST) X-Received: from [192.168.210.114] (83.11.185.48.ipv4.supernova.orange.pl [83.11.185.48]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTPSA id E493A2608AB; Thu, 26 Oct 2023 19:33:55 +0200 (CEST) From: "Marcin Juszkiewicz" Date: Thu, 26 Oct 2023 19:33:49 +0200 Subject: [edk2-devel] [PATCH edk2-platforms v6 1/4] SbsaQemu: introduce macro to compare platform version MIME-Version: 1.0 Message-Id: <20231026-ehci-xhci-fix-v6-1-923ae4f73b8e@linaro.org> References: <20231026-ehci-xhci-fix-v6-0-923ae4f73b8e@linaro.org> In-Reply-To: <20231026-ehci-xhci-fix-v6-0-923ae4f73b8e@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: KUn7HzRweuAH98JjkDHrZ2sSx1787277AA= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1698341643735100002 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 (#110134): https://edk2.groups.io/g/devel/message/110134 Mute This Topic: https://groups.io/mt/102205080/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 Thu May 16 08:07:13 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+110135+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+110135+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1698341642; cv=none; d=zohomail.com; s=zohoarc; b=YGQQbeuUaH2w2Fylyq990fwyzj7xm6z6NJmgqqUaoQVOPaVJQH4YPL8nlp2lm6LLBGFC5ZQzHelSDgCvAmPRKGwt3exewor5+YpBVYuizLV4iNdSvNDWLb46VQjdcFifIqZQD8PAyOY+DYw/Rw8KyBRMsEHBf9ETPtRjX5wc34c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698341642; 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=GDX4ioaIRhCo2dhvQwva8dC4CL6jFBnOGa1sd82mh8M=; b=WZM0w92qPGtMLT2yaiLQ2EHe3UXS9kuKkIlfPPyztUQAVkZVbn2jyP/g3riS5aEtcQYKjM/7VDnhmRz/ixVZXgAXCl9c53UXJQtn4EkQBmfzzFqGyCbYxaqTH9IkG5vu8rj0sPQ8TdPyk03LbY7awyxdF3ZsuyOWo0A6crd+61s= 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+110135+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 1698341642833800.2844852939285; Thu, 26 Oct 2023 10:34:02 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=FQMt0gZDMS3uEKCxaBjsSkw0j2DIgXXNNvIxK20sybw=; 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=1698341642; v=1; b=cIAxg4e54gkjTsPazCV16K5e4u5DzzaSdUHHueSHE2vhgSMnTVR0Z9f+YWx66XXaRBhgQdsT 3aqZlrJxGAenLd8GmREPNDRqDj1cD8A7+awC+2i8KvoQ96KLyOtAsxaYnUEukFlYuzS/RJ02k5L dav+zukmrWJKdn2ricTCLSi0= X-Received: by 127.0.0.2 with SMTP id pzZ2YY1788612xOWYkq02AHr; Thu, 26 Oct 2023 10:34:02 -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.77323.1698341641706874026 for ; Thu, 26 Oct 2023 10:34:02 -0700 X-Received: from localhost (localhost [127.0.0.1]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTP id CEA042608AB; Thu, 26 Oct 2023 19:33:59 +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 HLuM-L9LQt8p; Thu, 26 Oct 2023 19:33:58 +0200 (CEST) X-Received: from [192.168.210.114] (83.11.185.48.ipv4.supernova.orange.pl [83.11.185.48]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTPSA id C5F9B260B30; Thu, 26 Oct 2023 19:33:56 +0200 (CEST) From: "Marcin Juszkiewicz" Date: Thu, 26 Oct 2023 19:33:50 +0200 Subject: [edk2-devel] [PATCH edk2-platforms v6 2/4] SbsaQemu: add AcpiLib MIME-Version: 1.0 Message-Id: <20231026-ehci-xhci-fix-v6-2-923ae4f73b8e@linaro.org> References: <20231026-ehci-xhci-fix-v6-0-923ae4f73b8e@linaro.org> In-Reply-To: <20231026-ehci-xhci-fix-v6-0-923ae4f73b8e@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: UY4Cn3yOnBswCrAT4ZNqusRVx1787277AA= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1698341643729100001 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 806651fc55a0..fa85bd8dab89 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 (#110135): https://edk2.groups.io/g/devel/message/110135 Mute This Topic: https://groups.io/mt/102205081/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 Thu May 16 08:07:13 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+110136+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+110136+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1698341643; cv=none; d=zohomail.com; s=zohoarc; b=d8Ff/nDQH/wXSK2ZSzbbqDxRCxegWg8vXqIQGIBNn82J7luXq3RTZvtOn6YG252f9EEISCaV5V0Z32L9veo65zXr49qm6y5kYIO47tCOBepMr5VjFHFk5S73uu2WCz8yxTgpS8aKvZzIEQHHkPYS3+oEPzoi9BHU3gS9BwNGw6M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698341643; 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=M45wEmitvxrezO74aI/jkz1YioNPOpsdX2z3vUxbNNA=; b=GvWYqVQqura+HtaFo3RJoIv/uT8kHKHiBtBiHk5EOTowkCs4992V8rGAirvfL1+KcFOTvcOCxY9oxH0tkhQXJX9QZOnQeK427JmlbZ/8joT2vyUn8z7ZOK58YICDh9p/EG8AredPvJN5aiePgL0ePxyDIg7xug2Qf21F/s69Zjs= 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+110136+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 1698341643808569.1195286789872; Thu, 26 Oct 2023 10:34:03 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=KNERL2VcQpJn0FhzDEZNNs5qFdeB8vlLASU5CfP86gs=; 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=1698341643; v=1; b=PSHx0S4nTvMY4nTh4q4T/0q4MDv+u9ICCcgI3a+ueomSy3AnRi5uyjxoFMqzoKCnD7LzJxCL yrA28UcvtOnfUWXW/eUUbCDf0L4STtoW2Di/E4sP674serYQ0f/Rvpetp/sZfsaVs/661TukdWl Rw7J0gbryd/3JfeShRi5mjoo= X-Received: by 127.0.0.2 with SMTP id ge6PYY1788612xQuxcf3dKXx; Thu, 26 Oct 2023 10:34:03 -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.77324.1698341642708217786 for ; Thu, 26 Oct 2023 10:34:03 -0700 X-Received: from localhost (localhost [127.0.0.1]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTP id 81909260B30; Thu, 26 Oct 2023 19:34:00 +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 iir31IMe-M0m; Thu, 26 Oct 2023 19:33:58 +0200 (CEST) X-Received: from [192.168.210.114] (83.11.185.48.ipv4.supernova.orange.pl [83.11.185.48]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTPSA id DB6F6260BCF; Thu, 26 Oct 2023 19:33:57 +0200 (CEST) From: "Marcin Juszkiewicz" Date: Thu, 26 Oct 2023 19:33:51 +0200 Subject: [edk2-devel] [PATCH edk2-platforms v6 3/4] SbsaQemu: initialize XHCI only if it exists MIME-Version: 1.0 Message-Id: <20231026-ehci-xhci-fix-v6-3-923ae4f73b8e@linaro.org> References: <20231026-ehci-xhci-fix-v6-0-923ae4f73b8e@linaro.org> In-Reply-To: <20231026-ehci-xhci-fix-v6-0-923ae4f73b8e@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: wQCvNhOE8cldeu7marN1FBlHx1787277AA= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1698341645510100013 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 (#110136): https://edk2.groups.io/g/devel/message/110136 Mute This Topic: https://groups.io/mt/102205082/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 Thu May 16 08:07:13 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+110137+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+110137+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1698341644; cv=none; d=zohomail.com; s=zohoarc; b=hfpFuGvoV7paSuPzxRlLSgni+Q9uVqaX0L1VwzRx6BLDHjmYgBlc/MiwSVWQdiA8ot2eTD6jj95JpcJVIwJB7REVAhxYS/MFLPTQF72toA8zmjDpu4D77dYdiEEouVcvamLZ5KLLwBHFCK0NkC2nPEPziKySD2s+91XEOxhEKL8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698341644; 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=kjCMtAvQK+PbrF7H466O/PrWgHpBvaafCR1qrUuv2ms=; b=VFjKk9Sk1GU5i83g46EdHH27YjOhbMdFCdoVsDti5WDi1YBvm1Nx7ILz04btucHXkNgXKdkt8xJSwNxFox9P3iakwr649qRj1xcjK7MG7Iu+2VL420Tpx7srzAp7qdegUN9FrNuSinSqLoB9JPRBgyQrXVAT6wgxVPSvD4O8yA0= 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+110137+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 1698341644589990.4724452805826; Thu, 26 Oct 2023 10:34:04 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=02pIA/wC4kgtThoJzvOjQpqk3BcfELyWy019cRHraRc=; 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=1698341644; v=1; b=L+n7adPzlw1E4G3T6baRP9xD3a11ZmhuR5PB9f/AqEhh6GIej1zuIehgOu5BeMdvE/R4cFBS iLrOM26uz18bzlrhBXy/rTn440xQmnyy4NeqT5Pe39FYpen1nHReSPZyUvbrAe2AbmxDIV+chXb LQpYwN30+SqxppQ6vwVsMTOQ= X-Received: by 127.0.0.2 with SMTP id 8IsSYY1788612xFQ0dqac0d2; Thu, 26 Oct 2023 10:34:04 -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.206879.1698341643482175004 for ; Thu, 26 Oct 2023 10:34:03 -0700 X-Received: from localhost (localhost [127.0.0.1]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTP id B564D260BCF; Thu, 26 Oct 2023 19:34:01 +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 Y-3g8eIU_Mx1; Thu, 26 Oct 2023 19:33:59 +0200 (CEST) X-Received: from [192.168.210.114] (83.11.185.48.ipv4.supernova.orange.pl [83.11.185.48]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTPSA id 9B538260C04; Thu, 26 Oct 2023 19:33:58 +0200 (CEST) From: "Marcin Juszkiewicz" Date: Thu, 26 Oct 2023 19:33:52 +0200 Subject: [edk2-devel] [PATCH edk2-platforms v6 4/4] SbsaQemu: disable XHCI in DSDT if not present MIME-Version: 1.0 Message-Id: <20231026-ehci-xhci-fix-v6-4-923ae4f73b8e@linaro.org> References: <20231026-ehci-xhci-fix-v6-0-923ae4f73b8e@linaro.org> In-Reply-To: <20231026-ehci-xhci-fix-v6-0-923ae4f73b8e@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: Xy4vgruGvERYWm6v0rqBxrZgx1787277AA= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1698341645517100014 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 Reviewed-by: Leif Lindholm --- .../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf | 4 ++ .../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c | 74 ++++++++++++++++= +++- Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl | 3 +- 3 files changed, 79 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..523d9035e0c1 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,72 @@ AddGtdtTable ( return Status; } =20 +/* + * A function to disable XHCI node on Platform Version lower than 0.3 + */ +STATIC +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 +805,10 @@ InitializeSbsaQemuAcpiDxe ( DEBUG ((DEBUG_ERROR, "Failed to add GTDT table\n")); } =20 - return EFI_SUCCESS; + Status =3D DisableXhciOnOlderPlatVer (); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Failed to handle XHCI enablement\n")); + } + + return Status; } diff --git a/Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl b/Silicon/Qemu/SbsaQ= emu/AcpiTables/Dsdt.asl index 6661bc8195ee..b55ad6c5cc07 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 (#110137): https://edk2.groups.io/g/devel/message/110137 Mute This Topic: https://groups.io/mt/102205083/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-