patch-2.3.1 linux/drivers/block/ide-pmac.c

Next file: linux/drivers/block/ide-probe.c
Previous file: linux/drivers/block/ide-pci.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.0/linux/drivers/block/ide-pmac.c linux/drivers/block/ide-pmac.c
@@ -21,6 +21,8 @@
 #include <linux/sched.h>
 #include <linux/init.h>
 #include <linux/delay.h>
+#include <linux/ide.h>
+
 #include <asm/prom.h>
 #include <asm/io.h>
 #include <asm/dbdma.h>
@@ -31,9 +33,9 @@
 #include <asm/adb.h>
 #include <asm/pmu.h>
 #endif
-#include "ide.h"
 #include "ide_modes.h"
 
+int pmac_ide_ports_known;
 ide_ioreg_t pmac_ide_regbase[MAX_HWIFS];
 int pmac_ide_irq[MAX_HWIFS];
 int pmac_ide_count;
@@ -58,24 +60,32 @@
  * N.B. this can't be an initfunc, because the media-bay task can
  * call ide_[un]register at any time.
  */
-void
-pmac_ide_init_hwif_ports(ide_ioreg_t *p, ide_ioreg_t base, int *irq)
+void pmac_ide_init_hwif_ports (	hw_regs_t *hw,
+				ide_ioreg_t data_port,
+				ide_ioreg_t ctrl_port,
+				int *irq)
 {
+	ide_ioreg_t reg = ide_ioreg_t data_port;
 	int i, r;
 
-	*p = 0;
-	if (base == 0)
+	if (data_port == 0)
 		return;
 	/* we check only for -EINVAL meaning that we have found a matching
 	   bay but with the wrong device type */ 
 
-	r = check_media_bay_by_base(base, MB_CD);
+	r = check_media_bay_by_base(data_port, MB_CD);
 	if (r == -EINVAL)
 		return;
 		
-	for (i = 0; i < 8; ++i)
-		*p++ = base + i * 0x10;
-	*p = base + 0x160;
+	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
+		hw->io_ports[i] = reg * 0x10;
+		reg += 1;
+	}
+	if (ctrl_port) {
+		hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
+	} else {
+		hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x160;
+	}
 	if (irq != NULL) {
 		*irq = 0;
 		for (i = 0; i < MAX_HWIFS; ++i) {
@@ -104,8 +114,7 @@
 	}
 }
 
-__initfunc(void
-pmac_ide_probe(void))
+__initfunc(void pmac_ide_probe(void))
 {
 	struct device_node *np;
 	int i;
@@ -172,7 +181,8 @@
 			feature_set(np, FEATURE_IDE_enable);
 
 		hwif = &ide_hwifs[i];
-		pmac_ide_init_hwif_ports(hwif->io_ports, base, &hwif->irq);
+		pmac_ide_init_hwif_ports(&hwif->hw, base, 0, &hwif->irq);
+		memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports));
 		hwif->chipset = ide_generic;
 		hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET];
 		hwif->tuneproc = pmac_ide_tuneproc;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)