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 A7DFBAC0C1B for ; Thu, 11 Jan 2024 07:48:28 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=o8i+4Edl5YAfrnnMl2uPvBzUVj3AUBMyEAso8M+qCVU=; 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=1704959307; v=1; b=vf7Ief+nF0eBrz9HmYEI3kueHnf8VK9skgclaFAGsxst3wNcdGtb29rIW0t601a/IDYhYXvC oaCI1bM8y1P6SdrhXDvFbYTimU5L4QDwm9Hm2rDa66JGpr87J/TyK2HhIb3cHWyuJzRuE+1SkmX Ji9DvqtWBp/Y0+8+On5f/nVs= X-Received: by 127.0.0.2 with SMTP id Cy3SYY7687511xmapbuSDJwR; Wed, 10 Jan 2024 23:48:27 -0800 X-Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web10.6895.1704959305368616192 for ; Wed, 10 Jan 2024 23:48:26 -0800 X-Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 4B467B81A34 for ; Thu, 11 Jan 2024 07:48:20 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 775AFC43390 for ; Thu, 11 Jan 2024 07:48:19 +0000 (UTC) X-Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-50eab4bf47aso4515053e87.0 for ; Wed, 10 Jan 2024 23:48:19 -0800 (PST) X-Gm-Message-State: HLV24Cg2AjeG1hHJLgO5hFryx7686176AA= X-Google-Smtp-Source: AGHT+IGIaHjVfqFzYq/UXqAouyF/QstRgXo8H3aFKIw39oyQEUeFvOp3X2qj3VgFWG3wBTE4mOLMVIWaBvnHmE3acCM= X-Received: by 2002:a05:6512:453:b0:50e:797c:249a with SMTP id y19-20020a056512045300b0050e797c249amr218734lfk.12.1704959297614; Wed, 10 Jan 2024 23:48:17 -0800 (PST) MIME-Version: 1.0 References: <20240110235227.2734271-1-jeremy.linton@arm.com> <20240110235227.2734271-5-jeremy.linton@arm.com> In-Reply-To: <20240110235227.2734271-5-jeremy.linton@arm.com> From: "Ard Biesheuvel" Date: Thu, 11 Jan 2024 08:48:06 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [PATCH 4/5] Platform/RaspberryPi: Give the user control over the XHCI mailbox To: Jeremy Linton Cc: devel@edk2.groups.io, ardb+tianocore@kernel.org, quic_llindhol@quicinc.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,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=vf7Ief+n; 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 Thu, 11 Jan 2024 at 00:52, Jeremy Linton wrote: > > Its a complete tossup whether removing the mailbox call after we have > set up the XHCI works for a given kernel+distro in DT mode. So lets > give users which want to try DT the option of flipping this on/off. > > Users that don't want to have to deal with DT, can use ACPI. > > Signed-off-by: Jeremy Linton > --- > .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 10 ++++++++++ > .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 1 + > .../Drivers/ConfigDxe/ConfigDxeHii.uni | 5 +++++ > .../Drivers/ConfigDxe/ConfigDxeHii.vfr | 15 +++++++++++++++ > Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c | 4 ++++ > Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf | 1 + > Platform/RaspberryPi/RPi3/RPi3.dsc | 6 ++++++ > Platform/RaspberryPi/RPi4/RPi4.dsc | 7 +++++++ > Platform/RaspberryPi/RaspberryPi.dec | 1 + > 9 files changed, 50 insertions(+) > This looks ok to me but it doesn't appear to apply on today's edk2-platforms. > diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c > index 3dcf2bac0d..2484787982 100644 > --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c > +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c > @@ -298,6 +298,16 @@ SetupVariables ( > Status = PcdSet32S (PcdXhciPci, 1); > ASSERT_EFI_ERROR (Status); > } > + > + Size = sizeof (UINT32); > + Status = gRT->GetVariable (L"XhciReload", > + &gConfigDxeFormSetGuid, > + NULL, &Size, &Var32); > + if (EFI_ERROR (Status)) { > + Status = PcdSet32S (PcdXhciReload, PcdGet32 (PcdXhciReload)); > + ASSERT_EFI_ERROR (Status); > + } > + > } > } else { > /* > diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf > index 6f6e8f42ac..475e645537 100644 > --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf > +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf > @@ -96,6 +96,7 @@ > gRaspberryPiTokenSpaceGuid.PcdUartInUse > gRaspberryPiTokenSpaceGuid.PcdXhciPci > gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate > + gRaspberryPiTokenSpaceGuid.PcdXhciReload > > [Depex] > gPcdProtocolGuid AND gRaspberryPiFirmwareProtocolGuid > diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni > index 5ec17072c3..8130638876 100644 > --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni > +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni > @@ -62,6 +62,11 @@ > #string STR_ADVANCED_XHCIPCI_XHCI #language en-US "XHCI" > #string STR_ADVANCED_XHCIPCI_PCIE #language en-US "PCIe" > > +#string STR_ADVANCED_XHCIRELOAD_PROMPT #language en-US "DT Reload XHCI firmware" > +#string STR_ADVANCED_XHCIRELOAD_HELP #language en-US "OS should reload XHCI firmware on reset" > +#string STR_ADVANCED_XHCIRELOAD_DISABLE #language en-US "Disabled" > +#string STR_ADVANCED_XHCIRELOAD_RELOAD #language en-US "Reload" > + > #string STR_ADVANCED_ASSET_TAG_PROMPT #language en-US "Asset Tag" > #string STR_ADVANCED_ASSET_TAG_HELP #language en-US "Set the system Asset Tag" > > diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr > index f668b7a553..f13b70711d 100644 > --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr > +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr > @@ -61,6 +61,11 @@ formset > name = XhciPci, > guid = CONFIGDXE_FORM_SET_GUID; > > + efivarstore ADVANCED_XHCIPCI_VARSTORE_DATA, > + attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, > + name = XhciReload, > + guid = CONFIGDXE_FORM_SET_GUID; > + > efivarstore SYSTEM_TABLE_MODE_VARSTORE_DATA, > attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, > name = SystemTableMode, > @@ -228,6 +233,16 @@ formset > option text = STRING_TOKEN(STR_ADVANCED_XHCIPCI_PCIE), value = 1, flags = 0; > endoneof; > endif; > + > + grayoutif ideqval SystemTableMode.Mode == SYSTEM_TABLE_MODE_ACPI; > + oneof varid = XhciReload.Value, > + prompt = STRING_TOKEN(STR_ADVANCED_XHCIRELOAD_PROMPT), > + help = STRING_TOKEN(STR_ADVANCED_XHCIRELOAD_HELP), > + flags = NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED, > + option text = STRING_TOKEN(STR_ADVANCED_XHCIRELOAD_DISABLE), value = 0, flags = DEFAULT; > + option text = STRING_TOKEN(STR_ADVANCED_XHCIRELOAD_RELOAD), value = 1, flags = 0; > + endoneof; > + endif; > endif; > #endif > string varid = AssetTag.AssetTag, > diff --git a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c > index cbbc2ad30d..dd4fc0a05e 100644 > --- a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c > +++ b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c > @@ -375,6 +375,10 @@ SyncPcie ( > return EFI_NOT_FOUND; > } > > + if (PcdGet32 (PcdXhciReload) != 1) { > + return EFI_SUCCESS; > + } > + > /* > * Now that we are always running without DMA translation, and with a 3G > * limit, there shouldn't be a need to reset/reload the XHCI. The > diff --git a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf > index 26f84e5940..d9fb6ee480 100644 > --- a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf > +++ b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf > @@ -47,3 +47,4 @@ > > [Pcd] > gRaspberryPiTokenSpaceGuid.PcdSystemTableMode > + gRaspberryPiTokenSpaceGuid.PcdXhciReload > diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3/RPi3.dsc > index a967cd5a20..f5361ab95e 100644 > --- a/Platform/RaspberryPi/RPi3/RPi3.dsc > +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc > @@ -529,6 +529,12 @@ > # > gRaspberryPiTokenSpaceGuid.PcdXhciPci|L"XhciPci"|gConfigDxeFormSetGuid|0x0|0 > > + # DT contains XHCI quirk node (not valid on rpi3) > + # > + # 0 - DISABLED > + # > + gRaspberryPiTokenSpaceGuid.PcdXhciReload|L"XhciReload"|gConfigDxeFormSetGuid|0x0|0 > + > # > # Common UEFI ones. > # > diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4/RPi4.dsc > index 8c49c67ab2..4e91eb9aea 100644 > --- a/Platform/RaspberryPi/RPi4/RPi4.dsc > +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc > @@ -547,6 +547,13 @@ > # > gRaspberryPiTokenSpaceGuid.PcdXhciPci|L"XhciPci"|gConfigDxeFormSetGuid|0x0|0 > > + # DT contains XHCI quirk node > + # > + # 0 - No reload > + # 1 - Yes, DT has Reload > + # > + gRaspberryPiTokenSpaceGuid.PcdXhciReload|L"XhciReload"|gConfigDxeFormSetGuid|0x0|0 > + > # > # Common UEFI ones. > # > diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/RaspberryPi.dec > index 17b6061a05..6bd16a5ae9 100644 > --- a/Platform/RaspberryPi/RaspberryPi.dec > +++ b/Platform/RaspberryPi/RaspberryPi.dec > @@ -73,3 +73,4 @@ > gRaspberryPiTokenSpaceGuid.PcdUartInUse|1|UINT32|0x00000021 > gRaspberryPiTokenSpaceGuid.PcdXhciPci|0|UINT32|0x00000022 > gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate|0|UINT32|0x00000023 > + gRaspberryPiTokenSpaceGuid.PcdXhciReload|0|UINT32|0x00000024 > -- > 2.43.0 > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#113590): https://edk2.groups.io/g/devel/message/113590 Mute This Topic: https://groups.io/mt/103652856/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-