29 static int lldd_max_execute_num = 1;
32 "\tIf greater than one, tells the SAS Layer to run in Task Collector\n"
33 "\tMode. If 1 or 0, tells the SAS Layer to run in Direct Mode.\n"
34 "\tThe mvsas SAS LLDD supports both modes.\n"
35 "\tDefault: 1 (Direct Mode).\n");
107 sas_phy->
enabled = (phy_id < mvi->
chip->n_phy) ? 1 : 0;
123 static void mvs_free(
struct mvs_info *mvi)
152 sizeof(*mvi->
slot) * slot_nr,
171 #ifdef CONFIG_SCSI_MVSAS_TASKLET
172 static void mvs_tasklet(
unsigned long opaque)
190 for (i = 0; i < core_nr; i++) {
200 static irqreturn_t mvs_interrupt(
int irq,
void *opaque)
206 #ifndef CONFIG_SCSI_MVSAS_TASKLET
215 #ifdef CONFIG_SCSI_MVSAS_TASKLET
221 #ifdef CONFIG_SCSI_MVSAS_TASKLET
227 #ifdef CONFIG_SCSI_MVSAS_TASKLET
230 for (i = 0; i < core_nr; i++) {
249 for (i = 0; i < mvi->
chip->n_phy; i++) {
250 mvs_phy_init(mvi, i);
251 mvi->
port[
i].wide_port_phymap = 0;
252 mvi->
port[
i].port_attached = 0;
253 INIT_LIST_HEAD(&mvi->
port[i].list);
288 sizeof(*mvi->
slot) * slot_nr,
306 sprintf(pool_name,
"%s%d",
"mvs_dma_pool", mvi->
id);
324 unsigned long res_start, res_len, res_flag, res_flag_ex = 0;
332 if (!res_start || !res_len)
343 mvi->
regs_ex = (
void *)res_start;
350 if (!res_start || !res_len)
378 struct Scsi_Host *shost,
unsigned int id)
383 mvi = kzalloc(
sizeof(*mvi) +
408 if (!mvs_alloc(mvi, shost))
415 static int pci_go_64(
struct pci_dev *pdev)
420 rc = pci_set_consistent_dma_mask(pdev,
DMA_BIT_MASK(64));
422 rc = pci_set_consistent_dma_mask(pdev,
DMA_BIT_MASK(32));
425 "64-bit DMA enable failed\n");
433 "32-bit DMA enable failed\n");
436 rc = pci_set_consistent_dma_mask(pdev,
DMA_BIT_MASK(32));
439 "32-bit consistent DMA enable failed\n");
450 int phy_nr,
port_nr;
unsigned short core_nr;
455 core_nr = chip_info->
n_host;
456 phy_nr = core_nr * chip_info->
n_phy;
460 arr_phy = kcalloc(phy_nr,
sizeof(
void *),
GFP_KERNEL);
461 arr_port = kcalloc(port_nr,
sizeof(
void *),
GFP_KERNEL);
462 if (!arr_phy || !arr_port)
497 for (
j = 0;
j < nr_core;
j++) {
499 for (i = 0; i < chip_info->
n_phy; i++) {
501 &mvi->
phy[
i].sas_phy;
503 &mvi->
port[
i].sas_port;
528 static void mvs_init_sas_add(
struct mvs_info *mvi)
531 for (i = 0; i < mvi->
chip->n_phy; i++) {
532 mvi->
phy[
i].dev_sas_addr = 0x5005043011ab0000ULL;
533 mvi->
phy[
i].dev_sas_addr =
543 unsigned int rc, nhost = 0;
560 goto err_out_disable;
562 rc = pci_go_64(pdev);
564 goto err_out_regions;
569 goto err_out_regions;
578 goto err_out_regions;
581 rc = mvs_prep_sas_ha_init(shost, chip);
585 goto err_out_regions;
591 mvi = mvs_pci_alloc(pdev, ent, shost, nhost);
594 goto err_out_regions;
600 mvs_init_sas_add(mvi);
606 goto err_out_regions;
609 }
while (nhost < chip->
n_host);
611 #ifdef CONFIG_SCSI_MVSAS_TASKLET
616 mvs_post_sas_ha_init(shost, chip);
618 rc = scsi_add_host(shost, &pdev->
dev);
650 unsigned short core_nr, i = 0;
657 #ifdef CONFIG_SCSI_MVSAS_TASKLET
661 pci_set_drvdata(pdev,
NULL);
668 for (i = 0; i < core_nr; i++) {
749 .id_table = mvs_pci_table,
750 .probe = mvs_pci_init,
763 mvs_show_driver_version,
767 mvs_store_interrupt_coalescing(
struct device *
cdev,
779 if (
sscanf(buffer,
"%d", &val) != 1)
782 if (val >= 0x10000) {
783 mv_dprintk(
"interrupt coalescing timer %d us is"
796 for (i = 0; i < core_nr; i++) {
802 mv_dprintk(
"set interrupt coalescing time to %d us\n",
807 static ssize_t mvs_show_interrupt_coalescing(
struct device *cdev,
815 mvs_show_interrupt_coalescing,
816 mvs_store_interrupt_coalescing);
820 static int __init mvs_init(
void)
829 if (!mvs_task_list_cache) {
831 mv_printk(
"%s: mvs_task_list_cache alloc failed! \n", __func__);
835 rc = pci_register_driver(&mvs_pci_driver);
847 static void __exit mvs_exit(
void)
855 &dev_attr_driver_version,
856 &dev_attr_interrupt_coalescing,