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 507CC9412BE for ; Wed, 18 Oct 2023 08:47:50 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=OkNAGePN+B0k+JvDY0L8j3H/J+T66NyguCBziE48iF0=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20140610; t=1697618869; v=1; b=XpK0ilcEi4zLsvYa1hGfBloDVIOgAm0tKCO/Ooq7qjQ0bfTHobC0eJTdIAYN5XusrgQi4lu2 e/1sU1X3wZTqIfvTATegcXpS9siynWN+CYCcv7oj8nvvmp68PSvKkdCBVbeR1/YW7QTmZHtVxVF uHfyHlAxgfagjrOae3vjmHUc= X-Received: by 127.0.0.2 with SMTP id 4ynBYY7687511xRXPoHfziF1; Wed, 18 Oct 2023 01:47:49 -0700 X-Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by mx.groups.io with SMTP id smtpd.web10.277483.1697618867961501875 for ; Wed, 18 Oct 2023 01:47:48 -0700 X-Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id B9E63CE23F5 for ; Wed, 18 Oct 2023 08:47:44 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04798C433CA for ; Wed, 18 Oct 2023 08:47:44 +0000 (UTC) X-Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2c514cbbe7eso54769641fa.1 for ; Wed, 18 Oct 2023 01:47:43 -0700 (PDT) X-Gm-Message-State: IUcWCdPNpQqC3uevsA7pgjshx7686176AA= X-Google-Smtp-Source: AGHT+IEkaPGy8D9UoED+8epgAWtsa8DusTqRaigEMdz23FFxNGT/bj6RS/ivMBdx0I2BGiQEWbcJD3Uss8PnlGjpg7M= X-Received: by 2002:a2e:a546:0:b0:2c5:d3e:2f46 with SMTP id e6-20020a2ea546000000b002c50d3e2f46mr3693735ljn.11.1697618862240; Wed, 18 Oct 2023 01:47:42 -0700 (PDT) MIME-Version: 1.0 References: <20231017-ehci-xhci-fix-v3-0-0b9ec9847947@linaro.org> <20231017-ehci-xhci-fix-v3-4-0b9ec9847947@linaro.org> <57236818-8e59-4da0-af38-4809d08fba7f@os.amperecomputing.com> In-Reply-To: From: "Ard Biesheuvel" Date: Wed, 18 Oct 2023 10:47:30 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [PATCH edk2-platforms v3 4/4] SbsaQemu: disable XHCI in DSDT if not present To: Marcin Juszkiewicz Cc: Nhi Pham , devel@edk2.groups.io, Leif Lindholm , Ard Biesheuvel , Jeremy Linton , Chuong Tran , Rebecca Cran 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,ardb@kernel.org List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=XpK0ilcE; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (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 On Wed, 18 Oct 2023 at 07:56, Marcin Juszkiewicz wrote: > > W dniu 18.10.2023 o 05:28, Nhi Pham pisze: > > Hi Marcin, > > > > There is a nitpicking below. > > > > Other than, it looks good to me. > > > > Acked-by: Nhi Pham > > > >> a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c > >> b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c > >> index fd849ca1594b..cf6e534ca3a0 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,63 @@ AddGtdtTable ( > >> return Status; > >> } > >> +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; > >> + } > >> + > >> + TableIndex = 0; > >> + 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; > >> + } > >> + > >> + AcpiAmlObjectUpdateInteger (AcpiSdtProtocol, TableHandle, > >> "\\_SB.USB0.XHCI", 0x0); > >> + > >> + AcpiSdtProtocol->Close (TableHandle); > >> + AcpiUpdateChecksum ((UINT8 *)Table, Table->Length); > >> + } > >> + > >> + return Status; > >> +} > >> + > >> + > >> EFI_STATUS > >> EFIAPI > >> InitializeSbsaQemuAcpiDxe ( > >> @@ -738,5 +796,7 @@ InitializeSbsaQemuAcpiDxe ( > >> DEBUG ((DEBUG_ERROR, "Failed to add GTDT table\n")); > >> } > >> + Status = DisableXhciOnOlderPlatVer(); > > > > Nit: EDK2 Coding Style says that you need a space before (. > > Ah, right. forgot to crucify the source. > > > Is it necessary to handle the result of Status? > > EDK2 is full of handling Status on touching ACPI tables. So I followed. > Can you just do 'return DisableXhciOnOlderPlatVer();' instead? -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109715): https://edk2.groups.io/g/devel/message/109715 Mute This Topic: https://groups.io/mt/102017316/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-