diff mbox series

[v2,13/13] mac_nvram: Use NVRAM_SIZE constant

Message ID ed0551ed1d861c50706e27b39f24fd4699429c7e.1664108862.git.balaton@eik.bme.hu
State New
Headers show
Series Misc ppc/mac machines clean up | expand

Commit Message

BALATON Zoltan Sept. 25, 2022, 12:38 p.m. UTC
The NVRAM_SIZE constant was defined but not used. Rename it to
MACIO_NVRAM_SIZE to match the device model and use it where appropriate.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
 hw/misc/macio/macio.c        | 2 +-
 hw/ppc/mac_newworld.c        | 4 ++--
 include/hw/nvram/mac_nvram.h | 3 +--
 3 files changed, 4 insertions(+), 5 deletions(-)

Comments

Mark Cave-Ayland Sept. 29, 2022, 7:45 a.m. UTC | #1
On 25/09/2022 13:38, BALATON Zoltan wrote:

> The NVRAM_SIZE constant was defined but not used. Rename it to
> MACIO_NVRAM_SIZE to match the device model and use it where appropriate.
> 
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
>   hw/misc/macio/macio.c        | 2 +-
>   hw/ppc/mac_newworld.c        | 4 ++--
>   include/hw/nvram/mac_nvram.h | 3 +--
>   3 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
> index 93a7c7bbc8..08dbdd7fc0 100644
> --- a/hw/misc/macio/macio.c
> +++ b/hw/misc/macio/macio.c
> @@ -226,7 +226,7 @@ static void macio_oldworld_init(Object *obj)
>   
>       object_initialize_child(OBJECT(s), "nvram", &os->nvram, TYPE_MACIO_NVRAM);
>       dev = DEVICE(&os->nvram);
> -    qdev_prop_set_uint32(dev, "size", 0x2000);
> +    qdev_prop_set_uint32(dev, "size", MACIO_NVRAM_SIZE);
>       qdev_prop_set_uint32(dev, "it_shift", 4);
>   
>       for (i = 0; i < 2; i++) {
> diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
> index c0b2173cbd..37fb7845f1 100644
> --- a/hw/ppc/mac_newworld.c
> +++ b/hw/ppc/mac_newworld.c
> @@ -445,12 +445,12 @@ static void ppc_core99_init(MachineState *machine)
>           nvram_addr = 0xFFE00000;
>       }
>       dev = qdev_new(TYPE_MACIO_NVRAM);
> -    qdev_prop_set_uint32(dev, "size", 0x2000);
> +    qdev_prop_set_uint32(dev, "size", MACIO_NVRAM_SIZE);
>       qdev_prop_set_uint32(dev, "it_shift", 1);
>       sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
>       sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, nvram_addr);
>       nvr = MACIO_NVRAM(dev);
> -    pmac_format_nvram_partition(nvr, 0x2000);
> +    pmac_format_nvram_partition(nvr, MACIO_NVRAM_SIZE);
>       /* No PCI init: the BIOS will do it */
>   
>       dev = qdev_new(TYPE_FW_CFG_MEM);
> diff --git a/include/hw/nvram/mac_nvram.h b/include/hw/nvram/mac_nvram.h
> index baa9f6a5a6..b780aca470 100644
> --- a/include/hw/nvram/mac_nvram.h
> +++ b/include/hw/nvram/mac_nvram.h
> @@ -29,9 +29,8 @@
>   #include "exec/memory.h"
>   #include "hw/sysbus.h"
>   
> -#define NVRAM_SIZE        0x2000
> +#define MACIO_NVRAM_SIZE 0x2000
>   
> -/* Mac NVRAM */
>   #define TYPE_MACIO_NVRAM "macio-nvram"
>   OBJECT_DECLARE_SIMPLE_TYPE(MacIONVRAMState, MACIO_NVRAM)

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.
diff mbox series

Patch

diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
index 93a7c7bbc8..08dbdd7fc0 100644
--- a/hw/misc/macio/macio.c
+++ b/hw/misc/macio/macio.c
@@ -226,7 +226,7 @@  static void macio_oldworld_init(Object *obj)
 
     object_initialize_child(OBJECT(s), "nvram", &os->nvram, TYPE_MACIO_NVRAM);
     dev = DEVICE(&os->nvram);
-    qdev_prop_set_uint32(dev, "size", 0x2000);
+    qdev_prop_set_uint32(dev, "size", MACIO_NVRAM_SIZE);
     qdev_prop_set_uint32(dev, "it_shift", 4);
 
     for (i = 0; i < 2; i++) {
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index c0b2173cbd..37fb7845f1 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -445,12 +445,12 @@  static void ppc_core99_init(MachineState *machine)
         nvram_addr = 0xFFE00000;
     }
     dev = qdev_new(TYPE_MACIO_NVRAM);
-    qdev_prop_set_uint32(dev, "size", 0x2000);
+    qdev_prop_set_uint32(dev, "size", MACIO_NVRAM_SIZE);
     qdev_prop_set_uint32(dev, "it_shift", 1);
     sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
     sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, nvram_addr);
     nvr = MACIO_NVRAM(dev);
-    pmac_format_nvram_partition(nvr, 0x2000);
+    pmac_format_nvram_partition(nvr, MACIO_NVRAM_SIZE);
     /* No PCI init: the BIOS will do it */
 
     dev = qdev_new(TYPE_FW_CFG_MEM);
diff --git a/include/hw/nvram/mac_nvram.h b/include/hw/nvram/mac_nvram.h
index baa9f6a5a6..b780aca470 100644
--- a/include/hw/nvram/mac_nvram.h
+++ b/include/hw/nvram/mac_nvram.h
@@ -29,9 +29,8 @@ 
 #include "exec/memory.h"
 #include "hw/sysbus.h"
 
-#define NVRAM_SIZE        0x2000
+#define MACIO_NVRAM_SIZE 0x2000
 
-/* Mac NVRAM */
 #define TYPE_MACIO_NVRAM "macio-nvram"
 OBJECT_DECLARE_SIMPLE_TYPE(MacIONVRAMState, MACIO_NVRAM)