diff mbox series

[3/5] sun4u: use qdev properties instead of legacy m48t59_init() function

Message ID 20201016182739.22875-4-mark.cave-ayland@ilande.co.uk
State Superseded
Headers show
Series m48t59: remove legacy init functions | expand

Commit Message

Mark Cave-Ayland Oct. 16, 2020, 6:27 p.m. UTC
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/sparc64/sun4u.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Philippe Mathieu-Daudé Oct. 17, 2020, 9:43 a.m. UTC | #1
On 10/16/20 8:27 PM, Mark Cave-Ayland wrote:
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


> ---

>   hw/sparc64/sun4u.c | 7 +++++--

>   1 file changed, 5 insertions(+), 2 deletions(-)

> 

> diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c

> index ad5ca2472a..05e659c8a4 100644

> --- a/hw/sparc64/sun4u.c

> +++ b/hw/sparc64/sun4u.c

> @@ -671,10 +671,13 @@ static void sun4uv_init(MemoryRegion *address_space_mem,

>       pci_ide_create_devs(pci_dev);

>   

>       /* Map NVRAM into I/O (ebus) space */

> -    nvram = m48t59_init(NULL, 0, 0, NVRAM_SIZE, 1968, 59);

> -    s = SYS_BUS_DEVICE(nvram);

> +    dev = qdev_new("sysbus-m48t59");

> +    qdev_prop_set_int32(dev, "base-year", 1968);

> +    s = SYS_BUS_DEVICE(dev);

> +    sysbus_realize_and_unref(s, &error_fatal);

>       memory_region_add_subregion(pci_address_space_io(ebus), 0x2000,

>                                   sysbus_mmio_get_region(s, 0));

> +    nvram = NVRAM(dev);

>    

>       initrd_size = 0;

>       initrd_addr = 0;

>
diff mbox series

Patch

diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index ad5ca2472a..05e659c8a4 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -671,10 +671,13 @@  static void sun4uv_init(MemoryRegion *address_space_mem,
     pci_ide_create_devs(pci_dev);
 
     /* Map NVRAM into I/O (ebus) space */
-    nvram = m48t59_init(NULL, 0, 0, NVRAM_SIZE, 1968, 59);
-    s = SYS_BUS_DEVICE(nvram);
+    dev = qdev_new("sysbus-m48t59");
+    qdev_prop_set_int32(dev, "base-year", 1968);
+    s = SYS_BUS_DEVICE(dev);
+    sysbus_realize_and_unref(s, &error_fatal);
     memory_region_add_subregion(pci_address_space_io(ebus), 0x2000,
                                 sysbus_mmio_get_region(s, 0));
+    nvram = NVRAM(dev);
  
     initrd_size = 0;
     initrd_addr = 0;