Exemplo n.º 1
0
static DeviceState *fdt_create_qdev_from_compat(char *compat, char **dev_type)
{
    DeviceState *ret = NULL;

    char *c = g_strdup(compat);
    ret = qdev_try_create(NULL, c);
    if (!ret) {
        /* QEMU substitutes "."s for ","s in device names, so try with that
         * substitutution
         */
        substitute_char(c, ',', '.');
        ret = qdev_try_create(NULL, c);
    }
    if (!ret) {
        /* try again with the version string trimmed */
        trim_version(c);
        ret = qdev_try_create(NULL, c);
    }

    if (dev_type) {
        *dev_type = c;
    } else {
        g_free(c);
    }
    return ret;
}
Exemplo n.º 2
0
DeviceState *sysbus_try_create_varargs(const char *name,
                                       hwaddr addr, ...)
{
    DeviceState *dev;
    SysBusDevice *s;
    va_list va;
    qemu_irq irq;
    int n;

    dev = qdev_try_create(NULL, name);
    if (!dev) {
        return NULL;
    }
    s = SYS_BUS_DEVICE(dev);
    qdev_init_nofail(dev);
    if (addr != (hwaddr)-1) {
        sysbus_mmio_map(s, 0, addr);
    }
    va_start(va, addr);
    n = 0;
    while (1) {
        irq = va_arg(va, qemu_irq);
        if (!irq) {
            break;
        }
        sysbus_connect_irq(s, n, irq);
        n++;
    }
    va_end(va);
    return dev;
}
Exemplo n.º 3
0
ISADevice *isa_try_create(ISABus *bus, const char *name)
{
    DeviceState *dev;

    dev = qdev_try_create(BUS(bus), name);
    return ISA_DEVICE(dev);
}
Exemplo n.º 4
0
ISADevice *isa_try_create(ISABus *bus, const char *name)
{
    DeviceState *dev;

    if (!bus) {
        hw_error("Tried to create isa device %s with no isa bus present.",
                 name);
    }
    dev = qdev_try_create(BUS(bus), name);
    return ISA_DEVICE(dev);
}
Exemplo n.º 5
0
/* Create a new device.  This only initializes the device state structure
   and allows properties to be set.  qdev_init should be called to
   initialize the actual device emulation.  */
DeviceState *qdev_create(BusState *bus, const char *name)
{
    DeviceState *dev;

    dev = qdev_try_create(bus, name);
    if (!dev) {
        abort();
    }

    return dev;
}