Commit b9142174 authored by James Bottomley's avatar James Bottomley Committed by James Bottomley

[SCSI] libsas: make ATA functions selectable by a config option

Not everyone wants libsas automatically to pull in libata.  This patch
makes the behaviour configurable, so you can build libsas with or
without ATA support.
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 41e1703b
...@@ -30,6 +30,13 @@ config SCSI_SAS_LIBSAS ...@@ -30,6 +30,13 @@ config SCSI_SAS_LIBSAS
This provides transport specific helpers for SAS drivers which This provides transport specific helpers for SAS drivers which
use the domain device construct (like the aic94xxx). use the domain device construct (like the aic94xxx).
config SCSI_SAS_ATA
bool "ATA support for libsas (requires libata)"
depends on SCSI_SAS_LIBSAS && ATA
help
Builds in ATA support into libsas. Will necessitate
the loading of libata along with libsas.
config SCSI_SAS_LIBSAS_DEBUG config SCSI_SAS_LIBSAS_DEBUG
bool "Compile the SAS Domain Transport Attributes in debug mode" bool "Compile the SAS Domain Transport Attributes in debug mode"
default y default y
......
...@@ -33,5 +33,5 @@ libsas-y += sas_init.o \ ...@@ -33,5 +33,5 @@ libsas-y += sas_init.o \
sas_dump.o \ sas_dump.o \
sas_discover.o \ sas_discover.o \
sas_expander.o \ sas_expander.o \
sas_scsi_host.o \ sas_scsi_host.o
sas_ata.o libsas-$(CONFIG_SCSI_SAS_ATA) += sas_ata.o
This diff is collapsed.
This diff is collapsed.
...@@ -535,6 +535,8 @@ int sas_smp_get_phy_events(struct sas_phy *phy) ...@@ -535,6 +535,8 @@ int sas_smp_get_phy_events(struct sas_phy *phy)
} }
#ifdef CONFIG_SCSI_SAS_ATA
#define RPS_REQ_SIZE 16 #define RPS_REQ_SIZE 16
#define RPS_RESP_SIZE 60 #define RPS_RESP_SIZE 60
...@@ -578,6 +580,7 @@ static int sas_get_report_phy_sata(struct domain_device *dev, ...@@ -578,6 +580,7 @@ static int sas_get_report_phy_sata(struct domain_device *dev,
kfree(rps_req); kfree(rps_req);
return res; return res;
} }
#endif
static void sas_ex_get_linkrate(struct domain_device *parent, static void sas_ex_get_linkrate(struct domain_device *parent,
struct domain_device *child, struct domain_device *child,
...@@ -645,6 +648,7 @@ static struct domain_device *sas_ex_discover_end_dev( ...@@ -645,6 +648,7 @@ static struct domain_device *sas_ex_discover_end_dev(
} }
sas_ex_get_linkrate(parent, child, phy); sas_ex_get_linkrate(parent, child, phy);
#ifdef CONFIG_SCSI_SAS_ATA
if ((phy->attached_tproto & SAS_PROTO_STP) || phy->attached_sata_dev) { if ((phy->attached_tproto & SAS_PROTO_STP) || phy->attached_sata_dev) {
child->dev_type = SATA_DEV; child->dev_type = SATA_DEV;
if (phy->attached_tproto & SAS_PROTO_STP) if (phy->attached_tproto & SAS_PROTO_STP)
...@@ -682,7 +686,9 @@ static struct domain_device *sas_ex_discover_end_dev( ...@@ -682,7 +686,9 @@ static struct domain_device *sas_ex_discover_end_dev(
SAS_ADDR(parent->sas_addr), phy_id, res); SAS_ADDR(parent->sas_addr), phy_id, res);
goto out_list_del; goto out_list_del;
} }
} else if (phy->attached_tproto & SAS_PROTO_SSP) { } else
#endif
if (phy->attached_tproto & SAS_PROTO_SSP) {
child->dev_type = SAS_END_DEV; child->dev_type = SAS_END_DEV;
rphy = sas_end_device_alloc(phy->port); rphy = sas_end_device_alloc(phy->port);
/* FIXME: error handling */ /* FIXME: error handling */
...@@ -710,6 +716,7 @@ static struct domain_device *sas_ex_discover_end_dev( ...@@ -710,6 +716,7 @@ static struct domain_device *sas_ex_discover_end_dev(
SAS_DPRINTK("target proto 0x%x at %016llx:0x%x not handled\n", SAS_DPRINTK("target proto 0x%x at %016llx:0x%x not handled\n",
phy->attached_tproto, SAS_ADDR(parent->sas_addr), phy->attached_tproto, SAS_ADDR(parent->sas_addr),
phy_id); phy_id);
goto out_free;
} }
list_add_tail(&child->siblings, &parent_ex->children); list_add_tail(&child->siblings, &parent_ex->children);
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include <linux/libata.h> #include <linux/libata.h>
#include <scsi/libsas.h> #include <scsi/libsas.h>
#ifdef CONFIG_SCSI_SAS_ATA
static inline int dev_is_sata(struct domain_device *dev) static inline int dev_is_sata(struct domain_device *dev)
{ {
return (dev->rphy->identify.target_port_protocols & SAS_PROTOCOL_SATA); return (dev->rphy->identify.target_port_protocols & SAS_PROTOCOL_SATA);
...@@ -38,4 +40,21 @@ int sas_ata_init_host_and_port(struct domain_device *found_dev, ...@@ -38,4 +40,21 @@ int sas_ata_init_host_and_port(struct domain_device *found_dev,
void sas_ata_task_abort(struct sas_task *task); void sas_ata_task_abort(struct sas_task *task);
#else
static inline int dev_is_sata(struct domain_device *dev)
{
return 0;
}
int sas_ata_init_host_and_port(struct domain_device *found_dev,
struct scsi_target *starget)
{
return 0;
}
void sas_ata_task_abort(struct sas_task *task)
{
}
#endif
#endif /* _SAS_ATA_H_ */ #endif /* _SAS_ATA_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment