diff options
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r-- | drivers/scsi/libata-core.c | 57 |
1 files changed, 9 insertions, 48 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index b1011f4b995c..85081a1e1b10 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -296,28 +296,6 @@ void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf) | |||
296 | } | 296 | } |
297 | 297 | ||
298 | /** | 298 | /** |
299 | * ata_exec - issue ATA command to host controller | ||
300 | * @ap: port to which command is being issued | ||
301 | * @tf: ATA taskfile register set | ||
302 | * | ||
303 | * Issues PIO/MMIO write to ATA command register, with proper | ||
304 | * synchronization with interrupt handler / other threads. | ||
305 | * | ||
306 | * LOCKING: | ||
307 | * Obtains host_set lock. | ||
308 | */ | ||
309 | |||
310 | static inline void ata_exec(struct ata_port *ap, const struct ata_taskfile *tf) | ||
311 | { | ||
312 | unsigned long flags; | ||
313 | |||
314 | DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command); | ||
315 | spin_lock_irqsave(&ap->host_set->lock, flags); | ||
316 | ap->ops->exec_command(ap, tf); | ||
317 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | ||
318 | } | ||
319 | |||
320 | /** | ||
321 | * ata_tf_to_host - issue ATA taskfile to host controller | 299 | * ata_tf_to_host - issue ATA taskfile to host controller |
322 | * @ap: port to which command is being issued | 300 | * @ap: port to which command is being issued |
323 | * @tf: ATA taskfile register set | 301 | * @tf: ATA taskfile register set |
@@ -327,30 +305,11 @@ static inline void ata_exec(struct ata_port *ap, const struct ata_taskfile *tf) | |||
327 | * other threads. | 305 | * other threads. |
328 | * | 306 | * |
329 | * LOCKING: | 307 | * LOCKING: |
330 | * Obtains host_set lock. | ||
331 | */ | ||
332 | |||
333 | static void ata_tf_to_host(struct ata_port *ap, const struct ata_taskfile *tf) | ||
334 | { | ||
335 | ap->ops->tf_load(ap, tf); | ||
336 | |||
337 | ata_exec(ap, tf); | ||
338 | } | ||
339 | |||
340 | /** | ||
341 | * ata_tf_to_host_nolock - issue ATA taskfile to host controller | ||
342 | * @ap: port to which command is being issued | ||
343 | * @tf: ATA taskfile register set | ||
344 | * | ||
345 | * Issues ATA taskfile register set to ATA host controller, | ||
346 | * with proper synchronization with interrupt handler and | ||
347 | * other threads. | ||
348 | * | ||
349 | * LOCKING: | ||
350 | * spin_lock_irqsave(host_set lock) | 308 | * spin_lock_irqsave(host_set lock) |
351 | */ | 309 | */ |
352 | 310 | ||
353 | void ata_tf_to_host_nolock(struct ata_port *ap, const struct ata_taskfile *tf) | 311 | static inline void ata_tf_to_host(struct ata_port *ap, |
312 | const struct ata_taskfile *tf) | ||
354 | { | 313 | { |
355 | ap->ops->tf_load(ap, tf); | 314 | ap->ops->tf_load(ap, tf); |
356 | ap->ops->exec_command(ap, tf); | 315 | ap->ops->exec_command(ap, tf); |
@@ -1916,12 +1875,14 @@ static void ata_bus_post_reset(struct ata_port *ap, unsigned int devmask) | |||
1916 | * | 1875 | * |
1917 | * LOCKING: | 1876 | * LOCKING: |
1918 | * PCI/etc. bus probe sem. | 1877 | * PCI/etc. bus probe sem. |
1878 | * Obtains host_set lock. | ||
1919 | * | 1879 | * |
1920 | */ | 1880 | */ |
1921 | 1881 | ||
1922 | static unsigned int ata_bus_edd(struct ata_port *ap) | 1882 | static unsigned int ata_bus_edd(struct ata_port *ap) |
1923 | { | 1883 | { |
1924 | struct ata_taskfile tf; | 1884 | struct ata_taskfile tf; |
1885 | unsigned long flags; | ||
1925 | 1886 | ||
1926 | /* set up execute-device-diag (bus reset) taskfile */ | 1887 | /* set up execute-device-diag (bus reset) taskfile */ |
1927 | /* also, take interrupts to a known state (disabled) */ | 1888 | /* also, take interrupts to a known state (disabled) */ |
@@ -1932,7 +1893,9 @@ static unsigned int ata_bus_edd(struct ata_port *ap) | |||
1932 | tf.protocol = ATA_PROT_NODATA; | 1893 | tf.protocol = ATA_PROT_NODATA; |
1933 | 1894 | ||
1934 | /* do bus reset */ | 1895 | /* do bus reset */ |
1896 | spin_lock_irqsave(&ap->host_set->lock, flags); | ||
1935 | ata_tf_to_host(ap, &tf); | 1897 | ata_tf_to_host(ap, &tf); |
1898 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | ||
1936 | 1899 | ||
1937 | /* spec says at least 2ms. but who knows with those | 1900 | /* spec says at least 2ms. but who knows with those |
1938 | * crazy ATAPI devices... | 1901 | * crazy ATAPI devices... |
@@ -3711,7 +3674,7 @@ int ata_qc_issue_prot(struct ata_queued_cmd *qc) | |||
3711 | if (qc->tf.flags & ATA_TFLAG_POLLING) | 3674 | if (qc->tf.flags & ATA_TFLAG_POLLING) |
3712 | ata_qc_set_polling(qc); | 3675 | ata_qc_set_polling(qc); |
3713 | 3676 | ||
3714 | ata_tf_to_host_nolock(ap, &qc->tf); | 3677 | ata_tf_to_host(ap, &qc->tf); |
3715 | ap->hsm_task_state = HSM_ST_LAST; | 3678 | ap->hsm_task_state = HSM_ST_LAST; |
3716 | 3679 | ||
3717 | if (qc->tf.flags & ATA_TFLAG_POLLING) | 3680 | if (qc->tf.flags & ATA_TFLAG_POLLING) |
@@ -3732,7 +3695,7 @@ int ata_qc_issue_prot(struct ata_queued_cmd *qc) | |||
3732 | if (qc->tf.flags & ATA_TFLAG_POLLING) | 3695 | if (qc->tf.flags & ATA_TFLAG_POLLING) |
3733 | ata_qc_set_polling(qc); | 3696 | ata_qc_set_polling(qc); |
3734 | 3697 | ||
3735 | ata_tf_to_host_nolock(ap, &qc->tf); | 3698 | ata_tf_to_host(ap, &qc->tf); |
3736 | 3699 | ||
3737 | if (qc->tf.flags & ATA_TFLAG_WRITE) { | 3700 | if (qc->tf.flags & ATA_TFLAG_WRITE) { |
3738 | /* PIO data out protocol */ | 3701 | /* PIO data out protocol */ |
@@ -3761,7 +3724,7 @@ int ata_qc_issue_prot(struct ata_queued_cmd *qc) | |||
3761 | if (qc->tf.flags & ATA_TFLAG_POLLING) | 3724 | if (qc->tf.flags & ATA_TFLAG_POLLING) |
3762 | ata_qc_set_polling(qc); | 3725 | ata_qc_set_polling(qc); |
3763 | 3726 | ||
3764 | ata_tf_to_host_nolock(ap, &qc->tf); | 3727 | ata_tf_to_host(ap, &qc->tf); |
3765 | ap->hsm_task_state = HSM_ST_FIRST; | 3728 | ap->hsm_task_state = HSM_ST_FIRST; |
3766 | 3729 | ||
3767 | /* send cdb by polling if no cdb interrupt */ | 3730 | /* send cdb by polling if no cdb interrupt */ |
@@ -4342,8 +4305,6 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host, | |||
4342 | host->unique_id = ata_unique_id++; | 4305 | host->unique_id = ata_unique_id++; |
4343 | host->max_cmd_len = 12; | 4306 | host->max_cmd_len = 12; |
4344 | 4307 | ||
4345 | scsi_assign_lock(host, &host_set->lock); | ||
4346 | |||
4347 | ap->flags = ATA_FLAG_PORT_DISABLED; | 4308 | ap->flags = ATA_FLAG_PORT_DISABLED; |
4348 | ap->id = host->unique_id; | 4309 | ap->id = host->unique_id; |
4349 | ap->host = host; | 4310 | ap->host = host; |