patch-2.1.92 linux/drivers/block/ide.c

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

diff -u --recursive --new-file v2.1.91/linux/drivers/block/ide.c linux/drivers/block/ide.c
@@ -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
  *
@@ -138,7 +124,7 @@
 #include <linux/kmod.h>
 #endif /* CONFIG_KMOD */
 
-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 */
@@ -1183,6 +1169,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;
@@ -2575,7 +2575,7 @@
 #endif /* CONFIG_BLK_DEV_IDE */
 
 #ifdef CONFIG_PROC_FS
-	proc_ide_init();
+	proc_ide_create();
 #endif
 
 	/*
@@ -2691,10 +2691,12 @@
 	return NULL;
 }
 
+#ifdef CONFIG_PROC_FS
 static ide_proc_entry_t generic_subdriver_entries[] = {
-	{ "capacity", proc_ide_read_capacity, NULL },
-	{ NULL, NULL, NULL }
+	{ "capacity",	S_IFREG|S_IRUGO,	proc_ide_read_capacity,	NULL },
+	{ NULL, 0, NULL, NULL }
 };
+#endif
 
 int ide_register_subdriver (ide_drive_t *drive, ide_driver_t *driver, int version)
 {
@@ -2717,8 +2719,10 @@
 		drive->nice1 = 1;
 	}
 	drive->revalidate = 1;
-	ide_add_proc_entries(drive, generic_subdriver_entries);
-	ide_add_proc_entries(drive, driver->proc);
+#ifdef CONFIG_PROC_FS
+	ide_add_proc_entries(drive->proc, generic_subdriver_entries, drive);
+	ide_add_proc_entries(drive->proc, driver->proc, drive);
+#endif
 	return 0;
 }
 
@@ -2732,8 +2736,10 @@
 		__restore_flags(flags);
 		return 1;
 	}
-	ide_remove_proc_entries(drive, DRIVER(drive)->proc);
-	ide_remove_proc_entries(drive, generic_subdriver_entries);
+#ifdef CONFIG_PROC_FS
+	ide_remove_proc_entries(drive->proc, DRIVER(drive)->proc);
+	ide_remove_proc_entries(drive->proc, generic_subdriver_entries);
+#endif
 	auto_remove_settings(drive);
 	drive->driver = NULL;
 	__restore_flags(flags);
@@ -2803,6 +2809,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
@@ -2828,11 +2840,13 @@
 EXPORT_SYMBOL(ide_cmd);
 EXPORT_SYMBOL(ide_wait_cmd);
 EXPORT_SYMBOL(ide_stall_queue);
+#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);
 
 EXPORT_SYMBOL(ide_register);
 EXPORT_SYMBOL(ide_unregister);
@@ -2881,5 +2895,8 @@
 
 	for (index = 0; index < MAX_HWIFS; ++index)
 		ide_unregister(index);
+#ifdef CONFIG_PROC_FS
+	proc_ide_destroy();
+#endif
 }
 #endif /* MODULE */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov