diff options
Diffstat (limited to 'drivers/scsi/ibmvscsi/ibmvscsi.c')
-rw-r--r-- | drivers/scsi/ibmvscsi/ibmvscsi.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index d9b0e9d31983..88bad0e81bdd 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
@@ -40,7 +40,7 @@ | |||
40 | * (CRQ), which is just a buffer of 16 byte entries in the receiver's | 40 | * (CRQ), which is just a buffer of 16 byte entries in the receiver's |
41 | * Senders cannot access the buffer directly, but send messages by | 41 | * Senders cannot access the buffer directly, but send messages by |
42 | * making a hypervisor call and passing in the 16 bytes. The hypervisor | 42 | * making a hypervisor call and passing in the 16 bytes. The hypervisor |
43 | * puts the message in the next 16 byte space in round-robbin fashion, | 43 | * puts the message in the next 16 byte space in round-robin fashion, |
44 | * turns on the high order bit of the message (the valid bit), and | 44 | * turns on the high order bit of the message (the valid bit), and |
45 | * generates an interrupt to the receiver (if interrupts are turned on.) | 45 | * generates an interrupt to the receiver (if interrupts are turned on.) |
46 | * The receiver just turns off the valid bit when they have copied out | 46 | * The receiver just turns off the valid bit when they have copied out |
@@ -70,7 +70,9 @@ | |||
70 | #include <linux/moduleparam.h> | 70 | #include <linux/moduleparam.h> |
71 | #include <linux/dma-mapping.h> | 71 | #include <linux/dma-mapping.h> |
72 | #include <linux/delay.h> | 72 | #include <linux/delay.h> |
73 | #include <linux/slab.h> | ||
73 | #include <linux/of.h> | 74 | #include <linux/of.h> |
75 | #include <linux/pm.h> | ||
74 | #include <asm/firmware.h> | 76 | #include <asm/firmware.h> |
75 | #include <asm/vio.h> | 77 | #include <asm/vio.h> |
76 | #include <scsi/scsi.h> | 78 | #include <scsi/scsi.h> |
@@ -321,16 +323,6 @@ static void set_srp_direction(struct scsi_cmnd *cmd, | |||
321 | srp_cmd->buf_fmt = fmt; | 323 | srp_cmd->buf_fmt = fmt; |
322 | } | 324 | } |
323 | 325 | ||
324 | static void unmap_sg_list(int num_entries, | ||
325 | struct device *dev, | ||
326 | struct srp_direct_buf *md) | ||
327 | { | ||
328 | int i; | ||
329 | |||
330 | for (i = 0; i < num_entries; ++i) | ||
331 | dma_unmap_single(dev, md[i].va, md[i].len, DMA_BIDIRECTIONAL); | ||
332 | } | ||
333 | |||
334 | /** | 326 | /** |
335 | * unmap_cmd_data: - Unmap data pointed in srp_cmd based on the format | 327 | * unmap_cmd_data: - Unmap data pointed in srp_cmd based on the format |
336 | * @cmd: srp_cmd whose additional_data member will be unmapped | 328 | * @cmd: srp_cmd whose additional_data member will be unmapped |
@@ -348,24 +340,9 @@ static void unmap_cmd_data(struct srp_cmd *cmd, | |||
348 | 340 | ||
349 | if (out_fmt == SRP_NO_DATA_DESC && in_fmt == SRP_NO_DATA_DESC) | 341 | if (out_fmt == SRP_NO_DATA_DESC && in_fmt == SRP_NO_DATA_DESC) |
350 | return; | 342 | return; |
351 | else if (out_fmt == SRP_DATA_DESC_DIRECT || | ||
352 | in_fmt == SRP_DATA_DESC_DIRECT) { | ||
353 | struct srp_direct_buf *data = | ||
354 | (struct srp_direct_buf *) cmd->add_data; | ||
355 | dma_unmap_single(dev, data->va, data->len, DMA_BIDIRECTIONAL); | ||
356 | } else { | ||
357 | struct srp_indirect_buf *indirect = | ||
358 | (struct srp_indirect_buf *) cmd->add_data; | ||
359 | int num_mapped = indirect->table_desc.len / | ||
360 | sizeof(struct srp_direct_buf); | ||
361 | 343 | ||
362 | if (num_mapped <= MAX_INDIRECT_BUFS) { | 344 | if (evt_struct->cmnd) |
363 | unmap_sg_list(num_mapped, dev, &indirect->desc_list[0]); | 345 | scsi_dma_unmap(evt_struct->cmnd); |
364 | return; | ||
365 | } | ||
366 | |||
367 | unmap_sg_list(num_mapped, dev, evt_struct->ext_list); | ||
368 | } | ||
369 | } | 346 | } |
370 | 347 | ||
371 | static int map_sg_list(struct scsi_cmnd *cmd, int nseg, | 348 | static int map_sg_list(struct scsi_cmnd *cmd, int nseg, |
@@ -1637,12 +1614,17 @@ static int ibmvscsi_slave_configure(struct scsi_device *sdev) | |||
1637 | * ibmvscsi_change_queue_depth - Change the device's queue depth | 1614 | * ibmvscsi_change_queue_depth - Change the device's queue depth |
1638 | * @sdev: scsi device struct | 1615 | * @sdev: scsi device struct |
1639 | * @qdepth: depth to set | 1616 | * @qdepth: depth to set |
1617 | * @reason: calling context | ||
1640 | * | 1618 | * |
1641 | * Return value: | 1619 | * Return value: |
1642 | * actual depth set | 1620 | * actual depth set |
1643 | **/ | 1621 | **/ |
1644 | static int ibmvscsi_change_queue_depth(struct scsi_device *sdev, int qdepth) | 1622 | static int ibmvscsi_change_queue_depth(struct scsi_device *sdev, int qdepth, |
1623 | int reason) | ||
1645 | { | 1624 | { |
1625 | if (reason != SCSI_QDEPTH_DEFAULT) | ||
1626 | return -EOPNOTSUPP; | ||
1627 | |||
1646 | if (qdepth > IBMVSCSI_MAX_CMDS_PER_LUN) | 1628 | if (qdepth > IBMVSCSI_MAX_CMDS_PER_LUN) |
1647 | qdepth = IBMVSCSI_MAX_CMDS_PER_LUN; | 1629 | qdepth = IBMVSCSI_MAX_CMDS_PER_LUN; |
1648 | 1630 | ||
@@ -1986,6 +1968,19 @@ static int ibmvscsi_remove(struct vio_dev *vdev) | |||
1986 | } | 1968 | } |
1987 | 1969 | ||
1988 | /** | 1970 | /** |
1971 | * ibmvscsi_resume: Resume from suspend | ||
1972 | * @dev: device struct | ||
1973 | * | ||
1974 | * We may have lost an interrupt across suspend/resume, so kick the | ||
1975 | * interrupt handler | ||
1976 | */ | ||
1977 | static int ibmvscsi_resume(struct device *dev) | ||
1978 | { | ||
1979 | struct ibmvscsi_host_data *hostdata = dev_get_drvdata(dev); | ||
1980 | return ibmvscsi_ops->resume(hostdata); | ||
1981 | } | ||
1982 | |||
1983 | /** | ||
1989 | * ibmvscsi_device_table: Used by vio.c to match devices in the device tree we | 1984 | * ibmvscsi_device_table: Used by vio.c to match devices in the device tree we |
1990 | * support. | 1985 | * support. |
1991 | */ | 1986 | */ |
@@ -1995,6 +1990,10 @@ static struct vio_device_id ibmvscsi_device_table[] __devinitdata = { | |||
1995 | }; | 1990 | }; |
1996 | MODULE_DEVICE_TABLE(vio, ibmvscsi_device_table); | 1991 | MODULE_DEVICE_TABLE(vio, ibmvscsi_device_table); |
1997 | 1992 | ||
1993 | static struct dev_pm_ops ibmvscsi_pm_ops = { | ||
1994 | .resume = ibmvscsi_resume | ||
1995 | }; | ||
1996 | |||
1998 | static struct vio_driver ibmvscsi_driver = { | 1997 | static struct vio_driver ibmvscsi_driver = { |
1999 | .id_table = ibmvscsi_device_table, | 1998 | .id_table = ibmvscsi_device_table, |
2000 | .probe = ibmvscsi_probe, | 1999 | .probe = ibmvscsi_probe, |
@@ -2003,6 +2002,7 @@ static struct vio_driver ibmvscsi_driver = { | |||
2003 | .driver = { | 2002 | .driver = { |
2004 | .name = "ibmvscsi", | 2003 | .name = "ibmvscsi", |
2005 | .owner = THIS_MODULE, | 2004 | .owner = THIS_MODULE, |
2005 | .pm = &ibmvscsi_pm_ops, | ||
2006 | } | 2006 | } |
2007 | }; | 2007 | }; |
2008 | 2008 | ||