aboutsummaryrefslogtreecommitdiff
path: root/hw/block/pflash_cfi01.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/block/pflash_cfi01.c')
-rw-r--r--hw/block/pflash_cfi01.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
index bd42487c0a..9d1c356eb6 100644
--- a/hw/block/pflash_cfi01.c
+++ b/hw/block/pflash_cfi01.c
@@ -940,7 +940,7 @@ PFlashCFI01 *pflash_cfi01_register(hwaddr base,
const char *name,
hwaddr size,
BlockBackend *blk,
- uint32_t sector_len, int nb_blocs,
+ uint32_t sector_len,
int bank_width,
uint16_t id0, uint16_t id1,
uint16_t id2, uint16_t id3,
@@ -951,7 +951,8 @@ PFlashCFI01 *pflash_cfi01_register(hwaddr base,
if (blk) {
qdev_prop_set_drive(dev, "drive", blk, &error_abort);
}
- qdev_prop_set_uint32(dev, "num-blocks", nb_blocs);
+ assert(size % sector_len == 0);
+ qdev_prop_set_uint32(dev, "num-blocks", size / sector_len);
qdev_prop_set_uint64(dev, "sector-length", sector_len);
qdev_prop_set_uint8(dev, "width", bank_width);
qdev_prop_set_bit(dev, "big-endian", !!be);