#include <linux/init.h>
#include <linux/module.h>
#include <linux/jiffies.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/blkdev.h>
#include <linux/bsg.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_transport.h>
#include <scsi/scsi_transport_sas.h>
#include "scsi_sas_internal.h"
struct sas_host_attrs { … };
#define to_sas_host_attrs(host) …
#define SAS_DEVICE_ATTR(_prefix,_name,_mode,_show,_store) …
#define sas_bitfield_name_match(title, table) …
#define sas_bitfield_name_set(title, table) …
#define sas_bitfield_name_search(title, table) …
static struct { … } sas_device_type_names[] = …;
sas_bitfield_name_search(device_type, sas_device_type_names)
static struct { … } sas_protocol_names[] = …;
sas_bitfield_name_match(protocol, sas_protocol_names)
static struct { … } sas_linkspeed_names[] = …;
sas_bitfield_name_search(linkspeed, sas_linkspeed_names)
sas_bitfield_name_set(linkspeed, sas_linkspeed_names)
static struct sas_end_device *sas_sdev_to_rdev(struct scsi_device *sdev)
{ … }
static int sas_smp_dispatch(struct bsg_job *job)
{ … }
static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy)
{ … }
static int sas_host_setup(struct transport_container *tc, struct device *dev,
struct device *cdev)
{ … }
static int sas_host_remove(struct transport_container *tc, struct device *dev,
struct device *cdev)
{ … }
static DECLARE_TRANSPORT_CLASS(sas_host_class,
"sas_host", sas_host_setup, sas_host_remove, NULL);
static int sas_host_match(struct attribute_container *cont,
struct device *dev)
{ … }
static int do_sas_phy_delete(struct device *dev, void *data)
{ … }
void sas_remove_children(struct device *dev)
{ … }
EXPORT_SYMBOL(…);
void sas_remove_host(struct Scsi_Host *shost)
{ … }
EXPORT_SYMBOL(…);
u64 sas_get_address(struct scsi_device *sdev)
{ … }
EXPORT_SYMBOL(…);
unsigned int
sas_tlr_supported(struct scsi_device *sdev)
{ … }
EXPORT_SYMBOL_GPL(…);
void
sas_disable_tlr(struct scsi_device *sdev)
{ … }
EXPORT_SYMBOL_GPL(…);
void sas_enable_tlr(struct scsi_device *sdev)
{ … }
EXPORT_SYMBOL_GPL(…);
unsigned int sas_is_tlr_enabled(struct scsi_device *sdev)
{ … }
EXPORT_SYMBOL_GPL(…);
bool sas_ata_ncq_prio_supported(struct scsi_device *sdev)
{ … }
EXPORT_SYMBOL_GPL(…);
#define sas_phy_show_simple(field, name, format_string, cast) …
#define sas_phy_simple_attr(field, name, format_string, type) …
#define sas_phy_show_protocol(field, name) …
#define sas_phy_protocol_attr(field, name) …
#define sas_phy_show_linkspeed(field) …
#define sas_phy_store_linkspeed(field) …
#define sas_phy_linkspeed_rw_attr(field) …
#define sas_phy_linkspeed_attr(field) …
#define sas_phy_show_linkerror(field) …
#define sas_phy_linkerror_attr(field) …
static ssize_t
show_sas_device_type(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR(device_type, S_IRUGO, show_sas_device_type, NULL);
static ssize_t do_sas_phy_enable(struct device *dev,
size_t count, int enable)
{
struct sas_phy *phy = transport_class_to_phy(dev);
struct Scsi_Host *shost = dev_to_shost(phy->dev.parent);
struct sas_internal *i = to_sas_internal(shost->transportt);
int error;
error = i->f->phy_enable(phy, enable);
if (error)
return error;
phy->enabled = enable;
return count;
};
static ssize_t
store_sas_phy_enable(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t
show_sas_phy_enable(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, show_sas_phy_enable,
store_sas_phy_enable);
static ssize_t
do_sas_phy_reset(struct device *dev, size_t count, int hard_reset)
{
struct sas_phy *phy = transport_class_to_phy(dev);
struct Scsi_Host *shost = dev_to_shost(phy->dev.parent);
struct sas_internal *i = to_sas_internal(shost->transportt);
int error;
error = i->f->phy_reset(phy, hard_reset);
if (error)
return error;
phy->enabled = 1;
return count;
};
static ssize_t
store_sas_link_reset(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR(link_reset, S_IWUSR, NULL, store_sas_link_reset);
static ssize_t
store_sas_hard_reset(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR(hard_reset, S_IWUSR, NULL, store_sas_hard_reset);
sas_phy_protocol_attr(…);
sas_phy_protocol_attr(…);
sas_phy_simple_attr(…) …;
sas_phy_simple_attr(…);
sas_phy_linkspeed_attr(…);
sas_phy_linkspeed_attr(…);
sas_phy_linkspeed_rw_attr(…);
sas_phy_linkspeed_attr(…);
sas_phy_linkspeed_rw_attr(…);
sas_phy_linkerror_attr(…);
sas_phy_linkerror_attr(…);
sas_phy_linkerror_attr(…);
sas_phy_linkerror_attr(…);
static int sas_phy_setup(struct transport_container *tc, struct device *dev,
struct device *cdev)
{ … }
static DECLARE_TRANSPORT_CLASS(sas_phy_class,
"sas_phy", sas_phy_setup, NULL, NULL);
static int sas_phy_match(struct attribute_container *cont, struct device *dev)
{ … }
static void sas_phy_release(struct device *dev)
{ … }
struct sas_phy *sas_phy_alloc(struct device *parent, int number)
{ … }
EXPORT_SYMBOL(…);
int sas_phy_add(struct sas_phy *phy)
{ … }
EXPORT_SYMBOL(…);
void sas_phy_free(struct sas_phy *phy)
{ … }
EXPORT_SYMBOL(…);
void
sas_phy_delete(struct sas_phy *phy)
{ … }
EXPORT_SYMBOL(…);
int scsi_is_sas_phy(const struct device *dev)
{ … }
EXPORT_SYMBOL(…);
#define sas_port_show_simple(field, name, format_string, cast) …
#define sas_port_simple_attr(field, name, format_string, type) …
sas_port_simple_attr(…) …;
static DECLARE_TRANSPORT_CLASS(sas_port_class,
"sas_port", NULL, NULL, NULL);
static int sas_port_match(struct attribute_container *cont, struct device *dev)
{ … }
static void sas_port_release(struct device *dev)
{ … }
static void sas_port_create_link(struct sas_port *port,
struct sas_phy *phy)
{ … }
static void sas_port_delete_link(struct sas_port *port,
struct sas_phy *phy)
{ … }
struct sas_port *sas_port_alloc(struct device *parent, int port_id)
{ … }
EXPORT_SYMBOL(…);
struct sas_port *sas_port_alloc_num(struct device *parent)
{ … }
EXPORT_SYMBOL(…);
int sas_port_add(struct sas_port *port)
{ … }
EXPORT_SYMBOL(…);
void sas_port_free(struct sas_port *port)
{ … }
EXPORT_SYMBOL(…);
void sas_port_delete(struct sas_port *port)
{ … }
EXPORT_SYMBOL(…);
int scsi_is_sas_port(const struct device *dev)
{ … }
EXPORT_SYMBOL(…);
struct sas_phy *sas_port_get_phy(struct sas_port *port)
{ … }
EXPORT_SYMBOL(…);
void sas_port_add_phy(struct sas_port *port, struct sas_phy *phy)
{ … }
EXPORT_SYMBOL(…);
void sas_port_delete_phy(struct sas_port *port, struct sas_phy *phy)
{ … }
EXPORT_SYMBOL(…);
void sas_port_mark_backlink(struct sas_port *port)
{ … }
EXPORT_SYMBOL(…);
#define sas_rphy_show_simple(field, name, format_string, cast) …
#define sas_rphy_simple_attr(field, name, format_string, type) …
#define sas_rphy_show_protocol(field, name) …
#define sas_rphy_protocol_attr(field, name) …
static ssize_t
show_sas_rphy_device_type(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static SAS_DEVICE_ATTR(rphy, device_type, S_IRUGO,
show_sas_rphy_device_type, NULL);
static ssize_t
show_sas_rphy_enclosure_identifier(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static SAS_DEVICE_ATTR(rphy, enclosure_identifier, S_IRUGO,
show_sas_rphy_enclosure_identifier, NULL);
static ssize_t
show_sas_rphy_bay_identifier(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static SAS_DEVICE_ATTR(rphy, bay_identifier, S_IRUGO,
show_sas_rphy_bay_identifier, NULL);
sas_rphy_protocol_attr(…);
sas_rphy_protocol_attr(…);
sas_rphy_simple_attr(…) …;
sas_rphy_simple_attr(…);
sas_rphy_simple_attr(…);
#define BUF_SIZE …
int sas_read_port_mode_page(struct scsi_device *sdev)
{ … }
EXPORT_SYMBOL(…);
static DECLARE_TRANSPORT_CLASS(sas_end_dev_class,
"sas_end_device", NULL, NULL, NULL);
#define sas_end_dev_show_simple(field, name, format_string, cast) …
#define sas_end_dev_simple_attr(field, name, format_string, type) …
sas_end_dev_simple_attr(…) …;
sas_end_dev_simple_attr(…) …;
sas_end_dev_simple_attr(…) …;
sas_end_dev_simple_attr(…) …;
sas_end_dev_simple_attr(…) …;
static DECLARE_TRANSPORT_CLASS(sas_expander_class,
"sas_expander", NULL, NULL, NULL);
#define sas_expander_show_simple(field, name, format_string, cast) …
#define sas_expander_simple_attr(field, name, format_string, type) …
sas_expander_simple_attr(…) …;
sas_expander_simple_attr(…) …;
sas_expander_simple_attr(…) …;
sas_expander_simple_attr(…) …;
sas_expander_simple_attr(…) …;
sas_expander_simple_attr(…) …;
sas_expander_simple_attr(…) …;
static DECLARE_TRANSPORT_CLASS(sas_rphy_class,
"sas_device", NULL, NULL, NULL);
static int sas_rphy_match(struct attribute_container *cont, struct device *dev)
{ … }
static int sas_end_dev_match(struct attribute_container *cont,
struct device *dev)
{ … }
static int sas_expander_match(struct attribute_container *cont,
struct device *dev)
{ … }
static void sas_expander_release(struct device *dev)
{ … }
static void sas_end_device_release(struct device *dev)
{ … }
static void sas_rphy_initialize(struct sas_rphy *rphy)
{ … }
struct sas_rphy *sas_end_device_alloc(struct sas_port *parent)
{ … }
EXPORT_SYMBOL(…);
struct sas_rphy *sas_expander_alloc(struct sas_port *parent,
enum sas_device_type type)
{ … }
EXPORT_SYMBOL(…);
int sas_rphy_add(struct sas_rphy *rphy)
{ … }
EXPORT_SYMBOL(…);
void sas_rphy_free(struct sas_rphy *rphy)
{ … }
EXPORT_SYMBOL(…);
void
sas_rphy_delete(struct sas_rphy *rphy)
{ … }
EXPORT_SYMBOL(…);
void sas_rphy_unlink(struct sas_rphy *rphy)
{ … }
EXPORT_SYMBOL(…);
void
sas_rphy_remove(struct sas_rphy *rphy)
{ … }
EXPORT_SYMBOL(…);
int scsi_is_sas_rphy(const struct device *dev)
{ … }
EXPORT_SYMBOL(…);
static int sas_user_scan(struct Scsi_Host *shost, uint channel,
uint id, u64 lun)
{ … }
#define SETUP_TEMPLATE(attrb, field, perm, test) …
#define SETUP_TEMPLATE_RW(attrb, field, perm, test, ro_test, ro_perm) …
#define SETUP_RPORT_ATTRIBUTE(field) …
#define SETUP_OPTIONAL_RPORT_ATTRIBUTE(field, func) …
#define SETUP_PHY_ATTRIBUTE(field) …
#define SETUP_PHY_ATTRIBUTE_RW(field) …
#define SETUP_OPTIONAL_PHY_ATTRIBUTE_RW(field, func) …
#define SETUP_PORT_ATTRIBUTE(field) …
#define SETUP_OPTIONAL_PHY_ATTRIBUTE(field, func) …
#define SETUP_PHY_ATTRIBUTE_WRONLY(field) …
#define SETUP_OPTIONAL_PHY_ATTRIBUTE_WRONLY(field, func) …
#define SETUP_END_DEV_ATTRIBUTE(field) …
#define SETUP_EXPANDER_ATTRIBUTE(field) …
struct scsi_transport_template *
sas_attach_transport(struct sas_function_template *ft)
{ … }
EXPORT_SYMBOL(…);
void sas_release_transport(struct scsi_transport_template *t)
{ … }
EXPORT_SYMBOL(…);
static __init int sas_transport_init(void)
{ … }
static void __exit sas_transport_exit(void)
{ … }
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
module_init(…) …;
module_exit(sas_transport_exit);