Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 62704
b: refs/heads/master
c: 0f05df8
h: refs/heads/master
v: v3
  • Loading branch information
James Bottomley authored and James Bottomley committed Jul 18, 2007
1 parent 40ff0c6 commit 063eb32
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 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: 3a2755af37b317d47fdc3dd15178adaf5d47263e
refs/heads/master: 0f05df8b3b41bc258bdf520b72e8cf7c524048b7
4 changes: 2 additions & 2 deletions trunk/drivers/scsi/aic94xx/aic94xx_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static inline int asd_map_scatterlist(struct sas_task *task,

/* STP tasks come from libata which has already mapped
* the SG list */
if (task->task_proto == SAS_PROTOCOL_STP)
if (sas_protocol_ata(task->task_proto))
num_sg = task->num_scatter;
else
num_sg = pci_map_sg(asd_ha->pcidev, task->scatter,
Expand Down Expand Up @@ -125,7 +125,7 @@ static inline int asd_map_scatterlist(struct sas_task *task,

return 0;
err_unmap:
if (task->task_proto != SAS_PROTOCOL_STP)
if (sas_protocol_ata(task->task_proto))
pci_unmap_sg(asd_ha->pcidev, task->scatter, task->num_scatter,
task->data_dir);
return res;
Expand Down
14 changes: 13 additions & 1 deletion trunk/drivers/scsi/libsas/sas_discover.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size,
task->total_xfer_len = size;
task->data_dir = pci_dma_dir;
task->task_done = sas_disc_task_done;
if (pci_dma_dir != PCI_DMA_NONE &&
sas_protocol_ata(task->task_proto)) {
task->num_scatter = pci_map_sg(task->dev->port->ha->pcidev,
task->scatter,
task->num_scatter,
task->data_dir);
}

for (retries = 0; retries < 5; retries++) {
task->task_state_flags = SAS_TASK_STATE_PENDING;
Expand Down Expand Up @@ -192,8 +199,13 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size,
}
}
ex_err:
if (pci_dma_dir != PCI_DMA_NONE)
if (pci_dma_dir != PCI_DMA_NONE) {
if (sas_protocol_ata(task->task_proto))
pci_unmap_sg(task->dev->port->ha->pcidev,
task->scatter, task->num_scatter,
task->data_dir);
kfree(scatter);
}
out:
return res;
}
Expand Down
6 changes: 6 additions & 0 deletions trunk/include/scsi/scsi_transport_sas.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ enum sas_protocol {
SAS_PROTOCOL_SSP = 0x08,
};

static inline int sas_protocol_ata(enum sas_protocol proto)
{
return ((proto & SAS_PROTOCOL_SATA) ||
(proto & SAS_PROTOCOL_STP))? 1 : 0;
}

enum sas_linkrate {
/* These Values are defined in the SAS standard */
SAS_LINK_RATE_UNKNOWN = 0,
Expand Down

0 comments on commit 063eb32

Please sign in to comment.