From nobody Thu Apr 25 08:22:39 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+83635+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+83635+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1636631868; cv=none; d=zohomail.com; s=zohoarc; b=g/OuAXuI6eVVpy/eyH0Dqre1jTeykYeBAvjOss7YjypysaxerUkyHhzAwFWbq+iQATpQKOa91IrLdKYy6WMwYJ3ALIL2pMyGKH85B4N/oHgZEh+ZQW/VnUt5SOwzQCMlXI3Vjb6IB+yntFq1DmPQfVtdVsoquWjFubArdnqLPIw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636631868; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=AIFwkrEBVlw+EorSBmW+Y2fcRw+h8Ihj5UGd1v38Jls=; b=cCN/u/q3lhHqwHmZ4M1JsrDKk7I9OQLYSwzbw38vEKCrm54ErK5benct0dzteEYP8MB/ju6Fk/onWNubY9CzlpsVqEW0s4OfqRIWLlxfjyVjYN/UYEygu6kYkqp9FpMa6FOIip7uyaTEGp5MKHEfeV4ia0wPj+61ASx0gsJT7kg= 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+83635+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 1636631868608638.9986034576975; Thu, 11 Nov 2021 03:57:48 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id ZeWuYY1788612x0zEawSfLQZ; Thu, 11 Nov 2021 03:57:48 -0800 X-Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) by mx.groups.io with SMTP id smtpd.web09.7426.1636613875438544328 for ; Wed, 10 Nov 2021 22:57:55 -0800 X-Received: by mail-ot1-f53.google.com with SMTP id g91-20020a9d12e4000000b0055ae68cfc3dso7599493otg.9 for ; Wed, 10 Nov 2021 22:57:55 -0800 (PST) X-Gm-Message-State: qyTx0ZuH7v2fq4K0Cc9lh7max1787277AA= X-Google-Smtp-Source: ABdhPJwOUO29gbQGW+kMTBHWIGH8aDhdJNsXbwsvLz3/n0+a+rbWpNV7MvxB/9m+86icJneNslcxjw== X-Received: by 2002:a05:6830:1be9:: with SMTP id k9mr4240843otb.123.1636613874348; Wed, 10 Nov 2021 22:57:54 -0800 (PST) X-Received: from dell-suse.jhome.net (072-191-152-022.res.spectrum.com. [72.191.152.22]) by smtp.gmail.com with ESMTPSA id y12sm649206oiv.49.2021.11.10.22.57.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Nov 2021 22:57:53 -0800 (PST) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: pete@akeo.ie, ardb+tianocore@kernel.org, leif@nuviainc.com, awarkentin@vmware.com, Sunny.Wang@arm.com, samer.el-haj-mahmoud@arm.com, Jeremy Linton Subject: [edk2-devel] [PATCH 1/1] Platform/RaspberryPi: Add menu item to enable/disable GPIO Date: Thu, 11 Nov 2021 00:57:38 -0600 Message-Id: <20211111065742.8923-2-lintonrjeremy@gmail.com> In-Reply-To: <20211111065742.8923-1-lintonrjeremy@gmail.com> References: <20211111065742.8923-1-lintonrjeremy@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,lintonrjeremy@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1636631868; bh=H2LrsbRP4YRqA5b3BI3UWjvFzunpNK0G1Nmm8QPtGqg=; h=Cc:Date:From:Reply-To:Subject:To; b=MeHtfgzmGJ/FSWf2cEZWAyjZrDNTqaKGY4UNguC3QoLuwZ1nWzAcM7eaBKTYBV3h0qW asnarGKQmpjRpL4YwVsuhcGB9eS72DcEr7rNhBndiUwvuzSY8k8uq7hoGF3GPR3uO1yUw of1J5XHJHP8bC36Xztjq0S9vehrA2QELSVc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1636631869195100001 Content-Type: text/plain; charset="utf-8" Now that the GPIO devices are in their own SSDT lets add a menu item for the rpi4 to enable/disable it. For the rpi3 the SSDT is always exported. Signed-off-by: Jeremy Linton --- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 17 +++++++++++++= +++- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 1 + Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni | 5 +++++ Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 15 +++++++++++++= ++ Platform/RaspberryPi/Include/ConfigVars.h | 4 ++++ Platform/RaspberryPi/RPi3/RPi3.dsc | 6 ++++++ Platform/RaspberryPi/RPi4/RPi4.dsc | 7 +++++++ Platform/RaspberryPi/RaspberryPi.dec | 1 + 8 files changed, 55 insertions(+), 1 deletion(-) diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/= RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c index d22ecb3128..794d056dc6 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c @@ -308,12 +308,27 @@ SetupVariables ( } =20 } + + Size =3D sizeof (UINT32); + Status =3D gRT->GetVariable (L"EnableGpio", + &gConfigDxeFormSetGuid, + NULL, &Size, &Var32); + if (EFI_ERROR (Status)) { + Status =3D PcdSet32S (PcdEnableGpio, PcdGet32 (PcdEnableGpio)); + ASSERT_EFI_ERROR (Status); + } + } else { /* * Disable PCIe and XHCI */ Status =3D PcdSet32S (PcdXhciPci, 0); ASSERT_EFI_ERROR (Status); + /* + * Enable GPIO + */ + Status =3D PcdSet32S (PcdEnableGpio, 1); + ASSERT_EFI_ERROR (Status); } =20 Size =3D sizeof (AssetTagVar); @@ -840,7 +855,7 @@ STATIC CONST NAMESPACE_TABLES SdtTables[] =3D { #endif { SIGNATURE_64 ('R', 'P', 'I', '3', 'G', 'P', 'I', 'O'), - 0, + PcdToken(PcdEnableGpio), 0, NULL }, diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platfor= m/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf index ff182e831d..1cba4a2a22 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf @@ -96,6 +96,7 @@ gRaspberryPiTokenSpaceGuid.PcdUartInUse gRaspberryPiTokenSpaceGuid.PcdXhciPci gRaspberryPiTokenSpaceGuid.PcdXhciReload + gRaspberryPiTokenSpaceGuid.PcdEnableGpio =20 [Depex] gPcdProtocolGuid AND gRaspberryPiFirmwareProtocolGuid diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni index 8130638876..8fcb6a3949 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni @@ -67,6 +67,11 @@ #string STR_ADVANCED_XHCIRELOAD_DISABLE #language en-US "Disabled" #string STR_ADVANCED_XHCIRELOAD_RELOAD #language en-US "Reload" =20 +#string STR_ADVANCED_ENABLEGPIO_PROMPT #language en-US "Export GPIO devic= es to OS" +#string STR_ADVANCED_ENABLEGPIO_HELP #language en-US "OS can see the GP= IO device and some low level SPI and I2C interfaces" +#string STR_ADVANCED_ENABLEGPIO_DISABLE #language en-US "Disabled" +#string STR_ADVANCED_ENABLEGPIO_ENABLE #language en-US "Enable" + #string STR_ADVANCED_ASSET_TAG_PROMPT #language en-US "Asset Tag" #string STR_ADVANCED_ASSET_TAG_HELP #language en-US "Set the system Asse= t Tag" =20 diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr index f13b70711d..04eb0a15a2 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr @@ -66,6 +66,11 @@ formset name =3D XhciReload, guid =3D CONFIGDXE_FORM_SET_GUID; =20 + efivarstore ADVANCED_ENABLEGPIO_VARSTORE_DATA, + attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME= _ACCESS | EFI_VARIABLE_NON_VOLATILE, + name =3D EnableGpio, + guid =3D CONFIGDXE_FORM_SET_GUID; + efivarstore SYSTEM_TABLE_MODE_VARSTORE_DATA, attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME= _ACCESS | EFI_VARIABLE_NON_VOLATILE, name =3D SystemTableMode, @@ -244,6 +249,16 @@ formset endoneof; endif; endif; + + grayoutif ideqval SystemTableMode.Mode =3D=3D SYSTEM_TABLE_MODE_DT; + oneof varid =3D EnableGpio.Value, + prompt =3D STRING_TOKEN(STR_ADVANCED_ENABLEGPIO_PROMPT), + help =3D STRING_TOKEN(STR_ADVANCED_ENABLEGPIO_HELP), + flags =3D NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED, + option text =3D STRING_TOKEN(STR_ADVANCED_ENABLEGPIO_DISABLE),= value =3D 0, flags =3D DEFAULT; + option text =3D STRING_TOKEN(STR_ADVANCED_ENABLEGPIO_ENABLE), = value =3D 1, flags =3D 0; + endoneof; + endif; #endif string varid =3D AssetTag.AssetTag, prompt =3D STRING_TOKEN(STR_ADVANCED_ASSET_TAG_PROMPT), diff --git a/Platform/RaspberryPi/Include/ConfigVars.h b/Platform/Raspberry= Pi/Include/ConfigVars.h index a5b32b5284..43a39891d4 100644 --- a/Platform/RaspberryPi/Include/ConfigVars.h +++ b/Platform/RaspberryPi/Include/ConfigVars.h @@ -81,6 +81,10 @@ typedef struct { } ADVANCED_XHCIPCI_VARSTORE_DATA; =20 typedef struct { + UINT32 Value; +} ADVANCED_ENABLEGPIO_VARSTORE_DATA; + +typedef struct { #define SYSTEM_TABLE_MODE_ACPI 0 #define SYSTEM_TABLE_MODE_BOTH 1 #define SYSTEM_TABLE_MODE_DT 2 diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3= /RPi3.dsc index 72fafb7195..1d59cda4a7 100644 --- a/Platform/RaspberryPi/RPi3/RPi3.dsc +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc @@ -532,6 +532,12 @@ # gRaspberryPiTokenSpaceGuid.PcdXhciReload|L"XhciReload"|gConfigDxeFormSet= Guid|0x0|0 =20 + # Export GPIO block to OS + # + # 1 - Yes (for legacy reasons) + # + gRaspberryPiTokenSpaceGuid.PcdEnableGpio|L"EnableGpio"|gConfigDxeFormSet= Guid|0x0|1 + # # Common UEFI ones. # diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4= /RPi4.dsc index 6de4407749..c918af6dab 100644 --- a/Platform/RaspberryPi/RPi4/RPi4.dsc +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc @@ -551,6 +551,13 @@ # gRaspberryPiTokenSpaceGuid.PcdXhciReload|L"XhciReload"|gConfigDxeFormSet= Guid|0x0|0 =20 + # Export GPIO block to OS + # + # 0 - No + # 1 - Yes + # + gRaspberryPiTokenSpaceGuid.PcdEnableGpio|L"EnableGpio"|gConfigDxeFormSet= Guid|0x0|0 + # # Common UEFI ones. # diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/Ra= spberryPi.dec index c50ebdcf77..97709f9b94 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.PcdXhciReload|0|UINT32|0x00000023 + gRaspberryPiTokenSpaceGuid.PcdEnableGpio|0|UINT32|0x00000024 --=20 2.13.7 -=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 (#83635): https://edk2.groups.io/g/devel/message/83635 Mute This Topic: https://groups.io/mt/86979572/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 Apr 25 08:22:39 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+83636+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+83636+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1636631870; cv=none; d=zohomail.com; s=zohoarc; b=NJyrdbOqhu8YaSKeKBULCfRw6VdOHZk9CtUKW6YpyjZUoDpsv4GZWitFXnCh0kDF8zn/2cWOhNZ5bi7huYIHw6TTdSQZybRWw7diGC+S3aMzIOVTbDEFfpRIpsbQduQOuWrGC91OSHhZS2lSQiB9ttikexzJtO201UsykasT2Lg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636631870; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=ytcuFTEBOR96BnT+zL+vCwIY0FotU2emodDgqeTjosQ=; b=YiqUIrhwyhG/SBAaHImRKRskZ/DQG1IfwsGtVRr/RlFwQ17OXI+JgDDhsWYYABWAv8i4Oabp6jVWWPIjGKcimSEpwfilftqlJcGpjyzBKfPKPoI4Oi8kafkNe3tdeeg3LB++SA9tlEHqGtdWSIVkhs9mwgqfc3PVoRvrlzZh4gA= 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+83636+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 1636631869963844.1456868530305; Thu, 11 Nov 2021 03:57:49 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id GcoPYY1788612xt51pTiSMRG; Thu, 11 Nov 2021 03:57:49 -0800 X-Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173]) by mx.groups.io with SMTP id smtpd.web10.7469.1636613877374283628 for ; Wed, 10 Nov 2021 22:57:57 -0800 X-Received: by mail-oi1-f173.google.com with SMTP id q25so4392637oiw.0 for ; Wed, 10 Nov 2021 22:57:57 -0800 (PST) X-Gm-Message-State: 3ZKbujnvPLO0bM0SMc23L3jox1787277AA= X-Google-Smtp-Source: ABdhPJwzuQ7bsvKn6tspCbTRZ14k2pia7SV8TEXxijv5kKAdMYEcYSRpUt2GBGenR8GbPMJvGWfPmg== X-Received: by 2002:aca:58d6:: with SMTP id m205mr18354471oib.126.1636613876352; Wed, 10 Nov 2021 22:57:56 -0800 (PST) X-Received: from dell-suse.jhome.net (072-191-152-022.res.spectrum.com. [72.191.152.22]) by smtp.gmail.com with ESMTPSA id y12sm649206oiv.49.2021.11.10.22.57.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Nov 2021 22:57:55 -0800 (PST) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: pete@akeo.ie, ardb+tianocore@kernel.org, leif@nuviainc.com, awarkentin@vmware.com, Sunny.Wang@arm.com, samer.el-haj-mahmoud@arm.com, Jeremy Linton Subject: [edk2-devel] [PATCH 1/4] Platform/RaspberryPi: Cleanup menu visibility Date: Thu, 11 Nov 2021 00:57:39 -0600 Message-Id: <20211111065742.8923-3-lintonrjeremy@gmail.com> In-Reply-To: <20211111065742.8923-1-lintonrjeremy@gmail.com> References: <20211111065742.8923-1-lintonrjeremy@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,lintonrjeremy@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1636631869; bh=L2l1oDIAIdd1HczGGUxuVqapikl5GAO41MxLKtV1Sao=; h=Cc:Date:From:Reply-To:Subject:To; b=wxsWkipcTRG4cSr/TbCFIA9sMep56CGbkq4MNTXVmVIpY3fU4H3v0zL3CuxCVFxw2Vf 8Lg/+2iuUZUQL2bPVdPPdHt9hDoXNqywoIivjGS6dzGyl3L8d/VgFYwaPBt9kn+SNZ+Mb lg9uavZYMusSDlGUJlaEgDyH6pQMm8gw+nU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1636631871191100011 Content-Type: text/plain; charset="utf-8" Lets allow some of these options to change when the system is in ACPI+DT mode. Plus the fan temp should be disabled when ACPI isn't enabled. Signed-off-by: Jeremy Linton --- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr index e8bf16312d..f668b7a553 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr @@ -196,7 +196,7 @@ formset endoneof; =20 #if (RPI_MODEL =3D=3D 4) - grayoutif NOT ideqval SystemTableMode.Mode =3D=3D SYSTEM_TABLE_MOD= E_ACPI; + grayoutif ideqval SystemTableMode.Mode =3D=3D SYSTEM_TABLE_MODE_DT; oneof varid =3D FanOnGpio.Enabled, prompt =3D STRING_TOKEN(STR_ADVANCED_FANONGPIO_PROMPT), help =3D STRING_TOKEN(STR_ADVANCED_FANONGPIO_HELP), @@ -207,7 +207,7 @@ formset endoneof; endif; =20 - grayoutif ideqval FanOnGpio.Enabled =3D=3D 0; + grayoutif ideqval FanOnGpio.Enabled =3D=3D 0 OR ideqval SystemTabl= eMode.Mode =3D=3D SYSTEM_TABLE_MODE_DT; numeric varid =3D FanTemp.Value, prompt =3D STRING_TOKEN(STR_ADVANCED_FANTEMP_PROMPT), help =3D STRING_TOKEN(STR_ADVANCED_FANTEMP_HELP), @@ -219,7 +219,7 @@ formset endif; =20 suppressif ideqval XhciPci.Value =3D=3D 2; - grayoutif NOT ideqval SystemTableMode.Mode =3D=3D SYSTEM_TABLE_M= ODE_ACPI; + grayoutif ideqval SystemTableMode.Mode =3D=3D SYSTEM_TABLE_MODE_= DT; oneof varid =3D XhciPci.Value, prompt =3D STRING_TOKEN(STR_ADVANCED_XHCIPCI_PROMPT), help =3D STRING_TOKEN(STR_ADVANCED_XHCIPCI_HELP), --=20 2.13.7 -=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 (#83636): https://edk2.groups.io/g/devel/message/83636 Mute This Topic: https://groups.io/mt/86979573/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 Apr 25 08:22:39 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+83637+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+83637+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1636631870; cv=none; d=zohomail.com; s=zohoarc; b=IvV+3rd+cSzSOk369snOnOyOEH0l49USx263edQr1NBAgowPI0+/Mjsf6sJfUyJ3wIPY2b1q2hEAhfkkPrKqRwNZfgtP+c50al84mQx18s62j5ZldR/Wh/IrYVHEe31gaIyO5GCIUQS/irE2VxyvW+5BQBk33mTr7/jKSL9VVPE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636631870; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=gx92QMvafitSh2SBT9OvwACNL0aHbfd7SDeG7Sptdno=; b=HlqWmEwkF/w22liplzbTyQ1alUzS7BDgUgQ+RUtfclWkcMg7E2wG4SD4Gch6aYh2Ms2fUPf9EB/iqqtW8BMZmjqouzWfHV2wfRPDoW6qCxBJXxStMKYOfbkq91/vpiizfwXqXXOQOwUoLtrjeLaOV24HlmMZYqQGb3r0QPxgchI= 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+83637+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 1636631870528355.74041418974593; Thu, 11 Nov 2021 03:57:50 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id HHujYY1788612xxPYFDcS8kB; Thu, 11 Nov 2021 03:57:50 -0800 X-Received: from mail-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) by mx.groups.io with SMTP id smtpd.web11.7296.1636613878779875873 for ; Wed, 10 Nov 2021 22:57:58 -0800 X-Received: by mail-ot1-f41.google.com with SMTP id h19-20020a9d3e53000000b0056547b797b2so6761690otg.4 for ; Wed, 10 Nov 2021 22:57:58 -0800 (PST) X-Gm-Message-State: XhMJy56gF7w9wC9oaOmOUjkrx1787277AA= X-Google-Smtp-Source: ABdhPJx5vflEP9ybzM2I4/+Oj9ULNQqsKn7RH/IVbierLgaRWbERNaSRgkFHkttl/Uo1lbSnNidzjQ== X-Received: by 2002:a05:6830:1ad2:: with SMTP id r18mr4131120otc.308.1636613877757; Wed, 10 Nov 2021 22:57:57 -0800 (PST) X-Received: from dell-suse.jhome.net (072-191-152-022.res.spectrum.com. [72.191.152.22]) by smtp.gmail.com with ESMTPSA id y12sm649206oiv.49.2021.11.10.22.57.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Nov 2021 22:57:57 -0800 (PST) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: pete@akeo.ie, ardb+tianocore@kernel.org, leif@nuviainc.com, awarkentin@vmware.com, Sunny.Wang@arm.com, samer.el-haj-mahmoud@arm.com, Jeremy Linton Subject: [edk2-devel] [PATCH 2/4] Platform/RaspberryPi: Give the user control over the XHCI mailbox Date: Thu, 11 Nov 2021 00:57:40 -0600 Message-Id: <20211111065742.8923-4-lintonrjeremy@gmail.com> In-Reply-To: <20211111065742.8923-1-lintonrjeremy@gmail.com> References: <20211111065742.8923-1-lintonrjeremy@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,lintonrjeremy@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1636631870; bh=v9inUPH89HSXTnX6ZAMrjKIOtyxhBoSIhcwqktOgE5Q=; h=Cc:Date:From:Reply-To:Subject:To; b=JUPbqA76RCr7GCEXO8YKCpj2is8qXThfCIBKfNeOGeTX2hATuY+fEzkkBjaDKckHL9g apL6Ue03VZvgjmYb8CAQT7OKFyicfcm7G5xUEW+95Ka1lRQ3mzsdl01MyYy9zCI2Q1va+ ZEWy5Xouz9YUqkFvchjTIYIm7Mt2w8ylInY= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1636632772185100001 Content-Type: text/plain; charset="utf-8" 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 --- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 10 ++++++++++ Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 1 + Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni | 5 +++++ Platform/RaspberryPi/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(+) diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/= RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c index 415d99fadb..bdabdec7a5 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c @@ -297,6 +297,16 @@ SetupVariables ( Status =3D PcdSet32S (PcdXhciPci, 1); ASSERT_EFI_ERROR (Status); } + + Size =3D sizeof (UINT32); + Status =3D gRT->GetVariable (L"XhciReload", + &gConfigDxeFormSetGuid, + NULL, &Size, &Var32); + if (EFI_ERROR (Status)) { + Status =3D PcdSet32S (PcdXhciReload, PcdGet32 (PcdXhciReload)); + ASSERT_EFI_ERROR (Status); + } + } } else { /* diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platfor= m/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf index e6e22ad82e..ff182e831d 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf @@ -95,6 +95,7 @@ gRaspberryPiTokenSpaceGuid.PcdFanTemp gRaspberryPiTokenSpaceGuid.PcdUartInUse gRaspberryPiTokenSpaceGuid.PcdXhciPci + gRaspberryPiTokenSpaceGuid.PcdXhciReload =20 [Depex] gPcdProtocolGuid AND gRaspberryPiFirmwareProtocolGuid diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni b/Plat= form/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" =20 +#string STR_ADVANCED_XHCIRELOAD_PROMPT #language en-US "DT Reload XHCI fi= rmware" +#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 Asse= t Tag" =20 diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Plat= form/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 =3D XhciPci, guid =3D CONFIGDXE_FORM_SET_GUID; =20 + efivarstore ADVANCED_XHCIPCI_VARSTORE_DATA, + attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME= _ACCESS | EFI_VARIABLE_NON_VOLATILE, + name =3D XhciReload, + guid =3D CONFIGDXE_FORM_SET_GUID; + efivarstore SYSTEM_TABLE_MODE_VARSTORE_DATA, attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME= _ACCESS | EFI_VARIABLE_NON_VOLATILE, name =3D SystemTableMode, @@ -228,6 +233,16 @@ formset option text =3D STRING_TOKEN(STR_ADVANCED_XHCIPCI_PCIE), val= ue =3D 1, flags =3D 0; endoneof; endif; + + grayoutif ideqval SystemTableMode.Mode =3D=3D SYSTEM_TABLE_MODE_= ACPI; + oneof varid =3D XhciReload.Value, + prompt =3D STRING_TOKEN(STR_ADVANCED_XHCIRELOAD_PROMPT), + help =3D STRING_TOKEN(STR_ADVANCED_XHCIRELOAD_HELP), + flags =3D NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRE= D, + option text =3D STRING_TOKEN(STR_ADVANCED_XHCIRELOAD_DISABLE= ), value =3D 0, flags =3D DEFAULT; + option text =3D STRING_TOKEN(STR_ADVANCED_XHCIRELOAD_RELOAD)= , value =3D 1, flags =3D 0; + endoneof; + endif; endif; #endif string varid =3D AssetTag.AssetTag, diff --git a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c b/Platform/Raspbe= rryPi/Drivers/FdtDxe/FdtDxe.c index e72d132b18..7eb1b26b68 100644 --- a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c +++ b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c @@ -375,6 +375,10 @@ SyncPcie ( return EFI_NOT_FOUND; } =20 + if (PcdGet32 (PcdXhciReload) !=3D 1) { + return EFI_SUCCESS; + } +=20 /* * 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/Rasp= berryPi/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 @@ =20 [Pcd] gRaspberryPiTokenSpaceGuid.PcdSystemTableMode + gRaspberryPiTokenSpaceGuid.PcdXhciReload diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3= /RPi3.dsc index 6ab5d1ae6d..72fafb7195 100644 --- a/Platform/RaspberryPi/RPi3/RPi3.dsc +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc @@ -526,6 +526,12 @@ # gRaspberryPiTokenSpaceGuid.PcdXhciPci|L"XhciPci"|gConfigDxeFormSetGuid|0= x0|0 =20 + # DT contains XHCI quirk node (not valid on rpi3) + # + # 0 - DISABLED=20 + # + gRaspberryPiTokenSpaceGuid.PcdXhciReload|L"XhciReload"|gConfigDxeFormSet= Guid|0x0|0 + # # Common UEFI ones. # diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4= /RPi4.dsc index 44ed60ab2f..6de4407749 100644 --- a/Platform/RaspberryPi/RPi4/RPi4.dsc +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc @@ -544,6 +544,13 @@ # gRaspberryPiTokenSpaceGuid.PcdXhciPci|L"XhciPci"|gConfigDxeFormSetGuid|0= x0|0 =20 + # DT contains XHCI quirk node + # + # 0 - No reload + # 1 - Yes, DT has Reload + # + gRaspberryPiTokenSpaceGuid.PcdXhciReload|L"XhciReload"|gConfigDxeFormSet= Guid|0x0|0 + # # Common UEFI ones. # diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/Ra= spberryPi.dec index 797be59274..c50ebdcf77 100644 --- a/Platform/RaspberryPi/RaspberryPi.dec +++ b/Platform/RaspberryPi/RaspberryPi.dec @@ -72,3 +72,4 @@ gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma|0|UINT32|0x0000001F gRaspberryPiTokenSpaceGuid.PcdUartInUse|1|UINT32|0x00000021 gRaspberryPiTokenSpaceGuid.PcdXhciPci|0|UINT32|0x00000022 + gRaspberryPiTokenSpaceGuid.PcdXhciReload|0|UINT32|0x00000023 --=20 2.13.7 -=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 (#83637): https://edk2.groups.io/g/devel/message/83637 Mute This Topic: https://groups.io/mt/86979574/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 Apr 25 08:22:39 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+83638+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+83638+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1636631870; cv=none; d=zohomail.com; s=zohoarc; b=Vj/AFFpXwgMLPlPT925BPolKhkuONdLDy5fhL0uA+PSCkjKCgMfNeHSAmsRR5DORIcRGgfxmegOgtNEKczK2WHrFfaq6gkK74P1xlMZNxTutlEKvF8so4lHFpthI91mQuLlqX5Sa6RQVa10cvNDmMMNmW1gUsGLLHkVBhxiJR8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636631870; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=+GXBxtWYUcbcaBdZ0JnYz5PvqG1X/JNUJZWDpiEL9Pg=; b=Kw8jL3YN9EVo9Fgo4vj3VhIwdT6VdUngEpMuKZHTMWnhn+xrJGQr0PMAjHBOrYzlSQIUMc24f5QmZiK7TuIriUxXRzRL86CPWJhk446Sk7Z0yMcswGoJ8mTDLNZeVp7D7HkQE/xCOaDig7HdOV2aMEJch4jbe4/jsr1kwkYx9eg= 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+83638+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 1636631870676132.73932878122616; Thu, 11 Nov 2021 03:57:50 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id BKSmYY1788612xLYRCxELao7; Thu, 11 Nov 2021 03:57:50 -0800 X-Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) by mx.groups.io with SMTP id smtpd.web09.7429.1636613880199153904 for ; Wed, 10 Nov 2021 22:58:00 -0800 X-Received: by mail-oi1-f178.google.com with SMTP id q25so4392818oiw.0 for ; Wed, 10 Nov 2021 22:58:00 -0800 (PST) X-Gm-Message-State: oKxf6B1hN29XoaBcLF1TMotLx1787277AA= X-Google-Smtp-Source: ABdhPJz2AvlGVcdcatq2hwitbiy0lambBz3gCBn7QFiBeq+jdj1AGRu+bfnZzP941QED8RchDSYGBA== X-Received: by 2002:a05:6808:171c:: with SMTP id bc28mr17980217oib.18.1636613879214; Wed, 10 Nov 2021 22:57:59 -0800 (PST) X-Received: from dell-suse.jhome.net (072-191-152-022.res.spectrum.com. [72.191.152.22]) by smtp.gmail.com with ESMTPSA id y12sm649206oiv.49.2021.11.10.22.57.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Nov 2021 22:57:58 -0800 (PST) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: pete@akeo.ie, ardb+tianocore@kernel.org, leif@nuviainc.com, awarkentin@vmware.com, Sunny.Wang@arm.com, samer.el-haj-mahmoud@arm.com, Jeremy Linton Subject: [edk2-devel] [PATCH 3/4] Platform/RaspberryPi: Move GPIO/SPI/I2C to SSDT Date: Thu, 11 Nov 2021 00:57:41 -0600 Message-Id: <20211111065742.8923-5-lintonrjeremy@gmail.com> In-Reply-To: <20211111065742.8923-1-lintonrjeremy@gmail.com> References: <20211111065742.8923-1-lintonrjeremy@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,lintonrjeremy@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1636631870; bh=pG52vlic9S+io46C80cFPsb4GtS6RtBWleBYBvcfPns=; h=Cc:Date:From:Reply-To:Subject:To; b=N/EJo4ujlht1rlkO4+shWwPWIm398G4rIpaL/1WDd1W/Fk+ZrBt/Rw/wjeK9I5u77GA fscVeZbQrVLLRsM4Z0zJY9g95ioua+fXHzsLjd+DSpA7fOsIqaCdZkl/cdQfkvoN5oBcj K/ue9sghuoy0tv1w03tBQbxatUAJsWJzRfo= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1636631871292100015 Content-Type: text/plain; charset="utf-8" The UEFI firmware uses the GPIO port for the fan and real soon now the runtime SPI variable store. As such we need to be able to either isolate those devices from the OS or we risk clashing with OS's that reconfigure the GPIO pins. Ideally we would just rip this out and use _DSM() or just individual device power on/off methods to adjust the GPIO pins when needed. For now, lets leave it since windows at least knows about it. In the future we will decide whether the firmware is controlling something (SPI!) based on whether the user has enabled the GPIO block. Signed-off-by: Jeremy Linton --- Platform/RaspberryPi/AcpiTables/AcpiTables.inf | 1 + Platform/RaspberryPi/AcpiTables/Dsdt.asl | 7 - Platform/RaspberryPi/AcpiTables/GpuDevs.asl | 125 ---------------- Platform/RaspberryPi/AcpiTables/SsdtGpio.asl | 157 +++++++++++++++++= ++++ Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 6 + 5 files changed, 164 insertions(+), 132 deletions(-) create mode 100644 Platform/RaspberryPi/AcpiTables/SsdtGpio.asl diff --git a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf b/Platform/Rasp= berryPi/AcpiTables/AcpiTables.inf index da2a6db85f..3894d00565 100644 --- a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf +++ b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf @@ -40,6 +40,7 @@ SsdtThermal.asl Xhci.asl Pci.asl + SsdtGpio.asl =20 [Packages] ArmPkg/ArmPkg.dec diff --git a/Platform/RaspberryPi/AcpiTables/Dsdt.asl b/Platform/RaspberryP= i/AcpiTables/Dsdt.asl index b594d50bdf..08acc81d57 100644 --- a/Platform/RaspberryPi/AcpiTables/Dsdt.asl +++ b/Platform/RaspberryPi/AcpiTables/Dsdt.asl @@ -21,13 +21,6 @@ =20 #include "AcpiTables.h" =20 -#define BCM_ALT0 0x4 -#define BCM_ALT1 0x5 -#define BCM_ALT2 0x6 -#define BCM_ALT3 0x7 -#define BCM_ALT4 0x3 -#define BCM_ALT5 0x2 - // // The ASL compiler does not support argument arithmetic in functions // like QWordMemory (). So we need to instantiate dummy qword regions diff --git a/Platform/RaspberryPi/AcpiTables/GpuDevs.asl b/Platform/Raspber= ryPi/AcpiTables/GpuDevs.asl index 9750dc25c0..b1fd5a1387 100644 --- a/Platform/RaspberryPi/AcpiTables/GpuDevs.asl +++ b/Platform/RaspberryPi/AcpiTables/GpuDevs.asl @@ -203,56 +203,6 @@ Device (VCSM) } } =20 -// Description: GPIO -Device (GPI0) -{ - Name (_HID, "BCM2845") - Name (_CID, "BCM2845") - Name (_UID, 0x0) - Name (_CCA, 0x0) - Method (_STA) - { - Return(0xf) - } - Name (RBUF, ResourceTemplate () - { - MEMORY32FIXED (ReadWrite, 0, GPIO_LENGTH, RMEM) - Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) - { - BCM2386_GPIO_INTERRUPT0, BCM2386_GPIO_INTERRUPT1, - BCM2386_GPIO_INTERRUPT2, BCM2386_GPIO_INTERRUPT3 - } - }) - Method (_CRS, 0x0, Serialized) - { - MEMORY32SETBASE (RBUF, RMEM, RBAS, GPIO_OFFSET) - Return (^RBUF) - } -} - -// Description: I2C -Device (I2C1) -{ - Name (_HID, "BCM2841") - Name (_CID, "BCM2841") - Name (_UID, 0x1) - Name (_CCA, 0x0) - Method (_STA) - { - Return(0xf) - } - Name (RBUF, ResourceTemplate () - { - MEMORY32FIXED (ReadWrite, 0, BCM2836_I2C1_LENGTH, RMEM) - Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_I2C1= _INTERRUPT } - PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GDV0.GPI0", 0, Resour= ceConsumer, , ) { 2, 3 } - }) - Method (_CRS, 0x0, Serialized) - { - MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_I2C1_OFFSET) - Return (^RBUF) - } -} =20 // I2C2 is the HDMI DDC connection Device (I2C2) @@ -278,81 +228,6 @@ Device (I2C2) } } =20 -// SPI -Device (SPI0) -{ - Name (_HID, "BCM2838") - Name (_CID, "BCM2838") - Name (_UID, 0x0) - Name (_CCA, 0x0) - Method (_STA) - { - Return (0xf) - } - Name (RBUF, ResourceTemplate () - { - MEMORY32FIXED (ReadWrite, 0, BCM2836_SPI0_LENGTH, RMEM) - Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_SPI0= _INTERRUPT } - PinFunction (Exclusive, PullDown, BCM_ALT0, "\\_SB.GDV0.GPI0", 0, Reso= urceConsumer, , ) { 9, 10, 11 } // MISO, MOSI, SCLK - PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GDV0.GPI0", 0, Resour= ceConsumer, , ) { 8 } // CE0 - PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GDV0.GPI0", 0, Resour= ceConsumer, , ) { 7 } // CE1 - }) - - Method (_CRS, 0x0, Serialized) - { - MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_SPI0_OFFSET) - Return (^RBUF) - } -} - -Device (SPI1) -{ - Name (_HID, "BCM2839") - Name (_CID, "BCM2839") - Name (_UID, 0x1) - Name (_CCA, 0x0) - Name (_DEP, Package() { \_SB.GDV0.RPIQ }) - Method (_STA) - { - Return (0xf) - } - Name (RBUF, ResourceTemplate () - { - MEMORY32FIXED (ReadWrite, 0, BCM2836_SPI1_LENGTH, RMEM) - Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) { BCM2836_SPI= 1_INTERRUPT } - PinFunction (Exclusive, PullDown, BCM_ALT4, "\\_SB.GDV0.GPI0", 0, Reso= urceConsumer, , ) { 19, 20, 21 } // MISO, MOSI, SCLK - PinFunction (Exclusive, PullDown, BCM_ALT4, "\\_SB.GDV0.GPI0", 0, Reso= urceConsumer, , ) { 16 } // CE2 - }) - - Method (_CRS, 0x0, Serialized) - { - MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_SPI1_OFFSET) - Return (^RBUF) - } -} - -// SPI2 has no pins on GPIO header -// Device (SPI2) -// { -// Name (_HID, "BCM2839") -// Name (_CID, "BCM2839") -// Name (_UID, 0x2) -// Name (_CCA, 0x0) -// Name (_DEP, Package() { \_SB.GDV0.RPIQ }) -// Method (_STA) -// { -// Return (0xf) // Disabled -// } -// Method (_CRS, 0x0, Serialized) -// { -// Name (RBUF, ResourceTemplate () -// { -// MEMORY32FIXED (ReadWrite, BCM2836_SPI2_BASE_ADDRESS, BCM2836_SPI2= _LENGTH, RMEM) -// Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) { BCM283= 6_SPI2_INTERRUPT } -// }) -// Return (RBUF) -// } -// } =20 // PWM Driver Device (PWM0) diff --git a/Platform/RaspberryPi/AcpiTables/SsdtGpio.asl b/Platform/Raspbe= rryPi/AcpiTables/SsdtGpio.asl new file mode 100644 index 0000000000..0c8e1455d3 --- /dev/null +++ b/Platform/RaspberryPi/AcpiTables/SsdtGpio.asl @@ -0,0 +1,157 @@ +/** @file + * + * Secondary System Description Table (SSDT) for the GPIO port + * + * Copyright (c) 2021, Arm Ltd. All rights reserved. + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +#include +#include +#include +#include + +#include "AcpiTables.h" + +#define BCM_ALT0 0x4 +#define BCM_ALT1 0x5 +#define BCM_ALT2 0x6 +#define BCM_ALT3 0x7 +#define BCM_ALT4 0x3 +#define BCM_ALT5 0x2 + +DefinitionBlock (__FILE__, "SSDT", 5, "RPIFDN", "RPI3GPIO", 2) +{ + External (\_SB_.GDV0, DeviceObj) + External (\_SB_.GDV0.RPIQ, DeviceObj) + Scope (\_SB_.GDV0) + { + // Description: GPIO + Device (GPI0) + { + Name (_HID, "BCM2845") + Name (_CID, "BCM2845") + Name (_UID, 0x0) + Name (_CCA, 0x0) + Method (_STA) + { + Return(0xf) + } + Name (RBUF, ResourceTemplate () + { + MEMORY32FIXED (ReadWrite, 0, GPIO_LENGTH, RMEM) + Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) + { + BCM2386_GPIO_INTERRUPT0, BCM2386_GPIO_INTERRUPT1, + BCM2386_GPIO_INTERRUPT2, BCM2386_GPIO_INTERRUPT3 + } + }) + Method (_CRS, 0x0, Serialized) + { + MEMORY32SETBASE (RBUF, RMEM, RBAS, GPIO_OFFSET) + Return (^RBUF) + } + } + + // SPI + Device (SPI0) + { + Name (_HID, "BCM2838") + Name (_CID, "BCM2838") + Name (_UID, 0x0) + Name (_CCA, 0x0) + Method (_STA) + { + Return (0xf) + } + Name (RBUF, ResourceTemplate () + { + MEMORY32FIXED (ReadWrite, 0, BCM2836_SPI0_LENGTH, RMEM) + Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_SPI0_IN= TERRUPT } + PinFunction (Exclusive, PullDown, BCM_ALT0, "\\_SB.GDV0.GPI0", 0, Resourc= eConsumer, , ) { 9, 10, 11 } // MISO, MOSI, SCLK + PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GDV0.GPI0", 0, ResourceC= onsumer, , ) { 8 } // CE0 + PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GDV0.GPI0", 0, ResourceC= onsumer, , ) { 7 } // CE1 + }) + + Method (_CRS, 0x0, Serialized) + { + MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_SPI0_OFFSET) + Return (^RBUF) + } + } + + Device (SPI1) + { + Name (_HID, "BCM2839") + Name (_CID, "BCM2839") + Name (_UID, 0x1) + Name (_CCA, 0x0) + Name (_DEP, Package() { \_SB.GDV0.RPIQ }) + Method (_STA) + { + Return (0xf) + } + Name (RBUF, ResourceTemplate () + { + MEMORY32FIXED (ReadWrite, 0, BCM2836_SPI1_LENGTH, RMEM) + Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) { BCM2836_SPI1_I= NTERRUPT } + PinFunction (Exclusive, PullDown, BCM_ALT4, "\\_SB_.GDV0.GPI0", 0, Resour= ceConsumer, , ) { 19, 20, 21 } // MISO, MOSI, SCLK + PinFunction (Exclusive, PullDown, BCM_ALT4, "\\_SB_.GDV0.GPI0", 0, Resour= ceConsumer, , ) { 16 } // CE2 + }) + + Method (_CRS, 0x0, Serialized) + { + MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_SPI1_OFFSET) + Return (^RBUF) + } + } + + // SPI2 has no pins on GPIO header + // Device (SPI2) + // { + // Name (_HID, "BCM2839") + // Name (_CID, "BCM2839") + // Name (_UID, 0x2) + // Name (_CCA, 0x0) + // Name (_DEP, Package() { \_SB.GDV0.RPIQ }) + // Method (_STA) + // { + // Return (0xf) // Disabled + // } + // Method (_CRS, 0x0, Serialized) + // { + // Name (RBUF, ResourceTemplate () + // { + // MEMORY32FIXED (ReadWrite, BCM2836_SPI2_BASE_ADDRESS, BCM2836_SP= I2_LENGTH, RMEM) + // Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) { BCM2= 836_SPI2_INTERRUPT } + // }) + // Return (RBUF) + // } + // } + + Device (I2C1) + { + Name (_HID, "BCM2841") + Name (_CID, "BCM2841") + Name (_UID, 0x1) + Name (_CCA, 0x0) + Method (_STA) + { + Return(0xf) + } + Name (RBUF, ResourceTemplate () + { + MEMORY32FIXED (ReadWrite, 0, BCM2836_I2C1_LENGTH, RMEM) + Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_I2C1_IN= TERRUPT } + PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB_.GDV0.GPI0", 0, Resource= Consumer, , ) { 2, 3 } + }) + Method (_CRS, 0x0, Serialized) + { + MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_I2C1_OFFSET) + Return (^RBUF) + } + } + } +} diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/= RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c index bdabdec7a5..d22ecb3128 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c @@ -838,6 +838,12 @@ STATIC CONST NAMESPACE_TABLES SdtTables[] =3D { NULL }, #endif + { + SIGNATURE_64 ('R', 'P', 'I', '3', 'G', 'P', 'I', 'O'), + 0, + 0, + NULL + }, { // DSDT SIGNATURE_64 ('R', 'P', 'I', 0, 0, 0, 0, 0), 0, --=20 2.13.7 -=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 (#83638): https://edk2.groups.io/g/devel/message/83638 Mute This Topic: https://groups.io/mt/86979575/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 Apr 25 08:22:39 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+83639+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+83639+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1636631871; cv=none; d=zohomail.com; s=zohoarc; b=dKp+4sJT5iVs0mpZECo6MeVhGvw7Ob/CAoxVxGnTZa9v5/2GEk9g9+7XKIQl3w77DcLkSuPZV1QDykbmZ7GLAs/D/KOdWyRuAQNRz2KEUNfi6ebbnwchHEeARb1lCXuldrpDL82P4sOYrltZXLObKiTeUbw9TrOENhbg+Qaf958= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636631871; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=lTW0R/gFM7+Q51qmvVX3usMi3pJ+tFigvc50ZIoloWI=; b=Uwe/AaXxuPeEnCo9oH3xwGRnvWlmKXV3mrVKqaDh6/2CcaQBA2dr3YVByigsT2S+bLCDU9y6/02pmiFZSVW9pOGxymmgmZ+aoBSriAHtmCEn7+Ml95jnHGsmv8qEFfI7v1k+4GL/FlMVmsHjevcAcRx88ed/oy8xSiNEkGkJIqE= 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+83639+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 163663187105878.07875514364343; Thu, 11 Nov 2021 03:57:51 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 0xgLYY1788612xBJrDm0ZSRj; Thu, 11 Nov 2021 03:57:50 -0800 X-Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) by mx.groups.io with SMTP id smtpd.web08.7415.1636613881747050615 for ; Wed, 10 Nov 2021 22:58:01 -0800 X-Received: by mail-oi1-f174.google.com with SMTP id o83so9954590oif.4 for ; Wed, 10 Nov 2021 22:58:01 -0800 (PST) X-Gm-Message-State: 3D65f3RonVYqI2J1N2RWl8bwx1787277AA= X-Google-Smtp-Source: ABdhPJypu/Kzkzs+ZTKd6DbfYh9O1GzLdt0SUcsyvLIQ7DTzR0cYqmdaf1jSNMvJtJyWVVYkbJodMQ== X-Received: by 2002:a05:6808:14d6:: with SMTP id f22mr4304639oiw.101.1636613880699; Wed, 10 Nov 2021 22:58:00 -0800 (PST) X-Received: from dell-suse.jhome.net (072-191-152-022.res.spectrum.com. [72.191.152.22]) by smtp.gmail.com with ESMTPSA id y12sm649206oiv.49.2021.11.10.22.57.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Nov 2021 22:58:00 -0800 (PST) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: pete@akeo.ie, ardb+tianocore@kernel.org, leif@nuviainc.com, awarkentin@vmware.com, Sunny.Wang@arm.com, samer.el-haj-mahmoud@arm.com, Jeremy Linton Subject: [edk2-devel] [PATCH 4/4] Platform/RaspberryPi: Add menu item to enable/disable GPIO Date: Thu, 11 Nov 2021 00:57:42 -0600 Message-Id: <20211111065742.8923-6-lintonrjeremy@gmail.com> In-Reply-To: <20211111065742.8923-1-lintonrjeremy@gmail.com> References: <20211111065742.8923-1-lintonrjeremy@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,lintonrjeremy@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1636631870; bh=8UvBX2DHFu99Tl0ZC3ey59kt/NJd5omajD1cKxN0COM=; h=Cc:Date:From:Reply-To:Subject:To; b=DSEur+j+aMeRk6gX4PA2v7YxZ5ok0KRLrNDybDfk0wXZ+OIP5/0FQMYM71aVDBSmCk7 kc4OeNAtcxSHJRDpA45rvbcVd04LULp4nz4wQoILi/cPgC7AX61D0XmkXsrfwsgNM+pZF C5sbbfn0hmpfWIcM39SZ/QRi5WKeQ0LML1k= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1636631871309100017 Content-Type: text/plain; charset="utf-8" Now that the GPIO devices are in their own SSDT lets add a menu item for the rpi4 to enable/disable it. For the rpi3 the SSDT is always exported. Signed-off-by: Jeremy Linton --- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 17 +++++++++++++= +++- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 1 + Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni | 5 +++++ Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 15 +++++++++++++= ++ Platform/RaspberryPi/Include/ConfigVars.h | 4 ++++ Platform/RaspberryPi/RPi3/RPi3.dsc | 6 ++++++ Platform/RaspberryPi/RPi4/RPi4.dsc | 7 +++++++ Platform/RaspberryPi/RaspberryPi.dec | 1 + 8 files changed, 55 insertions(+), 1 deletion(-) diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/= RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c index d22ecb3128..794d056dc6 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c @@ -308,12 +308,27 @@ SetupVariables ( } =20 } + + Size =3D sizeof (UINT32); + Status =3D gRT->GetVariable (L"EnableGpio", + &gConfigDxeFormSetGuid, + NULL, &Size, &Var32); + if (EFI_ERROR (Status)) { + Status =3D PcdSet32S (PcdEnableGpio, PcdGet32 (PcdEnableGpio)); + ASSERT_EFI_ERROR (Status); + } + } else { /* * Disable PCIe and XHCI */ Status =3D PcdSet32S (PcdXhciPci, 0); ASSERT_EFI_ERROR (Status); + /* + * Enable GPIO + */ + Status =3D PcdSet32S (PcdEnableGpio, 1); + ASSERT_EFI_ERROR (Status); } =20 Size =3D sizeof (AssetTagVar); @@ -840,7 +855,7 @@ STATIC CONST NAMESPACE_TABLES SdtTables[] =3D { #endif { SIGNATURE_64 ('R', 'P', 'I', '3', 'G', 'P', 'I', 'O'), - 0, + PcdToken(PcdEnableGpio), 0, NULL }, diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platfor= m/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf index ff182e831d..1cba4a2a22 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf @@ -96,6 +96,7 @@ gRaspberryPiTokenSpaceGuid.PcdUartInUse gRaspberryPiTokenSpaceGuid.PcdXhciPci gRaspberryPiTokenSpaceGuid.PcdXhciReload + gRaspberryPiTokenSpaceGuid.PcdEnableGpio =20 [Depex] gPcdProtocolGuid AND gRaspberryPiFirmwareProtocolGuid diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni index 8130638876..8fcb6a3949 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni @@ -67,6 +67,11 @@ #string STR_ADVANCED_XHCIRELOAD_DISABLE #language en-US "Disabled" #string STR_ADVANCED_XHCIRELOAD_RELOAD #language en-US "Reload" =20 +#string STR_ADVANCED_ENABLEGPIO_PROMPT #language en-US "Export GPIO devic= es to OS" +#string STR_ADVANCED_ENABLEGPIO_HELP #language en-US "OS can see the GP= IO device and some low level SPI and I2C interfaces" +#string STR_ADVANCED_ENABLEGPIO_DISABLE #language en-US "Disabled" +#string STR_ADVANCED_ENABLEGPIO_ENABLE #language en-US "Enable" + #string STR_ADVANCED_ASSET_TAG_PROMPT #language en-US "Asset Tag" #string STR_ADVANCED_ASSET_TAG_HELP #language en-US "Set the system Asse= t Tag" =20 diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr index f13b70711d..04eb0a15a2 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr @@ -66,6 +66,11 @@ formset name =3D XhciReload, guid =3D CONFIGDXE_FORM_SET_GUID; =20 + efivarstore ADVANCED_ENABLEGPIO_VARSTORE_DATA, + attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME= _ACCESS | EFI_VARIABLE_NON_VOLATILE, + name =3D EnableGpio, + guid =3D CONFIGDXE_FORM_SET_GUID; + efivarstore SYSTEM_TABLE_MODE_VARSTORE_DATA, attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME= _ACCESS | EFI_VARIABLE_NON_VOLATILE, name =3D SystemTableMode, @@ -244,6 +249,16 @@ formset endoneof; endif; endif; + + grayoutif ideqval SystemTableMode.Mode =3D=3D SYSTEM_TABLE_MODE_DT; + oneof varid =3D EnableGpio.Value, + prompt =3D STRING_TOKEN(STR_ADVANCED_ENABLEGPIO_PROMPT), + help =3D STRING_TOKEN(STR_ADVANCED_ENABLEGPIO_HELP), + flags =3D NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED, + option text =3D STRING_TOKEN(STR_ADVANCED_ENABLEGPIO_DISABLE),= value =3D 0, flags =3D DEFAULT; + option text =3D STRING_TOKEN(STR_ADVANCED_ENABLEGPIO_ENABLE), = value =3D 1, flags =3D 0; + endoneof; + endif; #endif string varid =3D AssetTag.AssetTag, prompt =3D STRING_TOKEN(STR_ADVANCED_ASSET_TAG_PROMPT), diff --git a/Platform/RaspberryPi/Include/ConfigVars.h b/Platform/Raspberry= Pi/Include/ConfigVars.h index a5b32b5284..43a39891d4 100644 --- a/Platform/RaspberryPi/Include/ConfigVars.h +++ b/Platform/RaspberryPi/Include/ConfigVars.h @@ -81,6 +81,10 @@ typedef struct { } ADVANCED_XHCIPCI_VARSTORE_DATA; =20 typedef struct { + UINT32 Value; +} ADVANCED_ENABLEGPIO_VARSTORE_DATA; + +typedef struct { #define SYSTEM_TABLE_MODE_ACPI 0 #define SYSTEM_TABLE_MODE_BOTH 1 #define SYSTEM_TABLE_MODE_DT 2 diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3= /RPi3.dsc index 72fafb7195..1d59cda4a7 100644 --- a/Platform/RaspberryPi/RPi3/RPi3.dsc +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc @@ -532,6 +532,12 @@ # gRaspberryPiTokenSpaceGuid.PcdXhciReload|L"XhciReload"|gConfigDxeFormSet= Guid|0x0|0 =20 + # Export GPIO block to OS + # + # 1 - Yes (for legacy reasons) + # + gRaspberryPiTokenSpaceGuid.PcdEnableGpio|L"EnableGpio"|gConfigDxeFormSet= Guid|0x0|1 + # # Common UEFI ones. # diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4= /RPi4.dsc index 6de4407749..c918af6dab 100644 --- a/Platform/RaspberryPi/RPi4/RPi4.dsc +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc @@ -551,6 +551,13 @@ # gRaspberryPiTokenSpaceGuid.PcdXhciReload|L"XhciReload"|gConfigDxeFormSet= Guid|0x0|0 =20 + # Export GPIO block to OS + # + # 0 - No + # 1 - Yes + # + gRaspberryPiTokenSpaceGuid.PcdEnableGpio|L"EnableGpio"|gConfigDxeFormSet= Guid|0x0|0 + # # Common UEFI ones. # diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/Ra= spberryPi.dec index c50ebdcf77..97709f9b94 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.PcdXhciReload|0|UINT32|0x00000023 + gRaspberryPiTokenSpaceGuid.PcdEnableGpio|0|UINT32|0x00000024 --=20 2.13.7 -=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 (#83639): https://edk2.groups.io/g/devel/message/83639 Mute This Topic: https://groups.io/mt/86979576/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-