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 EEEE674003B for ; Wed, 18 Oct 2023 05:56:13 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=zfEQSXCKG6IFhbCcCXIeKk/vTdPmYS0JzfykXVn5dqA=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References:From:Organization:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1697608572; v=1; b=hj81uOW0dACx6iGLMpFo4qSppJ3kfRck+DqqtKEsIn/qs4Z/mPbxXcf2lohMOMKUvD95tniz L/pT4K0eUIQmo8lj/EiRaxKzWpPUgQ6saGbS8V5tH4CZaIMq88ZtoGC6bjgf9yeDLuqQLpJwjKE njGK+PxhomhH4BoAIcw3Q0Yw= X-Received: by 127.0.0.2 with SMTP id HTHyYY7687511xYd8aSLuUS3; Tue, 17 Oct 2023 22:56:12 -0700 X-Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by mx.groups.io with SMTP id smtpd.web11.275355.1697608571549310949 for ; Tue, 17 Oct 2023 22:56:12 -0700 X-Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-507c50b7c36so1222441e87.3 for ; Tue, 17 Oct 2023 22:56:11 -0700 (PDT) X-Gm-Message-State: 1l6lCrSRZcCfPPTHsKpM7axMx7686176AA= X-Google-Smtp-Source: AGHT+IGeufezkHX5EAf+NqEhYdwXl8lQsQUfT/mzHi8+7rpuz5claxDaMuJxa4t1ZqqROSyIKt3oYg== X-Received: by 2002:ac2:5f76:0:b0:503:1b83:e352 with SMTP id c22-20020ac25f76000000b005031b83e352mr2542427lfc.52.1697608569633; Tue, 17 Oct 2023 22:56:09 -0700 (PDT) X-Received: from [192.168.200.206] (83.11.27.172.ipv4.supernova.orange.pl. [83.11.27.172]) by smtp.gmail.com with ESMTPSA id n13-20020a17090673cd00b0099293cdbc98sm938667ejl.145.2023.10.17.22.56.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Oct 2023 22:56:09 -0700 (PDT) Message-ID: Date: Wed, 18 Oct 2023 07:56:07 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] [PATCH edk2-platforms v3 4/4] SbsaQemu: disable XHCI in DSDT if not present To: Nhi Pham , devel@edk2.groups.io Cc: Leif Lindholm , Ard Biesheuvel , Jeremy Linton , Chuong Tran , Rebecca Cran 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> From: "Marcin Juszkiewicz" Organization: Linaro In-Reply-To: <57236818-8e59-4da0-af38-4809d08fba7f@os.amperecomputing.com> 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: Content-Language: pl-PL, en-GB, en-HK Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=hj81uOW0; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=linaro.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 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. -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109711): https://edk2.groups.io/g/devel/message/109711 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] -=-=-=-=-=-=-=-=-=-=-=-