SCSI misc on 20190709
This is mostly update of the usual drivers: qla2xxx, hpsa, lpfc, ufs,
mpt3sas, ibmvscsi, megaraid_sas, bnx2fc and hisi_sas as well as the
removal of the osst driver (I heard from Willem privately that he
would like the driver removed because all his test hardware has
failed). Plus number of minor changes, spelling fixes and other
trivia.
Signed-off-by: James E.J. Bottomley <jejb@linux.ibm.com>
-----BEGIN PGP SIGNATURE-----
iJwEABMIAEQWIQTnYEDbdso9F2cI+arnQslM7pishQUCXSTl4yYcamFtZXMuYm90
dG9tbGV5QGhhbnNlbnBhcnRuZXJzaGlwLmNvbQAKCRDnQslM7pishdcxAQDCJVbd
fPUX76/V1ldupunF97+3DTharxxbst+VnkOnCwD8D4c0KFFFOI9+F36cnMGCPegE
fjy17dQLvsJ4GsidHy8=
=aS5B
-----END PGP SIGNATURE-----
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI updates from James Bottomley:
"This is mostly update of the usual drivers: qla2xxx, hpsa, lpfc, ufs,
mpt3sas, ibmvscsi, megaraid_sas, bnx2fc and hisi_sas as well as the
removal of the osst driver (I heard from Willem privately that he
would like the driver removed because all his test hardware has
failed). Plus number of minor changes, spelling fixes and other
trivia.
The big merge conflict this time around is the SPDX licence tags.
Following discussion on linux-next, we believe our version to be more
accurate than the one in the tree, so the resolution is to take our
version for all the SPDX conflicts"
Note on the SPDX license tag conversion conflicts: the SCSI tree had
done its own SPDX conversion, which in some cases conflicted with the
treewide ones done by Thomas & co.
In almost all cases, the conflicts were purely syntactic: the SCSI tree
used the old-style SPDX tags ("GPL-2.0" and "GPL-2.0+") while the
treewide conversion had used the new-style ones ("GPL-2.0-only" and
"GPL-2.0-or-later").
In these cases I picked the new-style one.
In a few cases, the SPDX conversion was actually different, though. As
explained by James above, and in more detail in a pre-pull-request
thread:
"The other problem is actually substantive: In the libsas code Luben
Tuikov originally specified gpl 2.0 only by dint of stating:
* This file is licensed under GPLv2.
In all the libsas files, but then muddied the water by quoting GPLv2
verbatim (which includes the or later than language). So for these
files Christoph did the conversion to v2 only SPDX tags and Thomas
converted to v2 or later tags"
So in those cases, where the spdx tag substantially mattered, I took the
SCSI tree conversion of it, but then also took the opportunity to turn
the old-style "GPL-2.0" into a new-style "GPL-2.0-only" tag.
Similarly, when there were whitespace differences or other differences
to the comments around the copyright notices, I took the version from
the SCSI tree as being the more specific conversion.
Finally, in the spdx conversions that had no conflicts (because the
treewide ones hadn't been done for those files), I just took the SCSI
tree version as-is, even if it was old-style. The old-style conversions
are perfectly valid, even if the "-only" and "-or-later" versions are
perhaps more descriptive.
* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (185 commits)
scsi: qla2xxx: move IO flush to the front of NVME rport unregistration
scsi: qla2xxx: Fix NVME cmd and LS cmd timeout race condition
scsi: qla2xxx: on session delete, return nvme cmd
scsi: qla2xxx: Fix kernel crash after disconnecting NVMe devices
scsi: megaraid_sas: Update driver version to 07.710.06.00-rc1
scsi: megaraid_sas: Introduce various Aero performance modes
scsi: megaraid_sas: Use high IOPS queues based on IO workload
scsi: megaraid_sas: Set affinity for high IOPS reply queues
scsi: megaraid_sas: Enable coalescing for high IOPS queues
scsi: megaraid_sas: Add support for High IOPS queues
scsi: megaraid_sas: Add support for MPI toolbox commands
scsi: megaraid_sas: Offload Aero RAID5/6 division calculations to driver
scsi: megaraid_sas: RAID1 PCI bandwidth limit algorithm is applicable for only Ventura
scsi: megaraid_sas: megaraid_sas: Add check for count returned by HOST_DEVICE_LIST DCMD
scsi: megaraid_sas: Handle sequence JBOD map failure at driver level
scsi: megaraid_sas: Don't send FPIO to RL Bypass queue
scsi: megaraid_sas: In probe context, retry IOC INIT once if firmware is in fault
scsi: megaraid_sas: Release Mutex lock before OCR in case of DCMD timeout
scsi: megaraid_sas: Call disable_irq from process IRQ poll
scsi: megaraid_sas: Remove few debug counters from IO path
...
2019-07-11 22:14:01 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2006-08-29 14:22:51 +00:00
|
|
|
/*
|
|
|
|
* SAS host prototypes and structures header file
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Adaptec, Inc. All rights reserved.
|
|
|
|
* Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _LIBSAS_H_
|
|
|
|
#define _LIBSAS_H_
|
|
|
|
|
|
|
|
|
|
|
|
#include <linux/timer.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <scsi/sas.h>
|
2006-08-11 02:19:47 +00:00
|
|
|
#include <linux/libata.h>
|
2006-08-29 14:22:51 +00:00
|
|
|
#include <linux/list.h>
|
|
|
|
#include <scsi/scsi_device.h>
|
|
|
|
#include <scsi/scsi_cmnd.h>
|
|
|
|
#include <scsi/scsi_transport_sas.h>
|
2007-10-30 09:35:04 +00:00
|
|
|
#include <linux/scatterlist.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 08:04:11 +00:00
|
|
|
#include <linux/slab.h>
|
2006-08-29 14:22:51 +00:00
|
|
|
|
|
|
|
struct block_device;
|
|
|
|
|
|
|
|
enum sas_class {
|
|
|
|
SAS,
|
|
|
|
EXPANDER
|
|
|
|
};
|
|
|
|
|
|
|
|
enum sas_phy_role {
|
|
|
|
PHY_ROLE_NONE = 0,
|
|
|
|
PHY_ROLE_TARGET = 0x40,
|
|
|
|
PHY_ROLE_INITIATOR = 0x80,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum sas_phy_type {
|
2019-01-04 16:01:26 +00:00
|
|
|
PHY_TYPE_PHYSICAL,
|
|
|
|
PHY_TYPE_VIRTUAL
|
2006-08-29 14:22:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* The events are mnemonically described in sas_dump.c
|
|
|
|
* so when updating/adding events here, please also
|
|
|
|
* update the other file too.
|
|
|
|
*/
|
|
|
|
enum port_event {
|
|
|
|
PORTE_BYTES_DMAED = 0U,
|
2017-09-06 09:15:05 +00:00
|
|
|
PORTE_BROADCAST_RCVD,
|
|
|
|
PORTE_LINK_RESET_ERR,
|
|
|
|
PORTE_TIMER_EVENT,
|
|
|
|
PORTE_HARD_RESET,
|
|
|
|
PORT_NUM_EVENTS,
|
2006-08-29 14:22:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum phy_event {
|
|
|
|
PHYE_LOSS_OF_SIGNAL = 0U,
|
2017-09-06 09:15:05 +00:00
|
|
|
PHYE_OOB_DONE,
|
|
|
|
PHYE_OOB_ERROR,
|
|
|
|
PHYE_SPINUP_HOLD, /* hot plug SATA, no COMWAKE sent */
|
|
|
|
PHYE_RESUME_TIMEOUT,
|
2017-12-08 09:42:05 +00:00
|
|
|
PHYE_SHUTDOWN,
|
2017-09-06 09:15:05 +00:00
|
|
|
PHY_NUM_EVENTS,
|
2006-08-29 14:22:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum discover_event {
|
|
|
|
DISCE_DISCOVER_DOMAIN = 0U,
|
2017-09-06 09:15:05 +00:00
|
|
|
DISCE_REVALIDATE_DOMAIN,
|
|
|
|
DISCE_SUSPEND,
|
|
|
|
DISCE_RESUME,
|
|
|
|
DISC_NUM_EVENTS,
|
2006-08-29 14:22:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* ---------- Expander Devices ---------- */
|
|
|
|
|
|
|
|
#define to_dom_device(_obj) container_of(_obj, struct domain_device, dev_obj)
|
|
|
|
#define to_dev_attr(_attr) container_of(_attr, struct domain_dev_attribute,\
|
2019-01-04 16:01:26 +00:00
|
|
|
attr)
|
2006-08-29 14:22:51 +00:00
|
|
|
|
|
|
|
enum routing_attribute {
|
|
|
|
DIRECT_ROUTING,
|
|
|
|
SUBTRACTIVE_ROUTING,
|
|
|
|
TABLE_ROUTING,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ex_phy_state {
|
|
|
|
PHY_EMPTY,
|
|
|
|
PHY_VACANT,
|
|
|
|
PHY_NOT_PRESENT,
|
|
|
|
PHY_DEVICE_DISCOVERED
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ex_phy {
|
|
|
|
int phy_id;
|
|
|
|
|
|
|
|
enum ex_phy_state phy_state;
|
|
|
|
|
2013-05-07 21:44:06 +00:00
|
|
|
enum sas_device_type attached_dev_type;
|
2006-09-06 22:36:13 +00:00
|
|
|
enum sas_linkrate linkrate;
|
2006-08-29 14:22:51 +00:00
|
|
|
|
|
|
|
u8 attached_sata_host:1;
|
|
|
|
u8 attached_sata_dev:1;
|
|
|
|
u8 attached_sata_ps:1;
|
|
|
|
|
2007-11-05 19:51:17 +00:00
|
|
|
enum sas_protocol attached_tproto;
|
|
|
|
enum sas_protocol attached_iproto;
|
2006-08-29 14:22:51 +00:00
|
|
|
|
|
|
|
u8 attached_sas_addr[SAS_ADDR_SIZE];
|
|
|
|
u8 attached_phy_id;
|
|
|
|
|
2012-06-22 06:41:51 +00:00
|
|
|
int phy_change_count;
|
2006-08-29 14:22:51 +00:00
|
|
|
enum routing_attribute routing_attr;
|
|
|
|
u8 virtual:1;
|
|
|
|
|
|
|
|
int last_da_index;
|
|
|
|
|
|
|
|
struct sas_phy *phy;
|
|
|
|
struct sas_port *port;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct expander_device {
|
|
|
|
struct list_head children;
|
|
|
|
|
2012-06-22 06:41:51 +00:00
|
|
|
int ex_change_count;
|
2006-08-29 14:22:51 +00:00
|
|
|
u16 max_route_indexes;
|
|
|
|
u8 num_phys;
|
2011-09-22 16:41:36 +00:00
|
|
|
|
|
|
|
u8 t2t_supp:1;
|
2006-08-29 14:22:51 +00:00
|
|
|
u8 configuring:1;
|
|
|
|
u8 conf_route_table:1;
|
2011-09-22 16:41:36 +00:00
|
|
|
|
2006-08-29 14:22:51 +00:00
|
|
|
u8 enclosure_logical_id[8];
|
|
|
|
|
|
|
|
struct ex_phy *ex_phy;
|
|
|
|
struct sas_port *parent_port;
|
2011-11-16 09:44:13 +00:00
|
|
|
|
|
|
|
struct mutex cmd_mutex;
|
2006-08-29 14:22:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* ---------- SATA device ---------- */
|
2012-06-22 17:52:34 +00:00
|
|
|
#define ATA_RESP_FIS_SIZE 24
|
|
|
|
|
2006-08-29 14:22:51 +00:00
|
|
|
struct sata_device {
|
2014-11-05 12:08:20 +00:00
|
|
|
unsigned int class;
|
|
|
|
u8 port_no; /* port number, if this is a PM (Port) */
|
2006-08-11 02:19:47 +00:00
|
|
|
|
|
|
|
struct ata_port *ap;
|
2018-05-10 03:05:16 +00:00
|
|
|
struct ata_host *ata_host;
|
2022-06-09 02:24:56 +00:00
|
|
|
struct smp_rps_resp rps_resp ____cacheline_aligned; /* report_phy_sata_resp */
|
2012-06-22 17:52:34 +00:00
|
|
|
u8 fis[ATA_RESP_FIS_SIZE];
|
2006-08-29 14:22:51 +00:00
|
|
|
};
|
|
|
|
|
2012-06-22 06:30:48 +00:00
|
|
|
struct ssp_device {
|
|
|
|
struct list_head eh_list_node; /* pending a user requested eh action */
|
|
|
|
struct scsi_lun reset_lun;
|
|
|
|
};
|
|
|
|
|
2012-01-07 08:52:39 +00:00
|
|
|
enum {
|
|
|
|
SAS_DEV_GONE,
|
2012-06-22 06:41:51 +00:00
|
|
|
SAS_DEV_FOUND, /* device notified to lldd */
|
2011-11-18 01:59:51 +00:00
|
|
|
SAS_DEV_DESTROY,
|
2012-06-22 06:25:27 +00:00
|
|
|
SAS_DEV_EH_PENDING,
|
2012-06-22 06:30:48 +00:00
|
|
|
SAS_DEV_LU_RESET,
|
|
|
|
SAS_DEV_RESET,
|
2012-01-07 08:52:39 +00:00
|
|
|
};
|
|
|
|
|
2006-08-29 14:22:51 +00:00
|
|
|
struct domain_device {
|
2011-11-28 19:29:20 +00:00
|
|
|
spinlock_t done_lock;
|
2013-05-07 21:44:06 +00:00
|
|
|
enum sas_device_type dev_type;
|
2006-08-29 14:22:51 +00:00
|
|
|
|
2019-01-04 16:01:26 +00:00
|
|
|
enum sas_linkrate linkrate;
|
|
|
|
enum sas_linkrate min_linkrate;
|
|
|
|
enum sas_linkrate max_linkrate;
|
2006-08-29 14:22:51 +00:00
|
|
|
|
2019-01-04 16:01:26 +00:00
|
|
|
int pathways;
|
2006-08-29 14:22:51 +00:00
|
|
|
|
2019-01-04 16:01:26 +00:00
|
|
|
struct domain_device *parent;
|
|
|
|
struct list_head siblings; /* devices on the same level */
|
|
|
|
struct asd_sas_port *port; /* shortcut to root of the tree */
|
2011-12-22 05:33:17 +00:00
|
|
|
struct sas_phy *phy;
|
2006-08-29 14:22:51 +00:00
|
|
|
|
2019-01-04 16:01:26 +00:00
|
|
|
struct list_head dev_list_node;
|
2011-11-18 01:59:51 +00:00
|
|
|
struct list_head disco_list_node; /* awaiting probe or destruct */
|
2006-08-29 14:22:51 +00:00
|
|
|
|
2019-01-04 16:01:26 +00:00
|
|
|
enum sas_protocol iproto;
|
|
|
|
enum sas_protocol tproto;
|
2006-08-29 14:22:51 +00:00
|
|
|
|
2019-01-04 16:01:26 +00:00
|
|
|
struct sas_rphy *rphy;
|
2006-08-29 14:22:51 +00:00
|
|
|
|
2019-01-04 16:01:26 +00:00
|
|
|
u8 sas_addr[SAS_ADDR_SIZE];
|
|
|
|
u8 hashed_sas_addr[HASHED_SAS_ADDR_SIZE];
|
2006-08-29 14:22:51 +00:00
|
|
|
|
2019-01-04 16:01:26 +00:00
|
|
|
u8 frame_rcvd[32];
|
2006-08-29 14:22:51 +00:00
|
|
|
|
2019-01-04 16:01:26 +00:00
|
|
|
union {
|
|
|
|
struct expander_device ex_dev;
|
|
|
|
struct sata_device sata_dev; /* STP & directly attached */
|
2012-06-22 06:30:48 +00:00
|
|
|
struct ssp_device ssp_dev;
|
2019-01-04 16:01:26 +00:00
|
|
|
};
|
2006-08-29 14:22:51 +00:00
|
|
|
|
2019-01-04 16:01:26 +00:00
|
|
|
void *lldd_dev;
|
2012-01-07 08:52:39 +00:00
|
|
|
unsigned long state;
|
2011-11-18 01:59:47 +00:00
|
|
|
struct kref kref;
|
2006-08-29 14:22:51 +00:00
|
|
|
};
|
|
|
|
|
2012-03-09 19:00:06 +00:00
|
|
|
struct sas_work {
|
|
|
|
struct list_head drain_node;
|
2006-11-22 14:57:56 +00:00
|
|
|
struct work_struct work;
|
2012-03-09 19:00:06 +00:00
|
|
|
};
|
|
|
|
|
2019-06-10 12:41:41 +00:00
|
|
|
static inline bool dev_is_expander(enum sas_device_type type)
|
2019-04-12 08:57:55 +00:00
|
|
|
{
|
|
|
|
return type == SAS_EDGE_EXPANDER_DEVICE ||
|
|
|
|
type == SAS_FANOUT_EXPANDER_DEVICE;
|
|
|
|
}
|
|
|
|
|
2012-03-09 19:00:06 +00:00
|
|
|
static inline void INIT_SAS_WORK(struct sas_work *sw, void (*fn)(struct work_struct *))
|
|
|
|
{
|
|
|
|
INIT_WORK(&sw->work, fn);
|
|
|
|
INIT_LIST_HEAD(&sw->drain_node);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct sas_discovery_event {
|
|
|
|
struct sas_work work;
|
2006-11-22 14:57:56 +00:00
|
|
|
struct asd_sas_port *port;
|
|
|
|
};
|
|
|
|
|
2012-03-09 19:00:06 +00:00
|
|
|
static inline struct sas_discovery_event *to_sas_discovery_event(struct work_struct *work)
|
|
|
|
{
|
|
|
|
struct sas_discovery_event *ev = container_of(work, typeof(*ev), work.work);
|
|
|
|
|
|
|
|
return ev;
|
|
|
|
}
|
|
|
|
|
2006-08-29 14:22:51 +00:00
|
|
|
struct sas_discovery {
|
2006-11-22 14:57:56 +00:00
|
|
|
struct sas_discovery_event disc_work[DISC_NUM_EVENTS];
|
2006-08-29 14:22:51 +00:00
|
|
|
unsigned long pending;
|
2019-04-12 08:57:52 +00:00
|
|
|
u8 fanout_sas_addr[SAS_ADDR_SIZE];
|
|
|
|
u8 eeds_a[SAS_ADDR_SIZE];
|
|
|
|
u8 eeds_b[SAS_ADDR_SIZE];
|
2006-08-29 14:22:51 +00:00
|
|
|
int max_level;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* The port struct is Class:RW, driver:RO */
|
|
|
|
struct asd_sas_port {
|
|
|
|
/* private: */
|
|
|
|
struct sas_discovery disc;
|
|
|
|
struct domain_device *port_dev;
|
|
|
|
spinlock_t dev_list_lock;
|
|
|
|
struct list_head dev_list;
|
2011-11-18 01:59:51 +00:00
|
|
|
struct list_head disco_list;
|
|
|
|
struct list_head destroy_list;
|
2017-12-08 09:42:09 +00:00
|
|
|
struct list_head sas_port_del_list;
|
2006-09-06 22:36:13 +00:00
|
|
|
enum sas_linkrate linkrate;
|
2006-08-29 14:22:51 +00:00
|
|
|
|
2012-03-09 19:00:06 +00:00
|
|
|
struct sas_work work;
|
2012-06-22 06:41:51 +00:00
|
|
|
int suspended;
|
2006-08-29 14:22:51 +00:00
|
|
|
|
|
|
|
/* public: */
|
|
|
|
int id;
|
|
|
|
|
|
|
|
enum sas_class class;
|
|
|
|
u8 sas_addr[SAS_ADDR_SIZE];
|
|
|
|
u8 attached_sas_addr[SAS_ADDR_SIZE];
|
2007-11-05 19:51:17 +00:00
|
|
|
enum sas_protocol iproto;
|
|
|
|
enum sas_protocol tproto;
|
2006-08-29 14:22:51 +00:00
|
|
|
|
|
|
|
enum sas_oob_mode oob_mode;
|
|
|
|
|
|
|
|
spinlock_t phy_list_lock;
|
|
|
|
struct list_head phy_list;
|
|
|
|
int num_phys;
|
|
|
|
u32 phy_mask;
|
|
|
|
|
|
|
|
struct sas_ha_struct *ha;
|
|
|
|
|
|
|
|
struct sas_port *port;
|
|
|
|
|
|
|
|
void *lldd_port; /* not touched by the sas class code */
|
|
|
|
};
|
|
|
|
|
2006-11-22 14:57:56 +00:00
|
|
|
struct asd_sas_event {
|
2012-03-09 19:00:06 +00:00
|
|
|
struct sas_work work;
|
2006-11-22 14:57:56 +00:00
|
|
|
struct asd_sas_phy *phy;
|
2017-12-08 09:42:04 +00:00
|
|
|
int event;
|
2006-11-22 14:57:56 +00:00
|
|
|
};
|
|
|
|
|
2012-03-09 19:00:06 +00:00
|
|
|
static inline struct asd_sas_event *to_asd_sas_event(struct work_struct *work)
|
|
|
|
{
|
|
|
|
struct asd_sas_event *ev = container_of(work, typeof(*ev), work.work);
|
|
|
|
|
|
|
|
return ev;
|
|
|
|
}
|
|
|
|
|
2017-12-08 09:42:04 +00:00
|
|
|
static inline void INIT_SAS_EVENT(struct asd_sas_event *ev,
|
|
|
|
void (*fn)(struct work_struct *),
|
|
|
|
struct asd_sas_phy *phy, int event)
|
|
|
|
{
|
|
|
|
INIT_SAS_WORK(&ev->work, fn);
|
|
|
|
ev->phy = phy;
|
|
|
|
ev->event = event;
|
|
|
|
}
|
|
|
|
|
2017-12-08 09:42:05 +00:00
|
|
|
#define SAS_PHY_SHUTDOWN_THRES 1024
|
2017-12-08 09:42:04 +00:00
|
|
|
|
2006-08-29 14:22:51 +00:00
|
|
|
/* The phy pretty much is controlled by the LLDD.
|
|
|
|
* The class only reads those fields.
|
|
|
|
*/
|
|
|
|
struct asd_sas_phy {
|
|
|
|
/* private: */
|
2017-12-08 09:42:05 +00:00
|
|
|
atomic_t event_nr;
|
|
|
|
int in_shutdown;
|
2006-08-29 14:22:51 +00:00
|
|
|
int error;
|
2012-06-22 06:41:51 +00:00
|
|
|
int suspended;
|
2006-08-29 14:22:51 +00:00
|
|
|
|
|
|
|
struct sas_phy *phy;
|
|
|
|
|
|
|
|
/* public: */
|
|
|
|
/* The following are class:RO, driver:R/W */
|
|
|
|
int enabled; /* must be set */
|
|
|
|
|
|
|
|
int id; /* must be set */
|
|
|
|
enum sas_class class;
|
2007-11-05 19:51:17 +00:00
|
|
|
enum sas_protocol iproto;
|
|
|
|
enum sas_protocol tproto;
|
2006-08-29 14:22:51 +00:00
|
|
|
|
|
|
|
enum sas_phy_type type;
|
|
|
|
enum sas_phy_role role;
|
|
|
|
enum sas_oob_mode oob_mode;
|
2006-09-06 22:36:13 +00:00
|
|
|
enum sas_linkrate linkrate;
|
2006-08-29 14:22:51 +00:00
|
|
|
|
|
|
|
u8 *sas_addr; /* must be set */
|
|
|
|
u8 attached_sas_addr[SAS_ADDR_SIZE]; /* class:RO, driver: R/W */
|
|
|
|
|
|
|
|
spinlock_t frame_rcvd_lock;
|
|
|
|
u8 *frame_rcvd; /* must be set */
|
|
|
|
int frame_rcvd_size;
|
|
|
|
|
|
|
|
spinlock_t sas_prim_lock;
|
|
|
|
u32 sas_prim;
|
|
|
|
|
|
|
|
struct list_head port_phy_el; /* driver:RO */
|
|
|
|
struct asd_sas_port *port; /* Class:RW, driver: RO */
|
|
|
|
|
|
|
|
struct sas_ha_struct *ha; /* may be set; the class sets it anyway */
|
|
|
|
|
|
|
|
void *lldd_phy; /* not touched by the sas_class_code */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct scsi_core {
|
|
|
|
struct Scsi_Host *shost;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2007-01-11 22:15:43 +00:00
|
|
|
enum sas_ha_state {
|
|
|
|
SAS_HA_REGISTERED,
|
2011-12-20 00:42:34 +00:00
|
|
|
SAS_HA_DRAINING,
|
2011-11-18 01:59:51 +00:00
|
|
|
SAS_HA_ATA_EH_ACTIVE,
|
2011-11-28 19:29:20 +00:00
|
|
|
SAS_HA_FROZEN,
|
2021-12-20 11:21:33 +00:00
|
|
|
SAS_HA_RESUMING,
|
2007-01-11 22:15:43 +00:00
|
|
|
};
|
|
|
|
|
2006-08-29 14:22:51 +00:00
|
|
|
struct sas_ha_struct {
|
|
|
|
/* private: */
|
2011-12-20 00:42:34 +00:00
|
|
|
struct list_head defer_q; /* work queued while draining */
|
|
|
|
struct mutex drain_mutex;
|
2011-12-20 01:02:25 +00:00
|
|
|
unsigned long state;
|
2012-06-22 06:25:27 +00:00
|
|
|
spinlock_t lock;
|
|
|
|
int eh_active;
|
2012-06-22 06:30:48 +00:00
|
|
|
wait_queue_head_t eh_wait_q;
|
|
|
|
struct list_head eh_dev_q;
|
2007-01-11 22:15:43 +00:00
|
|
|
|
2011-11-18 01:59:51 +00:00
|
|
|
struct mutex disco_mutex;
|
|
|
|
|
2006-08-29 14:22:51 +00:00
|
|
|
struct scsi_core core;
|
|
|
|
|
|
|
|
/* public: */
|
|
|
|
char *sas_ha_name;
|
2007-07-26 13:28:37 +00:00
|
|
|
struct device *dev; /* should be set */
|
2006-08-29 14:22:51 +00:00
|
|
|
|
2017-12-08 09:42:07 +00:00
|
|
|
struct workqueue_struct *event_q;
|
|
|
|
struct workqueue_struct *disco_q;
|
|
|
|
|
2006-08-29 14:22:51 +00:00
|
|
|
u8 *sas_addr; /* must be set */
|
|
|
|
u8 hashed_sas_addr[HASHED_SAS_ADDR_SIZE];
|
|
|
|
|
|
|
|
spinlock_t phy_port_lock;
|
|
|
|
struct asd_sas_phy **sas_phy; /* array of valid pointers, must be set */
|
|
|
|
struct asd_sas_port **sas_port; /* array of valid pointers, must be set */
|
|
|
|
int num_phys; /* must be set, gt 0, static */
|
|
|
|
|
2010-10-01 20:55:52 +00:00
|
|
|
int strict_wide_ports; /* both sas_addr and attached_sas_addr must match
|
|
|
|
* their siblings when forming wide ports */
|
2006-08-29 14:22:51 +00:00
|
|
|
|
|
|
|
void *lldd_ha; /* not touched by sas class code */
|
2006-10-30 23:18:39 +00:00
|
|
|
|
2011-11-29 20:08:50 +00:00
|
|
|
struct list_head eh_done_q; /* complete via scsi_eh_flush_done_q */
|
|
|
|
struct list_head eh_ata_q; /* scmds to promote from sas to ata eh */
|
2017-12-08 09:42:05 +00:00
|
|
|
|
|
|
|
int event_thres;
|
2006-08-29 14:22:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define SHOST_TO_SAS_HA(_shost) (*(struct sas_ha_struct **)(_shost)->hostdata)
|
|
|
|
|
|
|
|
static inline struct domain_device *
|
|
|
|
starget_to_domain_dev(struct scsi_target *starget) {
|
|
|
|
return starget->hostdata;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct domain_device *
|
|
|
|
sdev_to_domain_dev(struct scsi_device *sdev) {
|
|
|
|
return starget_to_domain_dev(sdev->sdev_target);
|
|
|
|
}
|
|
|
|
|
2011-10-01 01:52:19 +00:00
|
|
|
static inline struct ata_device *sas_to_ata_dev(struct domain_device *dev)
|
|
|
|
{
|
|
|
|
return &dev->sata_dev.ap->link.device[0];
|
|
|
|
}
|
|
|
|
|
2006-08-29 14:22:51 +00:00
|
|
|
static inline struct domain_device *
|
|
|
|
cmd_to_domain_dev(struct scsi_cmnd *cmd)
|
|
|
|
{
|
|
|
|
return sdev_to_domain_dev(cmd->device);
|
|
|
|
}
|
|
|
|
|
|
|
|
void sas_hash_addr(u8 *hashed, const u8 *sas_addr);
|
|
|
|
|
|
|
|
/* Before calling a notify event, LLDD should use this function
|
|
|
|
* when the link is severed (possibly from its tasklet).
|
|
|
|
* The idea is that the Class only reads those, while the LLDD,
|
|
|
|
* can R/W these (thus avoiding a race).
|
|
|
|
*/
|
|
|
|
static inline void sas_phy_disconnected(struct asd_sas_phy *phy)
|
|
|
|
{
|
|
|
|
phy->oob_mode = OOB_NOT_CONNECTED;
|
2006-09-06 22:36:13 +00:00
|
|
|
phy->linkrate = SAS_LINK_RATE_UNKNOWN;
|
2006-08-29 14:22:51 +00:00
|
|
|
}
|
|
|
|
|
2011-09-02 04:18:20 +00:00
|
|
|
static inline unsigned int to_sas_gpio_od(int device, int bit)
|
|
|
|
{
|
|
|
|
return 3 * device + bit;
|
|
|
|
}
|
|
|
|
|
2011-12-22 05:33:17 +00:00
|
|
|
static inline void sas_put_local_phy(struct sas_phy *phy)
|
|
|
|
{
|
|
|
|
put_device(&phy->dev);
|
|
|
|
}
|
|
|
|
|
2011-09-23 23:43:45 +00:00
|
|
|
#ifdef CONFIG_SCSI_SAS_HOST_SMP
|
2011-09-02 04:18:20 +00:00
|
|
|
int try_test_sas_gpio_gp_bit(unsigned int od, u8 *data, u8 index, u8 count);
|
2011-09-23 23:43:45 +00:00
|
|
|
#else
|
|
|
|
static inline int try_test_sas_gpio_gp_bit(unsigned int od, u8 *data, u8 index, u8 count)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
#endif
|
2011-09-02 04:18:20 +00:00
|
|
|
|
2006-08-29 14:22:51 +00:00
|
|
|
/* ---------- Tasks ---------- */
|
|
|
|
/*
|
|
|
|
service_response | SAS_TASK_COMPLETE | SAS_TASK_UNDELIVERED |
|
|
|
|
exec_status | | |
|
|
|
|
---------------------+---------------------+-----------------------+
|
|
|
|
SAM_... | X | |
|
|
|
|
DEV_NO_RESPONSE | X | X |
|
|
|
|
INTERRUPTED | X | |
|
|
|
|
QUEUE_FULL | | X |
|
|
|
|
DEVICE_UNKNOWN | | X |
|
|
|
|
SG_ERR | | X |
|
|
|
|
---------------------+---------------------+-----------------------+
|
|
|
|
*/
|
|
|
|
|
|
|
|
enum service_response {
|
|
|
|
SAS_TASK_COMPLETE,
|
|
|
|
SAS_TASK_UNDELIVERED = -1,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum exec_status {
|
2021-05-24 02:54:55 +00:00
|
|
|
/*
|
|
|
|
* Values 0..0x7f are used to return the SAM_STAT_* codes. To avoid
|
|
|
|
* 'case value not in enumerated type' compiler warnings every value
|
|
|
|
* returned through the exec_status enum needs an alias with the SAS_
|
|
|
|
* prefix here.
|
2011-12-07 07:24:42 +00:00
|
|
|
*/
|
2021-05-24 02:54:55 +00:00
|
|
|
SAS_SAM_STAT_GOOD = SAM_STAT_GOOD,
|
|
|
|
SAS_SAM_STAT_BUSY = SAM_STAT_BUSY,
|
|
|
|
SAS_SAM_STAT_TASK_ABORTED = SAM_STAT_TASK_ABORTED,
|
|
|
|
SAS_SAM_STAT_CHECK_CONDITION = SAM_STAT_CHECK_CONDITION,
|
2006-08-29 14:22:51 +00:00
|
|
|
|
|
|
|
SAS_DEV_NO_RESPONSE = 0x80,
|
|
|
|
SAS_DATA_UNDERRUN,
|
|
|
|
SAS_DATA_OVERRUN,
|
|
|
|
SAS_INTERRUPTED,
|
|
|
|
SAS_QUEUE_FULL,
|
|
|
|
SAS_DEVICE_UNKNOWN,
|
|
|
|
SAS_OPEN_REJECT,
|
|
|
|
SAS_OPEN_TO,
|
|
|
|
SAS_PROTO_RESPONSE,
|
|
|
|
SAS_PHY_DOWN,
|
|
|
|
SAS_NAK_R_ERR,
|
|
|
|
SAS_PENDING,
|
|
|
|
SAS_ABORTED_TASK,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* When a task finishes with a response, the LLDD examines the
|
|
|
|
* response:
|
2019-01-04 16:01:26 +00:00
|
|
|
* - For an ATA task task_status_struct::stat is set to
|
2006-08-29 14:22:51 +00:00
|
|
|
* SAS_PROTO_RESPONSE, and the task_status_struct::buf is set to the
|
|
|
|
* contents of struct ata_task_resp.
|
2019-01-04 16:01:26 +00:00
|
|
|
* - For SSP tasks, if no data is present or status/TMF response
|
2006-08-29 14:22:51 +00:00
|
|
|
* is valid, task_status_struct::stat is set. If data is present
|
|
|
|
* (SENSE data), the LLDD copies up to SAS_STATUS_BUF_SIZE, sets
|
|
|
|
* task_status_struct::buf_valid_size, and task_status_struct::stat is
|
|
|
|
* set to SAM_CHECK_COND.
|
|
|
|
*
|
|
|
|
* "buf" has format SCSI Sense for SSP task, or struct ata_task_resp
|
|
|
|
* for ATA task.
|
|
|
|
*
|
|
|
|
* "frame_len" is the total frame length, which could be more or less
|
|
|
|
* than actually copied.
|
|
|
|
*
|
|
|
|
* Tasks ending with response, always set the residual field.
|
|
|
|
*/
|
|
|
|
struct ata_task_resp {
|
|
|
|
u16 frame_len;
|
2012-06-22 17:52:34 +00:00
|
|
|
u8 ending_fis[ATA_RESP_FIS_SIZE]; /* dev to host or data-in */
|
2006-08-29 14:22:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define SAS_STATUS_BUF_SIZE 96
|
|
|
|
|
|
|
|
struct task_status_struct {
|
|
|
|
enum service_response resp;
|
|
|
|
enum exec_status stat;
|
|
|
|
int buf_valid_size;
|
|
|
|
|
|
|
|
u8 buf[SAS_STATUS_BUF_SIZE];
|
|
|
|
|
|
|
|
u32 residual;
|
|
|
|
enum sas_open_rej_reason open_rej_reason;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* ATA and ATAPI task queuable to a SAS LLDD.
|
|
|
|
*/
|
|
|
|
struct sas_ata_task {
|
|
|
|
struct host_to_dev_fis fis;
|
|
|
|
u8 atapi_packet[16]; /* 0 if not ATAPI task */
|
|
|
|
|
|
|
|
u8 retry_count; /* hardware retry, should be > 0 */
|
|
|
|
|
|
|
|
u8 dma_xfer:1; /* PIO:0 or DMA:1 */
|
|
|
|
u8 use_ncq:1;
|
|
|
|
u8 set_affil_pol:1;
|
|
|
|
u8 stp_affil_pol:1;
|
|
|
|
|
|
|
|
u8 device_control_reg_update:1;
|
2022-02-22 12:50:59 +00:00
|
|
|
|
|
|
|
bool force_phy;
|
|
|
|
int force_phy_id;
|
2006-08-29 14:22:51 +00:00
|
|
|
};
|
|
|
|
|
2022-03-11 12:23:49 +00:00
|
|
|
/* LLDDs rely on these values */
|
|
|
|
enum sas_internal_abort {
|
|
|
|
SAS_INTERNAL_ABORT_SINGLE = 0,
|
2022-03-11 12:23:50 +00:00
|
|
|
SAS_INTERNAL_ABORT_DEV = 1,
|
2022-03-11 12:23:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct sas_internal_abort_task {
|
|
|
|
enum sas_internal_abort type;
|
2022-03-11 12:23:52 +00:00
|
|
|
unsigned int qid;
|
2022-03-11 12:23:49 +00:00
|
|
|
u16 tag;
|
|
|
|
};
|
|
|
|
|
2006-08-29 14:22:51 +00:00
|
|
|
struct sas_smp_task {
|
|
|
|
struct scatterlist smp_req;
|
|
|
|
struct scatterlist smp_resp;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum task_attribute {
|
|
|
|
TASK_ATTR_SIMPLE = 0,
|
|
|
|
TASK_ATTR_HOQ = 1,
|
|
|
|
TASK_ATTR_ORDERED= 2,
|
|
|
|
TASK_ATTR_ACA = 4,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sas_ssp_task {
|
|
|
|
u8 retry_count; /* hardware retry, should be > 0 */
|
|
|
|
|
|
|
|
u8 LUN[8];
|
|
|
|
u8 enable_first_burst:1;
|
|
|
|
enum task_attribute task_attr;
|
|
|
|
u8 task_prio;
|
2013-05-07 22:38:18 +00:00
|
|
|
struct scsi_cmnd *cmd;
|
2006-08-29 14:22:51 +00:00
|
|
|
};
|
|
|
|
|
2022-02-17 15:42:35 +00:00
|
|
|
struct sas_tmf_task {
|
|
|
|
u8 tmf;
|
|
|
|
u16 tag_of_task_to_be_managed;
|
|
|
|
};
|
|
|
|
|
2006-08-29 14:22:51 +00:00
|
|
|
struct sas_task {
|
|
|
|
struct domain_device *dev;
|
|
|
|
|
|
|
|
spinlock_t task_state_lock;
|
|
|
|
unsigned task_state_flags;
|
|
|
|
|
2007-11-05 19:51:17 +00:00
|
|
|
enum sas_protocol task_proto;
|
2006-08-29 14:22:51 +00:00
|
|
|
|
|
|
|
union {
|
|
|
|
struct sas_ata_task ata_task;
|
|
|
|
struct sas_smp_task smp_task;
|
|
|
|
struct sas_ssp_task ssp_task;
|
2022-03-11 12:23:49 +00:00
|
|
|
struct sas_internal_abort_task abort_task;
|
2006-08-29 14:22:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct scatterlist *scatter;
|
|
|
|
int num_scatter;
|
|
|
|
u32 total_xfer_len;
|
|
|
|
u8 data_dir:2; /* Use PCI_DMA_... */
|
|
|
|
|
|
|
|
struct task_status_struct task_status;
|
|
|
|
void (*task_done)(struct sas_task *);
|
|
|
|
|
|
|
|
void *lldd_task; /* for use by LLDDs */
|
|
|
|
void *uldd_task;
|
2012-06-22 06:36:30 +00:00
|
|
|
struct sas_task_slow *slow_task;
|
2022-02-17 15:42:36 +00:00
|
|
|
struct sas_tmf_task *tmf;
|
2012-06-22 06:36:30 +00:00
|
|
|
};
|
2006-10-30 23:18:50 +00:00
|
|
|
|
2012-06-22 06:36:30 +00:00
|
|
|
struct sas_task_slow {
|
|
|
|
/* standard/extra infrastructure for slow path commands (SMP and
|
|
|
|
* internal lldd commands
|
|
|
|
*/
|
|
|
|
struct timer_list timer;
|
|
|
|
struct completion completion;
|
2017-08-22 23:05:14 +00:00
|
|
|
struct sas_task *task;
|
2006-08-29 14:22:51 +00:00
|
|
|
};
|
|
|
|
|
2006-10-30 23:18:39 +00:00
|
|
|
#define SAS_TASK_STATE_PENDING 1
|
|
|
|
#define SAS_TASK_STATE_DONE 2
|
|
|
|
#define SAS_TASK_STATE_ABORTED 4
|
2007-01-11 22:15:17 +00:00
|
|
|
#define SAS_TASK_NEED_DEV_RESET 8
|
2006-08-29 14:22:51 +00:00
|
|
|
|
2022-03-11 12:23:50 +00:00
|
|
|
static inline bool sas_is_internal_abort(struct sas_task *task)
|
|
|
|
{
|
|
|
|
return task->task_proto == SAS_PROTOCOL_INTERNAL_ABORT;
|
|
|
|
}
|
|
|
|
|
2022-10-18 11:15:57 +00:00
|
|
|
static inline struct request *sas_task_find_rq(struct sas_task *task)
|
|
|
|
{
|
|
|
|
struct scsi_cmnd *scmd;
|
|
|
|
|
|
|
|
if (task->task_proto & SAS_PROTOCOL_STP_ALL) {
|
|
|
|
struct ata_queued_cmd *qc = task->uldd_task;
|
|
|
|
|
|
|
|
scmd = qc ? qc->scsicmd : NULL;
|
|
|
|
} else {
|
|
|
|
scmd = task->uldd_task;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!scmd)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return scsi_cmd_to_rq(scmd);
|
|
|
|
}
|
|
|
|
|
2006-08-29 14:22:51 +00:00
|
|
|
struct sas_domain_function_template {
|
|
|
|
/* The class calls these to notify the LLDD of an event. */
|
|
|
|
void (*lldd_port_formed)(struct asd_sas_phy *);
|
|
|
|
void (*lldd_port_deformed)(struct asd_sas_phy *);
|
|
|
|
|
|
|
|
/* The class calls these when a device is found or gone. */
|
|
|
|
int (*lldd_dev_found)(struct domain_device *);
|
|
|
|
void (*lldd_dev_gone)(struct domain_device *);
|
|
|
|
|
2014-11-05 09:36:28 +00:00
|
|
|
int (*lldd_execute_task)(struct sas_task *, gfp_t gfp_flags);
|
2006-08-29 14:22:51 +00:00
|
|
|
|
|
|
|
/* Task Management Functions. Must be called from process context. */
|
|
|
|
int (*lldd_abort_task)(struct sas_task *);
|
|
|
|
int (*lldd_abort_task_set)(struct domain_device *, u8 *lun);
|
|
|
|
int (*lldd_clear_task_set)(struct domain_device *, u8 *lun);
|
|
|
|
int (*lldd_I_T_nexus_reset)(struct domain_device *);
|
2011-11-18 01:59:54 +00:00
|
|
|
int (*lldd_ata_check_ready)(struct domain_device *);
|
2011-11-18 01:59:52 +00:00
|
|
|
void (*lldd_ata_set_dmamode)(struct domain_device *);
|
2006-08-29 14:22:51 +00:00
|
|
|
int (*lldd_lu_reset)(struct domain_device *, u8 *lun);
|
|
|
|
int (*lldd_query_task)(struct sas_task *);
|
|
|
|
|
2022-02-17 15:42:39 +00:00
|
|
|
/* Special TMF callbacks */
|
|
|
|
void (*lldd_tmf_exec_complete)(struct domain_device *dev);
|
2022-02-17 15:42:40 +00:00
|
|
|
void (*lldd_tmf_aborted)(struct sas_task *task);
|
2022-03-11 12:23:52 +00:00
|
|
|
bool (*lldd_abort_timeout)(struct sas_task *task, void *data);
|
2022-02-17 15:42:39 +00:00
|
|
|
|
2006-08-29 14:22:51 +00:00
|
|
|
/* Port and Adapter management */
|
|
|
|
int (*lldd_clear_nexus_port)(struct asd_sas_port *);
|
|
|
|
int (*lldd_clear_nexus_ha)(struct sas_ha_struct *);
|
|
|
|
|
|
|
|
/* Phy management */
|
2006-09-07 00:28:07 +00:00
|
|
|
int (*lldd_control_phy)(struct asd_sas_phy *, enum phy_func, void *);
|
2011-09-02 04:18:20 +00:00
|
|
|
|
|
|
|
/* GPIO support */
|
|
|
|
int (*lldd_write_gpio)(struct sas_ha_struct *, u8 reg_type,
|
|
|
|
u8 reg_index, u8 reg_count, u8 *write_data);
|
2006-08-29 14:22:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern int sas_register_ha(struct sas_ha_struct *);
|
|
|
|
extern int sas_unregister_ha(struct sas_ha_struct *);
|
2012-06-22 06:41:51 +00:00
|
|
|
extern void sas_prep_resume_ha(struct sas_ha_struct *sas_ha);
|
|
|
|
extern void sas_resume_ha(struct sas_ha_struct *sas_ha);
|
2021-12-20 11:21:24 +00:00
|
|
|
extern void sas_resume_ha_no_sync(struct sas_ha_struct *sas_ha);
|
2012-06-22 06:41:51 +00:00
|
|
|
extern void sas_suspend_ha(struct sas_ha_struct *sas_ha);
|
2006-08-29 14:22:51 +00:00
|
|
|
|
2019-01-04 16:01:26 +00:00
|
|
|
int sas_set_phy_speed(struct sas_phy *phy, struct sas_phy_linkrates *rates);
|
2006-11-08 01:28:55 +00:00
|
|
|
int sas_phy_reset(struct sas_phy *phy, int hard_reset);
|
2021-10-12 12:26:27 +00:00
|
|
|
int sas_phy_enable(struct sas_phy *phy, int enable);
|
2019-01-04 16:01:26 +00:00
|
|
|
extern int sas_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
|
2006-08-29 14:22:51 +00:00
|
|
|
extern int sas_target_alloc(struct scsi_target *);
|
|
|
|
extern int sas_slave_configure(struct scsi_device *);
|
2014-11-13 14:08:42 +00:00
|
|
|
extern int sas_change_queue_depth(struct scsi_device *, int new_depth);
|
2019-01-04 16:01:26 +00:00
|
|
|
extern int sas_bios_param(struct scsi_device *, struct block_device *,
|
2006-08-29 14:22:51 +00:00
|
|
|
sector_t capacity, int *hsc);
|
2022-03-11 12:23:49 +00:00
|
|
|
int sas_execute_internal_abort_single(struct domain_device *device,
|
|
|
|
u16 tag, unsigned int qid,
|
|
|
|
void *data);
|
2022-03-11 12:23:50 +00:00
|
|
|
int sas_execute_internal_abort_dev(struct domain_device *device,
|
|
|
|
unsigned int qid, void *data);
|
2006-08-29 14:22:51 +00:00
|
|
|
extern struct scsi_transport_template *
|
|
|
|
sas_domain_attach_transport(struct sas_domain_function_template *);
|
2017-12-08 09:42:06 +00:00
|
|
|
extern struct device_attribute dev_attr_phy_event_threshold;
|
2006-08-29 14:22:51 +00:00
|
|
|
|
|
|
|
int sas_discover_root_expander(struct domain_device *);
|
|
|
|
|
|
|
|
void sas_init_ex_attr(void);
|
|
|
|
|
|
|
|
int sas_ex_revalidate_domain(struct domain_device *);
|
|
|
|
|
2012-01-10 22:39:13 +00:00
|
|
|
void sas_unregister_domain_devices(struct asd_sas_port *port, int gone);
|
2006-08-29 14:22:51 +00:00
|
|
|
void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *);
|
2022-02-11 06:42:55 +00:00
|
|
|
void sas_discover_event(struct asd_sas_port *, enum discover_event ev);
|
2006-08-29 14:22:51 +00:00
|
|
|
|
|
|
|
int sas_discover_end_dev(struct domain_device *);
|
|
|
|
|
2011-09-22 05:05:34 +00:00
|
|
|
void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *);
|
2006-08-29 14:22:51 +00:00
|
|
|
|
|
|
|
void sas_init_dev(struct domain_device *);
|
|
|
|
|
2007-01-11 22:15:20 +00:00
|
|
|
void sas_task_abort(struct sas_task *);
|
2012-06-22 06:30:53 +00:00
|
|
|
int sas_eh_abort_handler(struct scsi_cmnd *cmd);
|
2007-01-26 22:08:52 +00:00
|
|
|
int sas_eh_device_reset_handler(struct scsi_cmnd *cmd);
|
2017-08-25 11:57:02 +00:00
|
|
|
int sas_eh_target_reset_handler(struct scsi_cmnd *cmd);
|
2006-10-30 23:18:50 +00:00
|
|
|
|
2006-08-11 02:19:47 +00:00
|
|
|
extern void sas_target_destroy(struct scsi_target *);
|
|
|
|
extern int sas_slave_alloc(struct scsi_device *);
|
2019-02-07 16:07:20 +00:00
|
|
|
extern int sas_ioctl(struct scsi_device *sdev, unsigned int cmd,
|
|
|
|
void __user *arg);
|
2011-12-20 00:42:34 +00:00
|
|
|
extern int sas_drain_work(struct sas_ha_struct *ha);
|
2006-08-11 02:19:47 +00:00
|
|
|
|
2008-01-18 16:47:01 +00:00
|
|
|
extern void sas_ssp_task_response(struct device *dev, struct sas_task *task,
|
|
|
|
struct ssp_response_iu *iu);
|
2011-12-22 05:33:17 +00:00
|
|
|
struct sas_phy *sas_get_local_phy(struct domain_device *dev);
|
2008-01-18 16:47:01 +00:00
|
|
|
|
2008-02-19 18:49:40 +00:00
|
|
|
int sas_request_addr(struct Scsi_Host *shost, u8 *addr);
|
|
|
|
|
2022-02-17 15:42:41 +00:00
|
|
|
int sas_abort_task_set(struct domain_device *dev, u8 *lun);
|
2022-02-17 15:42:42 +00:00
|
|
|
int sas_clear_task_set(struct domain_device *dev, u8 *lun);
|
2022-02-17 15:42:43 +00:00
|
|
|
int sas_lu_reset(struct domain_device *dev, u8 *lun);
|
2022-02-17 15:42:44 +00:00
|
|
|
int sas_query_task(struct sas_task *task, u16 tag);
|
2022-02-17 15:42:45 +00:00
|
|
|
int sas_abort_task(struct sas_task *task, u16 tag);
|
2022-09-28 07:01:24 +00:00
|
|
|
int sas_find_attached_phy_id(struct expander_device *ex_dev,
|
|
|
|
struct domain_device *dev);
|
2022-02-17 15:42:41 +00:00
|
|
|
|
2022-02-25 10:57:35 +00:00
|
|
|
void sas_notify_port_event(struct asd_sas_phy *phy, enum port_event event,
|
|
|
|
gfp_t gfp_flags);
|
|
|
|
void sas_notify_phy_event(struct asd_sas_phy *phy, enum phy_event event,
|
|
|
|
gfp_t gfp_flags);
|
2021-01-18 10:09:38 +00:00
|
|
|
|
2006-08-29 14:22:51 +00:00
|
|
|
#endif /* _SASLIB_H_ */
|