qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 7/7] ide-core: allocate metadata storage for CFATA drives
Date: Mon, 11 Apr 2011 17:33:39 +0400	[thread overview]
Message-ID: <1302528819-24228-8-git-send-email-dbaryshkov@gmail.com> (raw)
In-Reply-To: <1302528819-24228-1-git-send-email-dbaryshkov@gmail.com>

Currently it's done by hw/ide/microdrive.c To simplify that part,
move this initialization to ide core.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 hw/ide/core.c       |    4 ++++
 hw/ide/internal.h   |    2 ++
 hw/ide/microdrive.c |    6 +-----
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/hw/ide/core.c b/hw/ide/core.c
index c11d457..f6f7c04 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2556,6 +2556,10 @@ int ide_init_drive(IDEState *s, BlockDriverState *bs,
             return -1;
         }
     }
+    if (s->drive_kind == IDE_CFATA) {
+        s->mdata_size = CFA_METADATA_SIZE;
+        s->mdata_storage = qemu_mallocz(CFA_METADATA_SIZE);
+    }
     if (serial) {
         strncpy(s->drive_serial_str, serial, sizeof(s->drive_serial_str));
     } else {
diff --git a/hw/ide/internal.h b/hw/ide/internal.h
index d533fb6..d1e0528 100644
--- a/hw/ide/internal.h
+++ b/hw/ide/internal.h
@@ -364,6 +364,8 @@ typedef struct IDEDMAOps IDEDMAOps;
 #define SMART_DISABLE         0xd9
 #define SMART_STATUS          0xda
 
+#define CFA_METADATA_SIZE     0x20
+
 typedef enum { IDE_HD, IDE_CD, IDE_CFATA } IDEDriveKind;
 
 typedef void EndTransferFunc(IDEState *);
diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c
index a251544..898ad15 100644
--- a/hw/ide/microdrive.c
+++ b/hw/ide/microdrive.c
@@ -35,8 +35,6 @@
 /***********************************************************/
 /* CF-ATA Microdrive */
 
-#define METADATA_SIZE	0x20
-
 /* DSCM-1XXXX Microdrive hard disk with CF+ II / PCMCIA interface.  */
 typedef struct {
     PCMCIACardState card;
@@ -534,9 +532,6 @@ PCMCIACardState *dscm1xxxx_init(PCMCIASocket *socket, DriveInfo *bdrv)
     md = DO_UPCAST(MicroDriveState, card.dev, dev);
 
     ide_create_drive(&md->bus, 0, bdrv);
-    md->bus.ifs[0].drive_kind = IDE_CFATA;
-    md->bus.ifs[0].mdata_size = METADATA_SIZE;
-    md->bus.ifs[0].mdata_storage = (uint8_t *) qemu_mallocz(METADATA_SIZE);
 
     return &md->card;
 }
@@ -553,6 +548,7 @@ static int dscm1xxxx_initfn(PCMCIACardState *state)
     qdev_init_gpio_in(&state->dev, md_set_irq, 1);
     ide_init2(&md->bus, qdev_get_gpio_in(&state->dev, 0));
 
+    md->bus.ifs[0].drive_kind = IDE_CFATA;
     return 0;
 }
 
-- 
1.7.4.1

  parent reply	other threads:[~2011-04-11 13:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-11 13:33 [Qemu-devel] [PATCH 0/7] Rework PCMCIA subsystem Dmitry Eremin-Solenikov
2011-04-11 13:33 ` [Qemu-devel] [PATCH 1/7] pxa2xx_pcmcia: qdevify Dmitry Eremin-Solenikov
2011-04-11 13:33 ` [Qemu-devel] [PATCH 2/7] PCMCIA: start qdev'ication Dmitry Eremin-Solenikov
2011-04-11 13:33 ` [Qemu-devel] [PATCH 3/7] microdrive: qdevify Dmitry Eremin-Solenikov
2011-04-11 13:33 ` [Qemu-devel] [PATCH 4/7] pcmcia: move all card callbacks to PCMCIACardInfo Dmitry Eremin-Solenikov
2011-04-11 13:33 ` [Qemu-devel] [PATCH 5/7] pcmcia: move attach and detach socket methods to PCMCIASocket Dmitry Eremin-Solenikov
2011-04-11 13:33 ` [Qemu-devel] [PATCH 6/7] pxa: change order of pcmcia devices instantiation, so that the socket 0 will be default Dmitry Eremin-Solenikov
2011-04-11 13:33 ` Dmitry Eremin-Solenikov [this message]
2011-04-16  9:26 ` [Qemu-devel] [PATCH 0/7] Rework PCMCIA subsystem Dmitry Eremin-Solenikov
2011-04-21 11:56 ` Dmitry Eremin-Solenikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1302528819-24228-8-git-send-email-dbaryshkov@gmail.com \
    --to=dbaryshkov@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).