aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-10-31 10:34:07 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-31 10:34:07 -0500
commitc1d962035d49565d8c7a2d97519012ccb861778a (patch)
treec958743946f813ebda2e8fd17c54455fd6f962af
parent4fd5f8267dd37aaebadfabe71d9c808821eea05a (diff)
parent005a5a06a6dd13a0ca3f2c6a0218e8d94ed36d8a (diff)
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev
-rw-r--r--drivers/scsi/libata-core.c59
-rw-r--r--drivers/scsi/libata-scsi.c9
-rw-r--r--drivers/scsi/libata.h1
3 files changed, 18 insertions, 51 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 8be7dc0b47b8..ff18fa7044c5 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -295,28 +295,6 @@ void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf)
295} 295}
296 296
297/** 297/**
298 * ata_exec - issue ATA command to host controller
299 * @ap: port to which command is being issued
300 * @tf: ATA taskfile register set
301 *
302 * Issues PIO/MMIO write to ATA command register, with proper
303 * synchronization with interrupt handler / other threads.
304 *
305 * LOCKING:
306 * Obtains host_set lock.
307 */
308
309static inline void ata_exec(struct ata_port *ap, const struct ata_taskfile *tf)
310{
311 unsigned long flags;
312
313 DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command);
314 spin_lock_irqsave(&ap->host_set->lock, flags);
315 ap->ops->exec_command(ap, tf);
316 spin_unlock_irqrestore(&ap->host_set->lock, flags);
317}
318
319/**
320 * ata_tf_to_host - issue ATA taskfile to host controller 298 * ata_tf_to_host - issue ATA taskfile to host controller
321 * @ap: port to which command is being issued 299 * @ap: port to which command is being issued
322 * @tf: ATA taskfile register set 300 * @tf: ATA taskfile register set
@@ -326,30 +304,11 @@ static inline void ata_exec(struct ata_port *ap, const struct ata_taskfile *tf)
326 * other threads. 304 * other threads.
327 * 305 *
328 * LOCKING: 306 * LOCKING:
329 * Obtains host_set lock.
330 */
331
332static void ata_tf_to_host(struct ata_port *ap, const struct ata_taskfile *tf)
333{
334 ap->ops->tf_load(ap, tf);
335
336 ata_exec(ap, tf);
337}
338
339/**
340 * ata_tf_to_host_nolock - issue ATA taskfile to host controller
341 * @ap: port to which command is being issued
342 * @tf: ATA taskfile register set
343 *
344 * Issues ATA taskfile register set to ATA host controller,
345 * with proper synchronization with interrupt handler and
346 * other threads.
347 *
348 * LOCKING:
349 * spin_lock_irqsave(host_set lock) 307 * spin_lock_irqsave(host_set lock)
350 */ 308 */
351 309
352void ata_tf_to_host_nolock(struct ata_port *ap, const struct ata_taskfile *tf) 310static inline void ata_tf_to_host(struct ata_port *ap,
311 const struct ata_taskfile *tf)
353{ 312{
354 ap->ops->tf_load(ap, tf); 313 ap->ops->tf_load(ap, tf);
355 ap->ops->exec_command(ap, tf); 314 ap->ops->exec_command(ap, tf);
@@ -1912,12 +1871,14 @@ static void ata_bus_post_reset(struct ata_port *ap, unsigned int devmask)
1912 * 1871 *
1913 * LOCKING: 1872 * LOCKING:
1914 * PCI/etc. bus probe sem. 1873 * PCI/etc. bus probe sem.
1874 * Obtains host_set lock.
1915 * 1875 *
1916 */ 1876 */
1917 1877
1918static unsigned int ata_bus_edd(struct ata_port *ap) 1878static unsigned int ata_bus_edd(struct ata_port *ap)
1919{ 1879{
1920 struct ata_taskfile tf; 1880 struct ata_taskfile tf;
1881 unsigned long flags;
1921 1882
1922 /* set up execute-device-diag (bus reset) taskfile */ 1883 /* set up execute-device-diag (bus reset) taskfile */
1923 /* also, take interrupts to a known state (disabled) */ 1884 /* also, take interrupts to a known state (disabled) */
@@ -1928,7 +1889,9 @@ static unsigned int ata_bus_edd(struct ata_port *ap)
1928 tf.protocol = ATA_PROT_NODATA; 1889 tf.protocol = ATA_PROT_NODATA;
1929 1890
1930 /* do bus reset */ 1891 /* do bus reset */
1892 spin_lock_irqsave(&ap->host_set->lock, flags);
1931 ata_tf_to_host(ap, &tf); 1893 ata_tf_to_host(ap, &tf);
1894 spin_unlock_irqrestore(&ap->host_set->lock, flags);
1932 1895
1933 /* spec says at least 2ms. but who knows with those 1896 /* spec says at least 2ms. but who knows with those
1934 * crazy ATAPI devices... 1897 * crazy ATAPI devices...
@@ -3555,7 +3518,7 @@ int ata_qc_issue_prot(struct ata_queued_cmd *qc)
3555 3518
3556 switch (qc->tf.protocol) { 3519 switch (qc->tf.protocol) {
3557 case ATA_PROT_NODATA: 3520 case ATA_PROT_NODATA:
3558 ata_tf_to_host_nolock(ap, &qc->tf); 3521 ata_tf_to_host(ap, &qc->tf);
3559 break; 3522 break;
3560 3523
3561 case ATA_PROT_DMA: 3524 case ATA_PROT_DMA:
@@ -3566,20 +3529,20 @@ int ata_qc_issue_prot(struct ata_queued_cmd *qc)
3566 3529
3567 case ATA_PROT_PIO: /* load tf registers, initiate polling pio */ 3530 case ATA_PROT_PIO: /* load tf registers, initiate polling pio */
3568 ata_qc_set_polling(qc); 3531 ata_qc_set_polling(qc);
3569 ata_tf_to_host_nolock(ap, &qc->tf); 3532 ata_tf_to_host(ap, &qc->tf);
3570 ap->hsm_task_state = HSM_ST; 3533 ap->hsm_task_state = HSM_ST;
3571 queue_work(ata_wq, &ap->pio_task); 3534 queue_work(ata_wq, &ap->pio_task);
3572 break; 3535 break;
3573 3536
3574 case ATA_PROT_ATAPI: 3537 case ATA_PROT_ATAPI:
3575 ata_qc_set_polling(qc); 3538 ata_qc_set_polling(qc);
3576 ata_tf_to_host_nolock(ap, &qc->tf); 3539 ata_tf_to_host(ap, &qc->tf);
3577 queue_work(ata_wq, &ap->packet_task); 3540 queue_work(ata_wq, &ap->packet_task);
3578 break; 3541 break;
3579 3542
3580 case ATA_PROT_ATAPI_NODATA: 3543 case ATA_PROT_ATAPI_NODATA:
3581 ap->flags |= ATA_FLAG_NOINTR; 3544 ap->flags |= ATA_FLAG_NOINTR;
3582 ata_tf_to_host_nolock(ap, &qc->tf); 3545 ata_tf_to_host(ap, &qc->tf);
3583 queue_work(ata_wq, &ap->packet_task); 3546 queue_work(ata_wq, &ap->packet_task);
3584 break; 3547 break;
3585 3548
@@ -4126,8 +4089,6 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host,
4126 host->unique_id = ata_unique_id++; 4089 host->unique_id = ata_unique_id++;
4127 host->max_cmd_len = 12; 4090 host->max_cmd_len = 12;
4128 4091
4129 scsi_assign_lock(host, &host_set->lock);
4130
4131 ap->flags = ATA_FLAG_PORT_DISABLED; 4092 ap->flags = ATA_FLAG_PORT_DISABLED;
4132 ap->id = host->unique_id; 4093 ap->id = host->unique_id;
4133 ap->host = host; 4094 ap->host = host;
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 1e3792f86fcf..248baae96486 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -39,6 +39,7 @@
39#include <scsi/scsi.h> 39#include <scsi/scsi.h>
40#include "scsi.h" 40#include "scsi.h"
41#include <scsi/scsi_host.h> 41#include <scsi/scsi_host.h>
42#include <scsi/scsi_device.h>
42#include <linux/libata.h> 43#include <linux/libata.h>
43#include <linux/hdreg.h> 44#include <linux/hdreg.h>
44#include <asm/uaccess.h> 45#include <asm/uaccess.h>
@@ -2405,8 +2406,12 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
2405 struct ata_port *ap; 2406 struct ata_port *ap;
2406 struct ata_device *dev; 2407 struct ata_device *dev;
2407 struct scsi_device *scsidev = cmd->device; 2408 struct scsi_device *scsidev = cmd->device;
2409 struct Scsi_Host *shost = scsidev->host;
2408 2410
2409 ap = (struct ata_port *) &scsidev->host->hostdata[0]; 2411 ap = (struct ata_port *) &shost->hostdata[0];
2412
2413 spin_unlock(shost->host_lock);
2414 spin_lock(&ap->host_set->lock);
2410 2415
2411 ata_scsi_dump_cdb(ap, cmd); 2416 ata_scsi_dump_cdb(ap, cmd);
2412 2417
@@ -2429,6 +2434,8 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
2429 ata_scsi_translate(ap, dev, cmd, done, atapi_xlat); 2434 ata_scsi_translate(ap, dev, cmd, done, atapi_xlat);
2430 2435
2431out_unlock: 2436out_unlock:
2437 spin_unlock(&ap->host_set->lock);
2438 spin_lock(shost->host_lock);
2432 return 0; 2439 return 0;
2433} 2440}
2434 2441
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h
index 10ecd9e15e4f..fad051ca4672 100644
--- a/drivers/scsi/libata.h
+++ b/drivers/scsi/libata.h
@@ -48,7 +48,6 @@ extern int ata_qc_issue(struct ata_queued_cmd *qc);
48extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); 48extern int ata_check_atapi_dma(struct ata_queued_cmd *qc);
49extern void ata_dev_select(struct ata_port *ap, unsigned int device, 49extern void ata_dev_select(struct ata_port *ap, unsigned int device,
50 unsigned int wait, unsigned int can_sleep); 50 unsigned int wait, unsigned int can_sleep);
51extern void ata_tf_to_host_nolock(struct ata_port *ap, const struct ata_taskfile *tf);
52extern void swap_buf_le16(u16 *buf, unsigned int buf_words); 51extern void swap_buf_le16(u16 *buf, unsigned int buf_words);
53extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg); 52extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg);
54extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg); 53extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg);