Lines Matching refs:pm8001_ha

138 static void pm8001_phy_init(struct pm8001_hba_info *pm8001_ha, int phy_id)  in pm8001_phy_init()  argument
140 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; in pm8001_phy_init()
143 phy->pm8001_ha = pm8001_ha; in pm8001_phy_init()
144 sas_phy->enabled = (phy_id < pm8001_ha->chip->n_phy) ? 1 : 0; in pm8001_phy_init()
155 sas_phy->ha = (struct sas_ha_struct *)pm8001_ha->shost->hostdata; in pm8001_phy_init()
163 static void pm8001_free(struct pm8001_hba_info *pm8001_ha) in pm8001_free() argument
167 if (!pm8001_ha) in pm8001_free()
171 if (pm8001_ha->memoryMap.region[i].virt_ptr != NULL) { in pm8001_free()
172 dma_free_coherent(&pm8001_ha->pdev->dev, in pm8001_free()
173 (pm8001_ha->memoryMap.region[i].total_len + in pm8001_free()
174 pm8001_ha->memoryMap.region[i].alignment), in pm8001_free()
175 pm8001_ha->memoryMap.region[i].virt_ptr, in pm8001_free()
176 pm8001_ha->memoryMap.region[i].phys_addr); in pm8001_free()
179 PM8001_CHIP_DISP->chip_iounmap(pm8001_ha); in pm8001_free()
181 kfree(pm8001_ha->tags); in pm8001_free()
182 kfree(pm8001_ha); in pm8001_free()
194 struct pm8001_hba_info *pm8001_ha; in pm8001_tasklet() local
198 pm8001_ha = irq_vector->drv_inst; in pm8001_tasklet()
199 if (unlikely(!pm8001_ha)) in pm8001_tasklet()
201 PM8001_CHIP_DISP->isr(pm8001_ha, irq_vector->irq_id); in pm8001_tasklet()
216 struct pm8001_hba_info *pm8001_ha; in pm8001_interrupt_handler_msix() local
219 pm8001_ha = irq_vector->drv_inst; in pm8001_interrupt_handler_msix()
221 if (unlikely(!pm8001_ha)) in pm8001_interrupt_handler_msix()
223 if (!PM8001_CHIP_DISP->is_our_interrupt(pm8001_ha)) in pm8001_interrupt_handler_msix()
226 tasklet_schedule(&pm8001_ha->tasklet[irq_vector->irq_id]); in pm8001_interrupt_handler_msix()
228 ret = PM8001_CHIP_DISP->isr(pm8001_ha, irq_vector->irq_id); in pm8001_interrupt_handler_msix()
241 struct pm8001_hba_info *pm8001_ha; in pm8001_interrupt_handler_intx() local
244 pm8001_ha = sha->lldd_ha; in pm8001_interrupt_handler_intx()
245 if (unlikely(!pm8001_ha)) in pm8001_interrupt_handler_intx()
247 if (!PM8001_CHIP_DISP->is_our_interrupt(pm8001_ha)) in pm8001_interrupt_handler_intx()
251 tasklet_schedule(&pm8001_ha->tasklet[0]); in pm8001_interrupt_handler_intx()
253 ret = PM8001_CHIP_DISP->isr(pm8001_ha, 0); in pm8001_interrupt_handler_intx()
258 static u32 pm8001_setup_irq(struct pm8001_hba_info *pm8001_ha);
259 static u32 pm8001_request_irq(struct pm8001_hba_info *pm8001_ha);
266 static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha, in pm8001_alloc() argument
273 spin_lock_init(&pm8001_ha->lock); in pm8001_alloc()
274 spin_lock_init(&pm8001_ha->bitmap_lock); in pm8001_alloc()
275 pm8001_dbg(pm8001_ha, INIT, "pm8001_alloc: PHY:%x\n", in pm8001_alloc()
276 pm8001_ha->chip->n_phy); in pm8001_alloc()
279 rc = pm8001_setup_irq(pm8001_ha); in pm8001_alloc()
281 pm8001_dbg(pm8001_ha, FAIL, in pm8001_alloc()
286 rc = pm8001_request_irq(pm8001_ha); in pm8001_alloc()
290 count = pm8001_ha->max_q_num; in pm8001_alloc()
292 ib_offset = pm8001_ha->ib_offset = USI_MAX_MEMCNT_BASE; in pm8001_alloc()
293 ci_offset = pm8001_ha->ci_offset = ib_offset + count; in pm8001_alloc()
294 ob_offset = pm8001_ha->ob_offset = ci_offset + count; in pm8001_alloc()
295 pi_offset = pm8001_ha->pi_offset = ob_offset + count; in pm8001_alloc()
296 pm8001_ha->max_memcnt = pi_offset + count; in pm8001_alloc()
298 for (i = 0; i < pm8001_ha->chip->n_phy; i++) { in pm8001_alloc()
299 pm8001_phy_init(pm8001_ha, i); in pm8001_alloc()
300 pm8001_ha->port[i].wide_port_phymap = 0; in pm8001_alloc()
301 pm8001_ha->port[i].port_attached = 0; in pm8001_alloc()
302 pm8001_ha->port[i].port_state = 0; in pm8001_alloc()
303 INIT_LIST_HEAD(&pm8001_ha->port[i].list); in pm8001_alloc()
307 pm8001_ha->memoryMap.region[AAP1].num_elements = 1; in pm8001_alloc()
308 pm8001_ha->memoryMap.region[AAP1].element_size = PM8001_EVENT_LOG_SIZE; in pm8001_alloc()
309 pm8001_ha->memoryMap.region[AAP1].total_len = PM8001_EVENT_LOG_SIZE; in pm8001_alloc()
310 pm8001_ha->memoryMap.region[AAP1].alignment = 32; in pm8001_alloc()
313 pm8001_ha->memoryMap.region[IOP].num_elements = 1; in pm8001_alloc()
314 pm8001_ha->memoryMap.region[IOP].element_size = PM8001_EVENT_LOG_SIZE; in pm8001_alloc()
315 pm8001_ha->memoryMap.region[IOP].total_len = PM8001_EVENT_LOG_SIZE; in pm8001_alloc()
316 pm8001_ha->memoryMap.region[IOP].alignment = 32; in pm8001_alloc()
319 circularQ = &pm8001_ha->inbnd_q_tbl[i]; in pm8001_alloc()
322 pm8001_ha->memoryMap.region[ci_offset+i].num_elements = 1; in pm8001_alloc()
323 pm8001_ha->memoryMap.region[ci_offset+i].element_size = 4; in pm8001_alloc()
324 pm8001_ha->memoryMap.region[ci_offset+i].total_len = 4; in pm8001_alloc()
325 pm8001_ha->memoryMap.region[ci_offset+i].alignment = 4; in pm8001_alloc()
329 pm8001_ha->memoryMap.region[ib_offset+i].num_elements = in pm8001_alloc()
331 pm8001_ha->memoryMap.region[ib_offset+i].element_size in pm8001_alloc()
333 pm8001_ha->memoryMap.region[ib_offset+i].total_len = in pm8001_alloc()
335 pm8001_ha->memoryMap.region[ib_offset+i].alignment in pm8001_alloc()
338 pm8001_ha->memoryMap.region[ib_offset+i].num_elements = in pm8001_alloc()
340 pm8001_ha->memoryMap.region[ib_offset+i].element_size in pm8001_alloc()
342 pm8001_ha->memoryMap.region[ib_offset+i].total_len = in pm8001_alloc()
344 pm8001_ha->memoryMap.region[ib_offset+i].alignment = 64; in pm8001_alloc()
350 pm8001_ha->memoryMap.region[pi_offset+i].num_elements = 1; in pm8001_alloc()
351 pm8001_ha->memoryMap.region[pi_offset+i].element_size = 4; in pm8001_alloc()
352 pm8001_ha->memoryMap.region[pi_offset+i].total_len = 4; in pm8001_alloc()
353 pm8001_ha->memoryMap.region[pi_offset+i].alignment = 4; in pm8001_alloc()
357 pm8001_ha->memoryMap.region[ob_offset+i].num_elements = in pm8001_alloc()
359 pm8001_ha->memoryMap.region[ob_offset+i].element_size in pm8001_alloc()
361 pm8001_ha->memoryMap.region[ob_offset+i].total_len = in pm8001_alloc()
363 pm8001_ha->memoryMap.region[ob_offset+i].alignment in pm8001_alloc()
367 pm8001_ha->memoryMap.region[ob_offset+i].num_elements = in pm8001_alloc()
369 pm8001_ha->memoryMap.region[ob_offset+i].element_size in pm8001_alloc()
371 pm8001_ha->memoryMap.region[ob_offset+i].total_len = in pm8001_alloc()
373 pm8001_ha->memoryMap.region[ob_offset+i].alignment = 64; in pm8001_alloc()
378 pm8001_ha->memoryMap.region[NVMD].num_elements = 1; in pm8001_alloc()
379 pm8001_ha->memoryMap.region[NVMD].element_size = 4096; in pm8001_alloc()
380 pm8001_ha->memoryMap.region[NVMD].total_len = 4096; in pm8001_alloc()
383 pm8001_ha->memoryMap.region[FW_FLASH].total_len = 4096; in pm8001_alloc()
385 pm8001_ha->memoryMap.region[FORENSIC_MEM].num_elements = 1; in pm8001_alloc()
386 pm8001_ha->memoryMap.region[FORENSIC_MEM].total_len = 0x10000; in pm8001_alloc()
387 pm8001_ha->memoryMap.region[FORENSIC_MEM].element_size = 0x10000; in pm8001_alloc()
388 pm8001_ha->memoryMap.region[FORENSIC_MEM].alignment = 0x10000; in pm8001_alloc()
389 for (i = 0; i < pm8001_ha->max_memcnt; i++) { in pm8001_alloc()
390 if (pm8001_mem_alloc(pm8001_ha->pdev, in pm8001_alloc()
391 &pm8001_ha->memoryMap.region[i].virt_ptr, in pm8001_alloc()
392 &pm8001_ha->memoryMap.region[i].phys_addr, in pm8001_alloc()
393 &pm8001_ha->memoryMap.region[i].phys_addr_hi, in pm8001_alloc()
394 &pm8001_ha->memoryMap.region[i].phys_addr_lo, in pm8001_alloc()
395 pm8001_ha->memoryMap.region[i].total_len, in pm8001_alloc()
396 pm8001_ha->memoryMap.region[i].alignment) != 0) { in pm8001_alloc()
397 pm8001_dbg(pm8001_ha, FAIL, in pm8001_alloc()
405 pm8001_ha->devices = kzalloc(PM8001_MAX_DEVICES in pm8001_alloc()
407 if (!pm8001_ha->devices) { in pm8001_alloc()
412 pm8001_ha->devices[i].dev_type = SAS_PHY_UNUSED; in pm8001_alloc()
413 pm8001_ha->devices[i].id = i; in pm8001_alloc()
414 pm8001_ha->devices[i].device_id = PM8001_MAX_DEVICES; in pm8001_alloc()
415 atomic_set(&pm8001_ha->devices[i].running_req, 0); in pm8001_alloc()
417 pm8001_ha->flags = PM8001F_INIT_TIME; in pm8001_alloc()
419 pm8001_tag_init(pm8001_ha); in pm8001_alloc()
423 for (i = 0; i < pm8001_ha->max_memcnt; i++) { in pm8001_alloc()
424 if (pm8001_ha->memoryMap.region[i].virt_ptr != NULL) { in pm8001_alloc()
425 pci_free_consistent(pm8001_ha->pdev, in pm8001_alloc()
426 (pm8001_ha->memoryMap.region[i].total_len + in pm8001_alloc()
427 pm8001_ha->memoryMap.region[i].alignment), in pm8001_alloc()
428 pm8001_ha->memoryMap.region[i].virt_ptr, in pm8001_alloc()
429 pm8001_ha->memoryMap.region[i].phys_addr); in pm8001_alloc()
441 static int pm8001_ioremap(struct pm8001_hba_info *pm8001_ha) in pm8001_ioremap() argument
447 pdev = pm8001_ha->pdev; in pm8001_ioremap()
461 pm8001_ha->io_mem[logicalBar].membase = in pm8001_ioremap()
463 pm8001_ha->io_mem[logicalBar].memsize = in pm8001_ioremap()
465 pm8001_ha->io_mem[logicalBar].memvirtaddr = in pm8001_ioremap()
466 ioremap(pm8001_ha->io_mem[logicalBar].membase, in pm8001_ioremap()
467 pm8001_ha->io_mem[logicalBar].memsize); in pm8001_ioremap()
468 pm8001_dbg(pm8001_ha, INIT, in pm8001_ioremap()
471 pm8001_dbg(pm8001_ha, INIT, in pm8001_ioremap()
473 (u64)pm8001_ha->io_mem[logicalBar].membase, in pm8001_ioremap()
475 pm8001_ha->io_mem[logicalBar].memvirtaddr, in pm8001_ioremap()
476 pm8001_ha->io_mem[logicalBar].memsize); in pm8001_ioremap()
478 pm8001_ha->io_mem[logicalBar].membase = 0; in pm8001_ioremap()
479 pm8001_ha->io_mem[logicalBar].memsize = 0; in pm8001_ioremap()
480 pm8001_ha->io_mem[logicalBar].memvirtaddr = NULL; in pm8001_ioremap()
498 struct pm8001_hba_info *pm8001_ha; in pm8001_pci_alloc() local
502 pm8001_ha = sha->lldd_ha; in pm8001_pci_alloc()
503 if (!pm8001_ha) in pm8001_pci_alloc()
506 pm8001_ha->pdev = pdev; in pm8001_pci_alloc()
507 pm8001_ha->dev = &pdev->dev; in pm8001_pci_alloc()
508 pm8001_ha->chip_id = ent->driver_data; in pm8001_pci_alloc()
509 pm8001_ha->chip = &pm8001_chips[pm8001_ha->chip_id]; in pm8001_pci_alloc()
510 pm8001_ha->irq = pdev->irq; in pm8001_pci_alloc()
511 pm8001_ha->sas = sha; in pm8001_pci_alloc()
512 pm8001_ha->shost = shost; in pm8001_pci_alloc()
513 pm8001_ha->id = pm8001_id++; in pm8001_pci_alloc()
514 pm8001_ha->logging_level = logging_level; in pm8001_pci_alloc()
515 pm8001_ha->non_fatal_count = 0; in pm8001_pci_alloc()
517 pm8001_ha->link_rate = (link_rate << 8); in pm8001_pci_alloc()
519 pm8001_ha->link_rate = LINKRATE_15 | LINKRATE_30 | in pm8001_pci_alloc()
521 pm8001_dbg(pm8001_ha, FAIL, in pm8001_pci_alloc()
524 sprintf(pm8001_ha->name, "%s%d", DRV_NAME, pm8001_ha->id); in pm8001_pci_alloc()
526 if (pm8001_ha->chip_id != chip_8001) in pm8001_pci_alloc()
527 pm8001_ha->iomb_size = IOMB_SIZE_SPCV; in pm8001_pci_alloc()
529 pm8001_ha->iomb_size = IOMB_SIZE_SPC; in pm8001_pci_alloc()
534 || (pm8001_ha->chip_id == chip_8001)) in pm8001_pci_alloc()
535 tasklet_init(&pm8001_ha->tasklet[0], pm8001_tasklet, in pm8001_pci_alloc()
536 (unsigned long)&(pm8001_ha->irq_vector[0])); in pm8001_pci_alloc()
539 tasklet_init(&pm8001_ha->tasklet[j], pm8001_tasklet, in pm8001_pci_alloc()
540 (unsigned long)&(pm8001_ha->irq_vector[j])); in pm8001_pci_alloc()
542 pm8001_ioremap(pm8001_ha); in pm8001_pci_alloc()
543 if (!pm8001_alloc(pm8001_ha, ent)) in pm8001_pci_alloc()
544 return pm8001_ha; in pm8001_pci_alloc()
545 pm8001_free(pm8001_ha); in pm8001_pci_alloc()
622 struct pm8001_hba_info *pm8001_ha; in pm8001_post_sas_ha_init() local
625 pm8001_ha = sha->lldd_ha; in pm8001_post_sas_ha_init()
627 sha->sas_phy[i] = &pm8001_ha->phy[i].sas_phy; in pm8001_post_sas_ha_init()
628 sha->sas_port[i] = &pm8001_ha->port[i].sas_port; in pm8001_post_sas_ha_init()
630 (u8 *)&pm8001_ha->phy[i].dev_sas_addr; in pm8001_post_sas_ha_init()
633 sha->dev = pm8001_ha->dev; in pm8001_post_sas_ha_init()
636 sha->sas_addr = &pm8001_ha->sas_addr[0]; in pm8001_post_sas_ha_init()
648 static void pm8001_init_sas_add(struct pm8001_hba_info *pm8001_ha) in pm8001_init_sas_add() argument
662 pci_read_config_word(pm8001_ha->pdev, PCI_DEVICE_ID, &deviceid); in pm8001_init_sas_add()
663 pm8001_ha->nvmd_completion = &completion; in pm8001_init_sas_add()
665 if (pm8001_ha->chip_id == chip_8001) { in pm8001_init_sas_add()
673 } else if ((pm8001_ha->chip_id == chip_8070 || in pm8001_init_sas_add()
674 pm8001_ha->chip_id == chip_8072) && in pm8001_init_sas_add()
675 pm8001_ha->pdev->subsystem_vendor == PCI_VENDOR_ID_ATTO) { in pm8001_init_sas_add()
685 pm8001_dbg(pm8001_ha, INIT, "mem alloc fail\n"); in pm8001_init_sas_add()
688 rc = PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload); in pm8001_init_sas_add()
691 pm8001_dbg(pm8001_ha, INIT, "nvmd failed\n"); in pm8001_init_sas_add()
697 if (pm8001_ha->chip_id == chip_8001) { in pm8001_init_sas_add()
699 pm8001_ha->sas_addr[j] = in pm8001_init_sas_add()
702 pm8001_ha->sas_addr[j] = in pm8001_init_sas_add()
704 } else if ((pm8001_ha->chip_id == chip_8070 || in pm8001_init_sas_add()
705 pm8001_ha->chip_id == chip_8072) && in pm8001_init_sas_add()
706 pm8001_ha->pdev->subsystem_vendor == PCI_VENDOR_ID_ATTO) { in pm8001_init_sas_add()
707 pm8001_ha->sas_addr[j] = in pm8001_init_sas_add()
710 pm8001_ha->sas_addr[j] = in pm8001_init_sas_add()
713 memcpy(sas_add, pm8001_ha->sas_addr, SAS_ADDR_SIZE); in pm8001_init_sas_add()
714 for (i = 0; i < pm8001_ha->chip->n_phy; i++) { in pm8001_init_sas_add()
717 memcpy(&pm8001_ha->phy[i].dev_sas_addr, in pm8001_init_sas_add()
719 pm8001_dbg(pm8001_ha, INIT, "phy %d sas_addr = %016llx\n", i, in pm8001_init_sas_add()
720 pm8001_ha->phy[i].dev_sas_addr); in pm8001_init_sas_add()
724 for (i = 0; i < pm8001_ha->chip->n_phy; i++) { in pm8001_init_sas_add()
725 pm8001_ha->phy[i].dev_sas_addr = 0x50010c600047f9d0ULL; in pm8001_init_sas_add()
726 pm8001_ha->phy[i].dev_sas_addr = in pm8001_init_sas_add()
728 (*(u64 *)&pm8001_ha->phy[i].dev_sas_addr)); in pm8001_init_sas_add()
730 memcpy(pm8001_ha->sas_addr, &pm8001_ha->phy[0].dev_sas_addr, in pm8001_init_sas_add()
739 static int pm8001_get_phy_settings_info(struct pm8001_hba_info *pm8001_ha) in pm8001_get_phy_settings_info() argument
748 pm8001_ha->nvmd_completion = &completion; in pm8001_get_phy_settings_info()
757 rc = PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload); in pm8001_get_phy_settings_info()
760 pm8001_dbg(pm8001_ha, INIT, "nvmd failed\n"); in pm8001_get_phy_settings_info()
764 pm8001_set_phy_profile(pm8001_ha, sizeof(u8), payload.func_specific); in pm8001_get_phy_settings_info()
788 void pm8001_get_internal_phy_settings(struct pm8001_hba_info *pm8001_ha, in pm8001_get_internal_phy_settings() argument
808 void pm8001_get_external_phy_settings(struct pm8001_hba_info *pm8001_ha, in pm8001_get_external_phy_settings() argument
828 void pm8001_get_phy_mask(struct pm8001_hba_info *pm8001_ha, int *phymask) in pm8001_get_phy_mask() argument
830 switch (pm8001_ha->pdev->subsystem_device) { in pm8001_get_phy_mask()
854 pm8001_dbg(pm8001_ha, INIT, in pm8001_get_phy_mask()
856 pm8001_ha->pdev->subsystem_device); in pm8001_get_phy_mask()
865 int pm8001_set_phy_settings_ven_117c_12G(struct pm8001_hba_info *pm8001_ha) in pm8001_set_phy_settings_ven_117c_12G() argument
875 pm8001_get_internal_phy_settings(pm8001_ha, &phycfg_int); in pm8001_set_phy_settings_ven_117c_12G()
876 pm8001_get_external_phy_settings(pm8001_ha, &phycfg_ext); in pm8001_set_phy_settings_ven_117c_12G()
877 pm8001_get_phy_mask(pm8001_ha, &phymask); in pm8001_set_phy_settings_ven_117c_12G()
879 for (i = 0; i < pm8001_ha->chip->n_phy; i++) { in pm8001_set_phy_settings_ven_117c_12G()
881 pm8001_set_phy_profile_single(pm8001_ha, i, in pm8001_set_phy_settings_ven_117c_12G()
886 pm8001_set_phy_profile_single(pm8001_ha, i, in pm8001_set_phy_settings_ven_117c_12G()
899 static int pm8001_configure_phy_settings(struct pm8001_hba_info *pm8001_ha) in pm8001_configure_phy_settings() argument
901 switch (pm8001_ha->pdev->subsystem_vendor) { in pm8001_configure_phy_settings()
903 if (pm8001_ha->pdev->device == 0x0042) /* 6Gb */ in pm8001_configure_phy_settings()
906 return pm8001_set_phy_settings_ven_117c_12G(pm8001_ha); in pm8001_configure_phy_settings()
913 return pm8001_get_phy_settings_info(pm8001_ha); in pm8001_configure_phy_settings()
922 static u32 pm8001_setup_msix(struct pm8001_hba_info *pm8001_ha) in pm8001_setup_msix() argument
929 if (pm8001_ha->chip_id == chip_8001) { in pm8001_setup_msix()
937 rc = pci_alloc_irq_vectors(pm8001_ha->pdev, number_of_intr, in pm8001_setup_msix()
945 pm8001_ha->number_of_intr = number_of_intr; in pm8001_setup_msix()
948 pm8001_ha->max_q_num = number_of_intr; in pm8001_setup_msix()
950 pm8001_dbg(pm8001_ha, INIT, in pm8001_setup_msix()
952 rc, pm8001_ha->number_of_intr); in pm8001_setup_msix()
956 static u32 pm8001_request_msix(struct pm8001_hba_info *pm8001_ha) in pm8001_request_msix() argument
961 if (pm8001_ha->chip_id != chip_8001) in pm8001_request_msix()
964 pm8001_dbg(pm8001_ha, INIT, in pm8001_request_msix()
966 pm8001_ha->number_of_intr); in pm8001_request_msix()
968 for (i = 0; i < pm8001_ha->number_of_intr; i++) { in pm8001_request_msix()
969 snprintf(pm8001_ha->intr_drvname[i], in pm8001_request_msix()
970 sizeof(pm8001_ha->intr_drvname[0]), in pm8001_request_msix()
971 "%s-%d", pm8001_ha->name, i); in pm8001_request_msix()
972 pm8001_ha->irq_vector[i].irq_id = i; in pm8001_request_msix()
973 pm8001_ha->irq_vector[i].drv_inst = pm8001_ha; in pm8001_request_msix()
975 rc = request_irq(pci_irq_vector(pm8001_ha->pdev, i), in pm8001_request_msix()
977 pm8001_ha->intr_drvname[i], in pm8001_request_msix()
978 &(pm8001_ha->irq_vector[i])); in pm8001_request_msix()
981 free_irq(pci_irq_vector(pm8001_ha->pdev, i), in pm8001_request_msix()
982 &(pm8001_ha->irq_vector[i])); in pm8001_request_msix()
984 pci_free_irq_vectors(pm8001_ha->pdev); in pm8001_request_msix()
993 static u32 pm8001_setup_irq(struct pm8001_hba_info *pm8001_ha) in pm8001_setup_irq() argument
997 pdev = pm8001_ha->pdev; in pm8001_setup_irq()
1001 return pm8001_setup_msix(pm8001_ha); in pm8001_setup_irq()
1002 pm8001_dbg(pm8001_ha, INIT, "MSIX not supported!!!\n"); in pm8001_setup_irq()
1011 static u32 pm8001_request_irq(struct pm8001_hba_info *pm8001_ha) in pm8001_request_irq() argument
1016 pdev = pm8001_ha->pdev; in pm8001_request_irq()
1020 return pm8001_request_msix(pm8001_ha); in pm8001_request_irq()
1022 pm8001_dbg(pm8001_ha, INIT, "MSIX not supported!!!\n"); in pm8001_request_irq()
1029 pm8001_ha->irq_vector[0].irq_id = 0; in pm8001_request_irq()
1030 pm8001_ha->irq_vector[0].drv_inst = pm8001_ha; in pm8001_request_irq()
1032 pm8001_ha->name, SHOST_TO_SAS_HA(pm8001_ha->shost)); in pm8001_request_irq()
1051 struct pm8001_hba_info *pm8001_ha; in pm8001_pci_probe() local
1097 pm8001_ha = pm8001_pci_alloc(pdev, ent, shost); in pm8001_pci_probe()
1098 if (!pm8001_ha) { in pm8001_pci_probe()
1103 PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha); in pm8001_pci_probe()
1104 rc = PM8001_CHIP_DISP->chip_init(pm8001_ha); in pm8001_pci_probe()
1106 pm8001_dbg(pm8001_ha, FAIL, in pm8001_pci_probe()
1111 rc = pm8001_init_ccb_tag(pm8001_ha, shost, pdev); in pm8001_pci_probe()
1119 PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, 0); in pm8001_pci_probe()
1120 if (pm8001_ha->chip_id != chip_8001) { in pm8001_pci_probe()
1121 for (i = 1; i < pm8001_ha->number_of_intr; i++) in pm8001_pci_probe()
1122 PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, i); in pm8001_pci_probe()
1124 pm80xx_set_thermal_config(pm8001_ha); in pm8001_pci_probe()
1127 pm8001_init_sas_add(pm8001_ha); in pm8001_pci_probe()
1129 rc = pm8001_configure_phy_settings(pm8001_ha); in pm8001_pci_probe()
1136 pm8001_dbg(pm8001_ha, FAIL, in pm8001_pci_probe()
1140 list_add_tail(&pm8001_ha->list, &hba_list); in pm8001_pci_probe()
1141 pm8001_ha->flags = PM8001F_RUN_TIME; in pm8001_pci_probe()
1142 scsi_scan_host(pm8001_ha->shost); in pm8001_pci_probe()
1146 scsi_remove_host(pm8001_ha->shost); in pm8001_pci_probe()
1148 pm8001_free(pm8001_ha); in pm8001_pci_probe()
1167 pm8001_init_ccb_tag(struct pm8001_hba_info *pm8001_ha, struct Scsi_Host *shost, in pm8001_init_ccb_tag() argument
1174 max_out_io = pm8001_ha->main_cfg_tbl.pm80xx_tbl.max_out_io; in pm8001_init_ccb_tag()
1181 pm8001_ha->tags = kzalloc(ccb_count, GFP_KERNEL); in pm8001_init_ccb_tag()
1182 if (!pm8001_ha->tags) in pm8001_init_ccb_tag()
1186 pm8001_ha->ccb_info = (struct pm8001_ccb_info *) in pm8001_init_ccb_tag()
1188 if (!pm8001_ha->ccb_info) { in pm8001_init_ccb_tag()
1189 pm8001_dbg(pm8001_ha, FAIL, in pm8001_init_ccb_tag()
1194 pm8001_ha->ccb_info[i].buf_prd = pci_alloc_consistent(pdev, in pm8001_init_ccb_tag()
1196 &pm8001_ha->ccb_info[i].ccb_dma_handle); in pm8001_init_ccb_tag()
1197 if (!pm8001_ha->ccb_info[i].buf_prd) { in pm8001_init_ccb_tag()
1198 pm8001_dbg(pm8001_ha, FAIL, in pm8001_init_ccb_tag()
1202 pm8001_ha->ccb_info[i].task = NULL; in pm8001_init_ccb_tag()
1203 pm8001_ha->ccb_info[i].ccb_tag = 0xffffffff; in pm8001_init_ccb_tag()
1204 pm8001_ha->ccb_info[i].device = NULL; in pm8001_init_ccb_tag()
1205 ++pm8001_ha->tags_num; in pm8001_init_ccb_tag()
1210 kfree(pm8001_ha->devices); in pm8001_init_ccb_tag()
1218 struct pm8001_hba_info *pm8001_ha; in pm8001_pci_remove() local
1220 pm8001_ha = sha->lldd_ha; in pm8001_pci_remove()
1222 sas_remove_host(pm8001_ha->shost); in pm8001_pci_remove()
1223 list_del(&pm8001_ha->list); in pm8001_pci_remove()
1224 PM8001_CHIP_DISP->interrupt_disable(pm8001_ha, 0xFF); in pm8001_pci_remove()
1225 PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha); in pm8001_pci_remove()
1228 for (i = 0; i < pm8001_ha->number_of_intr; i++) in pm8001_pci_remove()
1230 for (i = 0; i < pm8001_ha->number_of_intr; i++) in pm8001_pci_remove()
1231 free_irq(pci_irq_vector(pdev, i), &pm8001_ha->irq_vector[i]); in pm8001_pci_remove()
1234 free_irq(pm8001_ha->irq, sha); in pm8001_pci_remove()
1239 (pm8001_ha->chip_id == chip_8001)) in pm8001_pci_remove()
1240 tasklet_kill(&pm8001_ha->tasklet[0]); in pm8001_pci_remove()
1243 tasklet_kill(&pm8001_ha->tasklet[j]); in pm8001_pci_remove()
1245 scsi_host_put(pm8001_ha->shost); in pm8001_pci_remove()
1246 pm8001_free(pm8001_ha); in pm8001_pci_remove()
1264 struct pm8001_hba_info *pm8001_ha; in pm8001_pci_suspend() local
1267 pm8001_ha = sha->lldd_ha; in pm8001_pci_suspend()
1270 scsi_block_requests(pm8001_ha->shost); in pm8001_pci_suspend()
1275 PM8001_CHIP_DISP->interrupt_disable(pm8001_ha, 0xFF); in pm8001_pci_suspend()
1276 PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha); in pm8001_pci_suspend()
1278 for (i = 0; i < pm8001_ha->number_of_intr; i++) in pm8001_pci_suspend()
1280 for (i = 0; i < pm8001_ha->number_of_intr; i++) in pm8001_pci_suspend()
1281 free_irq(pci_irq_vector(pdev, i), &pm8001_ha->irq_vector[i]); in pm8001_pci_suspend()
1284 free_irq(pm8001_ha->irq, sha); in pm8001_pci_suspend()
1289 (pm8001_ha->chip_id == chip_8001)) in pm8001_pci_suspend()
1290 tasklet_kill(&pm8001_ha->tasklet[0]); in pm8001_pci_suspend()
1293 tasklet_kill(&pm8001_ha->tasklet[j]); in pm8001_pci_suspend()
1298 pm8001_ha->name, device_state); in pm8001_pci_suspend()
1314 struct pm8001_hba_info *pm8001_ha; in pm8001_pci_resume() local
1319 pm8001_ha = sha->lldd_ha; in pm8001_pci_resume()
1323 "operating state [D%d]\n", pdev, pm8001_ha->name, device_state); in pm8001_pci_resume()
1331 pm8001_ha->name); in pm8001_pci_resume()
1341 if (pm8001_ha->chip_id == chip_8001) { in pm8001_pci_resume()
1342 PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha); in pm8001_pci_resume()
1343 pm8001_dbg(pm8001_ha, INIT, "chip soft reset successful\n"); in pm8001_pci_resume()
1345 rc = PM8001_CHIP_DISP->chip_init(pm8001_ha); in pm8001_pci_resume()
1350 PM8001_CHIP_DISP->interrupt_disable(pm8001_ha, 0xFF); in pm8001_pci_resume()
1352 rc = pm8001_request_irq(pm8001_ha); in pm8001_pci_resume()
1358 (pm8001_ha->chip_id == chip_8001)) in pm8001_pci_resume()
1359 tasklet_init(&pm8001_ha->tasklet[0], pm8001_tasklet, in pm8001_pci_resume()
1360 (unsigned long)&(pm8001_ha->irq_vector[0])); in pm8001_pci_resume()
1363 tasklet_init(&pm8001_ha->tasklet[j], pm8001_tasklet, in pm8001_pci_resume()
1364 (unsigned long)&(pm8001_ha->irq_vector[j])); in pm8001_pci_resume()
1366 PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, 0); in pm8001_pci_resume()
1367 if (pm8001_ha->chip_id != chip_8001) { in pm8001_pci_resume()
1368 for (i = 1; i < pm8001_ha->number_of_intr; i++) in pm8001_pci_resume()
1369 PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, i); in pm8001_pci_resume()
1377 if (pm8001_ha->chip_id == chip_8070 || in pm8001_pci_resume()
1378 pm8001_ha->chip_id == chip_8072) { in pm8001_pci_resume()
1384 pm8001_ha->flags = PM8001F_RUN_TIME; in pm8001_pci_resume()
1385 for (i = 0; i < pm8001_ha->chip->n_phy; i++) { in pm8001_pci_resume()
1386 pm8001_ha->phy[i].enable_completion = &completion; in pm8001_pci_resume()
1387 PM8001_CHIP_DISP->phy_start_req(pm8001_ha, i); in pm8001_pci_resume()
1394 scsi_remove_host(pm8001_ha->shost); in pm8001_pci_resume()