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
54 [chip_8009] = {1, 8, &pm8001_80xx_dispatch,},
56 [chip_8019] = {1, 16, &pm8001_80xx_dispatch,},
83 .can_queue = 1,
84 .this_id = -1,
93 .track_queue_depth = 1,
116 *pm8001_phy_init - initiate our adapter phys
122 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; in pm8001_phy_init()
123 struct asd_sas_phy *sas_phy = &phy->sas_phy; in pm8001_phy_init()
124 phy->phy_state = 0; in pm8001_phy_init()
125 phy->pm8001_ha = pm8001_ha; in pm8001_phy_init()
126 sas_phy->enabled = (phy_id < pm8001_ha->chip->n_phy) ? 1 : 0; in pm8001_phy_init()
127 sas_phy->class = SAS; in pm8001_phy_init()
128 sas_phy->iproto = SAS_PROTOCOL_ALL; in pm8001_phy_init()
129 sas_phy->tproto = 0; in pm8001_phy_init()
130 sas_phy->type = PHY_TYPE_PHYSICAL; in pm8001_phy_init()
131 sas_phy->role = PHY_ROLE_INITIATOR; in pm8001_phy_init()
132 sas_phy->oob_mode = OOB_NOT_CONNECTED; in pm8001_phy_init()
133 sas_phy->linkrate = SAS_LINK_RATE_UNKNOWN; in pm8001_phy_init()
134 sas_phy->id = phy_id; in pm8001_phy_init()
135 sas_phy->sas_addr = (u8 *)&phy->dev_sas_addr; in pm8001_phy_init()
136 sas_phy->frame_rcvd = &phy->frame_rcvd[0]; in pm8001_phy_init()
137 sas_phy->ha = (struct sas_ha_struct *)pm8001_ha->shost->hostdata; in pm8001_phy_init()
138 sas_phy->lldd_phy = phy; in pm8001_phy_init()
142 *pm8001_free - free hba
154 if (pm8001_ha->memoryMap.region[i].virt_ptr != NULL) { in pm8001_free()
155 pci_free_consistent(pm8001_ha->pdev, in pm8001_free()
156 (pm8001_ha->memoryMap.region[i].total_len + in pm8001_free()
157 pm8001_ha->memoryMap.region[i].alignment), in pm8001_free()
158 pm8001_ha->memoryMap.region[i].virt_ptr, in pm8001_free()
159 pm8001_ha->memoryMap.region[i].phys_addr); in pm8001_free()
162 PM8001_CHIP_DISP->chip_iounmap(pm8001_ha); in pm8001_free()
164 kfree(pm8001_ha->tags); in pm8001_free()
171 * tasklet for 64 msi-x interrupt handler
181 pm8001_ha = irq_vector->drv_inst; in pm8001_tasklet()
183 BUG_ON(1); in pm8001_tasklet()
184 PM8001_CHIP_DISP->isr(pm8001_ha, irq_vector->irq_id); in pm8001_tasklet()
189 * pm8001_interrupt_handler_msix - main MSIX interrupt handler.
201 pm8001_ha = irq_vector->drv_inst; in pm8001_interrupt_handler_msix()
205 if (!PM8001_CHIP_DISP->is_our_interupt(pm8001_ha)) in pm8001_interrupt_handler_msix()
208 tasklet_schedule(&pm8001_ha->tasklet[irq_vector->irq_id]); in pm8001_interrupt_handler_msix()
210 ret = PM8001_CHIP_DISP->isr(pm8001_ha, irq_vector->irq_id); in pm8001_interrupt_handler_msix()
216 * pm8001_interrupt_handler_intx - main INTx interrupt handler.
224 struct sas_ha_struct *sha = dev_id; in pm8001_interrupt_handler_intx() local
225 pm8001_ha = sha->lldd_ha; in pm8001_interrupt_handler_intx()
228 if (!PM8001_CHIP_DISP->is_our_interupt(pm8001_ha)) in pm8001_interrupt_handler_intx()
232 tasklet_schedule(&pm8001_ha->tasklet[0]); in pm8001_interrupt_handler_intx()
234 ret = PM8001_CHIP_DISP->isr(pm8001_ha, 0); in pm8001_interrupt_handler_intx()
240 * pm8001_alloc - initiate our hba structure and 6 DMAs area.
248 spin_lock_init(&pm8001_ha->lock); in pm8001_alloc()
249 spin_lock_init(&pm8001_ha->bitmap_lock); in pm8001_alloc()
252 pm8001_ha->chip->n_phy)); in pm8001_alloc()
253 for (i = 0; i < pm8001_ha->chip->n_phy; i++) { in pm8001_alloc()
255 pm8001_ha->port[i].wide_port_phymap = 0; in pm8001_alloc()
256 pm8001_ha->port[i].port_attached = 0; in pm8001_alloc()
257 pm8001_ha->port[i].port_state = 0; in pm8001_alloc()
258 INIT_LIST_HEAD(&pm8001_ha->port[i].list); in pm8001_alloc()
261 pm8001_ha->tags = kzalloc(PM8001_MAX_CCB, GFP_KERNEL); in pm8001_alloc()
262 if (!pm8001_ha->tags) in pm8001_alloc()
264 /* MPI Memory region 1 for AAP Event Log for fw */ in pm8001_alloc()
265 pm8001_ha->memoryMap.region[AAP1].num_elements = 1; in pm8001_alloc()
266 pm8001_ha->memoryMap.region[AAP1].element_size = PM8001_EVENT_LOG_SIZE; in pm8001_alloc()
267 pm8001_ha->memoryMap.region[AAP1].total_len = PM8001_EVENT_LOG_SIZE; in pm8001_alloc()
268 pm8001_ha->memoryMap.region[AAP1].alignment = 32; in pm8001_alloc()
271 pm8001_ha->memoryMap.region[IOP].num_elements = 1; in pm8001_alloc()
272 pm8001_ha->memoryMap.region[IOP].element_size = PM8001_EVENT_LOG_SIZE; in pm8001_alloc()
273 pm8001_ha->memoryMap.region[IOP].total_len = PM8001_EVENT_LOG_SIZE; in pm8001_alloc()
274 pm8001_ha->memoryMap.region[IOP].alignment = 32; in pm8001_alloc()
278 pm8001_ha->memoryMap.region[CI+i].num_elements = 1; in pm8001_alloc()
279 pm8001_ha->memoryMap.region[CI+i].element_size = 4; in pm8001_alloc()
280 pm8001_ha->memoryMap.region[CI+i].total_len = 4; in pm8001_alloc()
281 pm8001_ha->memoryMap.region[CI+i].alignment = 4; in pm8001_alloc()
283 if ((ent->driver_data) != chip_8001) { in pm8001_alloc()
285 pm8001_ha->memoryMap.region[IB+i].num_elements = in pm8001_alloc()
287 pm8001_ha->memoryMap.region[IB+i].element_size = 128; in pm8001_alloc()
288 pm8001_ha->memoryMap.region[IB+i].total_len = in pm8001_alloc()
290 pm8001_ha->memoryMap.region[IB+i].alignment = 128; in pm8001_alloc()
292 pm8001_ha->memoryMap.region[IB+i].num_elements = in pm8001_alloc()
294 pm8001_ha->memoryMap.region[IB+i].element_size = 64; in pm8001_alloc()
295 pm8001_ha->memoryMap.region[IB+i].total_len = in pm8001_alloc()
297 pm8001_ha->memoryMap.region[IB+i].alignment = 64; in pm8001_alloc()
303 pm8001_ha->memoryMap.region[PI+i].num_elements = 1; in pm8001_alloc()
304 pm8001_ha->memoryMap.region[PI+i].element_size = 4; in pm8001_alloc()
305 pm8001_ha->memoryMap.region[PI+i].total_len = 4; in pm8001_alloc()
306 pm8001_ha->memoryMap.region[PI+i].alignment = 4; in pm8001_alloc()
308 if (ent->driver_data != chip_8001) { in pm8001_alloc()
310 pm8001_ha->memoryMap.region[OB+i].num_elements = in pm8001_alloc()
312 pm8001_ha->memoryMap.region[OB+i].element_size = 128; in pm8001_alloc()
313 pm8001_ha->memoryMap.region[OB+i].total_len = in pm8001_alloc()
315 pm8001_ha->memoryMap.region[OB+i].alignment = 128; in pm8001_alloc()
318 pm8001_ha->memoryMap.region[OB+i].num_elements = in pm8001_alloc()
320 pm8001_ha->memoryMap.region[OB+i].element_size = 64; in pm8001_alloc()
321 pm8001_ha->memoryMap.region[OB+i].total_len = in pm8001_alloc()
323 pm8001_ha->memoryMap.region[OB+i].alignment = 64; in pm8001_alloc()
328 pm8001_ha->memoryMap.region[NVMD].num_elements = 1; in pm8001_alloc()
329 pm8001_ha->memoryMap.region[NVMD].element_size = 4096; in pm8001_alloc()
330 pm8001_ha->memoryMap.region[NVMD].total_len = 4096; in pm8001_alloc()
332 pm8001_ha->memoryMap.region[DEV_MEM].num_elements = 1; in pm8001_alloc()
333 pm8001_ha->memoryMap.region[DEV_MEM].element_size = PM8001_MAX_DEVICES * in pm8001_alloc()
335 pm8001_ha->memoryMap.region[DEV_MEM].total_len = PM8001_MAX_DEVICES * in pm8001_alloc()
339 pm8001_ha->memoryMap.region[CCB_MEM].num_elements = 1; in pm8001_alloc()
340 pm8001_ha->memoryMap.region[CCB_MEM].element_size = PM8001_MAX_CCB * in pm8001_alloc()
342 pm8001_ha->memoryMap.region[CCB_MEM].total_len = PM8001_MAX_CCB * in pm8001_alloc()
346 pm8001_ha->memoryMap.region[FW_FLASH].total_len = 4096; in pm8001_alloc()
348 pm8001_ha->memoryMap.region[FORENSIC_MEM].num_elements = 1; in pm8001_alloc()
349 pm8001_ha->memoryMap.region[FORENSIC_MEM].total_len = 0x10000; in pm8001_alloc()
350 pm8001_ha->memoryMap.region[FORENSIC_MEM].element_size = 0x10000; in pm8001_alloc()
351 pm8001_ha->memoryMap.region[FORENSIC_MEM].alignment = 0x10000; in pm8001_alloc()
353 if (pm8001_mem_alloc(pm8001_ha->pdev, in pm8001_alloc()
354 &pm8001_ha->memoryMap.region[i].virt_ptr, in pm8001_alloc()
355 &pm8001_ha->memoryMap.region[i].phys_addr, in pm8001_alloc()
356 &pm8001_ha->memoryMap.region[i].phys_addr_hi, in pm8001_alloc()
357 &pm8001_ha->memoryMap.region[i].phys_addr_lo, in pm8001_alloc()
358 pm8001_ha->memoryMap.region[i].total_len, in pm8001_alloc()
359 pm8001_ha->memoryMap.region[i].alignment) != 0) { in pm8001_alloc()
367 pm8001_ha->devices = pm8001_ha->memoryMap.region[DEV_MEM].virt_ptr; in pm8001_alloc()
369 pm8001_ha->devices[i].dev_type = SAS_PHY_UNUSED; in pm8001_alloc()
370 pm8001_ha->devices[i].id = i; in pm8001_alloc()
371 pm8001_ha->devices[i].device_id = PM8001_MAX_DEVICES; in pm8001_alloc()
372 pm8001_ha->devices[i].running_req = 0; in pm8001_alloc()
374 pm8001_ha->ccb_info = pm8001_ha->memoryMap.region[CCB_MEM].virt_ptr; in pm8001_alloc()
376 pm8001_ha->ccb_info[i].ccb_dma_handle = in pm8001_alloc()
377 pm8001_ha->memoryMap.region[CCB_MEM].phys_addr + in pm8001_alloc()
379 pm8001_ha->ccb_info[i].task = NULL; in pm8001_alloc()
380 pm8001_ha->ccb_info[i].ccb_tag = 0xffffffff; in pm8001_alloc()
381 pm8001_ha->ccb_info[i].device = NULL; in pm8001_alloc()
382 ++pm8001_ha->tags_num; in pm8001_alloc()
384 pm8001_ha->flags = PM8001F_INIT_TIME; in pm8001_alloc()
389 return 1; in pm8001_alloc()
393 * pm8001_ioremap - remap the pci high physical address to kernal virtual
403 pdev = pm8001_ha->pdev; in pm8001_ioremap()
404 /* map pci mem (PMC pci base 0-3)*/ in pm8001_ioremap()
408 ** bar 0 and 1 - logical BAR0 in pm8001_ioremap()
409 ** bar 2 and 3 - logical BAR1 in pm8001_ioremap()
410 ** bar4 - logical BAR2 in pm8001_ioremap()
411 ** bar5 - logical BAR3 in pm8001_ioremap()
414 if ((bar == 1) || (bar == 3)) in pm8001_ioremap()
417 pm8001_ha->io_mem[logicalBar].membase = in pm8001_ioremap()
419 pm8001_ha->io_mem[logicalBar].memsize = in pm8001_ioremap()
421 pm8001_ha->io_mem[logicalBar].memvirtaddr = in pm8001_ioremap()
422 ioremap(pm8001_ha->io_mem[logicalBar].membase, in pm8001_ioremap()
423 pm8001_ha->io_mem[logicalBar].memsize); in pm8001_ioremap()
429 (u64)pm8001_ha->io_mem[logicalBar].membase, in pm8001_ioremap()
431 pm8001_ha->io_mem[logicalBar].memvirtaddr, in pm8001_ioremap()
432 pm8001_ha->io_mem[logicalBar].memsize)); in pm8001_ioremap()
434 pm8001_ha->io_mem[logicalBar].membase = 0; in pm8001_ioremap()
435 pm8001_ha->io_mem[logicalBar].memsize = 0; in pm8001_ioremap()
436 pm8001_ha->io_mem[logicalBar].memvirtaddr = 0; in pm8001_ioremap()
444 * pm8001_pci_alloc - initialize our ha card structure
455 struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); in pm8001_pci_alloc() local
458 pm8001_ha = sha->lldd_ha; in pm8001_pci_alloc()
462 pm8001_ha->pdev = pdev; in pm8001_pci_alloc()
463 pm8001_ha->dev = &pdev->dev; in pm8001_pci_alloc()
464 pm8001_ha->chip_id = ent->driver_data; in pm8001_pci_alloc()
465 pm8001_ha->chip = &pm8001_chips[pm8001_ha->chip_id]; in pm8001_pci_alloc()
466 pm8001_ha->irq = pdev->irq; in pm8001_pci_alloc()
467 pm8001_ha->sas = sha; in pm8001_pci_alloc()
468 pm8001_ha->shost = shost; in pm8001_pci_alloc()
469 pm8001_ha->id = pm8001_id++; in pm8001_pci_alloc()
470 pm8001_ha->logging_level = 0x01; in pm8001_pci_alloc()
471 sprintf(pm8001_ha->name, "%s%d", DRV_NAME, pm8001_ha->id); in pm8001_pci_alloc()
473 if (pm8001_ha->chip_id != chip_8001) in pm8001_pci_alloc()
474 pm8001_ha->iomb_size = IOMB_SIZE_SPCV; in pm8001_pci_alloc()
476 pm8001_ha->iomb_size = IOMB_SIZE_SPC; in pm8001_pci_alloc()
479 /* Tasklet for non msi-x interrupt handler */ in pm8001_pci_alloc()
480 if ((!pdev->msix_cap || !pci_msi_enabled()) in pm8001_pci_alloc()
481 || (pm8001_ha->chip_id == chip_8001)) in pm8001_pci_alloc()
482 tasklet_init(&pm8001_ha->tasklet[0], pm8001_tasklet, in pm8001_pci_alloc()
483 (unsigned long)&(pm8001_ha->irq_vector[0])); in pm8001_pci_alloc()
486 tasklet_init(&pm8001_ha->tasklet[j], pm8001_tasklet, in pm8001_pci_alloc()
487 (unsigned long)&(pm8001_ha->irq_vector[j])); in pm8001_pci_alloc()
497 * pci_go_44 - pm8001 specified, its DMA is 44 bit rather than 64 bit
510 dev_printk(KERN_ERR, &pdev->dev, in pci_go_44()
511 "44-bit DMA enable failed\n"); in pci_go_44()
518 dev_printk(KERN_ERR, &pdev->dev, in pci_go_44()
519 "32-bit DMA enable failed\n"); in pci_go_44()
524 dev_printk(KERN_ERR, &pdev->dev, in pci_go_44()
525 "32-bit consistent DMA enable failed\n"); in pci_go_44()
533 * pm8001_prep_sas_ha_init - allocate memory in general hba struct && init them.
543 struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); in pm8001_prep_sas_ha_init() local
545 phy_nr = chip_info->n_phy; in pm8001_prep_sas_ha_init()
547 memset(sha, 0x00, sizeof(*sha)); in pm8001_prep_sas_ha_init()
555 sha->sas_phy = arr_phy; in pm8001_prep_sas_ha_init()
556 sha->sas_port = arr_port; in pm8001_prep_sas_ha_init()
557 sha->lldd_ha = kzalloc(sizeof(struct pm8001_hba_info), GFP_KERNEL); in pm8001_prep_sas_ha_init()
558 if (!sha->lldd_ha) in pm8001_prep_sas_ha_init()
561 shost->transportt = pm8001_stt; in pm8001_prep_sas_ha_init()
562 shost->max_id = PM8001_MAX_DEVICES; in pm8001_prep_sas_ha_init()
563 shost->max_lun = 8; in pm8001_prep_sas_ha_init()
564 shost->max_channel = 0; in pm8001_prep_sas_ha_init()
565 shost->unique_id = pm8001_id; in pm8001_prep_sas_ha_init()
566 shost->max_cmd_len = 16; in pm8001_prep_sas_ha_init()
567 shost->can_queue = PM8001_CAN_QUEUE; in pm8001_prep_sas_ha_init()
568 shost->cmd_per_lun = 32; in pm8001_prep_sas_ha_init()
575 return -1; in pm8001_prep_sas_ha_init()
579 * pm8001_post_sas_ha_init - initialize general hba struct defined in libsas
588 struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); in pm8001_post_sas_ha_init() local
590 pm8001_ha = sha->lldd_ha; in pm8001_post_sas_ha_init()
591 for (i = 0; i < chip_info->n_phy; i++) { in pm8001_post_sas_ha_init()
592 sha->sas_phy[i] = &pm8001_ha->phy[i].sas_phy; in pm8001_post_sas_ha_init()
593 sha->sas_port[i] = &pm8001_ha->port[i].sas_port; in pm8001_post_sas_ha_init()
594 sha->sas_phy[i]->sas_addr = in pm8001_post_sas_ha_init()
595 (u8 *)&pm8001_ha->phy[i].dev_sas_addr; in pm8001_post_sas_ha_init()
597 sha->sas_ha_name = DRV_NAME; in pm8001_post_sas_ha_init()
598 sha->dev = pm8001_ha->dev; in pm8001_post_sas_ha_init()
599 sha->strict_wide_ports = 1; in pm8001_post_sas_ha_init()
600 sha->lldd_module = THIS_MODULE; in pm8001_post_sas_ha_init()
601 sha->sas_addr = &pm8001_ha->sas_addr[0]; in pm8001_post_sas_ha_init()
602 sha->num_phys = chip_info->n_phy; in pm8001_post_sas_ha_init()
603 sha->core.shost = shost; in pm8001_post_sas_ha_init()
607 * pm8001_init_sas_add - initialize sas address
627 pci_read_config_word(pm8001_ha->pdev, PCI_DEVICE_ID, &deviceid); in pm8001_init_sas_add()
628 pm8001_ha->nvmd_completion = &completion; in pm8001_init_sas_add()
630 if (pm8001_ha->chip_id == chip_8001) { in pm8001_init_sas_add()
638 } else if ((pm8001_ha->chip_id == chip_8070 || in pm8001_init_sas_add()
639 pm8001_ha->chip_id == chip_8072) && in pm8001_init_sas_add()
640 pm8001_ha->pdev->subsystem_vendor == PCI_VENDOR_ID_ATTO) { in pm8001_init_sas_add()
644 payload.minor_function = 1; in pm8001_init_sas_add()
653 rc = PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload); in pm8001_init_sas_add()
662 if (pm8001_ha->chip_id == chip_8001) { in pm8001_init_sas_add()
664 pm8001_ha->sas_addr[j] = in pm8001_init_sas_add()
667 pm8001_ha->sas_addr[j] = in pm8001_init_sas_add()
669 } else if ((pm8001_ha->chip_id == chip_8070 || in pm8001_init_sas_add()
670 pm8001_ha->chip_id == chip_8072) && in pm8001_init_sas_add()
671 pm8001_ha->pdev->subsystem_vendor == PCI_VENDOR_ID_ATTO) { in pm8001_init_sas_add()
672 pm8001_ha->sas_addr[j] = in pm8001_init_sas_add()
675 pm8001_ha->sas_addr[j] = in pm8001_init_sas_add()
678 memcpy(sas_add, pm8001_ha->sas_addr, SAS_ADDR_SIZE); in pm8001_init_sas_add()
679 for (i = 0; i < pm8001_ha->chip->n_phy; i++) { in pm8001_init_sas_add()
682 memcpy(&pm8001_ha->phy[i].dev_sas_addr, in pm8001_init_sas_add()
686 pm8001_ha->phy[i].dev_sas_addr)); in pm8001_init_sas_add()
690 for (i = 0; i < pm8001_ha->chip->n_phy; i++) { in pm8001_init_sas_add()
691 pm8001_ha->phy[i].dev_sas_addr = 0x50010c600047f9d0ULL; in pm8001_init_sas_add()
692 pm8001_ha->phy[i].dev_sas_addr = in pm8001_init_sas_add()
694 (*(u64 *)&pm8001_ha->phy[i].dev_sas_addr)); in pm8001_init_sas_add()
696 memcpy(pm8001_ha->sas_addr, &pm8001_ha->phy[0].dev_sas_addr, in pm8001_init_sas_add()
714 pm8001_ha->nvmd_completion = &completion; in pm8001_get_phy_settings_info()
721 return -ENOMEM; in pm8001_get_phy_settings_info()
723 rc = PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload); in pm8001_get_phy_settings_info()
727 return -ENOMEM; in pm8001_get_phy_settings_info()
757 phycfg->LaneLosCfg = 0x00000132; in pm8001_get_internal_phy_settings()
758 phycfg->LanePgaCfg1 = 0x00203949; in pm8001_get_internal_phy_settings()
759 phycfg->LanePisoCfg1 = 0x000000FF; in pm8001_get_internal_phy_settings()
760 phycfg->LanePisoCfg2 = 0xFF000001; in pm8001_get_internal_phy_settings()
761 phycfg->LanePisoCfg3 = 0xE7011300; in pm8001_get_internal_phy_settings()
762 phycfg->LanePisoCfg4 = 0x631C40C0; in pm8001_get_internal_phy_settings()
763 phycfg->LanePisoCfg5 = 0xF8102036; in pm8001_get_internal_phy_settings()
764 phycfg->LanePisoCfg6 = 0xF74A1000; in pm8001_get_internal_phy_settings()
765 phycfg->LaneBctCtrl = 0x00FB33F8; in pm8001_get_internal_phy_settings()
777 phycfg->LaneLosCfg = 0x00000132; in pm8001_get_external_phy_settings()
778 phycfg->LanePgaCfg1 = 0x00203949; in pm8001_get_external_phy_settings()
779 phycfg->LanePisoCfg1 = 0x000000FF; in pm8001_get_external_phy_settings()
780 phycfg->LanePisoCfg2 = 0xFF000001; in pm8001_get_external_phy_settings()
781 phycfg->LanePisoCfg3 = 0xE7011300; in pm8001_get_external_phy_settings()
782 phycfg->LanePisoCfg4 = 0x63349140; in pm8001_get_external_phy_settings()
783 phycfg->LanePisoCfg5 = 0xF8102036; in pm8001_get_external_phy_settings()
784 phycfg->LanePisoCfg6 = 0xF80D9300; in pm8001_get_external_phy_settings()
785 phycfg->LaneBctCtrl = 0x00FB33F8; in pm8001_get_external_phy_settings()
796 switch (pm8001_ha->pdev->subsystem_device) { in pm8001_get_phy_mask()
797 case 0x0070: /* H1280 - 8 external 0 internal */ in pm8001_get_phy_mask()
798 case 0x0072: /* H12F0 - 16 external 0 internal */ in pm8001_get_phy_mask()
802 case 0x0071: /* H1208 - 0 external 8 internal */ in pm8001_get_phy_mask()
803 case 0x0073: /* H120F - 0 external 16 internal */ in pm8001_get_phy_mask()
807 case 0x0080: /* H1244 - 4 external 4 internal */ in pm8001_get_phy_mask()
811 case 0x0081: /* H1248 - 4 external 8 internal */ in pm8001_get_phy_mask()
815 case 0x0082: /* H1288 - 8 external 8 internal */ in pm8001_get_phy_mask()
822 pm8001_ha->pdev->subsystem_device)); in pm8001_get_phy_mask()
845 for (i = 0; i < pm8001_ha->chip->n_phy; i++) { in pm8001_set_phy_settings_ven_117c_12G()
846 if (phymask & (1 << i)) {/* Internal PHY */ in pm8001_set_phy_settings_ven_117c_12G()
867 switch (pm8001_ha->pdev->subsystem_vendor) { in pm8001_configure_phy_settings()
869 if (pm8001_ha->pdev->device == 0x0042) /* 6Gb */ in pm8001_configure_phy_settings()
885 * pm8001_setup_msix - enable MSI-X interrupt
897 /* SPCv controllers supports 64 msi-x */ in pm8001_setup_msix()
898 if (pm8001_ha->chip_id == chip_8001) { in pm8001_setup_msix()
899 number_of_intr = 1; in pm8001_setup_msix()
905 rc = pci_alloc_irq_vectors(pm8001_ha->pdev, number_of_intr, in pm8001_setup_msix()
909 pm8001_ha->number_of_intr = number_of_intr; in pm8001_setup_msix()
913 rc, pm8001_ha->number_of_intr)); in pm8001_setup_msix()
918 pm8001_ha->irq_vector[i].irq_id = i; in pm8001_setup_msix()
919 pm8001_ha->irq_vector[i].drv_inst = pm8001_ha; in pm8001_setup_msix()
921 rc = request_irq(pci_irq_vector(pm8001_ha->pdev, i), in pm8001_setup_msix()
923 intr_drvname[i], &(pm8001_ha->irq_vector[i])); in pm8001_setup_msix()
926 free_irq(pci_irq_vector(pm8001_ha->pdev, i), in pm8001_setup_msix()
927 &(pm8001_ha->irq_vector[i])); in pm8001_setup_msix()
929 pci_free_irq_vectors(pm8001_ha->pdev); in pm8001_setup_msix()
939 * pm8001_request_irq - register interrupt
947 pdev = pm8001_ha->pdev; in pm8001_request_irq()
950 if (pdev->msix_cap && pci_msi_enabled()) in pm8001_request_irq()
960 /* initialize the INT-X interrupt */ in pm8001_request_irq()
961 pm8001_ha->irq_vector[0].irq_id = 0; in pm8001_request_irq()
962 pm8001_ha->irq_vector[0].drv_inst = pm8001_ha; in pm8001_request_irq()
963 rc = request_irq(pdev->irq, pm8001_interrupt_handler_intx, IRQF_SHARED, in pm8001_request_irq()
964 DRV_NAME, SHOST_TO_SAS_HA(pm8001_ha->shost)); in pm8001_request_irq()
969 * pm8001_pci_probe - probe supported device
987 dev_printk(KERN_INFO, &pdev->dev, in pm8001_pci_probe()
1010 rc = -ENOMEM; in pm8001_pci_probe()
1013 chip = &pm8001_chips[ent->driver_data]; in pm8001_pci_probe()
1017 rc = -ENOMEM; in pm8001_pci_probe()
1023 rc = -ENOMEM; in pm8001_pci_probe()
1027 /* ent->driver variable is used to differentiate between controllers */ in pm8001_pci_probe()
1030 rc = -ENOMEM; in pm8001_pci_probe()
1033 list_add_tail(&pm8001_ha->list, &hba_list); in pm8001_pci_probe()
1034 PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha); in pm8001_pci_probe()
1035 rc = PM8001_CHIP_DISP->chip_init(pm8001_ha); in pm8001_pci_probe()
1042 rc = scsi_add_host(shost, &pdev->dev); in pm8001_pci_probe()
1052 PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, 0); in pm8001_pci_probe()
1053 if (pm8001_ha->chip_id != chip_8001) { in pm8001_pci_probe()
1054 for (i = 1; i < pm8001_ha->number_of_intr; i++) in pm8001_pci_probe()
1055 PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, i); in pm8001_pci_probe()
1069 scsi_scan_host(pm8001_ha->shost); in pm8001_pci_probe()
1073 scsi_remove_host(pm8001_ha->shost); in pm8001_pci_probe()
1090 struct sas_ha_struct *sha = pci_get_drvdata(pdev); in pm8001_pci_remove() local
1093 pm8001_ha = sha->lldd_ha; in pm8001_pci_remove()
1094 sas_unregister_ha(sha); in pm8001_pci_remove()
1095 sas_remove_host(pm8001_ha->shost); in pm8001_pci_remove()
1096 list_del(&pm8001_ha->list); in pm8001_pci_remove()
1097 PM8001_CHIP_DISP->interrupt_disable(pm8001_ha, 0xFF); in pm8001_pci_remove()
1098 PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha); in pm8001_pci_remove()
1101 for (i = 0; i < pm8001_ha->number_of_intr; i++) in pm8001_pci_remove()
1103 for (i = 0; i < pm8001_ha->number_of_intr; i++) in pm8001_pci_remove()
1104 free_irq(pci_irq_vector(pdev, i), &pm8001_ha->irq_vector[i]); in pm8001_pci_remove()
1107 free_irq(pm8001_ha->irq, sha); in pm8001_pci_remove()
1110 /* For non-msix and msix interrupts */ in pm8001_pci_remove()
1111 if ((!pdev->msix_cap || !pci_msi_enabled()) || in pm8001_pci_remove()
1112 (pm8001_ha->chip_id == chip_8001)) in pm8001_pci_remove()
1113 tasklet_kill(&pm8001_ha->tasklet[0]); in pm8001_pci_remove()
1116 tasklet_kill(&pm8001_ha->tasklet[j]); in pm8001_pci_remove()
1118 scsi_host_put(pm8001_ha->shost); in pm8001_pci_remove()
1120 kfree(sha->sas_phy); in pm8001_pci_remove()
1121 kfree(sha->sas_port); in pm8001_pci_remove()
1122 kfree(sha); in pm8001_pci_remove()
1128 * pm8001_pci_suspend - power management suspend main entry point
1136 struct sas_ha_struct *sha = pci_get_drvdata(pdev); in pm8001_pci_suspend() local
1140 pm8001_ha = sha->lldd_ha; in pm8001_pci_suspend()
1141 sas_suspend_ha(sha); in pm8001_pci_suspend()
1143 scsi_block_requests(pm8001_ha->shost); in pm8001_pci_suspend()
1144 if (!pdev->pm_cap) { in pm8001_pci_suspend()
1145 dev_err(&pdev->dev, " PCI PM not supported\n"); in pm8001_pci_suspend()
1146 return -ENODEV; in pm8001_pci_suspend()
1148 PM8001_CHIP_DISP->interrupt_disable(pm8001_ha, 0xFF); in pm8001_pci_suspend()
1149 PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha); in pm8001_pci_suspend()
1151 for (i = 0; i < pm8001_ha->number_of_intr; i++) in pm8001_pci_suspend()
1153 for (i = 0; i < pm8001_ha->number_of_intr; i++) in pm8001_pci_suspend()
1154 free_irq(pci_irq_vector(pdev, i), &pm8001_ha->irq_vector[i]); in pm8001_pci_suspend()
1157 free_irq(pm8001_ha->irq, sha); in pm8001_pci_suspend()
1160 /* For non-msix and msix interrupts */ in pm8001_pci_suspend()
1161 if ((!pdev->msix_cap || !pci_msi_enabled()) || in pm8001_pci_suspend()
1162 (pm8001_ha->chip_id == chip_8001)) in pm8001_pci_suspend()
1163 tasklet_kill(&pm8001_ha->tasklet[0]); in pm8001_pci_suspend()
1166 tasklet_kill(&pm8001_ha->tasklet[j]); in pm8001_pci_suspend()
1171 pm8001_ha->name, device_state); in pm8001_pci_suspend()
1179 * pm8001_pci_resume - power management resume main entry point
1186 struct sas_ha_struct *sha = pci_get_drvdata(pdev); in pm8001_pci_resume() local
1192 pm8001_ha = sha->lldd_ha; in pm8001_pci_resume()
1193 device_state = pdev->current_state; in pm8001_pci_resume()
1196 "operating state [D%d]\n", pdev, pm8001_ha->name, device_state); in pm8001_pci_resume()
1204 pm8001_ha->name); in pm8001_pci_resume()
1212 sas_prep_resume_ha(sha); in pm8001_pci_resume()
1214 if (pm8001_ha->chip_id == chip_8001) { in pm8001_pci_resume()
1215 PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha); in pm8001_pci_resume()
1219 rc = PM8001_CHIP_DISP->chip_init(pm8001_ha); in pm8001_pci_resume()
1224 PM8001_CHIP_DISP->interrupt_disable(pm8001_ha, 0xFF); in pm8001_pci_resume()
1230 /* Tasklet for non msi-x interrupt handler */ in pm8001_pci_resume()
1231 if ((!pdev->msix_cap || !pci_msi_enabled()) || in pm8001_pci_resume()
1232 (pm8001_ha->chip_id == chip_8001)) in pm8001_pci_resume()
1233 tasklet_init(&pm8001_ha->tasklet[0], pm8001_tasklet, in pm8001_pci_resume()
1234 (unsigned long)&(pm8001_ha->irq_vector[0])); in pm8001_pci_resume()
1237 tasklet_init(&pm8001_ha->tasklet[j], pm8001_tasklet, in pm8001_pci_resume()
1238 (unsigned long)&(pm8001_ha->irq_vector[j])); in pm8001_pci_resume()
1240 PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, 0); in pm8001_pci_resume()
1241 if (pm8001_ha->chip_id != chip_8001) { in pm8001_pci_resume()
1242 for (i = 1; i < pm8001_ha->number_of_intr; i++) in pm8001_pci_resume()
1243 PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, i); in pm8001_pci_resume()
1251 if (pm8001_ha->chip_id == chip_8070 || in pm8001_pci_resume()
1252 pm8001_ha->chip_id == chip_8072) { in pm8001_pci_resume()
1258 pm8001_ha->flags = PM8001F_RUN_TIME; in pm8001_pci_resume()
1259 for (i = 0; i < pm8001_ha->chip->n_phy; i++) { in pm8001_pci_resume()
1260 pm8001_ha->phy[i].enable_completion = &completion; in pm8001_pci_resume()
1261 PM8001_CHIP_DISP->phy_start_req(pm8001_ha, i); in pm8001_pci_resume()
1264 sas_resume_ha(sha); in pm8001_pci_resume()
1268 scsi_remove_host(pm8001_ha->shost); in pm8001_pci_resume()
1363 * pm8001_init - initialize scsi transport template
1367 int rc = -ENOMEM; in pm8001_init()
1405 "PMC-Sierra PM8001/8006/8081/8088/8089/8074/8076/8077/8070/8072 "