mirror of https://gitee.com/openkylin/qemu.git
hw/misc: sifive_u_otp: Use error_report() when block operation fails
At present when blk_pread() / blk_pwrite() fails, a guest error is logged, but this is not really a guest error. Change to use error_report() instead. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-id: 1611026585-29971-1-git-send-email-bmeng.cn@gmail.com Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
6f03770dac
commit
a033d8008d
|
@ -23,6 +23,7 @@
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
#include "hw/qdev-properties-system.h"
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
#include "hw/misc/sifive_u_otp.h"
|
#include "hw/misc/sifive_u_otp.h"
|
||||||
|
@ -65,8 +66,7 @@ static uint64_t sifive_u_otp_read(void *opaque, hwaddr addr, unsigned int size)
|
||||||
|
|
||||||
if (blk_pread(s->blk, s->pa * SIFIVE_U_OTP_FUSE_WORD, &buf,
|
if (blk_pread(s->blk, s->pa * SIFIVE_U_OTP_FUSE_WORD, &buf,
|
||||||
SIFIVE_U_OTP_FUSE_WORD) < 0) {
|
SIFIVE_U_OTP_FUSE_WORD) < 0) {
|
||||||
qemu_log_mask(LOG_GUEST_ERROR,
|
error_report("read error index<%d>", s->pa);
|
||||||
"read error index<%d>\n", s->pa);
|
|
||||||
return 0xff;
|
return 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,8 +169,7 @@ static void sifive_u_otp_write(void *opaque, hwaddr addr,
|
||||||
if (blk_pwrite(s->blk, s->pa * SIFIVE_U_OTP_FUSE_WORD,
|
if (blk_pwrite(s->blk, s->pa * SIFIVE_U_OTP_FUSE_WORD,
|
||||||
&s->fuse[s->pa], SIFIVE_U_OTP_FUSE_WORD,
|
&s->fuse[s->pa], SIFIVE_U_OTP_FUSE_WORD,
|
||||||
0) < 0) {
|
0) < 0) {
|
||||||
qemu_log_mask(LOG_GUEST_ERROR,
|
error_report("write error index<%d>", s->pa);
|
||||||
"write error index<%d>\n", s->pa);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,15 +259,13 @@ static void sifive_u_otp_reset(DeviceState *dev)
|
||||||
serial_data = s->serial;
|
serial_data = s->serial;
|
||||||
if (blk_pwrite(s->blk, index * SIFIVE_U_OTP_FUSE_WORD,
|
if (blk_pwrite(s->blk, index * SIFIVE_U_OTP_FUSE_WORD,
|
||||||
&serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) {
|
&serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) {
|
||||||
qemu_log_mask(LOG_GUEST_ERROR,
|
error_report("write error index<%d>", index);
|
||||||
"write error index<%d>\n", index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_data = ~(s->serial);
|
serial_data = ~(s->serial);
|
||||||
if (blk_pwrite(s->blk, (index + 1) * SIFIVE_U_OTP_FUSE_WORD,
|
if (blk_pwrite(s->blk, (index + 1) * SIFIVE_U_OTP_FUSE_WORD,
|
||||||
&serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) {
|
&serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) {
|
||||||
qemu_log_mask(LOG_GUEST_ERROR,
|
error_report("write error index<%d>", index + 1);
|
||||||
"write error index<%d>\n", index + 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue