qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, qemu-ppc@nongnu.org, agraf@suse.de
Subject: [Qemu-devel] [PATCH 01/10] ide: Break all non-qdevified controllers
Date: Mon, 17 Dec 2012 15:05:51 +0100	[thread overview]
Message-ID: <1355753160-17544-2-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1355753160-17544-1-git-send-email-armbru@redhat.com>

They complicate IDE data structures and keep getting in the way.
Also, TRIM support (commit d353fb72) is broken for them, because
ide_identify() accesses IDEDevice member conf, but IDEDevice exists
only with qdevified controllers.

The non-qdevified controllers are still there, but attempting to
connect devices to them fails with "IDE controller not qdevified yet;
drive <name> ignored".

Affected machines:

* g3beige's first IDE channel (MacIO)
  -hda, -hdb are on first channel, and no longer work
  -hdc, -hdd are on second channel, and still work
* mac99's second and third IDE channel (MacIO)
  All four IDE drives no longer work
* spitz, borzoi, terrier and tosa (CF microdrive)
  -hda no longer works
  the other IDE drives have always been silently ignored
* r2d's onboard CF (MMIO)
  -hda no longer works
  the other IDE drives have always been silently ignored

The writing has been on the wall for a few years.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/ide/core.c | 43 +++++++++----------------------------------
 1 file changed, 9 insertions(+), 34 deletions(-)

diff --git a/hw/ide/core.c b/hw/ide/core.c
index c4f93d0..2c0c978 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2057,53 +2057,28 @@ void ide_init2(IDEBus *bus, qemu_irq irq)
     bus->dma = &ide_dma_nop;
 }
 
-/* TODO convert users to qdev and remove */
+/* TODO users are *broken*; convert them to qdev and remove this function */
 void ide_init2_with_non_qdev_drives(IDEBus *bus, DriveInfo *hd0,
                                     DriveInfo *hd1, qemu_irq irq)
 {
-    int i, trans;
+    Location loc;
+    int i;
     DriveInfo *dinfo;
-    uint32_t cyls, heads, secs;
 
+    loc_push_none(&loc);
     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]);
+            qemu_opts_loc_restore(dinfo->opts);
+            error_report("IDE controller not qdevified yet; drive %s ignored",
+                         dinfo->id);
         }
+        ide_reset(&bus->ifs[i]);
     }
     bus->irq = irq;
     bus->dma = &ide_dma_nop;
+    loc_pop(&loc);
 }
 
 static const MemoryRegionPortio ide_portio_list[] = {
-- 
1.7.11.7

  reply	other threads:[~2012-12-17 14:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-17 14:05 [Qemu-devel] [PATCH 00/10] Drop code for non-qdevified IDE, and clean up Markus Armbruster
2012-12-17 14:05 ` Markus Armbruster [this message]
2012-12-17 14:09   ` [Qemu-devel] [PATCH 01/10] ide: Break all non-qdevified controllers Alexander Graf
2012-12-17 14:43     ` Markus Armbruster
2012-12-17 14:55       ` Alexander Graf
2012-12-17 15:15         ` Markus Armbruster
2012-12-17 15:18           ` Alexander Graf
2012-12-17 15:38             ` Markus Armbruster
2012-12-17 21:50       ` Andreas Färber
2012-12-18 12:55         ` Markus Armbruster
2012-12-18 12:12   ` Peter Maydell
2012-12-18 12:44     ` Markus Armbruster
2012-12-18 13:56       ` Peter Maydell
2012-12-17 14:05 ` [Qemu-devel] [PATCH 02/10] ide: Move IDEDevice pointer from IDEBus to IDEState Markus Armbruster
2012-12-17 14:05 ` [Qemu-devel] [PATCH 03/10] ide: Use IDEState member dev for "device connected" test Markus Armbruster
2012-12-17 14:05 ` [Qemu-devel] [PATCH 04/10] ide: Don't block-align IDEState member smart_selftest_data Markus Armbruster
2012-12-17 14:05 ` [Qemu-devel] [PATCH 05/10] ide: Drop redundant IDEState member bs Markus Armbruster
2012-12-17 14:05 ` [Qemu-devel] [PATCH 06/10] ide: Drop redundant IDEState geometry members Markus Armbruster
2012-12-17 14:05 ` [Qemu-devel] [PATCH 07/10] ide: Drop redundant IDEState member version Markus Armbruster
2012-12-17 14:05 ` [Qemu-devel] [PATCH 08/10] ide: Drop redundant IDEState member drive_serial_str Markus Armbruster
2012-12-17 14:05 ` [Qemu-devel] [PATCH 09/10] ide: Drop redundant IDEState member model Markus Armbruster
2012-12-17 14:06 ` [Qemu-devel] [PATCH 10/10] ide: Drop redundant IDEState member wwn Markus Armbruster
2012-12-18 13:35 ` [Qemu-devel] [PATCH 00/10] Drop code for non-qdevified IDE, and clean up Anthony Liguori
2012-12-18 15:10   ` Markus Armbruster

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=1355753160-17544-2-git-send-email-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=agraf@suse.de \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).