* [Qemu-devel] [PATCH qom-next for-next 0/5] QOM PCMCIA, MicroDrive and IDE cleanups
@ 2013-08-04 14:22 Andreas Färber
2013-08-04 14:22 ` [Qemu-devel] [PATCH qom-next for-next 1/5] pxa: Fix typo "dettach" Andreas Färber
` (6 more replies)
0 siblings, 7 replies; 10+ messages in thread
From: Andreas Färber @ 2013-08-04 14:22 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, Othmar Pasteka, Peter Maydell, Markus Armbruster,
Anthony Liguori, Andreas Färber
Hello,
Based on an initial draft from Othmar Pasteka, this series QOM'ifies MicroDrive.
As a prerequisite, PCMCIA must be QOM'ified as pointed out by Peter. We can then
finally drop ide_init2_with_non_qdev_drives(), as desired by Markus for his
IDE refactorings. As a final touch, pxa2xx_pcmcia is made a SysBusDevice.
A for-1.6 patch to fix an assertion while inspecting the QOM composition tree
was sent out separately.
QOM'ifying the PXA2xx SoCs to replace pxa2xx_pcmcia_init() and other helpers
is left as follow-up.
We probably also want to move "info pcmcia" HMP out of vl.c but I'm not sure
in which form we want to keep PCMCIASocket? A SysBusDevice subtype would seem
easiest for our current use case, but there are also PCI-CardBus bridges IIRC.
PCMCIASocket::card_string should probably be a property of PCMCIACardState,
accessed through a link<pcmcia-card> property.
Markus, unfortunately git am --3way didn't work for your old IDE patches.
Please rebase them on this series yourself, thanks.
Regards,
Andreas
>From Othmar's draft patch:
* Dropped unused MicroDriveClass.
* Kept IRQ allocation where it was - it's ugly either way.
* Rebased onto ide_bus_new() change: 1 slot, so 1 IDE device.
* Updated dscm1xxxx_init() to use the new QOM type.
* Distinguished between microdrive and dscm1xxxx types.
* QOM'ified PCMCIA and made MicroDrive a PCMCIA Card rather than SysBusDevice.
* Fixed typo in PXA2xx API.
* QOM'ified PXA2xx PCMCIA controller.
>From Markus' IDE series:
* Instead of breaking ide_init2_with_non_qdev_drives(), dropped it after
converting last remaining pre-qdev IDE device.
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Othmar Pesteka <pasteka@kabsi.at>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Anthony Liguori <anthony@codemonkey.ws>
Andreas Färber (5):
pxa: Fix typo "dettach"
pcmcia: QOM'ify PCMCIACardState and MicroDriveState
microdrive: Coding Style cleanups
ide: Drop ide_init2_with_non_qdev_drives()
pcmcia/pxa2xx: QOM'ify PXA2xxPCMCIAState
hw/Makefile.objs | 1 +
hw/ide/core.c | 49 ------
hw/ide/internal.h | 2 -
hw/ide/microdrive.c | 226 +++++++++++++++++++--------
hw/misc/Makefile.objs | 1 -
hw/pcmcia/Makefile.objs | 2 +
hw/pcmcia/pcmcia.c | 24 +++
hw/{misc/pxa2xx_pcmcia.c => pcmcia/pxa2xx.c} | 130 +++++++++++----
include/hw/arm/pxa.h | 2 +-
include/hw/pcmcia.h | 46 ++++--
10 files changed, 322 insertions(+), 161 deletions(-)
create mode 100644 hw/pcmcia/Makefile.objs
create mode 100644 hw/pcmcia/pcmcia.c
rename hw/{misc/pxa2xx_pcmcia.c => pcmcia/pxa2xx.c} (61%)
--
1.8.1.4
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH qom-next for-next 1/5] pxa: Fix typo "dettach"
2013-08-04 14:22 [Qemu-devel] [PATCH qom-next for-next 0/5] QOM PCMCIA, MicroDrive and IDE cleanups Andreas Färber
@ 2013-08-04 14:22 ` Andreas Färber
2013-08-04 14:22 ` [Qemu-devel] [PATCH qom-next for-next 2/5] pcmcia: QOM'ify PCMCIACardState and MicroDriveState Andreas Färber
` (5 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Andreas Färber @ 2013-08-04 14:22 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, Othmar Pasteka, Markus Armbruster,
Andreas Färber
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
hw/misc/pxa2xx_pcmcia.c | 2 +-
include/hw/arm/pxa.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/misc/pxa2xx_pcmcia.c b/hw/misc/pxa2xx_pcmcia.c
index ef71a2a..76724a6 100644
--- a/hw/misc/pxa2xx_pcmcia.c
+++ b/hw/misc/pxa2xx_pcmcia.c
@@ -178,7 +178,7 @@ int pxa2xx_pcmcia_attach(void *opaque, PCMCIACardState *card)
}
/* Eject card from the slot */
-int pxa2xx_pcmcia_dettach(void *opaque)
+int pxa2xx_pcmcia_detach(void *opaque)
{
PXA2xxPCMCIAState *s = (PXA2xxPCMCIAState *) opaque;
if (!s->slot.attached)
diff --git a/include/hw/arm/pxa.h b/include/hw/arm/pxa.h
index 668232c..a4e1a66 100644
--- a/include/hw/arm/pxa.h
+++ b/include/hw/arm/pxa.h
@@ -97,7 +97,7 @@ typedef struct PXA2xxPCMCIAState PXA2xxPCMCIAState;
PXA2xxPCMCIAState *pxa2xx_pcmcia_init(MemoryRegion *sysmem,
hwaddr base);
int pxa2xx_pcmcia_attach(void *opaque, PCMCIACardState *card);
-int pxa2xx_pcmcia_dettach(void *opaque);
+int pxa2xx_pcmcia_detach(void *opaque);
void pxa2xx_pcmcia_set_irq_cb(void *opaque, qemu_irq irq, qemu_irq cd_irq);
/* pxa2xx_keypad.c */
--
1.8.1.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH qom-next for-next 2/5] pcmcia: QOM'ify PCMCIACardState and MicroDriveState
2013-08-04 14:22 [Qemu-devel] [PATCH qom-next for-next 0/5] QOM PCMCIA, MicroDrive and IDE cleanups Andreas Färber
2013-08-04 14:22 ` [Qemu-devel] [PATCH qom-next for-next 1/5] pxa: Fix typo "dettach" Andreas Färber
@ 2013-08-04 14:22 ` Andreas Färber
2013-08-04 14:22 ` [Qemu-devel] [PATCH qom-next for-next 3/5] microdrive: Coding Style cleanups Andreas Färber
` (4 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Andreas Färber @ 2013-08-04 14:22 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, Othmar Pasteka, Markus Armbruster,
Andreas Färber
Turn PCMCIACardState into a device.
Move callbacks to new PCMCIACardClass.
Derive TYPE_MICRODRIVE from TYPE_PCMCIA_CARD.
Replace ide_init2_with_non_qdev_drives().
Signed-off-by: Othmar Pasteka <pasteka@kabsi.at>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
hw/Makefile.objs | 1 +
hw/ide/microdrive.c | 170 +++++++++++++++++++--------
hw/misc/Makefile.objs | 1 -
hw/pcmcia/Makefile.objs | 2 +
hw/pcmcia/pcmcia.c | 24 ++++
hw/{misc/pxa2xx_pcmcia.c => pcmcia/pxa2xx.c} | 50 +++++---
include/hw/pcmcia.h | 46 ++++++--
7 files changed, 219 insertions(+), 75 deletions(-)
create mode 100644 hw/pcmcia/Makefile.objs
create mode 100644 hw/pcmcia/pcmcia.c
rename hw/{misc/pxa2xx_pcmcia.c => pcmcia/pxa2xx.c} (81%)
diff --git a/hw/Makefile.objs b/hw/Makefile.objs
index 0243d6a..d91b9cc 100644
--- a/hw/Makefile.objs
+++ b/hw/Makefile.objs
@@ -18,6 +18,7 @@ devices-dirs-$(CONFIG_SOFTMMU) += net/
devices-dirs-$(CONFIG_SOFTMMU) += nvram/
devices-dirs-$(CONFIG_SOFTMMU) += pci/
devices-dirs-$(CONFIG_PCI) += pci-bridge/ pci-host/
+devices-dirs-$(CONFIG_SOFTMMU) += pcmcia/
devices-dirs-$(CONFIG_SOFTMMU) += scsi/
devices-dirs-$(CONFIG_SOFTMMU) += sd/
devices-dirs-$(CONFIG_SOFTMMU) += ssi/
diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c
index 92c1df0..0b53649 100644
--- a/hw/ide/microdrive.c
+++ b/hw/ide/microdrive.c
@@ -30,15 +30,22 @@
#include <hw/ide/internal.h>
+#define TYPE_MICRODRIVE "microdrive"
+#define MICRODRIVE(obj) OBJECT_CHECK(MicroDriveState, (obj), TYPE_MICRODRIVE)
+
/***********************************************************/
/* CF-ATA Microdrive */
#define METADATA_SIZE 0x20
/* DSCM-1XXXX Microdrive hard disk with CF+ II / PCMCIA interface. */
-typedef struct {
+
+typedef struct MicroDriveState {
+ /*< private >*/
+ PCMCIACardState parent_obj;
+ /*< public >*/
+
IDEBus bus;
- PCMCIACardState card;
uint32_t attr_base;
uint32_t io_base;
@@ -81,10 +88,13 @@ enum md_ctrl {
static inline void md_interrupt_update(MicroDriveState *s)
{
- if (!s->card.slot)
+ PCMCIACardState *card = PCMCIA_CARD(s);
+
+ if (card->slot == NULL) {
return;
+ }
- qemu_set_irq(s->card.slot->irq,
+ qemu_set_irq(card->slot->irq,
!(s->stat & STAT_INT) && /* Inverted */
!(s->ctrl & (CTRL_IEN | CTRL_SRST)) &&
!(s->opt & OPT_SRESET));
@@ -101,8 +111,10 @@ static void md_set_irq(void *opaque, int irq, int level)
md_interrupt_update(s);
}
-static void md_reset(MicroDriveState *s)
+static void md_reset(DeviceState *dev)
{
+ MicroDriveState *s = MICRODRIVE(dev);
+
s->opt = OPT_MODE_MMAP;
s->stat = 0;
s->pins = 0;
@@ -111,14 +123,17 @@ static void md_reset(MicroDriveState *s)
ide_bus_reset(&s->bus);
}
-static uint8_t md_attr_read(void *opaque, uint32_t at)
+static uint8_t md_attr_read(PCMCIACardState *card, uint32_t at)
{
- MicroDriveState *s = opaque;
+ MicroDriveState *s = MICRODRIVE(card);
+ PCMCIACardClass *pcc = PCMCIA_CARD_GET_CLASS(card);
+
if (at < s->attr_base) {
- if (at < s->card.cis_len)
- return s->card.cis[at];
- else
+ if (at < pcc->cis_len) {
+ return pcc->cis[at];
+ } else {
return 0x00;
+ }
}
at -= s->attr_base;
@@ -144,16 +159,18 @@ static uint8_t md_attr_read(void *opaque, uint32_t at)
return 0;
}
-static void md_attr_write(void *opaque, uint32_t at, uint8_t value)
+static void md_attr_write(PCMCIACardState *card, uint32_t at, uint8_t value)
{
- MicroDriveState *s = opaque;
+ MicroDriveState *s = MICRODRIVE(card);
+
at -= s->attr_base;
switch (at) {
case 0x00: /* Configuration Option Register */
s->opt = value & 0xcf;
- if (value & OPT_SRESET)
- md_reset(s);
+ if (value & OPT_SRESET) {
+ device_reset(DEVICE(s));
+ }
md_interrupt_update(s);
break;
case 0x02: /* Card Configuration Status Register */
@@ -175,9 +192,9 @@ static void md_attr_write(void *opaque, uint32_t at, uint8_t value)
}
}
-static uint16_t md_common_read(void *opaque, uint32_t at)
+static uint16_t md_common_read(PCMCIACardState *card, uint32_t at)
{
- MicroDriveState *s = opaque;
+ MicroDriveState *s = MICRODRIVE(card);
IDEState *ifs;
uint16_t ret;
at -= s->io_base;
@@ -237,9 +254,9 @@ static uint16_t md_common_read(void *opaque, uint32_t at)
return 0;
}
-static void md_common_write(void *opaque, uint32_t at, uint16_t value)
+static void md_common_write(PCMCIACardState *card, uint32_t at, uint16_t value)
{
- MicroDriveState *s = opaque;
+ MicroDriveState *s = MICRODRIVE(card);
at -= s->io_base;
switch (s->opt & OPT_MODE) {
@@ -285,8 +302,9 @@ static void md_common_write(void *opaque, uint32_t at, uint16_t value)
break;
case 0xe: /* Device Control */
s->ctrl = value;
- if (value & CTRL_SRST)
- md_reset(s);
+ if (value & CTRL_SRST) {
+ device_reset(DEVICE(s));
+ }
md_interrupt_update(s);
break;
default:
@@ -501,49 +519,107 @@ static const uint8_t dscm1xxxx_cis[0x14a] = {
[0x146] = CISTPL_END, /* Tuple End */
};
-static int dscm1xxxx_attach(void *opaque)
+#define TYPE_DSCM1XXXX "dscm1xxxx"
+
+static int dscm1xxxx_attach(PCMCIACardState *card)
{
- MicroDriveState *md = opaque;
- md->card.attr_read = md_attr_read;
- md->card.attr_write = md_attr_write;
- md->card.common_read = md_common_read;
- md->card.common_write = md_common_write;
- md->card.io_read = md_common_read;
- md->card.io_write = md_common_write;
-
- md->attr_base = md->card.cis[0x74] | (md->card.cis[0x76] << 8);
+ MicroDriveState *md = MICRODRIVE(card);
+ PCMCIACardClass *pcc = PCMCIA_CARD_GET_CLASS(card);
+
+ md->attr_base = pcc->cis[0x74] | (pcc->cis[0x76] << 8);
md->io_base = 0x0;
- md_reset(md);
+ device_reset(DEVICE(md));
md_interrupt_update(md);
- md->card.slot->card_string = "DSCM-1xxxx Hitachi Microdrive";
+ card->slot->card_string = "DSCM-1xxxx Hitachi Microdrive";
return 0;
}
-static int dscm1xxxx_detach(void *opaque)
+static int dscm1xxxx_detach(PCMCIACardState *card)
{
- MicroDriveState *md = opaque;
- md_reset(md);
+ MicroDriveState *md = MICRODRIVE(card);
+
+ device_reset(DEVICE(md));
return 0;
}
-PCMCIACardState *dscm1xxxx_init(DriveInfo *bdrv)
+PCMCIACardState *dscm1xxxx_init(DriveInfo *dinfo)
{
- MicroDriveState *md = (MicroDriveState *) g_malloc0(sizeof(MicroDriveState));
- md->card.state = md;
- md->card.attach = dscm1xxxx_attach;
- md->card.detach = dscm1xxxx_detach;
- md->card.cis = dscm1xxxx_cis;
- md->card.cis_len = sizeof(dscm1xxxx_cis);
-
- ide_init2_with_non_qdev_drives(&md->bus, bdrv, NULL,
- qemu_allocate_irqs(md_set_irq, md, 1)[0]);
+ MicroDriveState *md = MICRODRIVE(object_new(TYPE_DSCM1XXXX));
+ PCMCIACardState *card = PCMCIA_CARD(md);
+
+ if (dinfo != NULL) {
+ ide_create_drive(&md->bus, 0, dinfo);
+ }
md->bus.ifs[0].drive_kind = IDE_CFATA;
md->bus.ifs[0].mdata_size = METADATA_SIZE;
md->bus.ifs[0].mdata_storage = (uint8_t *) g_malloc0(METADATA_SIZE);
- vmstate_register(NULL, -1, &vmstate_microdrive, md);
+ return card;
+}
+
+static void dscm1xxxx_class_init(ObjectClass *oc, void *data)
+{
+ PCMCIACardClass *pcc = PCMCIA_CARD_CLASS(oc);
+
+ pcc->cis = dscm1xxxx_cis;
+ pcc->cis_len = sizeof(dscm1xxxx_cis);
+
+ pcc->attach = dscm1xxxx_attach;
+ pcc->detach = dscm1xxxx_detach;
+}
+
+static const TypeInfo dscm1xxxx_type_info = {
+ .name = TYPE_DSCM1XXXX,
+ .parent = TYPE_MICRODRIVE,
+ .class_init = dscm1xxxx_class_init,
+};
+
+static void microdrive_realize(DeviceState *dev, Error **errp)
+{
+ MicroDriveState *md = MICRODRIVE(dev);
+
+ ide_init2(&md->bus, qemu_allocate_irqs(md_set_irq, md, 1)[0]);
+}
+
+static void microdrive_init(Object *obj)
+{
+ MicroDriveState *md = MICRODRIVE(obj);
+
+ ide_bus_new(&md->bus, DEVICE(obj), 0, 1);
+}
- return &md->card;
+static void microdrive_class_init(ObjectClass *oc, void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(oc);
+ PCMCIACardClass *pcc = PCMCIA_CARD_CLASS(oc);
+
+ pcc->attr_read = md_attr_read;
+ pcc->attr_write = md_attr_write;
+ pcc->common_read = md_common_read;
+ pcc->common_write = md_common_write;
+ pcc->io_read = md_common_read;
+ pcc->io_write = md_common_write;
+
+ dc->realize = microdrive_realize;
+ dc->reset = md_reset;
+ dc->vmsd = &vmstate_microdrive;
}
+
+static const TypeInfo microdrive_type_info = {
+ .name = TYPE_MICRODRIVE,
+ .parent = TYPE_PCMCIA_CARD,
+ .instance_size = sizeof(MicroDriveState),
+ .instance_init = microdrive_init,
+ .abstract = true,
+ .class_init = microdrive_class_init,
+};
+
+static void microdrive_register_types(void)
+{
+ type_register_static(µdrive_type_info);
+ type_register_static(&dscm1xxxx_type_info);
+}
+
+type_init(microdrive_register_types)
diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
index 2578e29..99e6181 100644
--- a/hw/misc/Makefile.objs
+++ b/hw/misc/Makefile.objs
@@ -36,7 +36,6 @@ obj-$(CONFIG_OMAP) += omap_gpmc.o
obj-$(CONFIG_OMAP) += omap_l4.o
obj-$(CONFIG_OMAP) += omap_sdrc.o
obj-$(CONFIG_OMAP) += omap_tap.o
-obj-$(CONFIG_PXA2XX) += pxa2xx_pcmcia.o
obj-$(CONFIG_SLAVIO) += slavio_misc.o
obj-$(CONFIG_ZYNQ) += zynq_slcr.o
diff --git a/hw/pcmcia/Makefile.objs b/hw/pcmcia/Makefile.objs
new file mode 100644
index 0000000..4eac060
--- /dev/null
+++ b/hw/pcmcia/Makefile.objs
@@ -0,0 +1,2 @@
+common-obj-y += pcmcia.o
+obj-$(CONFIG_PXA2XX) += pxa2xx.o
diff --git a/hw/pcmcia/pcmcia.c b/hw/pcmcia/pcmcia.c
new file mode 100644
index 0000000..78efe5a
--- /dev/null
+++ b/hw/pcmcia/pcmcia.c
@@ -0,0 +1,24 @@
+/*
+ * PCMCIA emulation
+ *
+ * Copyright 2013 SUSE LINUX Products GmbH
+ */
+
+#include "qemu-common.h"
+#include "hw/hw.h"
+#include "hw/pcmcia.h"
+
+static const TypeInfo pcmcia_card_type_info = {
+ .name = TYPE_PCMCIA_CARD,
+ .parent = TYPE_DEVICE,
+ .instance_size = sizeof(PCMCIACardState),
+ .abstract = true,
+ .class_size = sizeof(PCMCIACardClass),
+};
+
+static void pcmcia_register_types(void)
+{
+ type_register_static(&pcmcia_card_type_info);
+}
+
+type_init(pcmcia_register_types)
diff --git a/hw/misc/pxa2xx_pcmcia.c b/hw/pcmcia/pxa2xx.c
similarity index 81%
rename from hw/misc/pxa2xx_pcmcia.c
rename to hw/pcmcia/pxa2xx.c
index 76724a6..2c515be 100644
--- a/hw/misc/pxa2xx_pcmcia.c
+++ b/hw/pcmcia/pxa2xx.c
@@ -30,9 +30,11 @@ static uint64_t pxa2xx_pcmcia_common_read(void *opaque,
hwaddr offset, unsigned size)
{
PXA2xxPCMCIAState *s = (PXA2xxPCMCIAState *) opaque;
+ PCMCIACardClass *pcc;
if (s->slot.attached) {
- return s->card->common_read(s->card->state, offset);
+ pcc = PCMCIA_CARD_GET_CLASS(s->card);
+ return pcc->common_read(s->card, offset);
}
return 0;
@@ -42,9 +44,11 @@ static void pxa2xx_pcmcia_common_write(void *opaque, hwaddr offset,
uint64_t value, unsigned size)
{
PXA2xxPCMCIAState *s = (PXA2xxPCMCIAState *) opaque;
+ PCMCIACardClass *pcc;
if (s->slot.attached) {
- s->card->common_write(s->card->state, offset, value);
+ pcc = PCMCIA_CARD_GET_CLASS(s->card);
+ pcc->common_write(s->card, offset, value);
}
}
@@ -52,9 +56,11 @@ static uint64_t pxa2xx_pcmcia_attr_read(void *opaque,
hwaddr offset, unsigned size)
{
PXA2xxPCMCIAState *s = (PXA2xxPCMCIAState *) opaque;
+ PCMCIACardClass *pcc;
if (s->slot.attached) {
- return s->card->attr_read(s->card->state, offset);
+ pcc = PCMCIA_CARD_GET_CLASS(s->card);
+ return pcc->attr_read(s->card, offset);
}
return 0;
@@ -64,9 +70,11 @@ static void pxa2xx_pcmcia_attr_write(void *opaque, hwaddr offset,
uint64_t value, unsigned size)
{
PXA2xxPCMCIAState *s = (PXA2xxPCMCIAState *) opaque;
+ PCMCIACardClass *pcc;
if (s->slot.attached) {
- s->card->attr_write(s->card->state, offset, value);
+ pcc = PCMCIA_CARD_GET_CLASS(s->card);
+ pcc->attr_write(s->card, offset, value);
}
}
@@ -74,9 +82,11 @@ static uint64_t pxa2xx_pcmcia_io_read(void *opaque,
hwaddr offset, unsigned size)
{
PXA2xxPCMCIAState *s = (PXA2xxPCMCIAState *) opaque;
+ PCMCIACardClass *pcc;
if (s->slot.attached) {
- return s->card->io_read(s->card->state, offset);
+ pcc = PCMCIA_CARD_GET_CLASS(s->card);
+ return pcc->io_read(s->card, offset);
}
return 0;
@@ -86,9 +96,11 @@ static void pxa2xx_pcmcia_io_write(void *opaque, hwaddr offset,
uint64_t value, unsigned size)
{
PXA2xxPCMCIAState *s = (PXA2xxPCMCIAState *) opaque;
+ PCMCIACardClass *pcc;
if (s->slot.attached) {
- s->card->io_write(s->card->state, offset, value);
+ pcc = PCMCIA_CARD_GET_CLASS(s->card);
+ pcc->io_write(s->card, offset, value);
}
}
@@ -161,18 +173,22 @@ PXA2xxPCMCIAState *pxa2xx_pcmcia_init(MemoryRegion *sysmem,
int pxa2xx_pcmcia_attach(void *opaque, PCMCIACardState *card)
{
PXA2xxPCMCIAState *s = (PXA2xxPCMCIAState *) opaque;
- if (s->slot.attached)
+ PCMCIACardClass *pcc;
+
+ if (s->slot.attached) {
return -EEXIST;
+ }
if (s->cd_irq) {
qemu_irq_raise(s->cd_irq);
}
s->card = card;
+ pcc = PCMCIA_CARD_GET_CLASS(s->card);
- s->slot.attached = 1;
+ s->slot.attached = true;
s->card->slot = &s->slot;
- s->card->attach(s->card->state);
+ pcc->attach(s->card);
return 0;
}
@@ -181,19 +197,25 @@ int pxa2xx_pcmcia_attach(void *opaque, PCMCIACardState *card)
int pxa2xx_pcmcia_detach(void *opaque)
{
PXA2xxPCMCIAState *s = (PXA2xxPCMCIAState *) opaque;
- if (!s->slot.attached)
+ PCMCIACardClass *pcc;
+
+ if (!s->slot.attached) {
return -ENOENT;
+ }
- s->card->detach(s->card->state);
+ pcc = PCMCIA_CARD_GET_CLASS(s->card);
+ pcc->detach(s->card);
s->card->slot = NULL;
s->card = NULL;
- s->slot.attached = 0;
+ s->slot.attached = false;
- if (s->irq)
+ if (s->irq) {
qemu_irq_lower(s->irq);
- if (s->cd_irq)
+ }
+ if (s->cd_irq) {
qemu_irq_lower(s->cd_irq);
+ }
return 0;
}
diff --git a/include/hw/pcmcia.h b/include/hw/pcmcia.h
index f916693..2695d3c 100644
--- a/include/hw/pcmcia.h
+++ b/include/hw/pcmcia.h
@@ -3,11 +3,11 @@
/* PCMCIA/Cardbus */
-#include "qemu-common.h"
+#include "hw/qdev.h"
-typedef struct {
+typedef struct PCMCIASocket {
qemu_irq irq;
- int attached;
+ bool attached;
const char *slot_string;
const char *card_string;
} PCMCIASocket;
@@ -16,22 +16,42 @@ void pcmcia_socket_register(PCMCIASocket *socket);
void pcmcia_socket_unregister(PCMCIASocket *socket);
void pcmcia_info(Monitor *mon, const QDict *qdict);
+#define TYPE_PCMCIA_CARD "pcmcia-card"
+#define PCMCIA_CARD(obj) \
+ OBJECT_CHECK(PCMCIACardState, (obj), TYPE_PCMCIA_CARD)
+#define PCMCIA_CARD_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(PCMCIACardClass, obj, TYPE_PCMCIA_CARD)
+#define PCMCIA_CARD_CLASS(cls) \
+ OBJECT_CLASS_CHECK(PCMCIACardClass, cls, TYPE_PCMCIA_CARD)
+
struct PCMCIACardState {
- void *state;
+ /*< private >*/
+ DeviceState parent_obj;
+ /*< public >*/
+
PCMCIASocket *slot;
- int (*attach)(void *state);
- int (*detach)(void *state);
+};
+
+typedef struct PCMCIACardClass {
+ /*< private >*/
+ DeviceClass parent_class;
+ /*< public >*/
+
+ int (*attach)(PCMCIACardState *state);
+ int (*detach)(PCMCIACardState *state);
+
const uint8_t *cis;
int cis_len;
/* Only valid if attached */
- uint8_t (*attr_read)(void *state, uint32_t address);
- void (*attr_write)(void *state, uint32_t address, uint8_t value);
- uint16_t (*common_read)(void *state, uint32_t address);
- void (*common_write)(void *state, uint32_t address, uint16_t value);
- uint16_t (*io_read)(void *state, uint32_t address);
- void (*io_write)(void *state, uint32_t address, uint16_t value);
-};
+ uint8_t (*attr_read)(PCMCIACardState *card, uint32_t address);
+ void (*attr_write)(PCMCIACardState *card, uint32_t address, uint8_t value);
+ uint16_t (*common_read)(PCMCIACardState *card, uint32_t address);
+ void (*common_write)(PCMCIACardState *card,
+ uint32_t address, uint16_t value);
+ uint16_t (*io_read)(PCMCIACardState *card, uint32_t address);
+ void (*io_write)(PCMCIACardState *card, uint32_t address, uint16_t value);
+} PCMCIACardClass;
#define CISTPL_DEVICE 0x01 /* 5V Device Information Tuple */
#define CISTPL_NO_LINK 0x14 /* No Link Tuple */
--
1.8.1.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH qom-next for-next 3/5] microdrive: Coding Style cleanups
2013-08-04 14:22 [Qemu-devel] [PATCH qom-next for-next 0/5] QOM PCMCIA, MicroDrive and IDE cleanups Andreas Färber
2013-08-04 14:22 ` [Qemu-devel] [PATCH qom-next for-next 1/5] pxa: Fix typo "dettach" Andreas Färber
2013-08-04 14:22 ` [Qemu-devel] [PATCH qom-next for-next 2/5] pcmcia: QOM'ify PCMCIACardState and MicroDriveState Andreas Färber
@ 2013-08-04 14:22 ` Andreas Färber
2013-08-04 14:22 ` [Qemu-devel] [PATCH qom-next for-next 4/5] ide: Drop ide_init2_with_non_qdev_drives() Andreas Färber
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Andreas Färber @ 2013-08-04 14:22 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, Othmar Pasteka, Markus Armbruster,
Andreas Färber
Add missing braces.
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
hw/ide/microdrive.c | 62 ++++++++++++++++++++++++++++++++---------------------
1 file changed, 38 insertions(+), 24 deletions(-)
diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c
index 0b53649..9e4ee9c 100644
--- a/hw/ide/microdrive.c
+++ b/hw/ide/microdrive.c
@@ -103,10 +103,12 @@ static inline void md_interrupt_update(MicroDriveState *s)
static void md_set_irq(void *opaque, int irq, int level)
{
MicroDriveState *s = opaque;
- if (level)
+
+ if (level) {
s->stat |= STAT_INT;
- else
+ } else {
s->stat &= ~STAT_INT;
+ }
md_interrupt_update(s);
}
@@ -142,10 +144,11 @@ static uint8_t md_attr_read(PCMCIACardState *card, uint32_t at)
case 0x00: /* Configuration Option Register */
return s->opt;
case 0x02: /* Card Configuration Status Register */
- if (s->ctrl & CTRL_IEN)
+ if (s->ctrl & CTRL_IEN) {
return s->stat & ~STAT_INT;
- else
+ } else {
return s->stat;
+ }
case 0x04: /* Pin Replacement Register */
return (s->pins & PINS_CRDY) | 0x0c;
case 0x06: /* Socket and Copy Register */
@@ -174,8 +177,9 @@ static void md_attr_write(PCMCIACardState *card, uint32_t at, uint8_t value)
md_interrupt_update(s);
break;
case 0x02: /* Card Configuration Status Register */
- if ((s->stat ^ value) & STAT_PWRDWN)
+ if ((s->stat ^ value) & STAT_PWRDWN) {
s->pins |= PINS_CRDY;
+ }
s->stat &= 0x82;
s->stat |= value & 0x74;
md_interrupt_update(s);
@@ -201,23 +205,26 @@ static uint16_t md_common_read(PCMCIACardState *card, uint32_t at)
switch (s->opt & OPT_MODE) {
case OPT_MODE_MMAP:
- if ((at & ~0x3ff) == 0x400)
+ if ((at & ~0x3ff) == 0x400) {
at = 0;
+ }
break;
case OPT_MODE_IOMAP16:
at &= 0xf;
break;
case OPT_MODE_IOMAP1:
- if ((at & ~0xf) == 0x3f0)
+ if ((at & ~0xf) == 0x3f0) {
at -= 0x3e8;
- else if ((at & ~0xf) == 0x1f0)
+ } else if ((at & ~0xf) == 0x1f0) {
at -= 0x1f0;
+ }
break;
case OPT_MODE_IOMAP2:
- if ((at & ~0xf) == 0x370)
+ if ((at & ~0xf) == 0x370) {
at -= 0x368;
- else if ((at & ~0xf) == 0x170)
+ } else if ((at & ~0xf) == 0x170) {
at -= 0x170;
+ }
}
switch (at) {
@@ -226,9 +233,9 @@ static uint16_t md_common_read(PCMCIACardState *card, uint32_t at)
return ide_data_readw(&s->bus, 0);
/* TODO: 8-bit accesses */
- if (s->cycle)
+ if (s->cycle) {
ret = s->io >> 8;
- else {
+ } else {
s->io = ide_data_readw(&s->bus, 0);
ret = s->io & 0xff;
}
@@ -240,10 +247,11 @@ static uint16_t md_common_read(PCMCIACardState *card, uint32_t at)
return ide_ioport_read(&s->bus, 0x1);
case 0xe: /* Alternate Status */
ifs = idebus_active_if(&s->bus);
- if (ifs->bs)
+ if (ifs->bs) {
return ifs->status;
- else
+ } else {
return 0;
+ }
case 0xf: /* Device Address */
ifs = idebus_active_if(&s->bus);
return 0xc2 | ((~ifs->select << 2) & 0x3c);
@@ -261,23 +269,26 @@ static void md_common_write(PCMCIACardState *card, uint32_t at, uint16_t value)
switch (s->opt & OPT_MODE) {
case OPT_MODE_MMAP:
- if ((at & ~0x3ff) == 0x400)
+ if ((at & ~0x3ff) == 0x400) {
at = 0;
+ }
break;
case OPT_MODE_IOMAP16:
at &= 0xf;
break;
case OPT_MODE_IOMAP1:
- if ((at & ~0xf) == 0x3f0)
+ if ((at & ~0xf) == 0x3f0) {
at -= 0x3e8;
- else if ((at & ~0xf) == 0x1f0)
+ } else if ((at & ~0xf) == 0x1f0) {
at -= 0x1f0;
+ }
break;
case OPT_MODE_IOMAP2:
- if ((at & ~0xf) == 0x370)
+ if ((at & ~0xf) == 0x370) {
at -= 0x368;
- else if ((at & ~0xf) == 0x170)
+ } else if ((at & ~0xf) == 0x170) {
at -= 0x170;
+ }
}
switch (at) {
@@ -287,10 +298,11 @@ static void md_common_write(PCMCIACardState *card, uint32_t at, uint16_t value)
break;
/* TODO: 8-bit accesses */
- if (s->cycle)
+ if (s->cycle) {
ide_data_writew(&s->bus, 0, s->io | (value << 8));
- else
+ } else {
s->io = value & 0xff;
+ }
s->cycle = !s->cycle;
break;
case 0x9:
@@ -546,8 +558,10 @@ static int dscm1xxxx_detach(PCMCIACardState *card)
PCMCIACardState *dscm1xxxx_init(DriveInfo *dinfo)
{
- MicroDriveState *md = MICRODRIVE(object_new(TYPE_DSCM1XXXX));
- PCMCIACardState *card = PCMCIA_CARD(md);
+ MicroDriveState *md;
+
+ md = MICRODRIVE(object_new(TYPE_DSCM1XXXX));
+ qdev_init_nofail(DEVICE(md));
if (dinfo != NULL) {
ide_create_drive(&md->bus, 0, dinfo);
@@ -556,7 +570,7 @@ PCMCIACardState *dscm1xxxx_init(DriveInfo *dinfo)
md->bus.ifs[0].mdata_size = METADATA_SIZE;
md->bus.ifs[0].mdata_storage = (uint8_t *) g_malloc0(METADATA_SIZE);
- return card;
+ return PCMCIA_CARD(md);
}
static void dscm1xxxx_class_init(ObjectClass *oc, void *data)
--
1.8.1.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH qom-next for-next 4/5] ide: Drop ide_init2_with_non_qdev_drives()
2013-08-04 14:22 [Qemu-devel] [PATCH qom-next for-next 0/5] QOM PCMCIA, MicroDrive and IDE cleanups Andreas Färber
` (2 preceding siblings ...)
2013-08-04 14:22 ` [Qemu-devel] [PATCH qom-next for-next 3/5] microdrive: Coding Style cleanups Andreas Färber
@ 2013-08-04 14:22 ` Andreas Färber
2013-08-04 14:22 ` [Qemu-devel] [PATCH qom-next for-next 5/5] pcmcia/pxa2xx: QOM'ify PXA2xxPCMCIAState Andreas Färber
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Andreas Färber @ 2013-08-04 14:22 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, Othmar Pasteka, Markus Armbruster,
Andreas Färber
All its users have finally been converted.
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
hw/ide/core.c | 49 -------------------------------------------------
hw/ide/internal.h | 2 --
2 files changed, 51 deletions(-)
diff --git a/hw/ide/core.c b/hw/ide/core.c
index a73af72..ac0ffcf 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2215,55 +2215,6 @@ void ide_init2(IDEBus *bus, qemu_irq irq)
bus->dma = &ide_dma_nop;
}
-/* TODO convert users to qdev and remove */
-void ide_init2_with_non_qdev_drives(IDEBus *bus, DriveInfo *hd0,
- DriveInfo *hd1, qemu_irq irq)
-{
- int i, trans;
- DriveInfo *dinfo;
- uint32_t cyls, heads, secs;
-
- for(i = 0; i < 2; i++) {
- dinfo = i == 0 ? hd0 : hd1;
- ide_init1(bus, i);
- if (dinfo) {
- cyls = dinfo->cyls;
- heads = dinfo->heads;
- secs = dinfo->secs;
- trans = dinfo->trans;
- if (!cyls && !heads && !secs) {
- hd_geometry_guess(dinfo->bdrv, &cyls, &heads, &secs, &trans);
- } else if (trans == BIOS_ATA_TRANSLATION_AUTO) {
- trans = hd_bios_chs_auto_trans(cyls, heads, secs);
- }
- if (cyls < 1 || cyls > 65535) {
- error_report("cyls must be between 1 and 65535");
- exit(1);
- }
- if (heads < 1 || heads > 16) {
- error_report("heads must be between 1 and 16");
- exit(1);
- }
- if (secs < 1 || secs > 255) {
- error_report("secs must be between 1 and 255");
- exit(1);
- }
- if (ide_init_drive(&bus->ifs[i], dinfo->bdrv,
- dinfo->media_cd ? IDE_CD : IDE_HD,
- NULL, dinfo->serial, NULL, 0,
- cyls, heads, secs, trans) < 0) {
- error_report("Can't set up IDE drive %s", dinfo->id);
- exit(1);
- }
- bdrv_attach_dev_nofail(dinfo->bdrv, &bus->ifs[i]);
- } else {
- ide_reset(&bus->ifs[i]);
- }
- }
- bus->irq = irq;
- bus->dma = &ide_dma_nop;
-}
-
static const MemoryRegionPortio ide_portio_list[] = {
{ 0, 8, 1, .read = ide_ioport_read, .write = ide_ioport_write },
{ 0, 2, 2, .read = ide_data_readw, .write = ide_data_writew },
diff --git a/hw/ide/internal.h b/hw/ide/internal.h
index 048a052..d5d130f 100644
--- a/hw/ide/internal.h
+++ b/hw/ide/internal.h
@@ -553,8 +553,6 @@ int ide_init_drive(IDEState *s, BlockDriverState *bs, IDEDriveKind kind,
uint32_t cylinders, uint32_t heads, uint32_t secs,
int chs_trans);
void ide_init2(IDEBus *bus, qemu_irq irq);
-void ide_init2_with_non_qdev_drives(IDEBus *bus, DriveInfo *hd0,
- DriveInfo *hd1, qemu_irq irq);
void ide_init_ioport(IDEBus *bus, ISADevice *isa, int iobase, int iobase2);
void ide_exec_cmd(IDEBus *bus, uint32_t val);
--
1.8.1.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH qom-next for-next 5/5] pcmcia/pxa2xx: QOM'ify PXA2xxPCMCIAState
2013-08-04 14:22 [Qemu-devel] [PATCH qom-next for-next 0/5] QOM PCMCIA, MicroDrive and IDE cleanups Andreas Färber
` (3 preceding siblings ...)
2013-08-04 14:22 ` [Qemu-devel] [PATCH qom-next for-next 4/5] ide: Drop ide_init2_with_non_qdev_drives() Andreas Färber
@ 2013-08-04 14:22 ` Andreas Färber
2013-08-06 7:30 ` [Qemu-devel] [PATCH qom-next for-next 0/5] QOM PCMCIA, MicroDrive and IDE cleanups Markus Armbruster
2013-10-01 9:15 ` Markus Armbruster
6 siblings, 0 replies; 10+ messages in thread
From: Andreas Färber @ 2013-08-04 14:22 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, Othmar Pasteka, Markus Armbruster,
Andreas Färber
Turn it into a SysBusDevice and use a container MemoryRegion.
Add a link<pcmcia-card> property to the PCMCIACardState.
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
hw/pcmcia/pxa2xx.c | 78 +++++++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 66 insertions(+), 12 deletions(-)
diff --git a/hw/pcmcia/pxa2xx.c b/hw/pcmcia/pxa2xx.c
index 2c515be..8f17596 100644
--- a/hw/pcmcia/pxa2xx.c
+++ b/hw/pcmcia/pxa2xx.c
@@ -11,19 +11,27 @@
*/
#include "hw/hw.h"
+#include "hw/sysbus.h"
#include "hw/pcmcia.h"
#include "hw/arm/pxa.h"
+#define TYPE_PXA2XX_PCMCIA "pxa2xx-pcmcia"
+#define PXA2XX_PCMCIA(obj) \
+ OBJECT_CHECK(PXA2xxPCMCIAState, obj, TYPE_PXA2XX_PCMCIA)
struct PXA2xxPCMCIAState {
+ SysBusDevice parent_obj;
+
PCMCIASocket slot;
- PCMCIACardState *card;
+ MemoryRegion container_mem;
MemoryRegion common_iomem;
MemoryRegion attr_iomem;
MemoryRegion iomem;
qemu_irq irq;
qemu_irq cd_irq;
+
+ PCMCIACardState *card;
};
static uint64_t pxa2xx_pcmcia_common_read(void *opaque,
@@ -134,15 +142,43 @@ static void pxa2xx_pcmcia_set_irq(void *opaque, int line, int level)
PXA2xxPCMCIAState *pxa2xx_pcmcia_init(MemoryRegion *sysmem,
hwaddr base)
{
+ DeviceState *dev;
PXA2xxPCMCIAState *s;
- s = (PXA2xxPCMCIAState *)
- g_malloc0(sizeof(PXA2xxPCMCIAState));
+ dev = qdev_create(NULL, TYPE_PXA2XX_PCMCIA);
+ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
+ s = PXA2XX_PCMCIA(dev);
+
+ if (base == 0x30000000) {
+ s->slot.slot_string = "PXA PC Card Socket 1";
+ } else {
+ s->slot.slot_string = "PXA PC Card Socket 0";
+ }
+
+ qdev_init_nofail(dev);
+
+ return s;
+}
+
+static void pxa2xx_pcmcia_realize(DeviceState *dev, Error **errp)
+{
+ PXA2xxPCMCIAState *s = PXA2XX_PCMCIA(dev);
+
+ pcmcia_socket_register(&s->slot);
+}
+
+static void pxa2xx_pcmcia_initfn(Object *obj)
+{
+ SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
+ PXA2xxPCMCIAState *s = PXA2XX_PCMCIA(obj);
+
+ memory_region_init(&s->container_mem, obj, "container", 0x10000000);
+ sysbus_init_mmio(sbd, &s->container_mem);
/* Socket I/O Memory Space */
memory_region_init_io(&s->iomem, NULL, &pxa2xx_pcmcia_io_ops, s,
"pxa2xx-pcmcia-io", 0x04000000);
- memory_region_add_subregion(sysmem, base | 0x00000000,
+ memory_region_add_subregion(&s->container_mem, 0x00000000,
&s->iomem);
/* Then next 64 MB is reserved */
@@ -150,23 +186,19 @@ PXA2xxPCMCIAState *pxa2xx_pcmcia_init(MemoryRegion *sysmem,
/* Socket Attribute Memory Space */
memory_region_init_io(&s->attr_iomem, NULL, &pxa2xx_pcmcia_attr_ops, s,
"pxa2xx-pcmcia-attribute", 0x04000000);
- memory_region_add_subregion(sysmem, base | 0x08000000,
+ memory_region_add_subregion(&s->container_mem, 0x08000000,
&s->attr_iomem);
/* Socket Common Memory Space */
memory_region_init_io(&s->common_iomem, NULL, &pxa2xx_pcmcia_common_ops, s,
"pxa2xx-pcmcia-common", 0x04000000);
- memory_region_add_subregion(sysmem, base | 0x0c000000,
+ memory_region_add_subregion(&s->container_mem, 0x0c000000,
&s->common_iomem);
- if (base == 0x30000000)
- s->slot.slot_string = "PXA PC Card Socket 1";
- else
- s->slot.slot_string = "PXA PC Card Socket 0";
s->slot.irq = qemu_allocate_irqs(pxa2xx_pcmcia_set_irq, s, 1)[0];
- pcmcia_socket_register(&s->slot);
- return s;
+ object_property_add_link(obj, "card", TYPE_PCMCIA_CARD,
+ (Object **)&s->card, NULL);
}
/* Insert a new card into a slot */
@@ -227,3 +259,25 @@ void pxa2xx_pcmcia_set_irq_cb(void *opaque, qemu_irq irq, qemu_irq cd_irq)
s->irq = irq;
s->cd_irq = cd_irq;
}
+
+static void pxa2xx_pcmcia_class_init(ObjectClass *oc, void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(oc);
+
+ dc->realize = pxa2xx_pcmcia_realize;
+}
+
+static const TypeInfo pxa2xx_pcmcia_type_info = {
+ .name = TYPE_PXA2XX_PCMCIA,
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(PXA2xxPCMCIAState),
+ .instance_init = pxa2xx_pcmcia_initfn,
+ .class_init = pxa2xx_pcmcia_class_init,
+};
+
+static void pxa2xx_pcmcia_register_types(void)
+{
+ type_register_static(&pxa2xx_pcmcia_type_info);
+}
+
+type_init(pxa2xx_pcmcia_register_types)
--
1.8.1.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH qom-next for-next 0/5] QOM PCMCIA, MicroDrive and IDE cleanups
2013-08-04 14:22 [Qemu-devel] [PATCH qom-next for-next 0/5] QOM PCMCIA, MicroDrive and IDE cleanups Andreas Färber
` (4 preceding siblings ...)
2013-08-04 14:22 ` [Qemu-devel] [PATCH qom-next for-next 5/5] pcmcia/pxa2xx: QOM'ify PXA2xxPCMCIAState Andreas Färber
@ 2013-08-06 7:30 ` Markus Armbruster
2013-10-01 9:15 ` Markus Armbruster
6 siblings, 0 replies; 10+ messages in thread
From: Markus Armbruster @ 2013-08-06 7:30 UTC (permalink / raw)
To: Andreas Färber
Cc: Kevin Wolf, Othmar Pasteka, qemu-devel, Anthony Liguori,
Peter Maydell
Andreas Färber <afaerber@suse.de> writes:
> Hello,
>
> Based on an initial draft from Othmar Pasteka, this series QOM'ifies MicroDrive.
> As a prerequisite, PCMCIA must be QOM'ified as pointed out by Peter. We can then
> finally drop ide_init2_with_non_qdev_drives(), as desired by Markus for his
> IDE refactorings. As a final touch, pxa2xx_pcmcia is made a SysBusDevice.
Full IDE qdevification achieved in just under four years (assuming we
get this committed before September 15). I'm tickled pink.
Thanks a lot for making this happen! To Othmar, too, of course.
> A for-1.6 patch to fix an assertion while inspecting the QOM composition tree
> was sent out separately.
>
> QOM'ifying the PXA2xx SoCs to replace pxa2xx_pcmcia_init() and other helpers
> is left as follow-up.
>
> We probably also want to move "info pcmcia" HMP out of vl.c but I'm not sure
> in which form we want to keep PCMCIASocket? A SysBusDevice subtype would seem
> easiest for our current use case, but there are also PCI-CardBus bridges IIRC.
> PCMCIASocket::card_string should probably be a property of PCMCIACardState,
> accessed through a link<pcmcia-card> property.
>
> Markus, unfortunately git am --3way didn't work for your old IDE patches.
> Please rebase them on this series yourself, thanks.
Sure!
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH qom-next for-next 0/5] QOM PCMCIA, MicroDrive and IDE cleanups
2013-08-04 14:22 [Qemu-devel] [PATCH qom-next for-next 0/5] QOM PCMCIA, MicroDrive and IDE cleanups Andreas Färber
` (5 preceding siblings ...)
2013-08-06 7:30 ` [Qemu-devel] [PATCH qom-next for-next 0/5] QOM PCMCIA, MicroDrive and IDE cleanups Markus Armbruster
@ 2013-10-01 9:15 ` Markus Armbruster
2013-10-01 11:56 ` Andreas Färber
6 siblings, 1 reply; 10+ messages in thread
From: Markus Armbruster @ 2013-10-01 9:15 UTC (permalink / raw)
To: Andreas Färber
Cc: Kevin Wolf, Othmar Pasteka, qemu-devel, Anthony Liguori,
Peter Maydell
Has this one fallen through the cracks?
Andreas Färber <afaerber@suse.de> writes:
> Hello,
>
> Based on an initial draft from Othmar Pasteka, this series QOM'ifies MicroDrive.
> As a prerequisite, PCMCIA must be QOM'ified as pointed out by Peter. We can then
> finally drop ide_init2_with_non_qdev_drives(), as desired by Markus for his
> IDE refactorings. As a final touch, pxa2xx_pcmcia is made a SysBusDevice.
>
> A for-1.6 patch to fix an assertion while inspecting the QOM composition tree
> was sent out separately.
>
> QOM'ifying the PXA2xx SoCs to replace pxa2xx_pcmcia_init() and other helpers
> is left as follow-up.
>
> We probably also want to move "info pcmcia" HMP out of vl.c but I'm not sure
> in which form we want to keep PCMCIASocket? A SysBusDevice subtype would seem
> easiest for our current use case, but there are also PCI-CardBus bridges IIRC.
> PCMCIASocket::card_string should probably be a property of PCMCIACardState,
> accessed through a link<pcmcia-card> property.
>
> Markus, unfortunately git am --3way didn't work for your old IDE patches.
> Please rebase them on this series yourself, thanks.
>
> Regards,
> Andreas
>
>>From Othmar's draft patch:
> * Dropped unused MicroDriveClass.
> * Kept IRQ allocation where it was - it's ugly either way.
> * Rebased onto ide_bus_new() change: 1 slot, so 1 IDE device.
> * Updated dscm1xxxx_init() to use the new QOM type.
> * Distinguished between microdrive and dscm1xxxx types.
> * QOM'ified PCMCIA and made MicroDrive a PCMCIA Card rather than SysBusDevice.
> * Fixed typo in PXA2xx API.
> * QOM'ified PXA2xx PCMCIA controller.
>
>>From Markus' IDE series:
> * Instead of breaking ide_init2_with_non_qdev_drives(), dropped it after
> converting last remaining pre-qdev IDE device.
>
> Cc: Markus Armbruster <armbru@redhat.com>
> Cc: Kevin Wolf <kwolf@redhat.com>
> Cc: Othmar Pesteka <pasteka@kabsi.at>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: Anthony Liguori <anthony@codemonkey.ws>
>
> Andreas Färber (5):
> pxa: Fix typo "dettach"
> pcmcia: QOM'ify PCMCIACardState and MicroDriveState
> microdrive: Coding Style cleanups
> ide: Drop ide_init2_with_non_qdev_drives()
> pcmcia/pxa2xx: QOM'ify PXA2xxPCMCIAState
>
> hw/Makefile.objs | 1 +
> hw/ide/core.c | 49 ------
> hw/ide/internal.h | 2 -
> hw/ide/microdrive.c | 226 +++++++++++++++++++--------
> hw/misc/Makefile.objs | 1 -
> hw/pcmcia/Makefile.objs | 2 +
> hw/pcmcia/pcmcia.c | 24 +++
> hw/{misc/pxa2xx_pcmcia.c => pcmcia/pxa2xx.c} | 130 +++++++++++----
> include/hw/arm/pxa.h | 2 +-
> include/hw/pcmcia.h | 46 ++++--
> 10 files changed, 322 insertions(+), 161 deletions(-)
> create mode 100644 hw/pcmcia/Makefile.objs
> create mode 100644 hw/pcmcia/pcmcia.c
> rename hw/{misc/pxa2xx_pcmcia.c => pcmcia/pxa2xx.c} (61%)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH qom-next for-next 0/5] QOM PCMCIA, MicroDrive and IDE cleanups
2013-10-01 9:15 ` Markus Armbruster
@ 2013-10-01 11:56 ` Andreas Färber
2013-10-01 12:10 ` Markus Armbruster
0 siblings, 1 reply; 10+ messages in thread
From: Andreas Färber @ 2013-10-01 11:56 UTC (permalink / raw)
To: Markus Armbruster
Cc: Kevin Wolf, Othmar Pasteka, qemu-devel, Anthony Liguori,
Peter Maydell
Am 01.10.2013 11:15, schrieb Markus Armbruster:
> Has this one fallen through the cracks?
Nobody, including yourself, has felt responsable for reviewing this, and
I wanted to get some form of test coverage in place before sending any
pull, which I have just applied yesterday. :-)
It has been rebased without problems all the time.
Andreas
> Andreas Färber <afaerber@suse.de> writes:
>
>> Hello,
>>
>> Based on an initial draft from Othmar Pasteka, this series QOM'ifies MicroDrive.
>> As a prerequisite, PCMCIA must be QOM'ified as pointed out by Peter. We can then
>> finally drop ide_init2_with_non_qdev_drives(), as desired by Markus for his
>> IDE refactorings. As a final touch, pxa2xx_pcmcia is made a SysBusDevice.
>>
>> A for-1.6 patch to fix an assertion while inspecting the QOM composition tree
>> was sent out separately.
>>
>> QOM'ifying the PXA2xx SoCs to replace pxa2xx_pcmcia_init() and other helpers
>> is left as follow-up.
>>
>> We probably also want to move "info pcmcia" HMP out of vl.c but I'm not sure
>> in which form we want to keep PCMCIASocket? A SysBusDevice subtype would seem
>> easiest for our current use case, but there are also PCI-CardBus bridges IIRC.
>> PCMCIASocket::card_string should probably be a property of PCMCIACardState,
>> accessed through a link<pcmcia-card> property.
>>
>> Markus, unfortunately git am --3way didn't work for your old IDE patches.
>> Please rebase them on this series yourself, thanks.
>>
>> Regards,
>> Andreas
>>
>> >From Othmar's draft patch:
>> * Dropped unused MicroDriveClass.
>> * Kept IRQ allocation where it was - it's ugly either way.
>> * Rebased onto ide_bus_new() change: 1 slot, so 1 IDE device.
>> * Updated dscm1xxxx_init() to use the new QOM type.
>> * Distinguished between microdrive and dscm1xxxx types.
>> * QOM'ified PCMCIA and made MicroDrive a PCMCIA Card rather than SysBusDevice.
>> * Fixed typo in PXA2xx API.
>> * QOM'ified PXA2xx PCMCIA controller.
>>
>> >From Markus' IDE series:
>> * Instead of breaking ide_init2_with_non_qdev_drives(), dropped it after
>> converting last remaining pre-qdev IDE device.
>>
>> Cc: Markus Armbruster <armbru@redhat.com>
>> Cc: Kevin Wolf <kwolf@redhat.com>
>> Cc: Othmar Pesteka <pasteka@kabsi.at>
>> Cc: Peter Maydell <peter.maydell@linaro.org>
>> Cc: Anthony Liguori <anthony@codemonkey.ws>
>>
>> Andreas Färber (5):
>> pxa: Fix typo "dettach"
>> pcmcia: QOM'ify PCMCIACardState and MicroDriveState
>> microdrive: Coding Style cleanups
>> ide: Drop ide_init2_with_non_qdev_drives()
>> pcmcia/pxa2xx: QOM'ify PXA2xxPCMCIAState
>>
>> hw/Makefile.objs | 1 +
>> hw/ide/core.c | 49 ------
>> hw/ide/internal.h | 2 -
>> hw/ide/microdrive.c | 226 +++++++++++++++++++--------
>> hw/misc/Makefile.objs | 1 -
>> hw/pcmcia/Makefile.objs | 2 +
>> hw/pcmcia/pcmcia.c | 24 +++
>> hw/{misc/pxa2xx_pcmcia.c => pcmcia/pxa2xx.c} | 130 +++++++++++----
>> include/hw/arm/pxa.h | 2 +-
>> include/hw/pcmcia.h | 46 ++++--
>> 10 files changed, 322 insertions(+), 161 deletions(-)
>> create mode 100644 hw/pcmcia/Makefile.objs
>> create mode 100644 hw/pcmcia/pcmcia.c
>> rename hw/{misc/pxa2xx_pcmcia.c => pcmcia/pxa2xx.c} (61%)
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH qom-next for-next 0/5] QOM PCMCIA, MicroDrive and IDE cleanups
2013-10-01 11:56 ` Andreas Färber
@ 2013-10-01 12:10 ` Markus Armbruster
0 siblings, 0 replies; 10+ messages in thread
From: Markus Armbruster @ 2013-10-01 12:10 UTC (permalink / raw)
To: Andreas Färber
Cc: Kevin Wolf, Othmar Pasteka, qemu-devel, Anthony Liguori,
Peter Maydell
Andreas Färber <afaerber@suse.de> writes:
> Am 01.10.2013 11:15, schrieb Markus Armbruster:
>> Has this one fallen through the cracks?
>
> Nobody, including yourself, has felt responsable for reviewing this, and
QOMification isn't exactly my home turf...
> I wanted to get some form of test coverage in place before sending any
> pull, which I have just applied yesterday. :-)
> It has been rebased without problems all the time.
Excellent, thanks!
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-10-01 12:10 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-04 14:22 [Qemu-devel] [PATCH qom-next for-next 0/5] QOM PCMCIA, MicroDrive and IDE cleanups Andreas Färber
2013-08-04 14:22 ` [Qemu-devel] [PATCH qom-next for-next 1/5] pxa: Fix typo "dettach" Andreas Färber
2013-08-04 14:22 ` [Qemu-devel] [PATCH qom-next for-next 2/5] pcmcia: QOM'ify PCMCIACardState and MicroDriveState Andreas Färber
2013-08-04 14:22 ` [Qemu-devel] [PATCH qom-next for-next 3/5] microdrive: Coding Style cleanups Andreas Färber
2013-08-04 14:22 ` [Qemu-devel] [PATCH qom-next for-next 4/5] ide: Drop ide_init2_with_non_qdev_drives() Andreas Färber
2013-08-04 14:22 ` [Qemu-devel] [PATCH qom-next for-next 5/5] pcmcia/pxa2xx: QOM'ify PXA2xxPCMCIAState Andreas Färber
2013-08-06 7:30 ` [Qemu-devel] [PATCH qom-next for-next 0/5] QOM PCMCIA, MicroDrive and IDE cleanups Markus Armbruster
2013-10-01 9:15 ` Markus Armbruster
2013-10-01 11:56 ` Andreas Färber
2013-10-01 12:10 ` Markus Armbruster
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).