mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-02 16:44:10 +08:00
ba6d10ab80
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 ...
193 lines
5.9 KiB
C
193 lines
5.9 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Serial Attached SCSI (SAS) class internal header file
|
|
*
|
|
* Copyright (C) 2005 Adaptec, Inc. All rights reserved.
|
|
* Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com>
|
|
*/
|
|
|
|
#ifndef _SAS_INTERNAL_H_
|
|
#define _SAS_INTERNAL_H_
|
|
|
|
#include <scsi/scsi.h>
|
|
#include <scsi/scsi_host.h>
|
|
#include <scsi/scsi_transport_sas.h>
|
|
#include <scsi/libsas.h>
|
|
#include <scsi/sas_ata.h>
|
|
|
|
#ifdef pr_fmt
|
|
#undef pr_fmt
|
|
#endif
|
|
|
|
#define SAS_FMT "sas: "
|
|
|
|
#define pr_fmt(fmt) SAS_FMT fmt
|
|
|
|
#define TO_SAS_TASK(_scsi_cmd) ((void *)(_scsi_cmd)->host_scribble)
|
|
#define ASSIGN_SAS_TASK(_sc, _t) do { (_sc)->host_scribble = (void *) _t; } while (0)
|
|
|
|
struct sas_phy_data {
|
|
/* let reset be performed in sas_queue_work() context */
|
|
struct sas_phy *phy;
|
|
struct mutex event_lock;
|
|
int hard_reset;
|
|
int reset_result;
|
|
struct sas_work reset_work;
|
|
int enable;
|
|
int enable_result;
|
|
struct sas_work enable_work;
|
|
};
|
|
|
|
void sas_scsi_recover_host(struct Scsi_Host *shost);
|
|
|
|
int sas_show_class(enum sas_class class, char *buf);
|
|
int sas_show_proto(enum sas_protocol proto, char *buf);
|
|
int sas_show_linkrate(enum sas_linkrate linkrate, char *buf);
|
|
int sas_show_oob_mode(enum sas_oob_mode oob_mode, char *buf);
|
|
|
|
int sas_register_phys(struct sas_ha_struct *sas_ha);
|
|
void sas_unregister_phys(struct sas_ha_struct *sas_ha);
|
|
|
|
struct asd_sas_event *sas_alloc_event(struct asd_sas_phy *phy);
|
|
void sas_free_event(struct asd_sas_event *event);
|
|
|
|
int sas_register_ports(struct sas_ha_struct *sas_ha);
|
|
void sas_unregister_ports(struct sas_ha_struct *sas_ha);
|
|
|
|
int sas_init_events(struct sas_ha_struct *sas_ha);
|
|
void sas_disable_revalidation(struct sas_ha_struct *ha);
|
|
void sas_enable_revalidation(struct sas_ha_struct *ha);
|
|
void __sas_drain_work(struct sas_ha_struct *ha);
|
|
|
|
void sas_deform_port(struct asd_sas_phy *phy, int gone);
|
|
|
|
void sas_porte_bytes_dmaed(struct work_struct *work);
|
|
void sas_porte_broadcast_rcvd(struct work_struct *work);
|
|
void sas_porte_link_reset_err(struct work_struct *work);
|
|
void sas_porte_timer_event(struct work_struct *work);
|
|
void sas_porte_hard_reset(struct work_struct *work);
|
|
int sas_queue_work(struct sas_ha_struct *ha, struct sas_work *sw);
|
|
|
|
int sas_notify_lldd_dev_found(struct domain_device *);
|
|
void sas_notify_lldd_dev_gone(struct domain_device *);
|
|
|
|
void sas_smp_handler(struct bsg_job *job, struct Scsi_Host *shost,
|
|
struct sas_rphy *rphy);
|
|
int sas_smp_phy_control(struct domain_device *dev, int phy_id,
|
|
enum phy_func phy_func, struct sas_phy_linkrates *);
|
|
int sas_smp_get_phy_events(struct sas_phy *phy);
|
|
|
|
int sas_notify_phy_event(struct asd_sas_phy *phy, enum phy_event event);
|
|
void sas_device_set_phy(struct domain_device *dev, struct sas_port *port);
|
|
struct domain_device *sas_find_dev_by_rphy(struct sas_rphy *rphy);
|
|
struct domain_device *sas_ex_to_ata(struct domain_device *ex_dev, int phy_id);
|
|
int sas_ex_phy_discover(struct domain_device *dev, int single);
|
|
int sas_get_report_phy_sata(struct domain_device *dev, int phy_id,
|
|
struct smp_resp *rps_resp);
|
|
int sas_try_ata_reset(struct asd_sas_phy *phy);
|
|
void sas_hae_reset(struct work_struct *work);
|
|
|
|
void sas_free_device(struct kref *kref);
|
|
void sas_destruct_devices(struct asd_sas_port *port);
|
|
|
|
extern const work_func_t sas_phy_event_fns[PHY_NUM_EVENTS];
|
|
extern const work_func_t sas_port_event_fns[PORT_NUM_EVENTS];
|
|
|
|
#ifdef CONFIG_SCSI_SAS_HOST_SMP
|
|
extern void sas_smp_host_handler(struct bsg_job *job, struct Scsi_Host *shost);
|
|
#else
|
|
static inline void sas_smp_host_handler(struct bsg_job *job,
|
|
struct Scsi_Host *shost)
|
|
{
|
|
shost_printk(KERN_ERR, shost,
|
|
"Cannot send SMP to a sas host (not enabled in CONFIG)\n");
|
|
bsg_job_done(job, -EINVAL, 0);
|
|
}
|
|
#endif
|
|
|
|
static inline void sas_fail_probe(struct domain_device *dev, const char *func, int err)
|
|
{
|
|
pr_warn("%s: for %s device %16llx returned %d\n",
|
|
func, dev->parent ? "exp-attached" :
|
|
"direct-attached",
|
|
SAS_ADDR(dev->sas_addr), err);
|
|
sas_unregister_dev(dev->port, dev);
|
|
}
|
|
|
|
static inline void sas_fill_in_rphy(struct domain_device *dev,
|
|
struct sas_rphy *rphy)
|
|
{
|
|
rphy->identify.sas_address = SAS_ADDR(dev->sas_addr);
|
|
rphy->identify.initiator_port_protocols = dev->iproto;
|
|
rphy->identify.target_port_protocols = dev->tproto;
|
|
switch (dev->dev_type) {
|
|
case SAS_SATA_DEV:
|
|
/* FIXME: need sata device type */
|
|
case SAS_END_DEVICE:
|
|
case SAS_SATA_PENDING:
|
|
rphy->identify.device_type = SAS_END_DEVICE;
|
|
break;
|
|
case SAS_EDGE_EXPANDER_DEVICE:
|
|
rphy->identify.device_type = SAS_EDGE_EXPANDER_DEVICE;
|
|
break;
|
|
case SAS_FANOUT_EXPANDER_DEVICE:
|
|
rphy->identify.device_type = SAS_FANOUT_EXPANDER_DEVICE;
|
|
break;
|
|
default:
|
|
rphy->identify.device_type = SAS_PHY_UNUSED;
|
|
break;
|
|
}
|
|
}
|
|
|
|
static inline void sas_phy_set_target(struct asd_sas_phy *p, struct domain_device *dev)
|
|
{
|
|
struct sas_phy *phy = p->phy;
|
|
|
|
if (dev) {
|
|
if (dev_is_sata(dev))
|
|
phy->identify.device_type = SAS_END_DEVICE;
|
|
else
|
|
phy->identify.device_type = dev->dev_type;
|
|
phy->identify.target_port_protocols = dev->tproto;
|
|
} else {
|
|
phy->identify.device_type = SAS_PHY_UNUSED;
|
|
phy->identify.target_port_protocols = 0;
|
|
}
|
|
}
|
|
|
|
static inline void sas_add_parent_port(struct domain_device *dev, int phy_id)
|
|
{
|
|
struct expander_device *ex = &dev->ex_dev;
|
|
struct ex_phy *ex_phy = &ex->ex_phy[phy_id];
|
|
|
|
if (!ex->parent_port) {
|
|
ex->parent_port = sas_port_alloc(&dev->rphy->dev, phy_id);
|
|
/* FIXME: error handling */
|
|
BUG_ON(!ex->parent_port);
|
|
BUG_ON(sas_port_add(ex->parent_port));
|
|
sas_port_mark_backlink(ex->parent_port);
|
|
}
|
|
sas_port_add_phy(ex->parent_port, ex_phy->phy);
|
|
}
|
|
|
|
static inline struct domain_device *sas_alloc_device(void)
|
|
{
|
|
struct domain_device *dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
|
|
|
if (dev) {
|
|
INIT_LIST_HEAD(&dev->siblings);
|
|
INIT_LIST_HEAD(&dev->dev_list_node);
|
|
INIT_LIST_HEAD(&dev->disco_list_node);
|
|
kref_init(&dev->kref);
|
|
spin_lock_init(&dev->done_lock);
|
|
}
|
|
return dev;
|
|
}
|
|
|
|
static inline void sas_put_device(struct domain_device *dev)
|
|
{
|
|
kref_put(&dev->kref, sas_free_device);
|
|
}
|
|
|
|
#endif /* _SAS_INTERNAL_H_ */
|