]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/ide.h
ide: enhance ide_busy_sleep()
[linux-2.6-omap-h63xx.git] / include / linux / ide.h
index 1524829f73f2cd8c5aa4fc9cbc6bd47c7a1fa48f..2ad8548135d24e5ffac6581a02c1c56afec978b2 100644 (file)
@@ -87,12 +87,13 @@ struct ide_io_ports {
 };
 
 #define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good))
-#define BAD_R_STAT             (BUSY_STAT   | ERR_STAT)
-#define BAD_W_STAT             (BAD_R_STAT  | WRERR_STAT)
-#define BAD_STAT               (BAD_R_STAT  | DRQ_STAT)
-#define DRIVE_READY            (READY_STAT  | SEEK_STAT)
 
-#define BAD_CRC                        (ABRT_ERR    | ICRC_ERR)
+#define BAD_R_STAT     (ATA_BUSY | ATA_ERR)
+#define BAD_W_STAT     (BAD_R_STAT | ATA_DF)
+#define BAD_STAT       (BAD_R_STAT | ATA_DRQ)
+#define DRIVE_READY    (ATA_DRDY | ATA_DSC)
+
+#define BAD_CRC                (ATA_ABORTED | ATA_ICRC)
 
 #define SATA_NR_PORTS          (3)     /* 16 possible ?? */
 
@@ -366,7 +367,9 @@ enum {
        /* Currently on a filemark */
        IDE_AFLAG_FILEMARK              = (1 << 25),
        /* 0 = no tape is loaded, so we don't rewind after ejecting */
-       IDE_AFLAG_MEDIUM_PRESENT        = (1 << 26)
+       IDE_AFLAG_MEDIUM_PRESENT        = (1 << 26),
+
+       IDE_AFLAG_NO_AUTOCLOSE          = (1 << 27),
 };
 
 struct ide_drive_s {
@@ -378,7 +381,7 @@ struct ide_drive_s {
        struct request          *rq;    /* current request */
        struct ide_drive_s      *next;  /* circular list of hwgroup drives */
        void            *driver_data;   /* extra driver data */
-       struct hd_driveid       *id;    /* drive model identification info */
+       u16                     *id;    /* identification info */
 #ifdef CONFIG_IDE_PROC_FS
        struct proc_dir_entry *proc;    /* /proc/ide/ directory entry */
        struct ide_settings_s *settings;/* /proc/ide/ drive settings */
@@ -415,7 +418,6 @@ struct ide_drive_s {
        unsigned atapi_overlap  : 1;    /* ATAPI overlap (not supported) */
        unsigned doorlocking    : 1;    /* for removable only: door lock/unlock works */
        unsigned nodma          : 1;    /* disallow DMA */
-       unsigned remap_0_to_1   : 1;    /* 0=noremap, 1=remap 0->1 (for EZDrive) */
        unsigned blocked        : 1;    /* 1=powermanagment told us not to do anything, so sleep nicely */
        unsigned scsi           : 1;    /* 0=default, 1=ide-scsi emulation */
        unsigned sleeping       : 1;    /* 1=sleeping & sleep field valid */
@@ -436,9 +438,8 @@ struct ide_drive_s {
        u8      mult_req;       /* requested multiple sector setting */
        u8      tune_req;       /* requested drive tuning setting */
        u8      io_32bit;       /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */
-       u8      bad_wstat;      /* used for ignoring WRERR_STAT */
-       u8      nowerr;         /* used for ignoring WRERR_STAT */
-       u8      sect0;          /* offset of first sector for DM6:DDO */
+       u8      bad_wstat;      /* used for ignoring ATA_DF */
+       u8      nowerr;         /* used for ignoring ATA_DF */
        u8      head;           /* "real" number of heads */
        u8      sect;           /* "real" sectors per track */
        u8      bios_head;      /* BIOS/fdisk/LILO number of heads */
@@ -918,10 +919,12 @@ ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8);
 
 ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat);
 
-extern void ide_fix_driveid(struct hd_driveid *);
+void ide_fix_driveid(u16 *);
 
 extern void ide_fixstring(u8 *, const int, const int);
 
+int ide_busy_sleep(ide_hwif_t *, unsigned long, int);
+
 int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
 
 extern ide_startstop_t ide_do_reset (ide_drive_t *);
@@ -1238,7 +1241,7 @@ struct drive_list_entry {
        const char *id_firmware;
 };
 
-int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *);
+int ide_in_drive_list(u16 *, const struct drive_list_entry *);
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
 int __ide_dma_bad_drive(ide_drive_t *);
@@ -1345,12 +1348,12 @@ const char *ide_xfer_verbose(u8 mode);
 extern void ide_toggle_bounce(ide_drive_t *drive, int on);
 extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
 
-static inline int ide_dev_has_iordy(struct hd_driveid *id)
+static inline int ide_dev_has_iordy(u16 *id)
 {
-       return ((id->field_valid & 2) && (id->capability & 8)) ? 1 : 0;
+       return ((id[ATA_ID_FIELD_VALID] & 2) && ata_id_has_iordy(id)) ? 1 : 0;
 }
 
-static inline int ide_dev_is_sata(struct hd_driveid *id)
+static inline int ide_dev_is_sata(u16 *id)
 {
        /*
         * See if word 93 is 0 AND drive is at least ATA-5 compatible
@@ -1358,7 +1361,7 @@ static inline int ide_dev_is_sata(struct hd_driveid *id)
         * this trick allows us to filter out the reserved values of
         * 0x0000 and 0xffff along with the earlier ATA revisions...
         */
-       if (id->hw_config == 0 && (short)id->major_rev_num >= 0x0020)
+       if (id[ATA_ID_HW_CONFIG] == 0 && (short)id[ATA_ID_MAJOR_VER] >= 0x0020)
                return 1;
        return 0;
 }
@@ -1435,11 +1438,11 @@ extern struct bus_type ide_bus_type;
 extern struct class *ide_port_class;
 
 /* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */
-#define ide_id_has_flush_cache(id)     ((id)->cfs_enable_2 & 0x3000)
+#define ide_id_has_flush_cache(id)     ((id)[ATA_ID_CFS_ENABLE_2] & 0x3000)
 
 /* some Maxtor disks have bit 13 defined incorrectly so check bit 10 too */
 #define ide_id_has_flush_cache_ext(id) \
-       (((id)->cfs_enable_2 & 0x2400) == 0x2400)
+       (((id)[ATA_ID_CFS_ENABLE_2] & 0x2400) == 0x2400)
 
 static inline void ide_dump_identify(u8 *id)
 {