mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
hw/arm/virt: Minor code reshuffling in create_acpi_ged
Use a local SysBusDevice handle. Also use the newly introduced sysbus_mmio_map_name which brings better readability about the region being mapped. GED device has regions which exist depending on some external properties and it becomes difficult to guess the index of a region. Better refer to a region by its name. Signed-off-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Message-Id: <20250714080639.2525563-32-eric.auger@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
committed by
Michael S. Tsirkin
parent
1a10285665
commit
cfd4ace6e5
+7
-4
@@ -688,6 +688,7 @@ static inline DeviceState *create_acpi_ged(VirtMachineState *vms)
|
||||
{
|
||||
DeviceState *dev;
|
||||
MachineState *ms = MACHINE(vms);
|
||||
SysBusDevice *sbdev;
|
||||
int irq = vms->irqmap[VIRT_ACPI_GED];
|
||||
uint32_t event = ACPI_GED_PWR_DOWN_EVT;
|
||||
|
||||
@@ -702,11 +703,13 @@ static inline DeviceState *create_acpi_ged(VirtMachineState *vms)
|
||||
dev = qdev_new(TYPE_ACPI_GED);
|
||||
qdev_prop_set_uint32(dev, "ged-event", event);
|
||||
object_property_set_link(OBJECT(dev), "bus", OBJECT(vms->bus), &error_abort);
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||
sbdev = SYS_BUS_DEVICE(dev);
|
||||
sysbus_realize_and_unref(sbdev, &error_fatal);
|
||||
|
||||
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, vms->memmap[VIRT_ACPI_GED].base);
|
||||
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, vms->memmap[VIRT_PCDIMM_ACPI].base);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, qdev_get_gpio_in(vms->gic, irq));
|
||||
sysbus_mmio_map_name(sbdev, TYPE_ACPI_GED, vms->memmap[VIRT_ACPI_GED].base);
|
||||
sysbus_mmio_map_name(sbdev, ACPI_MEMHP_REGION_NAME,
|
||||
vms->memmap[VIRT_PCDIMM_ACPI].base);
|
||||
sysbus_connect_irq(sbdev, 0, qdev_get_gpio_in(vms->gic, irq));
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
@@ -111,6 +111,7 @@ typedef struct GEDState {
|
||||
} GEDState;
|
||||
|
||||
#define ACPI_PCIHP_REGION_NAME "pcihp container"
|
||||
#define ACPI_MEMHP_REGION_NAME "memhp container"
|
||||
|
||||
struct AcpiGedState {
|
||||
SysBusDevice parent_obj;
|
||||
|
||||
Reference in New Issue
Block a user