Commit 88edf746 authored by James Bottomley's avatar James Bottomley Committed by James Bottomley

[SCSI] SAS: consolidate linkspeed definitions

At the moment we have two separate linkspeed enumerations covering
roughly the same values.  This patch consolidates on a single one enum
sas_linkspeed in scsi_transport_sas.h and uses it everywhere in the
aic94xx driver.  Eventually I'll get around to removing the duplicated
fields in asd_sas_phy and sas_phy ...
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent b4620233
...@@ -96,7 +96,7 @@ static int asd_init_phy(struct asd_phy *phy) ...@@ -96,7 +96,7 @@ static int asd_init_phy(struct asd_phy *phy)
sas_phy->type = PHY_TYPE_PHYSICAL; sas_phy->type = PHY_TYPE_PHYSICAL;
sas_phy->role = PHY_ROLE_INITIATOR; sas_phy->role = PHY_ROLE_INITIATOR;
sas_phy->oob_mode = OOB_NOT_CONNECTED; sas_phy->oob_mode = OOB_NOT_CONNECTED;
sas_phy->linkrate = PHY_LINKRATE_NONE; sas_phy->linkrate = SAS_LINK_RATE_UNKNOWN;
phy->id_frm_tok = asd_alloc_coherent(asd_ha, phy->id_frm_tok = asd_alloc_coherent(asd_ha,
sizeof(*phy->identify_frame), sizeof(*phy->identify_frame),
......
...@@ -240,10 +240,14 @@ static int __devinit asd_common_setup(struct asd_ha_struct *asd_ha) ...@@ -240,10 +240,14 @@ static int __devinit asd_common_setup(struct asd_ha_struct *asd_ha)
/* All phys are enabled, by default. */ /* All phys are enabled, by default. */
asd_ha->hw_prof.enabled_phys = 0xFF; asd_ha->hw_prof.enabled_phys = 0xFF;
for (i = 0; i < ASD_MAX_PHYS; i++) { for (i = 0; i < ASD_MAX_PHYS; i++) {
asd_ha->hw_prof.phy_desc[i].max_sas_lrate = PHY_LINKRATE_3; asd_ha->hw_prof.phy_desc[i].max_sas_lrate =
asd_ha->hw_prof.phy_desc[i].min_sas_lrate = PHY_LINKRATE_1_5; SAS_LINK_RATE_3_0_GBPS;
asd_ha->hw_prof.phy_desc[i].max_sata_lrate= PHY_LINKRATE_1_5; asd_ha->hw_prof.phy_desc[i].min_sas_lrate =
asd_ha->hw_prof.phy_desc[i].min_sata_lrate= PHY_LINKRATE_1_5; SAS_LINK_RATE_1_5_GBPS;
asd_ha->hw_prof.phy_desc[i].max_sata_lrate =
SAS_LINK_RATE_1_5_GBPS;
asd_ha->hw_prof.phy_desc[i].min_sata_lrate =
SAS_LINK_RATE_1_5_GBPS;
} }
return 0; return 0;
......
...@@ -55,15 +55,15 @@ static inline void get_lrate_mode(struct asd_phy *phy, u8 oob_mode) ...@@ -55,15 +55,15 @@ static inline void get_lrate_mode(struct asd_phy *phy, u8 oob_mode)
switch (oob_mode & 7) { switch (oob_mode & 7) {
case PHY_SPEED_60: case PHY_SPEED_60:
/* FIXME: sas transport class doesn't have this */ /* FIXME: sas transport class doesn't have this */
phy->sas_phy.linkrate = PHY_LINKRATE_6; phy->sas_phy.linkrate = SAS_LINK_RATE_6_0_GBPS;
phy->sas_phy.phy->negotiated_linkrate = SAS_LINK_RATE_6_0_GBPS; phy->sas_phy.phy->negotiated_linkrate = SAS_LINK_RATE_6_0_GBPS;
break; break;
case PHY_SPEED_30: case PHY_SPEED_30:
phy->sas_phy.linkrate = PHY_LINKRATE_3; phy->sas_phy.linkrate = SAS_LINK_RATE_3_0_GBPS;
phy->sas_phy.phy->negotiated_linkrate = SAS_LINK_RATE_3_0_GBPS; phy->sas_phy.phy->negotiated_linkrate = SAS_LINK_RATE_3_0_GBPS;
break; break;
case PHY_SPEED_15: case PHY_SPEED_15:
phy->sas_phy.linkrate = PHY_LINKRATE_1_5; phy->sas_phy.linkrate = SAS_LINK_RATE_1_5_GBPS;
phy->sas_phy.phy->negotiated_linkrate = SAS_LINK_RATE_1_5_GBPS; phy->sas_phy.phy->negotiated_linkrate = SAS_LINK_RATE_1_5_GBPS;
break; break;
} }
...@@ -540,39 +540,39 @@ static inline void set_speed_mask(u8 *speed_mask, struct asd_phy_desc *pd) ...@@ -540,39 +540,39 @@ static inline void set_speed_mask(u8 *speed_mask, struct asd_phy_desc *pd)
| SATA_SPEED_30_DIS | SATA_SPEED_15_DIS; | SATA_SPEED_30_DIS | SATA_SPEED_15_DIS;
switch (pd->max_sas_lrate) { switch (pd->max_sas_lrate) {
case PHY_LINKRATE_6: case SAS_LINK_RATE_6_0_GBPS:
*speed_mask &= ~SAS_SPEED_60_DIS; *speed_mask &= ~SAS_SPEED_60_DIS;
default: default:
case PHY_LINKRATE_3: case SAS_LINK_RATE_3_0_GBPS:
*speed_mask &= ~SAS_SPEED_30_DIS; *speed_mask &= ~SAS_SPEED_30_DIS;
case PHY_LINKRATE_1_5: case SAS_LINK_RATE_1_5_GBPS:
*speed_mask &= ~SAS_SPEED_15_DIS; *speed_mask &= ~SAS_SPEED_15_DIS;
} }
switch (pd->min_sas_lrate) { switch (pd->min_sas_lrate) {
case PHY_LINKRATE_6: case SAS_LINK_RATE_6_0_GBPS:
*speed_mask |= SAS_SPEED_30_DIS; *speed_mask |= SAS_SPEED_30_DIS;
case PHY_LINKRATE_3: case SAS_LINK_RATE_3_0_GBPS:
*speed_mask |= SAS_SPEED_15_DIS; *speed_mask |= SAS_SPEED_15_DIS;
default: default:
case PHY_LINKRATE_1_5: case SAS_LINK_RATE_1_5_GBPS:
/* nothing to do */ /* nothing to do */
; ;
} }
switch (pd->max_sata_lrate) { switch (pd->max_sata_lrate) {
case PHY_LINKRATE_3: case SAS_LINK_RATE_3_0_GBPS:
*speed_mask &= ~SATA_SPEED_30_DIS; *speed_mask &= ~SATA_SPEED_30_DIS;
default: default:
case PHY_LINKRATE_1_5: case SAS_LINK_RATE_1_5_GBPS:
*speed_mask &= ~SATA_SPEED_15_DIS; *speed_mask &= ~SATA_SPEED_15_DIS;
} }
switch (pd->min_sata_lrate) { switch (pd->min_sata_lrate) {
case PHY_LINKRATE_3: case SAS_LINK_RATE_3_0_GBPS:
*speed_mask |= SATA_SPEED_15_DIS; *speed_mask |= SATA_SPEED_15_DIS;
default: default:
case PHY_LINKRATE_1_5: case SAS_LINK_RATE_1_5_GBPS:
/* nothing to do */ /* nothing to do */
; ;
} }
......
...@@ -191,20 +191,7 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, ...@@ -191,20 +191,7 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id,
phy->phy->maximum_linkrate_hw = SAS_LINK_RATE_3_0_GBPS; phy->phy->maximum_linkrate_hw = SAS_LINK_RATE_3_0_GBPS;
phy->phy->minimum_linkrate = SAS_LINK_RATE_1_5_GBPS; phy->phy->minimum_linkrate = SAS_LINK_RATE_1_5_GBPS;
phy->phy->maximum_linkrate = SAS_LINK_RATE_3_0_GBPS; phy->phy->maximum_linkrate = SAS_LINK_RATE_3_0_GBPS;
switch (phy->linkrate) { phy->phy->negotiated_linkrate = phy->linkrate;
case PHY_LINKRATE_1_5:
phy->phy->negotiated_linkrate = SAS_LINK_RATE_1_5_GBPS;
break;
case PHY_LINKRATE_3:
phy->phy->negotiated_linkrate = SAS_LINK_RATE_3_0_GBPS;
break;
case PHY_LINKRATE_6:
phy->phy->negotiated_linkrate = SAS_LINK_RATE_6_0_GBPS;
break;
default:
phy->phy->negotiated_linkrate = SAS_LINK_RATE_UNKNOWN;
break;
}
if (!rediscover) if (!rediscover)
sas_phy_add(phy->phy); sas_phy_add(phy->phy);
...@@ -450,7 +437,7 @@ static void sas_ex_disable_phy(struct domain_device *dev, int phy_id) ...@@ -450,7 +437,7 @@ static void sas_ex_disable_phy(struct domain_device *dev, int phy_id)
struct ex_phy *phy = &ex->ex_phy[phy_id]; struct ex_phy *phy = &ex->ex_phy[phy_id];
sas_smp_phy_control(dev, phy_id, PHY_FUNC_DISABLE); sas_smp_phy_control(dev, phy_id, PHY_FUNC_DISABLE);
phy->linkrate = PHY_DISABLED; phy->linkrate = SAS_PHY_DISABLED;
} }
static void sas_ex_disable_port(struct domain_device *dev, u8 *sas_addr) static void sas_ex_disable_port(struct domain_device *dev, u8 *sas_addr)
...@@ -743,7 +730,7 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id) ...@@ -743,7 +730,7 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id)
int res = 0; int res = 0;
/* Phy state */ /* Phy state */
if (ex_phy->linkrate == PHY_SPINUP_HOLD) { if (ex_phy->linkrate == SAS_SATA_SPINUP_HOLD) {
if (!sas_smp_phy_control(dev, phy_id, PHY_FUNC_LINK_RESET)) if (!sas_smp_phy_control(dev, phy_id, PHY_FUNC_LINK_RESET))
res = sas_ex_phy_discover(dev, phy_id); res = sas_ex_phy_discover(dev, phy_id);
if (res) if (res)
...@@ -773,7 +760,7 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id) ...@@ -773,7 +760,7 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id)
sas_configure_routing(dev, ex_phy->attached_sas_addr); sas_configure_routing(dev, ex_phy->attached_sas_addr);
} }
return 0; return 0;
} else if (ex_phy->linkrate == PHY_LINKRATE_UNKNOWN) } else if (ex_phy->linkrate == SAS_LINK_RATE_UNKNOWN)
return 0; return 0;
if (ex_phy->attached_dev_type != SAS_END_DEV && if (ex_phy->attached_dev_type != SAS_END_DEV &&
...@@ -922,9 +909,9 @@ static int sas_ex_discover_devices(struct domain_device *dev, int single) ...@@ -922,9 +909,9 @@ static int sas_ex_discover_devices(struct domain_device *dev, int single)
continue; continue;
switch (ex_phy->linkrate) { switch (ex_phy->linkrate) {
case PHY_DISABLED: case SAS_PHY_DISABLED:
case PHY_RESET_PROBLEM: case SAS_PHY_RESET_PROBLEM:
case PHY_PORT_SELECTOR: case SAS_SATA_PORT_SELECTOR:
continue; continue;
default: default:
res = sas_ex_discover_dev(dev, i); res = sas_ex_discover_dev(dev, i);
......
...@@ -43,7 +43,7 @@ void sas_scsi_recover_host(struct Scsi_Host *shost); ...@@ -43,7 +43,7 @@ void sas_scsi_recover_host(struct Scsi_Host *shost);
int sas_show_class(enum sas_class class, char *buf); int sas_show_class(enum sas_class class, char *buf);
int sas_show_proto(enum sas_proto proto, char *buf); int sas_show_proto(enum sas_proto proto, char *buf);
int sas_show_linkrate(enum sas_phy_linkrate linkrate, 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_show_oob_mode(enum sas_oob_mode oob_mode, char *buf);
int sas_register_phys(struct sas_ha_struct *sas_ha); int sas_register_phys(struct sas_ha_struct *sas_ha);
......
...@@ -114,7 +114,7 @@ struct ex_phy { ...@@ -114,7 +114,7 @@ struct ex_phy {
enum ex_phy_state phy_state; enum ex_phy_state phy_state;
enum sas_dev_type attached_dev_type; enum sas_dev_type attached_dev_type;
enum sas_phy_linkrate linkrate; enum sas_linkrate linkrate;
u8 attached_sata_host:1; u8 attached_sata_host:1;
u8 attached_sata_dev:1; u8 attached_sata_dev:1;
...@@ -170,9 +170,9 @@ struct sata_device { ...@@ -170,9 +170,9 @@ struct sata_device {
struct domain_device { struct domain_device {
enum sas_dev_type dev_type; enum sas_dev_type dev_type;
enum sas_phy_linkrate linkrate; enum sas_linkrate linkrate;
enum sas_phy_linkrate min_linkrate; enum sas_linkrate min_linkrate;
enum sas_phy_linkrate max_linkrate; enum sas_linkrate max_linkrate;
int pathways; int pathways;
...@@ -220,7 +220,7 @@ struct asd_sas_port { ...@@ -220,7 +220,7 @@ struct asd_sas_port {
struct domain_device *port_dev; struct domain_device *port_dev;
spinlock_t dev_list_lock; spinlock_t dev_list_lock;
struct list_head dev_list; struct list_head dev_list;
enum sas_phy_linkrate linkrate; enum sas_linkrate linkrate;
struct sas_phy *phy; struct sas_phy *phy;
struct work_struct work; struct work_struct work;
...@@ -276,7 +276,7 @@ struct asd_sas_phy { ...@@ -276,7 +276,7 @@ struct asd_sas_phy {
enum sas_phy_type type; enum sas_phy_type type;
enum sas_phy_role role; enum sas_phy_role role;
enum sas_oob_mode oob_mode; enum sas_oob_mode oob_mode;
enum sas_phy_linkrate linkrate; enum sas_linkrate linkrate;
u8 *sas_addr; /* must be set */ u8 *sas_addr; /* must be set */
u8 attached_sas_addr[SAS_ADDR_SIZE]; /* class:RO, driver: R/W */ u8 attached_sas_addr[SAS_ADDR_SIZE]; /* class:RO, driver: R/W */
...@@ -368,7 +368,7 @@ void sas_hash_addr(u8 *hashed, const u8 *sas_addr); ...@@ -368,7 +368,7 @@ void sas_hash_addr(u8 *hashed, const u8 *sas_addr);
static inline void sas_phy_disconnected(struct asd_sas_phy *phy) static inline void sas_phy_disconnected(struct asd_sas_phy *phy)
{ {
phy->oob_mode = OOB_NOT_CONNECTED; phy->oob_mode = OOB_NOT_CONNECTED;
phy->linkrate = PHY_LINKRATE_NONE; phy->linkrate = SAS_LINK_RATE_UNKNOWN;
} }
/* ---------- Tasks ---------- */ /* ---------- Tasks ---------- */
......
...@@ -102,20 +102,6 @@ enum sas_dev_type { ...@@ -102,20 +102,6 @@ enum sas_dev_type {
SATA_PM_PORT= 8, SATA_PM_PORT= 8,
}; };
enum sas_phy_linkrate {
PHY_LINKRATE_NONE = 0,
PHY_LINKRATE_UNKNOWN = 0,
PHY_DISABLED,
PHY_RESET_PROBLEM,
PHY_SPINUP_HOLD,
PHY_PORT_SELECTOR,
PHY_LINKRATE_1_5 = 0x08,
PHY_LINKRATE_G1 = PHY_LINKRATE_1_5,
PHY_LINKRATE_3 = 0x09,
PHY_LINKRATE_G2 = PHY_LINKRATE_3,
PHY_LINKRATE_6 = 0x0A,
};
/* Partly from IDENTIFY address frame. */ /* Partly from IDENTIFY address frame. */
enum sas_proto { enum sas_proto {
SATA_PROTO = 1, SATA_PROTO = 1,
......
...@@ -24,15 +24,23 @@ enum sas_protocol { ...@@ -24,15 +24,23 @@ enum sas_protocol {
}; };
enum sas_linkrate { enum sas_linkrate {
SAS_LINK_RATE_UNKNOWN, /* These Values are defined in the SAS standard */
SAS_PHY_DISABLED, SAS_LINK_RATE_UNKNOWN = 0,
SAS_LINK_RATE_FAILED, SAS_PHY_DISABLED = 1,
SAS_SATA_SPINUP_HOLD, SAS_PHY_RESET_PROBLEM = 2,
SAS_SATA_PORT_SELECTOR, SAS_SATA_SPINUP_HOLD = 3,
SAS_LINK_RATE_1_5_GBPS, SAS_SATA_PORT_SELECTOR = 4,
SAS_LINK_RATE_3_0_GBPS, SAS_PHY_RESET_IN_PROGRESS = 5,
SAS_LINK_RATE_6_0_GBPS, SAS_LINK_RATE_1_5_GBPS = 8,
SAS_LINK_VIRTUAL, SAS_LINK_RATE_G1 = SAS_LINK_RATE_1_5_GBPS,
SAS_LINK_RATE_3_0_GBPS = 9,
SAS_LINK_RATE_G2 = SAS_LINK_RATE_3_0_GBPS,
SAS_LINK_RATE_6_0_GBPS = 10,
/* These are virtual to the transport class and may never
* be signalled normally since the standard defined field
* is only 4 bits */
SAS_LINK_RATE_FAILED = 0x10,
SAS_PHY_VIRTUAL = 0x11,
}; };
struct sas_identify { struct sas_identify {
......
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