hw/misc/macio: Rename sysbus_dev to sbd for consistency and brevity
Some functions use sysbus_dev while others sbd name for local variable storing a sysbus device pointer. Standardise on the shorter name to be consistent and make the code easier to read as short name is less distracting and needs less line breaks. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Message-Id: <6c79d6903fc11e153f8050a374904c2b5d5db585.1674001242.git.balaton@eik.bme.hu> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
This commit is contained in:
parent
ea361fc348
commit
740ce28c46
@ -96,14 +96,14 @@ static void macio_bar_setup(MacIOState *s)
|
|||||||
static void macio_common_realize(PCIDevice *d, Error **errp)
|
static void macio_common_realize(PCIDevice *d, Error **errp)
|
||||||
{
|
{
|
||||||
MacIOState *s = MACIO(d);
|
MacIOState *s = MACIO(d);
|
||||||
SysBusDevice *sysbus_dev;
|
SysBusDevice *sbd;
|
||||||
|
|
||||||
if (!qdev_realize(DEVICE(&s->dbdma), BUS(&s->macio_bus), errp)) {
|
if (!qdev_realize(DEVICE(&s->dbdma), BUS(&s->macio_bus), errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sysbus_dev = SYS_BUS_DEVICE(&s->dbdma);
|
sbd = SYS_BUS_DEVICE(&s->dbdma);
|
||||||
memory_region_add_subregion(&s->bar, 0x08000,
|
memory_region_add_subregion(&s->bar, 0x08000,
|
||||||
sysbus_mmio_get_region(sysbus_dev, 0));
|
sysbus_mmio_get_region(sbd, 0));
|
||||||
|
|
||||||
qdev_prop_set_uint32(DEVICE(&s->escc), "disabled", 0);
|
qdev_prop_set_uint32(DEVICE(&s->escc), "disabled", 0);
|
||||||
qdev_prop_set_uint32(DEVICE(&s->escc), "frequency", ESCC_CLOCK);
|
qdev_prop_set_uint32(DEVICE(&s->escc), "frequency", ESCC_CLOCK);
|
||||||
@ -122,11 +122,10 @@ static void macio_realize_ide(MacIOState *s, MACIOIDEState *ide,
|
|||||||
qemu_irq irq0, qemu_irq irq1, int dmaid,
|
qemu_irq irq0, qemu_irq irq1, int dmaid,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
SysBusDevice *sysbus_dev;
|
SysBusDevice *sbd = SYS_BUS_DEVICE(ide);
|
||||||
|
|
||||||
sysbus_dev = SYS_BUS_DEVICE(ide);
|
sysbus_connect_irq(sbd, 0, irq0);
|
||||||
sysbus_connect_irq(sysbus_dev, 0, irq0);
|
sysbus_connect_irq(sbd, 1, irq1);
|
||||||
sysbus_connect_irq(sysbus_dev, 1, irq1);
|
|
||||||
qdev_prop_set_uint32(DEVICE(ide), "channel", dmaid);
|
qdev_prop_set_uint32(DEVICE(ide), "channel", dmaid);
|
||||||
object_property_set_link(OBJECT(ide), "dbdma", OBJECT(&s->dbdma),
|
object_property_set_link(OBJECT(ide), "dbdma", OBJECT(&s->dbdma),
|
||||||
&error_abort);
|
&error_abort);
|
||||||
@ -141,7 +140,7 @@ static void macio_oldworld_realize(PCIDevice *d, Error **errp)
|
|||||||
OldWorldMacIOState *os = OLDWORLD_MACIO(d);
|
OldWorldMacIOState *os = OLDWORLD_MACIO(d);
|
||||||
DeviceState *pic_dev = DEVICE(&os->pic);
|
DeviceState *pic_dev = DEVICE(&os->pic);
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
SysBusDevice *sysbus_dev;
|
SysBusDevice *sbd;
|
||||||
|
|
||||||
macio_common_realize(d, &err);
|
macio_common_realize(d, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -153,33 +152,30 @@ static void macio_oldworld_realize(PCIDevice *d, Error **errp)
|
|||||||
if (!qdev_realize(DEVICE(&os->pic), BUS(&s->macio_bus), errp)) {
|
if (!qdev_realize(DEVICE(&os->pic), BUS(&s->macio_bus), errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sysbus_dev = SYS_BUS_DEVICE(&os->pic);
|
sbd = SYS_BUS_DEVICE(&os->pic);
|
||||||
memory_region_add_subregion(&s->bar, 0x0,
|
memory_region_add_subregion(&s->bar, 0x0,
|
||||||
sysbus_mmio_get_region(sysbus_dev, 0));
|
sysbus_mmio_get_region(sbd, 0));
|
||||||
|
|
||||||
qdev_prop_set_uint64(DEVICE(&s->cuda), "timebase-frequency",
|
qdev_prop_set_uint64(DEVICE(&s->cuda), "timebase-frequency",
|
||||||
s->frequency);
|
s->frequency);
|
||||||
if (!qdev_realize(DEVICE(&s->cuda), BUS(&s->macio_bus), errp)) {
|
if (!qdev_realize(DEVICE(&s->cuda), BUS(&s->macio_bus), errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sysbus_dev = SYS_BUS_DEVICE(&s->cuda);
|
sbd = SYS_BUS_DEVICE(&s->cuda);
|
||||||
memory_region_add_subregion(&s->bar, 0x16000,
|
memory_region_add_subregion(&s->bar, 0x16000,
|
||||||
sysbus_mmio_get_region(sysbus_dev, 0));
|
sysbus_mmio_get_region(sbd, 0));
|
||||||
sysbus_connect_irq(sysbus_dev, 0, qdev_get_gpio_in(pic_dev,
|
sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(pic_dev, OLDWORLD_CUDA_IRQ));
|
||||||
OLDWORLD_CUDA_IRQ));
|
|
||||||
|
|
||||||
sysbus_dev = SYS_BUS_DEVICE(&s->escc);
|
sbd = SYS_BUS_DEVICE(&s->escc);
|
||||||
sysbus_connect_irq(sysbus_dev, 0, qdev_get_gpio_in(pic_dev,
|
sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(pic_dev, OLDWORLD_ESCCB_IRQ));
|
||||||
OLDWORLD_ESCCB_IRQ));
|
sysbus_connect_irq(sbd, 1, qdev_get_gpio_in(pic_dev, OLDWORLD_ESCCA_IRQ));
|
||||||
sysbus_connect_irq(sysbus_dev, 1, qdev_get_gpio_in(pic_dev,
|
|
||||||
OLDWORLD_ESCCA_IRQ));
|
|
||||||
|
|
||||||
if (!qdev_realize(DEVICE(&os->nvram), BUS(&s->macio_bus), errp)) {
|
if (!qdev_realize(DEVICE(&os->nvram), BUS(&s->macio_bus), errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sysbus_dev = SYS_BUS_DEVICE(&os->nvram);
|
sbd = SYS_BUS_DEVICE(&os->nvram);
|
||||||
memory_region_add_subregion(&s->bar, 0x60000,
|
memory_region_add_subregion(&s->bar, 0x60000,
|
||||||
sysbus_mmio_get_region(sysbus_dev, 0));
|
sysbus_mmio_get_region(sbd, 0));
|
||||||
pmac_format_nvram_partition(&os->nvram, os->nvram.size);
|
pmac_format_nvram_partition(&os->nvram, os->nvram.size);
|
||||||
|
|
||||||
/* IDE buses */
|
/* IDE buses */
|
||||||
@ -274,7 +270,7 @@ static void macio_newworld_realize(PCIDevice *d, Error **errp)
|
|||||||
NewWorldMacIOState *ns = NEWWORLD_MACIO(d);
|
NewWorldMacIOState *ns = NEWWORLD_MACIO(d);
|
||||||
DeviceState *pic_dev = DEVICE(&ns->pic);
|
DeviceState *pic_dev = DEVICE(&ns->pic);
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
SysBusDevice *sysbus_dev;
|
SysBusDevice *sbd;
|
||||||
MemoryRegion *timer_memory = NULL;
|
MemoryRegion *timer_memory = NULL;
|
||||||
|
|
||||||
macio_common_realize(d, &err);
|
macio_common_realize(d, &err);
|
||||||
@ -285,16 +281,14 @@ static void macio_newworld_realize(PCIDevice *d, Error **errp)
|
|||||||
|
|
||||||
/* OpenPIC */
|
/* OpenPIC */
|
||||||
qdev_prop_set_uint32(pic_dev, "model", OPENPIC_MODEL_KEYLARGO);
|
qdev_prop_set_uint32(pic_dev, "model", OPENPIC_MODEL_KEYLARGO);
|
||||||
sysbus_dev = SYS_BUS_DEVICE(&ns->pic);
|
sbd = SYS_BUS_DEVICE(&ns->pic);
|
||||||
sysbus_realize_and_unref(sysbus_dev, &error_fatal);
|
sysbus_realize_and_unref(sbd, &error_fatal);
|
||||||
memory_region_add_subregion(&s->bar, 0x40000,
|
memory_region_add_subregion(&s->bar, 0x40000,
|
||||||
sysbus_mmio_get_region(sysbus_dev, 0));
|
sysbus_mmio_get_region(sbd, 0));
|
||||||
|
|
||||||
sysbus_dev = SYS_BUS_DEVICE(&s->escc);
|
sbd = SYS_BUS_DEVICE(&s->escc);
|
||||||
sysbus_connect_irq(sysbus_dev, 0, qdev_get_gpio_in(pic_dev,
|
sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(pic_dev, NEWWORLD_ESCCB_IRQ));
|
||||||
NEWWORLD_ESCCB_IRQ));
|
sysbus_connect_irq(sbd, 1, qdev_get_gpio_in(pic_dev, NEWWORLD_ESCCA_IRQ));
|
||||||
sysbus_connect_irq(sysbus_dev, 1, qdev_get_gpio_in(pic_dev,
|
|
||||||
NEWWORLD_ESCCA_IRQ));
|
|
||||||
|
|
||||||
/* IDE buses */
|
/* IDE buses */
|
||||||
macio_realize_ide(s, &ns->ide[0],
|
macio_realize_ide(s, &ns->ide[0],
|
||||||
@ -326,27 +320,26 @@ static void macio_newworld_realize(PCIDevice *d, Error **errp)
|
|||||||
if (!qdev_realize(DEVICE(&ns->gpio), BUS(&s->macio_bus), errp)) {
|
if (!qdev_realize(DEVICE(&ns->gpio), BUS(&s->macio_bus), errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sysbus_dev = SYS_BUS_DEVICE(&ns->gpio);
|
sbd = SYS_BUS_DEVICE(&ns->gpio);
|
||||||
sysbus_connect_irq(sysbus_dev, 1, qdev_get_gpio_in(pic_dev,
|
sysbus_connect_irq(sbd, 1, qdev_get_gpio_in(pic_dev,
|
||||||
NEWWORLD_EXTING_GPIO1));
|
NEWWORLD_EXTING_GPIO1));
|
||||||
sysbus_connect_irq(sysbus_dev, 9, qdev_get_gpio_in(pic_dev,
|
sysbus_connect_irq(sbd, 9, qdev_get_gpio_in(pic_dev,
|
||||||
NEWWORLD_EXTING_GPIO9));
|
NEWWORLD_EXTING_GPIO9));
|
||||||
memory_region_add_subregion(&s->bar, 0x50,
|
memory_region_add_subregion(&s->bar, 0x50,
|
||||||
sysbus_mmio_get_region(sysbus_dev, 0));
|
sysbus_mmio_get_region(sbd, 0));
|
||||||
|
|
||||||
/* PMU */
|
/* PMU */
|
||||||
object_initialize_child(OBJECT(s), "pmu", &s->pmu, TYPE_VIA_PMU);
|
object_initialize_child(OBJECT(s), "pmu", &s->pmu, TYPE_VIA_PMU);
|
||||||
object_property_set_link(OBJECT(&s->pmu), "gpio", OBJECT(sysbus_dev),
|
object_property_set_link(OBJECT(&s->pmu), "gpio", OBJECT(sbd),
|
||||||
&error_abort);
|
&error_abort);
|
||||||
qdev_prop_set_bit(DEVICE(&s->pmu), "has-adb", ns->has_adb);
|
qdev_prop_set_bit(DEVICE(&s->pmu), "has-adb", ns->has_adb);
|
||||||
if (!qdev_realize(DEVICE(&s->pmu), BUS(&s->macio_bus), errp)) {
|
if (!qdev_realize(DEVICE(&s->pmu), BUS(&s->macio_bus), errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sysbus_dev = SYS_BUS_DEVICE(&s->pmu);
|
sbd = SYS_BUS_DEVICE(&s->pmu);
|
||||||
sysbus_connect_irq(sysbus_dev, 0, qdev_get_gpio_in(pic_dev,
|
sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(pic_dev, NEWWORLD_PMU_IRQ));
|
||||||
NEWWORLD_PMU_IRQ));
|
|
||||||
memory_region_add_subregion(&s->bar, 0x16000,
|
memory_region_add_subregion(&s->bar, 0x16000,
|
||||||
sysbus_mmio_get_region(sysbus_dev, 0));
|
sysbus_mmio_get_region(sbd, 0));
|
||||||
} else {
|
} else {
|
||||||
object_unparent(OBJECT(&ns->gpio));
|
object_unparent(OBJECT(&ns->gpio));
|
||||||
|
|
||||||
@ -358,11 +351,10 @@ static void macio_newworld_realize(PCIDevice *d, Error **errp)
|
|||||||
if (!qdev_realize(DEVICE(&s->cuda), BUS(&s->macio_bus), errp)) {
|
if (!qdev_realize(DEVICE(&s->cuda), BUS(&s->macio_bus), errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sysbus_dev = SYS_BUS_DEVICE(&s->cuda);
|
sbd = SYS_BUS_DEVICE(&s->cuda);
|
||||||
sysbus_connect_irq(sysbus_dev, 0, qdev_get_gpio_in(pic_dev,
|
sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(pic_dev, NEWWORLD_CUDA_IRQ));
|
||||||
NEWWORLD_CUDA_IRQ));
|
|
||||||
memory_region_add_subregion(&s->bar, 0x16000,
|
memory_region_add_subregion(&s->bar, 0x16000,
|
||||||
sysbus_mmio_get_region(sysbus_dev, 0));
|
sysbus_mmio_get_region(sbd, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user