diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-10-30 23:35:23 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-30 23:35:23 -0500 |
commit | cd8200e6d4f9f05e6ea48f7c000be890337396ac (patch) | |
tree | 2542b1bca535526750e5e1978091beebf4cf282b /drivers/scsi | |
parent | 122401ce39faab22b29eb11b20e4342f7f566b1b (diff) | |
parent | 005a5a06a6dd13a0ca3f2c6a0218e8d94ed36d8a (diff) |
Merge branch 'upstream'
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/libata-core.c | 57 | ||||
-rw-r--r-- | drivers/scsi/libata-scsi.c | 9 | ||||
-rw-r--r-- | drivers/scsi/libata.h | 1 |
3 files changed, 17 insertions, 50 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; |
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 | ||
2431 | out_unlock: | 2436 | out_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); | |||
48 | extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); | 48 | extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); |
49 | extern void ata_dev_select(struct ata_port *ap, unsigned int device, | 49 | extern 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); |
51 | extern void ata_tf_to_host_nolock(struct ata_port *ap, const struct ata_taskfile *tf); | ||
52 | extern void swap_buf_le16(u16 *buf, unsigned int buf_words); | 51 | extern void swap_buf_le16(u16 *buf, unsigned int buf_words); |
53 | extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg); | 52 | extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg); |
54 | extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg); | 53 | extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg); |