From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id A0B4474003E for ; Thu, 26 Oct 2023 16:56:40 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=5crY89RdED467aHBzrU0yTm3NVigqCmQOnZCQf5t6LM=; c=relaxed/simple; d=groups.io; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Disposition; s=20140610; t=1698339399; v=1; b=PTy3bjUkhSEucLg1FGpPIFWRJszAoips6IKM4U1qYhb1T3PGKzJtft10y1okC1fUwkrwGN3V FJRiv4AmeK0g9bnetbppUKm3aDoaIFYhdNi0zV091lbjlbEdxwIJsn0401KJfnGHujySHAlv4zM E4iIQ+NhlBcX2IYSsUM0PYAM= X-Received: by 127.0.0.2 with SMTP id 1EAnYY7687511xDJeNZsSuOb; Thu, 26 Oct 2023 09:56:39 -0700 X-Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by mx.groups.io with SMTP id smtpd.web10.205739.1698339398505875192 for ; Thu, 26 Oct 2023 09:56:38 -0700 X-Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39QEgS8e030853; Thu, 26 Oct 2023 16:56:35 GMT X-Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3tyhqnhhtb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Oct 2023 16:56:35 +0000 X-Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 39QGuYmu003183 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Oct 2023 16:56:34 GMT X-Received: from qc-i7.hemma.eciton.net (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Thu, 26 Oct 2023 09:56:32 -0700 Date: Thu, 26 Oct 2023 17:56:29 +0100 From: "Leif Lindholm" To: Marcin Juszkiewicz CC: , Ard Biesheuvel , Jeremy Linton , Nhi Pham , Chuong Tran , Rebecca Cran Subject: Re: [edk2-devel] [PATCH edk2-platforms v5 4/4] SbsaQemu: disable XHCI in DSDT if not present Message-ID: References: <20231018-ehci-xhci-fix-v5-0-f42995a3dfd9@linaro.org> <20231018-ehci-xhci-fix-v5-4-f42995a3dfd9@linaro.org> MIME-Version: 1.0 In-Reply-To: <20231018-ehci-xhci-fix-v5-4-f42995a3dfd9@linaro.org> X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-ORIG-GUID: n_RtuAsPN1lfqHADzmjKTlzror59IU_i X-Proofpoint-GUID: n_RtuAsPN1lfqHADzmjKTlzror59IU_i 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,quic_llindhol@quicinc.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: SxqB9SfGqAbogrK5PNFZVau4x7686176AA= Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=PTy3bjUk; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=quicinc.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Couple of minor comments on this patch, rest of set good to go: On Wed, Oct 18, 2023 at 13:55:41 +0200, Marcin Juszkiewicz wrote: > 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.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; > } > > +/* > + * 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 = EFI_SUCCESS; > + > + if ( PLATFORM_VERSION_LESS_THAN (0, 3)) { > + DEBUG ((DEBUG_ERROR, "Platform Version < 0.3 - disabling XHCI\n")); > + Status = gBS->LocateProtocol ( > + &gEfiAcpiSdtProtocolGuid, > + NULL, > + (VOID **)&AcpiSdtProtocol > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "Unable to locate ACPI table protocol\n")); > + return Status; > + } > + > + Status = AcpiLocateTableBySignature ( > + AcpiSdtProtocol, > + EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_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 = AcpiSdtProtocol->OpenSdt (TableKey, &TableHandle); > + if (EFI_ERROR (Status)) { > + ASSERT_EFI_ERROR (Status); > + AcpiSdtProtocol->Close (TableHandle); > + return Status; > + } > + > + Status = 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")); > } > > - return EFI_SUCCESS; > + return DisableXhciOnOlderPlatVer (); Replacing the normal exit path like this unnecessarily ties this call to the end of the function. Please add another boring "if (EFI_ERROR ..." stanza instead. / Leif > } > diff --git a/Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl b/Silicon/Qemu/SbsaQemu/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() { > > -- > 2.41.0 > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#110129): https://edk2.groups.io/g/devel/message/110129 Mute This Topic: https://groups.io/mt/102037246/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-