mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-18 05:28:36 -07:00
hw/arm/versatilepb hw/arm/vexpress: Replace drive_get_next() by drive_get()
drive_get_next() is basically a bad idea. It returns the "next" block
backend of a certain interface type. "Next" means bus=0,unit=N, where
subsequent calls count N up from zero, per interface type.
This lets you define unit numbers implicitly by execution order. If the
order changes, or new calls appear "in the middle", unit numbers change.
ABI break. Hard to spot in review.
The versatile and vexpress machines ("versatileab", "versatilepb",
"vexpress-a9", "vexpress-a15") connect just one or two backends of a
type with drive_get_next(). Change them to use drive_get() directly.
This makes the unit numbers explicit in the code.
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20211117163409.3587705-5-armbru@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
93d8bc8f5b
commit
d83c29e981
2 changed files with 5 additions and 5 deletions
|
|
@ -310,7 +310,7 @@ static void versatile_init(MachineState *machine, int board_id)
|
||||||
qdev_connect_gpio_out(sysctl, 0, qdev_get_gpio_in(dev, 0));
|
qdev_connect_gpio_out(sysctl, 0, qdev_get_gpio_in(dev, 0));
|
||||||
|
|
||||||
dev = sysbus_create_varargs("pl181", 0x10005000, sic[22], sic[1], NULL);
|
dev = sysbus_create_varargs("pl181", 0x10005000, sic[22], sic[1], NULL);
|
||||||
dinfo = drive_get_next(IF_SD);
|
dinfo = drive_get(IF_SD, 0, 0);
|
||||||
if (dinfo) {
|
if (dinfo) {
|
||||||
DeviceState *card;
|
DeviceState *card;
|
||||||
|
|
||||||
|
|
@ -322,7 +322,7 @@ static void versatile_init(MachineState *machine, int board_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
dev = sysbus_create_varargs("pl181", 0x1000b000, sic[23], sic[2], NULL);
|
dev = sysbus_create_varargs("pl181", 0x1000b000, sic[23], sic[2], NULL);
|
||||||
dinfo = drive_get_next(IF_SD);
|
dinfo = drive_get(IF_SD, 0, 1);
|
||||||
if (dinfo) {
|
if (dinfo) {
|
||||||
DeviceState *card;
|
DeviceState *card;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -625,7 +625,7 @@ static void vexpress_common_init(MachineState *machine)
|
||||||
qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT));
|
qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT));
|
||||||
qdev_connect_gpio_out_named(dev, "card-inserted", 0,
|
qdev_connect_gpio_out_named(dev, "card-inserted", 0,
|
||||||
qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN));
|
qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN));
|
||||||
dinfo = drive_get_next(IF_SD);
|
dinfo = drive_get(IF_SD, 0, 0);
|
||||||
if (dinfo) {
|
if (dinfo) {
|
||||||
DeviceState *card;
|
DeviceState *card;
|
||||||
|
|
||||||
|
|
@ -657,7 +657,7 @@ static void vexpress_common_init(MachineState *machine)
|
||||||
|
|
||||||
sysbus_create_simple("pl111", map[VE_CLCD], pic[14]);
|
sysbus_create_simple("pl111", map[VE_CLCD], pic[14]);
|
||||||
|
|
||||||
dinfo = drive_get_next(IF_PFLASH);
|
dinfo = drive_get(IF_PFLASH, 0, 0);
|
||||||
pflash0 = ve_pflash_cfi01_register(map[VE_NORFLASH0], "vexpress.flash0",
|
pflash0 = ve_pflash_cfi01_register(map[VE_NORFLASH0], "vexpress.flash0",
|
||||||
dinfo);
|
dinfo);
|
||||||
if (!pflash0) {
|
if (!pflash0) {
|
||||||
|
|
@ -673,7 +673,7 @@ static void vexpress_common_init(MachineState *machine)
|
||||||
memory_region_add_subregion(sysmem, map[VE_NORFLASHALIAS], flashalias);
|
memory_region_add_subregion(sysmem, map[VE_NORFLASHALIAS], flashalias);
|
||||||
}
|
}
|
||||||
|
|
||||||
dinfo = drive_get_next(IF_PFLASH);
|
dinfo = drive_get(IF_PFLASH, 0, 1);
|
||||||
if (!ve_pflash_cfi01_register(map[VE_NORFLASH1], "vexpress.flash1",
|
if (!ve_pflash_cfi01_register(map[VE_NORFLASH1], "vexpress.flash1",
|
||||||
dinfo)) {
|
dinfo)) {
|
||||||
error_report("vexpress: error registering flash 1");
|
error_report("vexpress: error registering flash 1");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue