[Skiboot] [PATCH 2/2] fsp-sensor: rework device tree for sensors

Stewart Smith stewart at linux.vnet.ibm.com
Mon Mar 7 18:04:56 AEDT 2016


Cédric Le Goater <clg at fr.ibm.com> writes:
> The current code in OPAL exposing the FSP sensors in the device tree
> is very SPCN-centric which makes it difficult to add new sensors
> fitting with the ibmpowernv Linux driver. This patch proposes some
> improvements on the way the device tree is created.
>
> The logic behind the node creation is preserved. The DMA sensor buffer
> is parsed, looping on the PRS command modifiers and entries while
> nodes are being created under the "ibm,opal/sensors/" directory. The
> code now splits the creation under separate routines, one for each
> modifier, and use the same old pattern for names :
>
> 	<resource class name>#<index>-attribute/
>
> Each resource node is compatible with :
>
> 	"ibm,opal-sensor-<resource classname>"
>
> There is a mapping to be done between the attributes of a same
> resource and the PRS command used to collect them. This adds some
> complexity in the code when creating the node and when building a
> request for the FSP.
>
> For instance, the status of a FSP sensor which can be returned by one
> or more PRS command modifiers. For power supply and fans, we choose
> the PRS modifier (and not DATA) to return the AC_FAULTED bit. For the
> ambient temperature, there is no other choice than to use the DATA
> modifier. The status bits being :
>
>                    PRS          PARAM/DATA
>                  Modifier        Modifier
>
>   0x0010        ON SUPPORTED
>   0x0008        ON
>
>   0x0004        AC FAULTED      EM ALERT
>   0x0002        FAULTED         FAULTED
>   0x0001        PRESENT         PRESENT
>
> we only keep bits[1-2] to reflect the fault status to Linux. 
>
> Another significant change is that the power consumption is now
> reported for each power supply and not as a whole like before. A Tuleta
> can have up to four distinct power supplies so it seems an interesting
> resource to report independently.
>
> Currently, we handle the "power-supply", "cooling-fan" and "amb-temp"
> resource classes. More exist in the specs but they have not showed up
> on the Tuleta I used.
>
> Signed-off-by: Cédric Le Goater <clg at fr.ibm.com>
> ---
>  hw/fsp/fsp-sensor.c |  489 +++++++++++++++++++++++++++++-----------------------
>  1 file changed, 278 insertions(+), 211 deletions(-)

Sorry for the delay in looking at this closely...

I notice a couple of things:
- we seem to go from amb-temp#1-data to amb-temp#24576-data -
  intentional?
- IT seems that DTS sensors follow doc/device-tree/ibm,opal/sensors.txt
yet the fsp-sensors come out differently:
  dts: type at addr
  fsp: type#id-type

  This should likely be documented *why* at least.

- when applying this patch, I seem to get 4 more sensors!?

-- 
Stewart Smith
OPAL Architect, IBM.



More information about the Skiboot mailing list