Lines Matching +full:sha +full:- +full:1
2 * PMC-Sierra PM8001/8081/8088/8089 SAS/SATA based host adapters driver
4 * Copyright (c) 2008-2009 USI Co., Ltd.
10 * 1. Redistributions of source code must retain the above copyright
18 * 3. Neither the names of the above-listed copyright holders nor the names
53 " 1: Link rate 1.5G\n"
68 [chip_8009] = {1, 8, &pm8001_80xx_dispatch,},
70 [chip_8019] = {1, 16, &pm8001_80xx_dispatch,},
98 .can_queue = 1,
99 .this_id = -1,
111 .track_queue_depth = 1,
134 * pm8001_phy_init - initiate our adapter phys
140 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; in pm8001_phy_init()
141 struct asd_sas_phy *sas_phy = &phy->sas_phy; in pm8001_phy_init()
142 phy->phy_state = PHY_LINK_DISABLE; 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()
145 sas_phy->class = SAS; in pm8001_phy_init()
146 sas_phy->iproto = SAS_PROTOCOL_ALL; in pm8001_phy_init()
147 sas_phy->tproto = 0; in pm8001_phy_init()
148 sas_phy->type = PHY_TYPE_PHYSICAL; in pm8001_phy_init()
149 sas_phy->role = PHY_ROLE_INITIATOR; in pm8001_phy_init()
150 sas_phy->oob_mode = OOB_NOT_CONNECTED; in pm8001_phy_init()
151 sas_phy->linkrate = SAS_LINK_RATE_UNKNOWN; in pm8001_phy_init()
152 sas_phy->id = phy_id; in pm8001_phy_init()
153 sas_phy->sas_addr = (u8 *)&phy->dev_sas_addr; in pm8001_phy_init()
154 sas_phy->frame_rcvd = &phy->frame_rcvd[0]; in pm8001_phy_init()
155 sas_phy->ha = (struct sas_ha_struct *)pm8001_ha->shost->hostdata; in pm8001_phy_init()
156 sas_phy->lldd_phy = phy; in pm8001_phy_init()
160 * pm8001_free - free hba
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()
188 * pm8001_tasklet() - tasklet for 64 msi-x interrupt handler
198 pm8001_ha = irq_vector->drv_inst; in pm8001_tasklet()
200 BUG_ON(1); in pm8001_tasklet()
201 PM8001_CHIP_DISP->isr(pm8001_ha, irq_vector->irq_id); in pm8001_tasklet()
206 * pm8001_interrupt_handler_msix - main MSIX interrupt handler.
219 pm8001_ha = irq_vector->drv_inst; 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()
234 * pm8001_interrupt_handler_intx - main INTx interrupt handler.
243 struct sas_ha_struct *sha = dev_id; in pm8001_interrupt_handler_intx() local
244 pm8001_ha = sha->lldd_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()
262 * pm8001_alloc - initiate our hba structure and 6 DMAs area.
274 spin_lock_init(&pm8001_ha->lock); in pm8001_alloc()
275 spin_lock_init(&pm8001_ha->bitmap_lock); in pm8001_alloc()
277 pm8001_ha->chip->n_phy); in pm8001_alloc()
291 count = pm8001_ha->max_q_num; in pm8001_alloc()
293 ib_offset = pm8001_ha->ib_offset = USI_MAX_MEMCNT_BASE; in pm8001_alloc()
294 ci_offset = pm8001_ha->ci_offset = ib_offset + count; in pm8001_alloc()
295 ob_offset = pm8001_ha->ob_offset = ci_offset + count; in pm8001_alloc()
296 pi_offset = pm8001_ha->pi_offset = ob_offset + count; in pm8001_alloc()
297 pm8001_ha->max_memcnt = pi_offset + count; in pm8001_alloc()
299 for (i = 0; i < pm8001_ha->chip->n_phy; i++) { in pm8001_alloc()
301 pm8001_ha->port[i].wide_port_phymap = 0; in pm8001_alloc()
302 pm8001_ha->port[i].port_attached = 0; in pm8001_alloc()
303 pm8001_ha->port[i].port_state = 0; in pm8001_alloc()
304 INIT_LIST_HEAD(&pm8001_ha->port[i].list); in pm8001_alloc()
307 /* MPI Memory region 1 for AAP Event Log for fw */ in pm8001_alloc()
308 pm8001_ha->memoryMap.region[AAP1].num_elements = 1; in pm8001_alloc()
309 pm8001_ha->memoryMap.region[AAP1].element_size = PM8001_EVENT_LOG_SIZE; in pm8001_alloc()
310 pm8001_ha->memoryMap.region[AAP1].total_len = PM8001_EVENT_LOG_SIZE; in pm8001_alloc()
311 pm8001_ha->memoryMap.region[AAP1].alignment = 32; in pm8001_alloc()
314 pm8001_ha->memoryMap.region[IOP].num_elements = 1; in pm8001_alloc()
315 pm8001_ha->memoryMap.region[IOP].element_size = PM8001_EVENT_LOG_SIZE; in pm8001_alloc()
316 pm8001_ha->memoryMap.region[IOP].total_len = PM8001_EVENT_LOG_SIZE; in pm8001_alloc()
317 pm8001_ha->memoryMap.region[IOP].alignment = 32; in pm8001_alloc()
320 ibq = &pm8001_ha->inbnd_q_tbl[i]; in pm8001_alloc()
321 spin_lock_init(&ibq->iq_lock); in pm8001_alloc()
323 pm8001_ha->memoryMap.region[ci_offset+i].num_elements = 1; in pm8001_alloc()
324 pm8001_ha->memoryMap.region[ci_offset+i].element_size = 4; in pm8001_alloc()
325 pm8001_ha->memoryMap.region[ci_offset+i].total_len = 4; in pm8001_alloc()
326 pm8001_ha->memoryMap.region[ci_offset+i].alignment = 4; in pm8001_alloc()
328 if ((ent->driver_data) != chip_8001) { in pm8001_alloc()
330 pm8001_ha->memoryMap.region[ib_offset+i].num_elements = in pm8001_alloc()
332 pm8001_ha->memoryMap.region[ib_offset+i].element_size in pm8001_alloc()
334 pm8001_ha->memoryMap.region[ib_offset+i].total_len = in pm8001_alloc()
336 pm8001_ha->memoryMap.region[ib_offset+i].alignment in pm8001_alloc()
339 pm8001_ha->memoryMap.region[ib_offset+i].num_elements = in pm8001_alloc()
341 pm8001_ha->memoryMap.region[ib_offset+i].element_size in pm8001_alloc()
343 pm8001_ha->memoryMap.region[ib_offset+i].total_len = in pm8001_alloc()
345 pm8001_ha->memoryMap.region[ib_offset+i].alignment = 64; in pm8001_alloc()
350 obq = &pm8001_ha->outbnd_q_tbl[i]; in pm8001_alloc()
351 spin_lock_init(&obq->oq_lock); in pm8001_alloc()
353 pm8001_ha->memoryMap.region[pi_offset+i].num_elements = 1; in pm8001_alloc()
354 pm8001_ha->memoryMap.region[pi_offset+i].element_size = 4; in pm8001_alloc()
355 pm8001_ha->memoryMap.region[pi_offset+i].total_len = 4; in pm8001_alloc()
356 pm8001_ha->memoryMap.region[pi_offset+i].alignment = 4; in pm8001_alloc()
358 if (ent->driver_data != chip_8001) { in pm8001_alloc()
360 pm8001_ha->memoryMap.region[ob_offset+i].num_elements = in pm8001_alloc()
362 pm8001_ha->memoryMap.region[ob_offset+i].element_size in pm8001_alloc()
364 pm8001_ha->memoryMap.region[ob_offset+i].total_len = in pm8001_alloc()
366 pm8001_ha->memoryMap.region[ob_offset+i].alignment in pm8001_alloc()
370 pm8001_ha->memoryMap.region[ob_offset+i].num_elements = in pm8001_alloc()
372 pm8001_ha->memoryMap.region[ob_offset+i].element_size in pm8001_alloc()
374 pm8001_ha->memoryMap.region[ob_offset+i].total_len = in pm8001_alloc()
376 pm8001_ha->memoryMap.region[ob_offset+i].alignment = 64; in pm8001_alloc()
381 pm8001_ha->memoryMap.region[NVMD].num_elements = 1; in pm8001_alloc()
382 pm8001_ha->memoryMap.region[NVMD].element_size = 4096; in pm8001_alloc()
383 pm8001_ha->memoryMap.region[NVMD].total_len = 4096; in pm8001_alloc()
386 pm8001_ha->memoryMap.region[FW_FLASH].total_len = 4096; in pm8001_alloc()
388 pm8001_ha->memoryMap.region[FORENSIC_MEM].num_elements = 1; in pm8001_alloc()
389 pm8001_ha->memoryMap.region[FORENSIC_MEM].total_len = 0x10000; in pm8001_alloc()
390 pm8001_ha->memoryMap.region[FORENSIC_MEM].element_size = 0x10000; in pm8001_alloc()
391 pm8001_ha->memoryMap.region[FORENSIC_MEM].alignment = 0x10000; in pm8001_alloc()
392 for (i = 0; i < pm8001_ha->max_memcnt; i++) { in pm8001_alloc()
393 struct mpi_mem *region = &pm8001_ha->memoryMap.region[i]; in pm8001_alloc()
395 if (pm8001_mem_alloc(pm8001_ha->pdev, in pm8001_alloc()
396 ®ion->virt_ptr, in pm8001_alloc()
397 ®ion->phys_addr, in pm8001_alloc()
398 ®ion->phys_addr_hi, in pm8001_alloc()
399 ®ion->phys_addr_lo, in pm8001_alloc()
400 region->total_len, in pm8001_alloc()
401 region->alignment) != 0) { in pm8001_alloc()
408 pm8001_ha->devices = kzalloc(PM8001_MAX_DEVICES in pm8001_alloc()
410 if (!pm8001_ha->devices) { in pm8001_alloc()
411 rc = -ENOMEM; in pm8001_alloc()
415 pm8001_ha->devices[i].dev_type = SAS_PHY_UNUSED; in pm8001_alloc()
416 pm8001_ha->devices[i].id = i; in pm8001_alloc()
417 pm8001_ha->devices[i].device_id = PM8001_MAX_DEVICES; in pm8001_alloc()
418 atomic_set(&pm8001_ha->devices[i].running_req, 0); in pm8001_alloc()
420 pm8001_ha->flags = PM8001F_INIT_TIME; in pm8001_alloc()
426 scsi_remove_host(pm8001_ha->shost); in pm8001_alloc()
428 for (i = 0; i < pm8001_ha->max_memcnt; i++) { in pm8001_alloc()
429 if (pm8001_ha->memoryMap.region[i].virt_ptr != NULL) { in pm8001_alloc()
430 dma_free_coherent(&pm8001_ha->pdev->dev, in pm8001_alloc()
431 (pm8001_ha->memoryMap.region[i].total_len + in pm8001_alloc()
432 pm8001_ha->memoryMap.region[i].alignment), in pm8001_alloc()
433 pm8001_ha->memoryMap.region[i].virt_ptr, in pm8001_alloc()
434 pm8001_ha->memoryMap.region[i].phys_addr); in pm8001_alloc()
438 return 1; in pm8001_alloc()
442 * pm8001_ioremap - remap the pci high physical address to kernel virtual
452 pdev = pm8001_ha->pdev; in pm8001_ioremap()
453 /* map pci mem (PMC pci base 0-3)*/ in pm8001_ioremap()
457 ** bar 0 and 1 - logical BAR0 in pm8001_ioremap()
458 ** bar 2 and 3 - logical BAR1 in pm8001_ioremap()
459 ** bar4 - logical BAR2 in pm8001_ioremap()
460 ** bar5 - logical BAR3 in pm8001_ioremap()
463 if ((bar == 1) || (bar == 3)) in pm8001_ioremap()
466 pm8001_ha->io_mem[logicalBar].membase = in pm8001_ioremap()
468 pm8001_ha->io_mem[logicalBar].memsize = in pm8001_ioremap()
470 pm8001_ha->io_mem[logicalBar].memvirtaddr = in pm8001_ioremap()
471 ioremap(pm8001_ha->io_mem[logicalBar].membase, in pm8001_ioremap()
472 pm8001_ha->io_mem[logicalBar].memsize); in pm8001_ioremap()
473 if (!pm8001_ha->io_mem[logicalBar].memvirtaddr) { in pm8001_ioremap()
477 return -ENOMEM; in pm8001_ioremap()
481 (u64)pm8001_ha->io_mem[logicalBar].membase, in pm8001_ioremap()
483 pm8001_ha->io_mem[logicalBar].memvirtaddr, in pm8001_ioremap()
484 pm8001_ha->io_mem[logicalBar].memsize); in pm8001_ioremap()
486 pm8001_ha->io_mem[logicalBar].membase = 0; in pm8001_ioremap()
487 pm8001_ha->io_mem[logicalBar].memsize = 0; in pm8001_ioremap()
488 pm8001_ha->io_mem[logicalBar].memvirtaddr = NULL; in pm8001_ioremap()
496 * pm8001_pci_alloc - initialize our ha card structure
507 struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); in pm8001_pci_alloc() local
510 pm8001_ha = sha->lldd_ha; in pm8001_pci_alloc()
514 pm8001_ha->pdev = pdev; in pm8001_pci_alloc()
515 pm8001_ha->dev = &pdev->dev; in pm8001_pci_alloc()
516 pm8001_ha->chip_id = ent->driver_data; in pm8001_pci_alloc()
517 pm8001_ha->chip = &pm8001_chips[pm8001_ha->chip_id]; in pm8001_pci_alloc()
518 pm8001_ha->irq = pdev->irq; in pm8001_pci_alloc()
519 pm8001_ha->sas = sha; in pm8001_pci_alloc()
520 pm8001_ha->shost = shost; in pm8001_pci_alloc()
521 pm8001_ha->id = pm8001_id++; in pm8001_pci_alloc()
522 pm8001_ha->logging_level = logging_level; in pm8001_pci_alloc()
523 pm8001_ha->non_fatal_count = 0; in pm8001_pci_alloc()
524 if (link_rate >= 1 && link_rate <= 15) in pm8001_pci_alloc()
525 pm8001_ha->link_rate = (link_rate << 8); in pm8001_pci_alloc()
527 pm8001_ha->link_rate = LINKRATE_15 | LINKRATE_30 | in pm8001_pci_alloc()
532 sprintf(pm8001_ha->name, "%s%d", DRV_NAME, pm8001_ha->id); in pm8001_pci_alloc()
534 if (pm8001_ha->chip_id != chip_8001) in pm8001_pci_alloc()
535 pm8001_ha->iomb_size = IOMB_SIZE_SPCV; in pm8001_pci_alloc()
537 pm8001_ha->iomb_size = IOMB_SIZE_SPC; in pm8001_pci_alloc()
540 /* Tasklet for non msi-x interrupt handler */ in pm8001_pci_alloc()
541 if ((!pdev->msix_cap || !pci_msi_enabled()) in pm8001_pci_alloc()
542 || (pm8001_ha->chip_id == chip_8001)) in pm8001_pci_alloc()
543 tasklet_init(&pm8001_ha->tasklet[0], pm8001_tasklet, in pm8001_pci_alloc()
544 (unsigned long)&(pm8001_ha->irq_vector[0])); in pm8001_pci_alloc()
547 tasklet_init(&pm8001_ha->tasklet[j], pm8001_tasklet, in pm8001_pci_alloc()
548 (unsigned long)&(pm8001_ha->irq_vector[j])); in pm8001_pci_alloc()
560 * pci_go_44 - pm8001 specified, its DMA is 44 bit rather than 64 bit
567 rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(44)); in pci_go_44()
569 rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); in pci_go_44()
571 dev_printk(KERN_ERR, &pdev->dev, in pci_go_44()
572 "32-bit DMA enable failed\n"); in pci_go_44()
578 * pm8001_prep_sas_ha_init - allocate memory in general hba struct && init them.
588 struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); in pm8001_prep_sas_ha_init() local
590 phy_nr = chip_info->n_phy; in pm8001_prep_sas_ha_init()
592 memset(sha, 0x00, sizeof(*sha)); in pm8001_prep_sas_ha_init()
600 sha->sas_phy = arr_phy; in pm8001_prep_sas_ha_init()
601 sha->sas_port = arr_port; in pm8001_prep_sas_ha_init()
602 sha->lldd_ha = kzalloc(sizeof(struct pm8001_hba_info), GFP_KERNEL); in pm8001_prep_sas_ha_init()
603 if (!sha->lldd_ha) in pm8001_prep_sas_ha_init()
606 shost->transportt = pm8001_stt; in pm8001_prep_sas_ha_init()
607 shost->max_id = PM8001_MAX_DEVICES; in pm8001_prep_sas_ha_init()
608 shost->max_lun = 8; in pm8001_prep_sas_ha_init()
609 shost->max_channel = 0; in pm8001_prep_sas_ha_init()
610 shost->unique_id = pm8001_id; in pm8001_prep_sas_ha_init()
611 shost->max_cmd_len = 16; in pm8001_prep_sas_ha_init()
612 shost->can_queue = PM8001_CAN_QUEUE; in pm8001_prep_sas_ha_init()
613 shost->cmd_per_lun = 32; in pm8001_prep_sas_ha_init()
620 return -1; in pm8001_prep_sas_ha_init()
624 * pm8001_post_sas_ha_init - initialize general hba struct defined in libsas
633 struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); in pm8001_post_sas_ha_init() local
635 pm8001_ha = sha->lldd_ha; in pm8001_post_sas_ha_init()
636 for (i = 0; i < chip_info->n_phy; i++) { in pm8001_post_sas_ha_init()
637 sha->sas_phy[i] = &pm8001_ha->phy[i].sas_phy; in pm8001_post_sas_ha_init()
638 sha->sas_port[i] = &pm8001_ha->port[i].sas_port; in pm8001_post_sas_ha_init()
639 sha->sas_phy[i]->sas_addr = in pm8001_post_sas_ha_init()
640 (u8 *)&pm8001_ha->phy[i].dev_sas_addr; in pm8001_post_sas_ha_init()
642 sha->sas_ha_name = DRV_NAME; in pm8001_post_sas_ha_init()
643 sha->dev = pm8001_ha->dev; in pm8001_post_sas_ha_init()
644 sha->strict_wide_ports = 1; in pm8001_post_sas_ha_init()
645 sha->lldd_module = THIS_MODULE; in pm8001_post_sas_ha_init()
646 sha->sas_addr = &pm8001_ha->sas_addr[0]; in pm8001_post_sas_ha_init()
647 sha->num_phys = chip_info->n_phy; in pm8001_post_sas_ha_init()
648 sha->core.shost = shost; in pm8001_post_sas_ha_init()
652 * pm8001_init_sas_add - initialize sas address
672 pci_read_config_word(pm8001_ha->pdev, PCI_DEVICE_ID, &deviceid); in pm8001_init_sas_add()
673 pm8001_ha->nvmd_completion = &completion; in pm8001_init_sas_add()
675 if (pm8001_ha->chip_id == chip_8001) { in pm8001_init_sas_add()
683 } else if ((pm8001_ha->chip_id == chip_8070 || in pm8001_init_sas_add()
684 pm8001_ha->chip_id == chip_8072) && in pm8001_init_sas_add()
685 pm8001_ha->pdev->subsystem_vendor == PCI_VENDOR_ID_ATTO) { in pm8001_init_sas_add()
689 payload.minor_function = 1; in pm8001_init_sas_add()
698 rc = PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload); in pm8001_init_sas_add()
707 if (pm8001_ha->chip_id == chip_8001) { in pm8001_init_sas_add()
709 pm8001_ha->sas_addr[j] = in pm8001_init_sas_add()
712 pm8001_ha->sas_addr[j] = in pm8001_init_sas_add()
714 } else if ((pm8001_ha->chip_id == chip_8070 || in pm8001_init_sas_add()
715 pm8001_ha->chip_id == chip_8072) && in pm8001_init_sas_add()
716 pm8001_ha->pdev->subsystem_vendor == PCI_VENDOR_ID_ATTO) { in pm8001_init_sas_add()
717 pm8001_ha->sas_addr[j] = in pm8001_init_sas_add()
720 pm8001_ha->sas_addr[j] = in pm8001_init_sas_add()
723 memcpy(sas_add, pm8001_ha->sas_addr, SAS_ADDR_SIZE); in pm8001_init_sas_add()
724 for (i = 0; i < pm8001_ha->chip->n_phy; i++) { in pm8001_init_sas_add()
727 memcpy(&pm8001_ha->phy[i].dev_sas_addr, in pm8001_init_sas_add()
730 pm8001_ha->phy[i].dev_sas_addr); in pm8001_init_sas_add()
734 for (i = 0; i < pm8001_ha->chip->n_phy; i++) { in pm8001_init_sas_add()
735 pm8001_ha->phy[i].dev_sas_addr = 0x50010c600047f9d0ULL; in pm8001_init_sas_add()
736 pm8001_ha->phy[i].dev_sas_addr = in pm8001_init_sas_add()
738 (*(u64 *)&pm8001_ha->phy[i].dev_sas_addr)); in pm8001_init_sas_add()
740 memcpy(pm8001_ha->sas_addr, &pm8001_ha->phy[0].dev_sas_addr, in pm8001_init_sas_add()
758 pm8001_ha->nvmd_completion = &completion; in pm8001_get_phy_settings_info()
765 return -ENOMEM; in pm8001_get_phy_settings_info()
767 rc = PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload); in pm8001_get_phy_settings_info()
771 return -ENOMEM; in pm8001_get_phy_settings_info()
793 * pm8001_get_internal_phy_settings - Retrieves the internal PHY settings
801 phycfg->LaneLosCfg = 0x00000132; in pm8001_get_internal_phy_settings()
802 phycfg->LanePgaCfg1 = 0x00203949; in pm8001_get_internal_phy_settings()
803 phycfg->LanePisoCfg1 = 0x000000FF; in pm8001_get_internal_phy_settings()
804 phycfg->LanePisoCfg2 = 0xFF000001; in pm8001_get_internal_phy_settings()
805 phycfg->LanePisoCfg3 = 0xE7011300; in pm8001_get_internal_phy_settings()
806 phycfg->LanePisoCfg4 = 0x631C40C0; in pm8001_get_internal_phy_settings()
807 phycfg->LanePisoCfg5 = 0xF8102036; in pm8001_get_internal_phy_settings()
808 phycfg->LanePisoCfg6 = 0xF74A1000; in pm8001_get_internal_phy_settings()
809 phycfg->LaneBctCtrl = 0x00FB33F8; in pm8001_get_internal_phy_settings()
813 * pm8001_get_external_phy_settings - Retrieves the external PHY settings
821 phycfg->LaneLosCfg = 0x00000132; in pm8001_get_external_phy_settings()
822 phycfg->LanePgaCfg1 = 0x00203949; in pm8001_get_external_phy_settings()
823 phycfg->LanePisoCfg1 = 0x000000FF; in pm8001_get_external_phy_settings()
824 phycfg->LanePisoCfg2 = 0xFF000001; in pm8001_get_external_phy_settings()
825 phycfg->LanePisoCfg3 = 0xE7011300; in pm8001_get_external_phy_settings()
826 phycfg->LanePisoCfg4 = 0x63349140; in pm8001_get_external_phy_settings()
827 phycfg->LanePisoCfg5 = 0xF8102036; in pm8001_get_external_phy_settings()
828 phycfg->LanePisoCfg6 = 0xF80D9300; in pm8001_get_external_phy_settings()
829 phycfg->LaneBctCtrl = 0x00FB33F8; in pm8001_get_external_phy_settings()
833 * pm8001_get_phy_mask - Retrieves the mask that denotes if a PHY is int/ext
840 switch (pm8001_ha->pdev->subsystem_device) { in pm8001_get_phy_mask()
841 case 0x0070: /* H1280 - 8 external 0 internal */ in pm8001_get_phy_mask()
842 case 0x0072: /* H12F0 - 16 external 0 internal */ in pm8001_get_phy_mask()
846 case 0x0071: /* H1208 - 0 external 8 internal */ in pm8001_get_phy_mask()
847 case 0x0073: /* H120F - 0 external 16 internal */ in pm8001_get_phy_mask()
851 case 0x0080: /* H1244 - 4 external 4 internal */ in pm8001_get_phy_mask()
855 case 0x0081: /* H1248 - 4 external 8 internal */ in pm8001_get_phy_mask()
859 case 0x0082: /* H1288 - 8 external 8 internal */ in pm8001_get_phy_mask()
866 pm8001_ha->pdev->subsystem_device); in pm8001_get_phy_mask()
871 * pm8001_set_phy_settings_ven_117c_12G() - Configure ATTO 12Gb PHY settings
889 for (i = 0; i < pm8001_ha->chip->n_phy; i++) { in pm8001_set_phy_settings_ven_117c_12G()
890 if (phymask & (1 << i)) {/* Internal PHY */ in pm8001_set_phy_settings_ven_117c_12G()
906 * pm8001_configure_phy_settings - Configures PHY settings based on vendor ID.
911 switch (pm8001_ha->pdev->subsystem_vendor) { in pm8001_configure_phy_settings()
913 if (pm8001_ha->pdev->device == 0x0042) /* 6Gb */ in pm8001_configure_phy_settings()
929 * pm8001_setup_msix - enable MSI-X interrupt
938 /* SPCv controllers supports 64 msi-x */ in pm8001_setup_msix()
939 if (pm8001_ha->chip_id == chip_8001) { in pm8001_setup_msix()
940 number_of_intr = 1; in pm8001_setup_msix()
947 rc = pci_alloc_irq_vectors(pm8001_ha->pdev, number_of_intr, in pm8001_setup_msix()
955 pm8001_ha->number_of_intr = number_of_intr; in pm8001_setup_msix()
958 pm8001_ha->max_q_num = number_of_intr; in pm8001_setup_msix()
962 rc, pm8001_ha->number_of_intr); in pm8001_setup_msix()
970 int nr_irqs = pm8001_ha->number_of_intr; in pm8001_request_msix()
972 if (pm8001_ha->chip_id != chip_8001) in pm8001_request_msix()
977 pm8001_ha->number_of_intr); in pm8001_request_msix()
979 if (nr_irqs > ARRAY_SIZE(pm8001_ha->intr_drvname)) in pm8001_request_msix()
980 nr_irqs = ARRAY_SIZE(pm8001_ha->intr_drvname); in pm8001_request_msix()
983 snprintf(pm8001_ha->intr_drvname[i], in pm8001_request_msix()
984 sizeof(pm8001_ha->intr_drvname[0]), in pm8001_request_msix()
985 "%s-%d", pm8001_ha->name, i); in pm8001_request_msix()
986 pm8001_ha->irq_vector[i].irq_id = i; in pm8001_request_msix()
987 pm8001_ha->irq_vector[i].drv_inst = pm8001_ha; in pm8001_request_msix()
989 rc = request_irq(pci_irq_vector(pm8001_ha->pdev, i), in pm8001_request_msix()
991 pm8001_ha->intr_drvname[i], in pm8001_request_msix()
992 &(pm8001_ha->irq_vector[i])); in pm8001_request_msix()
995 free_irq(pci_irq_vector(pm8001_ha->pdev, i), in pm8001_request_msix()
996 &(pm8001_ha->irq_vector[i])); in pm8001_request_msix()
998 pci_free_irq_vectors(pm8001_ha->pdev); in pm8001_request_msix()
1011 pdev = pm8001_ha->pdev; in pm8001_setup_irq()
1022 * pm8001_request_irq - register interrupt
1030 pdev = pm8001_ha->pdev; in pm8001_request_irq()
1033 if (pdev->msix_cap && pci_msi_enabled()) in pm8001_request_irq()
1042 /* initialize the INT-X interrupt */ in pm8001_request_irq()
1043 pm8001_ha->irq_vector[0].irq_id = 0; in pm8001_request_irq()
1044 pm8001_ha->irq_vector[0].drv_inst = pm8001_ha; in pm8001_request_irq()
1045 rc = request_irq(pdev->irq, pm8001_interrupt_handler_intx, IRQF_SHARED, in pm8001_request_irq()
1046 pm8001_ha->name, SHOST_TO_SAS_HA(pm8001_ha->shost)); in pm8001_request_irq()
1051 * pm8001_pci_probe - probe supported device
1068 struct sas_ha_struct *sha; in pm8001_pci_probe() local
1070 dev_printk(KERN_INFO, &pdev->dev, in pm8001_pci_probe()
1093 rc = -ENOMEM; in pm8001_pci_probe()
1096 chip = &pm8001_chips[ent->driver_data]; in pm8001_pci_probe()
1097 sha = kzalloc(sizeof(struct sas_ha_struct), GFP_KERNEL); in pm8001_pci_probe()
1098 if (!sha) { in pm8001_pci_probe()
1099 rc = -ENOMEM; in pm8001_pci_probe()
1102 SHOST_TO_SAS_HA(shost) = sha; in pm8001_pci_probe()
1106 rc = -ENOMEM; in pm8001_pci_probe()
1110 /* ent->driver variable is used to differentiate between controllers */ in pm8001_pci_probe()
1113 rc = -ENOMEM; in pm8001_pci_probe()
1117 PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha); in pm8001_pci_probe()
1118 rc = PM8001_CHIP_DISP->chip_init(pm8001_ha); in pm8001_pci_probe()
1129 rc = scsi_add_host(shost, &pdev->dev); in pm8001_pci_probe()
1133 PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, 0); in pm8001_pci_probe()
1134 if (pm8001_ha->chip_id != chip_8001) { in pm8001_pci_probe()
1135 for (i = 1; i < pm8001_ha->number_of_intr; i++) in pm8001_pci_probe()
1136 PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, i); in pm8001_pci_probe()
1154 list_add_tail(&pm8001_ha->list, &hba_list); in pm8001_pci_probe()
1155 pm8001_ha->flags = PM8001F_RUN_TIME; in pm8001_pci_probe()
1156 scsi_scan_host(pm8001_ha->shost); in pm8001_pci_probe()
1160 scsi_remove_host(pm8001_ha->shost); in pm8001_pci_probe()
1164 kfree(sha); in pm8001_pci_probe()
1176 * pm8001_init_ccb_tag - allocate memory to CCB and tag.
1189 max_out_io = pm8001_ha->main_cfg_tbl.pm80xx_tbl.max_out_io; in pm8001_init_ccb_tag()
1193 can_queue = ccb_count - PM8001_RESERVE_SLOT; in pm8001_init_ccb_tag()
1194 shost->can_queue = can_queue; in pm8001_init_ccb_tag()
1196 pm8001_ha->tags = kzalloc(ccb_count, GFP_KERNEL); in pm8001_init_ccb_tag()
1197 if (!pm8001_ha->tags) in pm8001_init_ccb_tag()
1201 pm8001_ha->ccb_info = in pm8001_init_ccb_tag()
1203 if (!pm8001_ha->ccb_info) { in pm8001_init_ccb_tag()
1209 pm8001_ha->ccb_info[i].buf_prd = dma_alloc_coherent(&pdev->dev, in pm8001_init_ccb_tag()
1211 &pm8001_ha->ccb_info[i].ccb_dma_handle, in pm8001_init_ccb_tag()
1213 if (!pm8001_ha->ccb_info[i].buf_prd) { in pm8001_init_ccb_tag()
1218 pm8001_ha->ccb_info[i].task = NULL; in pm8001_init_ccb_tag()
1219 pm8001_ha->ccb_info[i].ccb_tag = 0xffffffff; in pm8001_init_ccb_tag()
1220 pm8001_ha->ccb_info[i].device = NULL; in pm8001_init_ccb_tag()
1221 ++pm8001_ha->tags_num; in pm8001_init_ccb_tag()
1226 kfree(pm8001_ha->devices); in pm8001_init_ccb_tag()
1228 return -ENOMEM; in pm8001_init_ccb_tag()
1233 struct sas_ha_struct *sha = pci_get_drvdata(pdev); in pm8001_pci_remove() local
1236 pm8001_ha = sha->lldd_ha; in pm8001_pci_remove()
1237 sas_unregister_ha(sha); in pm8001_pci_remove()
1238 sas_remove_host(pm8001_ha->shost); in pm8001_pci_remove()
1239 list_del(&pm8001_ha->list); in pm8001_pci_remove()
1240 PM8001_CHIP_DISP->interrupt_disable(pm8001_ha, 0xFF); in pm8001_pci_remove()
1241 PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha); in pm8001_pci_remove()
1244 for (i = 0; i < pm8001_ha->number_of_intr; i++) in pm8001_pci_remove()
1246 for (i = 0; i < pm8001_ha->number_of_intr; i++) in pm8001_pci_remove()
1247 free_irq(pci_irq_vector(pdev, i), &pm8001_ha->irq_vector[i]); in pm8001_pci_remove()
1250 free_irq(pm8001_ha->irq, sha); in pm8001_pci_remove()
1253 /* For non-msix and msix interrupts */ in pm8001_pci_remove()
1254 if ((!pdev->msix_cap || !pci_msi_enabled()) || in pm8001_pci_remove()
1255 (pm8001_ha->chip_id == chip_8001)) in pm8001_pci_remove()
1256 tasklet_kill(&pm8001_ha->tasklet[0]); in pm8001_pci_remove()
1259 tasklet_kill(&pm8001_ha->tasklet[j]); in pm8001_pci_remove()
1261 scsi_host_put(pm8001_ha->shost); in pm8001_pci_remove()
1263 kfree(sha->sas_phy); in pm8001_pci_remove()
1264 kfree(sha->sas_port); in pm8001_pci_remove()
1265 kfree(sha); in pm8001_pci_remove()
1271 * pm8001_pci_suspend - power management suspend main entry point
1279 struct sas_ha_struct *sha = pci_get_drvdata(pdev); in pm8001_pci_suspend() local
1280 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_pci_suspend()
1282 sas_suspend_ha(sha); in pm8001_pci_suspend()
1284 scsi_block_requests(pm8001_ha->shost); in pm8001_pci_suspend()
1285 if (!pdev->pm_cap) { in pm8001_pci_suspend()
1287 return -ENODEV; in pm8001_pci_suspend()
1289 PM8001_CHIP_DISP->interrupt_disable(pm8001_ha, 0xFF); in pm8001_pci_suspend()
1290 PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha); in pm8001_pci_suspend()
1292 for (i = 0; i < pm8001_ha->number_of_intr; i++) in pm8001_pci_suspend()
1294 for (i = 0; i < pm8001_ha->number_of_intr; i++) in pm8001_pci_suspend()
1295 free_irq(pci_irq_vector(pdev, i), &pm8001_ha->irq_vector[i]); in pm8001_pci_suspend()
1298 free_irq(pm8001_ha->irq, sha); in pm8001_pci_suspend()
1301 /* For non-msix and msix interrupts */ in pm8001_pci_suspend()
1302 if ((!pdev->msix_cap || !pci_msi_enabled()) || in pm8001_pci_suspend()
1303 (pm8001_ha->chip_id == chip_8001)) in pm8001_pci_suspend()
1304 tasklet_kill(&pm8001_ha->tasklet[0]); in pm8001_pci_suspend()
1307 tasklet_kill(&pm8001_ha->tasklet[j]); in pm8001_pci_suspend()
1311 pm8001_ha->name); in pm8001_pci_suspend()
1316 * pm8001_pci_resume - power management resume main entry point
1324 struct sas_ha_struct *sha = pci_get_drvdata(pdev); in pm8001_pci_resume() local
1330 pm8001_ha = sha->lldd_ha; in pm8001_pci_resume()
1331 device_state = pdev->current_state; in pm8001_pci_resume()
1334 pdev, pm8001_ha->name, device_state); in pm8001_pci_resume()
1339 sas_prep_resume_ha(sha); 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()
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()
1356 /* Tasklet for non msi-x interrupt handler */ in pm8001_pci_resume()
1357 if ((!pdev->msix_cap || !pci_msi_enabled()) || 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()
1390 sas_resume_ha(sha); in pm8001_pci_resume()
1394 scsi_remove_host(pm8001_ha->shost); in pm8001_pci_resume()
1491 * pm8001_init - initialize scsi transport template
1495 int rc = -ENOMEM; in pm8001_init()
1533 "PMC-Sierra PM8001/8006/8081/8088/8089/8074/8076/8077/8070/8072 "