2009-10-14 15:19:21 +07:00
|
|
|
/*
|
2013-04-17 17:56:36 +07:00
|
|
|
* PMC-Sierra PM8001/8081/8088/8089 SAS/SATA based host adapters driver
|
2009-10-14 15:19:21 +07:00
|
|
|
*
|
|
|
|
* Copyright (c) 2008-2009 USI Co., Ltd.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions, and the following disclaimer,
|
|
|
|
* without modification.
|
|
|
|
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
|
|
|
|
* substantially similar to the "NO WARRANTY" disclaimer below
|
|
|
|
* ("Disclaimer") and any redistribution must be conditioned upon
|
|
|
|
* including a substantially similar Disclaimer requirement for further
|
|
|
|
* binary redistribution.
|
|
|
|
* 3. Neither the names of the above-listed copyright holders nor the names
|
|
|
|
* of any contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* Alternatively, this software may be distributed under the terms of the
|
|
|
|
* GNU General Public License ("GPL") version 2 as published by the Free
|
|
|
|
* Software Foundation.
|
|
|
|
*
|
|
|
|
* NO WARRANTY
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
|
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGES.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 15:04:11 +07:00
|
|
|
#include <linux/slab.h>
|
2009-10-14 15:19:21 +07:00
|
|
|
#include "pm8001_sas.h"
|
|
|
|
#include "pm8001_chips.h"
|
|
|
|
|
|
|
|
static struct scsi_transport_template *pm8001_stt;
|
|
|
|
|
2013-04-17 17:56:36 +07:00
|
|
|
/**
|
|
|
|
* chip info structure to identify chip key functionality as
|
|
|
|
* encryption available/not, no of ports, hw specific function ref
|
|
|
|
*/
|
2009-10-14 15:19:21 +07:00
|
|
|
static const struct pm8001_chip_info pm8001_chips[] = {
|
2013-04-17 17:56:36 +07:00
|
|
|
[chip_8001] = {0, 8, &pm8001_8001_dispatch,},
|
2013-04-17 18:07:02 +07:00
|
|
|
[chip_8008] = {0, 8, &pm8001_80xx_dispatch,},
|
|
|
|
[chip_8009] = {1, 8, &pm8001_80xx_dispatch,},
|
|
|
|
[chip_8018] = {0, 16, &pm8001_80xx_dispatch,},
|
|
|
|
[chip_8019] = {1, 16, &pm8001_80xx_dispatch,},
|
2013-09-03 16:39:42 +07:00
|
|
|
[chip_8074] = {0, 8, &pm8001_80xx_dispatch,},
|
|
|
|
[chip_8076] = {0, 16, &pm8001_80xx_dispatch,},
|
|
|
|
[chip_8077] = {0, 16, &pm8001_80xx_dispatch,},
|
2015-02-12 13:34:37 +07:00
|
|
|
[chip_8006] = {0, 16, &pm8001_80xx_dispatch,},
|
2015-10-30 21:53:25 +07:00
|
|
|
[chip_8070] = {0, 8, &pm8001_80xx_dispatch,},
|
|
|
|
[chip_8072] = {0, 16, &pm8001_80xx_dispatch,},
|
2009-10-14 15:19:21 +07:00
|
|
|
};
|
|
|
|
static int pm8001_id;
|
|
|
|
|
|
|
|
LIST_HEAD(hba_list);
|
|
|
|
|
2011-01-24 20:57:29 +07:00
|
|
|
struct workqueue_struct *pm8001_wq;
|
|
|
|
|
2009-10-14 15:19:21 +07:00
|
|
|
/**
|
|
|
|
* The main structure which LLDD must register for scsi core.
|
|
|
|
*/
|
|
|
|
static struct scsi_host_template pm8001_sht = {
|
|
|
|
.module = THIS_MODULE,
|
|
|
|
.name = DRV_NAME,
|
|
|
|
.queuecommand = sas_queuecommand,
|
|
|
|
.target_alloc = sas_target_alloc,
|
2011-09-21 05:11:03 +07:00
|
|
|
.slave_configure = sas_slave_configure,
|
2009-10-14 15:19:21 +07:00
|
|
|
.scan_finished = pm8001_scan_finished,
|
|
|
|
.scan_start = pm8001_scan_start,
|
|
|
|
.change_queue_depth = sas_change_queue_depth,
|
|
|
|
.bios_param = sas_bios_param,
|
|
|
|
.can_queue = 1,
|
|
|
|
.this_id = -1,
|
|
|
|
.sg_tablesize = SG_ALL,
|
|
|
|
.max_sectors = SCSI_DEFAULT_MAX_SECTORS,
|
|
|
|
.eh_device_reset_handler = sas_eh_device_reset_handler,
|
2017-08-25 18:57:02 +07:00
|
|
|
.eh_target_reset_handler = sas_eh_target_reset_handler,
|
2009-10-14 15:19:21 +07:00
|
|
|
.target_destroy = sas_target_destroy,
|
|
|
|
.ioctl = sas_ioctl,
|
|
|
|
.shost_attrs = pm8001_host_attrs,
|
2014-11-13 20:25:11 +07:00
|
|
|
.track_queue_depth = 1,
|
2009-10-14 15:19:21 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sas layer call this function to execute specific task.
|
|
|
|
*/
|
|
|
|
static struct sas_domain_function_template pm8001_transport_ops = {
|
|
|
|
.lldd_dev_found = pm8001_dev_found,
|
|
|
|
.lldd_dev_gone = pm8001_dev_gone,
|
|
|
|
|
|
|
|
.lldd_execute_task = pm8001_queue_command,
|
|
|
|
.lldd_control_phy = pm8001_phy_control,
|
|
|
|
|
|
|
|
.lldd_abort_task = pm8001_abort_task,
|
|
|
|
.lldd_abort_task_set = pm8001_abort_task_set,
|
|
|
|
.lldd_clear_aca = pm8001_clear_aca,
|
|
|
|
.lldd_clear_task_set = pm8001_clear_task_set,
|
|
|
|
.lldd_I_T_nexus_reset = pm8001_I_T_nexus_reset,
|
|
|
|
.lldd_lu_reset = pm8001_lu_reset,
|
|
|
|
.lldd_query_task = pm8001_query_task,
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
*pm8001_phy_init - initiate our adapter phys
|
|
|
|
*@pm8001_ha: our hba structure.
|
|
|
|
*@phy_id: phy id.
|
|
|
|
*/
|
2012-12-22 04:08:55 +07:00
|
|
|
static void pm8001_phy_init(struct pm8001_hba_info *pm8001_ha, int phy_id)
|
2009-10-14 15:19:21 +07:00
|
|
|
{
|
|
|
|
struct pm8001_phy *phy = &pm8001_ha->phy[phy_id];
|
|
|
|
struct asd_sas_phy *sas_phy = &phy->sas_phy;
|
2018-09-11 15:48:02 +07:00
|
|
|
phy->phy_state = PHY_LINK_DISABLE;
|
2009-10-14 15:19:21 +07:00
|
|
|
phy->pm8001_ha = pm8001_ha;
|
|
|
|
sas_phy->enabled = (phy_id < pm8001_ha->chip->n_phy) ? 1 : 0;
|
|
|
|
sas_phy->class = SAS;
|
|
|
|
sas_phy->iproto = SAS_PROTOCOL_ALL;
|
|
|
|
sas_phy->tproto = 0;
|
|
|
|
sas_phy->type = PHY_TYPE_PHYSICAL;
|
|
|
|
sas_phy->role = PHY_ROLE_INITIATOR;
|
|
|
|
sas_phy->oob_mode = OOB_NOT_CONNECTED;
|
|
|
|
sas_phy->linkrate = SAS_LINK_RATE_UNKNOWN;
|
|
|
|
sas_phy->id = phy_id;
|
2017-10-18 13:09:09 +07:00
|
|
|
sas_phy->sas_addr = (u8 *)&phy->dev_sas_addr;
|
2009-10-14 15:19:21 +07:00
|
|
|
sas_phy->frame_rcvd = &phy->frame_rcvd[0];
|
|
|
|
sas_phy->ha = (struct sas_ha_struct *)pm8001_ha->shost->hostdata;
|
|
|
|
sas_phy->lldd_phy = phy;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*pm8001_free - free hba
|
|
|
|
*@pm8001_ha: our hba structure.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static void pm8001_free(struct pm8001_hba_info *pm8001_ha)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!pm8001_ha)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = 0; i < USI_MAX_MEMCNT; i++) {
|
|
|
|
if (pm8001_ha->memoryMap.region[i].virt_ptr != NULL) {
|
2018-10-11 00:59:50 +07:00
|
|
|
dma_free_coherent(&pm8001_ha->pdev->dev,
|
2013-02-04 13:40:02 +07:00
|
|
|
(pm8001_ha->memoryMap.region[i].total_len +
|
|
|
|
pm8001_ha->memoryMap.region[i].alignment),
|
2009-10-14 15:19:21 +07:00
|
|
|
pm8001_ha->memoryMap.region[i].virt_ptr,
|
|
|
|
pm8001_ha->memoryMap.region[i].phys_addr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
PM8001_CHIP_DISP->chip_iounmap(pm8001_ha);
|
2011-01-24 20:57:29 +07:00
|
|
|
flush_workqueue(pm8001_wq);
|
2009-10-14 15:19:21 +07:00
|
|
|
kfree(pm8001_ha->tags);
|
|
|
|
kfree(pm8001_ha);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef PM8001_USE_TASKLET
|
2013-03-19 19:26:17 +07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* tasklet for 64 msi-x interrupt handler
|
|
|
|
* @opaque: the passed general host adapter struct
|
|
|
|
* Note: pm8001_tasklet is common for pm8001 & pm80xx
|
|
|
|
*/
|
2009-10-14 15:19:21 +07:00
|
|
|
static void pm8001_tasklet(unsigned long opaque)
|
|
|
|
{
|
|
|
|
struct pm8001_hba_info *pm8001_ha;
|
2013-11-11 16:58:14 +07:00
|
|
|
struct isr_param *irq_vector;
|
|
|
|
|
|
|
|
irq_vector = (struct isr_param *)opaque;
|
|
|
|
pm8001_ha = irq_vector->drv_inst;
|
2009-10-14 15:19:21 +07:00
|
|
|
if (unlikely(!pm8001_ha))
|
|
|
|
BUG_ON(1);
|
2013-11-11 16:58:14 +07:00
|
|
|
PM8001_CHIP_DISP->isr(pm8001_ha, irq_vector->irq_id);
|
2013-03-19 19:26:17 +07:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* pm8001_interrupt_handler_msix - main MSIX interrupt handler.
|
|
|
|
* It obtains the vector number and calls the equivalent bottom
|
|
|
|
* half or services directly.
|
|
|
|
* @opaque: the passed outbound queue/vector. Host structure is
|
|
|
|
* retrieved from the same.
|
|
|
|
*/
|
|
|
|
static irqreturn_t pm8001_interrupt_handler_msix(int irq, void *opaque)
|
|
|
|
{
|
2013-11-11 16:58:14 +07:00
|
|
|
struct isr_param *irq_vector;
|
|
|
|
struct pm8001_hba_info *pm8001_ha;
|
2013-03-19 19:26:17 +07:00
|
|
|
irqreturn_t ret = IRQ_HANDLED;
|
2013-11-11 16:58:14 +07:00
|
|
|
irq_vector = (struct isr_param *)opaque;
|
|
|
|
pm8001_ha = irq_vector->drv_inst;
|
|
|
|
|
2013-03-19 19:26:17 +07:00
|
|
|
if (unlikely(!pm8001_ha))
|
|
|
|
return IRQ_NONE;
|
|
|
|
if (!PM8001_CHIP_DISP->is_our_interupt(pm8001_ha))
|
|
|
|
return IRQ_NONE;
|
|
|
|
#ifdef PM8001_USE_TASKLET
|
2013-11-11 16:58:14 +07:00
|
|
|
tasklet_schedule(&pm8001_ha->tasklet[irq_vector->irq_id]);
|
2013-03-19 19:26:17 +07:00
|
|
|
#else
|
2013-11-11 16:58:14 +07:00
|
|
|
ret = PM8001_CHIP_DISP->isr(pm8001_ha, irq_vector->irq_id);
|
2009-10-14 15:19:21 +07:00
|
|
|
#endif
|
2013-03-19 19:26:17 +07:00
|
|
|
return ret;
|
|
|
|
}
|
2009-10-14 15:19:21 +07:00
|
|
|
|
2013-03-19 19:26:17 +07:00
|
|
|
/**
|
|
|
|
* pm8001_interrupt_handler_intx - main INTx interrupt handler.
|
|
|
|
* @dev_id: sas_ha structure. The HBA is retrieved from sas_has structure.
|
|
|
|
*/
|
2009-10-14 15:19:21 +07:00
|
|
|
|
2013-03-19 19:26:17 +07:00
|
|
|
static irqreturn_t pm8001_interrupt_handler_intx(int irq, void *dev_id)
|
2009-10-14 15:19:21 +07:00
|
|
|
{
|
|
|
|
struct pm8001_hba_info *pm8001_ha;
|
|
|
|
irqreturn_t ret = IRQ_HANDLED;
|
2013-03-19 19:26:17 +07:00
|
|
|
struct sas_ha_struct *sha = dev_id;
|
2009-10-14 15:19:21 +07:00
|
|
|
pm8001_ha = sha->lldd_ha;
|
|
|
|
if (unlikely(!pm8001_ha))
|
|
|
|
return IRQ_NONE;
|
|
|
|
if (!PM8001_CHIP_DISP->is_our_interupt(pm8001_ha))
|
|
|
|
return IRQ_NONE;
|
2013-03-19 19:26:17 +07:00
|
|
|
|
2009-10-14 15:19:21 +07:00
|
|
|
#ifdef PM8001_USE_TASKLET
|
2013-11-11 16:58:14 +07:00
|
|
|
tasklet_schedule(&pm8001_ha->tasklet[0]);
|
2009-10-14 15:19:21 +07:00
|
|
|
#else
|
2013-02-27 21:57:43 +07:00
|
|
|
ret = PM8001_CHIP_DISP->isr(pm8001_ha, 0);
|
2009-10-14 15:19:21 +07:00
|
|
|
#endif
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* pm8001_alloc - initiate our hba structure and 6 DMAs area.
|
|
|
|
* @pm8001_ha:our hba structure.
|
|
|
|
*
|
|
|
|
*/
|
2013-02-27 21:55:25 +07:00
|
|
|
static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha,
|
|
|
|
const struct pci_device_id *ent)
|
2009-10-14 15:19:21 +07:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
spin_lock_init(&pm8001_ha->lock);
|
2014-07-09 18:51:01 +07:00
|
|
|
spin_lock_init(&pm8001_ha->bitmap_lock);
|
2013-02-27 21:55:25 +07:00
|
|
|
PM8001_INIT_DBG(pm8001_ha,
|
|
|
|
pm8001_printk("pm8001_alloc: PHY:%x\n",
|
|
|
|
pm8001_ha->chip->n_phy));
|
2009-12-07 16:22:42 +07:00
|
|
|
for (i = 0; i < pm8001_ha->chip->n_phy; i++) {
|
2009-10-14 15:19:21 +07:00
|
|
|
pm8001_phy_init(pm8001_ha, i);
|
2009-12-07 16:22:42 +07:00
|
|
|
pm8001_ha->port[i].wide_port_phymap = 0;
|
|
|
|
pm8001_ha->port[i].port_attached = 0;
|
|
|
|
pm8001_ha->port[i].port_state = 0;
|
|
|
|
INIT_LIST_HEAD(&pm8001_ha->port[i].list);
|
|
|
|
}
|
2009-10-14 15:19:21 +07:00
|
|
|
|
2009-11-05 21:33:51 +07:00
|
|
|
pm8001_ha->tags = kzalloc(PM8001_MAX_CCB, GFP_KERNEL);
|
|
|
|
if (!pm8001_ha->tags)
|
|
|
|
goto err_out;
|
2009-10-14 15:19:21 +07:00
|
|
|
/* MPI Memory region 1 for AAP Event Log for fw */
|
|
|
|
pm8001_ha->memoryMap.region[AAP1].num_elements = 1;
|
|
|
|
pm8001_ha->memoryMap.region[AAP1].element_size = PM8001_EVENT_LOG_SIZE;
|
|
|
|
pm8001_ha->memoryMap.region[AAP1].total_len = PM8001_EVENT_LOG_SIZE;
|
|
|
|
pm8001_ha->memoryMap.region[AAP1].alignment = 32;
|
|
|
|
|
|
|
|
/* MPI Memory region 2 for IOP Event Log for fw */
|
|
|
|
pm8001_ha->memoryMap.region[IOP].num_elements = 1;
|
|
|
|
pm8001_ha->memoryMap.region[IOP].element_size = PM8001_EVENT_LOG_SIZE;
|
|
|
|
pm8001_ha->memoryMap.region[IOP].total_len = PM8001_EVENT_LOG_SIZE;
|
|
|
|
pm8001_ha->memoryMap.region[IOP].alignment = 32;
|
|
|
|
|
2013-02-27 21:55:25 +07:00
|
|
|
for (i = 0; i < PM8001_MAX_SPCV_INB_NUM; i++) {
|
|
|
|
/* MPI Memory region 3 for consumer Index of inbound queues */
|
|
|
|
pm8001_ha->memoryMap.region[CI+i].num_elements = 1;
|
|
|
|
pm8001_ha->memoryMap.region[CI+i].element_size = 4;
|
|
|
|
pm8001_ha->memoryMap.region[CI+i].total_len = 4;
|
|
|
|
pm8001_ha->memoryMap.region[CI+i].alignment = 4;
|
|
|
|
|
|
|
|
if ((ent->driver_data) != chip_8001) {
|
|
|
|
/* MPI Memory region 5 inbound queues */
|
|
|
|
pm8001_ha->memoryMap.region[IB+i].num_elements =
|
|
|
|
PM8001_MPI_QUEUE;
|
|
|
|
pm8001_ha->memoryMap.region[IB+i].element_size = 128;
|
|
|
|
pm8001_ha->memoryMap.region[IB+i].total_len =
|
|
|
|
PM8001_MPI_QUEUE * 128;
|
|
|
|
pm8001_ha->memoryMap.region[IB+i].alignment = 128;
|
|
|
|
} else {
|
|
|
|
pm8001_ha->memoryMap.region[IB+i].num_elements =
|
|
|
|
PM8001_MPI_QUEUE;
|
|
|
|
pm8001_ha->memoryMap.region[IB+i].element_size = 64;
|
|
|
|
pm8001_ha->memoryMap.region[IB+i].total_len =
|
|
|
|
PM8001_MPI_QUEUE * 64;
|
|
|
|
pm8001_ha->memoryMap.region[IB+i].alignment = 64;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < PM8001_MAX_SPCV_OUTB_NUM; i++) {
|
|
|
|
/* MPI Memory region 4 for producer Index of outbound queues */
|
|
|
|
pm8001_ha->memoryMap.region[PI+i].num_elements = 1;
|
|
|
|
pm8001_ha->memoryMap.region[PI+i].element_size = 4;
|
|
|
|
pm8001_ha->memoryMap.region[PI+i].total_len = 4;
|
|
|
|
pm8001_ha->memoryMap.region[PI+i].alignment = 4;
|
|
|
|
|
|
|
|
if (ent->driver_data != chip_8001) {
|
|
|
|
/* MPI Memory region 6 Outbound queues */
|
|
|
|
pm8001_ha->memoryMap.region[OB+i].num_elements =
|
|
|
|
PM8001_MPI_QUEUE;
|
|
|
|
pm8001_ha->memoryMap.region[OB+i].element_size = 128;
|
|
|
|
pm8001_ha->memoryMap.region[OB+i].total_len =
|
|
|
|
PM8001_MPI_QUEUE * 128;
|
|
|
|
pm8001_ha->memoryMap.region[OB+i].alignment = 128;
|
|
|
|
} else {
|
|
|
|
/* MPI Memory region 6 Outbound queues */
|
|
|
|
pm8001_ha->memoryMap.region[OB+i].num_elements =
|
|
|
|
PM8001_MPI_QUEUE;
|
|
|
|
pm8001_ha->memoryMap.region[OB+i].element_size = 64;
|
|
|
|
pm8001_ha->memoryMap.region[OB+i].total_len =
|
|
|
|
PM8001_MPI_QUEUE * 64;
|
|
|
|
pm8001_ha->memoryMap.region[OB+i].alignment = 64;
|
|
|
|
}
|
2009-10-14 15:19:21 +07:00
|
|
|
|
2013-02-27 21:55:25 +07:00
|
|
|
}
|
2009-10-14 15:19:21 +07:00
|
|
|
/* Memory region write DMA*/
|
|
|
|
pm8001_ha->memoryMap.region[NVMD].num_elements = 1;
|
|
|
|
pm8001_ha->memoryMap.region[NVMD].element_size = 4096;
|
|
|
|
pm8001_ha->memoryMap.region[NVMD].total_len = 4096;
|
|
|
|
/* Memory region for devices*/
|
|
|
|
pm8001_ha->memoryMap.region[DEV_MEM].num_elements = 1;
|
|
|
|
pm8001_ha->memoryMap.region[DEV_MEM].element_size = PM8001_MAX_DEVICES *
|
|
|
|
sizeof(struct pm8001_device);
|
|
|
|
pm8001_ha->memoryMap.region[DEV_MEM].total_len = PM8001_MAX_DEVICES *
|
|
|
|
sizeof(struct pm8001_device);
|
|
|
|
|
|
|
|
/* Memory region for ccb_info*/
|
|
|
|
pm8001_ha->memoryMap.region[CCB_MEM].num_elements = 1;
|
|
|
|
pm8001_ha->memoryMap.region[CCB_MEM].element_size = PM8001_MAX_CCB *
|
|
|
|
sizeof(struct pm8001_ccb_info);
|
|
|
|
pm8001_ha->memoryMap.region[CCB_MEM].total_len = PM8001_MAX_CCB *
|
|
|
|
sizeof(struct pm8001_ccb_info);
|
|
|
|
|
2013-03-19 19:36:40 +07:00
|
|
|
/* Memory region for fw flash */
|
|
|
|
pm8001_ha->memoryMap.region[FW_FLASH].total_len = 4096;
|
|
|
|
|
2013-09-04 14:27:00 +07:00
|
|
|
pm8001_ha->memoryMap.region[FORENSIC_MEM].num_elements = 1;
|
|
|
|
pm8001_ha->memoryMap.region[FORENSIC_MEM].total_len = 0x10000;
|
|
|
|
pm8001_ha->memoryMap.region[FORENSIC_MEM].element_size = 0x10000;
|
|
|
|
pm8001_ha->memoryMap.region[FORENSIC_MEM].alignment = 0x10000;
|
2009-10-14 15:19:21 +07:00
|
|
|
for (i = 0; i < USI_MAX_MEMCNT; i++) {
|
|
|
|
if (pm8001_mem_alloc(pm8001_ha->pdev,
|
|
|
|
&pm8001_ha->memoryMap.region[i].virt_ptr,
|
|
|
|
&pm8001_ha->memoryMap.region[i].phys_addr,
|
|
|
|
&pm8001_ha->memoryMap.region[i].phys_addr_hi,
|
|
|
|
&pm8001_ha->memoryMap.region[i].phys_addr_lo,
|
|
|
|
pm8001_ha->memoryMap.region[i].total_len,
|
|
|
|
pm8001_ha->memoryMap.region[i].alignment) != 0) {
|
|
|
|
PM8001_FAIL_DBG(pm8001_ha,
|
|
|
|
pm8001_printk("Mem%d alloc failed\n",
|
|
|
|
i));
|
|
|
|
goto err_out;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pm8001_ha->devices = pm8001_ha->memoryMap.region[DEV_MEM].virt_ptr;
|
|
|
|
for (i = 0; i < PM8001_MAX_DEVICES; i++) {
|
2013-05-08 04:44:06 +07:00
|
|
|
pm8001_ha->devices[i].dev_type = SAS_PHY_UNUSED;
|
2009-10-14 15:19:21 +07:00
|
|
|
pm8001_ha->devices[i].id = i;
|
|
|
|
pm8001_ha->devices[i].device_id = PM8001_MAX_DEVICES;
|
|
|
|
pm8001_ha->devices[i].running_req = 0;
|
|
|
|
}
|
|
|
|
pm8001_ha->ccb_info = pm8001_ha->memoryMap.region[CCB_MEM].virt_ptr;
|
|
|
|
for (i = 0; i < PM8001_MAX_CCB; i++) {
|
|
|
|
pm8001_ha->ccb_info[i].ccb_dma_handle =
|
|
|
|
pm8001_ha->memoryMap.region[CCB_MEM].phys_addr +
|
|
|
|
i * sizeof(struct pm8001_ccb_info);
|
2009-11-05 21:33:51 +07:00
|
|
|
pm8001_ha->ccb_info[i].task = NULL;
|
|
|
|
pm8001_ha->ccb_info[i].ccb_tag = 0xffffffff;
|
|
|
|
pm8001_ha->ccb_info[i].device = NULL;
|
2009-10-14 15:19:21 +07:00
|
|
|
++pm8001_ha->tags_num;
|
|
|
|
}
|
|
|
|
pm8001_ha->flags = PM8001F_INIT_TIME;
|
|
|
|
/* Initialize tags */
|
|
|
|
pm8001_tag_init(pm8001_ha);
|
|
|
|
return 0;
|
|
|
|
err_out:
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* pm8001_ioremap - remap the pci high physical address to kernal virtual
|
|
|
|
* address so that we can access them.
|
|
|
|
* @pm8001_ha:our hba structure.
|
|
|
|
*/
|
|
|
|
static int pm8001_ioremap(struct pm8001_hba_info *pm8001_ha)
|
|
|
|
{
|
|
|
|
u32 bar;
|
|
|
|
u32 logicalBar = 0;
|
|
|
|
struct pci_dev *pdev;
|
|
|
|
|
|
|
|
pdev = pm8001_ha->pdev;
|
|
|
|
/* map pci mem (PMC pci base 0-3)*/
|
|
|
|
for (bar = 0; bar < 6; bar++) {
|
|
|
|
/*
|
|
|
|
** logical BARs for SPC:
|
|
|
|
** bar 0 and 1 - logical BAR0
|
|
|
|
** bar 2 and 3 - logical BAR1
|
|
|
|
** bar4 - logical BAR2
|
|
|
|
** bar5 - logical BAR3
|
|
|
|
** Skip the appropriate assignments:
|
|
|
|
*/
|
|
|
|
if ((bar == 1) || (bar == 3))
|
|
|
|
continue;
|
|
|
|
if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
|
|
|
|
pm8001_ha->io_mem[logicalBar].membase =
|
|
|
|
pci_resource_start(pdev, bar);
|
|
|
|
pm8001_ha->io_mem[logicalBar].memsize =
|
|
|
|
pci_resource_len(pdev, bar);
|
|
|
|
pm8001_ha->io_mem[logicalBar].memvirtaddr =
|
|
|
|
ioremap(pm8001_ha->io_mem[logicalBar].membase,
|
|
|
|
pm8001_ha->io_mem[logicalBar].memsize);
|
|
|
|
PM8001_INIT_DBG(pm8001_ha,
|
2013-02-27 21:55:25 +07:00
|
|
|
pm8001_printk("PCI: bar %d, logicalBar %d ",
|
|
|
|
bar, logicalBar));
|
|
|
|
PM8001_INIT_DBG(pm8001_ha, pm8001_printk(
|
|
|
|
"base addr %llx virt_addr=%llx len=%d\n",
|
|
|
|
(u64)pm8001_ha->io_mem[logicalBar].membase,
|
2013-08-05 15:46:52 +07:00
|
|
|
(u64)(unsigned long)
|
|
|
|
pm8001_ha->io_mem[logicalBar].memvirtaddr,
|
2009-10-14 15:19:21 +07:00
|
|
|
pm8001_ha->io_mem[logicalBar].memsize));
|
|
|
|
} else {
|
|
|
|
pm8001_ha->io_mem[logicalBar].membase = 0;
|
|
|
|
pm8001_ha->io_mem[logicalBar].memsize = 0;
|
|
|
|
pm8001_ha->io_mem[logicalBar].memvirtaddr = 0;
|
|
|
|
}
|
|
|
|
logicalBar++;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* pm8001_pci_alloc - initialize our ha card structure
|
|
|
|
* @pdev: pci device.
|
|
|
|
* @ent: ent
|
|
|
|
* @shost: scsi host struct which has been initialized before.
|
|
|
|
*/
|
2012-12-22 04:08:55 +07:00
|
|
|
static struct pm8001_hba_info *pm8001_pci_alloc(struct pci_dev *pdev,
|
2013-02-27 21:55:25 +07:00
|
|
|
const struct pci_device_id *ent,
|
|
|
|
struct Scsi_Host *shost)
|
|
|
|
|
2009-10-14 15:19:21 +07:00
|
|
|
{
|
|
|
|
struct pm8001_hba_info *pm8001_ha;
|
|
|
|
struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
|
2013-11-11 16:58:14 +07:00
|
|
|
int j;
|
2009-10-14 15:19:21 +07:00
|
|
|
|
|
|
|
pm8001_ha = sha->lldd_ha;
|
|
|
|
if (!pm8001_ha)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
pm8001_ha->pdev = pdev;
|
|
|
|
pm8001_ha->dev = &pdev->dev;
|
2013-02-27 21:55:25 +07:00
|
|
|
pm8001_ha->chip_id = ent->driver_data;
|
2009-10-14 15:19:21 +07:00
|
|
|
pm8001_ha->chip = &pm8001_chips[pm8001_ha->chip_id];
|
|
|
|
pm8001_ha->irq = pdev->irq;
|
|
|
|
pm8001_ha->sas = sha;
|
|
|
|
pm8001_ha->shost = shost;
|
|
|
|
pm8001_ha->id = pm8001_id++;
|
|
|
|
pm8001_ha->logging_level = 0x01;
|
|
|
|
sprintf(pm8001_ha->name, "%s%d", DRV_NAME, pm8001_ha->id);
|
2013-02-27 21:57:43 +07:00
|
|
|
/* IOMB size is 128 for 8088/89 controllers */
|
|
|
|
if (pm8001_ha->chip_id != chip_8001)
|
|
|
|
pm8001_ha->iomb_size = IOMB_SIZE_SPCV;
|
|
|
|
else
|
|
|
|
pm8001_ha->iomb_size = IOMB_SIZE_SPC;
|
|
|
|
|
2009-10-14 15:19:21 +07:00
|
|
|
#ifdef PM8001_USE_TASKLET
|
2013-11-11 16:58:14 +07:00
|
|
|
/* Tasklet for non msi-x interrupt handler */
|
2015-10-30 21:53:31 +07:00
|
|
|
if ((!pdev->msix_cap || !pci_msi_enabled())
|
|
|
|
|| (pm8001_ha->chip_id == chip_8001))
|
2013-11-11 16:58:14 +07:00
|
|
|
tasklet_init(&pm8001_ha->tasklet[0], pm8001_tasklet,
|
|
|
|
(unsigned long)&(pm8001_ha->irq_vector[0]));
|
|
|
|
else
|
|
|
|
for (j = 0; j < PM8001_MAX_MSIX_VEC; j++)
|
|
|
|
tasklet_init(&pm8001_ha->tasklet[j], pm8001_tasklet,
|
|
|
|
(unsigned long)&(pm8001_ha->irq_vector[j]));
|
2009-10-14 15:19:21 +07:00
|
|
|
#endif
|
|
|
|
pm8001_ioremap(pm8001_ha);
|
2013-02-27 21:55:25 +07:00
|
|
|
if (!pm8001_alloc(pm8001_ha, ent))
|
2009-10-14 15:19:21 +07:00
|
|
|
return pm8001_ha;
|
|
|
|
pm8001_free(pm8001_ha);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* pci_go_44 - pm8001 specified, its DMA is 44 bit rather than 64 bit
|
|
|
|
* @pdev: pci device.
|
|
|
|
*/
|
|
|
|
static int pci_go_44(struct pci_dev *pdev)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
2018-10-11 00:59:50 +07:00
|
|
|
rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(44));
|
|
|
|
if (rc) {
|
|
|
|
rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
|
|
|
|
if (rc)
|
2009-10-14 15:19:21 +07:00
|
|
|
dev_printk(KERN_ERR, &pdev->dev,
|
|
|
|
"32-bit DMA enable failed\n");
|
|
|
|
}
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* pm8001_prep_sas_ha_init - allocate memory in general hba struct && init them.
|
|
|
|
* @shost: scsi host which has been allocated outside.
|
|
|
|
* @chip_info: our ha struct.
|
|
|
|
*/
|
2012-12-22 04:08:55 +07:00
|
|
|
static int pm8001_prep_sas_ha_init(struct Scsi_Host *shost,
|
|
|
|
const struct pm8001_chip_info *chip_info)
|
2009-10-14 15:19:21 +07:00
|
|
|
{
|
|
|
|
int phy_nr, port_nr;
|
|
|
|
struct asd_sas_phy **arr_phy;
|
|
|
|
struct asd_sas_port **arr_port;
|
|
|
|
struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
|
|
|
|
|
|
|
|
phy_nr = chip_info->n_phy;
|
|
|
|
port_nr = phy_nr;
|
|
|
|
memset(sha, 0x00, sizeof(*sha));
|
|
|
|
arr_phy = kcalloc(phy_nr, sizeof(void *), GFP_KERNEL);
|
|
|
|
if (!arr_phy)
|
|
|
|
goto exit;
|
|
|
|
arr_port = kcalloc(port_nr, sizeof(void *), GFP_KERNEL);
|
|
|
|
if (!arr_port)
|
|
|
|
goto exit_free2;
|
|
|
|
|
|
|
|
sha->sas_phy = arr_phy;
|
|
|
|
sha->sas_port = arr_port;
|
|
|
|
sha->lldd_ha = kzalloc(sizeof(struct pm8001_hba_info), GFP_KERNEL);
|
|
|
|
if (!sha->lldd_ha)
|
|
|
|
goto exit_free1;
|
|
|
|
|
|
|
|
shost->transportt = pm8001_stt;
|
|
|
|
shost->max_id = PM8001_MAX_DEVICES;
|
|
|
|
shost->max_lun = 8;
|
|
|
|
shost->max_channel = 0;
|
|
|
|
shost->unique_id = pm8001_id;
|
|
|
|
shost->max_cmd_len = 16;
|
|
|
|
shost->can_queue = PM8001_CAN_QUEUE;
|
|
|
|
shost->cmd_per_lun = 32;
|
|
|
|
return 0;
|
|
|
|
exit_free1:
|
|
|
|
kfree(arr_port);
|
|
|
|
exit_free2:
|
|
|
|
kfree(arr_phy);
|
|
|
|
exit:
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* pm8001_post_sas_ha_init - initialize general hba struct defined in libsas
|
|
|
|
* @shost: scsi host which has been allocated outside
|
|
|
|
* @chip_info: our ha struct.
|
|
|
|
*/
|
2012-12-22 04:08:55 +07:00
|
|
|
static void pm8001_post_sas_ha_init(struct Scsi_Host *shost,
|
|
|
|
const struct pm8001_chip_info *chip_info)
|
2009-10-14 15:19:21 +07:00
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
struct pm8001_hba_info *pm8001_ha;
|
|
|
|
struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
|
|
|
|
|
|
|
|
pm8001_ha = sha->lldd_ha;
|
|
|
|
for (i = 0; i < chip_info->n_phy; i++) {
|
|
|
|
sha->sas_phy[i] = &pm8001_ha->phy[i].sas_phy;
|
|
|
|
sha->sas_port[i] = &pm8001_ha->port[i].sas_port;
|
2017-10-18 13:09:09 +07:00
|
|
|
sha->sas_phy[i]->sas_addr =
|
|
|
|
(u8 *)&pm8001_ha->phy[i].dev_sas_addr;
|
2009-10-14 15:19:21 +07:00
|
|
|
}
|
|
|
|
sha->sas_ha_name = DRV_NAME;
|
|
|
|
sha->dev = pm8001_ha->dev;
|
2017-10-18 13:09:09 +07:00
|
|
|
sha->strict_wide_ports = 1;
|
2009-10-14 15:19:21 +07:00
|
|
|
sha->lldd_module = THIS_MODULE;
|
|
|
|
sha->sas_addr = &pm8001_ha->sas_addr[0];
|
|
|
|
sha->num_phys = chip_info->n_phy;
|
|
|
|
sha->core.shost = shost;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* pm8001_init_sas_add - initialize sas address
|
|
|
|
* @chip_info: our ha struct.
|
|
|
|
*
|
|
|
|
* Currently we just set the fixed SAS address to our HBA,for manufacture,
|
|
|
|
* it should read from the EEPROM
|
|
|
|
*/
|
|
|
|
static void pm8001_init_sas_add(struct pm8001_hba_info *pm8001_ha)
|
|
|
|
{
|
2013-03-19 19:37:35 +07:00
|
|
|
u8 i, j;
|
2017-10-18 13:09:09 +07:00
|
|
|
u8 sas_add[8];
|
2009-10-14 15:19:21 +07:00
|
|
|
#ifdef PM8001_READ_VPD
|
2013-03-19 19:37:35 +07:00
|
|
|
/* For new SPC controllers WWN is stored in flash vpd
|
|
|
|
* For SPC/SPCve controllers WWN is stored in EEPROM
|
|
|
|
* For Older SPC WWN is stored in NVMD
|
|
|
|
*/
|
2009-10-14 15:19:21 +07:00
|
|
|
DECLARE_COMPLETION_ONSTACK(completion);
|
2009-12-07 16:23:08 +07:00
|
|
|
struct pm8001_ioctl_payload payload;
|
2013-03-19 19:37:35 +07:00
|
|
|
u16 deviceid;
|
2014-07-09 18:51:11 +07:00
|
|
|
int rc;
|
|
|
|
|
2013-03-19 19:37:35 +07:00
|
|
|
pci_read_config_word(pm8001_ha->pdev, PCI_DEVICE_ID, &deviceid);
|
2009-10-14 15:19:21 +07:00
|
|
|
pm8001_ha->nvmd_completion = &completion;
|
2013-03-19 19:37:35 +07:00
|
|
|
|
|
|
|
if (pm8001_ha->chip_id == chip_8001) {
|
2013-12-19 22:50:56 +07:00
|
|
|
if (deviceid == 0x8081 || deviceid == 0x0042) {
|
2013-03-19 19:37:35 +07:00
|
|
|
payload.minor_function = 4;
|
|
|
|
payload.length = 4096;
|
|
|
|
} else {
|
|
|
|
payload.minor_function = 0;
|
|
|
|
payload.length = 128;
|
|
|
|
}
|
2015-11-03 03:39:23 +07:00
|
|
|
} else if ((pm8001_ha->chip_id == chip_8070 ||
|
|
|
|
pm8001_ha->chip_id == chip_8072) &&
|
|
|
|
pm8001_ha->pdev->subsystem_vendor == PCI_VENDOR_ID_ATTO) {
|
|
|
|
payload.minor_function = 4;
|
|
|
|
payload.length = 4096;
|
2013-03-19 19:37:35 +07:00
|
|
|
} else {
|
|
|
|
payload.minor_function = 1;
|
|
|
|
payload.length = 4096;
|
|
|
|
}
|
|
|
|
payload.offset = 0;
|
|
|
|
payload.func_specific = kzalloc(payload.length, GFP_KERNEL);
|
2014-07-09 18:51:11 +07:00
|
|
|
if (!payload.func_specific) {
|
|
|
|
PM8001_INIT_DBG(pm8001_ha, pm8001_printk("mem alloc fail\n"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
rc = PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload);
|
|
|
|
if (rc) {
|
|
|
|
kfree(payload.func_specific);
|
|
|
|
PM8001_INIT_DBG(pm8001_ha, pm8001_printk("nvmd failed\n"));
|
|
|
|
return;
|
|
|
|
}
|
2009-10-14 15:19:21 +07:00
|
|
|
wait_for_completion(&completion);
|
2013-03-19 19:37:35 +07:00
|
|
|
|
|
|
|
for (i = 0, j = 0; i <= 7; i++, j++) {
|
|
|
|
if (pm8001_ha->chip_id == chip_8001) {
|
|
|
|
if (deviceid == 0x8081)
|
|
|
|
pm8001_ha->sas_addr[j] =
|
|
|
|
payload.func_specific[0x704 + i];
|
2013-12-19 22:50:56 +07:00
|
|
|
else if (deviceid == 0x0042)
|
|
|
|
pm8001_ha->sas_addr[j] =
|
|
|
|
payload.func_specific[0x010 + i];
|
2015-11-03 03:39:23 +07:00
|
|
|
} else if ((pm8001_ha->chip_id == chip_8070 ||
|
|
|
|
pm8001_ha->chip_id == chip_8072) &&
|
|
|
|
pm8001_ha->pdev->subsystem_vendor == PCI_VENDOR_ID_ATTO) {
|
|
|
|
pm8001_ha->sas_addr[j] =
|
|
|
|
payload.func_specific[0x010 + i];
|
2013-03-19 19:37:35 +07:00
|
|
|
} else
|
|
|
|
pm8001_ha->sas_addr[j] =
|
|
|
|
payload.func_specific[0x804 + i];
|
|
|
|
}
|
2017-10-18 13:09:09 +07:00
|
|
|
memcpy(sas_add, pm8001_ha->sas_addr, SAS_ADDR_SIZE);
|
2009-10-14 15:19:21 +07:00
|
|
|
for (i = 0; i < pm8001_ha->chip->n_phy; i++) {
|
2017-10-18 13:09:09 +07:00
|
|
|
if (i && ((i % 4) == 0))
|
|
|
|
sas_add[7] = sas_add[7] + 4;
|
2013-03-19 19:37:35 +07:00
|
|
|
memcpy(&pm8001_ha->phy[i].dev_sas_addr,
|
2017-10-18 13:09:09 +07:00
|
|
|
sas_add, SAS_ADDR_SIZE);
|
2009-10-14 15:19:21 +07:00
|
|
|
PM8001_INIT_DBG(pm8001_ha,
|
2013-03-19 19:37:35 +07:00
|
|
|
pm8001_printk("phy %d sas_addr = %016llx\n", i,
|
2009-12-07 16:23:08 +07:00
|
|
|
pm8001_ha->phy[i].dev_sas_addr));
|
2009-10-14 15:19:21 +07:00
|
|
|
}
|
2014-07-09 18:51:11 +07:00
|
|
|
kfree(payload.func_specific);
|
2009-10-14 15:19:21 +07:00
|
|
|
#else
|
|
|
|
for (i = 0; i < pm8001_ha->chip->n_phy; i++) {
|
2009-12-07 16:23:08 +07:00
|
|
|
pm8001_ha->phy[i].dev_sas_addr = 0x50010c600047f9d0ULL;
|
2009-10-14 15:19:21 +07:00
|
|
|
pm8001_ha->phy[i].dev_sas_addr =
|
|
|
|
cpu_to_be64((u64)
|
|
|
|
(*(u64 *)&pm8001_ha->phy[i].dev_sas_addr));
|
|
|
|
}
|
|
|
|
memcpy(pm8001_ha->sas_addr, &pm8001_ha->phy[0].dev_sas_addr,
|
|
|
|
SAS_ADDR_SIZE);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-09-18 14:32:44 +07:00
|
|
|
/*
|
|
|
|
* pm8001_get_phy_settings_info : Read phy setting values.
|
|
|
|
* @pm8001_ha : our hba.
|
|
|
|
*/
|
2014-06-17 18:15:40 +07:00
|
|
|
static int pm8001_get_phy_settings_info(struct pm8001_hba_info *pm8001_ha)
|
2013-09-18 14:32:44 +07:00
|
|
|
{
|
|
|
|
|
|
|
|
#ifdef PM8001_READ_VPD
|
|
|
|
/*OPTION ROM FLASH read for the SPC cards */
|
|
|
|
DECLARE_COMPLETION_ONSTACK(completion);
|
|
|
|
struct pm8001_ioctl_payload payload;
|
2014-07-09 18:51:11 +07:00
|
|
|
int rc;
|
2013-09-18 14:32:44 +07:00
|
|
|
|
|
|
|
pm8001_ha->nvmd_completion = &completion;
|
|
|
|
/* SAS ADDRESS read from flash / EEPROM */
|
|
|
|
payload.minor_function = 6;
|
|
|
|
payload.offset = 0;
|
|
|
|
payload.length = 4096;
|
|
|
|
payload.func_specific = kzalloc(4096, GFP_KERNEL);
|
2014-06-17 18:15:40 +07:00
|
|
|
if (!payload.func_specific)
|
|
|
|
return -ENOMEM;
|
2013-09-18 14:32:44 +07:00
|
|
|
/* Read phy setting values from flash */
|
2014-07-09 18:51:11 +07:00
|
|
|
rc = PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload);
|
|
|
|
if (rc) {
|
|
|
|
kfree(payload.func_specific);
|
|
|
|
PM8001_INIT_DBG(pm8001_ha, pm8001_printk("nvmd failed\n"));
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
2013-09-18 14:32:44 +07:00
|
|
|
wait_for_completion(&completion);
|
|
|
|
pm8001_set_phy_profile(pm8001_ha, sizeof(u8), payload.func_specific);
|
2014-06-17 18:15:40 +07:00
|
|
|
kfree(payload.func_specific);
|
2013-09-18 14:32:44 +07:00
|
|
|
#endif
|
2014-06-17 18:15:40 +07:00
|
|
|
return 0;
|
2013-09-18 14:32:44 +07:00
|
|
|
}
|
|
|
|
|
2015-10-30 21:53:28 +07:00
|
|
|
struct pm8001_mpi3_phy_pg_trx_config {
|
|
|
|
u32 LaneLosCfg;
|
|
|
|
u32 LanePgaCfg1;
|
|
|
|
u32 LanePisoCfg1;
|
|
|
|
u32 LanePisoCfg2;
|
|
|
|
u32 LanePisoCfg3;
|
|
|
|
u32 LanePisoCfg4;
|
|
|
|
u32 LanePisoCfg5;
|
|
|
|
u32 LanePisoCfg6;
|
|
|
|
u32 LaneBctCtrl;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* pm8001_get_internal_phy_settings : Retrieves the internal PHY settings
|
|
|
|
* @pm8001_ha : our adapter
|
|
|
|
* @phycfg : PHY config page to populate
|
|
|
|
*/
|
|
|
|
static
|
|
|
|
void pm8001_get_internal_phy_settings(struct pm8001_hba_info *pm8001_ha,
|
|
|
|
struct pm8001_mpi3_phy_pg_trx_config *phycfg)
|
|
|
|
{
|
|
|
|
phycfg->LaneLosCfg = 0x00000132;
|
|
|
|
phycfg->LanePgaCfg1 = 0x00203949;
|
|
|
|
phycfg->LanePisoCfg1 = 0x000000FF;
|
|
|
|
phycfg->LanePisoCfg2 = 0xFF000001;
|
|
|
|
phycfg->LanePisoCfg3 = 0xE7011300;
|
|
|
|
phycfg->LanePisoCfg4 = 0x631C40C0;
|
|
|
|
phycfg->LanePisoCfg5 = 0xF8102036;
|
|
|
|
phycfg->LanePisoCfg6 = 0xF74A1000;
|
|
|
|
phycfg->LaneBctCtrl = 0x00FB33F8;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* pm8001_get_external_phy_settings : Retrieves the external PHY settings
|
|
|
|
* @pm8001_ha : our adapter
|
|
|
|
* @phycfg : PHY config page to populate
|
|
|
|
*/
|
|
|
|
static
|
|
|
|
void pm8001_get_external_phy_settings(struct pm8001_hba_info *pm8001_ha,
|
|
|
|
struct pm8001_mpi3_phy_pg_trx_config *phycfg)
|
|
|
|
{
|
|
|
|
phycfg->LaneLosCfg = 0x00000132;
|
|
|
|
phycfg->LanePgaCfg1 = 0x00203949;
|
|
|
|
phycfg->LanePisoCfg1 = 0x000000FF;
|
|
|
|
phycfg->LanePisoCfg2 = 0xFF000001;
|
|
|
|
phycfg->LanePisoCfg3 = 0xE7011300;
|
|
|
|
phycfg->LanePisoCfg4 = 0x63349140;
|
|
|
|
phycfg->LanePisoCfg5 = 0xF8102036;
|
|
|
|
phycfg->LanePisoCfg6 = 0xF80D9300;
|
|
|
|
phycfg->LaneBctCtrl = 0x00FB33F8;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* pm8001_get_phy_mask : Retrieves the mask that denotes if a PHY is int/ext
|
|
|
|
* @pm8001_ha : our adapter
|
|
|
|
* @phymask : The PHY mask
|
|
|
|
*/
|
|
|
|
static
|
|
|
|
void pm8001_get_phy_mask(struct pm8001_hba_info *pm8001_ha, int *phymask)
|
|
|
|
{
|
|
|
|
switch (pm8001_ha->pdev->subsystem_device) {
|
|
|
|
case 0x0070: /* H1280 - 8 external 0 internal */
|
|
|
|
case 0x0072: /* H12F0 - 16 external 0 internal */
|
|
|
|
*phymask = 0x0000;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x0071: /* H1208 - 0 external 8 internal */
|
|
|
|
case 0x0073: /* H120F - 0 external 16 internal */
|
|
|
|
*phymask = 0xFFFF;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x0080: /* H1244 - 4 external 4 internal */
|
|
|
|
*phymask = 0x00F0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x0081: /* H1248 - 4 external 8 internal */
|
|
|
|
*phymask = 0x0FF0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x0082: /* H1288 - 8 external 8 internal */
|
|
|
|
*phymask = 0xFF00;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
PM8001_INIT_DBG(pm8001_ha,
|
|
|
|
pm8001_printk("Unknown subsystem device=0x%.04x",
|
|
|
|
pm8001_ha->pdev->subsystem_device));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* pm8001_set_phy_settings_ven_117c_12Gb : Configure ATTO 12Gb PHY settings
|
|
|
|
* @pm8001_ha : our adapter
|
|
|
|
*/
|
|
|
|
static
|
|
|
|
int pm8001_set_phy_settings_ven_117c_12G(struct pm8001_hba_info *pm8001_ha)
|
|
|
|
{
|
|
|
|
struct pm8001_mpi3_phy_pg_trx_config phycfg_int;
|
|
|
|
struct pm8001_mpi3_phy_pg_trx_config phycfg_ext;
|
|
|
|
int phymask = 0;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
memset(&phycfg_int, 0, sizeof(phycfg_int));
|
|
|
|
memset(&phycfg_ext, 0, sizeof(phycfg_ext));
|
|
|
|
|
|
|
|
pm8001_get_internal_phy_settings(pm8001_ha, &phycfg_int);
|
|
|
|
pm8001_get_external_phy_settings(pm8001_ha, &phycfg_ext);
|
|
|
|
pm8001_get_phy_mask(pm8001_ha, &phymask);
|
|
|
|
|
|
|
|
for (i = 0; i < pm8001_ha->chip->n_phy; i++) {
|
|
|
|
if (phymask & (1 << i)) {/* Internal PHY */
|
|
|
|
pm8001_set_phy_profile_single(pm8001_ha, i,
|
|
|
|
sizeof(phycfg_int) / sizeof(u32),
|
|
|
|
(u32 *)&phycfg_int);
|
|
|
|
|
|
|
|
} else { /* External PHY */
|
|
|
|
pm8001_set_phy_profile_single(pm8001_ha, i,
|
|
|
|
sizeof(phycfg_ext) / sizeof(u32),
|
|
|
|
(u32 *)&phycfg_ext);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-10-30 21:53:24 +07:00
|
|
|
/**
|
|
|
|
* pm8001_configure_phy_settings : Configures PHY settings based on vendor ID.
|
|
|
|
* @pm8001_ha : our hba.
|
|
|
|
*/
|
|
|
|
static int pm8001_configure_phy_settings(struct pm8001_hba_info *pm8001_ha)
|
|
|
|
{
|
|
|
|
switch (pm8001_ha->pdev->subsystem_vendor) {
|
|
|
|
case PCI_VENDOR_ID_ATTO:
|
2015-10-30 21:53:28 +07:00
|
|
|
if (pm8001_ha->pdev->device == 0x0042) /* 6Gb */
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return pm8001_set_phy_settings_ven_117c_12G(pm8001_ha);
|
|
|
|
|
2015-10-30 21:53:24 +07:00
|
|
|
case PCI_VENDOR_ID_ADAPTEC2:
|
|
|
|
case 0:
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return pm8001_get_phy_settings_info(pm8001_ha);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-14 15:19:21 +07:00
|
|
|
#ifdef PM8001_USE_MSIX
|
|
|
|
/**
|
|
|
|
* pm8001_setup_msix - enable MSI-X interrupt
|
|
|
|
* @chip_info: our ha struct.
|
|
|
|
* @irq_handler: irq_handler
|
|
|
|
*/
|
2013-03-19 19:26:17 +07:00
|
|
|
static u32 pm8001_setup_msix(struct pm8001_hba_info *pm8001_ha)
|
2009-10-14 15:19:21 +07:00
|
|
|
{
|
|
|
|
u32 i = 0, j = 0;
|
2013-03-19 19:26:17 +07:00
|
|
|
u32 number_of_intr;
|
2009-10-14 15:19:21 +07:00
|
|
|
int flag = 0;
|
|
|
|
int rc;
|
2013-03-19 19:26:17 +07:00
|
|
|
static char intr_drvname[PM8001_MAX_MSIX_VEC][sizeof(DRV_NAME)+3];
|
|
|
|
|
|
|
|
/* SPCv controllers supports 64 msi-x */
|
|
|
|
if (pm8001_ha->chip_id == chip_8001) {
|
|
|
|
number_of_intr = 1;
|
|
|
|
} else {
|
|
|
|
number_of_intr = PM8001_MAX_MSIX_VEC;
|
|
|
|
flag &= ~IRQF_SHARED;
|
|
|
|
}
|
|
|
|
|
2017-02-01 21:11:07 +07:00
|
|
|
rc = pci_alloc_irq_vectors(pm8001_ha->pdev, number_of_intr,
|
|
|
|
number_of_intr, PCI_IRQ_MSIX);
|
|
|
|
if (rc < 0)
|
2014-07-17 01:05:22 +07:00
|
|
|
return rc;
|
2017-02-01 21:11:07 +07:00
|
|
|
pm8001_ha->number_of_intr = number_of_intr;
|
2014-07-17 01:05:22 +07:00
|
|
|
|
|
|
|
PM8001_INIT_DBG(pm8001_ha, pm8001_printk(
|
2017-02-01 21:11:07 +07:00
|
|
|
"pci_alloc_irq_vectors request ret:%d no of intr %d\n",
|
2014-07-17 01:05:22 +07:00
|
|
|
rc, pm8001_ha->number_of_intr));
|
|
|
|
|
|
|
|
for (i = 0; i < number_of_intr; i++) {
|
|
|
|
snprintf(intr_drvname[i], sizeof(intr_drvname[0]),
|
|
|
|
DRV_NAME"%d", i);
|
|
|
|
pm8001_ha->irq_vector[i].irq_id = i;
|
|
|
|
pm8001_ha->irq_vector[i].drv_inst = pm8001_ha;
|
|
|
|
|
2017-02-01 21:11:07 +07:00
|
|
|
rc = request_irq(pci_irq_vector(pm8001_ha->pdev, i),
|
2014-07-17 01:05:22 +07:00
|
|
|
pm8001_interrupt_handler_msix, flag,
|
|
|
|
intr_drvname[i], &(pm8001_ha->irq_vector[i]));
|
|
|
|
if (rc) {
|
|
|
|
for (j = 0; j < i; j++) {
|
2017-02-01 21:11:07 +07:00
|
|
|
free_irq(pci_irq_vector(pm8001_ha->pdev, i),
|
2013-11-11 16:58:14 +07:00
|
|
|
&(pm8001_ha->irq_vector[i]));
|
2009-10-14 15:19:21 +07:00
|
|
|
}
|
2017-02-01 21:11:07 +07:00
|
|
|
pci_free_irq_vectors(pm8001_ha->pdev);
|
2014-07-17 01:05:22 +07:00
|
|
|
break;
|
2009-10-14 15:19:21 +07:00
|
|
|
}
|
|
|
|
}
|
2014-07-17 01:05:22 +07:00
|
|
|
|
2009-10-14 15:19:21 +07:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* pm8001_request_irq - register interrupt
|
|
|
|
* @chip_info: our ha struct.
|
|
|
|
*/
|
|
|
|
static u32 pm8001_request_irq(struct pm8001_hba_info *pm8001_ha)
|
|
|
|
{
|
|
|
|
struct pci_dev *pdev;
|
2009-11-05 21:33:51 +07:00
|
|
|
int rc;
|
2009-10-14 15:19:21 +07:00
|
|
|
|
|
|
|
pdev = pm8001_ha->pdev;
|
|
|
|
|
|
|
|
#ifdef PM8001_USE_MSIX
|
2015-10-30 21:53:31 +07:00
|
|
|
if (pdev->msix_cap && pci_msi_enabled())
|
2013-03-19 19:26:17 +07:00
|
|
|
return pm8001_setup_msix(pm8001_ha);
|
|
|
|
else {
|
|
|
|
PM8001_INIT_DBG(pm8001_ha,
|
|
|
|
pm8001_printk("MSIX not supported!!!\n"));
|
2009-10-14 15:19:21 +07:00
|
|
|
goto intx;
|
2013-03-19 19:26:17 +07:00
|
|
|
}
|
2009-10-14 15:19:21 +07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
intx:
|
tree-wide: fix comment/printk typos
"gadget", "through", "command", "maintain", "maintain", "controller", "address",
"between", "initiali[zs]e", "instead", "function", "select", "already",
"equal", "access", "management", "hierarchy", "registration", "interest",
"relative", "memory", "offset", "already",
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-11-02 02:38:34 +07:00
|
|
|
/* initialize the INT-X interrupt */
|
2015-10-30 21:53:31 +07:00
|
|
|
pm8001_ha->irq_vector[0].irq_id = 0;
|
|
|
|
pm8001_ha->irq_vector[0].drv_inst = pm8001_ha;
|
2013-03-19 19:26:17 +07:00
|
|
|
rc = request_irq(pdev->irq, pm8001_interrupt_handler_intx, IRQF_SHARED,
|
|
|
|
DRV_NAME, SHOST_TO_SAS_HA(pm8001_ha->shost));
|
2009-10-14 15:19:21 +07:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* pm8001_pci_probe - probe supported device
|
|
|
|
* @pdev: pci device which kernel has been prepared for.
|
|
|
|
* @ent: pci device id
|
|
|
|
*
|
|
|
|
* This function is the main initialization function, when register a new
|
|
|
|
* pci driver it is invoked, all struct an hardware initilization should be done
|
|
|
|
* here, also, register interrupt
|
|
|
|
*/
|
2012-12-22 04:08:55 +07:00
|
|
|
static int pm8001_pci_probe(struct pci_dev *pdev,
|
|
|
|
const struct pci_device_id *ent)
|
2009-10-14 15:19:21 +07:00
|
|
|
{
|
|
|
|
unsigned int rc;
|
|
|
|
u32 pci_reg;
|
2013-03-19 19:26:17 +07:00
|
|
|
u8 i = 0;
|
2009-10-14 15:19:21 +07:00
|
|
|
struct pm8001_hba_info *pm8001_ha;
|
|
|
|
struct Scsi_Host *shost = NULL;
|
|
|
|
const struct pm8001_chip_info *chip;
|
|
|
|
|
|
|
|
dev_printk(KERN_INFO, &pdev->dev,
|
2013-03-19 19:37:09 +07:00
|
|
|
"pm80xx: driver version %s\n", DRV_VERSION);
|
2009-10-14 15:19:21 +07:00
|
|
|
rc = pci_enable_device(pdev);
|
|
|
|
if (rc)
|
|
|
|
goto err_out_enable;
|
|
|
|
pci_set_master(pdev);
|
|
|
|
/*
|
|
|
|
* Enable pci slot busmaster by setting pci command register.
|
|
|
|
* This is required by FW for Cyclone card.
|
|
|
|
*/
|
|
|
|
|
|
|
|
pci_read_config_dword(pdev, PCI_COMMAND, &pci_reg);
|
|
|
|
pci_reg |= 0x157;
|
|
|
|
pci_write_config_dword(pdev, PCI_COMMAND, pci_reg);
|
|
|
|
rc = pci_request_regions(pdev, DRV_NAME);
|
|
|
|
if (rc)
|
|
|
|
goto err_out_disable;
|
|
|
|
rc = pci_go_44(pdev);
|
|
|
|
if (rc)
|
|
|
|
goto err_out_regions;
|
|
|
|
|
|
|
|
shost = scsi_host_alloc(&pm8001_sht, sizeof(void *));
|
|
|
|
if (!shost) {
|
|
|
|
rc = -ENOMEM;
|
|
|
|
goto err_out_regions;
|
|
|
|
}
|
|
|
|
chip = &pm8001_chips[ent->driver_data];
|
|
|
|
SHOST_TO_SAS_HA(shost) =
|
2009-12-19 14:17:27 +07:00
|
|
|
kzalloc(sizeof(struct sas_ha_struct), GFP_KERNEL);
|
2009-10-14 15:19:21 +07:00
|
|
|
if (!SHOST_TO_SAS_HA(shost)) {
|
|
|
|
rc = -ENOMEM;
|
|
|
|
goto err_out_free_host;
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = pm8001_prep_sas_ha_init(shost, chip);
|
|
|
|
if (rc) {
|
|
|
|
rc = -ENOMEM;
|
|
|
|
goto err_out_free;
|
|
|
|
}
|
|
|
|
pci_set_drvdata(pdev, SHOST_TO_SAS_HA(shost));
|
2013-02-27 21:55:25 +07:00
|
|
|
/* ent->driver variable is used to differentiate between controllers */
|
|
|
|
pm8001_ha = pm8001_pci_alloc(pdev, ent, shost);
|
2009-10-14 15:19:21 +07:00
|
|
|
if (!pm8001_ha) {
|
|
|
|
rc = -ENOMEM;
|
|
|
|
goto err_out_free;
|
|
|
|
}
|
|
|
|
list_add_tail(&pm8001_ha->list, &hba_list);
|
2013-04-17 18:07:02 +07:00
|
|
|
PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha);
|
2009-10-14 15:19:21 +07:00
|
|
|
rc = PM8001_CHIP_DISP->chip_init(pm8001_ha);
|
2013-03-19 19:37:09 +07:00
|
|
|
if (rc) {
|
|
|
|
PM8001_FAIL_DBG(pm8001_ha, pm8001_printk(
|
|
|
|
"chip_init failed [ret: %d]\n", rc));
|
2009-10-14 15:19:21 +07:00
|
|
|
goto err_out_ha_free;
|
2013-03-19 19:37:09 +07:00
|
|
|
}
|
2009-10-14 15:19:21 +07:00
|
|
|
|
|
|
|
rc = scsi_add_host(shost, &pdev->dev);
|
|
|
|
if (rc)
|
|
|
|
goto err_out_ha_free;
|
|
|
|
rc = pm8001_request_irq(pm8001_ha);
|
2013-03-19 19:37:09 +07:00
|
|
|
if (rc) {
|
|
|
|
PM8001_FAIL_DBG(pm8001_ha, pm8001_printk(
|
|
|
|
"pm8001_request_irq failed [ret: %d]\n", rc));
|
2009-10-14 15:19:21 +07:00
|
|
|
goto err_out_shost;
|
2013-03-19 19:37:09 +07:00
|
|
|
}
|
2009-10-14 15:19:21 +07:00
|
|
|
|
2013-02-27 21:57:43 +07:00
|
|
|
PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, 0);
|
2013-03-19 19:26:17 +07:00
|
|
|
if (pm8001_ha->chip_id != chip_8001) {
|
|
|
|
for (i = 1; i < pm8001_ha->number_of_intr; i++)
|
|
|
|
PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, i);
|
2013-03-19 19:38:40 +07:00
|
|
|
/* setup thermal configuration. */
|
|
|
|
pm80xx_set_thermal_config(pm8001_ha);
|
2013-03-19 19:26:17 +07:00
|
|
|
}
|
|
|
|
|
2009-10-14 15:19:21 +07:00
|
|
|
pm8001_init_sas_add(pm8001_ha);
|
2013-09-18 14:32:44 +07:00
|
|
|
/* phy setting support for motherboard controller */
|
2015-10-30 21:53:24 +07:00
|
|
|
if (pm8001_configure_phy_settings(pm8001_ha))
|
|
|
|
goto err_out_shost;
|
|
|
|
|
2009-10-14 15:19:21 +07:00
|
|
|
pm8001_post_sas_ha_init(shost, chip);
|
|
|
|
rc = sas_register_ha(SHOST_TO_SAS_HA(shost));
|
|
|
|
if (rc)
|
|
|
|
goto err_out_shost;
|
|
|
|
scsi_scan_host(pm8001_ha->shost);
|
2018-09-11 15:48:02 +07:00
|
|
|
pm8001_ha->flags = PM8001F_RUN_TIME;
|
2009-10-14 15:19:21 +07:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_out_shost:
|
|
|
|
scsi_remove_host(pm8001_ha->shost);
|
|
|
|
err_out_ha_free:
|
|
|
|
pm8001_free(pm8001_ha);
|
|
|
|
err_out_free:
|
|
|
|
kfree(SHOST_TO_SAS_HA(shost));
|
|
|
|
err_out_free_host:
|
2017-08-08 18:40:30 +07:00
|
|
|
scsi_host_put(shost);
|
2009-10-14 15:19:21 +07:00
|
|
|
err_out_regions:
|
|
|
|
pci_release_regions(pdev);
|
|
|
|
err_out_disable:
|
|
|
|
pci_disable_device(pdev);
|
|
|
|
err_out_enable:
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2012-12-22 04:08:55 +07:00
|
|
|
static void pm8001_pci_remove(struct pci_dev *pdev)
|
2009-10-14 15:19:21 +07:00
|
|
|
{
|
|
|
|
struct sas_ha_struct *sha = pci_get_drvdata(pdev);
|
|
|
|
struct pm8001_hba_info *pm8001_ha;
|
2013-11-11 16:58:14 +07:00
|
|
|
int i, j;
|
2009-10-14 15:19:21 +07:00
|
|
|
pm8001_ha = sha->lldd_ha;
|
|
|
|
sas_unregister_ha(sha);
|
|
|
|
sas_remove_host(pm8001_ha->shost);
|
|
|
|
list_del(&pm8001_ha->list);
|
2013-03-19 19:26:17 +07:00
|
|
|
PM8001_CHIP_DISP->interrupt_disable(pm8001_ha, 0xFF);
|
2013-04-17 18:07:02 +07:00
|
|
|
PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha);
|
2009-10-14 15:19:21 +07:00
|
|
|
|
|
|
|
#ifdef PM8001_USE_MSIX
|
|
|
|
for (i = 0; i < pm8001_ha->number_of_intr; i++)
|
2017-02-01 21:11:07 +07:00
|
|
|
synchronize_irq(pci_irq_vector(pdev, i));
|
2009-10-14 15:19:21 +07:00
|
|
|
for (i = 0; i < pm8001_ha->number_of_intr; i++)
|
2017-02-01 21:11:07 +07:00
|
|
|
free_irq(pci_irq_vector(pdev, i), &pm8001_ha->irq_vector[i]);
|
|
|
|
pci_free_irq_vectors(pdev);
|
2009-10-14 15:19:21 +07:00
|
|
|
#else
|
|
|
|
free_irq(pm8001_ha->irq, sha);
|
|
|
|
#endif
|
|
|
|
#ifdef PM8001_USE_TASKLET
|
2013-11-11 16:58:14 +07:00
|
|
|
/* For non-msix and msix interrupts */
|
2015-10-30 21:53:31 +07:00
|
|
|
if ((!pdev->msix_cap || !pci_msi_enabled()) ||
|
|
|
|
(pm8001_ha->chip_id == chip_8001))
|
2013-11-11 16:58:14 +07:00
|
|
|
tasklet_kill(&pm8001_ha->tasklet[0]);
|
|
|
|
else
|
|
|
|
for (j = 0; j < PM8001_MAX_MSIX_VEC; j++)
|
|
|
|
tasklet_kill(&pm8001_ha->tasklet[j]);
|
2009-10-14 15:19:21 +07:00
|
|
|
#endif
|
2017-08-08 18:40:30 +07:00
|
|
|
scsi_host_put(pm8001_ha->shost);
|
2009-10-14 15:19:21 +07:00
|
|
|
pm8001_free(pm8001_ha);
|
|
|
|
kfree(sha->sas_phy);
|
|
|
|
kfree(sha->sas_port);
|
|
|
|
kfree(sha);
|
|
|
|
pci_release_regions(pdev);
|
|
|
|
pci_disable_device(pdev);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* pm8001_pci_suspend - power management suspend main entry point
|
|
|
|
* @pdev: PCI device struct
|
|
|
|
* @state: PM state change to (usually PCI_D3)
|
|
|
|
*
|
|
|
|
* Returns 0 success, anything else error.
|
|
|
|
*/
|
|
|
|
static int pm8001_pci_suspend(struct pci_dev *pdev, pm_message_t state)
|
|
|
|
{
|
|
|
|
struct sas_ha_struct *sha = pci_get_drvdata(pdev);
|
|
|
|
struct pm8001_hba_info *pm8001_ha;
|
2013-11-11 16:58:14 +07:00
|
|
|
int i, j;
|
2009-10-14 15:19:21 +07:00
|
|
|
u32 device_state;
|
|
|
|
pm8001_ha = sha->lldd_ha;
|
2014-07-09 18:50:23 +07:00
|
|
|
sas_suspend_ha(sha);
|
2011-01-24 20:57:29 +07:00
|
|
|
flush_workqueue(pm8001_wq);
|
2009-10-14 15:19:21 +07:00
|
|
|
scsi_block_requests(pm8001_ha->shost);
|
2013-06-27 14:02:49 +07:00
|
|
|
if (!pdev->pm_cap) {
|
|
|
|
dev_err(&pdev->dev, " PCI PM not supported\n");
|
2009-10-14 15:19:21 +07:00
|
|
|
return -ENODEV;
|
|
|
|
}
|
2013-03-19 19:26:17 +07:00
|
|
|
PM8001_CHIP_DISP->interrupt_disable(pm8001_ha, 0xFF);
|
2013-04-17 18:07:02 +07:00
|
|
|
PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha);
|
2009-10-14 15:19:21 +07:00
|
|
|
#ifdef PM8001_USE_MSIX
|
|
|
|
for (i = 0; i < pm8001_ha->number_of_intr; i++)
|
2017-02-01 21:11:07 +07:00
|
|
|
synchronize_irq(pci_irq_vector(pdev, i));
|
2009-10-14 15:19:21 +07:00
|
|
|
for (i = 0; i < pm8001_ha->number_of_intr; i++)
|
2017-02-01 21:11:07 +07:00
|
|
|
free_irq(pci_irq_vector(pdev, i), &pm8001_ha->irq_vector[i]);
|
|
|
|
pci_free_irq_vectors(pdev);
|
2009-10-14 15:19:21 +07:00
|
|
|
#else
|
|
|
|
free_irq(pm8001_ha->irq, sha);
|
|
|
|
#endif
|
|
|
|
#ifdef PM8001_USE_TASKLET
|
2013-11-11 16:58:14 +07:00
|
|
|
/* For non-msix and msix interrupts */
|
2015-10-30 21:53:31 +07:00
|
|
|
if ((!pdev->msix_cap || !pci_msi_enabled()) ||
|
|
|
|
(pm8001_ha->chip_id == chip_8001))
|
2013-11-11 16:58:14 +07:00
|
|
|
tasklet_kill(&pm8001_ha->tasklet[0]);
|
|
|
|
else
|
|
|
|
for (j = 0; j < PM8001_MAX_MSIX_VEC; j++)
|
|
|
|
tasklet_kill(&pm8001_ha->tasklet[j]);
|
2009-10-14 15:19:21 +07:00
|
|
|
#endif
|
|
|
|
device_state = pci_choose_state(pdev, state);
|
|
|
|
pm8001_printk("pdev=0x%p, slot=%s, entering "
|
|
|
|
"operating state [D%d]\n", pdev,
|
|
|
|
pm8001_ha->name, device_state);
|
|
|
|
pci_save_state(pdev);
|
|
|
|
pci_disable_device(pdev);
|
|
|
|
pci_set_power_state(pdev, device_state);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* pm8001_pci_resume - power management resume main entry point
|
|
|
|
* @pdev: PCI device struct
|
|
|
|
*
|
|
|
|
* Returns 0 success, anything else error.
|
|
|
|
*/
|
|
|
|
static int pm8001_pci_resume(struct pci_dev *pdev)
|
|
|
|
{
|
|
|
|
struct sas_ha_struct *sha = pci_get_drvdata(pdev);
|
|
|
|
struct pm8001_hba_info *pm8001_ha;
|
|
|
|
int rc;
|
2013-11-11 16:58:14 +07:00
|
|
|
u8 i = 0, j;
|
2009-10-14 15:19:21 +07:00
|
|
|
u32 device_state;
|
2014-07-09 18:50:23 +07:00
|
|
|
DECLARE_COMPLETION_ONSTACK(completion);
|
2009-10-14 15:19:21 +07:00
|
|
|
pm8001_ha = sha->lldd_ha;
|
|
|
|
device_state = pdev->current_state;
|
|
|
|
|
|
|
|
pm8001_printk("pdev=0x%p, slot=%s, resuming from previous "
|
|
|
|
"operating state [D%d]\n", pdev, pm8001_ha->name, device_state);
|
|
|
|
|
|
|
|
pci_set_power_state(pdev, PCI_D0);
|
|
|
|
pci_enable_wake(pdev, PCI_D0, 0);
|
|
|
|
pci_restore_state(pdev);
|
|
|
|
rc = pci_enable_device(pdev);
|
|
|
|
if (rc) {
|
|
|
|
pm8001_printk("slot=%s Enable device failed during resume\n",
|
|
|
|
pm8001_ha->name);
|
|
|
|
goto err_out_enable;
|
|
|
|
}
|
|
|
|
|
|
|
|
pci_set_master(pdev);
|
|
|
|
rc = pci_go_44(pdev);
|
|
|
|
if (rc)
|
|
|
|
goto err_out_disable;
|
2014-07-09 18:50:23 +07:00
|
|
|
sas_prep_resume_ha(sha);
|
2013-04-17 18:07:02 +07:00
|
|
|
/* chip soft rst only for spc */
|
|
|
|
if (pm8001_ha->chip_id == chip_8001) {
|
|
|
|
PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha);
|
|
|
|
PM8001_INIT_DBG(pm8001_ha,
|
|
|
|
pm8001_printk("chip soft reset successful\n"));
|
|
|
|
}
|
2009-10-14 15:19:21 +07:00
|
|
|
rc = PM8001_CHIP_DISP->chip_init(pm8001_ha);
|
|
|
|
if (rc)
|
|
|
|
goto err_out_disable;
|
2013-03-19 19:26:17 +07:00
|
|
|
|
|
|
|
/* disable all the interrupt bits */
|
|
|
|
PM8001_CHIP_DISP->interrupt_disable(pm8001_ha, 0xFF);
|
|
|
|
|
2009-10-14 15:19:21 +07:00
|
|
|
rc = pm8001_request_irq(pm8001_ha);
|
|
|
|
if (rc)
|
|
|
|
goto err_out_disable;
|
2013-03-19 19:26:17 +07:00
|
|
|
#ifdef PM8001_USE_TASKLET
|
2013-11-11 16:58:14 +07:00
|
|
|
/* Tasklet for non msi-x interrupt handler */
|
2015-10-30 21:53:31 +07:00
|
|
|
if ((!pdev->msix_cap || !pci_msi_enabled()) ||
|
|
|
|
(pm8001_ha->chip_id == chip_8001))
|
2013-11-11 16:58:14 +07:00
|
|
|
tasklet_init(&pm8001_ha->tasklet[0], pm8001_tasklet,
|
|
|
|
(unsigned long)&(pm8001_ha->irq_vector[0]));
|
|
|
|
else
|
|
|
|
for (j = 0; j < PM8001_MAX_MSIX_VEC; j++)
|
|
|
|
tasklet_init(&pm8001_ha->tasklet[j], pm8001_tasklet,
|
|
|
|
(unsigned long)&(pm8001_ha->irq_vector[j]));
|
2013-03-19 19:26:17 +07:00
|
|
|
#endif
|
2013-02-27 21:57:43 +07:00
|
|
|
PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, 0);
|
2013-03-19 19:26:17 +07:00
|
|
|
if (pm8001_ha->chip_id != chip_8001) {
|
|
|
|
for (i = 1; i < pm8001_ha->number_of_intr; i++)
|
|
|
|
PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, i);
|
|
|
|
}
|
2015-11-03 03:42:29 +07:00
|
|
|
|
|
|
|
/* Chip documentation for the 8070 and 8072 SPCv */
|
|
|
|
/* states that a 500ms minimum delay is required */
|
2016-05-17 21:38:44 +07:00
|
|
|
/* before issuing commands. Otherwise, the firmware */
|
2015-11-03 03:42:29 +07:00
|
|
|
/* will enter an unrecoverable state. */
|
|
|
|
|
|
|
|
if (pm8001_ha->chip_id == chip_8070 ||
|
|
|
|
pm8001_ha->chip_id == chip_8072) {
|
|
|
|
mdelay(500);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Spin up the PHYs */
|
|
|
|
|
2014-07-09 18:50:23 +07:00
|
|
|
pm8001_ha->flags = PM8001F_RUN_TIME;
|
|
|
|
for (i = 0; i < pm8001_ha->chip->n_phy; i++) {
|
|
|
|
pm8001_ha->phy[i].enable_completion = &completion;
|
|
|
|
PM8001_CHIP_DISP->phy_start_req(pm8001_ha, i);
|
|
|
|
wait_for_completion(&completion);
|
|
|
|
}
|
|
|
|
sas_resume_ha(sha);
|
2009-10-14 15:19:21 +07:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_out_disable:
|
|
|
|
scsi_remove_host(pm8001_ha->shost);
|
|
|
|
pci_disable_device(pdev);
|
|
|
|
err_out_enable:
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2013-04-17 17:56:36 +07:00
|
|
|
/* update of pci device, vendor id and driver data with
|
|
|
|
* unique value for each of the controller
|
|
|
|
*/
|
2012-12-22 04:08:55 +07:00
|
|
|
static struct pci_device_id pm8001_pci_table[] = {
|
2013-04-17 17:56:36 +07:00
|
|
|
{ PCI_VDEVICE(PMC_Sierra, 0x8001), chip_8001 },
|
2015-02-12 13:34:37 +07:00
|
|
|
{ PCI_VDEVICE(PMC_Sierra, 0x8006), chip_8006 },
|
|
|
|
{ PCI_VDEVICE(ADAPTEC2, 0x8006), chip_8006 },
|
2013-12-19 22:50:56 +07:00
|
|
|
{ PCI_VDEVICE(ATTO, 0x0042), chip_8001 },
|
2013-04-17 17:56:36 +07:00
|
|
|
/* Support for SPC/SPCv/SPCve controllers */
|
|
|
|
{ PCI_VDEVICE(ADAPTEC2, 0x8001), chip_8001 },
|
|
|
|
{ PCI_VDEVICE(PMC_Sierra, 0x8008), chip_8008 },
|
|
|
|
{ PCI_VDEVICE(ADAPTEC2, 0x8008), chip_8008 },
|
|
|
|
{ PCI_VDEVICE(PMC_Sierra, 0x8018), chip_8018 },
|
|
|
|
{ PCI_VDEVICE(ADAPTEC2, 0x8018), chip_8018 },
|
|
|
|
{ PCI_VDEVICE(PMC_Sierra, 0x8009), chip_8009 },
|
|
|
|
{ PCI_VDEVICE(ADAPTEC2, 0x8009), chip_8009 },
|
|
|
|
{ PCI_VDEVICE(PMC_Sierra, 0x8019), chip_8019 },
|
|
|
|
{ PCI_VDEVICE(ADAPTEC2, 0x8019), chip_8019 },
|
2013-09-03 16:39:42 +07:00
|
|
|
{ PCI_VDEVICE(PMC_Sierra, 0x8074), chip_8074 },
|
|
|
|
{ PCI_VDEVICE(ADAPTEC2, 0x8074), chip_8074 },
|
|
|
|
{ PCI_VDEVICE(PMC_Sierra, 0x8076), chip_8076 },
|
|
|
|
{ PCI_VDEVICE(ADAPTEC2, 0x8076), chip_8076 },
|
|
|
|
{ PCI_VDEVICE(PMC_Sierra, 0x8077), chip_8077 },
|
|
|
|
{ PCI_VDEVICE(ADAPTEC2, 0x8077), chip_8077 },
|
2013-04-17 17:56:36 +07:00
|
|
|
{ PCI_VENDOR_ID_ADAPTEC2, 0x8081,
|
|
|
|
PCI_VENDOR_ID_ADAPTEC2, 0x0400, 0, 0, chip_8001 },
|
|
|
|
{ PCI_VENDOR_ID_ADAPTEC2, 0x8081,
|
|
|
|
PCI_VENDOR_ID_ADAPTEC2, 0x0800, 0, 0, chip_8001 },
|
|
|
|
{ PCI_VENDOR_ID_ADAPTEC2, 0x8088,
|
|
|
|
PCI_VENDOR_ID_ADAPTEC2, 0x0008, 0, 0, chip_8008 },
|
|
|
|
{ PCI_VENDOR_ID_ADAPTEC2, 0x8088,
|
|
|
|
PCI_VENDOR_ID_ADAPTEC2, 0x0800, 0, 0, chip_8008 },
|
|
|
|
{ PCI_VENDOR_ID_ADAPTEC2, 0x8089,
|
|
|
|
PCI_VENDOR_ID_ADAPTEC2, 0x0008, 0, 0, chip_8009 },
|
|
|
|
{ PCI_VENDOR_ID_ADAPTEC2, 0x8089,
|
|
|
|
PCI_VENDOR_ID_ADAPTEC2, 0x0800, 0, 0, chip_8009 },
|
|
|
|
{ PCI_VENDOR_ID_ADAPTEC2, 0x8088,
|
|
|
|
PCI_VENDOR_ID_ADAPTEC2, 0x0016, 0, 0, chip_8018 },
|
|
|
|
{ PCI_VENDOR_ID_ADAPTEC2, 0x8088,
|
|
|
|
PCI_VENDOR_ID_ADAPTEC2, 0x1600, 0, 0, chip_8018 },
|
|
|
|
{ PCI_VENDOR_ID_ADAPTEC2, 0x8089,
|
|
|
|
PCI_VENDOR_ID_ADAPTEC2, 0x0016, 0, 0, chip_8019 },
|
|
|
|
{ PCI_VENDOR_ID_ADAPTEC2, 0x8089,
|
|
|
|
PCI_VENDOR_ID_ADAPTEC2, 0x1600, 0, 0, chip_8019 },
|
2013-09-03 16:39:42 +07:00
|
|
|
{ PCI_VENDOR_ID_ADAPTEC2, 0x8074,
|
|
|
|
PCI_VENDOR_ID_ADAPTEC2, 0x0800, 0, 0, chip_8074 },
|
|
|
|
{ PCI_VENDOR_ID_ADAPTEC2, 0x8076,
|
|
|
|
PCI_VENDOR_ID_ADAPTEC2, 0x1600, 0, 0, chip_8076 },
|
|
|
|
{ PCI_VENDOR_ID_ADAPTEC2, 0x8077,
|
|
|
|
PCI_VENDOR_ID_ADAPTEC2, 0x1600, 0, 0, chip_8077 },
|
|
|
|
{ PCI_VENDOR_ID_ADAPTEC2, 0x8074,
|
|
|
|
PCI_VENDOR_ID_ADAPTEC2, 0x0008, 0, 0, chip_8074 },
|
|
|
|
{ PCI_VENDOR_ID_ADAPTEC2, 0x8076,
|
|
|
|
PCI_VENDOR_ID_ADAPTEC2, 0x0016, 0, 0, chip_8076 },
|
|
|
|
{ PCI_VENDOR_ID_ADAPTEC2, 0x8077,
|
|
|
|
PCI_VENDOR_ID_ADAPTEC2, 0x0016, 0, 0, chip_8077 },
|
|
|
|
{ PCI_VENDOR_ID_ADAPTEC2, 0x8076,
|
|
|
|
PCI_VENDOR_ID_ADAPTEC2, 0x0808, 0, 0, chip_8076 },
|
|
|
|
{ PCI_VENDOR_ID_ADAPTEC2, 0x8077,
|
|
|
|
PCI_VENDOR_ID_ADAPTEC2, 0x0808, 0, 0, chip_8077 },
|
|
|
|
{ PCI_VENDOR_ID_ADAPTEC2, 0x8074,
|
|
|
|
PCI_VENDOR_ID_ADAPTEC2, 0x0404, 0, 0, chip_8074 },
|
2015-10-30 21:53:26 +07:00
|
|
|
{ PCI_VENDOR_ID_ATTO, 0x8070,
|
|
|
|
PCI_VENDOR_ID_ATTO, 0x0070, 0, 0, chip_8070 },
|
|
|
|
{ PCI_VENDOR_ID_ATTO, 0x8070,
|
|
|
|
PCI_VENDOR_ID_ATTO, 0x0071, 0, 0, chip_8070 },
|
|
|
|
{ PCI_VENDOR_ID_ATTO, 0x8072,
|
|
|
|
PCI_VENDOR_ID_ATTO, 0x0072, 0, 0, chip_8072 },
|
|
|
|
{ PCI_VENDOR_ID_ATTO, 0x8072,
|
|
|
|
PCI_VENDOR_ID_ATTO, 0x0073, 0, 0, chip_8072 },
|
|
|
|
{ PCI_VENDOR_ID_ATTO, 0x8070,
|
|
|
|
PCI_VENDOR_ID_ATTO, 0x0080, 0, 0, chip_8070 },
|
|
|
|
{ PCI_VENDOR_ID_ATTO, 0x8072,
|
|
|
|
PCI_VENDOR_ID_ATTO, 0x0081, 0, 0, chip_8072 },
|
|
|
|
{ PCI_VENDOR_ID_ATTO, 0x8072,
|
|
|
|
PCI_VENDOR_ID_ATTO, 0x0082, 0, 0, chip_8072 },
|
2009-10-14 15:19:21 +07:00
|
|
|
{} /* terminate list */
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pci_driver pm8001_pci_driver = {
|
|
|
|
.name = DRV_NAME,
|
|
|
|
.id_table = pm8001_pci_table,
|
|
|
|
.probe = pm8001_pci_probe,
|
2012-12-22 04:08:55 +07:00
|
|
|
.remove = pm8001_pci_remove,
|
2009-10-14 15:19:21 +07:00
|
|
|
.suspend = pm8001_pci_suspend,
|
|
|
|
.resume = pm8001_pci_resume,
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* pm8001_init - initialize scsi transport template
|
|
|
|
*/
|
|
|
|
static int __init pm8001_init(void)
|
|
|
|
{
|
2011-01-24 20:57:29 +07:00
|
|
|
int rc = -ENOMEM;
|
|
|
|
|
2013-03-19 19:37:09 +07:00
|
|
|
pm8001_wq = alloc_workqueue("pm80xx", 0, 0);
|
2011-01-24 20:57:29 +07:00
|
|
|
if (!pm8001_wq)
|
|
|
|
goto err;
|
|
|
|
|
2009-10-14 15:19:21 +07:00
|
|
|
pm8001_id = 0;
|
|
|
|
pm8001_stt = sas_domain_attach_transport(&pm8001_transport_ops);
|
|
|
|
if (!pm8001_stt)
|
2011-01-24 20:57:29 +07:00
|
|
|
goto err_wq;
|
2009-10-14 15:19:21 +07:00
|
|
|
rc = pci_register_driver(&pm8001_pci_driver);
|
|
|
|
if (rc)
|
2011-01-24 20:57:29 +07:00
|
|
|
goto err_tp;
|
2009-10-14 15:19:21 +07:00
|
|
|
return 0;
|
2011-01-24 20:57:29 +07:00
|
|
|
|
|
|
|
err_tp:
|
2009-10-14 15:19:21 +07:00
|
|
|
sas_release_transport(pm8001_stt);
|
2011-01-24 20:57:29 +07:00
|
|
|
err_wq:
|
|
|
|
destroy_workqueue(pm8001_wq);
|
|
|
|
err:
|
2009-10-14 15:19:21 +07:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit pm8001_exit(void)
|
|
|
|
{
|
|
|
|
pci_unregister_driver(&pm8001_pci_driver);
|
|
|
|
sas_release_transport(pm8001_stt);
|
2011-01-24 20:57:29 +07:00
|
|
|
destroy_workqueue(pm8001_wq);
|
2009-10-14 15:19:21 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
module_init(pm8001_init);
|
|
|
|
module_exit(pm8001_exit);
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Jack Wang <jack_wang@usish.com>");
|
2013-09-03 16:39:42 +07:00
|
|
|
MODULE_AUTHOR("Anand Kumar Santhanam <AnandKumar.Santhanam@pmcs.com>");
|
|
|
|
MODULE_AUTHOR("Sangeetha Gnanasekaran <Sangeetha.Gnanasekaran@pmcs.com>");
|
2013-11-13 17:05:23 +07:00
|
|
|
MODULE_AUTHOR("Nikith Ganigarakoppal <Nikith.Ganigarakoppal@pmcs.com>");
|
2013-04-17 17:56:36 +07:00
|
|
|
MODULE_DESCRIPTION(
|
2015-10-30 21:53:25 +07:00
|
|
|
"PMC-Sierra PM8001/8006/8081/8088/8089/8074/8076/8077/8070/8072 "
|
2013-09-03 16:39:42 +07:00
|
|
|
"SAS/SATA controller driver");
|
2009-10-14 15:19:21 +07:00
|
|
|
MODULE_VERSION(DRV_VERSION);
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
MODULE_DEVICE_TABLE(pci, pm8001_pci_table);
|
|
|
|
|