Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 21766
b: refs/heads/master
c: c4811b1
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Garzik committed Oct 31, 2005
1 parent bde04d5 commit bdbab7f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 52 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 024b1432716c0d8332327a506cb0f64c9a2f6083
refs/heads/master: c4811b151b6584a668de8ae59eb71c4890b9ad94
59 changes: 10 additions & 49 deletions trunk/drivers/scsi/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,28 +294,6 @@ void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf)
ata_exec_command_pio(ap, tf);
}

/**
* ata_exec - issue ATA command to host controller
* @ap: port to which command is being issued
* @tf: ATA taskfile register set
*
* Issues PIO/MMIO write to ATA command register, with proper
* synchronization with interrupt handler / other threads.
*
* LOCKING:
* Obtains host_set lock.
*/

static inline void ata_exec(struct ata_port *ap, const struct ata_taskfile *tf)
{
unsigned long flags;

DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command);
spin_lock_irqsave(&ap->host_set->lock, flags);
ap->ops->exec_command(ap, tf);
spin_unlock_irqrestore(&ap->host_set->lock, flags);
}

/**
* ata_tf_to_host - issue ATA taskfile to host controller
* @ap: port to which command is being issued
Expand All @@ -326,30 +304,11 @@ static inline void ata_exec(struct ata_port *ap, const struct ata_taskfile *tf)
* other threads.
*
* LOCKING:
* Obtains host_set lock.
*/

static void ata_tf_to_host(struct ata_port *ap, const struct ata_taskfile *tf)
{
ap->ops->tf_load(ap, tf);

ata_exec(ap, tf);
}

/**
* ata_tf_to_host_nolock - issue ATA taskfile to host controller
* @ap: port to which command is being issued
* @tf: ATA taskfile register set
*
* Issues ATA taskfile register set to ATA host controller,
* with proper synchronization with interrupt handler and
* other threads.
*
* LOCKING:
* spin_lock_irqsave(host_set lock)
*/

void ata_tf_to_host_nolock(struct ata_port *ap, const struct ata_taskfile *tf)
static inline void ata_tf_to_host(struct ata_port *ap,
const struct ata_taskfile *tf)
{
ap->ops->tf_load(ap, tf);
ap->ops->exec_command(ap, tf);
Expand Down Expand Up @@ -1912,12 +1871,14 @@ static void ata_bus_post_reset(struct ata_port *ap, unsigned int devmask)
*
* LOCKING:
* PCI/etc. bus probe sem.
* Obtains host_set lock.
*
*/

static unsigned int ata_bus_edd(struct ata_port *ap)
{
struct ata_taskfile tf;
unsigned long flags;

/* set up execute-device-diag (bus reset) taskfile */
/* also, take interrupts to a known state (disabled) */
Expand All @@ -1928,7 +1889,9 @@ static unsigned int ata_bus_edd(struct ata_port *ap)
tf.protocol = ATA_PROT_NODATA;

/* do bus reset */
spin_lock_irqsave(&ap->host_set->lock, flags);
ata_tf_to_host(ap, &tf);
spin_unlock_irqrestore(&ap->host_set->lock, flags);

/* spec says at least 2ms. but who knows with those
* crazy ATAPI devices...
Expand Down Expand Up @@ -3555,7 +3518,7 @@ int ata_qc_issue_prot(struct ata_queued_cmd *qc)

switch (qc->tf.protocol) {
case ATA_PROT_NODATA:
ata_tf_to_host_nolock(ap, &qc->tf);
ata_tf_to_host(ap, &qc->tf);
break;

case ATA_PROT_DMA:
Expand All @@ -3566,20 +3529,20 @@ int ata_qc_issue_prot(struct ata_queued_cmd *qc)

case ATA_PROT_PIO: /* load tf registers, initiate polling pio */
ata_qc_set_polling(qc);
ata_tf_to_host_nolock(ap, &qc->tf);
ata_tf_to_host(ap, &qc->tf);
ap->hsm_task_state = HSM_ST;
queue_work(ata_wq, &ap->pio_task);
break;

case ATA_PROT_ATAPI:
ata_qc_set_polling(qc);
ata_tf_to_host_nolock(ap, &qc->tf);
ata_tf_to_host(ap, &qc->tf);
queue_work(ata_wq, &ap->packet_task);
break;

case ATA_PROT_ATAPI_NODATA:
ap->flags |= ATA_FLAG_NOINTR;
ata_tf_to_host_nolock(ap, &qc->tf);
ata_tf_to_host(ap, &qc->tf);
queue_work(ata_wq, &ap->packet_task);
break;

Expand Down Expand Up @@ -4126,8 +4089,6 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host,
host->unique_id = ata_unique_id++;
host->max_cmd_len = 12;

scsi_assign_lock(host, &host_set->lock);

ap->flags = ATA_FLAG_PORT_DISABLED;
ap->id = host->unique_id;
ap->host = host;
Expand Down
9 changes: 8 additions & 1 deletion trunk/drivers/scsi/libata-scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <scsi/scsi.h>
#include "scsi.h"
#include <scsi/scsi_host.h>
#include <scsi/scsi_device.h>
#include <linux/libata.h>
#include <linux/hdreg.h>
#include <asm/uaccess.h>
Expand Down Expand Up @@ -2399,8 +2400,12 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
struct ata_port *ap;
struct ata_device *dev;
struct scsi_device *scsidev = cmd->device;
struct Scsi_Host *shost = scsidev->host;

ap = (struct ata_port *) &scsidev->host->hostdata[0];
ap = (struct ata_port *) &shost->hostdata[0];

spin_unlock(shost->host_lock);
spin_lock(&ap->host_set->lock);

ata_scsi_dump_cdb(ap, cmd);

Expand All @@ -2423,6 +2428,8 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
ata_scsi_translate(ap, dev, cmd, done, atapi_xlat);

out_unlock:
spin_unlock(&ap->host_set->lock);
spin_lock(shost->host_lock);
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/scsi/libata.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ extern int ata_qc_issue(struct ata_queued_cmd *qc);
extern int ata_check_atapi_dma(struct ata_queued_cmd *qc);
extern void ata_dev_select(struct ata_port *ap, unsigned int device,
unsigned int wait, unsigned int can_sleep);
extern void ata_tf_to_host_nolock(struct ata_port *ap, const struct ata_taskfile *tf);
extern void swap_buf_le16(u16 *buf, unsigned int buf_words);
extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg);
extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg);
Expand Down

0 comments on commit bdbab7f

Please sign in to comment.