All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linda Knippers <linda.knippers@hpe.com>
To: Lijun_Pan@Dell.com, lijunpan2000@gmail.com, linux-nvdimm@lists.01.org
Subject: Re: [PATCH v2] libndctl: add support for the MSFT family of DSM functions
Date: Wed, 29 Mar 2017 11:29:06 -0400	[thread overview]
Message-ID: <58DBD2C2.8080308@hpe.com> (raw)
In-Reply-To: <069a8e4a1714414892bbece91a5d387d@AUSX13MPS325.AMER.DELL.COM>

On 03/29/2017 11:08 AM, Lijun_Pan@Dell.com 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
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2017-03-29 15:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-26 20:17 [PATCH v2] libndctl: add support for the MSFT family of DSM functions Lijun Pan
2017-03-28 22:01 ` Linda Knippers
2017-03-28 23:14   ` Lijun.Pan
2017-03-28 23:37     ` Linda Knippers
2017-03-29 15:08   ` Lijun.Pan
2017-03-29 15:29     ` Linda Knippers [this message]
2017-03-29 18:13 ` Dan Williams
2017-03-29 21:41   ` Lijun.Pan
2017-03-29 22:26     ` Elliott, Robert (Persistent Memory)
2017-03-29 23:35       ` Lijun.Pan
2017-03-30 15:20       ` Linda Knippers
2017-03-30 15:19     ` Linda Knippers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58DBD2C2.8080308@hpe.com \
    --to=linda.knippers@hpe.com \
    --cc=Lijun_Pan@Dell.com \
    --cc=lijunpan2000@gmail.com \
    --cc=linux-nvdimm@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.