hw/arm/realview: replace 'qemu_split_irq' with 'TYPE_SPLIT_IRQ'
Signed-off-by: Zongyuan Li <zongyuan.li@smartx.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20220324181557.203805-2-zongyuan.li@smartx.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
f37fc537fc
commit
d5c3eb50af
|
@ -13,9 +13,11 @@
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "hw/arm/boot.h"
|
#include "hw/arm/boot.h"
|
||||||
#include "hw/arm/primecell.h"
|
#include "hw/arm/primecell.h"
|
||||||
|
#include "hw/core/split-irq.h"
|
||||||
#include "hw/net/lan9118.h"
|
#include "hw/net/lan9118.h"
|
||||||
#include "hw/net/smc91c111.h"
|
#include "hw/net/smc91c111.h"
|
||||||
#include "hw/pci/pci.h"
|
#include "hw/pci/pci.h"
|
||||||
|
#include "hw/qdev-core.h"
|
||||||
#include "net/net.h"
|
#include "net/net.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "hw/boards.h"
|
#include "hw/boards.h"
|
||||||
|
@ -53,6 +55,20 @@ static const int realview_board_id[] = {
|
||||||
0x76d
|
0x76d
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void split_irq_from_named(DeviceState *src, const char* outname,
|
||||||
|
qemu_irq out1, qemu_irq out2) {
|
||||||
|
DeviceState *splitter = qdev_new(TYPE_SPLIT_IRQ);
|
||||||
|
|
||||||
|
qdev_prop_set_uint32(splitter, "num-lines", 2);
|
||||||
|
|
||||||
|
qdev_realize_and_unref(splitter, NULL, &error_fatal);
|
||||||
|
|
||||||
|
qdev_connect_gpio_out(splitter, 0, out1);
|
||||||
|
qdev_connect_gpio_out(splitter, 1, out2);
|
||||||
|
qdev_connect_gpio_out_named(src, outname, 0,
|
||||||
|
qdev_get_gpio_in(splitter, 0));
|
||||||
|
}
|
||||||
|
|
||||||
static void realview_init(MachineState *machine,
|
static void realview_init(MachineState *machine,
|
||||||
enum realview_board_type board_type)
|
enum realview_board_type board_type)
|
||||||
{
|
{
|
||||||
|
@ -66,7 +82,6 @@ static void realview_init(MachineState *machine,
|
||||||
DeviceState *dev, *sysctl, *gpio2, *pl041;
|
DeviceState *dev, *sysctl, *gpio2, *pl041;
|
||||||
SysBusDevice *busdev;
|
SysBusDevice *busdev;
|
||||||
qemu_irq pic[64];
|
qemu_irq pic[64];
|
||||||
qemu_irq mmc_irq[2];
|
|
||||||
PCIBus *pci_bus = NULL;
|
PCIBus *pci_bus = NULL;
|
||||||
NICInfo *nd;
|
NICInfo *nd;
|
||||||
DriveInfo *dinfo;
|
DriveInfo *dinfo;
|
||||||
|
@ -229,14 +244,14 @@ static void realview_init(MachineState *machine,
|
||||||
* and the PL061 has them the other way about. Also the card
|
* and the PL061 has them the other way about. Also the card
|
||||||
* detect line is inverted.
|
* detect line is inverted.
|
||||||
*/
|
*/
|
||||||
mmc_irq[0] = qemu_irq_split(
|
split_irq_from_named(dev, "card-read-only",
|
||||||
qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT),
|
qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT),
|
||||||
qdev_get_gpio_in(gpio2, 1));
|
qdev_get_gpio_in(gpio2, 1));
|
||||||
mmc_irq[1] = qemu_irq_split(
|
|
||||||
qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN),
|
split_irq_from_named(dev, "card-inserted",
|
||||||
qemu_irq_invert(qdev_get_gpio_in(gpio2, 0)));
|
qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN),
|
||||||
qdev_connect_gpio_out_named(dev, "card-read-only", 0, mmc_irq[0]);
|
qemu_irq_invert(qdev_get_gpio_in(gpio2, 0)));
|
||||||
qdev_connect_gpio_out_named(dev, "card-inserted", 0, mmc_irq[1]);
|
|
||||||
dinfo = drive_get(IF_SD, 0, 0);
|
dinfo = drive_get(IF_SD, 0, 0);
|
||||||
if (dinfo) {
|
if (dinfo) {
|
||||||
DeviceState *card;
|
DeviceState *card;
|
||||||
|
|
Loading…
Reference in New Issue