From 51b6c1bbc3dd1b139a9e9b021d87bcfd7d82299e Mon Sep 17 00:00:00 2001 From: Green Wan Date: Tue, 20 Oct 2020 11:37:32 +0800 Subject: hw/misc/sifive_u_otp: Add backend drive support Add '-drive' support to OTP device. Allow users to assign a raw file as OTP image. test commands for 16k otp.img filled with zero: $ dd if=/dev/zero of=./otp.img bs=1k count=16 $ ./qemu-system-riscv64 -M sifive_u -m 256M -nographic -bios none \ -kernel ../opensbi/build/platform/sifive/fu540/firmware/fw_payload.elf \ -d guest_errors -drive if=none,format=raw,file=otp.img Signed-off-by: Green Wan Reviewed-by: Bin Meng Tested-by: Bin Meng Acked-by: Alistair Francis Message-id: 20201020033732.12921-3-green.wan@sifive.com Signed-off-by: Alistair Francis --- include/hw/misc/sifive_u_otp.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/hw/misc/sifive_u_otp.h b/include/hw/misc/sifive_u_otp.h index ebffbc1fa5..5d0d7df455 100644 --- a/include/hw/misc/sifive_u_otp.h +++ b/include/hw/misc/sifive_u_otp.h @@ -46,6 +46,7 @@ #define SIFIVE_U_OTP_PA_MASK 0xfff #define SIFIVE_U_OTP_NUM_FUSES 0x1000 +#define SIFIVE_U_OTP_FUSE_WORD 4 #define SIFIVE_U_OTP_SERIAL_ADDR 0xfc #define SIFIVE_U_OTP_REG_SIZE 0x1000 @@ -80,6 +81,7 @@ struct SiFiveUOTPState { uint32_t fuse_wo[SIFIVE_U_OTP_NUM_FUSES]; /* config */ uint32_t serial; + BlockBackend *blk; }; #endif /* HW_SIFIVE_U_OTP_H */ -- cgit v1.2.3-55-g7522