[edk2-devel] [PATCH v2 1/4] Platform/RaspberryPi4: Add a basic thermal zone

Jeremy Linton jeremy.linton at arm.com
Thu Aug 27 15:21:37 UTC 2020


On 8/27/20 3:06 AM, Ard Biesheuvel wrote:
> On 8/20/20 4:41 PM, Jeremy Linton wrote:
>> Hi,
>>
>> On 8/20/20 2:59 AM, Ard Biesheuvel wrote:
>>> On 8/20/20 6:42 AM, Jeremy Linton wrote:
>>>> Rather than exporting the temp sensor or mailbox
>>>> in ACPI land we can wrap them in AML and use the default
>>>> ACPI drivers provided by the OS. This enables the use of
>>>> "sensors" in linux to report the SOC temp.
>>>>
>>>> This commit also adds a basic passive cooling ACPI thermalzone
>>>> with trip points for passive cooling (throttling) handled
>>>> by the vc firmware, hibernate and critical shutdown. The
>>>> vc apparently kicks in at ~80C, so the hibernate and critical
>>>> set points are set at +5 and +10 of that. In the future
>>>> CPPC should be able to monitor the thermal throttling.
>>>>
>>>> Cc: Leif Lindholm <leif at nuviainc.com>
>>>> Cc: Pete Batard <pete at akeo.ie>
>>>> Cc: Andrei Warkentin <awarkentin at vmware.com>
>>>> Cc: Ard Biesheuvel <ard.biesheuvel at arm.com>
>>>> Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud at arm.com>
>>>> Signed-off-by: Jeremy Linton <jeremy.linton at arm.com>
>>>> Reviewed-by: Pete Batard <@pbatard>
>>>
>>> This looks ok to me but I did not receive patch #4 or the cover letter.
>>
>> I appear to have only CCed the groups.io ML on the cover letter and 
>> 4th patch (which is just whitespace).
>>
>> Can you find them them there? If not I will just resend the whole 
>> series as v3.
>>
> 
> Mind resending them? Grabbing and applying patches from the web UI is 
> not really feasible with the groups.io interface.

Sure, let me apply Andrei's suggestion. I was planning on fleshing out a 
more generic AML update mechanism but no sense in holding this up for that.


> 
> 
>>
>>>
>>>> ---
>>>>   Platform/RaspberryPi/AcpiTables/Dsdt.asl           | 31 
>>>> ++++++++++++++++++++++
>>>>   .../Bcm27xx/Include/IndustryStandard/Bcm2711.h     |  2 ++
>>>>   2 files changed, 33 insertions(+)
>>>>
>>>> diff --git a/Platform/RaspberryPi/AcpiTables/Dsdt.asl 
>>>> b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
>>>> index 353af2d876..73067aefd2 100644
>>>> --- a/Platform/RaspberryPi/AcpiTables/Dsdt.asl
>>>> +++ b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
>>>> @@ -252,6 +252,37 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, 
>>>> "RPIFDN", "RPI", 2)
>>>>           }
>>>>         })
>>>>       }
>>>> +
>>>> +    // Define a simple thermal zone. The idea here is we compute 
>>>> the SOC temp
>>>> +    // via a register we can read, and give it to the OS. This 
>>>> enables basic
>>>> +    // reports from the "sensors" utility, and the OS can then poll 
>>>> and take
>>>> +    // actions if that temp exceeds any of the given thresholds.
>>>> +    Device (EC0)
>>>> +    {
>>>> +      Name (_HID, EISAID ("PNP0C06"))
>>>> +      Name (_CCA, 0x0)
>>>> +
>>>> +      // all temps in are tenths of K (aka 2732 is the min temps in 
>>>> Linux (aka 0C))
>>>> +      ThermalZone (TZ0) {
>>>> +        Method (_TMP, 0, Serialized) {
>>>> +          OperationRegion (TEMS, SystemMemory, THERM_SENSOR, 0x8)
>>>> +          Field (TEMS, DWordAcc, NoLock, Preserve) {
>>>> +            TMPS, 32
>>>> +          }
>>>> +          return (((419949 - ((TMPS & 0x3ff) * 487)) / 100) + 2732);
>>>> +        }
>>>> +        Method (_SCP, 3) { }               // receive cooling 
>>>> policy from OS
>>>> +
>>>> +        Method (_CRT) { Return (3632) }    // (90C) Critical temp 
>>>> point (immediate power-off)
>>>> +        Method (_HOT) { Return (3582) }    // (85C) HOT state where 
>>>> OS should hibernate
>>>> +        Method (_PSV) { Return (3532) }    // (80C) Passive cooling 
>>>> (CPU throttling) trip point
>>>> +
>>>> +        // SSDT inserts _AC0/_AL0 @60C here, if a FAN is configured
>>>> +
>>>> +        Name (_TZP, 10)                   //The OSPM must poll this 
>>>> device every 1 seconds
>>>> +        Name (_PSL, Package () { \_SB_.CPU0, \_SB_.CPU1, 
>>>> \_SB_.CPU2, \_SB_.CPU3 })
>>>> +      }
>>>> +    }
>>>>   #endif
>>>>     }
>>>> diff --git 
>>>> a/Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h 
>>>> b/Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h
>>>> index e9c81cafa1..86906b2438 100644
>>>> --- a/Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h
>>>> +++ b/Silicon/Broadcom/Bcm27xx/Include/IndustryStandard/Bcm2711.h
>>>> @@ -86,4 +86,6 @@
>>>>   #define GENET_BASE_ADDRESS         FixedPcdGet64 
>>>> (PcdBcmGenetRegistersAddress)
>>>>   #define GENET_LENGTH               0x00010000
>>>> +#define THERM_SENSOR               0xfd5d2200
>>>> +
>>>>   #endif /* BCM2711_H__ */
>>>>
>>>
>>
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#64693): https://edk2.groups.io/g/devel/message/64693
Mute This Topic: https://groups.io/mt/76302316/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list