hw/arm/musicpal: Use the IEC binary prefix definitions

IEC binary prefixes ease code review: the unit is explicit.

Add the FLASH_SECTOR_SIZE definition.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20230109115316.2235-9-philmd@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Philippe Mathieu-Daudé 2023-01-09 12:53:11 +01:00 committed by Peter Maydell
parent c0e3a4bf77
commit e0ee64131f

View File

@ -10,6 +10,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/units.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "cpu.h" #include "cpu.h"
#include "hw/sysbus.h" #include "hw/sysbus.h"
@ -1196,6 +1197,8 @@ static const TypeInfo musicpal_key_info = {
.class_init = musicpal_key_class_init, .class_init = musicpal_key_class_init,
}; };
#define FLASH_SECTOR_SIZE (64 * KiB)
static struct arm_boot_info musicpal_binfo = { static struct arm_boot_info musicpal_binfo = {
.loader_start = 0x0, .loader_start = 0x0,
.board_id = 0x20e, .board_id = 0x20e,
@ -1264,8 +1267,8 @@ static void musicpal_init(MachineState *machine)
BlockBackend *blk = blk_by_legacy_dinfo(dinfo); BlockBackend *blk = blk_by_legacy_dinfo(dinfo);
flash_size = blk_getlength(blk); flash_size = blk_getlength(blk);
if (flash_size != 8*1024*1024 && flash_size != 16*1024*1024 && if (flash_size != 8 * MiB && flash_size != 16 * MiB &&
flash_size != 32*1024*1024) { flash_size != 32 * MiB) {
error_report("Invalid flash image size"); error_report("Invalid flash image size");
exit(1); exit(1);
} }
@ -1277,7 +1280,7 @@ static void musicpal_init(MachineState *machine)
*/ */
pflash_cfi02_register(0x100000000ULL - MP_FLASH_SIZE_MAX, pflash_cfi02_register(0x100000000ULL - MP_FLASH_SIZE_MAX,
"musicpal.flash", flash_size, "musicpal.flash", flash_size,
blk, 0x10000, blk, FLASH_SECTOR_SIZE,
MP_FLASH_SIZE_MAX / flash_size, MP_FLASH_SIZE_MAX / flash_size,
2, 0x00BF, 0x236D, 0x0000, 0x0000, 2, 0x00BF, 0x236D, 0x0000, 0x0000,
0x5555, 0x2AAA, 0); 0x5555, 0x2AAA, 0);