summaryrefslogtreecommitdiff
path: root/include/linux/ide.h
diff options
context:
space:
mode:
authorMartin Dalecki <dalecki@evision-ventures.com>2002-03-06 00:49:05 -0800
committerLinus Torvalds <torvalds@penguin.transmeta.com>2002-03-06 00:49:05 -0800
commita925c40f775a179a971bfd77de8e3035c0afc1ac (patch)
tree1d81646f110882548c241d497a820568d893bb9e /include/linux/ide.h
parent6aa0c79e5d777f467c567d17a4aaa67fb7262076 (diff)
[PATCH] IDE 17 (not just cleanup)
This is actually an attempt to remove some stall code from this driver. However if some *real* users complain (Not just the usuall: "Hey - if someone!" but the "Hey I'm using this!") I'm all open to reenable it. Since I prepared this patch yerstoday it doesn't contain the ide_module.h fixup. This will follow later. - Don't use the convoluted byte type in ide-pci.c. Just use the proper u8instead. - Move ide_get_or_set_dma_base to the only place where it's used and reorganize the code there by killing the unnecessary CONFIG_BLK_DEV_IDEDMA_FORCED configuration option. - Remove unfunctional CONFIG_PKT_TASK_IOCTL code. - Kill unused ALTSTAT_SCREW_UP code. - Tons of dead code removed from ide-taskfile.c (#if 0 #endif and friends) - Remove unused IDE_DEBUG macro as well as lots of other name space pollution from ide.h. - Start using the ide_lock spin-lock for protecting access to data structures instead of the excessive interrupt disabling games. - Shorten the proc ouput of the piix initialization module. - Remove special /proc tape "name" output from ide-tape.c. This was redundant data which should only show up on syslog anyway. - Kill the REALLY_FAST_IO undef from the ide.h. This was a mistake present since far too many years in this driver. The proper way to deal with broken systems is to define REALLY_SLOW_IO in system dependent headers or particular driver files. We can always reintroduce it easy if real users will complain, since OUT_BYTE() and similar can be used as hooks. But I don't expect anybody reporting about this. Even on the most broken IDE chip in the world (cmd640 at VLB) undefining this *always* worked for me. Nearly all the code pieces in the ide driver code *reverted* it's effects explicitly anyway. - Remove the obsolete CONFIG_BLK_DEV_4DRIVES support. This was supposed to support 4 drivers attached at one channel on some older chipsets, in esp. Tekram 690CD, in the last century. They where all supposed to work at a register set starting at the base address 0x1f0. Before complaining that this is removing functionality, please note that this must have been broken for already quite a long time, since the ide driver didn't contain the special device selection methods implicated by this any longer. It didn't scan this port too if PCI host chip support was enabled (as it is in all those distributions around there). On the other hand this is the most prominent case of incoherent use of the mate member in the struct hwif_s. And please think about how big the probability is, that there are systems out there, where there are actually 4 drivers on such a channel? - Streamline module initialization code by removing one shoot functions. - Make the WAIT_READY value used in case of CONFIG_APM or CONFIG_APM_MODULE the default, since this is what really reflects the behavior of modern drives. It won't hurt any other case and finally removing it is reducing the necessary coverage for overall driver code testing/analysis. - Move the IDE_LARGE_SEEK macro to the only place where it's actually used. Replace the IDE_MIN() and IDE_MAX() drivers with the obvious. Remove unused SPLIT_WORD and MAKE WORD from the local header. - Remove CMD640_DUMP_REGS from global scope, since there is no development done on this any longer. Finally, the way the host chip initialization routines are called changed in the time between allows this to remain fully local to the host chip driver in question. - Some spell checking of comments in the code. (Yeep I have extended my Vim to do this the "Word" way with nice undercurl lines... mozilla remains to be fixed...)
Diffstat (limited to 'include/linux/ide.h')
-rw-r--r--include/linux/ide.h184
1 files changed, 54 insertions, 130 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 1ced5d52add3..f6815848ae35 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -28,10 +28,7 @@
/******************************************************************************
* IDE driver configuration options (play with these as desired):
- *
- * REALLY_SLOW_IO can be defined in ide.c and ide-cd.c, if necessary
*/
-#undef REALLY_FAST_IO /* define if ide ports are perfect */
#define INITIAL_MULT_COUNT 0 /* off=0; on=2,4,8,16,32, etc.. */
#ifndef SUPPORT_SLOW_DATA_PORTS /* 1 to support slow data ports */
@@ -49,20 +46,12 @@
#ifndef FANCY_STATUS_DUMPS /* 1 for human-readable drive errors */
#define FANCY_STATUS_DUMPS 1 /* 0 to reduce kernel size */
#endif
-
-#ifdef CONFIG_BLK_DEV_CMD640
-# if 0 /* change to 1 when debugging cmd640 problems */
-void cmd640_dump_regs (void);
-# define CMD640_DUMP_REGS cmd640_dump_regs() /* for debugging cmd640 chipset */
-# endif
-#endif
-
#ifndef DISABLE_IRQ_NOSYNC
-# define DISABLE_IRQ_NOSYNC 0
+#define DISABLE_IRQ_NOSYNC 0
#endif
/*
- * "No user-serviceable parts" beyond this point :)
+ * "No user-serviceable parts" beyond this point
*****************************************************************************/
typedef unsigned char byte; /* used everywhere */
@@ -79,13 +68,6 @@ typedef unsigned char byte; /* used everywhere */
*/
#define DMA_PIO_RETRY 1 /* retrying in PIO */
-/*
- * Ensure that various configuration flags have compatible settings
- */
-#ifdef REALLY_SLOW_IO
-# undef REALLY_FAST_IO
-#endif
-
#define HWIF(drive) ((drive)->hwif)
#define HWGROUP(drive) (HWIF(drive)->hwgroup)
@@ -180,33 +162,17 @@ typedef unsigned char byte; /* used everywhere */
#define PARTN_BITS 6 /* number of minor dev bits for partitions */
#define PARTN_MASK ((1<<PARTN_BITS)-1) /* a useful bit mask */
#define MAX_DRIVES 2 /* per interface; 2 assumed by lots of code */
-#define CASCADE_DRIVES 8 /* per interface; 8|2 assumed by lots of code */
#define SECTOR_SIZE 512
#define SECTOR_WORDS (SECTOR_SIZE / 4) /* number of 32bit words per sector */
-#define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t)))
-#define IDE_MIN(a,b) ((a)<(b) ? (a):(b))
-#define IDE_MAX(a,b) ((a)>(b) ? (a):(b))
-
-#ifndef SPLIT_WORD
-# define SPLIT_WORD(W,HB,LB) ((HB)=(W>>8), (LB)=(W-((W>>8)<<8)))
-#endif
-#ifndef MAKE_WORD
-# define MAKE_WORD(W,HB,LB) ((W)=((HB<<8)+LB))
-#endif
-
/*
* Timeouts for various operations:
*/
#define WAIT_DRQ (5*HZ/100) /* 50msec - spec allows up to 20ms */
-#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
-#define WAIT_READY (5*HZ) /* 5sec - some laptops are very slow */
-#else
-#define WAIT_READY (3*HZ/100) /* 30msec - should be instantaneous */
-#endif /* CONFIG_APM || CONFIG_APM_MODULE */
-#define WAIT_PIDENTIFY (10*HZ) /* 10sec - should be less than 3ms (?), if all ATAPI CD is closed at boot */
-#define WAIT_WORSTCASE (30*HZ) /* 30sec - worst case when spinning up */
-#define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */
+#define WAIT_READY (5*HZ) /* 5sec - some laptops are very slow */
+#define WAIT_PIDENTIFY (10*HZ) /* 10sec - should be less than 3ms (?), if all ATAPI CD is closed at boot */
+#define WAIT_WORSTCASE (30*HZ) /* 30sec - worst case when spinning up */
+#define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */
#define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */
#define SELECT_DRIVE(hwif,drive) \
@@ -216,40 +182,12 @@ typedef unsigned char byte; /* used everywhere */
OUT_BYTE((drive)->select.all, hwif->io_ports[IDE_SELECT_OFFSET]); \
}
-#define SELECT_INTERRUPT(hwif,drive) \
-{ \
- if (hwif->intrproc) \
- hwif->intrproc(drive); \
- else \
- OUT_BYTE((drive)->ctl|2, hwif->io_ports[IDE_CONTROL_OFFSET]); \
-}
-
#define SELECT_MASK(hwif,drive,mask) \
{ \
if (hwif->maskproc) \
hwif->maskproc(drive,mask); \
}
-#define SELECT_READ_WRITE(hwif,drive,func) \
-{ \
- if (hwif->rwproc) \
- hwif->rwproc(drive,func); \
-}
-
-#define QUIRK_LIST(hwif,drive) \
-{ \
- if (hwif->quirkproc) \
- (drive)->quirk_list = hwif->quirkproc(drive); \
-}
-
-#define HOST(hwif,chipset) \
-{ \
- return ((hwif)->chipset == chipset) ? 1 : 0; \
-}
-
-#define IDE_DEBUG(lineno) \
- printk("%s,%s,line=%d\n", __FILE__, __FUNCTION__, (lineno))
-
/*
* Check for an interrupt and acknowledge the interrupt status
*/
@@ -257,19 +195,31 @@ struct hwif_s;
typedef int (ide_ack_intr_t)(struct hwif_s *);
#ifndef NO_DMA
-#define NO_DMA 255
+# define NO_DMA 255
#endif
/*
- * hwif_chipset_t is used to keep track of the specific hardware
- * chipset used by each IDE interface, if known.
+ * This is used to keep track of the specific hardware chipset used by each IDE
+ * interface, if known. Please note that we don't discriminate between
+ * different PCI host chips here.
*/
-typedef enum { ide_unknown, ide_generic, ide_pci,
- ide_cmd640, ide_dtc2278, ide_ali14xx,
- ide_qd65xx, ide_umc8672, ide_ht6560b,
- ide_pdc4030, ide_rz1000, ide_trm290,
- ide_cmd646, ide_cy82c693, ide_4drives,
- ide_pmac, ide_etrax100
+typedef enum {
+ ide_unknown,
+ ide_generic,
+ ide_pci,
+ ide_cmd640,
+ ide_dtc2278,
+ ide_ali14xx,
+ ide_qd65xx,
+ ide_umc8672,
+ ide_ht6560b,
+ ide_pdc4030,
+ ide_rz1000,
+ ide_trm290,
+ ide_cmd646,
+ ide_cy82c693,
+ ide_pmac,
+ ide_etrax100
} hwif_chipset_t;
@@ -297,7 +247,7 @@ int ide_register_hw(hw_regs_t *hw, struct hwif_s **hwifp);
/*
* Set up hw_regs_t structure before calling ide_register_hw (optional)
*/
-void ide_setup_ports( hw_regs_t *hw,
+void ide_setup_ports(hw_regs_t *hw,
ide_ioreg_t base,
int *offsets,
ide_ioreg_t ctrl,
@@ -308,28 +258,16 @@ void ide_setup_ports( hw_regs_t *hw,
#include <asm/ide.h>
/*
- * If the arch-dependant ide.h did not declare/define any OUT_BYTE
- * or IN_BYTE functions, we make some defaults here.
+ * If the arch-dependant ide.h did not declare/define any OUT_BYTE or IN_BYTE
+ * functions, we make some defaults here. The only architecture currently
+ * needing this is Cris.
*/
-#ifndef HAVE_ARCH_OUT_BYTE
-#ifdef REALLY_FAST_IO
-#define OUT_BYTE(b,p) outb((b),(p))
-#define OUT_WORD(w,p) outw((w),(p))
-#else
-#define OUT_BYTE(b,p) outb_p((b),(p))
-#define OUT_WORD(w,p) outw_p((w),(p))
-#endif
-#endif
-
-#ifndef HAVE_ARCH_IN_BYTE
-#ifdef REALLY_FAST_IO
-#define IN_BYTE(p) (byte)inb(p)
-#define IN_WORD(p) (short)inw(p)
-#else
-#define IN_BYTE(p) (byte)inb_p(p)
-#define IN_WORD(p) (short)inw_p(p)
-#endif
+#ifndef HAVE_ARCH_IN_OUT
+# define OUT_BYTE(b,p) outb((b),(p))
+# define OUT_WORD(w,p) outw((w),(p))
+# define IN_BYTE(p) (u8)inb(p)
+# define IN_WORD(p) (u16)inw(p)
#endif
/*
@@ -358,6 +296,7 @@ typedef union {
struct ide_settings_s;
typedef struct ide_drive_s {
+ unsigned int usage; /* current "open()" count for drive */
char type; /* distingiush different devices: disk, cdrom, tape, floppy, ... */
/* NOTE: If we had proper separation between channel and host chip, we
@@ -376,14 +315,14 @@ typedef struct ide_drive_s {
byte using_dma; /* disk is using dma for read/write */
byte retry_pio; /* retrying dma capable host in pio */
byte state; /* retry state */
- byte waiting_for_dma; /* dma currently in progress */
byte unmask; /* flag: okay to unmask other irqs */
byte slow; /* flag: slow data port */
byte bswap; /* flag: byte swap data */
byte dsc_overlap; /* flag: DSC overlap */
byte nice1; /* flag: give potential excess bandwidth */
+ unsigned waiting_for_dma: 1; /* dma currently in progress */
unsigned present : 1; /* drive is physically present */
- unsigned noprobe : 1; /* from: hdx=noprobe */
+ unsigned noprobe : 1; /* from: hdx=noprobe */
unsigned busy : 1; /* currently doing revalidate_disk() */
unsigned removable : 1; /* 1 if need to do check_media_change */
unsigned forced_geom : 1; /* 1 if hdx=c,h,s was given at boot */
@@ -410,7 +349,6 @@ typedef struct ide_drive_s {
byte bad_wstat; /* used for ignoring WRERR_STAT */
byte nowerr; /* used for ignoring WRERR_STAT */
byte sect0; /* offset of first sector for DM6:DDO */
- unsigned int usage; /* current "open()" count for drive */
byte head; /* "real" number of heads */
byte sect; /* "real" sectors per track */
byte bios_head; /* BIOS/fdisk/LILO number of heads */
@@ -543,12 +481,12 @@ typedef struct hwif_s {
unsigned long select_data; /* for use by chipset-specific code */
struct proc_dir_entry *proc; /* /proc/ide/ directory entry */
int irq; /* our irq number */
- byte major; /* our major number */
- char name[80]; /* name of interface */
- byte index; /* 0 for ide0; 1 for ide1; ... */
+ int major; /* our major number */
+ char name[80]; /* name of interface */
+ int index; /* 0 for ide0; 1 for ide1; ... */
hwif_chipset_t chipset; /* sub-module for tuning.. */
unsigned noprobe : 1; /* don't probe for this interface */
- unsigned present : 1; /* this interface exists */
+ unsigned present : 1; /* there is a device on this interface */
unsigned serialized : 1; /* serialized operation with mate hwif */
unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */
unsigned reset : 1; /* reset after probe */
@@ -909,15 +847,7 @@ void do_taskfile (ide_drive_t *drive, struct hd_drive_task_hdr *taskfile, struct
*/
ide_startstop_t set_multmode_intr (ide_drive_t *drive);
-ide_startstop_t set_geometry_intr (ide_drive_t *drive);
-ide_startstop_t recal_intr (ide_drive_t *drive);
ide_startstop_t task_no_data_intr (ide_drive_t *drive);
-ide_startstop_t task_in_intr (ide_drive_t *drive);
-ide_startstop_t task_mulin_intr (ide_drive_t *drive);
-ide_startstop_t pre_task_out_intr (ide_drive_t *drive, struct request *rq);
-ide_startstop_t task_out_intr (ide_drive_t *drive);
-ide_startstop_t task_mulout_intr (ide_drive_t *drive);
-void ide_init_drive_taskfile (struct request *rq);
int ide_wait_taskfile (ide_drive_t *drive, struct hd_drive_task_hdr *taskfile, struct hd_drive_hob_hdr *hobfile, byte *buf);
@@ -928,14 +858,9 @@ ide_handler_t * ide_handler_parser (struct hd_drive_task_hdr *taskfile, struct h
/* Expects args is a full set of TF registers and parses the command type */
int ide_cmd_type_parser (ide_task_t *args);
-int ide_taskfile_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
int ide_cmd_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
int ide_task_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
-#ifdef CONFIG_PKT_TASK_IOCTL
-int pkt_taskfile_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
-#endif /* CONFIG_PKT_TASK_IOCTL */
-
void ide_delay_50ms (void);
byte ide_auto_reduce_xfer (ide_drive_t *drive);
@@ -962,14 +887,16 @@ void ide_stall_queue (ide_drive_t *drive, unsigned long timeout);
/*
* ide_get_queue() returns the queue which corresponds to a given device.
*/
-request_queue_t *ide_get_queue (kdev_t dev);
+request_queue_t *ide_get_queue(kdev_t dev);
/*
* CompactFlash cards and their brethern pretend to be removable hard disks,
* but they never have a slave unit, and they don't have doorlock mechanisms.
- * This test catches them, and is invoked elsewhere when setting appropriate config bits.
+ * This test catches them, and is invoked elsewhere when setting appropriate
+ * config bits.
*/
-int drive_is_flashcard (ide_drive_t *drive);
+
+extern int drive_is_flashcard(ide_drive_t *drive);
int ide_spin_wait_hwgroup (ide_drive_t *drive);
void ide_timer_expiry (unsigned long data);
@@ -1009,26 +936,23 @@ extern int ide_unregister_subdriver(ide_drive_t *drive);
#define ON_BOARD 1
#define NEVER_BOARD 0
#ifdef CONFIG_BLK_DEV_OFFBOARD
-# define OFF_BOARD ON_BOARD
-#else /* CONFIG_BLK_DEV_OFFBOARD */
-# define OFF_BOARD NEVER_BOARD
-#endif /* CONFIG_BLK_DEV_OFFBOARD */
+# define OFF_BOARD ON_BOARD
+#else
+# define OFF_BOARD NEVER_BOARD
+#endif
void __init ide_scan_pcibus(int scan_direction);
#endif
#ifdef CONFIG_BLK_DEV_IDEDMA
-#define BAD_DMA_DRIVE 0
-#define GOOD_DMA_DRIVE 1
+# define BAD_DMA_DRIVE 0
+# define GOOD_DMA_DRIVE 1
int ide_build_dmatable (ide_drive_t *drive, ide_dma_action_t func);
void ide_destroy_dmatable (ide_drive_t *drive);
ide_startstop_t ide_dma_intr (ide_drive_t *drive);
int check_drive_lists (ide_drive_t *drive, int good_bad);
-int report_drive_dmaing (ide_drive_t *drive);
int ide_dmaproc (ide_dma_action_t func, ide_drive_t *drive);
int ide_release_dma (ide_hwif_t *hwif);
void ide_setup_dma (ide_hwif_t *hwif, unsigned long dmabase, unsigned int num_ports) __init;
-/* FIXME spilt this up into a get and set function */
-extern unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif, int extra, const char *name) __init;
#endif
extern spinlock_t ide_lock;