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.web10.58747.1598894761500236831 for ; Mon, 31 Aug 2020 10:26:01 -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 1F3361045; Mon, 31 Aug 2020 10:26:01 -0700 (PDT) Received: from mammon-tx2.austin.arm.com (mammon-tx2.austin.arm.com [10.118.28.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0F17D3F66F; Mon, 31 Aug 2020 10:26:01 -0700 (PDT) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: Jeremy Linton , Leif Lindholm , Pete Batard , Andrei Warkentin , Ard Biesheuvel , Samer El-Haj-Mahmoud Subject: [PATCH v4 1/6] Platform/RaspberryPi4: Add a basic thermal zone Date: Mon, 31 Aug 2020 12:25:44 -0500 Message-Id: <20200831172549.24079-2-jeremy.linton@arm.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200831172549.24079-1-jeremy.linton@arm.com> References: <20200831172549.24079-1-jeremy.linton@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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. As a first pass add 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 Cc: Pete Batard Cc: Andrei Warkentin Cc: Ard Biesheuvel Cc: Samer El-Haj-Mahmoud Signed-off-by: Jeremy Linton Reviewed-by: Pete Batard <@pbatard> --- 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/RaspberryP= i/AcpiTables/Dsdt.asl index 353af2d876..2b9e8211cf 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) }=0D })=0D }=0D +=0D + // Define a simple thermal zone. The idea here is we compute the SOC t= emp=0D + // via a register we can read, and give it to the OS. This enables bas= ic=0D + // reports from the "sensors" utility, and the OS can then poll and ta= ke=0D + // actions if that temp exceeds any of the given thresholds.=0D + Device (EC00)=0D + {=0D + Name (_HID, EISAID ("PNP0C06"))=0D + Name (_CCA, 0x0)=0D +=0D + // all temps in are tenths of K (aka 2732 is the min temps in Linux = (aka 0C))=0D + ThermalZone (TZ00) {=0D + Method (_TMP, 0, Serialized) {=0D + OperationRegion (TEMS, SystemMemory, THERM_SENSOR, 0x8)=0D + Field (TEMS, DWordAcc, NoLock, Preserve) {=0D + TMPS, 32=0D + }=0D + return (((419949 - ((TMPS & 0x3ff) * 487)) / 100) + 2732);=0D + }=0D + Method (_SCP, 3) { } // receive cooling policy from = OS=0D +=0D + Method (_CRT) { Return (3632) } // (90C) Critical temp point (i= mmediate power-off)=0D + Method (_HOT) { Return (3582) } // (85C) HOT state where OS sho= uld hibernate=0D + Method (_PSV) { Return (3532) } // (80C) Passive cooling (CPU t= hrottling) trip point=0D +=0D + // SSDT inserts _AC0/_AL0 @60C here, if a FAN is configured=0D +=0D + Name (_TZP, 10) //The OSPM must poll this device= every 1 seconds=0D + Name (_PSL, Package () { \_SB_.CPU0, \_SB_.CPU1, \_SB_.CPU2, \_SB_= .CPU3 })=0D + }=0D + }=0D #endif=0D =0D }=0D 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 (PcdBcmGenetRegistersAddr= ess)=0D #define GENET_LENGTH 0x00010000=0D =0D +#define THERM_SENSOR 0xfd5d2200=0D +=0D #endif /* BCM2711_H__ */=0D --=20 2.13.7