qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-ppc] [PATCH 01/10] ide: Break all non-qdevified controllers


From: Markus Armbruster
Subject: [Qemu-ppc] [PATCH 01/10] ide: Break all non-qdevified controllers
Date: Mon, 17 Dec 2012 15:05:51 +0100

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 <address@hidden>
---
 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 via email to

[Prev in Thread] Current Thread [Next in Thread]