aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/ide-iops.c48
1 files changed, 23 insertions, 25 deletions
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 73ff16bf9f1c..cf6c3036ae7f 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -27,7 +27,7 @@
27#include <asm/uaccess.h> 27#include <asm/uaccess.h>
28#include <asm/io.h> 28#include <asm/io.h>
29 29
30void SELECT_DRIVE (ide_drive_t *drive) 30void SELECT_DRIVE(ide_drive_t *drive)
31{ 31{
32 ide_hwif_t *hwif = drive->hwif; 32 ide_hwif_t *hwif = drive->hwif;
33 const struct ide_port_ops *port_ops = hwif->port_ops; 33 const struct ide_port_ops *port_ops = hwif->port_ops;
@@ -84,7 +84,7 @@ void ide_fix_driveid(u16 *id)
84 * returned by the ATA_CMD_ID_ATA[PI] commands. 84 * returned by the ATA_CMD_ID_ATA[PI] commands.
85 */ 85 */
86 86
87void ide_fixstring (u8 *s, const int bytecount, const int byteswap) 87void ide_fixstring(u8 *s, const int bytecount, const int byteswap)
88{ 88{
89 u8 *p, *end = &s[bytecount & ~1]; /* bytecount must be even */ 89 u8 *p, *end = &s[bytecount & ~1]; /* bytecount must be even */
90 90
@@ -107,7 +107,6 @@ void ide_fixstring (u8 *s, const int bytecount, const int byteswap)
107 while (p != end) 107 while (p != end)
108 *p++ = '\0'; 108 *p++ = '\0';
109} 109}
110
111EXPORT_SYMBOL(ide_fixstring); 110EXPORT_SYMBOL(ide_fixstring);
112 111
113/* 112/*
@@ -121,7 +120,8 @@ EXPORT_SYMBOL(ide_fixstring);
121 * setting a timer to wake up at half second intervals thereafter, 120 * setting a timer to wake up at half second intervals thereafter,
122 * until timeout is achieved, before timing out. 121 * until timeout is achieved, before timing out.
123 */ 122 */
124static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad, unsigned long timeout, u8 *rstat) 123static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad,
124 unsigned long timeout, u8 *rstat)
125{ 125{
126 ide_hwif_t *hwif = drive->hwif; 126 ide_hwif_t *hwif = drive->hwif;
127 const struct ide_tp_ops *tp_ops = hwif->tp_ops; 127 const struct ide_tp_ops *tp_ops = hwif->tp_ops;
@@ -179,7 +179,8 @@ static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad, unsigned long ti
179 * The caller should return the updated value of "startstop" in this case, 179 * The caller should return the updated value of "startstop" in this case,
180 * "startstop" is unchanged when the function returns 0. 180 * "startstop" is unchanged when the function returns 0.
181 */ 181 */
182int ide_wait_stat(ide_startstop_t *startstop, ide_drive_t *drive, u8 good, u8 bad, unsigned long timeout) 182int ide_wait_stat(ide_startstop_t *startstop, ide_drive_t *drive, u8 good,
183 u8 bad, unsigned long timeout)
183{ 184{
184 int err; 185 int err;
185 u8 stat; 186 u8 stat;
@@ -199,7 +200,6 @@ int ide_wait_stat(ide_startstop_t *startstop, ide_drive_t *drive, u8 good, u8 ba
199 200
200 return err; 201 return err;
201} 202}
202
203EXPORT_SYMBOL(ide_wait_stat); 203EXPORT_SYMBOL(ide_wait_stat);
204 204
205/** 205/**
@@ -220,7 +220,6 @@ int ide_in_drive_list(u16 *id, const struct drive_list_entry *table)
220 return 1; 220 return 1;
221 return 0; 221 return 0;
222} 222}
223
224EXPORT_SYMBOL_GPL(ide_in_drive_list); 223EXPORT_SYMBOL_GPL(ide_in_drive_list);
225 224
226/* 225/*
@@ -245,7 +244,7 @@ static const struct drive_list_entry ivb_list[] = {
245 * All hosts that use the 80c ribbon must use! 244 * All hosts that use the 80c ribbon must use!
246 * The name is derived from upper byte of word 93 and the 80c ribbon. 245 * The name is derived from upper byte of word 93 and the 80c ribbon.
247 */ 246 */
248u8 eighty_ninty_three (ide_drive_t *drive) 247u8 eighty_ninty_three(ide_drive_t *drive)
249{ 248{
250 ide_hwif_t *hwif = drive->hwif; 249 ide_hwif_t *hwif = drive->hwif;
251 u16 *id = drive->id; 250 u16 *id = drive->id;
@@ -470,9 +469,8 @@ void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler,
470 __ide_set_handler(drive, handler, timeout, expiry); 469 __ide_set_handler(drive, handler, timeout, expiry);
471 spin_unlock_irqrestore(&hwif->lock, flags); 470 spin_unlock_irqrestore(&hwif->lock, flags);
472} 471}
473
474EXPORT_SYMBOL(ide_set_handler); 472EXPORT_SYMBOL(ide_set_handler);
475 473
476/** 474/**
477 * ide_execute_command - execute an IDE command 475 * ide_execute_command - execute an IDE command
478 * @drive: IDE drive to issue the command against 476 * @drive: IDE drive to issue the command against
@@ -482,7 +480,7 @@ EXPORT_SYMBOL(ide_set_handler);
482 * @expiry: handler to run on timeout 480 * @expiry: handler to run on timeout
483 * 481 *
484 * Helper function to issue an IDE command. This handles the 482 * Helper function to issue an IDE command. This handles the
485 * atomicity requirements, command timing and ensures that the 483 * atomicity requirements, command timing and ensures that the
486 * handler and IRQ setup do not race. All IDE command kick off 484 * handler and IRQ setup do not race. All IDE command kick off
487 * should go via this function or do equivalent locking. 485 * should go via this function or do equivalent locking.
488 */ 486 */
@@ -528,28 +526,29 @@ static inline void ide_complete_drive_reset(ide_drive_t *drive, int err)
528} 526}
529 527
530/* needed below */ 528/* needed below */
531static ide_startstop_t do_reset1 (ide_drive_t *, int); 529static ide_startstop_t do_reset1(ide_drive_t *, int);
532 530
533/* 531/*
534 * atapi_reset_pollfunc() gets invoked to poll the interface for completion every 50ms 532 * atapi_reset_pollfunc() gets invoked to poll the interface for completion
535 * during an atapi drive reset operation. If the drive has not yet responded, 533 * every 50ms during an atapi drive reset operation. If the drive has not yet
536 * and we have not yet hit our maximum waiting time, then the timer is restarted 534 * responded, and we have not yet hit our maximum waiting time, then the timer
537 * for another 50ms. 535 * is restarted for another 50ms.
538 */ 536 */
539static ide_startstop_t atapi_reset_pollfunc (ide_drive_t *drive) 537static ide_startstop_t atapi_reset_pollfunc(ide_drive_t *drive)
540{ 538{
541 ide_hwif_t *hwif = drive->hwif; 539 ide_hwif_t *hwif = drive->hwif;
542 u8 stat; 540 u8 stat;
543 541
544 SELECT_DRIVE(drive); 542 SELECT_DRIVE(drive);
545 udelay (10); 543 udelay(10);
546 stat = hwif->tp_ops->read_status(hwif); 544 stat = hwif->tp_ops->read_status(hwif);
547 545
548 if (OK_STAT(stat, 0, ATA_BUSY)) 546 if (OK_STAT(stat, 0, ATA_BUSY))
549 printk(KERN_INFO "%s: ATAPI reset complete\n", drive->name); 547 printk(KERN_INFO "%s: ATAPI reset complete\n", drive->name);
550 else { 548 else {
551 if (time_before(jiffies, hwif->poll_timeout)) { 549 if (time_before(jiffies, hwif->poll_timeout)) {
552 ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20, NULL); 550 ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20,
551 NULL);
553 /* continue polling */ 552 /* continue polling */
554 return ide_started; 553 return ide_started;
555 } 554 }
@@ -591,7 +590,7 @@ static void ide_reset_report_error(ide_hwif_t *hwif, u8 err)
591 * and we have not yet hit our maximum waiting time, then the timer is restarted 590 * and we have not yet hit our maximum waiting time, then the timer is restarted
592 * for another 50ms. 591 * for another 50ms.
593 */ 592 */
594static ide_startstop_t reset_pollfunc (ide_drive_t *drive) 593static ide_startstop_t reset_pollfunc(ide_drive_t *drive)
595{ 594{
596 ide_hwif_t *hwif = drive->hwif; 595 ide_hwif_t *hwif = drive->hwif;
597 const struct ide_port_ops *port_ops = hwif->port_ops; 596 const struct ide_port_ops *port_ops = hwif->port_ops;
@@ -703,7 +702,7 @@ static void pre_reset(ide_drive_t *drive)
703 * (up to 30 seconds worstcase). So, instead of busy-waiting here for it, 702 * (up to 30 seconds worstcase). So, instead of busy-waiting here for it,
704 * we set a timer to poll at 50ms intervals. 703 * we set a timer to poll at 50ms intervals.
705 */ 704 */
706static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) 705static ide_startstop_t do_reset1(ide_drive_t *drive, int do_not_try_atapi)
707{ 706{
708 ide_hwif_t *hwif = drive->hwif; 707 ide_hwif_t *hwif = drive->hwif;
709 struct ide_io_ports *io_ports = &hwif->io_ports; 708 struct ide_io_ports *io_ports = &hwif->io_ports;
@@ -723,7 +722,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
723 if (drive->media != ide_disk && !do_not_try_atapi) { 722 if (drive->media != ide_disk && !do_not_try_atapi) {
724 pre_reset(drive); 723 pre_reset(drive);
725 SELECT_DRIVE(drive); 724 SELECT_DRIVE(drive);
726 udelay (20); 725 udelay(20);
727 tp_ops->exec_command(hwif, ATA_CMD_DEV_RESET); 726 tp_ops->exec_command(hwif, ATA_CMD_DEV_RESET);
728 ndelay(400); 727 ndelay(400);
729 hwif->poll_timeout = jiffies + WAIT_WORSTCASE; 728 hwif->poll_timeout = jiffies + WAIT_WORSTCASE;
@@ -807,11 +806,10 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
807 * ide_do_reset() is the entry point to the drive/interface reset code. 806 * ide_do_reset() is the entry point to the drive/interface reset code.
808 */ 807 */
809 808
810ide_startstop_t ide_do_reset (ide_drive_t *drive) 809ide_startstop_t ide_do_reset(ide_drive_t *drive)
811{ 810{
812 return do_reset1(drive, 0); 811 return do_reset1(drive, 0);
813} 812}
814
815EXPORT_SYMBOL(ide_do_reset); 813EXPORT_SYMBOL(ide_do_reset);
816 814
817/* 815/*
@@ -822,7 +820,7 @@ int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout)
822{ 820{
823 u8 stat = 0; 821 u8 stat = 0;
824 822
825 while(timeout--) { 823 while (timeout--) {
826 /* 824 /*
827 * Turn this into a schedule() sleep once I'm sure 825 * Turn this into a schedule() sleep once I'm sure
828 * about locking issues (2.5 work ?). 826 * about locking issues (2.5 work ?).