On 03/29/2017 11:08 AM, [email protected] wrote:
<snip>

>>> +static unsigned int msft_cmd_smart_get_temperature(struct ndctl_cmd
>> *cmd)
>>> +{
>>> +   if (msft_smart_valid(cmd) < 0)
>>> +           return UINT_MAX;
>>> +   /*
>>> +    * refer to JESD245 spec section 7.8 to calculate the temperature
>>> +    * then convert to 1/16 Celsius granularity.
>>> +    */
>>
>> I'm confused by this comment because the Microsoft DSM spec says this
>> value
>> is in degrees C.  Regardless of what the JEDAC spec says, wouldn't the
>> platform FW convert to degrees C?  And then this function needs to convert
>> to 1/16th of a degree?
> 
> MSFT DSM function 11 has a field called "Module Current Temperature".

When I look here:
https://msdn.microsoft.com/en-us/library/windows/hardware/mt604717
at the definition of function 11, it says that Module Current Temperature
 is 2 bytes at offset 6 and that the value is "The module temperature
in degrees Celsius. The minimum value is 0".

> JESD245.pdf section 7.8 p. 29 table 3 explains the bit definition.
> Bit 3 to bit 0 is 1/2 1/4 (1/8) (1/16) granularity.
> &0FFC will get it correctly.

That might be what the BIOS had to get from the device, but the BIOS
should then be converting it to what the DSM says it returns.

And since the rest of ndctl expects temperatures in 16ths of a degree C,
your function here will need to multiply the value from the DSM by 16.

> No negative temperature is defined.
>  
> Lijun
> 
>>
>>> +   return CMD_MSFT_SMART(cmd)->temp & 0x0FFC;

return CMD_MSFT_SMART(cmd)->temp * 16;

-- ljk
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to