summaryrefslogtreecommitdiffstats
path: root/hw/misc/sifive_u_otp.c
diff options
context:
space:
mode:
authorPeter Maydell2022-07-12 21:31:50 +0200
committerPeter Maydell2022-07-12 21:31:50 +0200
commit824824d12217f7d80b372eb051aad2c082cffb98 (patch)
tree34da8294c607697d38f08e96ccdb182abfc00049 /hw/misc/sifive_u_otp.c
parentMerge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (diff)
parentvl: Unlink absolute PID file path (diff)
downloadqemu-824824d12217f7d80b372eb051aad2c082cffb98.tar.gz
qemu-824824d12217f7d80b372eb051aad2c082cffb98.tar.xz
qemu-824824d12217f7d80b372eb051aad2c082cffb98.zip
Merge tag 'pull-block-2022-07-12' of https://gitlab.com/hreitz/qemu into staging
Block patches: - Refactoring for non-coroutine variants of bdrv/blk_co_* functions: Auto-generate more of them with the block coroutine wrapper generator script - iotest fixes - Both for the storage daemon and the system emulator: Fix PID file handling when daemonizing (store the absolute path and delete that on exit, which is necessary because daemonizing will change the working directory to /) # gpg: Signature made Tue 12 Jul 2022 19:04:14 BST # gpg: using RSA key CB62D7A0EE3829E45F004D34A1FA40D098019CDF # gpg: issuer "hreitz@redhat.com" # gpg: Good signature from "Hanna Reitz <hreitz@redhat.com>" [marginal] # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: CB62 D7A0 EE38 29E4 5F00 4D34 A1FA 40D0 9801 9CDF * tag 'pull-block-2022-07-12' of https://gitlab.com/hreitz/qemu: (35 commits) vl: Unlink absolute PID file path vl: Conditionally register PID file unlink notifier qsd: Unlink absolute PID file path iotests/297: Have mypy ignore unused ignores qsd: Do not use error_report() before monitor_init block: Remove remaining unused symbols in coroutines.h block: Reorganize some declarations in block-backend-io.h block: Add blk_co_truncate() block: Add blk_co_ioctl() block: Implement blk_flush() using generated_co_wrapper block: Implement blk_pdiscard() using generated_co_wrapper block: Implement blk_pwrite_zeroes() using generated_co_wrapper block: Add blk_co_pwrite_compressed() block: Change blk_pwrite_compressed() param order block: Export blk_pwritev_part() in block-backend-io.h block: Add blk_[co_]preadv_part() block: Add blk_{preadv,pwritev}() block: Implement blk_{pread,pwrite}() using generated_co_wrapper block: Make blk_co_pwrite() take a const buffer block: Make 'bytes' param of blk_{pread,pwrite}() an int64_t ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/misc/sifive_u_otp.c')
-rw-r--r--hw/misc/sifive_u_otp.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/hw/misc/sifive_u_otp.c b/hw/misc/sifive_u_otp.c
index 6d5f84e6c2..6d7fdb040a 100644
--- a/hw/misc/sifive_u_otp.c
+++ b/hw/misc/sifive_u_otp.c
@@ -64,8 +64,8 @@ static uint64_t sifive_u_otp_read(void *opaque, hwaddr addr, unsigned int size)
if (s->blk) {
int32_t buf;
- if (blk_pread(s->blk, s->pa * SIFIVE_U_OTP_FUSE_WORD, &buf,
- SIFIVE_U_OTP_FUSE_WORD) < 0) {
+ if (blk_pread(s->blk, s->pa * SIFIVE_U_OTP_FUSE_WORD,
+ SIFIVE_U_OTP_FUSE_WORD, &buf, 0) < 0) {
error_report("read error index<%d>", s->pa);
return 0xff;
}
@@ -167,8 +167,8 @@ static void sifive_u_otp_write(void *opaque, hwaddr addr,
/* write to backend */
if (s->blk) {
if (blk_pwrite(s->blk, s->pa * SIFIVE_U_OTP_FUSE_WORD,
- &s->fuse[s->pa], SIFIVE_U_OTP_FUSE_WORD,
- 0) < 0) {
+ SIFIVE_U_OTP_FUSE_WORD, &s->fuse[s->pa], 0)
+ < 0) {
error_report("write error index<%d>", s->pa);
}
}
@@ -240,7 +240,7 @@ static void sifive_u_otp_realize(DeviceState *dev, Error **errp)
return;
}
- if (blk_pread(s->blk, 0, s->fuse, filesize) != filesize) {
+ if (blk_pread(s->blk, 0, filesize, s->fuse, 0) < 0) {
error_setg(errp, "failed to read the initial flash content");
return;
}
@@ -261,14 +261,14 @@ static void sifive_u_otp_realize(DeviceState *dev, Error **errp)
serial_data = s->serial;
if (blk_pwrite(s->blk, index * SIFIVE_U_OTP_FUSE_WORD,
- &serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) {
+ SIFIVE_U_OTP_FUSE_WORD, &serial_data, 0) < 0) {
error_setg(errp, "failed to write index<%d>", index);
return;
}
serial_data = ~(s->serial);
if (blk_pwrite(s->blk, (index + 1) * SIFIVE_U_OTP_FUSE_WORD,
- &serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) {
+ SIFIVE_U_OTP_FUSE_WORD, &serial_data, 0) < 0) {
error_setg(errp, "failed to write index<%d>", index + 1);
return;
}