diff options
author | Markus Armbruster <armbru@redhat.com> | 2019-03-08 10:46:10 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2019-03-11 22:53:44 +0100 |
commit | ce14710f4fdfca32123d7efd3ddcbee984ef0ae5 (patch) | |
tree | 388b367cf788d97d74ba123bca43353e861af1a0 /hw/lm32 | |
parent | 940d5b132fab085bd8ec2bcfa5c1dd119785b217 (diff) |
pflash: Clean up after commit 368a354f02b, part 2
Our pflash devices are simplistically modelled has having
"num-blocks" sectors of equal size "sector-length". Real hardware
commonly has sectors of different sizes. How our "sector-length"
property is related to the physical device's multiple sector sizes
is unclear.
Helper functions pflash_cfi01_register() and pflash_cfi02_register()
create a pflash device, set properties including "sector-length" and
"num-blocks", and realize. They take parameters @size, @sector_len
and @nb_blocs.
QOMification left parameter @size unused. Obviously, @size should
match @sector_len and @nb_blocs, i.e. size == sector_len * nb_blocs.
All callers satisfy this.
Remove @nb_blocs and compute it from @size and @sector_len.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20190308094610.21210-16-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Diffstat (limited to 'hw/lm32')
-rw-r--r-- | hw/lm32/lm32_boards.c | 4 | ||||
-rw-r--r-- | hw/lm32/milkymist.c | 3 |
2 files changed, 3 insertions, 4 deletions
diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c index b71179cd9d..b820c9114b 100644 --- a/hw/lm32/lm32_boards.c +++ b/hw/lm32/lm32_boards.c @@ -115,7 +115,7 @@ static void lm32_evr_init(MachineState *machine) /* Spansion S29NS128P */ pflash_cfi02_register(flash_base, "lm32_evr.flash", flash_size, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - flash_sector_size, flash_size / flash_sector_size, + flash_sector_size, 1, 2, 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1); /* create irq lines */ @@ -208,7 +208,7 @@ static void lm32_uclinux_init(MachineState *machine) /* Spansion S29NS128P */ pflash_cfi02_register(flash_base, "lm32_uclinux.flash", flash_size, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - flash_sector_size, flash_size / flash_sector_size, + flash_sector_size, 1, 2, 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1); /* create irq lines */ diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c index c5f58c2425..689e633199 100644 --- a/hw/lm32/milkymist.c +++ b/hw/lm32/milkymist.c @@ -122,8 +122,7 @@ milkymist_init(MachineState *machine) /* Numonyx JS28F256J3F105 */ pflash_cfi01_register(flash_base, "milkymist.flash", flash_size, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - flash_sector_size, flash_size / flash_sector_size, - 2, 0x00, 0x89, 0x00, 0x1d, 1); + flash_sector_size, 2, 0x00, 0x89, 0x00, 0x1d, 1); /* create irq lines */ env->pic_state = lm32_pic_init(qemu_allocate_irq(cpu_irq_handler, cpu, 0)); |