aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libsas
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/libsas')
-rw-r--r--drivers/scsi/libsas/sas_ata.c30
-rw-r--r--drivers/scsi/libsas/sas_discover.c3
-rw-r--r--drivers/scsi/libsas/sas_dump.c2
-rw-r--r--drivers/scsi/libsas/sas_expander.c18
4 files changed, 30 insertions, 23 deletions
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index ced2de32c511..5e573efcf0a7 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -382,7 +382,7 @@ int sas_ata_init_host_and_port(struct domain_device *found_dev,
382 struct ata_port *ap; 382 struct ata_port *ap;
383 383
384 ata_host_init(&found_dev->sata_dev.ata_host, 384 ata_host_init(&found_dev->sata_dev.ata_host,
385 &ha->pcidev->dev, 385 ha->dev,
386 sata_port_info.flags, 386 sata_port_info.flags,
387 &sas_sata_ops); 387 &sas_sata_ops);
388 ap = ata_sas_port_alloc(&found_dev->sata_dev.ata_host, 388 ap = ata_sas_port_alloc(&found_dev->sata_dev.ata_host,
@@ -448,10 +448,10 @@ static void sas_disc_task_done(struct sas_task *task)
448 * @task: the task to be executed 448 * @task: the task to be executed
449 * @buffer: pointer to buffer to do I/O 449 * @buffer: pointer to buffer to do I/O
450 * @size: size of @buffer 450 * @size: size of @buffer
451 * @pci_dma_dir: PCI_DMA_... 451 * @dma_dir: DMA direction. DMA_xxx
452 */ 452 */
453static int sas_execute_task(struct sas_task *task, void *buffer, int size, 453static int sas_execute_task(struct sas_task *task, void *buffer, int size,
454 int pci_dma_dir) 454 enum dma_data_direction dma_dir)
455{ 455{
456 int res = 0; 456 int res = 0;
457 struct scatterlist *scatter = NULL; 457 struct scatterlist *scatter = NULL;
@@ -461,7 +461,7 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size,
461 struct sas_internal *i = 461 struct sas_internal *i =
462 to_sas_internal(task->dev->port->ha->core.shost->transportt); 462 to_sas_internal(task->dev->port->ha->core.shost->transportt);
463 463
464 if (pci_dma_dir != PCI_DMA_NONE) { 464 if (dma_dir != DMA_NONE) {
465 scatter = kzalloc(sizeof(*scatter), GFP_KERNEL); 465 scatter = kzalloc(sizeof(*scatter), GFP_KERNEL);
466 if (!scatter) 466 if (!scatter)
467 goto out; 467 goto out;
@@ -474,11 +474,11 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size,
474 task->scatter = scatter; 474 task->scatter = scatter;
475 task->num_scatter = num_scatter; 475 task->num_scatter = num_scatter;
476 task->total_xfer_len = size; 476 task->total_xfer_len = size;
477 task->data_dir = pci_dma_dir; 477 task->data_dir = dma_dir;
478 task->task_done = sas_disc_task_done; 478 task->task_done = sas_disc_task_done;
479 if (pci_dma_dir != PCI_DMA_NONE && 479 if (dma_dir != DMA_NONE &&
480 sas_protocol_ata(task->task_proto)) { 480 sas_protocol_ata(task->task_proto)) {
481 task->num_scatter = pci_map_sg(task->dev->port->ha->pcidev, 481 task->num_scatter = dma_map_sg(task->dev->port->ha->dev,
482 task->scatter, 482 task->scatter,
483 task->num_scatter, 483 task->num_scatter,
484 task->data_dir); 484 task->data_dir);
@@ -565,9 +565,9 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size,
565 } 565 }
566 } 566 }
567ex_err: 567ex_err:
568 if (pci_dma_dir != PCI_DMA_NONE) { 568 if (dma_dir != DMA_NONE) {
569 if (sas_protocol_ata(task->task_proto)) 569 if (sas_protocol_ata(task->task_proto))
570 pci_unmap_sg(task->dev->port->ha->pcidev, 570 dma_unmap_sg(task->dev->port->ha->dev,
571 task->scatter, task->num_scatter, 571 task->scatter, task->num_scatter,
572 task->data_dir); 572 task->data_dir);
573 kfree(scatter); 573 kfree(scatter);
@@ -628,11 +628,11 @@ static void sas_get_ata_command_set(struct domain_device *dev)
628 * @features: the features register 628 * @features: the features register
629 * @buffer: pointer to buffer to do I/O 629 * @buffer: pointer to buffer to do I/O
630 * @size: size of @buffer 630 * @size: size of @buffer
631 * @pci_dma_dir: PCI_DMA_... 631 * @dma_dir: DMA direction. DMA_xxx
632 */ 632 */
633static int sas_issue_ata_cmd(struct domain_device *dev, u8 command, 633static int sas_issue_ata_cmd(struct domain_device *dev, u8 command,
634 u8 features, void *buffer, int size, 634 u8 features, void *buffer, int size,
635 int pci_dma_dir) 635 enum dma_data_direction dma_dir)
636{ 636{
637 int res = 0; 637 int res = 0;
638 struct sas_task *task; 638 struct sas_task *task;
@@ -652,7 +652,7 @@ static int sas_issue_ata_cmd(struct domain_device *dev, u8 command,
652 task->ata_task.fis.device = d2h_fis->device; 652 task->ata_task.fis.device = d2h_fis->device;
653 task->ata_task.retry_count = 1; 653 task->ata_task.retry_count = 1;
654 654
655 res = sas_execute_task(task, buffer, size, pci_dma_dir); 655 res = sas_execute_task(task, buffer, size, dma_dir);
656 656
657 sas_free_task(task); 657 sas_free_task(task);
658out: 658out:
@@ -707,7 +707,7 @@ static int sas_discover_sata_dev(struct domain_device *dev)
707 } 707 }
708 708
709 res = sas_issue_ata_cmd(dev, command, 0, identify_x, 512, 709 res = sas_issue_ata_cmd(dev, command, 0, identify_x, 512,
710 PCI_DMA_FROMDEVICE); 710 DMA_FROM_DEVICE);
711 if (res) 711 if (res)
712 goto out_err; 712 goto out_err;
713 713
@@ -720,13 +720,13 @@ static int sas_discover_sata_dev(struct domain_device *dev)
720 goto cont1; 720 goto cont1;
721 res = sas_issue_ata_cmd(dev, ATA_SET_FEATURES, 721 res = sas_issue_ata_cmd(dev, ATA_SET_FEATURES,
722 ATA_FEATURE_PUP_STBY_SPIN_UP, 722 ATA_FEATURE_PUP_STBY_SPIN_UP,
723 NULL, 0, PCI_DMA_NONE); 723 NULL, 0, DMA_NONE);
724 if (res) 724 if (res)
725 goto cont1; 725 goto cont1;
726 726
727 schedule_timeout_interruptible(5*HZ); /* More time? */ 727 schedule_timeout_interruptible(5*HZ); /* More time? */
728 res = sas_issue_ata_cmd(dev, command, 0, identify_x, 512, 728 res = sas_issue_ata_cmd(dev, command, 0, identify_x, 512,
729 PCI_DMA_FROMDEVICE); 729 DMA_FROM_DEVICE);
730 if (res) 730 if (res)
731 goto out_err; 731 goto out_err;
732 } 732 }
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
index 6ac9f61d006a..7ef0afc3cd68 100644
--- a/drivers/scsi/libsas/sas_discover.c
+++ b/drivers/scsi/libsas/sas_discover.c
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include <linux/pci.h>
26#include <linux/scatterlist.h> 25#include <linux/scatterlist.h>
27#include <scsi/scsi_host.h> 26#include <scsi/scsi_host.h>
28#include <scsi/scsi_eh.h> 27#include <scsi/scsi_eh.h>
@@ -170,7 +169,7 @@ int sas_notify_lldd_dev_found(struct domain_device *dev)
170 if (res) { 169 if (res) {
171 printk("sas: driver on pcidev %s cannot handle " 170 printk("sas: driver on pcidev %s cannot handle "
172 "device %llx, error:%d\n", 171 "device %llx, error:%d\n",
173 pci_name(sas_ha->pcidev), 172 sas_ha->dev->bus_id,
174 SAS_ADDR(dev->sas_addr), res); 173 SAS_ADDR(dev->sas_addr), res);
175 } 174 }
176 } 175 }
diff --git a/drivers/scsi/libsas/sas_dump.c b/drivers/scsi/libsas/sas_dump.c
index f1246d2c9bef..bf34a236f946 100644
--- a/drivers/scsi/libsas/sas_dump.c
+++ b/drivers/scsi/libsas/sas_dump.c
@@ -56,7 +56,7 @@ void sas_dprint_phye(int phyid, enum phy_event pe)
56 56
57void sas_dprint_hae(struct sas_ha_struct *sas_ha, enum ha_event he) 57void sas_dprint_hae(struct sas_ha_struct *sas_ha, enum ha_event he)
58{ 58{
59 SAS_DPRINTK("ha %s: %s event\n", pci_name(sas_ha->pcidev), 59 SAS_DPRINTK("ha %s: %s event\n", sas_ha->dev->bus_id,
60 sas_hae_str[he]); 60 sas_hae_str[he]);
61} 61}
62 62
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index b500f0c1449c..8727436b222d 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -507,14 +507,21 @@ static int sas_dev_present_in_domain(struct asd_sas_port *port,
507int sas_smp_get_phy_events(struct sas_phy *phy) 507int sas_smp_get_phy_events(struct sas_phy *phy)
508{ 508{
509 int res; 509 int res;
510 u8 *req;
511 u8 *resp;
510 struct sas_rphy *rphy = dev_to_rphy(phy->dev.parent); 512 struct sas_rphy *rphy = dev_to_rphy(phy->dev.parent);
511 struct domain_device *dev = sas_find_dev_by_rphy(rphy); 513 struct domain_device *dev = sas_find_dev_by_rphy(rphy);
512 u8 *req = alloc_smp_req(RPEL_REQ_SIZE);
513 u8 *resp = kzalloc(RPEL_RESP_SIZE, GFP_KERNEL);
514 514
515 if (!resp) 515 req = alloc_smp_req(RPEL_REQ_SIZE);
516 if (!req)
516 return -ENOMEM; 517 return -ENOMEM;
517 518
519 resp = alloc_smp_resp(RPEL_RESP_SIZE);
520 if (!resp) {
521 kfree(req);
522 return -ENOMEM;
523 }
524
518 req[1] = SMP_REPORT_PHY_ERR_LOG; 525 req[1] = SMP_REPORT_PHY_ERR_LOG;
519 req[9] = phy->number; 526 req[9] = phy->number;
520 527
@@ -1879,7 +1886,7 @@ int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
1879 struct request *req) 1886 struct request *req)
1880{ 1887{
1881 struct domain_device *dev; 1888 struct domain_device *dev;
1882 int ret, type = rphy->identify.device_type; 1889 int ret, type;
1883 struct request *rsp = req->next_rq; 1890 struct request *rsp = req->next_rq;
1884 1891
1885 if (!rsp) { 1892 if (!rsp) {
@@ -1888,12 +1895,13 @@ int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
1888 return -EINVAL; 1895 return -EINVAL;
1889 } 1896 }
1890 1897
1891 /* seems aic94xx doesn't support */ 1898 /* no rphy means no smp target support (ie aic94xx host) */
1892 if (!rphy) { 1899 if (!rphy) {
1893 printk("%s: can we send a smp request to a host?\n", 1900 printk("%s: can we send a smp request to a host?\n",
1894 __FUNCTION__); 1901 __FUNCTION__);
1895 return -EINVAL; 1902 return -EINVAL;
1896 } 1903 }
1904 type = rphy->identify.device_type;
1897 1905
1898 if (type != SAS_EDGE_EXPANDER_DEVICE && 1906 if (type != SAS_EDGE_EXPANDER_DEVICE &&
1899 type != SAS_FANOUT_EXPANDER_DEVICE) { 1907 type != SAS_FANOUT_EXPANDER_DEVICE) {