18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Ver 0.1 Nov 1 95 Pre-working code :-) 38c2ecf20Sopenharmony_ci * Ver 0.2 Nov 23 95 A short backup (few megabytes) and restore procedure 48c2ecf20Sopenharmony_ci * was successful ! (Using tar cvf ... on the block 58c2ecf20Sopenharmony_ci * device interface). 68c2ecf20Sopenharmony_ci * A longer backup resulted in major swapping, bad 78c2ecf20Sopenharmony_ci * overall Linux performance and eventually failed as 88c2ecf20Sopenharmony_ci * we received non serial read-ahead requests from the 98c2ecf20Sopenharmony_ci * buffer cache. 108c2ecf20Sopenharmony_ci * Ver 0.3 Nov 28 95 Long backups are now possible, thanks to the 118c2ecf20Sopenharmony_ci * character device interface. Linux's responsiveness 128c2ecf20Sopenharmony_ci * and performance doesn't seem to be much affected 138c2ecf20Sopenharmony_ci * from the background backup procedure. 148c2ecf20Sopenharmony_ci * Some general mtio.h magnetic tape operations are 158c2ecf20Sopenharmony_ci * now supported by our character device. As a result, 168c2ecf20Sopenharmony_ci * popular tape utilities are starting to work with 178c2ecf20Sopenharmony_ci * ide tapes :-) 188c2ecf20Sopenharmony_ci * The following configurations were tested: 198c2ecf20Sopenharmony_ci * 1. An IDE ATAPI TAPE shares the same interface 208c2ecf20Sopenharmony_ci * and irq with an IDE ATAPI CDROM. 218c2ecf20Sopenharmony_ci * 2. An IDE ATAPI TAPE shares the same interface 228c2ecf20Sopenharmony_ci * and irq with a normal IDE disk. 238c2ecf20Sopenharmony_ci * Both configurations seemed to work just fine ! 248c2ecf20Sopenharmony_ci * However, to be on the safe side, it is meanwhile 258c2ecf20Sopenharmony_ci * recommended to give the IDE TAPE its own interface 268c2ecf20Sopenharmony_ci * and irq. 278c2ecf20Sopenharmony_ci * The one thing which needs to be done here is to 288c2ecf20Sopenharmony_ci * add a "request postpone" feature to ide.c, 298c2ecf20Sopenharmony_ci * so that we won't have to wait for the tape to finish 308c2ecf20Sopenharmony_ci * performing a long media access (DSC) request (such 318c2ecf20Sopenharmony_ci * as a rewind) before we can access the other device 328c2ecf20Sopenharmony_ci * on the same interface. This effect doesn't disturb 338c2ecf20Sopenharmony_ci * normal operation most of the time because read/write 348c2ecf20Sopenharmony_ci * requests are relatively fast, and once we are 358c2ecf20Sopenharmony_ci * performing one tape r/w request, a lot of requests 368c2ecf20Sopenharmony_ci * from the other device can be queued and ide.c will 378c2ecf20Sopenharmony_ci * service all of them after this single tape request. 388c2ecf20Sopenharmony_ci * Ver 1.0 Dec 11 95 Integrated into Linux 1.3.46 development tree. 398c2ecf20Sopenharmony_ci * On each read / write request, we now ask the drive 408c2ecf20Sopenharmony_ci * if we can transfer a constant number of bytes 418c2ecf20Sopenharmony_ci * (a parameter of the drive) only to its buffers, 428c2ecf20Sopenharmony_ci * without causing actual media access. If we can't, 438c2ecf20Sopenharmony_ci * we just wait until we can by polling the DSC bit. 448c2ecf20Sopenharmony_ci * This ensures that while we are not transferring 458c2ecf20Sopenharmony_ci * more bytes than the constant referred to above, the 468c2ecf20Sopenharmony_ci * interrupt latency will not become too high and 478c2ecf20Sopenharmony_ci * we won't cause an interrupt timeout, as happened 488c2ecf20Sopenharmony_ci * occasionally in the previous version. 498c2ecf20Sopenharmony_ci * While polling for DSC, the current request is 508c2ecf20Sopenharmony_ci * postponed and ide.c is free to handle requests from 518c2ecf20Sopenharmony_ci * the other device. This is handled transparently to 528c2ecf20Sopenharmony_ci * ide.c. The hwgroup locking method which was used 538c2ecf20Sopenharmony_ci * in the previous version was removed. 548c2ecf20Sopenharmony_ci * Use of new general features which are provided by 558c2ecf20Sopenharmony_ci * ide.c for use with atapi devices. 568c2ecf20Sopenharmony_ci * (Programming done by Mark Lord) 578c2ecf20Sopenharmony_ci * Few potential bug fixes (Again, suggested by Mark) 588c2ecf20Sopenharmony_ci * Single character device data transfers are now 598c2ecf20Sopenharmony_ci * not limited in size, as they were before. 608c2ecf20Sopenharmony_ci * We are asking the tape about its recommended 618c2ecf20Sopenharmony_ci * transfer unit and send a larger data transfer 628c2ecf20Sopenharmony_ci * as several transfers of the above size. 638c2ecf20Sopenharmony_ci * For best results, use an integral number of this 648c2ecf20Sopenharmony_ci * basic unit (which is shown during driver 658c2ecf20Sopenharmony_ci * initialization). I will soon add an ioctl to get 668c2ecf20Sopenharmony_ci * this important parameter. 678c2ecf20Sopenharmony_ci * Our data transfer buffer is allocated on startup, 688c2ecf20Sopenharmony_ci * rather than before each data transfer. This should 698c2ecf20Sopenharmony_ci * ensure that we will indeed have a data buffer. 708c2ecf20Sopenharmony_ci * Ver 1.1 Dec 14 95 Fixed random problems which occurred when the tape 718c2ecf20Sopenharmony_ci * shared an interface with another device. 728c2ecf20Sopenharmony_ci * (poll_for_dsc was a complete mess). 738c2ecf20Sopenharmony_ci * Removed some old (non-active) code which had 748c2ecf20Sopenharmony_ci * to do with supporting buffer cache originated 758c2ecf20Sopenharmony_ci * requests. 768c2ecf20Sopenharmony_ci * The block device interface can now be opened, so 778c2ecf20Sopenharmony_ci * that general ide driver features like the unmask 788c2ecf20Sopenharmony_ci * interrupts flag can be selected with an ioctl. 798c2ecf20Sopenharmony_ci * This is the only use of the block device interface. 808c2ecf20Sopenharmony_ci * New fast pipelined operation mode (currently only on 818c2ecf20Sopenharmony_ci * writes). When using the pipelined mode, the 828c2ecf20Sopenharmony_ci * throughput can potentially reach the maximum 838c2ecf20Sopenharmony_ci * tape supported throughput, regardless of the 848c2ecf20Sopenharmony_ci * user backup program. On my tape drive, it sometimes 858c2ecf20Sopenharmony_ci * boosted performance by a factor of 2. Pipelined 868c2ecf20Sopenharmony_ci * mode is enabled by default, but since it has a few 878c2ecf20Sopenharmony_ci * downfalls as well, you may want to disable it. 888c2ecf20Sopenharmony_ci * A short explanation of the pipelined operation mode 898c2ecf20Sopenharmony_ci * is available below. 908c2ecf20Sopenharmony_ci * Ver 1.2 Jan 1 96 Eliminated pipelined mode race condition. 918c2ecf20Sopenharmony_ci * Added pipeline read mode. As a result, restores 928c2ecf20Sopenharmony_ci * are now as fast as backups. 938c2ecf20Sopenharmony_ci * Optimized shared interface behavior. The new behavior 948c2ecf20Sopenharmony_ci * typically results in better IDE bus efficiency and 958c2ecf20Sopenharmony_ci * higher tape throughput. 968c2ecf20Sopenharmony_ci * Pre-calculation of the expected read/write request 978c2ecf20Sopenharmony_ci * service time, based on the tape's parameters. In 988c2ecf20Sopenharmony_ci * the pipelined operation mode, this allows us to 998c2ecf20Sopenharmony_ci * adjust our polling frequency to a much lower value, 1008c2ecf20Sopenharmony_ci * and thus to dramatically reduce our load on Linux, 1018c2ecf20Sopenharmony_ci * without any decrease in performance. 1028c2ecf20Sopenharmony_ci * Implemented additional mtio.h operations. 1038c2ecf20Sopenharmony_ci * The recommended user block size is returned by 1048c2ecf20Sopenharmony_ci * the MTIOCGET ioctl. 1058c2ecf20Sopenharmony_ci * Additional minor changes. 1068c2ecf20Sopenharmony_ci * Ver 1.3 Feb 9 96 Fixed pipelined read mode bug which prevented the 1078c2ecf20Sopenharmony_ci * use of some block sizes during a restore procedure. 1088c2ecf20Sopenharmony_ci * The character device interface will now present a 1098c2ecf20Sopenharmony_ci * continuous view of the media - any mix of block sizes 1108c2ecf20Sopenharmony_ci * during a backup/restore procedure is supported. The 1118c2ecf20Sopenharmony_ci * driver will buffer the requests internally and 1128c2ecf20Sopenharmony_ci * convert them to the tape's recommended transfer 1138c2ecf20Sopenharmony_ci * unit, making performance almost independent of the 1148c2ecf20Sopenharmony_ci * chosen user block size. 1158c2ecf20Sopenharmony_ci * Some improvements in error recovery. 1168c2ecf20Sopenharmony_ci * By cooperating with ide-dma.c, bus mastering DMA can 1178c2ecf20Sopenharmony_ci * now sometimes be used with IDE tape drives as well. 1188c2ecf20Sopenharmony_ci * Bus mastering DMA has the potential to dramatically 1198c2ecf20Sopenharmony_ci * reduce the CPU's overhead when accessing the device, 1208c2ecf20Sopenharmony_ci * and can be enabled by using hdparm -d1 on the tape's 1218c2ecf20Sopenharmony_ci * block device interface. For more info, read the 1228c2ecf20Sopenharmony_ci * comments in ide-dma.c. 1238c2ecf20Sopenharmony_ci * Ver 1.4 Mar 13 96 Fixed serialize support. 1248c2ecf20Sopenharmony_ci * Ver 1.5 Apr 12 96 Fixed shared interface operation, broken in 1.3.85. 1258c2ecf20Sopenharmony_ci * Fixed pipelined read mode inefficiency. 1268c2ecf20Sopenharmony_ci * Fixed nasty null dereferencing bug. 1278c2ecf20Sopenharmony_ci * Ver 1.6 Aug 16 96 Fixed FPU usage in the driver. 1288c2ecf20Sopenharmony_ci * Fixed end of media bug. 1298c2ecf20Sopenharmony_ci * Ver 1.7 Sep 10 96 Minor changes for the CONNER CTT8000-A model. 1308c2ecf20Sopenharmony_ci * Ver 1.8 Sep 26 96 Attempt to find a better balance between good 1318c2ecf20Sopenharmony_ci * interactive response and high system throughput. 1328c2ecf20Sopenharmony_ci * Ver 1.9 Nov 5 96 Automatically cross encountered filemarks rather 1338c2ecf20Sopenharmony_ci * than requiring an explicit FSF command. 1348c2ecf20Sopenharmony_ci * Abort pending requests at end of media. 1358c2ecf20Sopenharmony_ci * MTTELL was sometimes returning incorrect results. 1368c2ecf20Sopenharmony_ci * Return the real block size in the MTIOCGET ioctl. 1378c2ecf20Sopenharmony_ci * Some error recovery bug fixes. 1388c2ecf20Sopenharmony_ci * Ver 1.10 Nov 5 96 Major reorganization. 1398c2ecf20Sopenharmony_ci * Reduced CPU overhead a bit by eliminating internal 1408c2ecf20Sopenharmony_ci * bounce buffers. 1418c2ecf20Sopenharmony_ci * Added module support. 1428c2ecf20Sopenharmony_ci * Added multiple tape drives support. 1438c2ecf20Sopenharmony_ci * Added partition support. 1448c2ecf20Sopenharmony_ci * Rewrote DSC handling. 1458c2ecf20Sopenharmony_ci * Some portability fixes. 1468c2ecf20Sopenharmony_ci * Removed ide-tape.h. 1478c2ecf20Sopenharmony_ci * Additional minor changes. 1488c2ecf20Sopenharmony_ci * Ver 1.11 Dec 2 96 Bug fix in previous DSC timeout handling. 1498c2ecf20Sopenharmony_ci * Use ide_stall_queue() for DSC overlap. 1508c2ecf20Sopenharmony_ci * Use the maximum speed rather than the current speed 1518c2ecf20Sopenharmony_ci * to compute the request service time. 1528c2ecf20Sopenharmony_ci * Ver 1.12 Dec 7 97 Fix random memory overwriting and/or last block data 1538c2ecf20Sopenharmony_ci * corruption, which could occur if the total number 1548c2ecf20Sopenharmony_ci * of bytes written to the tape was not an integral 1558c2ecf20Sopenharmony_ci * number of tape blocks. 1568c2ecf20Sopenharmony_ci * Add support for INTERRUPT DRQ devices. 1578c2ecf20Sopenharmony_ci * Ver 1.13 Jan 2 98 Add "speed == 0" work-around for HP COLORADO 5GB 1588c2ecf20Sopenharmony_ci * Ver 1.14 Dec 30 98 Partial fixes for the Sony/AIWA tape drives. 1598c2ecf20Sopenharmony_ci * Replace cli()/sti() with hwgroup spinlocks. 1608c2ecf20Sopenharmony_ci * Ver 1.15 Mar 25 99 Fix SMP race condition by replacing hwgroup 1618c2ecf20Sopenharmony_ci * spinlock with private per-tape spinlock. 1628c2ecf20Sopenharmony_ci * Ver 1.16 Sep 1 99 Add OnStream tape support. 1638c2ecf20Sopenharmony_ci * Abort read pipeline on EOD. 1648c2ecf20Sopenharmony_ci * Wait for the tape to become ready in case it returns 1658c2ecf20Sopenharmony_ci * "in the process of becoming ready" on open(). 1668c2ecf20Sopenharmony_ci * Fix zero padding of the last written block in 1678c2ecf20Sopenharmony_ci * case the tape block size is larger than PAGE_SIZE. 1688c2ecf20Sopenharmony_ci * Decrease the default disconnection time to tn. 1698c2ecf20Sopenharmony_ci * Ver 1.16e Oct 3 99 Minor fixes. 1708c2ecf20Sopenharmony_ci * Ver 1.16e1 Oct 13 99 Patches by Arnold Niessen, 1718c2ecf20Sopenharmony_ci * niessen@iae.nl / arnold.niessen@philips.com 1728c2ecf20Sopenharmony_ci * GO-1) Undefined code in idetape_read_position 1738c2ecf20Sopenharmony_ci * according to Gadi's email 1748c2ecf20Sopenharmony_ci * AJN-1) Minor fix asc == 11 should be asc == 0x11 1758c2ecf20Sopenharmony_ci * in idetape_issue_packet_command (did effect 1768c2ecf20Sopenharmony_ci * debugging output only) 1778c2ecf20Sopenharmony_ci * AJN-2) Added more debugging output, and 1788c2ecf20Sopenharmony_ci * added ide-tape: where missing. I would also 1798c2ecf20Sopenharmony_ci * like to add tape->name where possible 1808c2ecf20Sopenharmony_ci * AJN-3) Added different debug_level's 1818c2ecf20Sopenharmony_ci * via /proc/ide/hdc/settings 1828c2ecf20Sopenharmony_ci * "debug_level" determines amount of debugging output; 1838c2ecf20Sopenharmony_ci * can be changed using /proc/ide/hdx/settings 1848c2ecf20Sopenharmony_ci * 0 : almost no debugging output 1858c2ecf20Sopenharmony_ci * 1 : 0+output errors only 1868c2ecf20Sopenharmony_ci * 2 : 1+output all sensekey/asc 1878c2ecf20Sopenharmony_ci * 3 : 2+follow all chrdev related procedures 1888c2ecf20Sopenharmony_ci * 4 : 3+follow all procedures 1898c2ecf20Sopenharmony_ci * 5 : 4+include pc_stack rq_stack info 1908c2ecf20Sopenharmony_ci * 6 : 5+USE_COUNT updates 1918c2ecf20Sopenharmony_ci * AJN-4) Fixed timeout for retension in idetape_queue_pc_tail 1928c2ecf20Sopenharmony_ci * from 5 to 10 minutes 1938c2ecf20Sopenharmony_ci * AJN-5) Changed maximum number of blocks to skip when 1948c2ecf20Sopenharmony_ci * reading tapes with multiple consecutive write 1958c2ecf20Sopenharmony_ci * errors from 100 to 1000 in idetape_get_logical_blk 1968c2ecf20Sopenharmony_ci * Proposed changes to code: 1978c2ecf20Sopenharmony_ci * 1) output "logical_blk_num" via /proc 1988c2ecf20Sopenharmony_ci * 2) output "current_operation" via /proc 1998c2ecf20Sopenharmony_ci * 3) Either solve or document the fact that `mt rewind' is 2008c2ecf20Sopenharmony_ci * required after reading from /dev/nhtx to be 2018c2ecf20Sopenharmony_ci * able to rmmod the idetape module; 2028c2ecf20Sopenharmony_ci * Also, sometimes an application finishes but the 2038c2ecf20Sopenharmony_ci * device remains `busy' for some time. Same cause ? 2048c2ecf20Sopenharmony_ci * Proposed changes to release-notes: 2058c2ecf20Sopenharmony_ci * 4) write a simple `quickstart' section in the 2068c2ecf20Sopenharmony_ci * release notes; I volunteer if you don't want to 2078c2ecf20Sopenharmony_ci * 5) include a pointer to video4linux in the doc 2088c2ecf20Sopenharmony_ci * to stimulate video applications 2098c2ecf20Sopenharmony_ci * 6) release notes lines 331 and 362: explain what happens 2108c2ecf20Sopenharmony_ci * if the application data rate is higher than 1100 KB/s; 2118c2ecf20Sopenharmony_ci * similar approach to lower-than-500 kB/s ? 2128c2ecf20Sopenharmony_ci * 7) 6.6 Comparison; wouldn't it be better to allow different 2138c2ecf20Sopenharmony_ci * strategies for read and write ? 2148c2ecf20Sopenharmony_ci * Wouldn't it be better to control the tape buffer 2158c2ecf20Sopenharmony_ci * contents instead of the bandwidth ? 2168c2ecf20Sopenharmony_ci * 8) line 536: replace will by would (if I understand 2178c2ecf20Sopenharmony_ci * this section correctly, a hypothetical and unwanted situation 2188c2ecf20Sopenharmony_ci * is being described) 2198c2ecf20Sopenharmony_ci * Ver 1.16f Dec 15 99 Change place of the secondary OnStream header frames. 2208c2ecf20Sopenharmony_ci * Ver 1.17 Nov 2000 / Jan 2001 Marcel Mol, marcel@mesa.nl 2218c2ecf20Sopenharmony_ci * - Add idetape_onstream_mode_sense_tape_parameter_page 2228c2ecf20Sopenharmony_ci * function to get tape capacity in frames: tape->capacity. 2238c2ecf20Sopenharmony_ci * - Add support for DI-50 drives( or any DI- drive). 2248c2ecf20Sopenharmony_ci * - 'workaround' for read error/blank block around block 3000. 2258c2ecf20Sopenharmony_ci * - Implement Early warning for end of media for Onstream. 2268c2ecf20Sopenharmony_ci * - Cosmetic code changes for readability. 2278c2ecf20Sopenharmony_ci * - Idetape_position_tape should not use SKIP bit during 2288c2ecf20Sopenharmony_ci * Onstream read recovery. 2298c2ecf20Sopenharmony_ci * - Add capacity, logical_blk_num and first/last_frame_position 2308c2ecf20Sopenharmony_ci * to /proc/ide/hd?/settings. 2318c2ecf20Sopenharmony_ci * - Module use count was gone in the Linux 2.4 driver. 2328c2ecf20Sopenharmony_ci * Ver 1.17a Apr 2001 Willem Riede osst@riede.org 2338c2ecf20Sopenharmony_ci * - Get drive's actual block size from mode sense block descriptor 2348c2ecf20Sopenharmony_ci * - Limit size of pipeline 2358c2ecf20Sopenharmony_ci * Ver 1.17b Oct 2002 Alan Stern <stern@rowland.harvard.edu> 2368c2ecf20Sopenharmony_ci * Changed IDETAPE_MIN_PIPELINE_STAGES to 1 and actually used 2378c2ecf20Sopenharmony_ci * it in the code! 2388c2ecf20Sopenharmony_ci * Actually removed aborted stages in idetape_abort_pipeline 2398c2ecf20Sopenharmony_ci * instead of just changing the command code. 2408c2ecf20Sopenharmony_ci * Made the transfer byte count for Request Sense equal to the 2418c2ecf20Sopenharmony_ci * actual length of the data transfer. 2428c2ecf20Sopenharmony_ci * Changed handling of partial data transfers: they do not 2438c2ecf20Sopenharmony_ci * cause DMA errors. 2448c2ecf20Sopenharmony_ci * Moved initiation of DMA transfers to the correct place. 2458c2ecf20Sopenharmony_ci * Removed reference to unallocated memory. 2468c2ecf20Sopenharmony_ci * Made __idetape_discard_read_pipeline return the number of 2478c2ecf20Sopenharmony_ci * sectors skipped, not the number of stages. 2488c2ecf20Sopenharmony_ci * Replaced errant kfree() calls with __idetape_kfree_stage(). 2498c2ecf20Sopenharmony_ci * Fixed off-by-one error in testing the pipeline length. 2508c2ecf20Sopenharmony_ci * Fixed handling of filemarks in the read pipeline. 2518c2ecf20Sopenharmony_ci * Small code optimization for MTBSF and MTBSFM ioctls. 2528c2ecf20Sopenharmony_ci * Don't try to unlock the door during device close if is 2538c2ecf20Sopenharmony_ci * already unlocked! 2548c2ecf20Sopenharmony_ci * Cosmetic fixes to miscellaneous debugging output messages. 2558c2ecf20Sopenharmony_ci * Set the minimum /proc/ide/hd?/settings values for "pipeline", 2568c2ecf20Sopenharmony_ci * "pipeline_min", and "pipeline_max" to 1. 2578c2ecf20Sopenharmony_ci */ 258