lsslot: fix segfault when lmb_list->lmbs is NULL

PowerKVM guests currently do not support dynamically reconfigurable
memory, and as such get_lmbs will return a lmb_list struct whose lmbs
field is NULL. Added a NULL check to avoid segfault for the case where
no LMB drc-names  are defined in device tree.

Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
serv_config: handle endianess in sysparm buffer

rtas_get_sysparm and rtas_set_sysparm commands both
manipulate buffers in which the first two bytes are a big
endian integer indicating the size of the remaining buffer.
This patch makes sure those bytes are in the correct format.

Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
uesensor: fix endian issues reading device-tree

The values in /proc/device-tree/rtas/rtas-sensors are
big endian so this needs to be handled for little endian
architectures.

Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
ppc64_cpu: handle endianess in rtas sysparm buffer

ppc64_cpu passes a buffer to rtas_set_sysparm.  The first two
bytes of this buffer must encode a integer denoting the
size of the remaining the buffer. This integer must be in a
big endian format.

Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
set_power_on: handle endianess reading max latency

set_power_on reads device-tree to get the max latency value,
which is in a big endian format.  This needs to be converted
for little endian architectures.

Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
nvram: fix memory corruption when nvram->nbytes is less than actual nvram size

The nvram_read function always calls read with a 512 byte chunk size. If the
actual nvram size is greater than nvram->nbytes, which can be overriden by the
--nvram-size option, the allocated read buffer will be overrun.

Fixed read logic to only read upto nvram->nbytes of data.

Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
nvram: restrict --nvram-size to 16 byte multiples

PAPR defines a 16 byte block size for nvram partitions. This patch restricts
the --nvram-size option to sizes that are multiples of 16.

Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
uesensor: remove unused platform variable

Remove the unused platform variable that appears to be
an accidental leftover from updating the platform checking
code.

This was producing a build warning.

Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Perp for powerpc-utils-1.2.21 release.

Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>