Skip to contentSkip to conversation

pmac_ide_init_hwif_ports duplicate

PATCH Joseph P. Garcia 1 participant 1 message Aug 27, 2001

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

pmac_ide_init_hwif_ports exists in two forms in the latest benh kernel. a generic coding in pmac_setup.c for pci chips (pcmcia iirc), and a coding in ide-pmac.c for pmac specific applications. On boot, the ide-pmac.c coding is used, but since the pmac_setup.c coding is used in the ppc function structure setup, the pmac_setup.c code is used everywhere else. One consequence is that mediabays are no longer hot swappable.

I wonder if the pmac_setup.c coding is needed. If it is, where? If the only places that need the ide-pmac.c coding are ide-pmac.c and mediabay.c, then the attached patch should be a good fix. It works by explicitly calling the ide-pmac.c coding, then calling ide_register_hw instead of ide_register. The more generic pmac_setup.c coding is left as default for any other hot swappable ata subsystem.

Is this code going in the correct direction? (ide_register is kinda hinted as being legacy)

Thanks.

--
Joseph P. Garcia
http://www.lycestra.com/

drivers/macintosh/mediabay.c +7 -1
@@ -105,6 +105,9 @@
    (assumes the media-bay contains an ide device) */
 //#define MB_IDE_READY(i)	((inb(media_bays[i].cd_base + 0x70) & 0xc0) == 0x40)
 #define MB_IDE_READY(i)	((inb(media_bays[i].cd_base + 0x70) & 0x80) == 0)
+#include <linux/ide.h>
+void pmac_ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port,
+										 ide_ioreg_t ctrl_port, int *irq);
 #endif
 
 /* Note: All delays are not in milliseconds and converted to HZ relative
@@ -473,8 +476,11 @@
 			bay->timer = 0;
 			bay->state = mb_up;
 			if (bay->cd_index < 0) {
+				hw_regs_t hw;
 				pmu_suspend();
-				bay->cd_index = ide_register(bay->cd_base, 0, bay->cd_irq);
+				pmac_ide_init_hwif_ports(&hw, (ide_ioreg_t) bay->cd_base, 0, NULL);
+				hw.irq = bay->cd_irq;
+				bay->cd_index = ide_register_hw(&hw, NULL);
 				pmu_resume();
 			}
 			if (bay->cd_index == -1) {
arch/ppc/kernel/pmac_setup.c +2 -2
@@ -617,7 +617,7 @@
  * for the IDE controller in the ohare/paddington/heathrow/keylargo.
  */
 static void __pmac
-pmac_ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port,
+pmac_pci_ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port,
 		ide_ioreg_t ctrl_port, int *irq)
 {
 	ide_ioreg_t reg = data_port;
@@ -795,7 +795,7 @@
         ppc_ide_md.ide_check_region	= pmac_ide_check_region;
         ppc_ide_md.ide_request_region	= pmac_ide_request_region;
         ppc_ide_md.ide_release_region	= pmac_ide_release_region;
-        ppc_ide_md.ide_init_hwif	= pmac_ide_init_hwif_ports;
+        ppc_ide_md.ide_init_hwif	= pmac_pci_ide_init_hwif_ports;
 #endif /* CONFIG_BLK_DEV_IDE && CONFIG_BLK_DEV_IDE_PMAC */
 
 #ifdef CONFIG_BOOTX_TEXT