libqos: Convert fw_cfg values to host endianness

The fw_cfg ABI is Little Endian, so byte-swap the generically read
byte array to host endianness.

This unbreaks the fw_cfg tests on ppc.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Message-id: 1367167547-19931-1-git-send-email-afaerber@suse.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Andreas Färber 2013-04-28 18:45:47 +02:00 committed by Anthony Liguori
parent 61e477f4c7
commit 1a63e059de

View File

@ -11,6 +11,7 @@
*/
#include "libqos/fw_cfg.h"
#include "qemu/bswap.h"
void qfw_cfg_select(QFWCFG *fw_cfg, uint16_t key)
{
@ -32,20 +33,20 @@ uint16_t qfw_cfg_get_u16(QFWCFG *fw_cfg, uint16_t key)
{
uint16_t value;
qfw_cfg_get(fw_cfg, key, &value, sizeof(value));
return value;
return le16_to_cpu(value);
}
uint32_t qfw_cfg_get_u32(QFWCFG *fw_cfg, uint16_t key)
{
uint32_t value;
qfw_cfg_get(fw_cfg, key, &value, sizeof(value));
return value;
return le32_to_cpu(value);
}
uint64_t qfw_cfg_get_u64(QFWCFG *fw_cfg, uint16_t key)
{
uint64_t value;
qfw_cfg_get(fw_cfg, key, &value, sizeof(value));
return value;
return le64_to_cpu(value);
}