2019-05-27 14:55:15 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2009-05-09 05:44:01 +08:00
|
|
|
/*
|
2009-05-09 05:46:40 +08:00
|
|
|
* Marvell 88SE64xx/88SE94xx main function head file
|
|
|
|
*
|
|
|
|
* Copyright 2007 Red Hat, Inc.
|
|
|
|
* Copyright 2008 Marvell. <kewei@marvell.com>
|
2011-04-26 21:36:51 +08:00
|
|
|
* Copyright 2009-2011 Marvell. <yuxiangl@marvell.com>
|
2009-05-09 05:46:40 +08:00
|
|
|
*/
|
2009-05-09 05:44:01 +08:00
|
|
|
|
|
|
|
#ifndef _MV_SAS_H_
|
|
|
|
#define _MV_SAS_H_
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/spinlock.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/ctype.h>
|
|
|
|
#include <linux/dma-mapping.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/irq.h>
|
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 16:04:11 +08:00
|
|
|
#include <linux/slab.h>
|
2009-05-09 05:44:01 +08:00
|
|
|
#include <linux/vmalloc.h>
|
2013-06-10 00:23:16 +08:00
|
|
|
#include <asm/unaligned.h>
|
2009-05-09 05:44:01 +08:00
|
|
|
#include <scsi/libsas.h>
|
2010-02-15 14:00:00 +08:00
|
|
|
#include <scsi/scsi.h>
|
2009-05-09 05:44:01 +08:00
|
|
|
#include <scsi/scsi_tcq.h>
|
|
|
|
#include <scsi/sas_ata.h>
|
|
|
|
#include "mv_defs.h"
|
|
|
|
|
2009-05-09 05:46:40 +08:00
|
|
|
#define DRV_NAME "mvsas"
|
2011-09-29 15:35:38 +08:00
|
|
|
#define DRV_VERSION "0.8.16"
|
2009-05-09 05:44:01 +08:00
|
|
|
#define MVS_ID_NOT_MAPPED 0x7f
|
2009-05-09 05:46:40 +08:00
|
|
|
#define WIDE_PORT_MAX_PHY 4
|
|
|
|
#define mv_printk(fmt, arg ...) \
|
|
|
|
printk(KERN_DEBUG"%s %d:" fmt, __FILE__, __LINE__, ## arg)
|
|
|
|
#ifdef MV_DEBUG
|
|
|
|
#define mv_dprintk(format, arg...) \
|
|
|
|
printk(KERN_DEBUG"%s %d:" format, __FILE__, __LINE__, ## arg)
|
|
|
|
#else
|
|
|
|
#define mv_dprintk(format, arg...)
|
|
|
|
#endif
|
|
|
|
#define MV_MAX_U32 0xffffffff
|
|
|
|
|
2011-05-24 22:31:47 +08:00
|
|
|
extern int interrupt_coalescing;
|
2009-05-09 05:46:40 +08:00
|
|
|
extern struct mvs_tgt_initiator mvs_tgt;
|
|
|
|
extern struct mvs_info *tgt_mvi;
|
|
|
|
extern const struct mvs_dispatch mvs_64xx_dispatch;
|
|
|
|
extern const struct mvs_dispatch mvs_94xx_dispatch;
|
|
|
|
|
2012-11-17 03:40:03 +08:00
|
|
|
#define bit(n) ((u64)1 << n)
|
2009-05-09 05:46:40 +08:00
|
|
|
|
|
|
|
#define for_each_phy(__lseq_mask, __mc, __lseq) \
|
|
|
|
for ((__mc) = (__lseq_mask), (__lseq) = 0; \
|
|
|
|
(__mc) != 0 ; \
|
2009-05-09 05:44:01 +08:00
|
|
|
(++__lseq), (__mc) >>= 1)
|
|
|
|
|
2013-01-30 00:25:53 +08:00
|
|
|
#define MVS_PHY_ID (1U << sas_phy->id)
|
2009-05-09 05:46:40 +08:00
|
|
|
#define MV_INIT_DELAYED_WORK(w, f, d) INIT_DELAYED_WORK(w, f)
|
|
|
|
#define UNASSOC_D2H_FIS(id) \
|
|
|
|
((void *) mvi->rx_fis + 0x100 * id)
|
|
|
|
#define SATA_RECEIVED_FIS_LIST(reg_set) \
|
|
|
|
((void *) mvi->rx_fis + mvi->chip->fis_offs + 0x100 * reg_set)
|
|
|
|
#define SATA_RECEIVED_SDB_FIS(reg_set) \
|
|
|
|
(SATA_RECEIVED_FIS_LIST(reg_set) + 0x58)
|
|
|
|
#define SATA_RECEIVED_D2H_FIS(reg_set) \
|
|
|
|
(SATA_RECEIVED_FIS_LIST(reg_set) + 0x40)
|
|
|
|
#define SATA_RECEIVED_PIO_FIS(reg_set) \
|
|
|
|
(SATA_RECEIVED_FIS_LIST(reg_set) + 0x20)
|
|
|
|
#define SATA_RECEIVED_DMA_FIS(reg_set) \
|
|
|
|
(SATA_RECEIVED_FIS_LIST(reg_set) + 0x00)
|
|
|
|
|
|
|
|
enum dev_status {
|
|
|
|
MVS_DEV_NORMAL = 0x0,
|
|
|
|
MVS_DEV_EH = 0x1,
|
|
|
|
};
|
|
|
|
|
2011-05-24 22:36:02 +08:00
|
|
|
enum dev_reset {
|
|
|
|
MVS_SOFT_RESET = 0,
|
|
|
|
MVS_HARD_RESET = 1,
|
|
|
|
MVS_PHY_TUNE = 2,
|
|
|
|
};
|
2009-05-09 05:46:40 +08:00
|
|
|
|
|
|
|
struct mvs_info;
|
2015-12-28 03:21:19 +08:00
|
|
|
struct mvs_prv_info;
|
2009-05-09 05:46:40 +08:00
|
|
|
|
|
|
|
struct mvs_dispatch {
|
|
|
|
char *name;
|
|
|
|
int (*chip_init)(struct mvs_info *mvi);
|
|
|
|
int (*spi_init)(struct mvs_info *mvi);
|
|
|
|
int (*chip_ioremap)(struct mvs_info *mvi);
|
|
|
|
void (*chip_iounmap)(struct mvs_info *mvi);
|
|
|
|
irqreturn_t (*isr)(struct mvs_info *mvi, int irq, u32 stat);
|
|
|
|
u32 (*isr_status)(struct mvs_info *mvi, int irq);
|
|
|
|
void (*interrupt_enable)(struct mvs_info *mvi);
|
|
|
|
void (*interrupt_disable)(struct mvs_info *mvi);
|
|
|
|
|
|
|
|
u32 (*read_phy_ctl)(struct mvs_info *mvi, u32 port);
|
|
|
|
void (*write_phy_ctl)(struct mvs_info *mvi, u32 port, u32 val);
|
|
|
|
|
|
|
|
u32 (*read_port_cfg_data)(struct mvs_info *mvi, u32 port);
|
|
|
|
void (*write_port_cfg_data)(struct mvs_info *mvi, u32 port, u32 val);
|
|
|
|
void (*write_port_cfg_addr)(struct mvs_info *mvi, u32 port, u32 addr);
|
|
|
|
|
|
|
|
u32 (*read_port_vsr_data)(struct mvs_info *mvi, u32 port);
|
|
|
|
void (*write_port_vsr_data)(struct mvs_info *mvi, u32 port, u32 val);
|
|
|
|
void (*write_port_vsr_addr)(struct mvs_info *mvi, u32 port, u32 addr);
|
|
|
|
|
|
|
|
u32 (*read_port_irq_stat)(struct mvs_info *mvi, u32 port);
|
|
|
|
void (*write_port_irq_stat)(struct mvs_info *mvi, u32 port, u32 val);
|
|
|
|
|
|
|
|
u32 (*read_port_irq_mask)(struct mvs_info *mvi, u32 port);
|
|
|
|
void (*write_port_irq_mask)(struct mvs_info *mvi, u32 port, u32 val);
|
|
|
|
|
|
|
|
void (*command_active)(struct mvs_info *mvi, u32 slot_idx);
|
2010-02-15 14:00:00 +08:00
|
|
|
void (*clear_srs_irq)(struct mvs_info *mvi, u8 reg_set, u8 clear_all);
|
2009-05-09 05:46:40 +08:00
|
|
|
void (*issue_stop)(struct mvs_info *mvi, enum mvs_port_type type,
|
|
|
|
u32 tfs);
|
|
|
|
void (*start_delivery)(struct mvs_info *mvi, u32 tx);
|
|
|
|
u32 (*rx_update)(struct mvs_info *mvi);
|
|
|
|
void (*int_full)(struct mvs_info *mvi);
|
|
|
|
u8 (*assign_reg_set)(struct mvs_info *mvi, u8 *tfs);
|
|
|
|
void (*free_reg_set)(struct mvs_info *mvi, u8 *tfs);
|
|
|
|
u32 (*prd_size)(void);
|
|
|
|
u32 (*prd_count)(void);
|
|
|
|
void (*make_prd)(struct scatterlist *scatter, int nr, void *prd);
|
|
|
|
void (*detect_porttype)(struct mvs_info *mvi, int i);
|
|
|
|
int (*oob_done)(struct mvs_info *mvi, int i);
|
|
|
|
void (*fix_phy_info)(struct mvs_info *mvi, int i,
|
|
|
|
struct sas_identify_frame *id);
|
|
|
|
void (*phy_work_around)(struct mvs_info *mvi, int i);
|
|
|
|
void (*phy_set_link_rate)(struct mvs_info *mvi, u32 phy_id,
|
|
|
|
struct sas_phy_linkrates *rates);
|
|
|
|
u32 (*phy_max_link_rate)(void);
|
|
|
|
void (*phy_disable)(struct mvs_info *mvi, u32 phy_id);
|
|
|
|
void (*phy_enable)(struct mvs_info *mvi, u32 phy_id);
|
|
|
|
void (*phy_reset)(struct mvs_info *mvi, u32 phy_id, int hard);
|
|
|
|
void (*stp_reset)(struct mvs_info *mvi, u32 phy_id);
|
|
|
|
void (*clear_active_cmds)(struct mvs_info *mvi);
|
|
|
|
u32 (*spi_read_data)(struct mvs_info *mvi);
|
|
|
|
void (*spi_write_data)(struct mvs_info *mvi, u32 data);
|
|
|
|
int (*spi_buildcmd)(struct mvs_info *mvi,
|
|
|
|
u32 *dwCmd,
|
|
|
|
u8 cmd,
|
|
|
|
u8 read,
|
|
|
|
u8 length,
|
|
|
|
u32 addr
|
|
|
|
);
|
|
|
|
int (*spi_issuecmd)(struct mvs_info *mvi, u32 cmd);
|
|
|
|
int (*spi_waitdataready)(struct mvs_info *mvi, u32 timeout);
|
2011-05-24 22:33:11 +08:00
|
|
|
void (*dma_fix)(struct mvs_info *mvi, u32 phy_mask,
|
|
|
|
int buf_len, int from, void *prd);
|
2011-05-24 22:31:47 +08:00
|
|
|
void (*tune_interrupt)(struct mvs_info *mvi, u32 time);
|
2011-05-24 22:26:50 +08:00
|
|
|
void (*non_spec_ncq_error)(struct mvs_info *mvi);
|
2015-12-28 03:21:19 +08:00
|
|
|
int (*gpio_write)(struct mvs_prv_info *mvs_prv, u8 reg_type,
|
|
|
|
u8 reg_index, u8 reg_count, u8 *write_data);
|
2009-05-09 05:46:40 +08:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2009-05-09 05:44:01 +08:00
|
|
|
struct mvs_chip_info {
|
2009-05-09 05:46:40 +08:00
|
|
|
u32 n_host;
|
|
|
|
u32 n_phy;
|
|
|
|
u32 fis_offs;
|
|
|
|
u32 fis_count;
|
|
|
|
u32 srs_sz;
|
2011-05-24 22:36:02 +08:00
|
|
|
u32 sg_width;
|
2009-05-09 05:46:40 +08:00
|
|
|
u32 slot_width;
|
|
|
|
const struct mvs_dispatch *dispatch;
|
2009-05-09 05:44:01 +08:00
|
|
|
};
|
2011-05-24 22:36:02 +08:00
|
|
|
#define MVS_MAX_SG (1U << mvi->chip->sg_width)
|
2009-05-09 05:46:40 +08:00
|
|
|
#define MVS_CHIP_SLOT_SZ (1U << mvi->chip->slot_width)
|
|
|
|
#define MVS_RX_FISL_SZ \
|
|
|
|
(mvi->chip->fis_offs + (mvi->chip->fis_count * 0x100))
|
|
|
|
#define MVS_CHIP_DISP (mvi->chip->dispatch)
|
2009-05-09 05:44:01 +08:00
|
|
|
|
|
|
|
struct mvs_err_info {
|
|
|
|
__le32 flags;
|
|
|
|
__le32 flags2;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mvs_cmd_hdr {
|
|
|
|
__le32 flags; /* PRD tbl len; SAS, SATA ctl */
|
|
|
|
__le32 lens; /* cmd, max resp frame len */
|
|
|
|
__le32 tags; /* targ port xfer tag; tag */
|
|
|
|
__le32 data_len; /* data xfer len */
|
2009-05-09 05:46:40 +08:00
|
|
|
__le64 cmd_tbl; /* command table address */
|
2009-05-09 05:44:01 +08:00
|
|
|
__le64 open_frame; /* open addr frame address */
|
|
|
|
__le64 status_buf; /* status buffer address */
|
|
|
|
__le64 prd_tbl; /* PRD tbl address */
|
|
|
|
__le32 reserved[4];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mvs_port {
|
|
|
|
struct asd_sas_port sas_port;
|
|
|
|
u8 port_attached;
|
|
|
|
u8 wide_port_phymap;
|
|
|
|
struct list_head list;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mvs_phy {
|
2009-05-09 05:46:40 +08:00
|
|
|
struct mvs_info *mvi;
|
2009-05-09 05:44:01 +08:00
|
|
|
struct mvs_port *port;
|
|
|
|
struct asd_sas_phy sas_phy;
|
|
|
|
struct sas_identify identify;
|
|
|
|
struct scsi_device *sdev;
|
2009-05-09 05:46:40 +08:00
|
|
|
struct timer_list timer;
|
2009-05-09 05:44:01 +08:00
|
|
|
u64 dev_sas_addr;
|
|
|
|
u64 att_dev_sas_addr;
|
|
|
|
u32 att_dev_info;
|
|
|
|
u32 dev_info;
|
|
|
|
u32 phy_type;
|
|
|
|
u32 phy_status;
|
|
|
|
u32 irq_status;
|
|
|
|
u32 frame_rcvd_size;
|
|
|
|
u8 frame_rcvd[32];
|
|
|
|
u8 phy_attached;
|
2009-05-09 05:46:40 +08:00
|
|
|
u8 phy_mode;
|
|
|
|
u8 reserved[2];
|
|
|
|
u32 phy_event;
|
2009-05-09 05:44:01 +08:00
|
|
|
enum sas_linkrate minimum_linkrate;
|
|
|
|
enum sas_linkrate maximum_linkrate;
|
|
|
|
};
|
|
|
|
|
2009-05-09 05:46:40 +08:00
|
|
|
struct mvs_device {
|
2009-05-11 22:19:25 +08:00
|
|
|
struct list_head dev_entry;
|
2013-05-08 05:44:06 +08:00
|
|
|
enum sas_device_type dev_type;
|
2009-05-11 22:19:25 +08:00
|
|
|
struct mvs_info *mvi_info;
|
2009-05-09 05:46:40 +08:00
|
|
|
struct domain_device *sas_device;
|
|
|
|
u32 attached_phy;
|
|
|
|
u32 device_id;
|
2010-02-15 14:00:00 +08:00
|
|
|
u32 running_req;
|
2009-05-09 05:46:40 +08:00
|
|
|
u8 taskfileset;
|
|
|
|
u8 dev_status;
|
|
|
|
u16 reserved;
|
|
|
|
};
|
|
|
|
|
2011-05-24 22:28:31 +08:00
|
|
|
/* Generate PHY tunning parameters */
|
|
|
|
struct phy_tuning {
|
|
|
|
/* 1 bit, transmitter emphasis enable */
|
|
|
|
u8 trans_emp_en:1;
|
|
|
|
/* 4 bits, transmitter emphasis amplitude */
|
|
|
|
u8 trans_emp_amp:4;
|
|
|
|
/* 3 bits, reserved space */
|
|
|
|
u8 Reserved_2bit_1:3;
|
|
|
|
/* 5 bits, transmitter amplitude */
|
|
|
|
u8 trans_amp:5;
|
|
|
|
/* 2 bits, transmitter amplitude adjust */
|
|
|
|
u8 trans_amp_adj:2;
|
|
|
|
/* 1 bit, reserved space */
|
|
|
|
u8 resv_2bit_2:1;
|
|
|
|
/* 2 bytes, reserved space */
|
|
|
|
u8 reserved[2];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ffe_control {
|
|
|
|
/* 4 bits, FFE Capacitor Select (value range 0~F) */
|
|
|
|
u8 ffe_cap_sel:4;
|
|
|
|
/* 3 bits, FFE Resistor Select (value range 0~7) */
|
|
|
|
u8 ffe_rss_sel:3;
|
|
|
|
/* 1 bit reserve*/
|
|
|
|
u8 reserved:1;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* HBA_Info_Page is saved in Flash/NVRAM, total 256 bytes.
|
|
|
|
* The data area is valid only Signature="MRVL".
|
|
|
|
* If any member fills with 0xFF, the member is invalid.
|
|
|
|
*/
|
|
|
|
struct hba_info_page {
|
|
|
|
/* Dword 0 */
|
|
|
|
/* 4 bytes, structure signature,should be "MRVL" at first initial */
|
|
|
|
u8 signature[4];
|
|
|
|
|
|
|
|
/* Dword 1-13 */
|
|
|
|
u32 reserved1[13];
|
|
|
|
|
|
|
|
/* Dword 14-29 */
|
|
|
|
/* 64 bytes, SAS address for each port */
|
|
|
|
u64 sas_addr[8];
|
|
|
|
|
|
|
|
/* Dword 30-31 */
|
|
|
|
/* 8 bytes for vanir 8 port PHY FFE seeting
|
|
|
|
* BIT 0~3 : FFE Capacitor select(value range 0~F)
|
|
|
|
* BIT 4~6 : FFE Resistor select(value range 0~7)
|
|
|
|
* BIT 7: reserve.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct ffe_control ffe_ctl[8];
|
|
|
|
/* Dword 32 -43 */
|
|
|
|
u32 reserved2[12];
|
|
|
|
|
|
|
|
/* Dword 44-45 */
|
|
|
|
/* 8 bytes, 0: 1.5G, 1: 3.0G, should be 0x01 at first initial */
|
|
|
|
u8 phy_rate[8];
|
|
|
|
|
|
|
|
/* Dword 46-53 */
|
|
|
|
/* 32 bytes, PHY tuning parameters for each PHY*/
|
|
|
|
struct phy_tuning phy_tuning[8];
|
|
|
|
|
|
|
|
/* Dword 54-63 */
|
|
|
|
u32 reserved3[10];
|
|
|
|
}; /* total 256 bytes */
|
|
|
|
|
2009-05-09 05:44:01 +08:00
|
|
|
struct mvs_slot_info {
|
2009-05-09 05:46:40 +08:00
|
|
|
struct list_head entry;
|
|
|
|
union {
|
|
|
|
struct sas_task *task;
|
|
|
|
void *tdata;
|
|
|
|
};
|
2009-05-09 05:44:01 +08:00
|
|
|
u32 n_elem;
|
|
|
|
u32 tx;
|
2009-05-09 05:46:40 +08:00
|
|
|
u32 slot_tag;
|
2009-05-09 05:44:01 +08:00
|
|
|
|
|
|
|
/* DMA buffer for storing cmd tbl, open addr frame, status buffer,
|
|
|
|
* and PRD table
|
|
|
|
*/
|
|
|
|
void *buf;
|
|
|
|
dma_addr_t buf_dma;
|
|
|
|
void *response;
|
|
|
|
struct mvs_port *port;
|
2009-05-09 05:46:40 +08:00
|
|
|
struct mvs_device *device;
|
|
|
|
void *open_frame;
|
2009-05-09 05:44:01 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct mvs_info {
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
/* host-wide lock */
|
|
|
|
spinlock_t lock;
|
|
|
|
|
|
|
|
/* our device */
|
|
|
|
struct pci_dev *pdev;
|
2009-05-09 05:46:40 +08:00
|
|
|
struct device *dev;
|
2009-05-09 05:44:01 +08:00
|
|
|
|
|
|
|
/* enhanced mode registers */
|
|
|
|
void __iomem *regs;
|
|
|
|
|
2009-05-09 05:46:40 +08:00
|
|
|
/* peripheral or soc registers */
|
|
|
|
void __iomem *regs_ex;
|
2009-05-09 05:44:01 +08:00
|
|
|
u8 sas_addr[SAS_ADDR_SIZE];
|
|
|
|
|
|
|
|
/* SCSI/SAS glue */
|
2009-05-09 05:46:40 +08:00
|
|
|
struct sas_ha_struct *sas;
|
2009-05-09 05:44:01 +08:00
|
|
|
struct Scsi_Host *shost;
|
|
|
|
|
|
|
|
/* TX (delivery) DMA ring */
|
|
|
|
__le32 *tx;
|
|
|
|
dma_addr_t tx_dma;
|
|
|
|
|
|
|
|
/* cached next-producer idx */
|
|
|
|
u32 tx_prod;
|
|
|
|
|
|
|
|
/* RX (completion) DMA ring */
|
2009-05-09 05:46:40 +08:00
|
|
|
__le32 *rx;
|
2009-05-09 05:44:01 +08:00
|
|
|
dma_addr_t rx_dma;
|
|
|
|
|
|
|
|
/* RX consumer idx */
|
|
|
|
u32 rx_cons;
|
|
|
|
|
|
|
|
/* RX'd FIS area */
|
|
|
|
__le32 *rx_fis;
|
|
|
|
dma_addr_t rx_fis_dma;
|
|
|
|
|
|
|
|
/* DMA command header slots */
|
|
|
|
struct mvs_cmd_hdr *slot;
|
|
|
|
dma_addr_t slot_dma;
|
|
|
|
|
2009-05-09 05:46:40 +08:00
|
|
|
u32 chip_id;
|
2009-05-09 05:44:01 +08:00
|
|
|
const struct mvs_chip_info *chip;
|
|
|
|
|
2009-05-09 05:46:40 +08:00
|
|
|
int tags_num;
|
[SCSI] mvsas: Remove unused macros, variables and functions
Remove unused macros: VSR_PHY_VS0, VSR_PHY_VS1, MVS_SLOTS,
MVS_CAN_QUEUE, MVS_MSI, SG_MX, _MV_DUMP, MV_DISABLE_NCQ
Remove unused variables for mvs_info: irq, exp_req, cmd_size
Remove unused functions: mvs_get_sas_addr, mvs_hexdump,
mvs_hba_sb_dump, mvs_hab_memory_dump, mvs_hba_cq_dump
Signed-off-by: Xiangliang Yu <yuxiangl@marvell.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-05-24 22:35:09 +08:00
|
|
|
unsigned long *tags;
|
2009-05-09 05:46:40 +08:00
|
|
|
/* further per-slot information */
|
2009-05-09 05:44:01 +08:00
|
|
|
struct mvs_phy phy[MVS_MAX_PHYS];
|
|
|
|
struct mvs_port port[MVS_MAX_PHYS];
|
2009-05-09 05:46:40 +08:00
|
|
|
u32 id;
|
|
|
|
u64 sata_reg_set;
|
|
|
|
struct list_head *hba_list;
|
|
|
|
struct list_head soc_entry;
|
|
|
|
struct list_head wq_list;
|
|
|
|
unsigned long instance;
|
|
|
|
u16 flashid;
|
|
|
|
u32 flashsize;
|
|
|
|
u32 flashsectSize;
|
|
|
|
|
|
|
|
void *addon;
|
2011-05-24 22:28:31 +08:00
|
|
|
struct hba_info_page hba_info_param;
|
2009-05-09 05:46:40 +08:00
|
|
|
struct mvs_device devices[MVS_MAX_DEVICES];
|
|
|
|
void *bulk_buffer;
|
|
|
|
dma_addr_t bulk_buffer_dma;
|
2011-05-24 22:33:11 +08:00
|
|
|
void *bulk_buffer1;
|
|
|
|
dma_addr_t bulk_buffer_dma1;
|
2009-05-09 05:46:40 +08:00
|
|
|
#define TRASH_BUCKET_SIZE 0x20000
|
2011-04-26 21:36:51 +08:00
|
|
|
void *dma_pool;
|
2009-05-09 05:46:40 +08:00
|
|
|
struct mvs_slot_info slot_info[0];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mvs_prv_info{
|
|
|
|
u8 n_host;
|
|
|
|
u8 n_phy;
|
2011-05-24 22:37:25 +08:00
|
|
|
u8 scan_finished;
|
|
|
|
u8 reserve;
|
2009-05-09 05:46:40 +08:00
|
|
|
struct mvs_info *mvi[2];
|
2011-06-30 22:27:36 +08:00
|
|
|
struct tasklet_struct mv_tasklet;
|
2009-05-09 05:46:40 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct mvs_wq {
|
|
|
|
struct delayed_work work_q;
|
|
|
|
struct mvs_info *mvi;
|
|
|
|
void *data;
|
|
|
|
int handler;
|
|
|
|
struct list_head entry;
|
2009-05-09 05:44:01 +08:00
|
|
|
};
|
|
|
|
|
2009-05-09 05:46:40 +08:00
|
|
|
struct mvs_task_exec_info {
|
|
|
|
struct sas_task *task;
|
|
|
|
struct mvs_cmd_hdr *hdr;
|
|
|
|
struct mvs_port *port;
|
|
|
|
u32 tag;
|
|
|
|
int n_elem;
|
|
|
|
};
|
|
|
|
|
|
|
|
/******************** function prototype *********************/
|
|
|
|
void mvs_get_sas_addr(void *buf, u32 buflen);
|
|
|
|
void mvs_tag_clear(struct mvs_info *mvi, u32 tag);
|
|
|
|
void mvs_tag_free(struct mvs_info *mvi, u32 tag);
|
|
|
|
void mvs_tag_set(struct mvs_info *mvi, unsigned int tag);
|
|
|
|
int mvs_tag_alloc(struct mvs_info *mvi, u32 *tag_out);
|
|
|
|
void mvs_tag_init(struct mvs_info *mvi);
|
|
|
|
void mvs_iounmap(void __iomem *regs);
|
|
|
|
int mvs_ioremap(struct mvs_info *mvi, int bar, int bar_ex);
|
|
|
|
void mvs_phys_reset(struct mvs_info *mvi, u32 phy_mask, int hard);
|
2009-05-09 05:44:01 +08:00
|
|
|
int mvs_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
|
|
|
|
void *funcdata);
|
2012-12-22 05:08:55 +08:00
|
|
|
void mvs_set_sas_addr(struct mvs_info *mvi, int port_id, u32 off_lo,
|
|
|
|
u32 off_hi, u64 sas_addr);
|
2009-05-09 05:44:01 +08:00
|
|
|
void mvs_scan_start(struct Scsi_Host *shost);
|
|
|
|
int mvs_scan_finished(struct Scsi_Host *shost, unsigned long time);
|
2014-11-05 17:36:28 +08:00
|
|
|
int mvs_queue_command(struct sas_task *task, gfp_t gfp_flags);
|
2009-05-09 05:46:40 +08:00
|
|
|
int mvs_abort_task(struct sas_task *task);
|
|
|
|
int mvs_abort_task_set(struct domain_device *dev, u8 *lun);
|
|
|
|
int mvs_clear_aca(struct domain_device *dev, u8 *lun);
|
|
|
|
int mvs_clear_task_set(struct domain_device *dev, u8 * lun);
|
2009-05-09 05:44:01 +08:00
|
|
|
void mvs_port_formed(struct asd_sas_phy *sas_phy);
|
2009-05-09 05:46:40 +08:00
|
|
|
void mvs_port_deformed(struct asd_sas_phy *sas_phy);
|
|
|
|
int mvs_dev_found(struct domain_device *dev);
|
|
|
|
void mvs_dev_gone(struct domain_device *dev);
|
|
|
|
int mvs_lu_reset(struct domain_device *dev, u8 *lun);
|
|
|
|
int mvs_slot_complete(struct mvs_info *mvi, u32 rx_desc, u32 flags);
|
2009-05-09 05:44:01 +08:00
|
|
|
int mvs_I_T_nexus_reset(struct domain_device *dev);
|
2009-05-09 05:46:40 +08:00
|
|
|
int mvs_query_task(struct sas_task *task);
|
2010-02-15 14:00:00 +08:00
|
|
|
void mvs_release_task(struct mvs_info *mvi,
|
|
|
|
struct domain_device *dev);
|
|
|
|
void mvs_do_release_task(struct mvs_info *mvi, int phy_no,
|
2009-05-09 05:46:40 +08:00
|
|
|
struct domain_device *dev);
|
|
|
|
void mvs_int_port(struct mvs_info *mvi, int phy_no, u32 events);
|
|
|
|
void mvs_update_phyinfo(struct mvs_info *mvi, int i, int get_st);
|
|
|
|
int mvs_int_rx(struct mvs_info *mvi, bool self_clear);
|
2011-05-24 22:26:50 +08:00
|
|
|
struct mvs_device *mvs_find_dev_by_reg_set(struct mvs_info *mvi, u8 reg_set);
|
2015-12-28 03:21:19 +08:00
|
|
|
int mvs_gpio_write(struct sas_ha_struct *, u8 reg_type, u8 reg_index,
|
|
|
|
u8 reg_count, u8 *write_data);
|
2009-05-09 05:44:01 +08:00
|
|
|
#endif
|
2009-05-09 05:46:40 +08:00
|
|
|
|