Date: Thu, 2 Apr 1998 10:38:29 +0200 (CEST)
From: Geert Uytterhoeven <Geert.Uytterhoeven@cs.kuleuven.ac.be>
To: Linux/m68k <linux-m68k@lists.linux-m68k.org>
Subject: L68K: IDE patches for 2.1.90
Sender: owner-linux-m68k@phil.uni-sb.de
Reply-To: Geert Uytterhoeven <Geert.Uytterhoeven@cs.kuleuven.ac.be>


Here are some patches for IDE.

Changes:

  - Mac IDE driver (Michael Schmitz).
  - Fix driver cache size report (Michael Schmitz).
  - Moved block stuff from arch/m68k/config.in drivers/block/Config.in [*]
    (suggested by Mark Lord).
  - Put low level IDE drivers in separate sources (suggested by Mark Lord).
    To prevent kernel bloat when using modules, I link all low level stuff in
    ide-mod.o, together with ide.o and ide-probe.o [*]
  - Upgrade to `current' IDE stuff (Mark Lord). I guess this is the same as
    2.1.92.

Something that doesn't really belong here:

  - fb.h: smem_offset for Mac (Michael Schmitz).

What's missing:

  - Configure.help entry for Mac IDE
  - Mark also wants to get rid of ide_init_hwif_ports, but now I see we are
    the only guys we do _not_ use that function :-)

Any comments are welcome, especially about the things marked with [*].

--- m68k-2.1.90-current/arch/m68k/config.in	Tue Mar 24 18:54:47 1998
+++ m68k/arch/m68k/config.in	Wed Apr  1 20:49:20 1998
@@ -88,69 +88,7 @@
 fi
 endmenu
 
-#
-# Block device driver configuration
-#
-mainmenu_option next_comment
-comment 'Floppy, IDE, and other block devices'
-
-if [ "$CONFIG_AMIGA" = "y" ]; then
-  tristate 'Amiga floppy support' CONFIG_AMIGA_FLOPPY
-fi
-if [ "$CONFIG_ATARI" = "y" ]; then
-  tristate 'Atari floppy support' CONFIG_ATARI_FLOPPY
-fi
-if [ "$CONFIG_MAC" = "y" ]; then
-  tristate 'Macintosh IWM floppy support' CONFIG_MAC_FLOPPY
-fi
-#Normal floppy disk support' CONFIG_BLK_DEV_FD
-
-tristate 'Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support' CONFIG_BLK_DEV_IDE
-if [ "$CONFIG_BLK_DEV_IDE" != "n" ]; then
-  dep_tristate '   Include IDE/ATA-2 DISK support' CONFIG_BLK_DEV_IDEDISK $CONFIG_BLK_DEV_IDE
-  dep_tristate '   Include IDE/ATAPI CDROM support' CONFIG_BLK_DEV_IDECD $CONFIG_BLK_DEV_IDE
-  dep_tristate '   Include IDE/ATAPI TAPE support' CONFIG_BLK_DEV_IDETAPE $CONFIG_BLK_DEV_IDE
-  dep_tristate '   Include IDE/ATAPI FLOPPY support' CONFIG_BLK_DEV_IDEFLOPPY $CONFIG_BLK_DEV_IDE
-  dep_tristate '   SCSI emulation support' CONFIG_BLK_DEV_IDESCSI $CONFIG_BLK_DEV_IDE
-  if [ "$CONFIG_AMIGA" = "y" ]; then
-    bool '   Amiga Gayle IDE interface support' CONFIG_BLK_DEV_GAYLE
-    if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
-      bool '   Buddha/Catweasel IDE interface support' CONFIG_BLK_DEV_BUDDHA
-      bool '   Amiga IDE Doubler support' CONFIG_BLK_DEV_IDEDOUBLER $CONFIG_BLK_DEV_GAYLE
-    fi
-  fi
-  if [ "$CONFIG_ATARI" = "y" ]; then
-    bool '   Falcon IDE interface support' CONFIG_BLK_DEV_FALCON_IDE
-  fi
-fi
-if [ "$CONFIG_AMIGA" = "y" ]; then
-  tristate 'Amiga Zorro II ramdisk support' CONFIG_AMIGA_Z2RAM
-fi
-if [ "$CONFIG_ATARI" = "y" ]; then
-  tristate 'Atari ACSI support' CONFIG_ATARI_ACSI
-  if [ "$CONFIG_ATARI_ACSI" != "n" ]; then
-    comment 'Some devices (e.g. CD jukebox) support multiple LUNs'
-    bool 'Probe all LUNs on each ACSI device' CONFIG_ACSI_MULTI_LUN
-    dep_tristate 'Atari SLM laser printer support' CONFIG_ATARI_SLM $CONFIG_ATARI_ACSI
-  fi
-fi
-
-comment 'Additional Block Devices'
-
-tristate 'Loopback device support' CONFIG_BLK_DEV_LOOP
-bool 'Multiple devices driver support' CONFIG_BLK_DEV_MD
-if [ "$CONFIG_BLK_DEV_MD" = "y" ]; then
-  tristate '   Linear (append) mode' CONFIG_MD_LINEAR
-  tristate '   RAID-0 (striping) mode' CONFIG_MD_STRIPED
-fi
-if [ "$CONFIG_MD_LINEAR" = "y" -o "$CONFIG_MD_STRIPED" = "y" ]; then
-  bool '      Boot support (linear, striped)' CONFIG_MD_BOOT
-fi
-tristate 'RAM disk support' CONFIG_BLK_DEV_RAM
-if [ "$CONFIG_BLK_DEV_RAM" = "y" ]; then
-  bool '   Initial RAM disk (initrd) support' CONFIG_BLK_DEV_INITRD
-fi
-endmenu
+source drivers/block/Config.in
 
 if [ "$CONFIG_NET" = "y" ]; then
   source net/Config.in
@@ -191,6 +129,10 @@
   bool 'CyberStorm SCSI Mk II support' CONFIG_CYBERSTORMII_SCSI
   bool 'Blizzard 2060 SCSI support' CONFIG_BLZ2060_SCSI
   bool 'Blizzard 1230IV/1260 SCSI support' CONFIG_BLZ1230_SCSI
+  if [ "$CONFIG_BLZ1230_SCSI" = "n" ]; then
+    define_bool CONFIG_BLZ1230_SCSI y
+    bool 'Blizzard 1230I/II SCSI support' CONFIG_BLZII1230_SCSI
+  fi
   bool 'Fastlane SCSI support' CONFIG_FASTLANE_SCSI
   if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
     bool 'A4000T SCSI support' CONFIG_A4000T_SCSI
@@ -199,6 +141,9 @@
 #    bool 'Cyberstorm Mk III SCSI support' CONFIG_CYBERSTORMIII_SCSI
 #    bool 'GVP Turbo 040/060 SCSI support' CONFIG_GVP_TURBO_SCSI
   fi
+  if [ "$CONFIG_MAC" = "y" ]; then
+    bool '   Macintosh Quadra/Powerbook IDE interface support' CONFIG_BLK_DEV_MAC_IDE
+  fi
 fi
 if [ "$CONFIG_ATARI" = "y" ]; then
   dep_tristate 'Atari native SCSI support' CONFIG_ATARI_SCSI $CONFIG_SCSI
@@ -334,16 +279,17 @@
   tristate 'Multiface Card III serial support' CONFIG_MULTIFACE_III_TTY
   bool 'Hisoft Whippet PCMCIA serial support' CONFIG_WHIPPET
 fi
-if [ "$CONFIG_AMIGA" = "y" -o "$CONFIG_ATARI" = "y" ]; then
+if [ "$CONFIG_MAC" = "y" ]; then
+  bool 'Mac SCC serial support' CONFIG_MAC_SCC
+fi
+if [ "$CONFIG_AMIGA" = "y" -o "$CONFIG_ATARI" = "y" -o "$CONFIG_MAC" = "y" ]; then
   if [ "$CONFIG_ATARI_MFPSER" = "y" -o "$CONFIG_ATARI_SCC" = "y" -o \
-       "$CONFIG_ATARI_MIDI" = "y" -o "$CONFIG_AMIGA_BUILTIN_SERIAL" = "y" -o \
+       "$CONFIG_ATARI_MIDI" = "y" -o "$CONFIG_MAC_SCC" = "y" -o \
+       "$CONFIG_AMIGA_BUILTIN_SERIAL" = "y" -o \
        "$CONFIG_GVPIOEXT" = "y" -o "$CONFIG_MULTIFACE_III_TTY" = "y" ]; then
     bool 'Support for serial port console' CONFIG_SERIAL_CONSOLE
   fi
 fi
-if [ "$CONFIG_MAC" = "y" ]; then
-  bool 'Mac SCC serial support' CONFIG_MAC_SCC
-fi
 if [ "$CONFIG_VME" = "y" ]; then
   define_bool CONFIG_SERIAL_CONSOLE y
   bool 'CD2401 support for MVME166/7 serial ports' CONFIG_SERIAL167
@@ -360,7 +306,7 @@
   bool '   Software Watchdog' CONFIG_SOFT_WATCHDOG
 fi
 bool 'Support for user misc device modules' CONFIG_UMISC
-if [ "$CONFIG_AMIGA" = "y" -o "$CONFIG_ATARI" = "y" ]; then
+if [ "$CONFIG_AMIGA" = "y" -o "$CONFIG_ATARI" = "y" -o "$CONFIG_MAC" = "y" ]; then
   define_bool CONFIG_ABSTRACT_CONSOLE y
 fi
 if [ "$CONFIG_ATARI" = "y" ]; then
--- m68k-2.1.90-current/drivers/block/Config.in	Tue Mar 24 18:54:47 1998
+++ m68k/drivers/block/Config.in	Tue Mar 31 01:46:56 1998
@@ -4,58 +4,97 @@
 mainmenu_option next_comment
 comment 'Floppy, IDE, and other block devices'
 
-tristate 'Normal floppy disk support' CONFIG_BLK_DEV_FD
+if [ "$ARCH" != "m68k" ]; then
+  tristate 'Normal floppy disk support' CONFIG_BLK_DEV_FD
+fi
+if [ "$CONFIG_AMIGA" = "y" -o "$CONFIG_APUS" = "y" ]; then
+  tristate 'Amiga floppy support' CONFIG_AMIGA_FLOPPY
+fi
+if [ "$CONFIG_ATARI" = "y" ]; then
+  tristate 'Atari floppy support' CONFIG_ATARI_FLOPPY
+fi
+if [ "$CONFIG_MAC" = "y" ]; then
+  tristate 'Macintosh IWM floppy support' CONFIG_MAC_FLOPPY_IWM
+fi
+
 tristate 'Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support' CONFIG_BLK_DEV_IDE
 comment 'Please see Documentation/ide.txt for help/info on IDE drives'
 
-define_bool CONFIG_BLK_DEV_PCIDE $CONFIG_BLK_DEV_IDE
-
 if [ "$CONFIG_BLK_DEV_IDE" = "n" ]; then
-  bool 'Old harddisk (MFM/RLL/IDE) driver' CONFIG_BLK_DEV_HD_ONLY
+  if [ "$ARCH" != "m68k" ]; then
+    bool 'Old harddisk (MFM/RLL/IDE) driver' CONFIG_BLK_DEV_HD_ONLY
+  fi
 else
-  bool '   Use old disk-only driver on primary interface' CONFIG_BLK_DEV_HD_IDE
+  if [ "$ARCH" != "m68k" ]; then
+    bool '   Use old disk-only driver on primary interface' CONFIG_BLK_DEV_HD_IDE
+  fi
   dep_tristate '   Include IDE/ATA-2 DISK support' CONFIG_BLK_DEV_IDEDISK $CONFIG_BLK_DEV_IDE
   dep_tristate '   Include IDE/ATAPI CDROM support' CONFIG_BLK_DEV_IDECD $CONFIG_BLK_DEV_IDE
   dep_tristate '   Include IDE/ATAPI TAPE support' CONFIG_BLK_DEV_IDETAPE $CONFIG_BLK_DEV_IDE
   dep_tristate '   Include IDE/ATAPI FLOPPY support' CONFIG_BLK_DEV_IDEFLOPPY $CONFIG_BLK_DEV_IDE
   dep_tristate '   SCSI emulation support' CONFIG_BLK_DEV_IDESCSI $CONFIG_BLK_DEV_IDE
-  if [ "$CONFIG_BLK_DEV_IDE" = "y" ]; then
-    bool '   CMD640 chipset bugfix/support' CONFIG_BLK_DEV_CMD640
-    if [ "$CONFIG_BLK_DEV_CMD640" = "y" ]; then
-      bool '     CMD640 enhanced support' CONFIG_BLK_DEV_CMD640_ENHANCED
-    fi
-    if [ "$CONFIG_PCI" = "y" ]; then
-      bool '   RZ1000 chipset bugfix/support' CONFIG_BLK_DEV_RZ1000
-      bool '   Generic PCI IDE chipset support' CONFIG_BLK_DEV_IDEPCI
-      if [ "$CONFIG_BLK_DEV_IDEPCI" = "y" ]; then
-        bool '     Generic PCI bus-master DMA support' CONFIG_BLK_DEV_IDEDMA
-        if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
-          bool '     OPTi 82C621 chipset enhanced support (EXPERIMENTAL)' CONFIG_BLK_DEV_OPTI621
-          if [ "$CONFIG_BLK_DEV_IDEDMA" = "y" ]; then
-            bool '     Tekram TRM290 chipset support (EXPERIMENTAL)' CONFIG_BLK_DEV_TRM290
-            bool '     NS87415 chipset support (EXPERIMENTAL)' CONFIG_BLK_DEV_NS87415
-          fi
-        fi
+  if [ "$ARCH" != "m68k" ]; then
+    define_bool CONFIG_BLK_DEV_PCIDE y
+    if [ "$CONFIG_BLK_DEV_IDE" = "y" -a "$ARCH" != "m68k" ]; then
+      bool '   CMD640 chipset bugfix/support' CONFIG_BLK_DEV_CMD640
+      if [ "$CONFIG_BLK_DEV_CMD640" = "y" ]; then
+	bool '     CMD640 enhanced support' CONFIG_BLK_DEV_CMD640_ENHANCED
       fi
-    fi
-    bool '   Other IDE chipset support' CONFIG_IDE_CHIPSETS
-    if [ "$CONFIG_IDE_CHIPSETS" = "y" ]; then
-      comment 'Note: most of these also require special kernel boot parameters'
-      bool '     Generic 4 drives/port support' CONFIG_BLK_DEV_4DRIVES
-      bool '     ALI M14xx support' CONFIG_BLK_DEV_ALI14XX
-      bool '     DTC-2278 support' CONFIG_BLK_DEV_DTC2278
-      bool '     Holtek HT6560B support' CONFIG_BLK_DEV_HT6560B
-      bool '     QDI QD6580 support' CONFIG_BLK_DEV_QD6580
-      bool '     UMC-8672 support' CONFIG_BLK_DEV_UMC8672
-      if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
-        bool '     PROMISE DC4030 support (EXPERIMENTAL)' CONFIG_BLK_DEV_PDC4030
+      if [ "$CONFIG_PCI" = "y" ]; then
+	bool '   RZ1000 chipset bugfix/support' CONFIG_BLK_DEV_RZ1000
+	bool '   Generic PCI IDE chipset support' CONFIG_BLK_DEV_IDEPCI
+	if [ "$CONFIG_BLK_DEV_IDEPCI" = "y" ]; then
+	  bool '     Generic PCI bus-master DMA support' CONFIG_BLK_DEV_IDEDMA
+	  if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
+	    bool '     OPTi 82C621 chipset enhanced support (EXPERIMENTAL)' CONFIG_BLK_DEV_OPTI621
+	    if [ "$CONFIG_BLK_DEV_IDEDMA" = "y" ]; then
+	      bool '     Tekram TRM290 chipset support (EXPERIMENTAL)' CONFIG_BLK_DEV_TRM290
+	      bool '     NS87415 chipset support (EXPERIMENTAL)' CONFIG_BLK_DEV_NS87415
+	    fi
+	  fi
+	fi
+      fi
+      bool '   Other IDE chipset support' CONFIG_IDE_CHIPSETS
+      if [ "$CONFIG_IDE_CHIPSETS" = "y" ]; then
+	comment 'Note: most of these also require special kernel boot parameters'
+	bool '     Generic 4 drives/port support' CONFIG_BLK_DEV_4DRIVES
+	bool '     ALI M14xx support' CONFIG_BLK_DEV_ALI14XX
+	bool '     DTC-2278 support' CONFIG_BLK_DEV_DTC2278
+	bool '     Holtek HT6560B support' CONFIG_BLK_DEV_HT6560B
+	bool '     QDI QD6580 support' CONFIG_BLK_DEV_QD6580
+	bool '     UMC-8672 support' CONFIG_BLK_DEV_UMC8672
+	if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
+	  bool '     PROMISE DC4030 support (EXPERIMENTAL)' CONFIG_BLK_DEV_PDC4030
+	fi
       fi
     fi
   fi
+  if [ "$CONFIG_AMIGA" = "y" -o "$CONFIG_APUS" = "y" ]; then
+    bool '   Amiga Gayle IDE interface support' CONFIG_BLK_DEV_GAYLE
+    if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
+      bool '   Amiga IDE Doubler support' CONFIG_BLK_DEV_IDEDOUBLER $CONFIG_BLK_DEV_GAYLE
+      bool '   Buddha/Catweasel IDE interface support' CONFIG_BLK_DEV_BUDDHA
+    fi
+  fi
+  if [ "$CONFIG_ATARI" = "y" ]; then
+    bool '   Falcon IDE interface support' CONFIG_BLK_DEV_FALCON_IDE
+  fi
 fi
 if [ "$CONFIG_MCA" = "y" ]; then
   bool 'PS/2 ESDI harddisk support' CONFIG_BLK_DEV_PS2
 fi
+if [ "$CONFIG_AMIGA" = "y" -o "$CONFIG_APUS" = "y" ]; then
+  tristate 'Amiga Zorro II ramdisk support' CONFIG_AMIGA_Z2RAM
+fi
+if [ "$CONFIG_ATARI" = "y" ]; then
+  tristate 'Atari ACSI support' CONFIG_ATARI_ACSI
+  if [ "$CONFIG_ATARI_ACSI" != "n" ]; then
+    comment 'Some devices (e.g. CD jukebox) support multiple LUNs'
+    bool 'Probe all LUNs on each ACSI device' CONFIG_ACSI_MULTI_LUN
+    dep_tristate 'Atari SLM laser printer support' CONFIG_ATARI_SLM $CONFIG_ATARI_ACSI
+  fi
+fi
+
 
 comment 'Additional Block Devices'
 
--- m68k-2.1.90-current/drivers/block/Makefile	Wed Mar 25 21:21:41 1998
+++ m68k/drivers/block/Makefile	Wed Apr  1 21:36:25 1998
@@ -26,6 +26,8 @@
 LX_OBJS := ll_rw_blk.o genhd.o
 MX_OBJS :=
 
+IDE_OBJS :=
+
 ifeq ($(CONFIG_MSDOS_PARTITION),y)
   L_OBJS += partbl_msdos.o
 else
@@ -78,6 +80,10 @@
 L_OBJS += swim3.o
 endif
 
+ifeq ($(CONFIG_MAC_FLOPPY_IWM),y)
+L_OBJS += iwm.o
+endif
+
 ifeq ($(CONFIG_BLK_DEV_FD),y)
 L_OBJS += floppy.o
 else
@@ -184,39 +190,63 @@
 endif
 
 ifeq ($(CONFIG_BLK_DEV_DTC2278),y)
-L_OBJS += dtc2278.o
+IDE_OBJS += dtc2278.o
 endif
 
 ifeq ($(CONFIG_BLK_DEV_HT6560B),y)
-L_OBJS += ht6560b.o
+IDE_OBJS += ht6560b.o
 endif
 
 ifeq ($(CONFIG_BLK_DEV_QD6580),y)
-L_OBJS += qd6580.o
+IDE_OBJS += qd6580.o
 endif
 
 ifeq ($(CONFIG_BLK_DEV_UMC8672),y)
-L_OBJS += umc8672.o
+IDE_OBJS += umc8672.o
 endif
 
 ifeq ($(CONFIG_BLK_DEV_ALI14XX),y)
-L_OBJS += ali14xx.o
+IDE_OBJS += ali14xx.o
 endif
 
 ifeq ($(CONFIG_BLK_DEV_PDC4030),y)
-L_OBJS += pdc4030.o
+IDE_OBJS += pdc4030.o
 endif
 
 ifeq ($(CONFIG_BLK_DEV_TRM290),y)
-L_OBJS += trm290.o
+IDE_OBJS += trm290.o
 endif
 
 ifeq ($(CONFIG_BLK_DEV_OPTI621),y)
-L_OBJS += opti621.o
+IDE_OBJS += opti621.o
 endif
 
 ifeq ($(CONFIG_BLK_DEV_NS87415),y)
-L_OBJS += ns87415.o
+IDE_OBJS += ns87415.o
+endif
+
+ifeq ($(CONFIG_BLK_DEV_PCIDE),y)
+IDE_OBJS += pcide.o
+endif
+
+ifeq ($(CONFIG_BLK_DEV_GAYLE),y)
+IDE_OBJS += gayle.o
+endif
+
+ifeq ($(CONFIG_BLK_DEV_FALCON_IDE),y)
+IDE_OBJS += falconide.o
+endif
+
+ifeq ($(CONFIG_BLK_DEV_MAC_IDE),y)
+IDE_OBJS += macide.o
+endif
+
+ifeq ($(CONFIG_BLK_DEV_BUDDHA),y)
+IDE_OBJS += buddha.o
+endif
+
+ifeq ($(CONFIG_BLK_DEV_IDE),y)
+L_OBJS += $(IDE_OBJS)
 endif
 
 ifeq ($(CONFIG_BLK_DEV_IDEDISK),y)
@@ -315,5 +345,5 @@
 
 include $(TOPDIR)/Rules.make
 
-ide-mod.o: ide.o ide-proc.o
-	$(LD) $(LD_RFLAG) -r -o $@ ide.o ide-proc.o
+ide-mod.o: ide.o ide-proc.o $(IDE_OBJS)
+	$(LD) $(LD_RFLAG) -r -o $@ ide.o ide-proc.o $(IDE_OBJS)
--- m68k-2.1.90-current/drivers/block/ide-disk.c	Tue Mar 24 18:54:48 1998
+++ m68k/drivers/block/ide-disk.c	Thu Apr  2 01:01:27 1998
@@ -497,25 +497,13 @@
 		drive->special.b.set_multmode = 1;
 }
 
-static int proc_idedisk_read_cache
-	(char *page, char **start, off_t off, int count, int *eof, void *data)
-{
-	ide_drive_t	*drive = (ide_drive_t *) data;
-	char		*out = page;
-	int		len;
-
-	if (drive->id)
-		len = sprintf(out,"%i\n", drive->id->buf_size / 2);
-	else
-		len = sprintf(out,"(none)\n");
-	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
-}
-
 static int smart_enable(ide_drive_t *drive)
 {
 	return ide_wait_cmd(drive, WIN_SMART, 0, SMART_ENABLE, 0, NULL);
 }
 
+#ifdef CONFIG_PROC_FS
+
 static int get_smart_values(ide_drive_t *drive, byte *buf)
 {
 	(void) smart_enable(drive);
@@ -528,6 +516,20 @@
 	return ide_wait_cmd(drive, WIN_SMART, 0, SMART_READ_THRESHOLDS, 1, buf);
 }
 
+static int proc_idedisk_read_cache
+	(char *page, char **start, off_t off, int count, int *eof, void *data)
+{
+	ide_drive_t	*drive = (ide_drive_t *) data;
+	char		*out = page;
+	int		len;
+
+	if (drive->id)
+		len = sprintf(out,"%i\n", drive->id->buf_size / 2);
+	else
+		len = sprintf(out,"(none)\n");
+	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
+}
+
 static int proc_idedisk_read_smart_thresholds
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
@@ -574,6 +576,12 @@
 	{ NULL, NULL, NULL }
 };
 
+#else
+
+#define	idedisk_proc	NULL
+
+#endif	/* CONFIG_PROC_FS */
+
 static int set_multcount(ide_drive_t *drive, int arg)
 {
 	struct request rq;
@@ -716,9 +724,10 @@
 		if (drive->cyl > drive->bios_cyl)
 			drive->bios_cyl = drive->cyl;
 	}
+#if 0	/* MSch 980329: That's already been done in ide_fix_drivid() ... */
 	/* fix byte-ordering of buffer size field */
 	id->buf_size = le16_to_cpu(id->buf_size);
-
+#endif
 	printk (KERN_INFO "%s: %.40s, %ldMB w/%dkB Cache, CHS=%d/%d/%d",
 	 drive->name, id->model, idedisk_capacity(drive)/2048L, id->buf_size/2,
 	 drive->bios_cyl, drive->bios_head, drive->bios_sect);
--- m68k-2.1.90-current/drivers/block/ide-floppy.c	Tue Mar 24 18:54:48 1998
+++ m68k/drivers/block/ide-floppy.c	Thu Apr  2 01:01:27 1998
@@ -1380,10 +1380,18 @@
 	return 0;
 }
 
+#ifdef CONFIG_PROC_FS
+
 static ide_proc_entry_t idefloppy_proc[] = {
 	{ "geometry", proc_ide_read_geometry, NULL },
 	{ NULL, NULL, NULL }
 };
+
+#else
+
+#define	idefloppy_proc	NULL
+
+#endif	/* CONFIG_PROC_FS */
 
 /*
  *	IDE subdriver functions, registered with ide.c
--- m68k-2.1.90-current/drivers/block/ide-pci.c	Thu Mar 19 21:29:20 1998
+++ m68k/drivers/block/ide-pci.c	Thu Apr  2 01:01:27 1998
@@ -174,9 +174,13 @@
 	 * just in case there's another interface yet-to-be-scanned
 	 * which uses ports 1f0/170 (the ide0/ide1 defaults).
 	 */
-	for (h = 0; h < MAX_HWIFS; ++h) {
-		int hwifs[] = {2,3,1,0}; /* assign 3rd/4th before 1st/2nd */
-		hwif = &ide_hwifs[hwifs[h]];
+	for (h = 2; h < MAX_HWIFS; ++h) {
+		hwif = ide_hwifs + h;
+		if (hwif->chipset == ide_unknown)
+			return hwif;	/* pick an unused entry */
+	}
+	for (h = 0; h < 2; ++h) {
+		hwif = ide_hwifs + h;
 		if (hwif->chipset == ide_unknown)
 			return hwif;	/* pick an unused entry */
 	}
@@ -366,8 +370,10 @@
 		 * workaround Intel Advanced/ZP with bios <= 1.04;
 		 * these appear in some Dell Dimension XPS's 
 		 */
-		if (!hedt && IDE_PCI_DEVID_EQ(devid, DEVID_PIIXa))
+		if (!hedt && IDE_PCI_DEVID_EQ(devid, DEVID_PIIXa)) {
+			printk("ide: implementing workaround for PIIX detection\n");
 		        hedt = 0x80;
+		}
 
 		for (d = ide_pci_chipsets; d->devid.vid && !IDE_PCI_DEVID_EQ(d->devid, devid); ++d);
 		if (d->init_hwif == IDE_IGNORE)
@@ -382,7 +388,7 @@
 				printk("%s: IDE controller on PCI bus %d function %d\n", d->name, bus, fn);
 			ide_setup_pci_device(bus, fn, ccode, d);
 		}
-	} while (hedt == 0x80 && (++fn & 7));
+	} while ((hedt & 0x80) && (++fn & 7));
 }
 
 /*
--- m68k-2.1.90-current/drivers/block/ide-probe.c	Tue Mar 24 18:54:48 1998
+++ m68k/drivers/block/ide-probe.c	Thu Apr  2 01:01:27 1998
@@ -668,6 +668,12 @@
 #if MAX_HWIFS > 3
 	case IDE3_MAJOR: rfn = &do_ide3_request; break;
 #endif
+#if MAX_HWIFS > 4
+	case IDE4_MAJOR: rfn = &do_ide4_request; break;
+#endif
+#if MAX_HWIFS > 5
+	case IDE5_MAJOR: rfn = &do_ide5_request; break;
+#endif
 	default:
 		printk("%s: request_fn NOT DEFINED\n", hwif->name);
 		return (hwif->present = 0);
--- m68k-2.1.90-current/drivers/block/ide-tape.c	Tue Mar 24 18:54:48 1998
+++ m68k/drivers/block/ide-tape.c	Thu Apr  2 01:01:27 1998
@@ -3641,6 +3641,8 @@
 	return 0;
 }
 
+#ifdef CONFIG_PROC_FS
+
 static int proc_idetape_read_name
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
@@ -3657,6 +3659,12 @@
 	{ "name", proc_idetape_read_name, NULL },
 	{ NULL, NULL, NULL }
 };
+
+#else
+
+#define	idetape_proc	NULL
+
+#endif
 
 /*
  *	IDE subdriver functions, registered with ide.c
--- m68k-2.1.90-current/drivers/block/ide.c	Tue Mar 24 18:54:48 1998
+++ m68k/drivers/block/ide.c	Thu Apr  2 01:03:24 1998
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/block/ide.c	Version 6.12  January  2, 1998
+ *  linux/drivers/block/ide.c	Version 6.13  March 29, 1998
  *
  *  Copyright (C) 1994-1998  Linus Torvalds & authors (see below)
  */
@@ -10,29 +10,14 @@
  *            and Gadi Oxman <gadio@netvision.net.il>
  *
  * This is the multiple IDE interface driver, as evolved from hd.c.
- * It supports up to four IDE interfaces, on one or more IRQs (usually 14 & 15).
+ * It supports up to MAX_HWIFS IDE interfaces, on one or more IRQs (usually 14 & 15).
  * There can be up to two drives per interface, as per the ATA-2 spec.
  *
  * Primary:    ide0, port 0x1f0; major=3;  hda is minor=0; hdb is minor=64
  * Secondary:  ide1, port 0x170; major=22; hdc is minor=0; hdd is minor=64
  * Tertiary:   ide2, port 0x???; major=33; hde is minor=0; hdf is minor=64
  * Quaternary: ide3, port 0x???; major=34; hdg is minor=0; hdh is minor=64
- *
- * It is easy to extend ide.c to handle more than four interfaces:
- *
- *	Change the MAX_HWIFS constant in ide.h.
- *
- *	Define some new major numbers (in major.h), and insert them into
- *	the ide_hwif_to_major table in ide.c.
- *
- *	Fill in the extra values for the new interfaces into the two tables
- *	inside ide.c:  default_io_base[]  and  default_irqs[].
- *
- *	Create the new request handlers by cloning "do_ide3_request()"
- *	for each new interface, and add them to the switch statement
- *	in the ide_init() function in ide.c.
- *
- *	Recompile, create the new /dev/ entries, and it will probably work.
+ * ...
  *
  *  From hd.c:
  *  |
@@ -100,6 +85,7 @@
  *			mask all hwgroup interrupts on each irq entry
  * Version 6.12		integrate ioctl and proc interfaces
  *			fix parsing of "idex=" command line parameter
+ * Version 6.13		add support for ide4/ide5 courtesy rjones@orchestream.com
  *
  *  Some additional driver compile-time options are in ide.h
  *
@@ -139,447 +125,7 @@
 #endif /* CONFIG_KMOD */
 
 
-#ifdef CONFIG_BLK_DEV_PCIDE
-
-/* ------------------------- PC I/O Port IDE Driver ------------------------ */
-
-    /*
-     *  Bases of the IDE interfaces
-     */
-
-#define PCIDE_NUM_HWIFS	4
-
-#define PCIDE_BASE1	0x1f0
-#define PCIDE_BASE2	0x170
-#define PCIDE_BASE3	0x1e8
-#define PCIDE_BASE4	0x168
-
-const ide_ioreg_t pcide_bases[PCIDE_NUM_HWIFS] = {
-    PCIDE_BASE1, PCIDE_BASE2, PCIDE_BASE3, PCIDE_BASE4
-};
-
-
-    /*
-     *  Offsets from one of the above bases
-     */
-
-#define PCIDE_REG(x)	(HD_##x-PCIDE_BASE1)
-
-const int pcide_offsets[IDE_NR_PORTS] = {
-    PCIDE_REG(DATA), PCIDE_REG(ERROR), PCIDE_REG(NSECTOR), PCIDE_REG(SECTOR),
-    PCIDE_REG(LCYL), PCIDE_REG(HCYL), PCIDE_REG(CURRENT), PCIDE_REG(STATUS),
-    PCIDE_REG(CMD)
-};
-
-
-    /*
-     *  Probe for PC IDE interfaces
-     */
-
-int pcide_probe_hwif(int index, ide_hwif_t *hwif)
-{
-    static int pcide_index[PCIDE_NUM_HWIFS] = { 0, };
-    int i;
-
-    for (i = 0; i < PCIDE_NUM_HWIFS; i++) {
-	if (!pcide_index[i]) {
-	    printk("ide%d: PC IDE interface\n", index);
-	    pcide_index[i] = index+1;
-	}
-	if (pcide_index[i] == index+1) {
-	    ide_setup_ports(hwif, pcide_bases[i], pcide_offsets, 0, NULL);
-	    hwif->irq = 0;
-	    return 1;
-	}
-    }
-    return 0;
-}
-
-#endif
-
-
-#ifdef CONFIG_BLK_DEV_GAYLE
-
-/* ------------------------- Amiga Gayle IDE Driver ------------------------ */
-
-#include <asm/amigahw.h>
-#include <asm/amigaints.h>
-
-
-    /*
-     *  Bases of the IDE interfaces
-     */
-
-#define GAYLE_BASE_4000	0xdd2020	/* A4000/A4000T */
-#define GAYLE_BASE_1200	0xda0000	/* A1200/A600 */
-
-    /*
-     *  Offsets from one of the above bases
-     */
-
-#define GAYLE_DATA	0x00
-#define GAYLE_ERROR	0x06		/* see err-bits */
-#define GAYLE_NSECTOR	0x0a		/* nr of sectors to read/write */
-#define GAYLE_SECTOR	0x0e		/* starting sector */
-#define GAYLE_LCYL	0x12		/* starting cylinder */
-#define GAYLE_HCYL	0x16		/* high byte of starting cyl */
-#define GAYLE_SELECT	0x1a		/* 101dhhhh , d=drive, hhhh=head */
-#define GAYLE_STATUS	0x1e		/* see status-bits */
-#define GAYLE_CONTROL	0x101a
-
-u_int gayle_offsets[IDE_NR_PORTS] = {
-    GAYLE_DATA, GAYLE_ERROR, GAYLE_NSECTOR, GAYLE_SECTOR, GAYLE_LCYL,
-    GAYLE_HCYL, GAYLE_SELECT, GAYLE_STATUS, GAYLE_CONTROL
-};
-
-
-    /*
-     *  These are at different offsets from the base
-     */
-
-#define GAYLE_IRQ_4000	0xdd3020	/* MSB = 1, Harddisk is source of */
-#define GAYLE_IRQ_1200	0xda9000	/* interrupt */
-
-
-    /*
-     *  Offset of the secondary port for IDE doublers
-     *  Note that GAYLE_CONTROL is NOT available then!
-     */
-
-#define GAYLE_NEXT_PORT	0x1000
-
-#ifndef CONFIG_BLK_DEV_IDEDOUBLER
-#define GAYLE_NUM_HWIFS		1
-#define GAYLE_NUM_PROBE_HWIFS	GAYLE_NUM_HWIFS
-#define GAYLE_HAS_CONTROL_REG	1
-#else /* CONFIG_BLK_DEV_IDEDOUBLER */
-#define GAYLE_NUM_HWIFS		2
-#define GAYLE_NUM_PROBE_HWIFS	(ide_doubler ? GAYLE_NUM_HWIFS : \
-					       GAYLE_NUM_HWIFS-1)
-#define GAYLE_HAS_CONTROL_REG	(!ide_doubler)
-int ide_doubler = 0;	/* support IDE doublers? */
-#endif /* CONFIG_BLK_DEV_IDEDOUBLER */
-
-
-    /*
-     *  Check and acknowledge the interrupt status
-     */
-
-static int gayle_ack_intr_a4000(ide_hwif_t *hwif)
-{
-    unsigned char ch;
-
-    ch = inb(hwif->io_ports[IDE_IRQ_OFFSET]);
-    if (!(ch & 0x80))
-	return 0;
-    return 1;
-}
-
-static int gayle_ack_intr_a1200(ide_hwif_t *hwif)
-{
-    unsigned char ch;
-
-    ch = inb(hwif->io_ports[IDE_IRQ_OFFSET]);
-    if (!(ch & 0x80))
-	return 0;
-    (void)inb(hwif->io_ports[IDE_STATUS_OFFSET]);
-    outb(0x7c | (ch & 0x03), hwif->io_ports[IDE_IRQ_OFFSET]);
-    return 1;
-}
-
-
-    /*
-     *  Probe for a Gayle IDE interface (and optionally for an IDE doubler)
-     */
-
-int gayle_probe_hwif(int index, ide_hwif_t *hwif)
-{
-    static int gayle_index[GAYLE_NUM_HWIFS] = { 0, };
-    int a4000, i;
-
-    if (!MACH_IS_AMIGA)
-	return 0;
-
-    if (!(a4000 = AMIGAHW_PRESENT(A4000_IDE)) && !AMIGAHW_PRESENT(A1200_IDE))
-	return 0;
-
-    if (!GAYLE_HAS_CONTROL_REG)
-	gayle_offsets[IDE_CONTROL_OFFSET] = -1;
-
-    for (i = 0; i < GAYLE_NUM_PROBE_HWIFS; i++) {
-	if (!gayle_index[i]) {
-	    switch (i) {
-		case 0:
-		    printk("ide%d: Gayle IDE interface (A%d style)\n", index,
-			   a4000 ? 4000 : 1200);
-		    break;
-#ifdef CONFIG_BLK_DEV_IDEDOUBLER
-		case 1:
-		    printk("ide%d: IDE doubler\n", index);
-		    break;
-#endif /* CONFIG_BLK_DEV_IDEDOUBLER */
-	    }
-	    gayle_index[i] = index+1;
-	}
-	if (gayle_index[i] == index+1) {
-	    ide_ioreg_t base, irqport;
-	    ide_ack_intr_t *ack_intr;
-	    if (a4000) {
-		base = (ide_ioreg_t)ZTWO_VADDR(GAYLE_BASE_4000);
-		irqport = (ide_ioreg_t)ZTWO_VADDR(GAYLE_IRQ_4000);
-		ack_intr = gayle_ack_intr_a4000;
-	    } else {
-		base = (ide_ioreg_t)ZTWO_VADDR(GAYLE_BASE_1200);
-		irqport = (ide_ioreg_t)ZTWO_VADDR(GAYLE_IRQ_1200);
-		ack_intr = gayle_ack_intr_a1200;
-	    }
-	    base += i*GAYLE_NEXT_PORT;
-	    ide_setup_ports(hwif, base, gayle_offsets, irqport, ack_intr);
-#if 1 /* TESTING */
-	    if (i == 1) {
-		volatile u_short *addr = (u_short *)base;
-		u_short data;
-		printk("+++ Probing for IDE doubler... ");
-		*addr = 0xffff;
-		data = *addr;
-		printk("probe returned 0x%02x (PLEASE REPORT THIS!!)\n", data);
-	    }
-#endif /* TESTING */
-	    hwif->irq = IRQ_AMIGA_PORTS;
-	    return 1;
-	}
-    }
-    return 0;
-}
-
-#endif /* CONFIG_BLK_DEV_GAYLE */
-
-
-#ifdef CONFIG_BLK_DEV_FALCON_IDE
-
-/* ------------------------ Atari Falcon IDE Driver ------------------------ */
-
-#include <asm/atarihw.h>
-#include <asm/atariints.h>
-
-
-    /*
-     *  Base of the IDE interface
-     */
-
-#define ATA_HD_BASE	0xfff00000
-
-    /*
-     *  Offsets from the above base
-     */
-
-#define ATA_HD_DATA	0x00
-#define ATA_HD_ERROR	0x05		/* see err-bits */
-#define ATA_HD_NSECTOR	0x09		/* nr of sectors to read/write */
-#define ATA_HD_SECTOR	0x0d		/* starting sector */
-#define ATA_HD_LCYL	0x11		/* starting cylinder */
-#define ATA_HD_HCYL	0x15		/* high byte of starting cyl */
-#define ATA_HD_SELECT	0x19		/* 101dhhhh , d=drive, hhhh=head */
-#define ATA_HD_STATUS	0x1d		/* see status-bits */
-#define ATA_HD_CONTROL	0x39
-
-const int falconide_offsets[IDE_NR_PORTS] = {
-    ATA_HD_DATA, ATA_HD_ERROR, ATA_HD_NSECTOR, ATA_HD_SECTOR, ATA_HD_LCYL,
-    ATA_HD_HCYL, ATA_HD_SELECT, ATA_HD_STATUS, ATA_HD_CONTROL
-};
-
-
-    /*
-     *  Probe for a Falcon IDE interface
-     */
-
-int falconide_probe_hwif(int index, ide_hwif_t *hwif)
-{
-    static int falcon_index = 0;
-
-    if (!MACH_IS_ATARI || !ATARIHW_PRESENT(IDE))
-	return 0;
-
-    if (!falcon_index) {
-	printk("ide%d: Falcon IDE interface\n", index);
-	falcon_index = index+1;
-    }
-    if (falcon_index == index+1) {
-	ide_setup_ports(hwif, (ide_ioreg_t)ATA_HD_BASE, falconide_offsets, 0,
-			NULL);
-	hwif->irq = IRQ_MFP_IDE;
-	return 1;
-    }
-    return 0;
-}
-
-#endif /* CONFIG_BLK_DEV_FALCON_IDE */
-
-
-#ifdef CONFIG_BLK_DEV_BUDDHA
-
-/* ----------------- Amiga Buddha and Catweasel IDE Driver ----------------- */
-
-/*
- *  This driver was written by Geert Uytterhoeven based on the specifications
- *  in README.buddha.
- *
- *  TODO:
- *    - test it :-)
- *    - tune the timings using the speed-register
- */
-
-#include <linux/zorro.h>
-#include <asm/amigahw.h>
-#include <asm/amigaints.h>
-
-
-    /*
-     *  The Buddha has 2 IDE interfaces, the Catweasel has 3
-     */
-
-#define BUDDHA_NUM_HWIFS	2
-#define CATWEASEL_NUM_HWIFS	3
-
-
-    /*
-     *  Bases of the IDE interfaces (relative to the board address)
-     */
-
-#define BUDDHA_BASE1	0x800
-#define BUDDHA_BASE2	0xa00
-#define BUDDHA_BASE3	0xc00
-
-const u_int buddha_bases[CATWEASEL_NUM_HWIFS] = {
-    BUDDHA_BASE1, BUDDHA_BASE2, BUDDHA_BASE3
-};
-
-
-    /*
-     *  Offsets from one of the above bases
-     */
-
-#define BUDDHA_DATA	0x00
-#define BUDDHA_ERROR	0x06		/* see err-bits */
-#define BUDDHA_NSECTOR	0x0a		/* nr of sectors to read/write */
-#define BUDDHA_SECTOR	0x0e		/* starting sector */
-#define BUDDHA_LCYL	0x12		/* starting cylinder */
-#define BUDDHA_HCYL	0x16		/* high byte of starting cyl */
-#define BUDDHA_SELECT	0x1a		/* 101dhhhh , d=drive, hhhh=head */
-#define BUDDHA_STATUS	0x1e		/* see status-bits */
-#define BUDDHA_CONTROL	0x11a
-
-const u_int buddha_offsets[IDE_NR_PORTS] = {
-    BUDDHA_DATA, BUDDHA_ERROR, BUDDHA_NSECTOR, BUDDHA_SECTOR, BUDDHA_LCYL,
-    BUDDHA_HCYL, BUDDHA_SELECT, BUDDHA_STATUS, BUDDHA_CONTROL
-};
-
-
-    /*
-     *  Other registers
-     */
-
-#define BUDDHA_IRQ1	0xf00		/* MSB = 1, Harddisk is source of */
-#define BUDDHA_IRQ2	0xf40		/* interrupt */
-#define BUDDHA_IRQ3	0xf80
-
-const int buddha_irqports[CATWEASEL_NUM_HWIFS] = {
-    BUDDHA_IRQ1, BUDDHA_IRQ2, BUDDHA_IRQ3
-};
-
-#define BUDDHA_IRQ_MR	0xfc0		/* master interrupt enable */
-
-
-    /*
-     *  Board information
-     */
-
-static u_long buddha_board = 0;
-static int buddha_num_hwifs = -1;
-
-
-    /*
-     *  Check and acknowledge the interrupt status
-     */
-
-static int buddha_ack_intr(ide_hwif_t *hwif)
-{
-    unsigned char ch;
-
-    ch = inb(hwif->io_ports[IDE_IRQ_OFFSET]);
-    if (!(ch & 0x80))
-	return 0;
-    return 1;
-}
-
-
-    /*
-     *  Any Buddha or Catweasel boards present?
-     */
-
-int find_buddha(void)
-{
-    u_int key;
-    const struct ConfigDev *cd;
-
-    buddha_num_hwifs = 0;
-    if ((key = zorro_find(ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA, 0, 0)))
-	buddha_num_hwifs = BUDDHA_NUM_HWIFS;
-    else if ((key = zorro_find(ZORRO_PROD_INDIVIDUAL_COMPUTERS_CATWEASEL, 0,
-			       0)))
-	buddha_num_hwifs = CATWEASEL_NUM_HWIFS;
-    if (key) {
-	cd = zorro_get_board(key);
-	buddha_board = (u_long)cd->cd_BoardAddr;
-	if (buddha_board) {
-	    buddha_board = ZTWO_VADDR(buddha_board);
-	    /* write to BUDDHA_IRQ_MR to enable the board IRQ */
-	    *(char *)(buddha_board+BUDDHA_IRQ_MR) = 0;
-	    zorro_config_board(key, 0);
-	}
-    }
-    return buddha_num_hwifs;
-}
-
-
-    /*
-     *  Probe for a Buddha or Catweasel IDE interface
-     *  We support only _one_ of them, no multiple boards!
-     */
-
-int buddha_probe_hwif(int index, ide_hwif_t *hwif)
-{
-    static int buddha_index[CATWEASEL_NUM_HWIFS] = { 0, };
-    int i;
-
-    if (buddha_num_hwifs < 0 && !find_buddha())
-	return 0;
-
-    for (i = 0; i < buddha_num_hwifs; i++) {
-	if (!buddha_index[i]) {
-	    printk("ide%d: %s IDE interface\n", index,
-		   buddha_num_hwifs == BUDDHA_NUM_HWIFS ? "Buddha" :
-		   					  "Catweasel");
-	    buddha_index[i] = index+1;
-	}
-	if (buddha_index[i] == index+1) {
-	    ide_setup_ports(hwif, (ide_ioreg_t)(buddha_board+buddha_bases[i]),
-	    		    buddha_offsets,
-			    (ide_ioreg_t)(buddha_board+buddha_irqports[i]),
-			    buddha_ack_intr);
-	    hwif->irq = IRQ_AMIGA_PORTS;
-	    return 1;
-	}
-    }
-    return 0;
-}
-
-#endif /* CONFIG_BLK_DEV_BUDDHA */
-
-/* ------------------------- End of Low Level Stuff ------------------------ */
-
-
-static const byte	ide_hwif_to_major[] = {IDE0_MAJOR, IDE1_MAJOR, IDE2_MAJOR, IDE3_MAJOR};
+static const byte	ide_hwif_to_major[] = {IDE0_MAJOR, IDE1_MAJOR, IDE2_MAJOR, IDE3_MAJOR, IDE4_MAJOR, IDE5_MAJOR };
 
 static int	idebus_parameter; /* holds the "idebus=" parameter */
 static int	system_bus_speed; /* holds what we think is VESA/PCI bus speed */
@@ -649,6 +195,12 @@
  */
 static int probe_hwif(int index, ide_hwif_t *hwif)
 {
+    extern int pcide_probe_hwif(int index, ide_hwif_t *hwif);
+    extern int gayle_probe_hwif(int index, ide_hwif_t *hwif);
+    extern int falconide_probe_hwif(int index, ide_hwif_t *hwif);
+    extern int macide_probe_hwif(int index, ide_hwif_t *hwif);
+    extern int buddha_probe_hwif(int index, ide_hwif_t *hwif);
+
     return 0
 #ifdef CONFIG_BLK_DEV_PCIDE
 	|| pcide_probe_hwif(index, hwif)
@@ -659,6 +211,9 @@
 #ifdef CONFIG_BLK_DEV_FALCON_IDE
 	|| falconide_probe_hwif(index, hwif)
 #endif
+#ifdef CONFIG_BLK_DEV_MAC_IDE
+	|| macide_probe_hwif(index, hwif)
+#endif
 #ifdef CONFIG_BLK_DEV_BUDDHA
 	|| buddha_probe_hwif(index, hwif)
 #endif
@@ -1666,6 +1221,20 @@
 }
 #endif /* MAX_HWIFS > 3 */
 
+#if MAX_HWIFS > 4
+void do_ide4_request (void)	/* invoked with cli() */
+{
+	do_hwgroup_request (ide_hwifs[4].hwgroup);
+}
+#endif /* MAX_HWIFS > 4 */
+
+#if MAX_HWIFS > 5
+void do_ide5_request (void)	/* invoked with cli() */
+{
+	do_hwgroup_request (ide_hwifs[5].hwgroup);
+}
+#endif /* MAX_HWIFS > 5 */
+
 void ide_timer_expiry (unsigned long data)
 {
 	ide_hwgroup_t *hwgroup = (ide_hwgroup_t *) data;
@@ -3185,10 +2754,12 @@
 	return NULL;
 }
 
+#ifdef CONFIG_PROC_FS
 static ide_proc_entry_t generic_subdriver_entries[] = {
 	{ "capacity", proc_ide_read_capacity, NULL },
 	{ NULL, NULL, NULL }
 };
+#endif
 
 int ide_register_subdriver (ide_drive_t *drive, ide_driver_t *driver, int version)
 {
@@ -3211,8 +2782,10 @@
 		drive->nice1 = 1;
 	}
 	drive->revalidate = 1;
+#ifdef CONFIG_PROC_FS
 	ide_add_proc_entries(drive, generic_subdriver_entries);
 	ide_add_proc_entries(drive, driver->proc);
+#endif
 	return 0;
 }
 
@@ -3226,8 +2799,10 @@
 		__restore_flags(flags);
 		return 1;
 	}
+#ifdef CONFIG_PROC_FS
 	ide_remove_proc_entries(drive, DRIVER(drive)->proc);
 	ide_remove_proc_entries(drive, generic_subdriver_entries);
+#endif
 	auto_remove_settings(drive);
 	drive->driver = NULL;
 	__restore_flags(flags);
@@ -3297,6 +2872,12 @@
 #if MAX_HWIFS > 3
 EXPORT_SYMBOL(do_ide3_request);
 #endif /* MAX_HWIFS > 3 */
+#if MAX_HWIFS > 4
+EXPORT_SYMBOL(do_ide4_request);
+#endif /* MAX_HWIFS > 4 */
+#if MAX_HWIFS > 5
+EXPORT_SYMBOL(do_ide5_request);
+#endif /* MAX_HWIFS > 5 */
 
 /*
  * Driver module
@@ -3323,8 +2904,11 @@
 EXPORT_SYMBOL(ide_wait_cmd);
 EXPORT_SYMBOL(ide_stall_queue);
 EXPORT_SYMBOL(ide_xlate_1024);
+#ifdef CONFIG_PROC_FS
 EXPORT_SYMBOL(ide_add_proc_entries);
 EXPORT_SYMBOL(ide_remove_proc_entries);
+EXPORT_SYMBOL(proc_ide_read_geometry);
+#endif
 EXPORT_SYMBOL(ide_add_setting);
 EXPORT_SYMBOL(ide_remove_setting);
 EXPORT_SYMBOL(proc_ide_read_geometry);
--- m68k-2.1.90-current/drivers/block/ide.h	Tue Mar 24 18:54:48 1998
+++ m68k/drivers/block/ide.h	Thu Apr  2 01:01:28 1998
@@ -417,6 +418,7 @@
 	write_proc_t *write_proc;
 } ide_proc_entry_t;
 
+#ifdef CONFIG_PROC_FS
 void proc_ide_init(void);
 void ide_add_proc_entries(ide_drive_t *drive, ide_proc_entry_t *p);
 void ide_remove_proc_entries(ide_drive_t *drive, ide_proc_entry_t *p);
@@ -438,6 +440,7 @@
 	*start = page + off;		\
 	return len;			\
 }
+#endif
 
 /*
  * Subdrivers support.
@@ -679,6 +682,12 @@
 #endif
 #if MAX_HWIFS > 3
 void do_ide3_request (void);
+#endif
+#if MAX_HWIFS > 4
+void do_ide4_request (void);
+#endif
+#if MAX_HWIFS > 5
+void do_ide5_request (void);
 #endif
 void ide_init_subdrivers (void);
 
--- m68k-2.1.90-current/drivers/block/ll_rw_blk.c	Tue Mar 24 18:54:48 1998
+++ m68k/drivers/block/ll_rw_blk.c	Thu Apr  2 01:01:28 1998
@@ -428,6 +428,8 @@
 	     case FLOPPY_MAJOR:
 	     case IDE2_MAJOR:
 	     case IDE3_MAJOR:
+	     case IDE4_MAJOR:
+	     case IDE5_MAJOR:
 	     case ACSI_MAJOR:
 		/*
 		 * The scsi disk and cdrom drivers completely remove the request
@@ -751,6 +753,9 @@
 #endif
 #ifdef CONFIG_ATARI_FLOPPY
 	atari_floppy_init();
+#endif
+#ifdef CONFIG_MAC_FLOPPY_IWM
+	mac_floppy_init();
 #endif
 #ifdef CONFIG_BLK_DEV_FD
 	floppy_init();
--- m68k-2.1.90-current/drivers/block/md.c	Thu Mar 19 21:29:20 1998
+++ m68k/drivers/block/md.c	Thu Apr  2 01:01:28 1998
@@ -851,11 +851,13 @@
 EXPORT_SYMBOL(md_wakeup_thread);
 EXPORT_SYMBOL(md_do_sync);
 
+#ifdef CONFIG_PROC_FS
 static struct proc_dir_entry proc_md = {
 	PROC_MD, 6, "mdstat",
 	S_IFREG | S_IRUGO, 1, 0, 0,
 	0, &proc_array_inode_operations,
 };
+#endif
 
 static void md_geninit (struct gendisk *gdisk)
 {
@@ -873,7 +875,9 @@
   blksize_size[MD_MAJOR] = md_blocksizes;
   max_readahead[MD_MAJOR] = md_maxreadahead;
 
+#ifdef CONFIG_PROC_FS
   proc_register(&proc_root, &proc_md);
+#endif
 }
 
 int md_error (kdev_t mddev, kdev_t rdev)
--- m68k-2.1.90-current/include/asm-i386/ide.h	Tue Mar 24 18:54:52 1998
+++ m68k/include/asm-i386/ide.h	Thu Apr  2 01:01:28 1998
@@ -16,7 +16,7 @@
 typedef unsigned short ide_ioreg_t;
 
 #ifndef MAX_HWIFS
-#define MAX_HWIFS	4
+#define MAX_HWIFS	6
 #endif
 
 #define ide_sti()	sti()
@@ -28,6 +28,8 @@
 		case 0x170: return 15;
 		case 0x1e8: return 11;
 		case 0x168: return 10;
+		case 0x1e0: return 8;
+		case 0x160: return 12;
 		default:
 			return 0;
 	}
--- m68k-2.1.90-current/include/asm-m68k/ide.h	Wed Mar 25 21:21:41 1998
+++ m68k/include/asm-m68k/ide.h	Wed Apr  1 21:30:55 1998
@@ -41,6 +41,10 @@
 #include <asm/atari_stdma.h>
 #endif
 
+#ifdef CONFIG_MAC
+#include <asm/macints.h>
+#endif
+
 typedef unsigned char * ide_ioreg_t;
 
 #ifndef MAX_HWIFS
@@ -71,6 +75,10 @@
 	} b;
 	} select_t;
 
+#ifdef CONFIG_MAC	/* MSch: Hack; wrapper for ide_intr */
+void mac_ide_intr(int irq, void *dev_id, struct pt_regs *regs);
+#endif
+
 static __inline__ int ide_request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *),
 			unsigned long flags, const char *device, void *dev_id)
 {
@@ -78,6 +86,14 @@
 	if (MACH_IS_AMIGA)
 		return request_irq(irq, handler, 0, device, dev_id);
 #endif /* CONFIG_AMIGA */
+#ifdef CONFIG_MAC
+	if (MACH_IS_MAC)
+#if 0	/* MSch Hack: maybe later we'll call ide_intr without a wrapper */
+	return nubus_request_irq(12, dev_id, handler);
+#else
+	return nubus_request_irq(12, dev_id, mac_ide_intr);
+#endif
+#endif /* CONFIG_MAC */
 	return 0;
 }
 
@@ -87,6 +103,10 @@
 	if (MACH_IS_AMIGA)
 		free_irq(irq, dev_id);
 #endif /* CONFIG_AMIGA */
+#ifdef CONFIG_MAC
+	if (MACH_IS_MAC)
+		nubus_free_irq(12);
+#endif /* CONFIG_MAC */
 }
 
 /*
@@ -304,11 +324,11 @@
 #define D_INT(cnt)      (T_INT   | (cnt))
 #define D_TEXT(cnt)     (T_TEXT  | (cnt))
 
-#ifdef CONFIG_AMIGA
+#if defined(CONFIG_AMIGA) || defined (CONFIG_MAC)
 static u_short driveid_types[] = {
 	D_SHORT(10),	/* config - vendor2 */
 	D_TEXT(20),	/* serial_no */
-	D_SHORT(3),	/* buf_type - ecc_bytes */
+	D_SHORT(3),	/* buf_type, buf_size - ecc_bytes */
 	D_TEXT(48),	/* fw_rev - model */
 	D_CHAR(2),	/* max_multsect - vendor3 */
 	D_SHORT(1),	/* dword_io */
@@ -327,12 +347,12 @@
 
 static __inline__ void ide_fix_driveid(struct hd_driveid *id)
 {
-#ifdef CONFIG_AMIGA
+#if defined(CONFIG_AMIGA) || defined (CONFIG_MAC)
    u_char *p = (u_char *)id;
    int i, j, cnt;
    u_char t;
 
-   if (!MACH_IS_AMIGA)
+   if (!MACH_IS_AMIGA && !MACH_IS_MAC)
    	return;
    for (i = 0; i < num_driveid_types; i++) {
       cnt = driveid_types[i] & T_MASK_COUNT;
@@ -417,7 +437,7 @@
  * an interrupt, and in that case it does nothing. Hope that is reasonable and
  * works. (Roman)
  */
-#if defined(CONFIG_ATARI) && !defined(CONFIG_AMIGA)
+#if defined(CONFIG_ATARI) && !defined(CONFIG_AMIGA) && !defined(CONFIG_MAC)
 #define	ide_sti()					\
     do {						\
 	if (!in_interrupt()) sti();			\
--- m68k-2.1.90-current/include/asm-m68k/macintosh.h	Tue Feb 17 22:08:36 1998
+++ m68k/include/asm-m68k/macintosh.h	Wed Apr  1 20:55:30 1998
@@ -56,6 +56,8 @@
 #define MAC_ADB_II		1
 #define MAC_ADB_IISI		2
 #define MAC_ADB_CUDA		3
+#define MAC_ADB_PB1		4
+#define MAC_ADB_PB2		5
 
 #define MAC_VIA_II		1
 #define MAC_VIA_IIci		2
@@ -74,6 +76,7 @@
 #define MAC_SCC_II		1
 #define MAC_SCC_QUADRA		2
 #define MAC_SCC_QUADRA2		3
+#define MAC_SCC_IOP		4
 
 #define MAC_ETHER_NONE		0	
 #define MAC_ETHER_SONIC		1
@@ -92,8 +95,9 @@
 #define MAC_MODEL_IICI		11
 #define MAC_MODEL_IIFX		13	/* And well numbered it is too */
 #define MAC_MODEL_IISI		18
+#define MAC_MODEL_LC		19
 #define MAC_MODEL_Q900		20
-#define MAC_MODEL_PB170		25
+#define MAC_MODEL_PB170		21
 #define MAC_MODEL_Q700		22
 #define MAC_MODEL_CLII		23
 #define MAC_MODEL_PB140		25
@@ -109,6 +113,7 @@
 #define MAC_MODEL_LCII		37	/* aka: P400/405/410/430 */
 #define MAC_MODEL_PB250		38
 #define MAC_MODEL_IIVI		44
+#define MAC_MODEL_P600		45
 #define MAC_MODEL_IIVX		48
 #define MAC_MODEL_CCL		49
 #define MAC_MODEL_PB165C	50
@@ -123,13 +128,16 @@
 #define MAC_MODEL_PB270C	77
 #define MAC_MODEL_Q840		78
 #define MAC_MODEL_P550		80
+#define MAC_MODEL_CCLII		83
 #define MAC_MODEL_PB165		84
 #define MAC_MODEL_PB190 	85
 #define MAC_MODEL_TV		88
 #define MAC_MODEL_P475		89	/* aka: LC475, P476 */
+#define MAC_MODEL_P475F		90	/* aka: P475 w/ FPU (no LC040) */
 #define MAC_MODEL_P575		92	/* aka: LC575/580, P577/578/508 */
 #define MAC_MODEL_Q605		94
 #define MAC_MODEL_Q630		98	/* aka: LC630, P630/631/636/640 */
+#define MAC_MODEL_P588		99	/* aka: ?? */
 #define MAC_MODEL_PB280		102
 #define MAC_MODEL_PB280C	103
 #define MAC_MODEL_PB150		115
--- m68k-2.1.90-current/include/asm-m68k/macints.h	Tue Feb 17 22:08:36 1998
+++ m68k/include/asm-m68k/macints.h	Fri Feb 13 10:21:45 1998
@@ -143,7 +143,7 @@
 void mac_turnoff_irq( unsigned irq );
 void mac_clear_pending_irq( unsigned irq );
 int  mac_irq_pending( unsigned irq );
-int  nubus_request_irq(int slot, void (*handler)(int,void *,struct pt_regs *));
+int  nubus_request_irq(int slot, void *dev_id, void (*handler)(int,void *,struct pt_regs *));
 int  nubus_free_irq(int slot);
 
 unsigned long mac_register_nubus_int( void );
--- m68k-2.1.90-current/include/linux/fb.h	Sun Mar 29 23:59:54 1998
+++ m68k/include/linux/fb.h	Wed Apr  1 20:49:27 1998
@@ -63,7 +63,8 @@
 	unsigned char *mmio_start;	/* Start of Memory Mapped I/O   */
 	__u32 mmio_len;			/* Length of Memory Mapped I/O  */
 	__u32 accel;			/* Type of acceleration available */
-	__u16 reserved[3];		/* Reserved for future compatibility */
+	__u16 smem_offset;		/* Offset to frame buffer vram (Mac) */
+	__u16 reserved[2];		/* Reserved for future compatibility */
 };
 
 /* Interpretation of offset for color fields: All offsets are from the right,
@@ -132,7 +133,7 @@
 	__u32 height;			/* height of picture in mm    */
 	__u32 width;			/* width of picture in mm     */
 
-	__u32 accel_flags;		/* acceleration flags (hints)	*/
+	__u32 accel_flags;		/* acceleration flags	*/
 
 	/* Timing: All values in pixclocks, except pixclock (of course) */
 	__u32 pixclock;			/* pixel clock in ps (pico seconds) */
--- m68k-2.1.90-current/include/linux/major.h	Wed Dec  3 21:14:35 1997
+++ m68k/include/linux/major.h	Thu Apr  2 01:01:28 1998
@@ -73,6 +73,9 @@
 #define MKISS_MAJOR	55
 #define DSP56K_MAJOR    55   /* DSP56001 processor device */
 
+#define IDE4_MAJOR	56
+#define IDE5_MAJOR	57
+
 #define SPECIALIX_NORMAL_MAJOR 75
 #define SPECIALIX_CALLOUT_MAJOR 76
 
--- m68k-2.1.90-current/kernel/sysctl.c	Thu Mar 19 21:29:32 1998
+++ m68k/kernel/sysctl.c	Thu Apr  2 01:01:28 1998
@@ -33,7 +33,7 @@
 #include <linux/nfs_fs.h>
 #endif
 
-#ifdef CONFIG_SYSCTL
+#if defined(CONFIG_SYSCTL) && defined(CONFIG_PROC_FS)
 
 /* External variables not in a header file. */
 extern int panic_timeout;
@@ -1029,7 +1029,7 @@
 }
 
 
-#else /* CONFIG_SYSCTL */
+#else /* CONFIG_PROC_FS && CONFIG_SYSCTL */
 
 
 extern asmlinkage int sys_sysctl(struct __sysctl_args *args)
@@ -1085,7 +1085,7 @@
 {
 }
 
-#endif /* CONFIG_SYSCTL */
+#endif /* CONFIG_PROC_FS && CONFIG_SYSCTL */
 
 
 
--- /dev/null	Sat Jun 17 03:20:38 1995
+++ m68k/drivers/block/buddha.c	Wed Apr  1 22:01:58 1998
@@ -0,0 +1,168 @@
+/*
+ *  linux/drivers/block/buddha.c -- Amiga Buddha and Catweasel IDE Driver
+ *
+ *	Copyright (C) 1997 by Geert Uytterhoeven
+ *
+ *  This driver was written by based on the specifications in README.buddha.
+ *
+ *  This file is subject to the terms and conditions of the GNU General Public
+ *  License.  See the file COPYING in the main directory of this archive for
+ *  more details.
+ *
+ *  TODO:
+ *    - test it :-)
+ *    - tune the timings using the speed-register
+ */
+
+#include <linux/types.h>
+#include <linux/mm.h>
+#include <linux/interrupt.h>
+#include <linux/blkdev.h>
+#include <linux/hdreg.h>
+#include <linux/zorro.h>
+
+#include "ide.h"
+
+#include <asm/amigahw.h>
+#include <asm/amigaints.h>
+
+
+    /*
+     *  The Buddha has 2 IDE interfaces, the Catweasel has 3
+     */
+
+#define BUDDHA_NUM_HWIFS	2
+#define CATWEASEL_NUM_HWIFS	3
+
+
+    /*
+     *  Bases of the IDE interfaces (relative to the board address)
+     */
+
+#define BUDDHA_BASE1	0x800
+#define BUDDHA_BASE2	0xa00
+#define BUDDHA_BASE3	0xc00
+
+static const u_int buddha_bases[CATWEASEL_NUM_HWIFS] = {
+    BUDDHA_BASE1, BUDDHA_BASE2, BUDDHA_BASE3
+};
+
+
+    /*
+     *  Offsets from one of the above bases
+     */
+
+#define BUDDHA_DATA	0x00
+#define BUDDHA_ERROR	0x06		/* see err-bits */
+#define BUDDHA_NSECTOR	0x0a		/* nr of sectors to read/write */
+#define BUDDHA_SECTOR	0x0e		/* starting sector */
+#define BUDDHA_LCYL	0x12		/* starting cylinder */
+#define BUDDHA_HCYL	0x16		/* high byte of starting cyl */
+#define BUDDHA_SELECT	0x1a		/* 101dhhhh , d=drive, hhhh=head */
+#define BUDDHA_STATUS	0x1e		/* see status-bits */
+#define BUDDHA_CONTROL	0x11a
+
+static const u_int buddha_offsets[IDE_NR_PORTS] = {
+    BUDDHA_DATA, BUDDHA_ERROR, BUDDHA_NSECTOR, BUDDHA_SECTOR, BUDDHA_LCYL,
+    BUDDHA_HCYL, BUDDHA_SELECT, BUDDHA_STATUS, BUDDHA_CONTROL
+};
+
+
+    /*
+     *  Other registers
+     */
+
+#define BUDDHA_IRQ1	0xf00		/* MSB = 1, Harddisk is source of */
+#define BUDDHA_IRQ2	0xf40		/* interrupt */
+#define BUDDHA_IRQ3	0xf80
+
+static const int buddha_irqports[CATWEASEL_NUM_HWIFS] = {
+    BUDDHA_IRQ1, BUDDHA_IRQ2, BUDDHA_IRQ3
+};
+
+#define BUDDHA_IRQ_MR	0xfc0		/* master interrupt enable */
+
+
+    /*
+     *  Board information
+     */
+
+static u_long buddha_board = 0;
+static int buddha_num_hwifs = -1;
+
+
+    /*
+     *  Check and acknowledge the interrupt status
+     */
+
+static int buddha_ack_intr(ide_hwif_t *hwif)
+{
+    unsigned char ch;
+
+    ch = inb(hwif->io_ports[IDE_IRQ_OFFSET]);
+    if (!(ch & 0x80))
+	return 0;
+    return 1;
+}
+
+
+    /*
+     *  Any Buddha or Catweasel boards present?
+     */
+
+static int find_buddha(void)
+{
+    u_int key;
+    const struct ConfigDev *cd;
+
+    buddha_num_hwifs = 0;
+    if ((key = zorro_find(ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA, 0, 0)))
+	buddha_num_hwifs = BUDDHA_NUM_HWIFS;
+    else if ((key = zorro_find(ZORRO_PROD_INDIVIDUAL_COMPUTERS_CATWEASEL, 0,
+			       0)))
+	buddha_num_hwifs = CATWEASEL_NUM_HWIFS;
+    if (key) {
+	cd = zorro_get_board(key);
+	buddha_board = (u_long)cd->cd_BoardAddr;
+	if (buddha_board) {
+	    buddha_board = ZTWO_VADDR(buddha_board);
+	    /* write to BUDDHA_IRQ_MR to enable the board IRQ */
+	    *(char *)(buddha_board+BUDDHA_IRQ_MR) = 0;
+	    zorro_config_board(key, 0);
+	}
+    }
+    return buddha_num_hwifs;
+}
+
+
+    /*
+     *  Probe for a Buddha or Catweasel IDE interface
+     *  We support only _one_ of them, no multiple boards!
+     */
+
+int buddha_probe_hwif(int index, ide_hwif_t *hwif)
+{
+    static int buddha_index[CATWEASEL_NUM_HWIFS] = { 0, };
+    int i;
+
+    if (buddha_num_hwifs < 0 && !find_buddha())
+	return 0;
+
+    for (i = 0; i < buddha_num_hwifs; i++) {
+	if (!buddha_index[i]) {
+	    printk("ide%d: %s IDE interface\n", index,
+		   buddha_num_hwifs == BUDDHA_NUM_HWIFS ? "Buddha" :
+		   					  "Catweasel");
+	    buddha_index[i] = index+1;
+	}
+	if (buddha_index[i] == index+1) {
+	    ide_setup_ports(hwif, (ide_ioreg_t)(buddha_board+buddha_bases[i]),
+	    		    buddha_offsets,
+			    (ide_ioreg_t)(buddha_board+buddha_irqports[i]),
+			    buddha_ack_intr);
+	    hwif->irq = IRQ_AMIGA_PORTS;
+	    return 1;
+	}
+    }
+    return 0;
+}
--- /dev/null	Sat Jun 17 03:20:38 1995
+++ m68k/drivers/block/falconide.c	Wed Apr  1 22:01:36 1998
@@ -0,0 +1,72 @@
+/*
+ *  linux/drivers/block/falconide.c -- Atari Falcon IDE Driver
+ *
+ *     Created 12 Jul 1997 by Geert Uytterhoeven
+ *
+ *  This file is subject to the terms and conditions of the GNU General Public
+ *  License.  See the file COPYING in the main directory of this archive for
+ *  more details.
+ */
+
+#include <linux/types.h>
+#include <linux/mm.h>
+#include <linux/interrupt.h>
+#include <linux/blkdev.h>
+#include <linux/hdreg.h>
+
+#include "ide.h"
+
+#include <asm/atarihw.h>
+#include <asm/atariints.h>
+#include <asm/atari_stdma.h>
+
+
+    /*
+     *  Base of the IDE interface
+     */
+
+#define ATA_HD_BASE	0xfff00000
+
+    /*
+     *  Offsets from the above base
+     */
+
+#define ATA_HD_DATA	0x00
+#define ATA_HD_ERROR	0x05		/* see err-bits */
+#define ATA_HD_NSECTOR	0x09		/* nr of sectors to read/write */
+#define ATA_HD_SECTOR	0x0d		/* starting sector */
+#define ATA_HD_LCYL	0x11		/* starting cylinder */
+#define ATA_HD_HCYL	0x15		/* high byte of starting cyl */
+#define ATA_HD_SELECT	0x19		/* 101dhhhh , d=drive, hhhh=head */
+#define ATA_HD_STATUS	0x1d		/* see status-bits */
+#define ATA_HD_CONTROL	0x39
+
+static const int falconide_offsets[IDE_NR_PORTS] = {
+    ATA_HD_DATA, ATA_HD_ERROR, ATA_HD_NSECTOR, ATA_HD_SECTOR, ATA_HD_LCYL,
+    ATA_HD_HCYL, ATA_HD_SELECT, ATA_HD_STATUS, ATA_HD_CONTROL
+};
+
+
+    /*
+     *  Probe for a Falcon IDE interface
+     */
+
+int falconide_probe_hwif(int index, ide_hwif_t *hwif)
+{
+    static int falcon_index = 0;
+
+    if (!MACH_IS_ATARI || !ATARIHW_PRESENT(IDE))
+	return 0;
+
+    if (!falcon_index) {
+	printk("ide%d: Falcon IDE interface\n", index);
+	falcon_index = index+1;
+    }
+    if (falcon_index == index+1) {
+	ide_setup_ports(hwif, (ide_ioreg_t)ATA_HD_BASE, falconide_offsets, 0,
+			NULL);
+	hwif->irq = IRQ_MFP_IDE;
+	return 1;
+    }
+    return 0;
+}
--- /dev/null	Sat Jun 17 03:20:38 1995
+++ m68k/drivers/block/gayle.c	Wed Apr  1 22:01:00 1998
@@ -0,0 +1,168 @@
+/*
+ *  linux/drivers/block/gayle.c -- Amiga Gayle IDE Driver
+ *
+ *     Created 9 Jul 1997 by Geert Uytterhoeven
+ *
+ *  This file is subject to the terms and conditions of the GNU General Public
+ *  License.  See the file COPYING in the main directory of this archive for
+ *  more details.
+ */
+
+#include <linux/config.h>
+#include <linux/types.h>
+#include <linux/mm.h>
+#include <linux/interrupt.h>
+#include <linux/blkdev.h>
+#include <linux/hdreg.h>
+
+#include "ide.h"
+
+#include <asm/amigahw.h>
+#include <asm/amigaints.h>
+
+
+    /*
+     *  Bases of the IDE interfaces
+     */
+
+#define GAYLE_BASE_4000	0xdd2020	/* A4000/A4000T */
+#define GAYLE_BASE_1200	0xda0000	/* A1200/A600 */
+
+    /*
+     *  Offsets from one of the above bases
+     */
+
+#define GAYLE_DATA	0x00
+#define GAYLE_ERROR	0x06		/* see err-bits */
+#define GAYLE_NSECTOR	0x0a		/* nr of sectors to read/write */
+#define GAYLE_SECTOR	0x0e		/* starting sector */
+#define GAYLE_LCYL	0x12		/* starting cylinder */
+#define GAYLE_HCYL	0x16		/* high byte of starting cyl */
+#define GAYLE_SELECT	0x1a		/* 101dhhhh , d=drive, hhhh=head */
+#define GAYLE_STATUS	0x1e		/* see status-bits */
+#define GAYLE_CONTROL	0x101a
+
+static u_int gayle_offsets[IDE_NR_PORTS] = {
+    GAYLE_DATA, GAYLE_ERROR, GAYLE_NSECTOR, GAYLE_SECTOR, GAYLE_LCYL,
+    GAYLE_HCYL, GAYLE_SELECT, GAYLE_STATUS, GAYLE_CONTROL
+};
+
+
+    /*
+     *  These are at different offsets from the base
+     */
+
+#define GAYLE_IRQ_4000	0xdd3020	/* MSB = 1, Harddisk is source of */
+#define GAYLE_IRQ_1200	0xda9000	/* interrupt */
+
+
+    /*
+     *  Offset of the secondary port for IDE doublers
+     *  Note that GAYLE_CONTROL is NOT available then!
+     */
+
+#define GAYLE_NEXT_PORT	0x1000
+
+#ifndef CONFIG_BLK_DEV_IDEDOUBLER
+#define GAYLE_NUM_HWIFS		1
+#define GAYLE_NUM_PROBE_HWIFS	GAYLE_NUM_HWIFS
+#define GAYLE_HAS_CONTROL_REG	1
+#else /* CONFIG_BLK_DEV_IDEDOUBLER */
+#define GAYLE_NUM_HWIFS		2
+#define GAYLE_NUM_PROBE_HWIFS	(ide_doubler ? GAYLE_NUM_HWIFS : \
+					       GAYLE_NUM_HWIFS-1)
+#define GAYLE_HAS_CONTROL_REG	(!ide_doubler)
+int ide_doubler = 0;	/* support IDE doublers? */
+#endif /* CONFIG_BLK_DEV_IDEDOUBLER */
+
+
+    /*
+     *  Check and acknowledge the interrupt status
+     */
+
+static int gayle_ack_intr_a4000(ide_hwif_t *hwif)
+{
+    unsigned char ch;
+
+    ch = inb(hwif->io_ports[IDE_IRQ_OFFSET]);
+    if (!(ch & 0x80))
+	return 0;
+    return 1;
+}
+
+static int gayle_ack_intr_a1200(ide_hwif_t *hwif)
+{
+    unsigned char ch;
+
+    ch = inb(hwif->io_ports[IDE_IRQ_OFFSET]);
+    if (!(ch & 0x80))
+	return 0;
+    (void)inb(hwif->io_ports[IDE_STATUS_OFFSET]);
+    outb(0x7c | (ch & 0x03), hwif->io_ports[IDE_IRQ_OFFSET]);
+    return 1;
+}
+
+
+    /*
+     *  Probe for a Gayle IDE interface (and optionally for an IDE doubler)
+     */
+
+int gayle_probe_hwif(int index, ide_hwif_t *hwif)
+{
+    static int gayle_index[GAYLE_NUM_HWIFS] = { 0, };
+    int a4000, i;
+
+    if (!MACH_IS_AMIGA)
+	return 0;
+
+    if (!(a4000 = AMIGAHW_PRESENT(A4000_IDE)) && !AMIGAHW_PRESENT(A1200_IDE))
+	return 0;
+
+    if (!GAYLE_HAS_CONTROL_REG)
+	gayle_offsets[IDE_CONTROL_OFFSET] = -1;
+
+    for (i = 0; i < GAYLE_NUM_PROBE_HWIFS; i++) {
+	if (!gayle_index[i]) {
+	    switch (i) {
+		case 0:
+		    printk("ide%d: Gayle IDE interface (A%d style)\n", index,
+			   a4000 ? 4000 : 1200);
+		    break;
+#ifdef CONFIG_BLK_DEV_IDEDOUBLER
+		case 1:
+		    printk("ide%d: IDE doubler\n", index);
+		    break;
+#endif /* CONFIG_BLK_DEV_IDEDOUBLER */
+	    }
+	    gayle_index[i] = index+1;
+	}
+	if (gayle_index[i] == index+1) {
+	    ide_ioreg_t base, irqport;
+	    ide_ack_intr_t *ack_intr;
+	    if (a4000) {
+		base = (ide_ioreg_t)ZTWO_VADDR(GAYLE_BASE_4000);
+		irqport = (ide_ioreg_t)ZTWO_VADDR(GAYLE_IRQ_4000);
+		ack_intr = gayle_ack_intr_a4000;
+	    } else {
+		base = (ide_ioreg_t)ZTWO_VADDR(GAYLE_BASE_1200);
+		irqport = (ide_ioreg_t)ZTWO_VADDR(GAYLE_IRQ_1200);
+		ack_intr = gayle_ack_intr_a1200;
+	    }
+	    base += i*GAYLE_NEXT_PORT;
+	    ide_setup_ports(hwif, base, gayle_offsets, irqport, ack_intr);
+#if 1 /* TESTING */
+	    if (i == 1) {
+		volatile u_short *addr = (u_short *)base;
+		u_short data;
+		printk("+++ Probing for IDE doubler... ");
+		*addr = 0xffff;
+		data = *addr;
+		printk("probe returned 0x%02x (PLEASE REPORT THIS!!)\n", data);
+	    }
+#endif /* TESTING */
+	    hwif->irq = IRQ_AMIGA_PORTS;
+	    return 1;
+	}
+    }
+    return 0;
+}
--- /dev/null	Sat Jun 17 03:20:38 1995
+++ m68k/drivers/block/macide.c	Wed Apr  1 22:02:43 1998
@@ -0,0 +1,156 @@
+/*
+ *  linux/drivers/block/macide.c -- Macintosh IDE Driver
+ *
+ *     Copyright (C) 1998 by Michael Schmitz
+ *
+ *  This driver was written based on information obtained from the MacOS IDE
+ *  driver binary by Mikael Forselius
+ *
+ *  This file is subject to the terms and conditions of the GNU General Public
+ *  License.  See the file COPYING in the main directory of this archive for
+ *  more details.
+ */
+
+#include <linux/types.h>
+#include <linux/mm.h>
+#include <linux/interrupt.h>
+#include <linux/blkdev.h>
+#include <linux/hdreg.h>
+#include <linux/zorro.h>
+
+#include "ide.h"
+
+#include <asm/machw.h>
+#include <asm/macintosh.h>
+#include <asm/macints.h>
+
+    /*
+     *  Base of the IDE interface (see ATAManager ROM code)
+     */
+
+#define MAC_HD_BASE	0x50f1a000
+
+    /*
+     *  Offsets from the above base (scaling 4)
+     */
+
+#define MAC_HD_DATA	0x00
+#define MAC_HD_ERROR	0x04		/* see err-bits */
+#define MAC_HD_NSECTOR	0x08		/* nr of sectors to read/write */
+#define MAC_HD_SECTOR	0x0c		/* starting sector */
+#define MAC_HD_LCYL	0x10		/* starting cylinder */
+#define MAC_HD_HCYL	0x14		/* high byte of starting cyl */
+#define MAC_HD_SELECT	0x18		/* 101dhhhh , d=drive, hhhh=head */
+#define MAC_HD_STATUS	0x1c		/* see status-bits */
+#define MAC_HD_CONTROL	0x38
+
+static const int macide_offsets[IDE_NR_PORTS] = {
+    MAC_HD_DATA, MAC_HD_ERROR, MAC_HD_NSECTOR, MAC_HD_SECTOR, MAC_HD_LCYL,
+    MAC_HD_HCYL, MAC_HD_SELECT, MAC_HD_STATUS, MAC_HD_CONTROL
+};
+
+	/*
+	 * Other registers
+	 */
+
+	/* 
+	 * IDE interrupt status register for both (?) hwifs on Quadra
+	 * Initial setting: 0xc
+	 * Guessing again:
+	 * Bit 0+1: some interrupt flags
+	 * Bit 2+3: some interrupt enable
+	 * Bit 4:   ??
+	 * Bit 5:   IDE interrupt flag (any hwif)
+	 * Bit 6:   maybe IDE interrupt enable (any hwif) ??
+	 * Bit 7:   Any interrupt condition
+	 *
+	 * Only relevant item: bit 5, to be checked by mac_ack_intr
+	 */
+
+#define MAC_HD_ISR	0x101
+
+	/*
+	 * IDE interrupt glue - seems to be wired to Nubus, Slot D?
+	 * (ROM code disassembly again)
+	 * First try: just use Nubus interrupt for Slot C. Have Nubus code call
+	 * a wrapper to ide_intr that checks the ISR (see above).
+	 * Need to #define IDE_IRQ_NUBUS though.
+	 * Alternative method: set a mac_ide_hook function pointer to the wrapper 
+	 * here and have via_do_nubus call that hook if set. 
+	 *
+	 * Quadra needs the hook, Powerbook can use Nubus slot C. 
+	 * Checking the ISR on Quadra is done by mac_ack_intr (see Amiga code). mac_ide_intr
+	 * mac_ide_intr is obsolete except for providing the hwgroup argument.
+	 */
+
+	/* The Mac hwif data, for passing hwgroup to ide_intr */
+static ide_hwif_t *mac_hwif = NULL;
+
+	/* The function pointer used in the Nubus handler */
+void (*mac_ide_intr_hook)(int, void *, struct pt_regs *) = NULL;
+
+	/*
+	 * Only purpose: feeds the hwgroup to the main IDE handler. 
+	 * Obsolete as soon as Nubus code is fixed WRT pseudo slot C int.
+	 * (should be the case on Powerbooks)
+	 */
+void mac_ide_intr(int irq, void *dev_id, struct pt_regs *regs)
+{
+	ide_intr(irq, mac_hwif->hwgroup, regs);
+}
+
+    /*
+     *  Check the interrupt status
+     */
+
+static int mac_ack_intr(ide_hwif_t *hwif)
+{
+    unsigned char ch;
+
+    ch = inb(hwif->io_ports[IDE_IRQ_OFFSET]);
+    if (!(ch & 0x20))
+	return 0;
+    return 1;
+}
+
+    /*
+     *  Probe for a Macintosh IDE interface
+     */
+
+int macide_probe_hwif(int index, ide_hwif_t *hwif)
+{
+    static int mac_index = 0;
+
+    if (!MACH_IS_MAC || macintosh_config->ide_type == 0)
+	return 0;
+
+    if (!mac_index) {
+	if (macintosh_config->ide_type == MAC_IDE_QUADRA)
+		printk("ide%d: Macintosh Quadra IDE interface\n", index);
+	else
+		printk("ide%d: Macintosh Powerbook IDE interface\n", index);
+	mac_index = index+1;
+    }
+    if (mac_index == index+1) {
+	/* Quadra (pseudo Nubus interrupt) needs to check interrupt status */
+	if (macintosh_config->ide_type == MAC_IDE_QUADRA)
+		ide_setup_ports(hwif, (ide_ioreg_t)MAC_HD_BASE, macide_offsets, 
+				(ide_ioreg_t)(MAC_HD_BASE+MAC_HD_ISR), 
+				mac_ack_intr);
+	else
+		ide_setup_ports(hwif, (ide_ioreg_t)MAC_HD_BASE, macide_offsets, 
+				0, NULL);
+
+	hwif->irq = IRQ_MAC_NUBUS;
+
+	/* set IDE interrupt hook for Nubus dispatch (Quadra only) */
+	if (macintosh_config->ide_type == MAC_IDE_QUADRA)
+		mac_ide_intr_hook = mac_ide_intr;
+
+	/* XXX remember interface struct for reference in interrupt wrapper */
+	mac_hwif = hwif;
+
+	return 1;
+    }
+    return 0;
+}
--- /dev/null	Sat Jun 17 03:20:38 1995
+++ m68k/drivers/block/pcide.c	Thu Apr  2 01:05:08 1998
@@ -0,0 +1,73 @@
+/*
+ *  linux/drivers/block/pcide.c -- PC I/O port IDE Driver
+ *
+ *     Created 12 Jul 1997 by Geert Uytterhoeven
+ *
+ *  This file is subject to the terms and conditions of the GNU General Public
+ *  License.  See the file COPYING in the main directory of this archive for
+ *  more details.
+ */
+
+#include <linux/types.h>
+#include <linux/mm.h>
+#include <linux/interrupt.h>
+#include <linux/blkdev.h>
+#include <linux/hdreg.h>
+
+#include "ide.h"
+
+
+    /*
+     *  Bases of the IDE interfaces
+     */
+
+#define PCIDE_NUM_HWIFS	6
+
+#define PCIDE_BASE1	0x1f0
+#define PCIDE_BASE2	0x170
+#define PCIDE_BASE3	0x1e8
+#define PCIDE_BASE4	0x168
+#define PCIDE_BASE5	0x1e0
+#define PCIDE_BASE6	0x160
+
+static const ide_ioreg_t pcide_bases[PCIDE_NUM_HWIFS] = {
+    PCIDE_BASE1, PCIDE_BASE2, PCIDE_BASE3, PCIDE_BASE4, PCIDE_BASE5,
+    PCIDE_BASE6
+};
+
+
+    /*
+     *  Offsets from one of the above bases
+     */
+
+#define PCIDE_REG(x)	(HD_##x-PCIDE_BASE1)
+
+static const int pcide_offsets[IDE_NR_PORTS] = {
+    PCIDE_REG(DATA), PCIDE_REG(ERROR), PCIDE_REG(NSECTOR), PCIDE_REG(SECTOR),
+    PCIDE_REG(LCYL), PCIDE_REG(HCYL), PCIDE_REG(CURRENT), PCIDE_REG(STATUS),
+    PCIDE_REG(CMD)
+};
+
+
+    /*
+     *  Probe for PC IDE interfaces
+     */
+
+int pcide_probe_hwif(int index, ide_hwif_t *hwif)
+{
+    static int pcide_index[PCIDE_NUM_HWIFS] = { 0, };
+    int i;
+
+    for (i = 0; i < PCIDE_NUM_HWIFS; i++) {
+	if (!pcide_index[i]) {
+	    printk("ide%d: PC IDE interface\n", index);
+	    pcide_index[i] = index+1;
+	}
+	if (pcide_index[i] == index+1) {
+	    ide_setup_ports(hwif, pcide_bases[i], pcide_offsets, 0, NULL);
+	    hwif->irq = 0;
+	    return 1;
+	}
+    }
+    return 0;
+}

Greetings,

						Geert

--
Geert Uytterhoeven                     Geert.Uytterhoeven@cs.kuleuven.ac.be
Wavelets, Linux/{m68k~Amiga,PPC~CHRP}  http://www.cs.kuleuven.ac.be/~geert/
Department of Computer Science -- Katholieke Universiteit Leuven -- Belgium


