|
From: | ckim |
Subject: | When is SysBusDevice's num_mmios determined? and does SYS_BUS_DEVICE macro allocate memory? |
Date: | Fri, 4 Jun 2021 17:46:33 +0900 |
Hello, experts and users, I thought I need to understand the basic qemu object model. This is from the ethernet controller hw/net/smc91c111.c (version 5.1.0). void smc91c111_init(NICInfo *nd, uint32_t base, qemu_irq irq) { DeviceState *dev; SysBusDevice *s; qemu_check_nic_model(nd, "smc91c111"); dev = qdev_new(TYPE_SMC91C111); qdev_set_nic_properties(dev, nd); s = SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(s, &error_fatal); sysbus_mmio_map(s, 0, base); sysbus_connect_irq(s, 0, irq); } The sysbus_mmio_map function checks if the given mmio range number (here 0) is between 0 and num_mmios of the SyBusDevice. But when is the num_mmios value inside the struct SysBusDevice determined? I couldn’t follow it up. And SysBusDevice includes DeviceState, then does the s = SYS_BUS_DEVICE(dev) statement allocates the SysBusDevice on memory? Any comment will be deeply appreciated. Thanks! Chan Kim |
[Prev in Thread] | Current Thread | [Next in Thread] |