From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.48987.1597687823439068917 for ; Mon, 17 Aug 2020 11:10:23 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: jeremy.linton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9D2DA31B; Mon, 17 Aug 2020 11:10:22 -0700 (PDT) Received: from [192.168.122.166] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5CD203F66B; Mon, 17 Aug 2020 11:10:22 -0700 (PDT) Subject: Re: [PATCH 3/3] Platform/RaspberryPi: Add entry for user fan control To: Pete Batard , devel@edk2.groups.io Cc: Leif Lindholm , Andrei Warkentin , Ard Biesheuvel , Samer El-Haj-Mahmoud References: <20200813230056.40526-1-jeremy.linton@arm.com> <20200813230056.40526-4-jeremy.linton@arm.com> From: "Jeremy Linton" Message-ID: Date: Mon, 17 Aug 2020 13:10:17 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hi, Thanks for taking a look at this, I will roll another version with the=20 suggested changes. It seems my space '(' rules are broken :) On 8/17/20 6:10 AM, Pete Batard wrote: > More minor style issues: >=20 > On 2020.08.14 00:00, Jeremy Linton wrote: >> Add a menu item that allows the user to enable GPIO based >> fan control via SSDT. This should only be seen/enabled on RPI4 >> because that is what its been tested with. As of this commit >> its currently limited to only operating on a single GPIO pin (19). >> >> Given GPIO pin current limitations its likely that a bit of >> additional circuitry is required to drive a fan, and the GPIO >> high/low signal can only be used as a enable/disable signal. A >> search for "rpi npn gpio fan" or similar should turn up some >> hits for how to do this simply. >> >> It appears there are a couple boards (fan SHIM) which operate this >> way, and probably should have custom menu items/SSDT edits as >> people acquire the boards and test them. >> >> Cc: Leif Lindholm >> Cc: Pete Batard >> Cc: Andrei Warkentin >> Cc: Ard Biesheuvel >> Cc: Samer El-Haj-Mahmoud >> Signed-off-by: Jeremy Linton >> --- >> =C2=A0 Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 55=20 >> ++++++++++++++++++++++ >> =C2=A0 .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf=C2=A0=C2=A0=C2=A0= |=C2=A0 3 ++ >> =C2=A0 .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni |=C2=A0 5 ++ >> =C2=A0 .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 17 +++++++ >> =C2=A0 Platform/RaspberryPi/Include/ConfigVars.h=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 4 ++ >> =C2=A0 Platform/RaspberryPi/RPi3/RPi3.dsc=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0= 5 ++ >> =C2=A0 Platform/RaspberryPi/RPi4/RPi4.dsc=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0= 8 ++++ >> =C2=A0 Platform/RaspberryPi/RaspberryPi.dec=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 1 + >> =C2=A0 .../Bcm27xx/Include/IndustryStandard/Bcm2711.h=C2=A0=C2=A0=C2=A0= =C2=A0 |=C2=A0 2 + >> =C2=A0 9 files changed, 100 insertions(+) >> >> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c=20 >> b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c >> index af54136ade..f10347be64 100644 >> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c >> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c >> @@ -15,6 +15,7 @@ >> =C2=A0 #include >> >> =C2=A0 #include >> >> =C2=A0 #include >> >> +#include >> >> =C2=A0 #include >> >> =C2=A0 #include >> >> =C2=A0 #include >> >> @@ -22,6 +23,7 @@ >> =C2=A0 #include >> >> =C2=A0 #include >> >> =C2=A0 #include >> >> +#include >> >> =C2=A0 #include >> >> =C2=A0 #include >> >> =C2=A0 #include >> >> @@ -246,6 +248,14 @@ SetupVariables ( >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ASSERT_EFI_ERROR (Status); >> >> =C2=A0=C2=A0=C2=A0 } >> >> >> +=C2=A0 Size =3D sizeof (UINT32); >> >> +=C2=A0 Status =3D gRT->GetVariable (L"FanOnGpio", >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 &gConfigDxeFormSetGuid, >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 NULL, &Size, &Var32); >> >> +=C2=A0 if (EFI_ERROR (Status)) { >> >> +=C2=A0=C2=A0=C2=A0 PcdSet32 (PcdFanOnGpio, PcdGet32 (PcdFanOnGpio)); >> >> +=C2=A0 } >> >> + >> >> =C2=A0=C2=A0=C2=A0 Size =3D sizeof(AssetTagVar); >=20 > Space before '(' >=20 >> >> >> =C2=A0=C2=A0=C2=A0 Status =3D gRT->GetVariable(L"AssetTag", >=20 > Space before '(' >=20 >> >> @@ -368,6 +378,7 @@ ApplyVariables ( >> =C2=A0=C2=A0=C2=A0 UINT32 CpuClock =3D PcdGet32 (PcdCpuClock); >> >> =C2=A0=C2=A0=C2=A0 UINT32 CustomCpuClock =3D PcdGet32 (PcdCustomCpuClo= ck); >> >> =C2=A0=C2=A0=C2=A0 UINT32 Rate =3D 0; >> >> +=C2=A0 UINT32 FanOnGpio =3D PcdGet32 (PcdFanOnGpio); >> >> >> =C2=A0=C2=A0=C2=A0 switch (CpuClock) { >> >> =C2=A0=C2=A0=C2=A0 case CHIPSET_CPU_CLOCK_LOW: >> >> @@ -565,8 +576,49 @@ ApplyVariables ( >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 GpioPinFuncSet (23, GPIO_FSEL_INPUT); >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 GpioPinFuncSet (24, GPIO_FSEL_INPUT); >> >> =C2=A0=C2=A0=C2=A0 } >> >> + >> >> +=C2=A0 if (FanOnGpio) { >> >> +=C2=A0=C2=A0=C2=A0 DEBUG ((DEBUG_INFO, "Fan enabled on GPIO %d\n", Fa= nOnGpio)); >> >> +=C2=A0=C2=A0=C2=A0 GpioPinFuncSet(FanOnGpio, GPIO_FSEL_OUTPUT); >=20 > Space before '(' >> >> +=C2=A0 } >> >> =C2=A0 } >> >> >> +EFI_STATUS >> >> +FindInstallSsdt(UINT64 OemTableId) >=20 > Space before '(' >=20 >> >> +{ >> >> +=C2=A0 EFI_ACPI_TABLE_PROTOCOL=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 *AcpiTable; >> >> +=C2=A0 UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 Index; >> >> +=C2=A0 EFI_ACPI_DESCRIPTION_HEADER=C2=A0=C2=A0=C2=A0=C2=A0 *Ssdt; >> >> +=C2=A0 UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 SsdtSize; >> >> +=C2=A0 EFI_STATUS=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = Status; >> >> +=C2=A0 UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 TableKey; >> >> + >> >> + >> >> +=C2=A0 Status =3D gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NU= LL, >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (VOID **)&AcpiTable); >> >> +=C2=A0 if (EFI_ERROR (Status)) { >> >> +=C2=A0=C2=A0=C2=A0 return Status; >> >> +=C2=A0 } >> >> + >> >> +=C2=A0 for (Index =3D 0; !EFI_ERROR(Status); Index++) { >=20 > Space before '(' >=20 >> >> +=C2=A0=C2=A0=C2=A0 Status =3D GetSectionFromFv (&gEfiCallerIdGuid, EF= I_SECTION_RAW,=20 >> Index, >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (VOID **)&Ssdt, &SsdtSize); >> >> +=C2=A0=C2=A0=C2=A0 if (Ssdt->OemTableId =3D=3D OemTableId) >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break; >=20 > Indentation should be 2 spaces after 'if' >=20 >> >> +=C2=A0=C2=A0=C2=A0 SsdtSize =3D 0; >> >> +=C2=A0 } >> >> + >> >> +=C2=A0 if (SsdtSize > 0) { >> >> +=C2=A0=C2=A0=C2=A0 Status =3D AcpiTable->InstallAcpiTable (AcpiTable,= Ssdt, SsdtSize, >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 &TableKey); >> >> +=C2=A0=C2=A0=C2=A0 if (EFI_ERROR (Status)) { >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DEBUG ((DEBUG_WARN, "%a: failed to ins= tall SSDT table %r\n", >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 __FUNCTION__, Status)); >> >> +=C2=A0=C2=A0=C2=A0 } >> >> +=C2=A0 } >> >> + >> >> +=C2=A0 return Status; >> >> +} >> >> >> =C2=A0 EFI_STATUS >> >> =C2=A0 EFIAPI >> >> @@ -620,6 +672,9 @@ ConfigInitialize ( >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 PcdGet32 (PcdSystemTableMod= e) =3D=3D SYSTEM_TABLE_MODE_BOTH) { >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Status =3D LocateAndInstallAcpiFr= omFv (&mAcpiTableFile); >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ASSERT_EFI_ERROR (Status); >> >> +=C2=A0=C2=A0=C2=A0=C2=A0 if (PcdGet32 (PcdFanOnGpio)) { >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 FindInstallSsdt(SIGN= ATURE_64 ('R', 'P', 'I', 'T', 'H', 'F',=20 >> 'A', 'N')); >=20 > Space before '(' and indentation should be 2 spaces after 'if' >=20 >> >> +=C2=A0=C2=A0=C2=A0=C2=A0 } >> >> =C2=A0=C2=A0=C2=A0 } >> >> >> =C2=A0=C2=A0=C2=A0 Status =3D gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, T= PL_NOTIFY,=20 >> RegisterDevices, >> >> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf=20 >> b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf >> index cdce35bc74..fe3a01a570 100644 >> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf >> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf >> @@ -28,6 +28,7 @@ >> =C2=A0=C2=A0=C2=A0 ConfigDxeFormSetGuid.h >> >> =C2=A0=C2=A0=C2=A0 ConfigDxeHii.vfr >> >> =C2=A0=C2=A0=C2=A0 ConfigDxeHii.uni >> >> +=C2=A0 SsdtThermal.asl >> >> =C2=A0=C2=A0=C2=A0 XhciQuirk.c >> >> >> =C2=A0 [Packages] >> >> @@ -46,6 +47,7 @@ >> =C2=A0=C2=A0=C2=A0 AcpiLib >> >> =C2=A0=C2=A0=C2=A0 BaseLib >> >> =C2=A0=C2=A0=C2=A0 DebugLib >> >> +=C2=A0 DxeServicesLib >> >> =C2=A0=C2=A0=C2=A0 DxeServicesTableLib >> >> =C2=A0=C2=A0=C2=A0 GpioLib >> >> =C2=A0=C2=A0=C2=A0 HiiLib >> >> @@ -89,6 +91,7 @@ >> =C2=A0=C2=A0=C2=A0 gRaspberryPiTokenSpaceGuid.PcdSystemTableMode >> >> =C2=A0=C2=A0=C2=A0 gRaspberryPiTokenSpaceGuid.PcdRamMoreThan3GB >> >> =C2=A0=C2=A0=C2=A0 gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB >> >> +=C2=A0 gRaspberryPiTokenSpaceGuid.PcdFanOnGpio >> >> >> =C2=A0 [Depex] >> >> =C2=A0=C2=A0=C2=A0 gPcdProtocolGuid AND gRaspberryPiFirmwareProtocolGu= id >> >> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni=20 >> b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni >> index 03763710a1..491d022fff 100644 >> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni >> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni >> @@ -48,6 +48,11 @@ >> =C2=A0 #string STR_ADVANCED_SYSTAB_BOTH=C2=A0=C2=A0=C2=A0=C2=A0 #langu= age en-US "ACPI +=20 >> Devicetree" >> >> =C2=A0 #string STR_ADVANCED_SYSTAB_DT=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 #language en-US "Devicetree" >> >> >> +#string STR_ADVANCED_FANONGPIO_PROMPT #language en-US "ACPI fan contr= ol" >> >> +#string STR_ADVANCED_FANONGPIO_HELP=C2=A0=C2=A0 #language en-US "Cycl= e a fan=20 >> via GPIO-19 if temp exceeds 60C" >> >> +#string STR_ADVANCED_FANONGPIO_OFF=C2=A0=C2=A0=C2=A0 #language en-US = "Disabled" >> >> +#string STR_ADVANCED_FANONGPIO_ON=C2=A0=C2=A0=C2=A0=C2=A0 #language e= n-US "Enabled" >> >> + >> >> =C2=A0 #string STR_ADVANCED_ASSET_TAG_PROMPT #language en-US "Asset Ta= g" >> >> =C2=A0 #string STR_ADVANCED_ASSET_TAG_HELP=C2=A0=C2=A0 #language en-US= "Set the=20 >> system Asset Tag" >> >> >> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr=20 >> b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr >> index d5615d7af0..0a5e4163e8 100644 >> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr >> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr >> @@ -10,6 +10,7 @@ >> =C2=A0 #include >> >> =C2=A0 #include "ConfigDxeFormSetGuid.h" >> >> =C2=A0 #include >> >> +#include >> >> >> =C2=A0 // >> >> =C2=A0 // EFI Variable attributes >> >> @@ -45,6 +46,11 @@ formset >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 name=C2=A0 =3D RamLimitTo3G= B, >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 guid=C2=A0 =3D CONFIGDXE_FO= RM_SET_GUID; >> >> >> +=C2=A0=C2=A0=C2=A0 efivarstore ADVANCED_FAN_ON_GPIO_VARSTORE_DATA, >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 attribute =3D EFI_VARIABLE_BOOTSERVICE= _ACCESS |=20 >> EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 name=C2=A0 =3D FanOnGpio, >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 guid=C2=A0 =3D CONFIGDXE_FORM_SET_GUID= ; >> >> + >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 efivarstore SYSTEM_TABLE_MODE_VARSTORE_= DATA, >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 attribute =3D EFI_VARIABLE_= BOOTSERVICE_ACCESS |=20 >> EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 name=C2=A0 =3D SystemTableM= ode, >> >> @@ -174,6 +180,17 @@ formset >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 option text =3D STRING_TOKEN(STR_ADVANCED_SYSTAB_DT),=20 >> value =3D SYSTEM_TABLE_MODE_DT, flags =3D DEFAULT; >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 endoneof; >> >> >> +#if (RPI_MODEL =3D=3D 4) >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 grayoutif NOT ideqval Syst= emTableMode.Mode =3D=3D=20 >> SYSTEM_TABLE_MODE_ACPI; >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 oneof varid =3D= FanOnGpio.Enabled, >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 prompt=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D STRING_TOKEN(STR_ADVAN= CED_FANONGPIO_PROMPT), >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 help=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D STRING_TOKEN= (STR_ADVANCED_FANONGPIO_HELP), >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 flags=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D NUMERIC_SIZE_4 | = INTERACTIVE |=20 >> RESET_REQUIRED, >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 option text =3D STRING_TOKEN(STR_ADVANCED_FANONGPIO_OFF),=20 >> value =3D 0, flags =3D DEFAULT; >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 option text =3D STRING_TOKEN(STR_ADVANCED_FANONGPIO_ON),=20 >> value =3D GPIO_FAN_PIN, flags =3D 0; >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 endoneof; >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 endif; >> >> +#endif >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 string varid =3D= AssetTag.AssetTag, >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 prompt=C2=A0 =3D STRING_TOKEN(STR_ADVANCED_ASSET_TAG_PROMPT), >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 help=C2=A0=C2=A0=C2=A0 =3D STRING_TOKEN(STR_ADVANCED_ASSET_TAG_HEL= P), >> >> diff --git a/Platform/RaspberryPi/Include/ConfigVars.h=20 >> b/Platform/RaspberryPi/Include/ConfigVars.h >> index b1689b004d..1a40469bfa 100644 >> --- a/Platform/RaspberryPi/Include/ConfigVars.h >> +++ b/Platform/RaspberryPi/Include/ConfigVars.h >> @@ -69,6 +69,10 @@ typedef struct { >> =C2=A0 } ADVANCED_RAM_LIMIT_TO_3GB_VARSTORE_DATA; >> >> >> =C2=A0 typedef struct { >> >> +=C2=A0 UINT32 Enabled; >> >> +} ADVANCED_FAN_ON_GPIO_VARSTORE_DATA; >> >> + >> >> +typedef struct { >> >> =C2=A0 #define SYSTEM_TABLE_MODE_ACPI 0 >> >> =C2=A0 #define SYSTEM_TABLE_MODE_BOTH 1 >> >> =C2=A0 #define SYSTEM_TABLE_MODE_DT=C2=A0=C2=A0 2 >> >> diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc=20 >> b/Platform/RaspberryPi/RPi3/RPi3.dsc >> index 0998d8366c..cef8932ca2 100644 >> --- a/Platform/RaspberryPi/RPi3/RPi3.dsc >> +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc >> @@ -499,6 +499,11 @@ >> =20 >> gRaspberryPiTokenSpaceGuid.PcdSystemTableMode|L"SystemTableMode"|gConf= igDxeFormSetGuid|0x0|1=20 >> >> >> >> =C2=A0=C2=A0=C2=A0 # >> >> +=C2=A0 # Enable a fan in the ACPI thermal zone on GPIO pin # >> >> +=C2=A0 # >> >> + =20 >> gRaspberryPiTokenSpaceGuid.PcdFanOnGpio|L"FanOnGpio"|gConfigDxeFormSet= Guid|0x0|0=20 >> >> >> + >> >> +=C2=A0 # >> >> =C2=A0=C2=A0=C2=A0 # Common UEFI ones. >> >> =C2=A0=C2=A0=C2=A0 # >> >> >> diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc=20 >> b/Platform/RaspberryPi/RPi4/RPi4.dsc >> index baa7e63483..9d0eaf10a1 100644 >> --- a/Platform/RaspberryPi/RPi4/RPi4.dsc >> +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc >> @@ -510,6 +510,14 @@ >> =20 >> gRaspberryPiTokenSpaceGuid.PcdSystemTableMode|L"SystemTableMode"|gConf= igDxeFormSetGuid|0x0|0=20 >> >> >> >> =C2=A0=C2=A0=C2=A0 # >> >> +=C2=A0 # Enable a fan in the ACPI thermal zone on GPIO pin # >> >> +=C2=A0 # >> >> +=C2=A0 # 0=C2=A0 - DISABLED >> >> +=C2=A0 # 19 - Enabled on pin 19 >> >> +=C2=A0 # >> >> + =20 >> gRaspberryPiTokenSpaceGuid.PcdFanOnGpio|L"FanOnGpio"|gConfigDxeFormSet= Guid|0x0|0=20 >> >> >> + >> >> +=C2=A0 # >> >> =C2=A0=C2=A0=C2=A0 # Common UEFI ones. >> >> =C2=A0=C2=A0=C2=A0 # >> >> >> diff --git a/Platform/RaspberryPi/RaspberryPi.dec=20 >> b/Platform/RaspberryPi/RaspberryPi.dec >> index c71177a2f7..a73650f2c3 100644 >> --- a/Platform/RaspberryPi/RaspberryPi.dec >> +++ b/Platform/RaspberryPi/RaspberryPi.dec >> @@ -66,3 +66,4 @@ >> =C2=A0=C2=A0=C2=A0 gRaspberryPiTokenSpaceGuid.PcdSystemTableMode|1|UIN= T32|0x0000001B >> >> =C2=A0=C2=A0=C2=A0 gRaspberryPiTokenSpaceGuid.PcdRamMoreThan3GB|0|UINT= 32|0x00000019 >> >> =C2=A0=C2=A0=C2=A0 gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB|0|UINT3= 2|0x0000001A >> >> +=C2=A0 gRaspberryPiTokenSpaceGuid.PcdFanOnGpio|0|UINT32|0x0000001C >> >> diff --git=20 >> a/Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h=20 >> b/Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h >> index e9c81cafa1..7d9ea5d35c 100644 >> --- a/Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h >> +++ b/Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h >> @@ -86,4 +86,6 @@ >> =C2=A0 #define GENET_BASE_ADDRESS=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 FixedPcdGet64=20 >> (PcdBcmGenetRegistersAddress) >> >> =C2=A0 #define GENET_LENGTH=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 0x00010000 >> >> >> +#define GPIO_FAN_PIN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 19 // fan shim uses GPIO 18 >> >> + >> >> =C2=A0 #endif /* BCM2711_H__ */ >> >=20 > Reviewed-by: Pete Batard