diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2015-01-16 12:06:41 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2015-01-16 12:06:41 +0000 |
commit | 1e42c353469cb58ca4f3b450eea4211af7d0b147 (patch) | |
tree | b9120124757b240abae25c28e01255bf43c3290d /hw | |
parent | e68cba36360a2ab5bf0576b66df4d0eb0d822f8d (diff) | |
parent | 36b62ae6a58f9a588fd33be9386e18a2b90103f5 (diff) |
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20150116' into staging
target-arm queue:
* fix endianness handling in fwcfg wide registers
* fix broken crypto insn emulation on big endian hosts
# gpg: Signature made Fri 16 Jan 2015 12:04:08 GMT using RSA key ID 14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"
* remotes/pmaydell/tags/pull-target-arm-20150116:
fw_cfg: fix endianness in fw_cfg_data_mem_read() / _write()
target-arm: crypto: fix BE host support
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/nvram/fw_cfg.c | 41 |
1 files changed, 7 insertions, 34 deletions
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index fcdf821c31..78a37be42b 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -287,51 +287,24 @@ static uint64_t fw_cfg_data_mem_read(void *opaque, hwaddr addr, unsigned size) { FWCfgState *s = opaque; - uint8_t buf[8]; + uint64_t value = 0; unsigned i; for (i = 0; i < size; ++i) { - buf[i] = fw_cfg_read(s); + value = (value << 8) | fw_cfg_read(s); } - switch (size) { - case 1: - return buf[0]; - case 2: - return lduw_he_p(buf); - case 4: - return (uint32_t)ldl_he_p(buf); - case 8: - return ldq_he_p(buf); - } - abort(); + return value; } static void fw_cfg_data_mem_write(void *opaque, hwaddr addr, uint64_t value, unsigned size) { FWCfgState *s = opaque; - uint8_t buf[8]; - unsigned i; + unsigned i = size; - switch (size) { - case 1: - buf[0] = value; - break; - case 2: - stw_he_p(buf, value); - break; - case 4: - stl_he_p(buf, value); - break; - case 8: - stq_he_p(buf, value); - break; - default: - abort(); - } - for (i = 0; i < size; ++i) { - fw_cfg_write(s, buf[i]); - } + do { + fw_cfg_write(s, value >> (8 * --i)); + } while (i); } static bool fw_cfg_data_mem_valid(void *opaque, hwaddr addr, |