hw/misc/allwinner-dramc: Do not use SysBus API to map local MMIO region
commitfaef398291598e39a4484947d44bb177b4596120
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Wed, 18 Oct 2023 08:13:54 +0000 (18 10:13 +0200)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Thu, 19 Oct 2023 21:13:28 +0000 (19 23:13 +0200)
tree3758b7a664e975c2d0a6d573a8139c62d0c446b3
parentd71af7c83eb4a6adbaf3ce0afba1d3dfbf4a6e2c
hw/misc/allwinner-dramc: Do not use SysBus API to map local MMIO region

There is no point in exposing an internal MMIO region via
SysBus and directly mapping it in the very same device.

Just map it without using the SysBus API.

Transformation done using the following coccinelle script:

  @@
  expression sbdev;
  expression index;
  expression addr;
  expression subregion;
  @@
  -    sysbus_init_mmio(sbdev, subregion);
       ... when != sbdev
  -    sysbus_mmio_map(sbdev, index, addr);
  +    memory_region_add_subregion(get_system_memory(),
  +                                addr, subregion);

  @@
  expression priority;
  @@
  -    sysbus_init_mmio(sbdev, subregion);
       ... when != sbdev
  -    sysbus_mmio_map_overlap(sbdev, index, addr, priority);
  +    memory_region_add_subregion_overlap(get_system_memory(),
  +                                        addr,
  +                                        subregion, priority);

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20231019071611.98885-5-philmd@linaro.org>
hw/misc/allwinner-r40-dramc.c