diff options
Diffstat (limited to 'drivers/ide/ide-iops.c')
-rw-r--r-- | drivers/ide/ide-iops.c | 122 |
1 files changed, 68 insertions, 54 deletions
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index c9d15be4c48d..07da5fb9eaff 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -68,7 +68,7 @@ void SELECT_DRIVE (ide_drive_t *drive) | |||
68 | memset(&task, 0, sizeof(task)); | 68 | memset(&task, 0, sizeof(task)); |
69 | task.tf_flags = IDE_TFLAG_OUT_DEVICE; | 69 | task.tf_flags = IDE_TFLAG_OUT_DEVICE; |
70 | 70 | ||
71 | drive->hwif->tf_load(drive, &task); | 71 | drive->hwif->tp_ops->tf_load(drive, &task); |
72 | } | 72 | } |
73 | 73 | ||
74 | void SELECT_MASK(ide_drive_t *drive, int mask) | 74 | void SELECT_MASK(ide_drive_t *drive, int mask) |
@@ -79,39 +79,43 @@ void SELECT_MASK(ide_drive_t *drive, int mask) | |||
79 | port_ops->maskproc(drive, mask); | 79 | port_ops->maskproc(drive, mask); |
80 | } | 80 | } |
81 | 81 | ||
82 | static void ide_exec_command(ide_hwif_t *hwif, u8 cmd) | 82 | void ide_exec_command(ide_hwif_t *hwif, u8 cmd) |
83 | { | 83 | { |
84 | if (hwif->host_flags & IDE_HFLAG_MMIO) | 84 | if (hwif->host_flags & IDE_HFLAG_MMIO) |
85 | writeb(cmd, (void __iomem *)hwif->io_ports.command_addr); | 85 | writeb(cmd, (void __iomem *)hwif->io_ports.command_addr); |
86 | else | 86 | else |
87 | outb(cmd, hwif->io_ports.command_addr); | 87 | outb(cmd, hwif->io_ports.command_addr); |
88 | } | 88 | } |
89 | EXPORT_SYMBOL_GPL(ide_exec_command); | ||
89 | 90 | ||
90 | static u8 ide_read_status(ide_hwif_t *hwif) | 91 | u8 ide_read_status(ide_hwif_t *hwif) |
91 | { | 92 | { |
92 | if (hwif->host_flags & IDE_HFLAG_MMIO) | 93 | if (hwif->host_flags & IDE_HFLAG_MMIO) |
93 | return readb((void __iomem *)hwif->io_ports.status_addr); | 94 | return readb((void __iomem *)hwif->io_ports.status_addr); |
94 | else | 95 | else |
95 | return inb(hwif->io_ports.status_addr); | 96 | return inb(hwif->io_ports.status_addr); |
96 | } | 97 | } |
98 | EXPORT_SYMBOL_GPL(ide_read_status); | ||
97 | 99 | ||
98 | static u8 ide_read_altstatus(ide_hwif_t *hwif) | 100 | u8 ide_read_altstatus(ide_hwif_t *hwif) |
99 | { | 101 | { |
100 | if (hwif->host_flags & IDE_HFLAG_MMIO) | 102 | if (hwif->host_flags & IDE_HFLAG_MMIO) |
101 | return readb((void __iomem *)hwif->io_ports.ctl_addr); | 103 | return readb((void __iomem *)hwif->io_ports.ctl_addr); |
102 | else | 104 | else |
103 | return inb(hwif->io_ports.ctl_addr); | 105 | return inb(hwif->io_ports.ctl_addr); |
104 | } | 106 | } |
107 | EXPORT_SYMBOL_GPL(ide_read_altstatus); | ||
105 | 108 | ||
106 | static u8 ide_read_sff_dma_status(ide_hwif_t *hwif) | 109 | u8 ide_read_sff_dma_status(ide_hwif_t *hwif) |
107 | { | 110 | { |
108 | if (hwif->host_flags & IDE_HFLAG_MMIO) | 111 | if (hwif->host_flags & IDE_HFLAG_MMIO) |
109 | return readb((void __iomem *)(hwif->dma_base + ATA_DMA_STATUS)); | 112 | return readb((void __iomem *)(hwif->dma_base + ATA_DMA_STATUS)); |
110 | else | 113 | else |
111 | return inb(hwif->dma_base + ATA_DMA_STATUS); | 114 | return inb(hwif->dma_base + ATA_DMA_STATUS); |
112 | } | 115 | } |
116 | EXPORT_SYMBOL_GPL(ide_read_sff_dma_status); | ||
113 | 117 | ||
114 | static void ide_set_irq(ide_hwif_t *hwif, int on) | 118 | void ide_set_irq(ide_hwif_t *hwif, int on) |
115 | { | 119 | { |
116 | u8 ctl = ATA_DEVCTL_OBS; | 120 | u8 ctl = ATA_DEVCTL_OBS; |
117 | 121 | ||
@@ -127,8 +131,9 @@ static void ide_set_irq(ide_hwif_t *hwif, int on) | |||
127 | else | 131 | else |
128 | outb(ctl, hwif->io_ports.ctl_addr); | 132 | outb(ctl, hwif->io_ports.ctl_addr); |
129 | } | 133 | } |
134 | EXPORT_SYMBOL_GPL(ide_set_irq); | ||
130 | 135 | ||
131 | static void ide_tf_load(ide_drive_t *drive, ide_task_t *task) | 136 | void ide_tf_load(ide_drive_t *drive, ide_task_t *task) |
132 | { | 137 | { |
133 | ide_hwif_t *hwif = drive->hwif; | 138 | ide_hwif_t *hwif = drive->hwif; |
134 | struct ide_io_ports *io_ports = &hwif->io_ports; | 139 | struct ide_io_ports *io_ports = &hwif->io_ports; |
@@ -180,8 +185,9 @@ static void ide_tf_load(ide_drive_t *drive, ide_task_t *task) | |||
180 | tf_outb((tf->device & HIHI) | drive->select.all, | 185 | tf_outb((tf->device & HIHI) | drive->select.all, |
181 | io_ports->device_addr); | 186 | io_ports->device_addr); |
182 | } | 187 | } |
188 | EXPORT_SYMBOL_GPL(ide_tf_load); | ||
183 | 189 | ||
184 | static void ide_tf_read(ide_drive_t *drive, ide_task_t *task) | 190 | void ide_tf_read(ide_drive_t *drive, ide_task_t *task) |
185 | { | 191 | { |
186 | ide_hwif_t *hwif = drive->hwif; | 192 | ide_hwif_t *hwif = drive->hwif; |
187 | struct ide_io_ports *io_ports = &hwif->io_ports; | 193 | struct ide_io_ports *io_ports = &hwif->io_ports; |
@@ -241,6 +247,7 @@ static void ide_tf_read(ide_drive_t *drive, ide_task_t *task) | |||
241 | tf->hob_lbah = tf_inb(io_ports->lbah_addr); | 247 | tf->hob_lbah = tf_inb(io_ports->lbah_addr); |
242 | } | 248 | } |
243 | } | 249 | } |
250 | EXPORT_SYMBOL_GPL(ide_tf_read); | ||
244 | 251 | ||
245 | /* | 252 | /* |
246 | * Some localbus EIDE interfaces require a special access sequence | 253 | * Some localbus EIDE interfaces require a special access sequence |
@@ -263,8 +270,8 @@ static void ata_vlb_sync(unsigned long port) | |||
263 | * so if an odd len is specified, be sure that there's at least one | 270 | * so if an odd len is specified, be sure that there's at least one |
264 | * extra byte allocated for the buffer. | 271 | * extra byte allocated for the buffer. |
265 | */ | 272 | */ |
266 | static void ata_input_data(ide_drive_t *drive, struct request *rq, | 273 | void ide_input_data(ide_drive_t *drive, struct request *rq, void *buf, |
267 | void *buf, unsigned int len) | 274 | unsigned int len) |
268 | { | 275 | { |
269 | ide_hwif_t *hwif = drive->hwif; | 276 | ide_hwif_t *hwif = drive->hwif; |
270 | struct ide_io_ports *io_ports = &hwif->io_ports; | 277 | struct ide_io_ports *io_ports = &hwif->io_ports; |
@@ -304,12 +311,13 @@ static void ata_input_data(ide_drive_t *drive, struct request *rq, | |||
304 | insw(data_addr, buf, len / 2); | 311 | insw(data_addr, buf, len / 2); |
305 | } | 312 | } |
306 | } | 313 | } |
314 | EXPORT_SYMBOL_GPL(ide_input_data); | ||
307 | 315 | ||
308 | /* | 316 | /* |
309 | * This is used for most PIO data transfers *to* the IDE interface | 317 | * This is used for most PIO data transfers *to* the IDE interface |
310 | */ | 318 | */ |
311 | static void ata_output_data(ide_drive_t *drive, struct request *rq, | 319 | void ide_output_data(ide_drive_t *drive, struct request *rq, void *buf, |
312 | void *buf, unsigned int len) | 320 | unsigned int len) |
313 | { | 321 | { |
314 | ide_hwif_t *hwif = drive->hwif; | 322 | ide_hwif_t *hwif = drive->hwif; |
315 | struct ide_io_ports *io_ports = &hwif->io_ports; | 323 | struct ide_io_ports *io_ports = &hwif->io_ports; |
@@ -347,22 +355,7 @@ static void ata_output_data(ide_drive_t *drive, struct request *rq, | |||
347 | outsw(data_addr, buf, len / 2); | 355 | outsw(data_addr, buf, len / 2); |
348 | } | 356 | } |
349 | } | 357 | } |
350 | 358 | EXPORT_SYMBOL_GPL(ide_output_data); | |
351 | void default_hwif_transport(ide_hwif_t *hwif) | ||
352 | { | ||
353 | hwif->exec_command = ide_exec_command; | ||
354 | hwif->read_status = ide_read_status; | ||
355 | hwif->read_altstatus = ide_read_altstatus; | ||
356 | hwif->read_sff_dma_status = ide_read_sff_dma_status; | ||
357 | |||
358 | hwif->set_irq = ide_set_irq; | ||
359 | |||
360 | hwif->tf_load = ide_tf_load; | ||
361 | hwif->tf_read = ide_tf_read; | ||
362 | |||
363 | hwif->input_data = ata_input_data; | ||
364 | hwif->output_data = ata_output_data; | ||
365 | } | ||
366 | 359 | ||
367 | u8 ide_read_error(ide_drive_t *drive) | 360 | u8 ide_read_error(ide_drive_t *drive) |
368 | { | 361 | { |
@@ -371,7 +364,7 @@ u8 ide_read_error(ide_drive_t *drive) | |||
371 | memset(&task, 0, sizeof(task)); | 364 | memset(&task, 0, sizeof(task)); |
372 | task.tf_flags = IDE_TFLAG_IN_FEATURE; | 365 | task.tf_flags = IDE_TFLAG_IN_FEATURE; |
373 | 366 | ||
374 | drive->hwif->tf_read(drive, &task); | 367 | drive->hwif->tp_ops->tf_read(drive, &task); |
375 | 368 | ||
376 | return task.tf.error; | 369 | return task.tf.error; |
377 | } | 370 | } |
@@ -385,13 +378,28 @@ void ide_read_bcount_and_ireason(ide_drive_t *drive, u16 *bcount, u8 *ireason) | |||
385 | task.tf_flags = IDE_TFLAG_IN_LBAH | IDE_TFLAG_IN_LBAM | | 378 | task.tf_flags = IDE_TFLAG_IN_LBAH | IDE_TFLAG_IN_LBAM | |
386 | IDE_TFLAG_IN_NSECT; | 379 | IDE_TFLAG_IN_NSECT; |
387 | 380 | ||
388 | drive->hwif->tf_read(drive, &task); | 381 | drive->hwif->tp_ops->tf_read(drive, &task); |
389 | 382 | ||
390 | *bcount = (task.tf.lbah << 8) | task.tf.lbam; | 383 | *bcount = (task.tf.lbah << 8) | task.tf.lbam; |
391 | *ireason = task.tf.nsect & 3; | 384 | *ireason = task.tf.nsect & 3; |
392 | } | 385 | } |
393 | EXPORT_SYMBOL_GPL(ide_read_bcount_and_ireason); | 386 | EXPORT_SYMBOL_GPL(ide_read_bcount_and_ireason); |
394 | 387 | ||
388 | const struct ide_tp_ops default_tp_ops = { | ||
389 | .exec_command = ide_exec_command, | ||
390 | .read_status = ide_read_status, | ||
391 | .read_altstatus = ide_read_altstatus, | ||
392 | .read_sff_dma_status = ide_read_sff_dma_status, | ||
393 | |||
394 | .set_irq = ide_set_irq, | ||
395 | |||
396 | .tf_load = ide_tf_load, | ||
397 | .tf_read = ide_tf_read, | ||
398 | |||
399 | .input_data = ide_input_data, | ||
400 | .output_data = ide_output_data, | ||
401 | }; | ||
402 | |||
395 | void ide_fix_driveid (struct hd_driveid *id) | 403 | void ide_fix_driveid (struct hd_driveid *id) |
396 | { | 404 | { |
397 | #ifndef __LITTLE_ENDIAN | 405 | #ifndef __LITTLE_ENDIAN |
@@ -545,10 +553,10 @@ int drive_is_ready (ide_drive_t *drive) | |||
545 | * about possible isa-pnp and pci-pnp issues yet. | 553 | * about possible isa-pnp and pci-pnp issues yet. |
546 | */ | 554 | */ |
547 | if (hwif->io_ports.ctl_addr) | 555 | if (hwif->io_ports.ctl_addr) |
548 | stat = hwif->read_altstatus(hwif); | 556 | stat = hwif->tp_ops->read_altstatus(hwif); |
549 | else | 557 | else |
550 | /* Note: this may clear a pending IRQ!! */ | 558 | /* Note: this may clear a pending IRQ!! */ |
551 | stat = hwif->read_status(hwif); | 559 | stat = hwif->tp_ops->read_status(hwif); |
552 | 560 | ||
553 | if (stat & BUSY_STAT) | 561 | if (stat & BUSY_STAT) |
554 | /* drive busy: definitely not interrupting */ | 562 | /* drive busy: definitely not interrupting */ |
@@ -574,24 +582,25 @@ EXPORT_SYMBOL(drive_is_ready); | |||
574 | static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad, unsigned long timeout, u8 *rstat) | 582 | static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad, unsigned long timeout, u8 *rstat) |
575 | { | 583 | { |
576 | ide_hwif_t *hwif = drive->hwif; | 584 | ide_hwif_t *hwif = drive->hwif; |
585 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; | ||
577 | unsigned long flags; | 586 | unsigned long flags; |
578 | int i; | 587 | int i; |
579 | u8 stat; | 588 | u8 stat; |
580 | 589 | ||
581 | udelay(1); /* spec allows drive 400ns to assert "BUSY" */ | 590 | udelay(1); /* spec allows drive 400ns to assert "BUSY" */ |
582 | stat = hwif->read_status(hwif); | 591 | stat = tp_ops->read_status(hwif); |
583 | 592 | ||
584 | if (stat & BUSY_STAT) { | 593 | if (stat & BUSY_STAT) { |
585 | local_irq_set(flags); | 594 | local_irq_set(flags); |
586 | timeout += jiffies; | 595 | timeout += jiffies; |
587 | while ((stat = hwif->read_status(hwif)) & BUSY_STAT) { | 596 | while ((stat = tp_ops->read_status(hwif)) & BUSY_STAT) { |
588 | if (time_after(jiffies, timeout)) { | 597 | if (time_after(jiffies, timeout)) { |
589 | /* | 598 | /* |
590 | * One last read after the timeout in case | 599 | * One last read after the timeout in case |
591 | * heavy interrupt load made us not make any | 600 | * heavy interrupt load made us not make any |
592 | * progress during the timeout.. | 601 | * progress during the timeout.. |
593 | */ | 602 | */ |
594 | stat = hwif->read_status(hwif); | 603 | stat = tp_ops->read_status(hwif); |
595 | if (!(stat & BUSY_STAT)) | 604 | if (!(stat & BUSY_STAT)) |
596 | break; | 605 | break; |
597 | 606 | ||
@@ -611,7 +620,7 @@ static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad, unsigned long ti | |||
611 | */ | 620 | */ |
612 | for (i = 0; i < 10; i++) { | 621 | for (i = 0; i < 10; i++) { |
613 | udelay(1); | 622 | udelay(1); |
614 | stat = hwif->read_status(hwif); | 623 | stat = tp_ops->read_status(hwif); |
615 | 624 | ||
616 | if (OK_STAT(stat, good, bad)) { | 625 | if (OK_STAT(stat, good, bad)) { |
617 | *rstat = stat; | 626 | *rstat = stat; |
@@ -737,6 +746,7 @@ no_80w: | |||
737 | int ide_driveid_update(ide_drive_t *drive) | 746 | int ide_driveid_update(ide_drive_t *drive) |
738 | { | 747 | { |
739 | ide_hwif_t *hwif = drive->hwif; | 748 | ide_hwif_t *hwif = drive->hwif; |
749 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; | ||
740 | struct hd_driveid *id; | 750 | struct hd_driveid *id; |
741 | unsigned long timeout, flags; | 751 | unsigned long timeout, flags; |
742 | u8 stat; | 752 | u8 stat; |
@@ -747,9 +757,9 @@ int ide_driveid_update(ide_drive_t *drive) | |||
747 | */ | 757 | */ |
748 | 758 | ||
749 | SELECT_MASK(drive, 1); | 759 | SELECT_MASK(drive, 1); |
750 | hwif->set_irq(hwif, 0); | 760 | tp_ops->set_irq(hwif, 0); |
751 | msleep(50); | 761 | msleep(50); |
752 | hwif->exec_command(hwif, WIN_IDENTIFY); | 762 | tp_ops->exec_command(hwif, WIN_IDENTIFY); |
753 | timeout = jiffies + WAIT_WORSTCASE; | 763 | timeout = jiffies + WAIT_WORSTCASE; |
754 | do { | 764 | do { |
755 | if (time_after(jiffies, timeout)) { | 765 | if (time_after(jiffies, timeout)) { |
@@ -758,11 +768,11 @@ int ide_driveid_update(ide_drive_t *drive) | |||
758 | } | 768 | } |
759 | 769 | ||
760 | msleep(50); /* give drive a breather */ | 770 | msleep(50); /* give drive a breather */ |
761 | stat = hwif->read_altstatus(hwif); | 771 | stat = tp_ops->read_altstatus(hwif); |
762 | } while (stat & BUSY_STAT); | 772 | } while (stat & BUSY_STAT); |
763 | 773 | ||
764 | msleep(50); /* wait for IRQ and DRQ_STAT */ | 774 | msleep(50); /* wait for IRQ and DRQ_STAT */ |
765 | stat = hwif->read_status(hwif); | 775 | stat = tp_ops->read_status(hwif); |
766 | 776 | ||
767 | if (!OK_STAT(stat, DRQ_STAT, BAD_R_STAT)) { | 777 | if (!OK_STAT(stat, DRQ_STAT, BAD_R_STAT)) { |
768 | SELECT_MASK(drive, 0); | 778 | SELECT_MASK(drive, 0); |
@@ -776,8 +786,8 @@ int ide_driveid_update(ide_drive_t *drive) | |||
776 | local_irq_restore(flags); | 786 | local_irq_restore(flags); |
777 | return 0; | 787 | return 0; |
778 | } | 788 | } |
779 | hwif->input_data(drive, NULL, id, SECTOR_SIZE); | 789 | tp_ops->input_data(drive, NULL, id, SECTOR_SIZE); |
780 | (void)hwif->read_status(hwif); /* clear drive IRQ */ | 790 | (void)tp_ops->read_status(hwif); /* clear drive IRQ */ |
781 | local_irq_enable(); | 791 | local_irq_enable(); |
782 | local_irq_restore(flags); | 792 | local_irq_restore(flags); |
783 | ide_fix_driveid(id); | 793 | ide_fix_driveid(id); |
@@ -798,6 +808,7 @@ int ide_driveid_update(ide_drive_t *drive) | |||
798 | int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | 808 | int ide_config_drive_speed(ide_drive_t *drive, u8 speed) |
799 | { | 809 | { |
800 | ide_hwif_t *hwif = drive->hwif; | 810 | ide_hwif_t *hwif = drive->hwif; |
811 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; | ||
801 | int error = 0; | 812 | int error = 0; |
802 | u8 stat; | 813 | u8 stat; |
803 | ide_task_t task; | 814 | ide_task_t task; |
@@ -833,19 +844,19 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
833 | SELECT_DRIVE(drive); | 844 | SELECT_DRIVE(drive); |
834 | SELECT_MASK(drive, 0); | 845 | SELECT_MASK(drive, 0); |
835 | udelay(1); | 846 | udelay(1); |
836 | hwif->set_irq(hwif, 0); | 847 | tp_ops->set_irq(hwif, 0); |
837 | 848 | ||
838 | memset(&task, 0, sizeof(task)); | 849 | memset(&task, 0, sizeof(task)); |
839 | task.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT; | 850 | task.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT; |
840 | task.tf.feature = SETFEATURES_XFER; | 851 | task.tf.feature = SETFEATURES_XFER; |
841 | task.tf.nsect = speed; | 852 | task.tf.nsect = speed; |
842 | 853 | ||
843 | hwif->tf_load(drive, &task); | 854 | tp_ops->tf_load(drive, &task); |
844 | 855 | ||
845 | hwif->exec_command(hwif, WIN_SETFEATURES); | 856 | tp_ops->exec_command(hwif, WIN_SETFEATURES); |
846 | 857 | ||
847 | if (drive->quirk_list == 2) | 858 | if (drive->quirk_list == 2) |
848 | hwif->set_irq(hwif, 1); | 859 | tp_ops->set_irq(hwif, 1); |
849 | 860 | ||
850 | error = __ide_wait_stat(drive, drive->ready_stat, | 861 | error = __ide_wait_stat(drive, drive->ready_stat, |
851 | BUSY_STAT|DRQ_STAT|ERR_STAT, | 862 | BUSY_STAT|DRQ_STAT|ERR_STAT, |
@@ -950,7 +961,7 @@ void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler, | |||
950 | 961 | ||
951 | spin_lock_irqsave(&ide_lock, flags); | 962 | spin_lock_irqsave(&ide_lock, flags); |
952 | __ide_set_handler(drive, handler, timeout, expiry); | 963 | __ide_set_handler(drive, handler, timeout, expiry); |
953 | hwif->exec_command(hwif, cmd); | 964 | hwif->tp_ops->exec_command(hwif, cmd); |
954 | /* | 965 | /* |
955 | * Drive takes 400nS to respond, we must avoid the IRQ being | 966 | * Drive takes 400nS to respond, we must avoid the IRQ being |
956 | * serviced before that. | 967 | * serviced before that. |
@@ -968,7 +979,7 @@ void ide_execute_pkt_cmd(ide_drive_t *drive) | |||
968 | unsigned long flags; | 979 | unsigned long flags; |
969 | 980 | ||
970 | spin_lock_irqsave(&ide_lock, flags); | 981 | spin_lock_irqsave(&ide_lock, flags); |
971 | hwif->exec_command(hwif, WIN_PACKETCMD); | 982 | hwif->tp_ops->exec_command(hwif, WIN_PACKETCMD); |
972 | ndelay(400); | 983 | ndelay(400); |
973 | spin_unlock_irqrestore(&ide_lock, flags); | 984 | spin_unlock_irqrestore(&ide_lock, flags); |
974 | } | 985 | } |
@@ -999,7 +1010,7 @@ static ide_startstop_t atapi_reset_pollfunc (ide_drive_t *drive) | |||
999 | 1010 | ||
1000 | SELECT_DRIVE(drive); | 1011 | SELECT_DRIVE(drive); |
1001 | udelay (10); | 1012 | udelay (10); |
1002 | stat = hwif->read_status(hwif); | 1013 | stat = hwif->tp_ops->read_status(hwif); |
1003 | 1014 | ||
1004 | if (OK_STAT(stat, 0, BUSY_STAT)) | 1015 | if (OK_STAT(stat, 0, BUSY_STAT)) |
1005 | printk("%s: ATAPI reset complete\n", drive->name); | 1016 | printk("%s: ATAPI reset complete\n", drive->name); |
@@ -1045,7 +1056,7 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive) | |||
1045 | } | 1056 | } |
1046 | } | 1057 | } |
1047 | 1058 | ||
1048 | tmp = hwif->read_status(hwif); | 1059 | tmp = hwif->tp_ops->read_status(hwif); |
1049 | 1060 | ||
1050 | if (!OK_STAT(tmp, 0, BUSY_STAT)) { | 1061 | if (!OK_STAT(tmp, 0, BUSY_STAT)) { |
1051 | if (time_before(jiffies, hwgroup->poll_timeout)) { | 1062 | if (time_before(jiffies, hwgroup->poll_timeout)) { |
@@ -1159,6 +1170,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) | |||
1159 | ide_hwif_t *hwif; | 1170 | ide_hwif_t *hwif; |
1160 | ide_hwgroup_t *hwgroup; | 1171 | ide_hwgroup_t *hwgroup; |
1161 | struct ide_io_ports *io_ports; | 1172 | struct ide_io_ports *io_ports; |
1173 | const struct ide_tp_ops *tp_ops; | ||
1162 | const struct ide_port_ops *port_ops; | 1174 | const struct ide_port_ops *port_ops; |
1163 | 1175 | ||
1164 | spin_lock_irqsave(&ide_lock, flags); | 1176 | spin_lock_irqsave(&ide_lock, flags); |
@@ -1167,6 +1179,8 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) | |||
1167 | 1179 | ||
1168 | io_ports = &hwif->io_ports; | 1180 | io_ports = &hwif->io_ports; |
1169 | 1181 | ||
1182 | tp_ops = hwif->tp_ops; | ||
1183 | |||
1170 | /* We must not reset with running handlers */ | 1184 | /* We must not reset with running handlers */ |
1171 | BUG_ON(hwgroup->handler != NULL); | 1185 | BUG_ON(hwgroup->handler != NULL); |
1172 | 1186 | ||
@@ -1175,7 +1189,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) | |||
1175 | pre_reset(drive); | 1189 | pre_reset(drive); |
1176 | SELECT_DRIVE(drive); | 1190 | SELECT_DRIVE(drive); |
1177 | udelay (20); | 1191 | udelay (20); |
1178 | hwif->exec_command(hwif, WIN_SRST); | 1192 | tp_ops->exec_command(hwif, WIN_SRST); |
1179 | ndelay(400); | 1193 | ndelay(400); |
1180 | hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; | 1194 | hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; |
1181 | hwgroup->polling = 1; | 1195 | hwgroup->polling = 1; |
@@ -1208,11 +1222,11 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) | |||
1208 | * TODO: add ->softreset method and stop abusing ->set_irq | 1222 | * TODO: add ->softreset method and stop abusing ->set_irq |
1209 | */ | 1223 | */ |
1210 | /* set SRST and nIEN */ | 1224 | /* set SRST and nIEN */ |
1211 | hwif->set_irq(hwif, 4); | 1225 | tp_ops->set_irq(hwif, 4); |
1212 | /* more than enough time */ | 1226 | /* more than enough time */ |
1213 | udelay(10); | 1227 | udelay(10); |
1214 | /* clear SRST, leave nIEN (unless device is on the quirk list) */ | 1228 | /* clear SRST, leave nIEN (unless device is on the quirk list) */ |
1215 | hwif->set_irq(hwif, drive->quirk_list == 2); | 1229 | tp_ops->set_irq(hwif, drive->quirk_list == 2); |
1216 | /* more than enough time */ | 1230 | /* more than enough time */ |
1217 | udelay(10); | 1231 | udelay(10); |
1218 | hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; | 1232 | hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; |
@@ -1257,7 +1271,7 @@ int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout) | |||
1257 | * about locking issues (2.5 work ?). | 1271 | * about locking issues (2.5 work ?). |
1258 | */ | 1272 | */ |
1259 | mdelay(1); | 1273 | mdelay(1); |
1260 | stat = hwif->read_status(hwif); | 1274 | stat = hwif->tp_ops->read_status(hwif); |
1261 | if ((stat & BUSY_STAT) == 0) | 1275 | if ((stat & BUSY_STAT) == 0) |
1262 | return 0; | 1276 | return 0; |
1263 | /* | 1277 | /* |