mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-27 05:20:50 +00:00
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/arm/boot.h"
|
||||
#include "hw/arm/primecell.h"
|
||||
#include "hw/core/split-irq.h"
|
||||
#include "hw/net/lan9118.h"
|
||||
#include "hw/net/smc91c111.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#include "hw/qdev-core.h"
|
||||
#include "net/net.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "hw/boards.h"
|
||||
@ -53,6 +55,20 @@ static const int realview_board_id[] = {
|
||||
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,
|
||||
enum realview_board_type board_type)
|
||||
{
|
||||
@ -66,7 +82,6 @@ static void realview_init(MachineState *machine,
|
||||
DeviceState *dev, *sysctl, *gpio2, *pl041;
|
||||
SysBusDevice *busdev;
|
||||
qemu_irq pic[64];
|
||||
qemu_irq mmc_irq[2];
|
||||
PCIBus *pci_bus = NULL;
|
||||
NICInfo *nd;
|
||||
DriveInfo *dinfo;
|
||||
@ -229,14 +244,14 @@ static void realview_init(MachineState *machine,
|
||||
* and the PL061 has them the other way about. Also the card
|
||||
* detect line is inverted.
|
||||
*/
|
||||
mmc_irq[0] = qemu_irq_split(
|
||||
qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT),
|
||||
qdev_get_gpio_in(gpio2, 1));
|
||||
mmc_irq[1] = qemu_irq_split(
|
||||
qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN),
|
||||
qemu_irq_invert(qdev_get_gpio_in(gpio2, 0)));
|
||||
qdev_connect_gpio_out_named(dev, "card-read-only", 0, mmc_irq[0]);
|
||||
qdev_connect_gpio_out_named(dev, "card-inserted", 0, mmc_irq[1]);
|
||||
split_irq_from_named(dev, "card-read-only",
|
||||
qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT),
|
||||
qdev_get_gpio_in(gpio2, 1));
|
||||
|
||||
split_irq_from_named(dev, "card-inserted",
|
||||
qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN),
|
||||
qemu_irq_invert(qdev_get_gpio_in(gpio2, 0)));
|
||||
|
||||
dinfo = drive_get(IF_SD, 0, 0);
|
||||
if (dinfo) {
|
||||
DeviceState *card;
|
||||
|
Loading…
Reference in New Issue
Block a user