aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-10-30 23:32:03 -0500
committerJeff Garzik <jgarzik@pobox.com>2005-10-30 23:32:03 -0500
commitce1eeb95fc4eb25109c00bea3e83a87eeff6b07d (patch)
treed7a1be22432740af1b9ea4330dd95d5915fdb0c3 /drivers/scsi
parent95dbf5c4be080e94880ead13773d1a14eec8f4de (diff)
parent005a5a06a6dd13a0ca3f2c6a0218e8d94ed36d8a (diff)
Merge branch 'upstream'
Diffstat (limited to 'drivers/scsi')
-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 2e022240051e..ae2475e4291c 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...
@@ -3642,7 +3605,7 @@ int ata_qc_issue_prot(struct ata_queued_cmd *qc)
3642 3605
3643 switch (qc->tf.protocol) { 3606 switch (qc->tf.protocol) {
3644 case ATA_PROT_NODATA: 3607 case ATA_PROT_NODATA:
3645 ata_tf_to_host_nolock(ap, &qc->tf); 3608 ata_tf_to_host(ap, &qc->tf);
3646 break; 3609 break;
3647 3610
3648 case ATA_PROT_DMA: 3611 case ATA_PROT_DMA:
@@ -3653,20 +3616,20 @@ int ata_qc_issue_prot(struct ata_queued_cmd *qc)
3653 3616
3654 case ATA_PROT_PIO: /* load tf registers, initiate polling pio */ 3617 case ATA_PROT_PIO: /* load tf registers, initiate polling pio */
3655 ata_qc_set_polling(qc); 3618 ata_qc_set_polling(qc);
3656 ata_tf_to_host_nolock(ap, &qc->tf); 3619 ata_tf_to_host(ap, &qc->tf);
3657 ap->hsm_task_state = HSM_ST; 3620 ap->hsm_task_state = HSM_ST;
3658 queue_work(ata_wq, &ap->pio_task); 3621 queue_work(ata_wq, &ap->pio_task);
3659 break; 3622 break;
3660 3623
3661 case ATA_PROT_ATAPI: 3624 case ATA_PROT_ATAPI:
3662 ata_qc_set_polling(qc); 3625 ata_qc_set_polling(qc);
3663 ata_tf_to_host_nolock(ap, &qc->tf); 3626 ata_tf_to_host(ap, &qc->tf);
3664 queue_work(ata_wq, &ap->packet_task); 3627 queue_work(ata_wq, &ap->packet_task);
3665 break; 3628 break;
3666 3629
3667 case ATA_PROT_ATAPI_NODATA: 3630 case ATA_PROT_ATAPI_NODATA:
3668 ap->flags |= ATA_FLAG_NOINTR; 3631 ap->flags |= ATA_FLAG_NOINTR;
3669 ata_tf_to_host_nolock(ap, &qc->tf); 3632 ata_tf_to_host(ap, &qc->tf);
3670 queue_work(ata_wq, &ap->packet_task); 3633 queue_work(ata_wq, &ap->packet_task);
3671 break; 3634 break;
3672 3635
@@ -4220,8 +4183,6 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host,
4220 host->unique_id = ata_unique_id++; 4183 host->unique_id = ata_unique_id++;
4221 host->max_cmd_len = 12; 4184 host->max_cmd_len = 12;
4222 4185
4223 scsi_assign_lock(host, &host_set->lock);
4224
4225 ap->flags = ATA_FLAG_PORT_DISABLED; 4186 ap->flags = ATA_FLAG_PORT_DISABLED;
4226 ap->id = host->unique_id; 4187 ap->id = host->unique_id;
4227 ap->host = host; 4188 ap->host = host;
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 5574520bf1c2..eb604b0a8990 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>
@@ -2415,8 +2416,12 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
2415 struct ata_port *ap; 2416 struct ata_port *ap;
2416 struct ata_device *dev; 2417 struct ata_device *dev;
2417 struct scsi_device *scsidev = cmd->device; 2418 struct scsi_device *scsidev = cmd->device;
2419 struct Scsi_Host *shost = scsidev->host;
2418 2420
2419 ap = (struct ata_port *) &scsidev->host->hostdata[0]; 2421 ap = (struct ata_port *) &shost->hostdata[0];
2422
2423 spin_unlock(shost->host_lock);
2424 spin_lock(&ap->host_set->lock);
2420 2425
2421 ata_scsi_dump_cdb(ap, cmd); 2426 ata_scsi_dump_cdb(ap, cmd);
2422 2427
@@ -2439,6 +2444,8 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
2439 ata_scsi_translate(ap, dev, cmd, done, atapi_xlat); 2444 ata_scsi_translate(ap, dev, cmd, done, atapi_xlat);
2440 2445
2441out_unlock: 2446out_unlock:
2447 spin_unlock(&ap->host_set->lock);
2448 spin_lock(shost->host_lock);
2442 return 0; 2449 return 0;
2443} 2450}
2444 2451
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);