root/drivers/block/ide.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  *  linux/drivers/block/ide.h
   3  *
   4  *  Copyright (C) 1994, 1995  Linus Torvalds & authors
   5  */
   6 
   7 #include <linux/config.h>
   8 
   9 /*
  10  * This is the multiple IDE interface driver, as evolved from hd.c.  
  11  * It supports up to four IDE interfaces, on one or more IRQs (usually 14 & 15).
  12  * There can be up to two drives per interface, as per the ATA-2 spec.
  13  *
  14  * Primary i/f:    ide0: major=3;  (hda)         minor=0; (hdb)         minor=64
  15  * Secondary i/f:  ide1: major=22; (hdc or hd1a) minor=0; (hdd or hd1b) minor=64
  16  * Tertiary i/f:   ide2: major=33; (hde)         minor=0; (hdf)         minor=64
  17  * Quaternary i/f: ide3: major=34; (hdg)         minor=0; (hdh)         minor=64
  18  */
  19 
  20 /******************************************************************************
  21  * IDE driver configuration options (play with these as desired):
  22  * 
  23  * REALLY_SLOW_IO can be defined in ide.c and ide-cd.c, if necessary
  24  */
  25 #undef REALLY_FAST_IO                   /* define if ide ports are perfect */
  26 #define INITIAL_MULT_COUNT      0       /* off=0; on=2,4,8,16,32, etc.. */
  27 
  28 #ifndef DISK_RECOVERY_TIME              /* off=0; on=access_delay_time */
  29 #define DISK_RECOVERY_TIME      0       /*  for hardware that needs it */
  30 #endif
  31 #ifndef OK_TO_RESET_CONTROLLER          /* 1 needed for good error recovery */
  32 #define OK_TO_RESET_CONTROLLER  1       /* 0 for use with AH2372A/B interface */
  33 #endif
  34 #ifndef FAKE_FDISK_FOR_EZDRIVE          /* 1 to help linux fdisk with EZDRIVE */
  35 #define FAKE_FDISK_FOR_EZDRIVE  1       /* 0 to reduce kernel size */
  36 #endif
  37 #ifndef SUPPORT_RZ1000                  /* 1 to support RZ1000 chipset */
  38 #define SUPPORT_RZ1000          1       /* 0 to reduce kernel size */
  39 #endif
  40 #ifndef SUPPORT_UMC8672                 /* 1 to support UMC8672 chipset */
  41 #define SUPPORT_UMC8672         1       /* 0 to reduce kernel size */
  42 #endif
  43 #ifndef SUPPORT_HT6560B                 /* 1 to support HT6560B chipset */
  44 #define SUPPORT_HT6560B         1       /* 0 to reduce kernel size */
  45 #endif
  46 #ifndef SUPPORT_QD6580                  /* 1 to support QD6580 chipset */
  47 #define SUPPORT_QD6580          1       /* 0 to reduce kernel size */
  48 #endif
  49 #ifndef SUPPORT_DTC2278                 /* 1 to support DTC2278 chipset */
  50 #define SUPPORT_DTC2278         1       /* 0 to reduce kernel size */
  51 #ifndef SET_DTC2278_MODE4
  52 #define SET_DTC2278_MODE4       0       /* 1 to init primary i/f for PIO mode4 */
  53 #endif
  54 #endif
  55 #ifndef FANCY_STATUS_DUMPS              /* 1 for human-readable drive errors */
  56 #define FANCY_STATUS_DUMPS      1       /* 0 to reduce kernel size */
  57 #endif
  58 
  59 #if defined(CONFIG_BLK_DEV_IDECD) || defined(CONFIG_BLK_DEV_IDETAPE)
  60 #define CONFIG_BLK_DEV_IDEATAPI 1
  61 #endif
  62 
  63 /*
  64  * IDE_DRIVE_CMD is used to implement many features of the hdparm utility
  65  */
  66 #define IDE_DRIVE_CMD           99      /* (magic) undef to reduce kernel size*/
  67 
  68 /*
  69  *  "No user-serviceable parts" beyond this point  :)
  70  *****************************************************************************/
  71 
  72 typedef unsigned char   byte;   /* used everywhere */
  73 
  74 /*
  75  * Probably not wise to fiddle with these
  76  */
  77 #define ERROR_MAX       8       /* Max read/write errors per sector */
  78 #define ERROR_RESET     3       /* Reset controller every 4th retry */
  79 #define ERROR_RECAL     1       /* Recalibrate every 2nd retry */
  80 
  81 /*
  82  * Ensure that various configuration flags have compatible settings
  83  */
  84 #ifdef REALLY_SLOW_IO
  85 #undef REALLY_FAST_IO
  86 #endif
  87 
  88 /*
  89  * Definitions for accessing IDE controller registers
  90  */
  91 
  92 #define HWIF(drive)             ((ide_hwif_t *)drive->hwif)
  93 #define HWGROUP(drive)          ((ide_hwgroup_t *)(HWIF(drive)->hwgroup))
  94 
  95 #define IDE_DATA_OFFSET         (0)
  96 #define IDE_ERROR_OFFSET        (1)
  97 #define IDE_NSECTOR_OFFSET      (2)
  98 #define IDE_SECTOR_OFFSET       (3)
  99 #define IDE_LCYL_OFFSET         (4)
 100 #define IDE_HCYL_OFFSET         (5)
 101 #define IDE_SELECT_OFFSET       (6)
 102 #define IDE_STATUS_OFFSET       (7)
 103 #define IDE_FEATURE_OFFSET      IDE_ERROR_OFFSET
 104 #define IDE_COMMAND_OFFSET      IDE_STATUS_OFFSET
 105 
 106 #define IDE_DATA_REG            (HWIF(drive)->io_base+IDE_DATA_OFFSET)
 107 #define IDE_ERROR_REG           (HWIF(drive)->io_base+IDE_ERROR_OFFSET)
 108 #define IDE_NSECTOR_REG         (HWIF(drive)->io_base+IDE_NSECTOR_OFFSET)
 109 #define IDE_SECTOR_REG          (HWIF(drive)->io_base+IDE_SECTOR_OFFSET)
 110 #define IDE_LCYL_REG            (HWIF(drive)->io_base+IDE_LCYL_OFFSET)
 111 #define IDE_HCYL_REG            (HWIF(drive)->io_base+IDE_HCYL_OFFSET)
 112 #define IDE_SELECT_REG          (HWIF(drive)->io_base+IDE_SELECT_OFFSET)
 113 #define IDE_STATUS_REG          (HWIF(drive)->io_base+IDE_STATUS_OFFSET)
 114 #define IDE_CONTROL_REG         (HWIF(drive)->ctl_port)
 115 #define IDE_FEATURE_REG         IDE_ERROR_REG
 116 #define IDE_COMMAND_REG         IDE_STATUS_REG
 117 #define IDE_ALTSTATUS_REG       IDE_CONTROL_REG
 118 
 119 #ifdef REALLY_FAST_IO
 120 #define OUT_BYTE(b,p)           outb((b),p)
 121 #define IN_BYTE(p)              (byte)inb(p)
 122 #else
 123 #define OUT_BYTE(b,p)           outb_p((b),p)
 124 #define IN_BYTE(p)              (byte)inb_p(p)
 125 #endif /* REALLY_FAST_IO */
 126 
 127 #define GET_ERR()               IN_BYTE(IDE_ERROR_REG)
 128 #define GET_STAT()              IN_BYTE(IDE_STATUS_REG)
 129 #define OK_STAT(stat,good,bad)  (((stat)&((good)|(bad)))==(good))
 130 #define BAD_R_STAT              (BUSY_STAT   | ERR_STAT)
 131 #define BAD_W_STAT              (BAD_R_STAT  | WRERR_STAT)
 132 #define BAD_STAT                (BAD_R_STAT  | DRQ_STAT)
 133 #define DRIVE_READY             (READY_STAT  | SEEK_STAT)
 134 #define DATA_READY              (DRIVE_READY | DRQ_STAT)
 135 
 136 /*
 137  * Some more useful definitions
 138  */
 139 #define IDE_MAJOR_NAME  "ide"   /* the same for all i/f; see also genhd.c */
 140 #define MAJOR_NAME      IDE_MAJOR_NAME
 141 #define PARTN_BITS      6       /* number of minor dev bits for partitions */
 142 #define PARTN_MASK      ((1<<PARTN_BITS)-1)     /* a useful bit mask */
 143 #define MAX_DRIVES      2       /* per interface; 2 assumed by lots of code */
 144 #define MAX_HWIFS       4       /* an arbitrary, but realistic limit */
 145 #define SECTOR_WORDS    (512 / 4)       /* number of 32bit words per sector */
 146 
 147 /*
 148  * Timeouts for various operations:
 149  */
 150 #define WAIT_DRQ        (5*HZ/100)      /* 50msec - spec allows up to 20ms */
 151 #define WAIT_READY      (3*HZ/100)      /* 30msec - should be instantaneous */
 152 #define WAIT_PIDENTIFY  (1*HZ)  /* 1sec   - should be less than 3ms (?) */
 153 #define WAIT_WORSTCASE  (30*HZ) /* 30sec  - worst case when spinning up */
 154 #define WAIT_CMD        (10*HZ) /* 10sec  - maximum wait for an IRQ to happen */
 155 
 156 #ifdef CONFIG_BLK_DEV_IDETAPE
 157 #include "ide-tape.h"
 158 #endif /* CONFIG_BLK_DEV_IDETAPE */
 159 
 160 #ifdef CONFIG_BLK_DEV_IDECD
 161 
 162 struct atapi_request_sense {
 163   unsigned char error_code : 7;
 164   unsigned char valid      : 1;
 165   byte reserved1;
 166   unsigned char sense_key  : 4;
 167   unsigned char reserved2  : 1;
 168   unsigned char ili        : 1;
 169   unsigned char reserved3  : 2;
 170   byte info[4];
 171   byte sense_len;
 172   byte command_info[4];
 173   byte asc;
 174   byte ascq;
 175   byte fru;
 176   byte sense_key_specific[3];
 177 };
 178 
 179 struct packet_command {
 180   char *buffer;
 181   int buflen;
 182   int stat;
 183   struct atapi_request_sense *sense_data;
 184   unsigned char c[12];
 185 };
 186 
 187 /* Space to hold the disk TOC. */
 188 
 189 #define MAX_TRACKS 99
 190 struct atapi_toc_header {
 191   unsigned short toc_length;
 192   byte first_track;
 193   byte last_track;
 194 };
 195 
 196 struct atapi_toc_entry {
 197   byte reserved1;
 198   unsigned control : 4;
 199   unsigned adr     : 4;
 200   byte track;
 201   byte reserved2;
 202   union {
 203     unsigned lba;
 204     struct {
 205       byte reserved3;
 206       byte m;
 207       byte s;
 208       byte f;
 209     } msf;
 210   } addr;
 211 };
 212 
 213 struct atapi_toc {
 214   int    last_session_lba;
 215   int    xa_flag;
 216   unsigned capacity;
 217   struct atapi_toc_header hdr;
 218   struct atapi_toc_entry  ent[MAX_TRACKS+1];  /* One extra for the leadout. */
 219 };
 220 
 221 
 222 /* This structure is annoyingly close to, but not identical with,
 223    the cdrom_subchnl structure from cdrom.h. */
 224 struct atapi_cdrom_subchnl 
 225 {
 226   u_char  acdsc_reserved;
 227   u_char  acdsc_audiostatus;
 228   u_short acdsc_length;
 229   u_char  acdsc_format;
 230 
 231   u_char  acdsc_adr:    4;
 232   u_char  acdsc_ctrl:   4;
 233   u_char  acdsc_trk;
 234   u_char  acdsc_ind;
 235   union
 236   {
 237     struct                      
 238     {
 239       u_char    minute;
 240       u_char    second;
 241       u_char    frame;
 242     } msf;
 243     int lba;
 244   } acdsc_absaddr;
 245   union 
 246   {
 247     struct 
 248     {
 249       u_char    minute;
 250       u_char    second;
 251       u_char    frame;
 252     } msf;
 253     int lba;
 254   } acdsc_reladdr;
 255 };
 256 
 257 
 258 /* Extra per-device info for cdrom drives. */
 259 struct cdrom_info {
 260 
 261   /* Buffer for table of contents.  NULL if we haven't allocated
 262      a TOC buffer for this device yet. */
 263 
 264   struct atapi_toc *toc;
 265 
 266   /* Sector buffer.  If a read request wants only the first part of a cdrom
 267      block, we cache the rest of the block here, in the expectation that that
 268      data is going to be wanted soon.  SECTOR_BUFFERED is the number of the
 269      first buffered sector, and NSECTORS_BUFFERED is the number of sectors
 270      in the buffer.  Before the buffer is allocated, we should have
 271      SECTOR_BUFFER == NULL and NSECTORS_BUFFERED == 0. */
 272 
 273   unsigned long sector_buffered;
 274   unsigned long nsectors_buffered;
 275   char *sector_buffer;
 276 
 277   /* The result of the last successful request sense command
 278      on this device. */
 279   struct atapi_request_sense sense_data;
 280 };
 281 
 282 #endif /* CONFIG_BLK_DEV_IDECD */
 283 
 284 /*
 285  * Now for the data we need to maintain per-drive:  ide_drive_t
 286  */
 287 
 288 typedef enum {ide_disk, ide_cdrom, ide_tape} ide_media_t;
 289 
 290 typedef union {
 291         unsigned all                    : 8;    /* all of the bits together */
 292         struct {
 293                 unsigned set_geometry   : 1;    /* respecify drive geometry */
 294                 unsigned recalibrate    : 1;    /* seek to cyl 0      */
 295                 unsigned set_multmode   : 1;    /* set multmode count */
 296                 unsigned reserved       : 5;    /* unused */
 297                 } b;
 298         } special_t;
 299 
 300 typedef union {
 301         unsigned all                    : 8;    /* all of the bits together */
 302         struct {
 303                 unsigned head           : 4;    /* always zeros here */
 304                 unsigned unit           : 1;    /* drive select number, 0 or 1 */
 305                 unsigned bit5           : 1;    /* always 1 */
 306                 unsigned lba            : 1;    /* using LBA instead of CHS */
 307                 unsigned bit7           : 1;    /* always 1 */
 308         } b;
 309         } select_t;
 310 
 311 typedef struct ide_drive_s {
 312         special_t       special;        /* special action flags */
 313 #if FAKE_FDISK_FOR_EZDRIVE
 314         unsigned ezdrive        : 1;    /* flag: partitioned with ezdrive */
 315 #endif /* FAKE_FDISK_FOR_EZDRIVE */
 316         unsigned present        : 1;    /* drive is physically present */
 317         unsigned noprobe        : 1;    /* from:  hdx=noprobe */
 318         unsigned keep_settings  : 1;    /* restore settings after drive reset */
 319         unsigned busy           : 1;    /* currently doing revalidate_disk() */
 320         unsigned vlb_32bit      : 1;    /* use 32bit in/out for data */
 321         unsigned vlb_sync       : 1;    /* needed for some 32bit chip sets */
 322         unsigned removeable     : 1;    /* 1 if need to do check_media_change */
 323         unsigned using_dma      : 1;    /* disk is using dma for read/write */
 324         unsigned unmask         : 1;    /* flag: okay to unmask other irqs */
 325         ide_media_t     media;          /* disk, cdrom, tape */
 326         select_t        select;         /* basic drive/head select reg value */
 327         void            *hwif;          /* actually (ide_hwif_t *) */
 328         byte            ctl;            /* "normal" value for IDE_CONTROL_REG */
 329         byte            ready_stat;     /* min status value for drive ready */
 330         byte            mult_count;     /* current multiple sector setting */
 331         byte            mult_req;       /* requested multiple sector setting */
 332         byte            chipset;        /* interface chipset access method */
 333         byte            bad_wstat;      /* used for ignoring WRERR_STAT */
 334         byte            sect0;          /* offset of first sector for DM6:DDO */
 335         byte            usage;          /* current "open()" count for drive */
 336         byte            head;           /* "real" number of heads */
 337         byte            sect;           /* "real" sectors per track */
 338         byte            bios_head;      /* BIOS/fdisk/LILO number of heads */
 339         byte            bios_sect;      /* BIOS/fdisk/LILO sectors per track */
 340         unsigned short  bios_cyl;       /* BIOS/fdisk/LILO number of cyls */
 341         unsigned short  cyl;            /* "real" number of cyls */
 342         struct wait_queue *wqueue;      /* used to wait for drive in open() */
 343         struct hd_driveid *id;          /* drive model identification info */
 344         struct hd_struct  *part;        /* drive partition table */
 345         char            name[4];        /* drive name, such as "hda" */
 346 #ifdef CONFIG_BLK_DEV_IDECD
 347         struct cdrom_info cdrom_info;   /* from ide-cd.c */
 348 #endif /* CONFIG_BLK_DEV_IDECD */
 349 
 350 #ifdef CONFIG_BLK_DEV_IDETAPE           /* ide-tape specific data */
 351 
 352 /*
 353  *      Most of our global data which we need to save even as we leave the
 354  *      driver due to an interrupt or a timer event is stored here.
 355  *
 356  *      Additional global variables which provide the link between the
 357  *      character device interface to this structure are defined in
 358  *      ide-tape.c
 359  */
 360 
 361         idetape_tape_t tape;
 362 
 363 #endif /* CONFIG_BLK_DEV_IDETAPE */
 364 
 365         } ide_drive_t;
 366 
 367 /*
 368  * An ide_dmaproc_t() initiates/aborts DMA read/write operations on a drive.
 369  *
 370  * The caller is assumed to have selected the drive and programmed the drive's
 371  * sector address using CHS or LBA.  All that remains is to prepare for DMA
 372  * and then issue the actual read/write DMA/PIO command to the drive.
 373  *
 374  * Returns 0 if all went well.
 375  * Returns 1 if DMA read/write could not be started, in which case the caller
 376  * should either try again later, or revert to PIO for the current request.
 377  */
 378 typedef enum {ide_dma_read = 0, ide_dma_write = 1, ide_dma_abort = 2, ide_dma_check = 3} ide_dma_action_t;
 379 typedef int (ide_dmaproc_t)(ide_dma_action_t, ide_drive_t *);
 380 
 381 typedef struct hwif_s {
 382         struct hwif_s   *next;          /* for linked-list in ide_hwgroup_t */
 383         void            *hwgroup;       /* actually (ide_hwgroup_t *) */
 384         unsigned short  io_base;        /* base io port addr */
 385         unsigned short  ctl_port;       /* usually io_base+0x206 */
 386         ide_drive_t     drives[MAX_DRIVES];     /* drive info */
 387         struct gendisk  *gd;            /* gendisk structure */
 388         ide_dmaproc_t   *dmaproc;       /* dma read/write/abort routine */
 389         unsigned long   *dmatable;      /* dma physical region descriptor table */
 390         unsigned short  dma_base;       /* base addr for dma ports (triton) */
 391         byte            irq;            /* our irq number */
 392         byte            major;          /* our major number */
 393         byte            select;         /* pri/sec hwif select for ht6560b */
 394         char            name[5];        /* name of interface, eg. "ide0" */
 395         unsigned        noprobe : 1;    /* don't probe for this interface */
 396         unsigned        present : 1;    /* this interface exists */
 397         unsigned        serialized : 1; /* valid only for ide_hwifs[0] */
 398 #if (DISK_RECOVERY_TIME > 0)
 399         unsigned long   last_time;      /* time when previous rq was done */
 400 #endif
 401 #ifdef CONFIG_BLK_DEV_IDECD
 402         struct request request_sense_request;   /* from ide-cd.c */
 403         struct packet_command request_sense_pc; /* from ide-cd.c */
 404 #endif /* CONFIG_BLK_DEV_IDECD */
 405 #ifdef CONFIG_BLK_DEV_IDETAPE
 406         ide_drive_t     *tape_drive;    /* Pointer to the tape on this interface */
 407 #endif /* CONFIG_BLK_DEV_IDETAPE */
 408         } ide_hwif_t;
 409 
 410 /*
 411  *  internal ide interrupt handler type
 412  */
 413 typedef void (ide_handler_t)(ide_drive_t *);
 414 
 415 typedef struct hwgroup_s {
 416         ide_handler_t           *handler;/* irq handler, if active */
 417         ide_drive_t             *drive; /* current drive */
 418         ide_hwif_t              *hwif;  /* ptr to current hwif in linked-list */
 419         struct request          *rq;    /* current request */
 420         struct timer_list       timer;  /* failsafe timer */
 421         struct request          wrq;    /* local copy of current write rq */
 422         unsigned long           poll_timeout;   /* timeout value during long polls */
 423         } ide_hwgroup_t;
 424 
 425 /*
 426  * One final include file, which references some of the data/defns from above
 427  */
 428 #define IDE_DRIVER      /* "parameter" for blk.h */
 429 #include <linux/blk.h>
 430 
 431 #if (DISK_RECOVERY_TIME > 0)
 432 void ide_set_recovery_timer (ide_hwif_t *);
 433 #define SET_RECOVERY_TIMER(drive) ide_set_recovery_timer (drive)
 434 #else
 435 #define SET_RECOVERY_TIMER(drive)
 436 #endif
 437 
 438 /*
 439  * This is used for (nearly) all data transfers from the IDE interface
 440  */
 441 void ide_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount);
 442 
 443 /*
 444  * This is used for (nearly) all data transfers to the IDE interface
 445  */
 446 void ide_output_data (ide_drive_t *drive, void *buffer, unsigned int wcount);
 447 
 448 /*
 449  * This is used on exit from the driver, to designate the next irq handler
 450  * and also to start the safety timer.
 451  */
 452 void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout);
 453 
 454 /*
 455  * Error reporting, in human readable form (luxurious, but a memory hog).
 456  */
 457 byte ide_dump_status (ide_drive_t *drive, const char *msg, byte stat);
 458 
 459 /*
 460  * ide_error() takes action based on the error returned by the controller.
 461  * The calling function must return afterwards, to restart the request.
 462  */
 463 void ide_error (ide_drive_t *drive, const char *msg, byte stat);
 464 
 465 /*
 466  * ide_fixstring() cleans up and (optionally) byte-swaps a text string,
 467  * removing leading/trailing blanks and compressing internal blanks.
 468  * It is primarily used to tidy up the model name/number fields as
 469  * returned by the WIN_[P]IDENTIFY commands.
 470  */
 471 void ide_fixstring (byte *s, const int bytecount, const int byteswap);
 472 
 473 /*
 474  * This routine busy-waits for the drive status to be not "busy".
 475  * It then checks the status for all of the "good" bits and none
 476  * of the "bad" bits, and if all is okay it returns 0.  All other
 477  * cases return 1 after invoking ide_error() -- caller should return.
 478  *
 479  */
 480 int ide_wait_stat (ide_drive_t *drive, byte good, byte bad, unsigned long timeout);
 481 
 482 /*
 483  * This is called from genhd.c to correct DiskManager/EZ-Drive geometries
 484  */
 485 int ide_xlate_1024(kdev_t, int, const char *);
 486 
 487 /*
 488  * Start a reset operation for an IDE interface.
 489  * The caller should return immediately after invoking this.
 490  */
 491 void ide_do_reset (ide_drive_t *);
 492 
 493 /*
 494  * This function is intended to be used prior to invoking ide_do_drive_cmd().
 495  */
 496 void ide_init_drive_cmd (struct request *rq);
 497 
 498 /*
 499  * "action" parameter type for ide_do_drive_cmd() below.
 500  */
 501 typedef enum
 502         {ide_wait,      /* insert rq at end of list, and wait for it */
 503          ide_next,      /* insert rq immediately after current request */
 504          ide_preempt,   /* insert rq in front of current request */
 505          ide_end}       /* insert rq at end of list, but don't wait for it */
 506  ide_action_t;
 507 
 508 /*
 509  * This function issues a special IDE device request
 510  * onto the request queue.
 511  *
 512  * If action is ide_wait, then then rq is queued at the end of
 513  * the request queue, and the function sleeps until it has been
 514  * processed.  This is for use when invoked from an ioctl handler.
 515  *
 516  * If action is ide_preempt, then the rq is queued at the head of
 517  * the request queue, displacing the currently-being-processed
 518  * request and this function returns immediately without waiting
 519  * for the new rq to be completed.  This is VERY DANGEROUS, and is
 520  * intended for careful use by the ATAPI tape/cdrom driver code.
 521  *
 522  * If action is ide_next, then the rq is queued immediately after
 523  * the currently-being-processed-request (if any), and the function
 524  * returns without waiting for the new rq to be completed.  As above,
 525  * This is VERY DANGEROUS, and is intended for careful use by the 
 526  * ATAPI tape/cdrom driver code.
 527  *
 528  * If action is ide_end, then the rq is queued at the end of the
 529  * request queue, and the function returns immediately without waiting
 530  * for the new rq to be completed. This is again intended for careful
 531  * use by the ATAPI tape/cdrom driver code. (Currently used by ide-tape.c,
 532  * when operating in the pipelined operation mode).
 533  */
 534 int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t action);
 535  
 536 /*
 537  * Clean up after success/failure of an explicit drive cmd.
 538  * stat/err are used only when (HWGROUP(drive)->rq->cmd == IDE_DRIVE_CMD).
 539  */
 540 void ide_end_drive_cmd (ide_drive_t *drive, byte stat, byte err);
 541 
 542 #ifdef CONFIG_BLK_DEV_IDECD
 543 /*
 544  * These are routines in ide-cd.c invoked from ide.c
 545  */
 546 void ide_do_rw_cdrom (ide_drive_t *, unsigned long);
 547 int ide_cdrom_ioctl (ide_drive_t *, struct inode *, struct file *, unsigned int, unsigned long);
 548 int ide_cdrom_check_media_change (ide_drive_t *);
 549 int ide_cdrom_open (struct inode *, struct file *, ide_drive_t *);
 550 void ide_cdrom_release (struct inode *, struct file *, ide_drive_t *);
 551 void ide_cdrom_setup (ide_drive_t *);
 552 #endif /* CONFIG_BLK_DEV_IDECD */
 553 
 554 #ifdef CONFIG_BLK_DEV_IDETAPE
 555 
 556 /*
 557  *      Functions in ide-tape.c which are invoked from ide.c:
 558  */
 559 
 560 /*
 561  *      idetape_identify_device is called during device probing stage to
 562  *      probe for an ide atapi tape drive and to initialize global variables
 563  *      in ide-tape.c which provide the link between the character device
 564  *      and the correspoding block device.
 565  *
 566  *      Returns 1 if an ide tape was detected and is supported.
 567  *      Returns 0 otherwise.
 568  */
 569  
 570 int idetape_identify_device (ide_drive_t *drive,struct hd_driveid *id);
 571 
 572 /*
 573  *      idetape_setup is called a bit later than idetape_identify_device,
 574  *      during the search for disk partitions, to initialize various tape
 575  *      state variables in ide_drive_t *drive.
 576  */
 577  
 578 void idetape_setup (ide_drive_t *drive);
 579 
 580 /*
 581  *      idetape_do_request is our request function. It is called by ide.c
 582  *      to process a new request.
 583  */
 584 
 585 void idetape_do_request (ide_drive_t *drive, struct request *rq, unsigned long block);
 586 
 587 /*
 588  *      Block device interface functions.
 589  */
 590   
 591 int idetape_blkdev_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file,
 592                         unsigned int cmd, unsigned long arg);
 593 int idetape_blkdev_open (struct inode *inode, struct file *filp, ide_drive_t *drive);
 594 void idetape_blkdev_release (struct inode *inode, struct file *filp, ide_drive_t *drive);
 595 
 596 /*
 597  *      idetape_register_chrdev initializes the character device interface to
 598  *      the ide tape drive.
 599  */
 600  
 601 void idetape_register_chrdev (void);
 602 
 603 #endif /* CONFIG_BLK_DEV_IDETAPE */
 604 
 605 #ifdef CONFIG_BLK_DEV_TRITON
 606 void ide_init_triton (byte, byte);
 607 #endif /* CONFIG_BLK_DEV_TRITON */

/* [previous][next][first][last][top][bottom][index][help] */