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 #undefREALLY_FAST_IO/* define if ide ports are perfect */ 26 #defineINITIAL_MULT_COUNT 0 /* off=0; on=2,4,8,16,32, etc.. */ 27
28 #ifndefDISK_RECOVERY_TIME/* off=0; on=access_delay_time */ 29 #defineDISK_RECOVERY_TIME 0 /* for hardware that needs it */ 30 #endif 31 #ifndefOK_TO_RESET_CONTROLLER/* 1 needed for good error recovery */ 32 #defineOK_TO_RESET_CONTROLLER 1 /* 0 for use with AH2372A/B interface */ 33 #endif 34 #ifndefFAKE_FDISK_FOR_EZDRIVE/* 1 to help linux fdisk with EZDRIVE */ 35 #defineFAKE_FDISK_FOR_EZDRIVE 1 /* 0 to reduce kernel size */ 36 #endif 37 #ifndefSUPPORT_RZ1000/* 1 to support RZ1000 chipset */ 38 #defineSUPPORT_RZ1000 1 /* 0 to reduce kernel size */ 39 #endif 40 #ifndefSUPPORT_CMD640/* 1 to support CMD640 chipset */ 41 #defineSUPPORT_CMD640 1 /* 0 to reduce kernel size */ 42 #endif 43 #ifndefSUPPORT_UMC8672/* 1 to support UMC8672 chipset */ 44 #defineSUPPORT_UMC8672 1 /* 0 to reduce kernel size */ 45 #endif 46 #ifndefSUPPORT_HT6560B/* 1 to support HT6560B chipset */ 47 #defineSUPPORT_HT6560B 1 /* 0 to reduce kernel size */ 48 #endif 49 #ifndefSUPPORT_QD6580/* 1 to support QD6580 chipset */ 50 #defineSUPPORT_QD6580 1 /* 0 to reduce kernel size */ 51 #endif 52 #ifndefSUPPORT_DTC2278/* 1 to support DTC2278 chipset */ 53 #defineSUPPORT_DTC2278 1 /* 0 to reduce kernel size */ 54 #ifndefSET_DTC2278_MODE4 55 #defineSET_DTC2278_MODE4 0 /* 1 to init primary i/f for PIO mode4 */ 56 #endif 57 #endif 58 #ifndefFANCY_STATUS_DUMPS/* 1 for human-readable drive errors */ 59 #defineFANCY_STATUS_DUMPS 1 /* 0 to reduce kernel size */ 60 #endif 61
62 /* 63 * IDE_DRIVE_CMD is used to implement many features of the hdparm utility 64 */ 65 #defineIDE_DRIVE_CMD 99 /* (magic) undef to reduce kernel size*/ 66
67 /* 68 * "No user-serviceable parts" beyond this point :) 69 *****************************************************************************/ 70
71 typedefunsignedcharbyte; /* used everywhere */ 72
73 /* 74 * Probably not wise to fiddle with these 75 */ 76 #defineERROR_MAX 8 /* Max read/write errors per sector */ 77 #defineERROR_RESET 3 /* Reset controller every 4th retry */ 78 #defineERROR_RECAL 1 /* Recalibrate every 2nd retry */ 79
80 /* 81 * Ensure that various configuration flags have compatible settings 82 */ 83 #ifdefREALLY_SLOW_IO 84 #undefREALLY_FAST_IO 85 #endif 86
87 /* 88 * Definitions for accessing IDE controller registers 89 */ 90
91 #defineHWIF(drive) ((ide_hwif_t *)drive->hwif)
92 #defineHWGROUP(drive) ((ide_hwgroup_t *)(HWIF(drive)->hwgroup))
93
94 #defineIDE_DATA_OFFSET (0)
95 #defineIDE_ERROR_OFFSET (1)
96 #defineIDE_NSECTOR_OFFSET (2)
97 #defineIDE_SECTOR_OFFSET (3)
98 #defineIDE_LCYL_OFFSET (4)
99 #defineIDE_HCYL_OFFSET (5)
100 #defineIDE_SELECT_OFFSET (6)
101 #defineIDE_STATUS_OFFSET (7)
102 #defineIDE_FEATURE_OFFSETIDE_ERROR_OFFSET 103 #defineIDE_COMMAND_OFFSETIDE_STATUS_OFFSET 104
105 #defineIDE_DATA_REG (HWIF(drive)->io_base+IDE_DATA_OFFSET)
106 #defineIDE_ERROR_REG (HWIF(drive)->io_base+IDE_ERROR_OFFSET)
107 #defineIDE_NSECTOR_REG (HWIF(drive)->io_base+IDE_NSECTOR_OFFSET)
108 #defineIDE_SECTOR_REG (HWIF(drive)->io_base+IDE_SECTOR_OFFSET)
109 #defineIDE_LCYL_REG (HWIF(drive)->io_base+IDE_LCYL_OFFSET)
110 #defineIDE_HCYL_REG (HWIF(drive)->io_base+IDE_HCYL_OFFSET)
111 #defineIDE_SELECT_REG (HWIF(drive)->io_base+IDE_SELECT_OFFSET)
112 #defineIDE_STATUS_REG (HWIF(drive)->io_base+IDE_STATUS_OFFSET)
113 #defineIDE_CONTROL_REG (HWIF(drive)->ctl_port)
114 #defineIDE_FEATURE_REGIDE_ERROR_REG 115 #defineIDE_COMMAND_REGIDE_STATUS_REG 116 #defineIDE_ALTSTATUS_REGIDE_CONTROL_REG 117
118 #ifdefREALLY_FAST_IO 119 #defineOUT_BYTE(b,p) outb((b),p)
120 #defineIN_BYTE(p) (byte)inb(p)
121 #else 122 #defineOUT_BYTE(b,p) outb_p((b),p)
123 #defineIN_BYTE(p) (byte)inb_p(p)
124 #endif/* REALLY_FAST_IO */ 125
126 #defineGET_ERR() IN_BYTE(IDE_ERROR_REG)
127 #defineGET_STAT() IN_BYTE(IDE_STATUS_REG)
128 #defineOK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good))
129 #defineBAD_R_STAT (BUSY_STAT | ERR_STAT)
130 #defineBAD_W_STAT (BAD_R_STAT | WRERR_STAT)
131 #defineBAD_STAT (BAD_R_STAT | DRQ_STAT)
132 #defineDRIVE_READY (READY_STAT | SEEK_STAT)
133 #defineDATA_READY (DRIVE_READY | DRQ_STAT)
134
135 /* 136 * Some more useful definitions 137 */ 138 #defineIDE_MAJOR_NAME "ide" /* the same for all i/f; see also genhd.c */ 139 #define MAJOR_NAME IDE_MAJOR_NAME 140 #definePARTN_BITS 6 /* number of minor dev bits for partitions */ 141 #definePARTN_MASK ((1<<PARTN_BITS)-1) /* a useful bit mask */ 142 #defineMAX_DRIVES 2 /* per interface; 2 assumed by lots of code */ 143 #defineMAX_HWIFS 4 /* an arbitrary, but realistic limit */ 144 #defineSECTOR_WORDS (512 / 4) /* number of 32bit words per sector */ 145
146 /* 147 * Timeouts for various operations: 148 */ 149 #defineWAIT_DRQ (5*HZ/100) /* 50msec - spec allows up to 20ms */ 150 #defineWAIT_READY (3*HZ/100) /* 30msec - should be instantaneous */ 151 #defineWAIT_PIDENTIFY (1*HZ) /* 1sec - should be less than 3ms (?) */ 152 #defineWAIT_WORSTCASE (30*HZ) /* 30sec - worst case when spinning up */ 153 #defineWAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */ 154
155 #ifdefCONFIG_BLK_DEV_IDETAPE 156 #include "ide-tape.h"
157 #endif/* CONFIG_BLK_DEV_IDETAPE */ 158
159 #ifdefCONFIG_BLK_DEV_IDECD 160
161 structatapi_request_sense{ 162 unsignedcharerror_code : 7;
163 unsignedcharvalid : 1;
164 bytereserved1;
165 unsignedcharsense_key : 4;
166 unsignedcharreserved2 : 1;
167 unsignedcharili : 1;
168 unsignedcharreserved3 : 2;
169 byteinfo[4];
170 bytesense_len;
171 byte command_info[4];
172 byteasc;
173 byteascq;
174 byte fru;
175 bytesense_key_specific[3];
176 };
177
178 structpacket_command{ 179 char *buffer;
180 intbuflen;
181 intstat;
182 structatapi_request_sense *sense_data;
183 unsignedcharc[12];
184 };
185
186 /* Space to hold the disk TOC. */ 187
188 #defineMAX_TRACKS 99
189 structatapi_toc_header{ 190 unsignedshorttoc_length;
191 bytefirst_track;
192 bytelast_track;
193 };
194
195 structatapi_toc_entry{ 196 bytereserved1;
197 unsignedcontrol : 4;
198 unsignedadr : 4;
199 bytetrack;
200 bytereserved2;
201 union{ 202 unsignedlba;
203 struct{ 204 bytereserved3;
205 bytem;
206 bytes;
207 bytef;
208 }msf;
209 }addr;
210 };
211
212 structatapi_toc{ 213 intlast_session_lba;
214 intxa_flag;
215 unsignedcapacity;
216 structatapi_toc_headerhdr;
217 structatapi_toc_entryent[MAX_TRACKS+1]; /* One extra for the leadout. */ 218 };
219
220
221 /* This structure is annoyingly close to, but not identical with, 222 the cdrom_subchnl structure from cdrom.h. */ 223 structatapi_cdrom_subchnl 224 { 225 u_char acdsc_reserved;
226 u_characdsc_audiostatus;
227 u_short acdsc_length;
228 u_char acdsc_format;
229
230 u_char acdsc_adr: 4;
231 u_characdsc_ctrl: 4;
232 u_characdsc_trk;
233 u_characdsc_ind;
234 union 235 { 236 struct 237 { 238 u_charminute;
239 u_charsecond;
240 u_charframe;
241 }msf;
242 intlba;
243 }acdsc_absaddr;
244 union 245 { 246 struct 247 { 248 u_charminute;
249 u_charsecond;
250 u_charframe;
251 }msf;
252 intlba;
253 }acdsc_reladdr;
254 };
255
256
257 /* Extra per-device info for cdrom drives. */ 258 structcdrom_info{ 259
260 /* Buffer for table of contents. NULL if we haven't allocated 261 a TOC buffer for this device yet. */ 262
263 structatapi_toc *toc;
264
265 /* Sector buffer. If a read request wants only the first part of a cdrom 266 block, we cache the rest of the block here, in the expectation that that 267 data is going to be wanted soon. SECTOR_BUFFERED is the number of the 268 first buffered sector, and NSECTORS_BUFFERED is the number of sectors 269 in the buffer. Before the buffer is allocated, we should have 270 SECTOR_BUFFER == NULL and NSECTORS_BUFFERED == 0. */ 271
272 unsignedlongsector_buffered;
273 unsignedlongnsectors_buffered;
274 char *sector_buffer;
275
276 /* The result of the last successful request sense command 277 on this device. */ 278 structatapi_request_sensesense_data;
279 };
280
281 #endif/* CONFIG_BLK_DEV_IDECD */ 282
283 /* 284 * Now for the data we need to maintain per-drive: ide_drive_t 285 */ 286
287 typedefenum{ide_disk, ide_cdrom, ide_tape}ide_media_t;
288
289 typedefunion{ 290 unsignedall : 8; /* all of the bits together */ 291 struct{ 292 unsignedset_geometry : 1; /* respecify drive geometry */ 293 unsignedrecalibrate : 1; /* seek to cyl 0 */ 294 unsignedset_multmode : 1; /* set multmode count */ 295 unsignedreserved : 5; /* unused */ 296 }b;
297 }special_t;
298
299 typedefunion{ 300 unsignedall : 8; /* all of the bits together */ 301 struct{ 302 unsignedhead : 4; /* always zeros here */ 303 unsignedunit : 1; /* drive select number, 0 or 1 */ 304 unsigned bit5 : 1; /* always 1 */ 305 unsignedlba : 1; /* using LBA instead of CHS */ 306 unsigned bit7 : 1; /* always 1 */ 307 }b;
308 }select_t;
309
310 typedefstructide_drive_s{ 311 special_tspecial; /* special action flags */ 312 #ifFAKE_FDISK_FOR_EZDRIVE 313 unsignedezdrive : 1; /* flag: partitioned with ezdrive */ 314 #endif/* FAKE_FDISK_FOR_EZDRIVE */ 315 unsignedpresent : 1; /* drive is physically present */ 316 unsignednoprobe : 1; /* from: hdx=noprobe */ 317 unsignedkeep_settings : 1; /* restore settings after drive reset */ 318 unsignedbusy : 1; /* currently doing revalidate_disk() */ 319 unsignedvlb_32bit : 1; /* use 32bit in/out for data */ 320 unsignedvlb_sync : 1; /* needed for some 32bit chip sets */ 321 unsignedremoveable : 1; /* 1 if need to do check_media_change */ 322 unsignedusing_dma : 1; /* disk is using dma for read/write */ 323 unsignedunmask : 1; /* flag: okay to unmask other irqs */ 324 ide_media_tmedia; /* disk, cdrom, tape */ 325 select_tselect; /* basic drive/head select reg value */ 326 void *hwif; /* actually (ide_hwif_t *) */ 327 bytectl; /* "normal" value for IDE_CONTROL_REG */ 328 byteready_stat; /* min status value for drive ready */ 329 bytemult_count; /* current multiple sector setting */ 330 bytemult_req; /* requested multiple sector setting */ 331 bytechipset; /* interface chipset access method */ 332 bytebad_wstat; /* used for ignoring WRERR_STAT */ 333 bytesect0; /* offset of first sector for DM6:DDO */ 334 byteusage; /* current "open()" count for drive */ 335 bytehead; /* "real" number of heads */ 336 bytesect; /* "real" sectors per track */ 337 bytebios_head; /* BIOS/fdisk/LILO number of heads */ 338 bytebios_sect; /* BIOS/fdisk/LILO sectors per track */ 339 unsignedshortbios_cyl; /* BIOS/fdisk/LILO number of cyls */ 340 unsignedshortcyl; /* "real" number of cyls */ 341 structwait_queue *wqueue; /* used to wait for drive in open() */ 342 structhd_driveid *id; /* drive model identification info */ 343 structhd_struct *part; /* drive partition table */ 344 charname[4]; /* drive name, such as "hda" */ 345 #ifdefCONFIG_BLK_DEV_IDECD 346 structcdrom_infocdrom_info; /* from ide-cd.c */ 347 #endif/* CONFIG_BLK_DEV_IDECD */ 348
349 #ifdefCONFIG_BLK_DEV_IDETAPE/* ide-tape specific data */ 350
351 /* 352 * Most of our global data which we need to save even as we leave the 353 * driver due to an interrupt or a timer event is stored here. 354 * 355 * Additional global variables which provide the link between the 356 * character device interface to this structure are defined in 357 * ide-tape.c 358 */ 359
360 idetape_tape_ttape;
361
362 #endif/* CONFIG_BLK_DEV_IDETAPE */ 363
364 }ide_drive_t;
365
366 /* 367 * An ide_dmaproc_t() initiates/aborts DMA read/write operations on a drive. 368 * 369 * The caller is assumed to have selected the drive and programmed the drive's 370 * sector address using CHS or LBA. All that remains is to prepare for DMA 371 * and then issue the actual read/write DMA/PIO command to the drive. 372 * 373 * Returns 0 if all went well. 374 * Returns 1 if DMA read/write could not be started, in which case the caller 375 * should either try again later, or revert to PIO for the current request. 376 */ 377 typedefenum{ide_dma_read = 0, ide_dma_write = 1, ide_dma_abort = 2, ide_dma_check = 3}ide_dma_action_t;
378 typedefint (ide_dmaproc_t)(ide_dma_action_t, ide_drive_t *);
379
380 typedefstructhwif_s{ 381 structhwif_s *next; /* for linked-list in ide_hwgroup_t */ 382 void *hwgroup; /* actually (ide_hwgroup_t *) */ 383 unsignedshortio_base; /* base io port addr */ 384 unsignedshortctl_port; /* usually io_base+0x206 */ 385 ide_drive_tdrives[MAX_DRIVES]; /* drive info */ 386 structgendisk *gd; /* gendisk structure */ 387 ide_dmaproc_t *dmaproc; /* dma read/write/abort routine */ 388 unsignedlong *dmatable; /* dma physical region descriptor table */ 389 unsignedshortdma_base; /* base addr for dma ports (triton) */ 390 byteirq; /* our irq number */ 391 bytemajor; /* our major number */ 392 byteselect; /* pri/sec hwif select for ht6560b */ 393 charname[5]; /* name of interface, eg. "ide0" */ 394 unsignednoprobe : 1; /* don't probe for this interface */ 395 unsignedpresent : 1; /* this interface exists */ 396 #if (DISK_RECOVERY_TIME > 0)
397 unsignedlonglast_time; /* time when previous rq was done */ 398 #endif 399 #ifdefCONFIG_BLK_DEV_IDECD 400 structrequestrequest_sense_request; /* from ide-cd.c */ 401 structpacket_commandrequest_sense_pc; /* from ide-cd.c */ 402 #endif/* CONFIG_BLK_DEV_IDECD */ 403 #ifdefCONFIG_BLK_DEV_IDETAPE 404 ide_drive_t *tape_drive; /* Pointer to the tape on this interface */ 405 #endif/* CONFIG_BLK_DEV_IDETAPE */ 406 }ide_hwif_t;
407
408 /* 409 * internal ide interrupt handler type 410 */ 411 typedefvoid (ide_handler_t)(ide_drive_t *);
412
413 typedefstruct hwgroup_s { 414 ide_handler_t *handler;/* irq handler, if active */ 415 ide_drive_t *drive; /* current drive */ 416 ide_hwif_t *hwif; /* ptr to current hwif in linked-list */ 417 structrequest *rq; /* current request */ 418 structtimer_listtimer; /* failsafe timer */ 419 structrequestwrq; /* local copy of current write rq */ 420 unsignedlongpoll_timeout; /* timeout value during long polls */ 421 }ide_hwgroup_t;
422
423 /* 424 * One final include file, which references some of the data/defns from above 425 */ 426 #defineIDE_DRIVER/* "parameter" for blk.h */ 427 #include <linux/blk.h>
428
429 #if (DISK_RECOVERY_TIME > 0)
430 voidide_set_recovery_timer (ide_hwif_t *);
431 #defineSET_RECOVERY_TIMER(drive) ide_set_recovery_timer (drive)
432 #else 433 #defineSET_RECOVERY_TIMER(drive)
434 #endif 435
436 /* 437 * This is used for (nearly) all data transfers from the IDE interface 438 */ 439 voidide_input_data (ide_drive_t *drive, void *buffer, unsignedintwcount);
440
441 /* 442 * This is used for (nearly) all data transfers to the IDE interface 443 */ 444 voidide_output_data (ide_drive_t *drive, void *buffer, unsignedintwcount);
445
446 /* 447 * This is used on exit from the driver, to designate the next irq handler 448 * and also to start the safety timer. 449 */ 450 voidide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsignedinttimeout);
451
452 /* 453 * Error reporting, in human readable form (luxurious, but a memory hog). 454 */ 455 byteide_dump_status (ide_drive_t *drive, constchar *msg, bytestat);
456
457 /* 458 * ide_error() takes action based on the error returned by the controller. 459 * The calling function must return afterwards, to restart the request. 460 */ 461 voidide_error (ide_drive_t *drive, constchar *msg, bytestat);
462
463 /* 464 * ide_fixstring() cleans up and (optionally) byte-swaps a text string, 465 * removing leading/trailing blanks and compressing internal blanks. 466 * It is primarily used to tidy up the model name/number fields as 467 * returned by the WIN_[P]IDENTIFY commands. 468 */ 469 voidide_fixstring (byte *s, constintbytecount, constintbyteswap);
470
471 /* 472 * This routine busy-waits for the drive status to be not "busy". 473 * It then checks the status for all of the "good" bits and none 474 * of the "bad" bits, and if all is okay it returns 0. All other 475 * cases return 1 after invoking ide_error() -- caller should return. 476 * 477 */ 478 intide_wait_stat (ide_drive_t *drive, bytegood, bytebad, unsignedlongtimeout);
479
480 /* 481 * This is called from genhd.c to correct DiskManager/EZ-Drive geometries 482 */ 483 intide_xlate_1024(kdev_t, int, constchar *);
484
485 /* 486 * Start a reset operation for an IDE interface. 487 * The caller should return immediately after invoking this. 488 */ 489 voidide_do_reset (ide_drive_t *);
490
491 /* 492 * This function is intended to be used prior to invoking ide_do_drive_cmd(). 493 */ 494 voidide_init_drive_cmd (structrequest *rq);
495
496 /* 497 * "action" parameter type for ide_do_drive_cmd() below. 498 */ 499 typedefenum 500 {ide_wait, /* insert rq at end of list, and wait for it */ 501 ide_next, /* insert rq immediately after current request */ 502 ide_preempt, /* insert rq in front of current request */ 503 ide_end}/* insert rq at end of list, but don't wait for it */ 504 ide_action_t;
505
506 /* 507 * This function issues a special IDE device request 508 * onto the request queue. 509 * 510 * If action is ide_wait, then then rq is queued at the end of 511 * the request queue, and the function sleeps until it has been 512 * processed. This is for use when invoked from an ioctl handler. 513 * 514 * If action is ide_preempt, then the rq is queued at the head of 515 * the request queue, displacing the currently-being-processed 516 * request and this function returns immediately without waiting 517 * for the new rq to be completed. This is VERY DANGEROUS, and is 518 * intended for careful use by the ATAPI tape/cdrom driver code. 519 * 520 * If action is ide_next, then the rq is queued immediately after 521 * the currently-being-processed-request (if any), and the function 522 * returns without waiting for the new rq to be completed. As above, 523 * This is VERY DANGEROUS, and is intended for careful use by the 524 * ATAPI tape/cdrom driver code. 525 * 526 * If action is ide_end, then the rq is queued at the end of the 527 * request queue, and the function returns immediately without waiting 528 * for the new rq to be completed. This is again intended for careful 529 * use by the ATAPI tape/cdrom driver code. (Currently used by ide-tape.c, 530 * when operating in the pipelined operation mode). 531 */ 532 intide_do_drive_cmd (ide_drive_t *drive, structrequest *rq, ide_action_taction);
533
534 /* 535 * Clean up after success/failure of an explicit drive cmd. 536 * stat/err are used only when (HWGROUP(drive)->rq->cmd == IDE_DRIVE_CMD). 537 */ 538 voidide_end_drive_cmd (ide_drive_t *drive, bytestat, byteerr);
539
540 #ifdefCONFIG_BLK_DEV_IDECD 541 /* 542 * These are routines in ide-cd.c invoked from ide.c 543 */ 544 voidide_do_rw_cdrom (ide_drive_t *, unsignedlong);
545 intide_cdrom_ioctl (ide_drive_t *, structinode *, structfile *, unsignedint, unsignedlong);
546 intide_cdrom_check_media_change (ide_drive_t *);
547 intide_cdrom_open (structinode *, structfile *, ide_drive_t *);
548 voidide_cdrom_release (structinode *, structfile *, ide_drive_t *);
549 voidide_cdrom_setup (ide_drive_t *);
550 #endif/* CONFIG_BLK_DEV_IDECD */ 551
552 #ifdefCONFIG_BLK_DEV_IDETAPE 553
554 /* 555 * Functions in ide-tape.c which are invoked from ide.c: 556 */ 557
558 /* 559 * idetape_identify_device is called during device probing stage to 560 * probe for an ide atapi tape drive and to initialize global variables 561 * in ide-tape.c which provide the link between the character device 562 * and the correspoding block device. 563 * 564 * Returns 1 if an ide tape was detected and is supported. 565 * Returns 0 otherwise. 566 */ 567
568 intidetape_identify_device (ide_drive_t *drive,structhd_driveid *id);
569
570 /* 571 * idetape_setup is called a bit later than idetape_identify_device, 572 * during the search for disk partitions, to initialize various tape 573 * state variables in ide_drive_t *drive. 574 */ 575
576 voididetape_setup (ide_drive_t *drive);
577
578 /* 579 * idetape_do_request is our request function. It is called by ide.c 580 * to process a new request. 581 */ 582
583 voididetape_do_request (ide_drive_t *drive, structrequest *rq, unsignedlongblock);
584
585 /* 586 * Block device interface functions. 587 */ 588
589 intidetape_blkdev_ioctl (ide_drive_t *drive, structinode *inode, structfile *file,
590 unsignedintcmd, unsignedlongarg);
591 intidetape_blkdev_open (structinode *inode, structfile *filp, ide_drive_t *drive);
592 voididetape_blkdev_release (structinode *inode, structfile *filp, ide_drive_t *drive);
593
594 /* 595 * idetape_register_chrdev initializes the character device interface to 596 * the ide tape drive. 597 */ 598
599 voididetape_register_chrdev (void);
600
601 #endif/* CONFIG_BLK_DEV_IDETAPE */ 602
603 #ifdefCONFIG_BLK_DEV_TRITON 604 voidide_init_triton (byte, byte);
605 #endif/* CONFIG_BLK_DEV_TRITON */ 606