--- a/drivers/ide/Makefile
+++ b/drivers/ide/Makefile
@@ -39,6 +39,7 @@
 obj-$(CONFIG_BLK_DEV_AMD74XX)          += amd74xx.o
 obj-$(CONFIG_BLK_DEV_ATIIXP)           += atiixp.o
 obj-$(CONFIG_BLK_DEV_CELLEB)           += scc_pata.o
+obj-$(CONFIG_BLK_DEV_IDE_PMAC)         += pmac.o
 obj-$(CONFIG_BLK_DEV_CMD64X)           += cmd64x.o
 obj-$(CONFIG_BLK_DEV_CS5520)           += cs5520.o
 obj-$(CONFIG_BLK_DEV_CS5530)           += cs5530.o
@@ -76,8 +77,6 @@
 
 obj-$(CONFIG_BLK_DEV_CMD640)           += cmd640.o
 
-obj-$(CONFIG_BLK_DEV_IDE_PMAC)         += pmac.o
-
 obj-$(CONFIG_IDE_H8300)                        += ide-h8300.o
 
 obj-$(CONFIG_IDE_GENERIC)              += ide-generic.o


The problem is, the kernel guys will never take that patch upstream because 
what they're currently doing isn't actually wrong.  Their behavior is 
consistent, the kernel's been probing the same devices in the same order since 
the 90's, and they don't really care what order things go in.

The problem is that the association between qemu's command line arguments and 
the devices they refer to is somewhat arbitrary.  On the other targets I've 
used (arm, mips, x86, and so on), the device QEMU initializes in response to 
"-hda" is the one the Linux kernel makes /dev/hda (or /dev/sda), and the one 
it intializes in response to "-hdc" is the one Linux makes /dev/hdc.  But in 
this case, they don't match up, and that's screwing up my same init/build 
script that works fine on all the other tarets.

Here's a patch to QEMU that makes those arguments intialize the devices the 
kernel expects them to.  This doesn't change where any of the hardware is on 
the board, just which command line arguments associate with which drives:

--- a/hw/ppc_oldworld.c
+++ b/hw/ppc_oldworld.c
@@ -346,16 +346,16 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
         exit(1);
     }
 
-    /* First IDE channel is a MAC IDE on the MacIO bus */
-    hd[0] = drive_get(IF_IDE, 0, 0);
-    hd[1] = drive_get(IF_IDE, 0, 1);
+    /* Second IDE channel is a MAC IDE on the MacIO bus */
+    hd[0] = drive_get(IF_IDE, 1, 0);
+    hd[1] = drive_get(IF_IDE, 1, 1);
     dbdma = DBDMA_init(&dbdma_mem_index);
     ide_mem_index[0] = -1;
     ide_mem_index[1] = pmac_ide_init(hd, pic[0x0D], dbdma, 0x16, pic[0x02]);
 
-    /* Second IDE channel is a CMD646 on the PCI bus */
-    hd[0] = drive_get(IF_IDE, 1, 0);
-    hd[1] = drive_get(IF_IDE, 1, 1);
+    /* First IDE channel is a CMD646 on the PCI bus */
+    hd[0] = drive_get(IF_IDE, 0, 0);
+    hd[1] = drive_get(IF_IDE, 0, 1);
     hd[3] = hd[2] = NULL;
     pci_cmd646_ide_init(pci_bus, hd, 0);
 
