Commit 3cb75a7c authored by Paolo Bonzini's avatar Paolo Bonzini Committed by Andreas Färber
Browse files

qdev: Move bus properties to a separate global



Simple code movement in order to simplify future refactoring.

Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
parent 2f262e06
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -17,13 +17,15 @@ struct i2c_bus
    uint8_t saved_address;
};

static Property i2c_props[] = {
    DEFINE_PROP_UINT8("address", struct I2CSlave, address, 0),
    DEFINE_PROP_END_OF_LIST(),
};

static struct BusInfo i2c_bus_info = {
    .name = "I2C",
    .size = sizeof(i2c_bus),
    .props = (Property[]) {
        DEFINE_PROP_UINT8("address", struct I2CSlave, address, 0),
        DEFINE_PROP_END_OF_LIST(),
    }
    .props = i2c_props,
};

static void i2c_bus_pre_save(void *opaque)
+6 −4
Original line number Diff line number Diff line
@@ -27,14 +27,16 @@

static char *idebus_get_fw_dev_path(DeviceState *dev);

static Property ide_props[] = {
    DEFINE_PROP_UINT32("unit", IDEDevice, unit, -1),
    DEFINE_PROP_END_OF_LIST(),
};

static struct BusInfo ide_bus_info = {
    .name  = "IDE",
    .size  = sizeof(IDEBus),
    .get_fw_dev_path = idebus_get_fw_dev_path,
    .props = (Property[]) {
        DEFINE_PROP_UINT32("unit", IDEDevice, unit, -1),
        DEFINE_PROP_END_OF_LIST(),
    },
    .props = ide_props,
};

void ide_bus_new(IDEBus *idebus, DeviceState *dev, int bus_id)
+6 −4
Original line number Diff line number Diff line
@@ -29,13 +29,15 @@
/* --------------------------------------------------------------------- */
/* hda bus                                                               */

static Property hda_props[] = {
    DEFINE_PROP_UINT32("cad", HDACodecDevice, cad, -1),
    DEFINE_PROP_END_OF_LIST()
};

static struct BusInfo hda_codec_bus_info = {
    .name      = "HDA",
    .size      = sizeof(HDACodecBus),
    .props     = (Property[]) {
        DEFINE_PROP_UINT32("cad", HDACodecDevice, cad, -1),
        DEFINE_PROP_END_OF_LIST()
    }
    .props     = hda_props,
};

void hda_codec_bus_init(DeviceState *dev, HDACodecBus *bus,
+12 −10
Original line number Diff line number Diff line
@@ -44,14 +44,7 @@ static char *pcibus_get_dev_path(DeviceState *dev);
static char *pcibus_get_fw_dev_path(DeviceState *dev);
static int pcibus_reset(BusState *qbus);

struct BusInfo pci_bus_info = {
    .name       = "PCI",
    .size       = sizeof(PCIBus),
    .print_dev  = pcibus_dev_print,
    .get_dev_path = pcibus_get_dev_path,
    .get_fw_dev_path = pcibus_get_fw_dev_path,
    .reset      = pcibus_reset,
    .props      = (Property[]) {
static Property pci_props[] = {
    DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1),
    DEFINE_PROP_STRING("romfile", PCIDevice, romfile),
    DEFINE_PROP_UINT32("rombar",  PCIDevice, rom_bar, 1),
@@ -60,7 +53,16 @@ struct BusInfo pci_bus_info = {
    DEFINE_PROP_BIT("command_serr_enable", PCIDevice, cap_present,
                    QEMU_PCI_CAP_SERR_BITNR, true),
    DEFINE_PROP_END_OF_LIST()
    }
};

struct BusInfo pci_bus_info = {
    .name       = "PCI",
    .size       = sizeof(PCIBus),
    .print_dev  = pcibus_dev_print,
    .get_dev_path = pcibus_get_dev_path,
    .get_fw_dev_path = pcibus_get_fw_dev_path,
    .reset      = pcibus_reset,
    .props      = pci_props,
};

static PCIBus *pci_find_bus_nr(PCIBus *bus, int bus_num);
+8 −6
Original line number Diff line number Diff line
@@ -12,17 +12,19 @@ static char *scsibus_get_fw_dev_path(DeviceState *dev);
static int scsi_req_parse(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf);
static void scsi_req_dequeue(SCSIRequest *req);

static Property scsi_props[] = {
    DEFINE_PROP_UINT32("channel", SCSIDevice, channel, 0),
    DEFINE_PROP_UINT32("scsi-id", SCSIDevice, id, -1),
    DEFINE_PROP_UINT32("lun", SCSIDevice, lun, -1),
    DEFINE_PROP_END_OF_LIST(),
};

static struct BusInfo scsi_bus_info = {
    .name  = "SCSI",
    .size  = sizeof(SCSIBus),
    .get_dev_path = scsibus_get_dev_path,
    .get_fw_dev_path = scsibus_get_fw_dev_path,
    .props = (Property[]) {
        DEFINE_PROP_UINT32("channel", SCSIDevice, channel, 0),
        DEFINE_PROP_UINT32("scsi-id", SCSIDevice, id, -1),
        DEFINE_PROP_UINT32("lun", SCSIDevice, lun, -1),
        DEFINE_PROP_END_OF_LIST(),
    },
    .props = scsi_props,
};
static int next_scsi_bus;

Loading