Re: [PATCH-for-6.1 07/10] hw/block/pflash_cfi02: Simplify pflash_cfi02_register() prototype

2021-03-28 Thread David Gibson
On Fri, Mar 26, 2021 at 01:27:25AM +0100, Philippe Mathieu-Daudé wrote:
> The previous commit removed the mapping code from TYPE_PFLASH_CFI02.
> pflash_cfi02_register() doesn't use the 'nb_mappings' argument
> anymore. Simply remove it to simplify.
> 
> Signed-off-by: Philippe Mathieu-Daudé 

Revieed-by: David Gibson 

> ---
>  include/hw/block/flash.h | 1 -
>  hw/arm/digic_boards.c| 1 -
>  hw/arm/musicpal.c| 1 -
>  hw/arm/xilinx_zynq.c | 2 +-
>  hw/block/pflash_cfi02.c  | 3 +--
>  hw/lm32/lm32_boards.c| 4 ++--
>  hw/ppc/ppc405_boards.c   | 6 +++---
>  hw/sh4/r2d.c | 2 +-
>  8 files changed, 8 insertions(+), 12 deletions(-)
> 
> diff --git a/include/hw/block/flash.h b/include/hw/block/flash.h
> index 7dde0adcee7..0e5dd818a9d 100644
> --- a/include/hw/block/flash.h
> +++ b/include/hw/block/flash.h
> @@ -36,7 +36,6 @@ PFlashCFI02 *pflash_cfi02_register(hwaddr base,
> hwaddr size,
> BlockBackend *blk,
> uint32_t sector_len,
> -   int nb_mappings,
> int width,
> uint16_t id0, uint16_t id1,
> uint16_t id2, uint16_t id3,
> diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c
> index 293402b1240..eb694c70d4c 100644
> --- a/hw/arm/digic_boards.c
> +++ b/hw/arm/digic_boards.c
> @@ -128,7 +128,6 @@ static void digic4_add_k8p3215uqb_rom(DigicState *s, 
> hwaddr addr,
>   FLASH_K8P3215UQB_SIZE / 
> FLASH_K8P3215UQB_SECTOR_SIZE);
>  qdev_prop_set_uint32(dev, "sector-length", FLASH_K8P3215UQB_SECTOR_SIZE);
>  qdev_prop_set_uint8(dev, "width", 4); /* 32-bit */
> -qdev_prop_set_uint8(dev, "mappings", 0);
>  qdev_prop_set_uint8(dev, "big-endian", 0);
>  qdev_prop_set_uint16(dev, "id0", 0x00ec);
>  qdev_prop_set_uint16(dev, "id1", 0x007e);
> diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
> index 7d1f2f3fb3f..e882e11df36 100644
> --- a/hw/arm/musicpal.c
> +++ b/hw/arm/musicpal.c
> @@ -1657,7 +1657,6 @@ static void musicpal_init(MachineState *machine)
>  qdev_prop_set_uint32(dev, "num-blocks", flash_size / sector_size);
>  qdev_prop_set_uint32(dev, "sector-length", sector_size);
>  qdev_prop_set_uint8(dev, "width", 2); /* 16-bit */
> -qdev_prop_set_uint8(dev, "mappings", 0);
>  qdev_prop_set_uint8(dev, "big-endian", 0);
>  qdev_prop_set_uint16(dev, "id0", 0x00bf);
>  qdev_prop_set_uint16(dev, "id1", 0x236d);
> diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
> index 8db6cfd47f5..d12b00e7648 100644
> --- a/hw/arm/xilinx_zynq.c
> +++ b/hw/arm/xilinx_zynq.c
> @@ -220,7 +220,7 @@ static void zynq_init(MachineState *machine)
>  pflash_cfi02_register(0xe200, "zynq.pflash", FLASH_SIZE,
>dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
>FLASH_SECTOR_SIZE, 1,
> -  1, 0x0066, 0x0022, 0x, 0x, 0x0555, 0x2aa,
> +  0x0066, 0x0022, 0x, 0x, 0x0555, 0x2aa,
>0);
>  
>  /* Create the main clock source, and feed slcr with it */
> diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
> index 6f4b3e3c3fe..2b412402fac 100644
> --- a/hw/block/pflash_cfi02.c
> +++ b/hw/block/pflash_cfi02.c
> @@ -968,7 +968,7 @@ PFlashCFI02 *pflash_cfi02_register(hwaddr base,
> hwaddr size,
> BlockBackend *blk,
> uint32_t sector_len,
> -   int nb_mappings, int width,
> +   int width,
> uint16_t id0, uint16_t id1,
> uint16_t id2, uint16_t id3,
> uint16_t unlock_addr0,
> @@ -977,7 +977,6 @@ PFlashCFI02 *pflash_cfi02_register(hwaddr base,
>  {
>  DeviceState *dev = qdev_new(TYPE_PFLASH_CFI02);
>  
> -assert(nb_mappings <= 1);
>  if (blk) {
>  qdev_prop_set_drive(dev, "drive", blk);
>  }
> diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c
> index b5d97dd53ed..96877ba7cfb 100644
> --- a/hw/lm32/lm32_boards.c
> +++ b/hw/lm32/lm32_boards.c
> @@ -121,7 +121,7 @@ static void lm32_evr_init(MachineState *machine)
>  pflash_cfi02_register(flash_base, "lm32_evr.flash", flash_size,
>dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
>flash_sector_size,
> -  1, 2, 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1);
> +  2, 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1);
>  
>  /* create irq lines */
>  env->pic_state = lm32_pic_init(qemu_allocate_irq(cpu_irq_handler, cpu, 
> 0));
> @@ -218,7 +218,7 @@ static void 

[PATCH-for-6.1 07/10] hw/block/pflash_cfi02: Simplify pflash_cfi02_register() prototype

2021-03-25 Thread Philippe Mathieu-Daudé
The previous commit removed the mapping code from TYPE_PFLASH_CFI02.
pflash_cfi02_register() doesn't use the 'nb_mappings' argument
anymore. Simply remove it to simplify.

Signed-off-by: Philippe Mathieu-Daudé 
---
 include/hw/block/flash.h | 1 -
 hw/arm/digic_boards.c| 1 -
 hw/arm/musicpal.c| 1 -
 hw/arm/xilinx_zynq.c | 2 +-
 hw/block/pflash_cfi02.c  | 3 +--
 hw/lm32/lm32_boards.c| 4 ++--
 hw/ppc/ppc405_boards.c   | 6 +++---
 hw/sh4/r2d.c | 2 +-
 8 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/include/hw/block/flash.h b/include/hw/block/flash.h
index 7dde0adcee7..0e5dd818a9d 100644
--- a/include/hw/block/flash.h
+++ b/include/hw/block/flash.h
@@ -36,7 +36,6 @@ PFlashCFI02 *pflash_cfi02_register(hwaddr base,
hwaddr size,
BlockBackend *blk,
uint32_t sector_len,
-   int nb_mappings,
int width,
uint16_t id0, uint16_t id1,
uint16_t id2, uint16_t id3,
diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c
index 293402b1240..eb694c70d4c 100644
--- a/hw/arm/digic_boards.c
+++ b/hw/arm/digic_boards.c
@@ -128,7 +128,6 @@ static void digic4_add_k8p3215uqb_rom(DigicState *s, hwaddr 
addr,
  FLASH_K8P3215UQB_SIZE / FLASH_K8P3215UQB_SECTOR_SIZE);
 qdev_prop_set_uint32(dev, "sector-length", FLASH_K8P3215UQB_SECTOR_SIZE);
 qdev_prop_set_uint8(dev, "width", 4); /* 32-bit */
-qdev_prop_set_uint8(dev, "mappings", 0);
 qdev_prop_set_uint8(dev, "big-endian", 0);
 qdev_prop_set_uint16(dev, "id0", 0x00ec);
 qdev_prop_set_uint16(dev, "id1", 0x007e);
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
index 7d1f2f3fb3f..e882e11df36 100644
--- a/hw/arm/musicpal.c
+++ b/hw/arm/musicpal.c
@@ -1657,7 +1657,6 @@ static void musicpal_init(MachineState *machine)
 qdev_prop_set_uint32(dev, "num-blocks", flash_size / sector_size);
 qdev_prop_set_uint32(dev, "sector-length", sector_size);
 qdev_prop_set_uint8(dev, "width", 2); /* 16-bit */
-qdev_prop_set_uint8(dev, "mappings", 0);
 qdev_prop_set_uint8(dev, "big-endian", 0);
 qdev_prop_set_uint16(dev, "id0", 0x00bf);
 qdev_prop_set_uint16(dev, "id1", 0x236d);
diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
index 8db6cfd47f5..d12b00e7648 100644
--- a/hw/arm/xilinx_zynq.c
+++ b/hw/arm/xilinx_zynq.c
@@ -220,7 +220,7 @@ static void zynq_init(MachineState *machine)
 pflash_cfi02_register(0xe200, "zynq.pflash", FLASH_SIZE,
   dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
   FLASH_SECTOR_SIZE, 1,
-  1, 0x0066, 0x0022, 0x, 0x, 0x0555, 0x2aa,
+  0x0066, 0x0022, 0x, 0x, 0x0555, 0x2aa,
   0);
 
 /* Create the main clock source, and feed slcr with it */
diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
index 6f4b3e3c3fe..2b412402fac 100644
--- a/hw/block/pflash_cfi02.c
+++ b/hw/block/pflash_cfi02.c
@@ -968,7 +968,7 @@ PFlashCFI02 *pflash_cfi02_register(hwaddr base,
hwaddr size,
BlockBackend *blk,
uint32_t sector_len,
-   int nb_mappings, int width,
+   int width,
uint16_t id0, uint16_t id1,
uint16_t id2, uint16_t id3,
uint16_t unlock_addr0,
@@ -977,7 +977,6 @@ PFlashCFI02 *pflash_cfi02_register(hwaddr base,
 {
 DeviceState *dev = qdev_new(TYPE_PFLASH_CFI02);
 
-assert(nb_mappings <= 1);
 if (blk) {
 qdev_prop_set_drive(dev, "drive", blk);
 }
diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c
index b5d97dd53ed..96877ba7cfb 100644
--- a/hw/lm32/lm32_boards.c
+++ b/hw/lm32/lm32_boards.c
@@ -121,7 +121,7 @@ static void lm32_evr_init(MachineState *machine)
 pflash_cfi02_register(flash_base, "lm32_evr.flash", flash_size,
   dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
   flash_sector_size,
-  1, 2, 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1);
+  2, 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1);
 
 /* create irq lines */
 env->pic_state = lm32_pic_init(qemu_allocate_irq(cpu_irq_handler, cpu, 0));
@@ -218,7 +218,7 @@ static void lm32_uclinux_init(MachineState *machine)
 pflash_cfi02_register(flash_base, "lm32_uclinux.flash", flash_size,
   dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
   flash_sector_size,
-  1, 2, 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1);
+