@@ -256,7 +256,7 @@ static void pci_cmd646_ide_realize(PCIDevice *dev, Error **errp)
pci_conf[PCI_CLASS_PROG] = 0x8f;
pci_conf[CNTRL] = CNTRL_EN_CH0; // enable IDE0
- if (d->secondary) {
+ if (d->flags & BIT(PCI_IDE_SECONDARY)) {
/* XXX: if not enabled, really disable the seconday IDE controller */
pci_conf[CNTRL] |= CNTRL_EN_CH1; /* enable IDE1 */
}
@@ -318,7 +318,7 @@ static void pci_cmd646_ide_exitfn(PCIDevice *dev)
}
static Property cmd646_ide_properties[] = {
- DEFINE_PROP_UINT32("secondary", PCIIDEState, secondary, 0),
+ DEFINE_PROP_BIT("secondary", PCIIDEState, flags, PCI_IDE_SECONDARY, false),
DEFINE_PROP_END_OF_LIST(),
};
@@ -666,7 +666,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
ide_drive_get(hd, ARRAY_SIZE(hd));
pci_dev = pci_create(pci_busA, PCI_DEVFN(3, 0), "cmd646-ide");
- qdev_prop_set_uint32(&pci_dev->qdev, "secondary", 1);
+ qdev_prop_set_bit(&pci_dev->qdev, "secondary", true);
qdev_init_nofail(&pci_dev->qdev);
pci_ide_create_devs(pci_dev, hd);
@@ -40,6 +40,11 @@ typedef struct BMDMAState {
#define TYPE_PCI_IDE "pci-ide"
#define PCI_IDE(obj) OBJECT_CHECK(PCIIDEState, (obj), TYPE_PCI_IDE)
+enum {
+ PCI_IDE_SECONDARY, /* used only for cmd646 */
+ PCI_IDE_LEGACY_IRQ
+};
+
typedef struct PCIIDEState {
/*< private >*/
PCIDevice parent_obj;
@@ -47,7 +52,7 @@ typedef struct PCIIDEState {
IDEBus bus[2];
BMDMAState bmdma[2];
- uint32_t secondary; /* used only for cmd646 */
+ uint32_t flags;
MemoryRegion bmdma_bar;
MemoryRegion cmd_bar[2];
MemoryRegion data_bar[2];
We'll need a flag for implementing some device specific behaviour in via-ide but we already have a currently CMD646 specific field that can be repurposed for this and leave room for furhter flags if needed in the future. This patch changes the "secondary" field to "flags" and define the flags for CMD646 and via-ide and change CMD646 and its users accordingly. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> --- hw/ide/cmd646.c | 4 ++-- hw/sparc64/sun4u.c | 2 +- include/hw/ide/pci.h | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-)