Hey Lars!
I am using XWorkplace 1.0.17 and recently I added the "CPU temperature" widget to XCenter to keep track of CPU temperature.
Unfortunately, it will always display 0 °C.
I am using an AMD CPU and I suppose, that is the problem. Needless to say that I have ACPI installed and working (but ACPI power management turned off, see below).
So as I understood the whole ACPI ecosystem it is not necessary for things like power management to be activated in order for the hardware to report runtime metrics.
Whether it is Intel, AMD or others (CPUs or chipsets) so long as the motherboard vendor implements the proper ACPI functionality, the subsequent OS or APP software should have the ability to query the various ACPI components.
Take a look at the officials specs
https://uefi.org/specifications, ACPI is at 6.5a level now. They also show a good number of technical/whitepaper docs on there that help with digesting all of this.
I have no clue what widget DLL implements the CPU temp widget and I don't know where I can find the source code.
1) can someone point me to the source code ? That could be my starting point of implementing a widget
OK, so when installing ACPI support you have the option of installing the ACPI Toolkit. In my case the stuff sits in \acpi\toolkit where you'll find the header files, libs, some docs and a good measure of sample code.
2) does the existing widget build upon ACPI functionality to query temperature ? If yes, then I would suspect that this functionality does not work for AMD CPUs but I don't know. Does anyone have any insight ?
Great topic, so in the other thread (CPU shutdown) I mentioned that I was trying to digest the ACPI framework in order to expose this information, basically thinking along the lines of what you articulated in your post here.
So far here is how all of it appear to glue together using the TEMPERATURE topic as an example (this is very much WIP on my part, so I'm sure I'm missing some stuff and most likely misunderstanding things):
1) in the \acpi\toolkit\samples directory look at the acpitree.c code, where you'll find this section:
if (DevInfo->Type == ACPI_TYPE_THERMAL)
{
printf(" Thermal State:\n");
AcpiTkWalkResources(ObjHandle,
"_TMP",
internal_PrintResourceInfo,
(void *) NestingLevel);
}
if (DevInfo)
{
AcpiTkOsFree(DevInfo);
}
return AE_OK;
In particular the key here is that reference to "_TMP" in the AcpiTkWalkResources API call, which the toolkit docs explain as:
Parse an ACPI Resource List.
AcpiStatus = AcpiTkWalkResources(Device, &Name, UserFunction, &UserContext);
PARAMETERS
Device (ACPI_HANDLE) - input
A handle to the Device for which one of the resource lists will be walked:
Name (char *) - input
Name of a resource method (either a _CRS or _PRS method.)
UserFunction (ACPI_WALK_RESOURCE_CALLBACK *) - input
A pointer to a user-written function that is invoked for each resource object within the resource list. (See the interface specification for the user function below.)
UserContext (void *) - input
A value that will be passed as a parameter to the user function each time it is invoked.
RETURN VALUE
Status (ACPI_STATUS) - output
Exception code that indicates success or reason for failure.
Functional Description:
This function is equivalent to the AcpiWalkResources function described in the Intel ACPI Component Architecture User Guide and Programmer Reference.
In other words, that "_TMP" is the "Name of a resource method" that you are interested in obtaining information about/from. Further on, if you look this up in the official ACPI docs you'll find that following:
11.4 (Thermal Objects) => 11.4.18 (_TMP Temperature)
...with the following (rather criptic details being shown):
11.4.18 _TMP (Temperature)
This control method returns the thermal zone’s current operating temperature.
Arguments:
None
Return Value:
An Integer containing the current temperature of the thermal zone (in tenths of degrees Kelvin)
The return value is the current temperature of the thermal zone in tenths of degrees Kelvin. For example, 300.0K is represented by the integer 3000.
OK, but not all is lost. There are other "resouce methods" you can use to obtain all the information you need, these are nicely listed in the main table at the start of 11.4 (Thermal Objects) section.
Soooo...I am thinking that what AOS (DavidA in particular) provided us with is the ability (through ACPI framework) to access such "resource methods". What I am not sure is whether ALL such ACPI currently defined methods are available, or just a subset.
With ACPI framework there is that whole notion of motherboard firmware (BIOS) needing to support the various ACPI calls, which in fact are pseudo-code (similar to how the JVM stuff works) and which the OS/APP layer issues and the firmware understands and is capable of responding to.
This is well documented in CH19 of that ACPI Specs document, as well as CH20 which talks about "ACPI MACHINE LANGUAGE (AML) SPECIFICATION".
What I am unclear about at this point in time is as to whether the ASL & AML stuff is completely transparent to us (at the API level for example)? I think the answer is YES, but yet our ACPI package ships with iasl.exe, which is:
Intel ACPI Component Architecture
ASL+ Optimizing Compiler/Disassembler version 20210331
Copyright (c) 2000 - 2021 Intel Corporation
Supports ACPI Specification Revision 6.3
Usage: iasl [Options] [Files]
....so the plot thickens!!! lol
NOTE: I think ASL is used to actually dynamically define & create the whole ACPI set of tables which can then be loaded into BIOS at runtime, thus allowing the OS to further customize the particular behaviour/functionality present on specific hardware. That way you could in fact "patch" faulty motherboard hardware and have the BIOS execute this stuff. This is a pure stipulation on my part though as I honestly do not understand this enough at this point in time...