Commit aa9f8328 authored by James Bottomley's avatar James Bottomley

[SCSI] sas: unify the pointlessly separated enums sas_dev_type and sas_device_type

These enums have been separate since the dawn of SAS, mainly because the
latter is a procotol only enum and the former includes additional state
for libsas.  The dichotomy causes endless confusion about which one you
should use where and leads to pointless warnings like this:

drivers/scsi/mvsas/mv_sas.c: In function 'mvs_update_phyinfo':
drivers/scsi/mvsas/mv_sas.c:1162:34: warning: comparison between 'enum sas_device_type' and 'enum sas_dev_type' [-Wenum-compare]

Fix by eliminating one of them.  The one kept is effectively the sas.h
one, but call it sas_device_type and make sure the enums are all
properly namespaced with the SAS_ prefix.
Signed-off-by: 's avatarJames Bottomley <JBottomley@Parallels.com>
parent a6cb3d01
...@@ -84,7 +84,7 @@ static void asd_set_ddb_type(struct domain_device *dev) ...@@ -84,7 +84,7 @@ static void asd_set_ddb_type(struct domain_device *dev)
struct asd_ha_struct *asd_ha = dev->port->ha->lldd_ha; struct asd_ha_struct *asd_ha = dev->port->ha->lldd_ha;
int ddb = (int) (unsigned long) dev->lldd_dev; int ddb = (int) (unsigned long) dev->lldd_dev;
if (dev->dev_type == SATA_PM_PORT) if (dev->dev_type == SAS_SATA_PM_PORT)
asd_ddbsite_write_byte(asd_ha,ddb, DDB_TYPE, DDB_TYPE_PM_PORT); asd_ddbsite_write_byte(asd_ha,ddb, DDB_TYPE, DDB_TYPE_PM_PORT);
else if (dev->tproto) else if (dev->tproto)
asd_ddbsite_write_byte(asd_ha,ddb, DDB_TYPE, DDB_TYPE_TARGET); asd_ddbsite_write_byte(asd_ha,ddb, DDB_TYPE, DDB_TYPE_TARGET);
...@@ -116,7 +116,7 @@ void asd_set_dmamode(struct domain_device *dev) ...@@ -116,7 +116,7 @@ void asd_set_dmamode(struct domain_device *dev)
int ddb = (int) (unsigned long) dev->lldd_dev; int ddb = (int) (unsigned long) dev->lldd_dev;
u32 qdepth = 0; u32 qdepth = 0;
if (dev->dev_type == SATA_DEV || dev->dev_type == SATA_PM_PORT) { if (dev->dev_type == SAS_SATA_DEV || dev->dev_type == SAS_SATA_PM_PORT) {
if (ata_id_has_ncq(ata_dev->id)) if (ata_id_has_ncq(ata_dev->id))
qdepth = ata_id_queue_depth(ata_dev->id); qdepth = ata_id_queue_depth(ata_dev->id);
asd_ddbsite_write_dword(asd_ha, ddb, SATA_TAG_ALLOC_MASK, asd_ddbsite_write_dword(asd_ha, ddb, SATA_TAG_ALLOC_MASK,
...@@ -140,8 +140,8 @@ static int asd_init_sata(struct domain_device *dev) ...@@ -140,8 +140,8 @@ static int asd_init_sata(struct domain_device *dev)
int ddb = (int) (unsigned long) dev->lldd_dev; int ddb = (int) (unsigned long) dev->lldd_dev;
asd_ddbsite_write_word(asd_ha, ddb, ATA_CMD_SCBPTR, 0xFFFF); asd_ddbsite_write_word(asd_ha, ddb, ATA_CMD_SCBPTR, 0xFFFF);
if (dev->dev_type == SATA_DEV || dev->dev_type == SATA_PM || if (dev->dev_type == SAS_SATA_DEV || dev->dev_type == SAS_SATA_PM ||
dev->dev_type == SATA_PM_PORT) { dev->dev_type == SAS_SATA_PM_PORT) {
struct dev_to_host_fis *fis = (struct dev_to_host_fis *) struct dev_to_host_fis *fis = (struct dev_to_host_fis *)
dev->frame_rcvd; dev->frame_rcvd;
asd_ddbsite_write_byte(asd_ha, ddb, SATA_STATUS, fis->status); asd_ddbsite_write_byte(asd_ha, ddb, SATA_STATUS, fis->status);
...@@ -174,7 +174,7 @@ static int asd_init_target_ddb(struct domain_device *dev) ...@@ -174,7 +174,7 @@ static int asd_init_target_ddb(struct domain_device *dev)
asd_ddbsite_write_byte(asd_ha, ddb, CONN_MASK, dev->port->phy_mask); asd_ddbsite_write_byte(asd_ha, ddb, CONN_MASK, dev->port->phy_mask);
if (dev->port->oob_mode != SATA_OOB_MODE) { if (dev->port->oob_mode != SATA_OOB_MODE) {
flags |= OPEN_REQUIRED; flags |= OPEN_REQUIRED;
if ((dev->dev_type == SATA_DEV) || if ((dev->dev_type == SAS_SATA_DEV) ||
(dev->tproto & SAS_PROTOCOL_STP)) { (dev->tproto & SAS_PROTOCOL_STP)) {
struct smp_resp *rps_resp = &dev->sata_dev.rps_resp; struct smp_resp *rps_resp = &dev->sata_dev.rps_resp;
if (rps_resp->frame_type == SMP_RESPONSE && if (rps_resp->frame_type == SMP_RESPONSE &&
...@@ -188,8 +188,8 @@ static int asd_init_target_ddb(struct domain_device *dev) ...@@ -188,8 +188,8 @@ static int asd_init_target_ddb(struct domain_device *dev)
} else { } else {
flags |= CONCURRENT_CONN_SUPP; flags |= CONCURRENT_CONN_SUPP;
if (!dev->parent && if (!dev->parent &&
(dev->dev_type == EDGE_DEV || (dev->dev_type == SAS_EDGE_EXPANDER_DEVICE ||
dev->dev_type == FANOUT_DEV)) dev->dev_type == SAS_FANOUT_EXPANDER_DEVICE))
asd_ddbsite_write_byte(asd_ha, ddb, MAX_CCONN, asd_ddbsite_write_byte(asd_ha, ddb, MAX_CCONN,
4); 4);
else else
...@@ -198,7 +198,7 @@ static int asd_init_target_ddb(struct domain_device *dev) ...@@ -198,7 +198,7 @@ static int asd_init_target_ddb(struct domain_device *dev)
asd_ddbsite_write_byte(asd_ha, ddb, NUM_CTX, 1); asd_ddbsite_write_byte(asd_ha, ddb, NUM_CTX, 1);
} }
} }
if (dev->dev_type == SATA_PM) if (dev->dev_type == SAS_SATA_PM)
flags |= SATA_MULTIPORT; flags |= SATA_MULTIPORT;
asd_ddbsite_write_byte(asd_ha, ddb, DDB_TARG_FLAGS, flags); asd_ddbsite_write_byte(asd_ha, ddb, DDB_TARG_FLAGS, flags);
...@@ -211,7 +211,7 @@ static int asd_init_target_ddb(struct domain_device *dev) ...@@ -211,7 +211,7 @@ static int asd_init_target_ddb(struct domain_device *dev)
asd_ddbsite_write_word(asd_ha, ddb, SEND_QUEUE_TAIL, 0xFFFF); asd_ddbsite_write_word(asd_ha, ddb, SEND_QUEUE_TAIL, 0xFFFF);
asd_ddbsite_write_word(asd_ha, ddb, SISTER_DDB, 0xFFFF); asd_ddbsite_write_word(asd_ha, ddb, SISTER_DDB, 0xFFFF);
if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { if (dev->dev_type == SAS_SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) {
i = asd_init_sata(dev); i = asd_init_sata(dev);
if (i < 0) { if (i < 0) {
asd_free_ddb(asd_ha, ddb); asd_free_ddb(asd_ha, ddb);
...@@ -219,7 +219,7 @@ static int asd_init_target_ddb(struct domain_device *dev) ...@@ -219,7 +219,7 @@ static int asd_init_target_ddb(struct domain_device *dev)
} }
} }
if (dev->dev_type == SAS_END_DEV) { if (dev->dev_type == SAS_END_DEVICE) {
struct sas_end_device *rdev = rphy_to_end_device(dev->rphy); struct sas_end_device *rdev = rphy_to_end_device(dev->rphy);
if (rdev->I_T_nexus_loss_timeout > 0) if (rdev->I_T_nexus_loss_timeout > 0)
asd_ddbsite_write_word(asd_ha, ddb, ITNL_TIMEOUT, asd_ddbsite_write_word(asd_ha, ddb, ITNL_TIMEOUT,
...@@ -328,10 +328,10 @@ int asd_dev_found(struct domain_device *dev) ...@@ -328,10 +328,10 @@ int asd_dev_found(struct domain_device *dev)
spin_lock_irqsave(&asd_ha->hw_prof.ddb_lock, flags); spin_lock_irqsave(&asd_ha->hw_prof.ddb_lock, flags);
switch (dev->dev_type) { switch (dev->dev_type) {
case SATA_PM: case SAS_SATA_PM:
res = asd_init_sata_pm_ddb(dev); res = asd_init_sata_pm_ddb(dev);
break; break;
case SATA_PM_PORT: case SAS_SATA_PM_PORT:
res = asd_init_sata_pm_port_ddb(dev); res = asd_init_sata_pm_port_ddb(dev);
break; break;
default: default:
......
...@@ -74,7 +74,7 @@ static void asd_init_phy_identify(struct asd_phy *phy) ...@@ -74,7 +74,7 @@ static void asd_init_phy_identify(struct asd_phy *phy)
memset(phy->identify_frame, 0, sizeof(*phy->identify_frame)); memset(phy->identify_frame, 0, sizeof(*phy->identify_frame));
phy->identify_frame->dev_type = SAS_END_DEV; phy->identify_frame->dev_type = SAS_END_DEVICE;
if (phy->sas_phy.role & PHY_ROLE_INITIATOR) if (phy->sas_phy.role & PHY_ROLE_INITIATOR)
phy->identify_frame->initiator_bits = phy->sas_phy.iproto; phy->identify_frame->initiator_bits = phy->sas_phy.iproto;
if (phy->sas_phy.role & PHY_ROLE_TARGET) if (phy->sas_phy.role & PHY_ROLE_TARGET)
......
...@@ -184,7 +184,7 @@ int asd_I_T_nexus_reset(struct domain_device *dev) ...@@ -184,7 +184,7 @@ int asd_I_T_nexus_reset(struct domain_device *dev)
struct sas_phy *phy = sas_get_local_phy(dev); struct sas_phy *phy = sas_get_local_phy(dev);
/* Standard mandates link reset for ATA (type 0) and /* Standard mandates link reset for ATA (type 0) and
* hard reset for SSP (type 1) */ * hard reset for SSP (type 1) */
int reset_type = (dev->dev_type == SATA_DEV || int reset_type = (dev->dev_type == SAS_SATA_DEV ||
(dev->tproto & SAS_PROTOCOL_STP)) ? 0 : 1; (dev->tproto & SAS_PROTOCOL_STP)) ? 0 : 1;
asd_clear_nexus_I_T(dev, NEXUS_PHASE_PRE); asd_clear_nexus_I_T(dev, NEXUS_PHASE_PRE);
......
...@@ -1085,7 +1085,7 @@ static void sci_remote_device_ready_state_enter(struct sci_base_state_machine *s ...@@ -1085,7 +1085,7 @@ static void sci_remote_device_ready_state_enter(struct sci_base_state_machine *s
struct isci_host *ihost = idev->owning_port->owning_controller; struct isci_host *ihost = idev->owning_port->owning_controller;
struct domain_device *dev = idev->domain_dev; struct domain_device *dev = idev->domain_dev;
if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_SATA)) { if (dev->dev_type == SAS_SATA_DEV || (dev->tproto & SAS_PROTOCOL_SATA)) {
sci_change_state(&idev->sm, SCI_STP_DEV_IDLE); sci_change_state(&idev->sm, SCI_STP_DEV_IDLE);
} else if (dev_is_expander(dev)) { } else if (dev_is_expander(dev)) {
sci_change_state(&idev->sm, SCI_SMP_DEV_IDLE); sci_change_state(&idev->sm, SCI_SMP_DEV_IDLE);
...@@ -1098,7 +1098,7 @@ static void sci_remote_device_ready_state_exit(struct sci_base_state_machine *sm ...@@ -1098,7 +1098,7 @@ static void sci_remote_device_ready_state_exit(struct sci_base_state_machine *sm
struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm);
struct domain_device *dev = idev->domain_dev; struct domain_device *dev = idev->domain_dev;
if (dev->dev_type == SAS_END_DEV) { if (dev->dev_type == SAS_END_DEVICE) {
struct isci_host *ihost = idev->owning_port->owning_controller; struct isci_host *ihost = idev->owning_port->owning_controller;
isci_remote_device_not_ready(ihost, idev, isci_remote_device_not_ready(ihost, idev,
......
...@@ -297,7 +297,7 @@ static inline struct isci_remote_device *rnc_to_dev(struct sci_remote_node_conte ...@@ -297,7 +297,7 @@ static inline struct isci_remote_device *rnc_to_dev(struct sci_remote_node_conte
static inline bool dev_is_expander(struct domain_device *dev) static inline bool dev_is_expander(struct domain_device *dev)
{ {
return dev->dev_type == EDGE_DEV || dev->dev_type == FANOUT_DEV; return dev->dev_type == SAS_EDGE_EXPANDER_DEVICE || dev->dev_type == SAS_FANOUT_EXPANDER_DEVICE;
} }
static inline void sci_remote_device_decrement_request_count(struct isci_remote_device *idev) static inline void sci_remote_device_decrement_request_count(struct isci_remote_device *idev)
......
...@@ -2978,7 +2978,7 @@ static void sci_request_started_state_enter(struct sci_base_state_machine *sm) ...@@ -2978,7 +2978,7 @@ static void sci_request_started_state_enter(struct sci_base_state_machine *sm)
/* all unaccelerated request types (non ssp or ncq) handled with /* all unaccelerated request types (non ssp or ncq) handled with
* substates * substates
*/ */
if (!task && dev->dev_type == SAS_END_DEV) { if (!task && dev->dev_type == SAS_END_DEVICE) {
state = SCI_REQ_TASK_WAIT_TC_COMP; state = SCI_REQ_TASK_WAIT_TC_COMP;
} else if (task && task->task_proto == SAS_PROTOCOL_SMP) { } else if (task && task->task_proto == SAS_PROTOCOL_SMP) {
state = SCI_REQ_SMP_WAIT_RESP; state = SCI_REQ_SMP_WAIT_RESP;
...@@ -3101,7 +3101,7 @@ sci_io_request_construct(struct isci_host *ihost, ...@@ -3101,7 +3101,7 @@ sci_io_request_construct(struct isci_host *ihost,
if (idev->rnc.remote_node_index == SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) if (idev->rnc.remote_node_index == SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX)
return SCI_FAILURE_INVALID_REMOTE_DEVICE; return SCI_FAILURE_INVALID_REMOTE_DEVICE;
if (dev->dev_type == SAS_END_DEV) if (dev->dev_type == SAS_END_DEVICE)
/* pass */; /* pass */;
else if (dev_is_sata(dev)) else if (dev_is_sata(dev))
memset(&ireq->stp.cmd, 0, sizeof(ireq->stp.cmd)); memset(&ireq->stp.cmd, 0, sizeof(ireq->stp.cmd));
...@@ -3125,7 +3125,7 @@ enum sci_status sci_task_request_construct(struct isci_host *ihost, ...@@ -3125,7 +3125,7 @@ enum sci_status sci_task_request_construct(struct isci_host *ihost,
/* Build the common part of the request */ /* Build the common part of the request */
sci_general_request_construct(ihost, idev, ireq); sci_general_request_construct(ihost, idev, ireq);
if (dev->dev_type == SAS_END_DEV || dev_is_sata(dev)) { if (dev->dev_type == SAS_END_DEVICE || dev_is_sata(dev)) {
set_bit(IREQ_TMF, &ireq->flags); set_bit(IREQ_TMF, &ireq->flags);
memset(ireq->tc, 0, sizeof(struct scu_task_context)); memset(ireq->tc, 0, sizeof(struct scu_task_context));
......
...@@ -250,7 +250,7 @@ static struct isci_request *isci_task_request_build(struct isci_host *ihost, ...@@ -250,7 +250,7 @@ static struct isci_request *isci_task_request_build(struct isci_host *ihost,
} }
/* XXX convert to get this from task->tproto like other drivers */ /* XXX convert to get this from task->tproto like other drivers */
if (dev->dev_type == SAS_END_DEV) { if (dev->dev_type == SAS_END_DEVICE) {
isci_tmf->proto = SAS_PROTOCOL_SSP; isci_tmf->proto = SAS_PROTOCOL_SSP;
status = sci_task_request_construct_ssp(ireq); status = sci_task_request_construct_ssp(ireq);
if (status != SCI_SUCCESS) if (status != SCI_SUCCESS)
......
...@@ -285,14 +285,14 @@ int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy) ...@@ -285,14 +285,14 @@ int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy)
if (phy->attached_tproto & SAS_PROTOCOL_STP) if (phy->attached_tproto & SAS_PROTOCOL_STP)
dev->tproto = phy->attached_tproto; dev->tproto = phy->attached_tproto;
if (phy->attached_sata_dev) if (phy->attached_sata_dev)
dev->tproto |= SATA_DEV; dev->tproto |= SAS_SATA_DEV;
if (phy->attached_dev_type == SATA_PENDING) if (phy->attached_dev_type == SAS_SATA_PENDING)
dev->dev_type = SATA_PENDING; dev->dev_type = SAS_SATA_PENDING;
else { else {
int res; int res;
dev->dev_type = SATA_DEV; dev->dev_type = SAS_SATA_DEV;
res = sas_get_report_phy_sata(dev->parent, phy->phy_id, res = sas_get_report_phy_sata(dev->parent, phy->phy_id,
&dev->sata_dev.rps_resp); &dev->sata_dev.rps_resp);
if (res) { if (res) {
...@@ -314,7 +314,7 @@ static int sas_ata_clear_pending(struct domain_device *dev, struct ex_phy *phy) ...@@ -314,7 +314,7 @@ static int sas_ata_clear_pending(struct domain_device *dev, struct ex_phy *phy)
int res; int res;
/* we weren't pending, so successfully end the reset sequence now */ /* we weren't pending, so successfully end the reset sequence now */
if (dev->dev_type != SATA_PENDING) if (dev->dev_type != SAS_SATA_PENDING)
return 1; return 1;
/* hmmm, if this succeeds do we need to repost the domain_device to the /* hmmm, if this succeeds do we need to repost the domain_device to the
...@@ -348,9 +348,9 @@ static int smp_ata_check_ready(struct ata_link *link) ...@@ -348,9 +348,9 @@ static int smp_ata_check_ready(struct ata_link *link)
return 0; return 0;
switch (ex_phy->attached_dev_type) { switch (ex_phy->attached_dev_type) {
case SATA_PENDING: case SAS_SATA_PENDING:
return 0; return 0;
case SAS_END_DEV: case SAS_END_DEVICE:
if (ex_phy->attached_sata_dev) if (ex_phy->attached_sata_dev)
return sas_ata_clear_pending(dev, ex_phy); return sas_ata_clear_pending(dev, ex_phy);
default: default:
...@@ -631,7 +631,7 @@ static void sas_get_ata_command_set(struct domain_device *dev) ...@@ -631,7 +631,7 @@ static void sas_get_ata_command_set(struct domain_device *dev)
struct dev_to_host_fis *fis = struct dev_to_host_fis *fis =
(struct dev_to_host_fis *) dev->frame_rcvd; (struct dev_to_host_fis *) dev->frame_rcvd;
if (dev->dev_type == SATA_PENDING) if (dev->dev_type == SAS_SATA_PENDING)
return; return;
if ((fis->sector_count == 1 && /* ATA */ if ((fis->sector_count == 1 && /* ATA */
...@@ -797,7 +797,7 @@ int sas_discover_sata(struct domain_device *dev) ...@@ -797,7 +797,7 @@ int sas_discover_sata(struct domain_device *dev)
{ {
int res; int res;
if (dev->dev_type == SATA_PM) if (dev->dev_type == SAS_SATA_PM)
return -ENODEV; return -ENODEV;
sas_get_ata_command_set(dev); sas_get_ata_command_set(dev);
......
...@@ -39,11 +39,11 @@ ...@@ -39,11 +39,11 @@
void sas_init_dev(struct domain_device *dev) void sas_init_dev(struct domain_device *dev)
{ {
switch (dev->dev_type) { switch (dev->dev_type) {
case SAS_END_DEV: case SAS_END_DEVICE:
INIT_LIST_HEAD(&dev->ssp_dev.eh_list_node); INIT_LIST_HEAD(&dev->ssp_dev.eh_list_node);
break; break;
case EDGE_DEV: case SAS_EDGE_EXPANDER_DEVICE:
case FANOUT_DEV: case SAS_FANOUT_EXPANDER_DEVICE:
INIT_LIST_HEAD(&dev->ex_dev.children); INIT_LIST_HEAD(&dev->ex_dev.children);
mutex_init(&dev->ex_dev.cmd_mutex); mutex_init(&dev->ex_dev.cmd_mutex);
break; break;
...@@ -93,9 +93,9 @@ static int sas_get_port_device(struct asd_sas_port *port) ...@@ -93,9 +93,9 @@ static int sas_get_port_device(struct asd_sas_port *port)
if (fis->interrupt_reason == 1 && fis->lbal == 1 && if (fis->interrupt_reason == 1 && fis->lbal == 1 &&
fis->byte_count_low==0x69 && fis->byte_count_high == 0x96 fis->byte_count_low==0x69 && fis->byte_count_high == 0x96
&& (fis->device & ~0x10) == 0) && (fis->device & ~0x10) == 0)
dev->dev_type = SATA_PM; dev->dev_type = SAS_SATA_PM;
else else
dev->dev_type = SATA_DEV; dev->dev_type = SAS_SATA_DEV;
dev->tproto = SAS_PROTOCOL_SATA; dev->tproto = SAS_PROTOCOL_SATA;
} else { } else {
struct sas_identify_frame *id = struct sas_identify_frame *id =
...@@ -109,21 +109,21 @@ static int sas_get_port_device(struct asd_sas_port *port) ...@@ -109,21 +109,21 @@ static int sas_get_port_device(struct asd_sas_port *port)
dev->port = port; dev->port = port;
switch (dev->dev_type) { switch (dev->dev_type) {
case SATA_DEV: case SAS_SATA_DEV:
rc = sas_ata_init(dev); rc = sas_ata_init(dev);
if (rc) { if (rc) {
rphy = NULL; rphy = NULL;
break; break;
} }
/* fall through */ /* fall through */
case SAS_END_DEV: case SAS_END_DEVICE:
rphy = sas_end_device_alloc(port->port); rphy = sas_end_device_alloc(port->port);
break; break;
case EDGE_DEV: case SAS_EDGE_EXPANDER_DEVICE:
rphy = sas_expander_alloc(port->port, rphy = sas_expander_alloc(port->port,
SAS_EDGE_EXPANDER_DEVICE); SAS_EDGE_EXPANDER_DEVICE);
break; break;
case FANOUT_DEV: case SAS_FANOUT_EXPANDER_DEVICE:
rphy = sas_expander_alloc(port->port, rphy = sas_expander_alloc(port->port,
SAS_FANOUT_EXPANDER_DEVICE); SAS_FANOUT_EXPANDER_DEVICE);
break; break;
...@@ -156,7 +156,7 @@ static int sas_get_port_device(struct asd_sas_port *port) ...@@ -156,7 +156,7 @@ static int sas_get_port_device(struct asd_sas_port *port)
dev->rphy = rphy; dev->rphy = rphy;
get_device(&dev->rphy->dev); get_device(&dev->rphy->dev);
if (dev_is_sata(dev) || dev->dev_type == SAS_END_DEV) if (dev_is_sata(dev) || dev->dev_type == SAS_END_DEVICE)
list_add_tail(&dev->disco_list_node, &port->disco_list); list_add_tail(&dev->disco_list_node, &port->disco_list);
else { else {
spin_lock_irq(&port->dev_list_lock); spin_lock_irq(&port->dev_list_lock);
...@@ -315,7 +315,7 @@ void sas_free_device(struct kref *kref) ...@@ -315,7 +315,7 @@ void sas_free_device(struct kref *kref)
dev->phy = NULL; dev->phy = NULL;
/* remove the phys and ports, everything else should be gone */ /* remove the phys and ports, everything else should be gone */
if (dev->dev_type == EDGE_DEV || dev->dev_type == FANOUT_DEV) if (dev->dev_type == SAS_EDGE_EXPANDER_DEVICE || dev->dev_type == SAS_FANOUT_EXPANDER_DEVICE)
kfree(dev->ex_dev.ex_phy); kfree(dev->ex_dev.ex_phy);
if (dev_is_sata(dev) && dev->sata_dev.ap) { if (dev_is_sata(dev) && dev->sata_dev.ap) {
...@@ -343,7 +343,7 @@ static void sas_unregister_common_dev(struct asd_sas_port *port, struct domain_d ...@@ -343,7 +343,7 @@ static void sas_unregister_common_dev(struct asd_sas_port *port, struct domain_d
spin_unlock_irq(&port->dev_list_lock); spin_unlock_irq(&port->dev_list_lock);
spin_lock_irq(&ha->lock); spin_lock_irq(&ha->lock);
if (dev->dev_type == SAS_END_DEV && if (dev->dev_type == SAS_END_DEVICE &&
!list_empty(&dev->ssp_dev.eh_list_node)) { !list_empty(&dev->ssp_dev.eh_list_node)) {
list_del_init(&dev->ssp_dev.eh_list_node); list_del_init(&dev->ssp_dev.eh_list_node);
ha->eh_active--; ha->eh_active--;
...@@ -457,15 +457,15 @@ static void sas_discover_domain(struct work_struct *work) ...@@ -457,15 +457,15 @@ static void sas_discover_domain(struct work_struct *work)
task_pid_nr(current)); task_pid_nr(current));
switch (dev->dev_type) { switch (dev->dev_type) {
case SAS_END_DEV: case SAS_END_DEVICE:
error = sas_discover_end_dev(dev); error = sas_discover_end_dev(dev);
break; break;
case EDGE_DEV: case SAS_EDGE_EXPANDER_DEVICE:
case FANOUT_DEV: case SAS_FANOUT_EXPANDER_DEVICE:
error = sas_discover_root_expander(dev); error = sas_discover_root_expander(dev);
break; break;
case SATA_DEV: case SAS_SATA_DEV:
case SATA_PM: case SAS_SATA_PM:
#ifdef CONFIG_SCSI_SAS_ATA #ifdef CONFIG_SCSI_SAS_ATA
error = sas_discover_sata(dev); error = sas_discover_sata(dev);
break; break;
......
This diff is collapsed.
...@@ -131,16 +131,16 @@ static inline void sas_fill_in_rphy(struct domain_device *dev, ...@@ -131,16 +131,16 @@ static inline void sas_fill_in_rphy(struct domain_device *dev,
rphy->identify.initiator_port_protocols = dev->iproto; rphy->identify.initiator_port_protocols = dev->iproto;
rphy->identify.target_port_protocols = dev->tproto; rphy->identify.target_port_protocols = dev->tproto;
switch (dev->dev_type) { switch (dev->dev_type) {
case SATA_DEV: case SAS_SATA_DEV:
/* FIXME: need sata device type */ /* FIXME: need sata device type */
case SAS_END_DEV: case SAS_END_DEVICE:
case SATA_PENDING: case SAS_SATA_PENDING:
rphy->identify.device_type = SAS_END_DEVICE; rphy->identify.device_type = SAS_END_DEVICE;
break; break;
case EDGE_DEV: case SAS_EDGE_EXPANDER_DEVICE:
rphy->identify.device_type = SAS_EDGE_EXPANDER_DEVICE; rphy->identify.device_type = SAS_EDGE_EXPANDER_DEVICE;
break; break;
case FANOUT_DEV: case SAS_FANOUT_EXPANDER_DEVICE:
rphy->identify.device_type = SAS_FANOUT_EXPANDER_DEVICE; rphy->identify.device_type = SAS_FANOUT_EXPANDER_DEVICE;
break; break;
default: default:
......
...@@ -69,7 +69,7 @@ static void sas_resume_port(struct asd_sas_phy *phy) ...@@ -69,7 +69,7 @@ static void sas_resume_port(struct asd_sas_phy *phy)
continue; continue;
} }
if (dev->dev_type == EDGE_DEV || dev->dev_type == FANOUT_DEV) { if (dev->dev_type == SAS_EDGE_EXPANDER_DEVICE || dev->dev_type == SAS_FANOUT_EXPANDER_DEVICE) {
dev->ex_dev.ex_change_count = -1; dev->ex_dev.ex_change_count = -1;
for (i = 0; i < dev->ex_dev.num_phys; i++) { for (i = 0; i < dev->ex_dev.num_phys; i++) {
struct ex_phy *phy = &dev->ex_dev.ex_phy[i]; struct ex_phy *phy = &dev->ex_dev.ex_phy[i];
......
...@@ -254,7 +254,7 @@ static int mvs_alloc(struct mvs_info *mvi, struct Scsi_Host *shost) ...@@ -254,7 +254,7 @@ static int mvs_alloc(struct mvs_info *mvi, struct Scsi_Host *shost)
} }
for (i = 0; i < MVS_MAX_DEVICES; i++) { for (i = 0; i < MVS_MAX_DEVICES; i++) {
mvi->devices[i].taskfileset = MVS_ID_NOT_MAPPED; mvi->devices[i].taskfileset = MVS_ID_NOT_MAPPED;
mvi->devices[i].dev_type = NO_DEVICE; mvi->devices[i].dev_type = SAS_PHY_UNUSED;
mvi->devices[i].device_id = i; mvi->devices[i].device_id = i;
mvi->devices[i].dev_status = MVS_DEV_NORMAL; mvi->devices[i].dev_status = MVS_DEV_NORMAL;
init_timer(&mvi->devices[i].timer); init_timer(&mvi->devices[i].timer);
......
...@@ -706,7 +706,7 @@ static int mvs_task_prep_ssp(struct mvs_info *mvi, ...@@ -706,7 +706,7 @@ static int mvs_task_prep_ssp(struct mvs_info *mvi,
return 0; return 0;
} }
#define DEV_IS_GONE(mvi_dev) ((!mvi_dev || (mvi_dev->dev_type == NO_DEVICE))) #define DEV_IS_GONE(mvi_dev) ((!mvi_dev || (mvi_dev->dev_type == SAS_PHY_UNUSED)))
static int mvs_task_prep(struct sas_task *task, struct mvs_info *mvi, int is_tmf, static int mvs_task_prep(struct sas_task *task, struct mvs_info *mvi, int is_tmf,
struct mvs_tmf_task *tmf, int *pass) struct mvs_tmf_task *tmf, int *pass)
{ {
...@@ -726,7 +726,7 @@ static int mvs_task_prep(struct sas_task *task, struct mvs_info *mvi, int is_tmf ...@@ -726,7 +726,7 @@ static int mvs_task_prep(struct sas_task *task, struct mvs_info *mvi, int is_tmf
* libsas will use dev->port, should * libsas will use dev->port, should
* not call task_done for sata * not call task_done for sata
*/ */
if (dev->dev_type != SATA_DEV) if (dev->dev_type != SAS_SATA_DEV)
task->task_done(task); task->task_done(task);
return rc; return rc;
} }
...@@ -1159,10 +1159,10 @@ void mvs_update_phyinfo(struct mvs_info *mvi, int i, int get_st) ...@@ -1159,10 +1159,10 @@ void mvs_update_phyinfo(struct mvs_info *mvi, int i, int get_st)
phy->identify.device_type = phy->identify.device_type =
phy->att_dev_info & PORT_DEV_TYPE_MASK; phy->att_dev_info & PORT_DEV_TYPE_MASK;
if (phy->identify.device_type == SAS_END_DEV) if (phy->identify.device_type == SAS_END_DEVICE)
phy->identify.target_port_protocols = phy->identify.target_port_protocols =
SAS_PROTOCOL_SSP; SAS_PROTOCOL_SSP;
else if (phy->identify.device_type != NO_DEVICE) else if (phy->identify.device_type != SAS_PHY_UNUSED)
phy->identify.target_port_protocols = phy->identify.target_port_protocols =
SAS_PROTOCOL_SMP; SAS_PROTOCOL_SMP;
if (oob_done) if (oob_done)
...@@ -1260,7 +1260,7 @@ struct mvs_device *mvs_alloc_dev(struct mvs_info *mvi) ...@@ -1260,7 +1260,7 @@ struct mvs_device *mvs_alloc_dev(struct mvs_info *mvi)
{ {
u32 dev; u32 dev;
for (dev = 0; dev < MVS_MAX_DEVICES; dev++) { for (dev = 0; dev < MVS_MAX_DEVICES; dev++) {
if (mvi->devices[dev].dev_type == NO_DEVICE) { if (mvi->devices[dev].dev_type == SAS_PHY_UNUSED) {
mvi->devices[dev].device_id = dev; mvi->devices[dev].device_id = dev;
return &mvi->devices[dev]; return &mvi->devices[dev];
} }
...@@ -1278,7 +1278,7 @@ void mvs_free_dev(struct mvs_device *mvi_dev) ...@@ -1278,7 +1278,7 @@ void mvs_free_dev(struct mvs_device *mvi_dev)
u32 id = mvi_dev->device_id; u32 id = mvi_dev->device_id;
memset(mvi_dev, 0, sizeof(*mvi_dev)); memset(mvi_dev, 0, sizeof(*mvi_dev));
mvi_dev->device_id = id; mvi_dev->device_id = id;
mvi_dev->dev_type = NO_DEVICE; mvi_dev->dev_type = SAS_PHY_UNUSED;
mvi_dev->dev_status = MVS_DEV_NORMAL; mvi_dev->dev_status = MVS_DEV_NORMAL;
mvi_dev->taskfileset = MVS_ID_NOT_MAPPED; mvi_dev->taskfileset = MVS_ID_NOT_MAPPED;
} }
...@@ -1480,7 +1480,7 @@ static int mvs_debug_I_T_nexus_reset(struct domain_device *dev) ...@@ -1480,7 +1480,7 @@ static int mvs_debug_I_T_nexus_reset(struct domain_device *dev)
{ {
int rc; int rc;
struct sas_phy *phy = sas_get_local_phy(dev); struct sas_phy *phy = sas_get_local_phy(dev);
int reset_type = (dev->dev_type == SATA_DEV || int reset_type = (dev->dev_type == SAS_SATA_DEV ||
(dev->tproto & SAS_PROTOCOL_STP)) ? 0 : 1; (dev->tproto & SAS_PROTOCOL_STP)) ? 0 : 1;
rc = sas_phy_reset(phy, reset_type); rc = sas_phy_reset(phy, reset_type);
sas_put_local_phy(phy); sas_put_local_phy(phy);
...@@ -1629,7 +1629,7 @@ int mvs_abort_task(struct sas_task *task) ...@@ -1629,7 +1629,7 @@ int mvs_abort_task(struct sas_task *task)
} else if (task->task_proto & SAS_PROTOCOL_SATA || } else if (task->task_proto & SAS_PROTOCOL_SATA ||
task->task_proto & SAS_PROTOCOL_STP) { task->task_proto & SAS_PROTOCOL_STP) {
if (SATA_DEV == dev->dev_type) { if (SAS_SATA_DEV == dev->dev_type) {
struct mvs_slot_info *slot = task->lldd_task; struct mvs_slot_info *slot = task->lldd_task;
u32 slot_idx = (u32)(slot - mvi->slot_info); u32 slot_idx = (u32)(slot - mvi->slot_info);
mv_dprintk("mvs_abort_task() mvi=%p task=%p " mv_dprintk("mvs_abort_task() mvi=%p task=%p "
......
...@@ -67,7 +67,7 @@ extern const struct mvs_dispatch mvs_94xx_dispatch; ...@@ -67,7 +67,7 @@ extern const struct mvs_dispatch mvs_94xx_dispatch;
extern struct kmem_cache *mvs_task_list_cache; extern struct kmem_cache *mvs_task_list_cache;
#define DEV_IS_EXPANDER(type) \ #define DEV_IS_EXPANDER(type) \
((type == EDGE_DEV) || (type == FANOUT_DEV)) ((type == SAS_EDGE_EXPANDER_DEVICE) || (type == SAS_FANOUT_EXPANDER_DEVICE))
#define bit(n) ((u64)1 << n) #define bit(n) ((u64)1 << n)
...@@ -241,7 +241,7 @@ struct mvs_phy { ...@@ -241,7 +241,7 @@ struct mvs_phy {
struct mvs_device { struct mvs_device {
struct list_head dev_entry; struct list_head dev_entry;
enum sas_dev_type dev_type; enum sas_device_type dev_type;
struct mvs_info *mvi_info; struct mvs_info *mvi_info;
struct domain_device *sas_device; struct domain_device *sas_device;
struct timer_list timer; struct timer_list timer;
......
...@@ -1505,7 +1505,7 @@ void pm8001_work_fn(struct work_struct *work) ...@@ -1505,7 +1505,7 @@ void pm8001_work_fn(struct work_struct *work)
pm8001_dev = pw->data; /* Most stash device structure */ pm8001_dev = pw->data; /* Most stash device structure */
if ((pm8001_dev == NULL) if ((pm8001_dev == NULL)
|| ((pw->handler != IO_XFER_ERROR_BREAK) || ((pw->handler != IO_XFER_ERROR_BREAK)
&& (pm8001_dev->dev_type == NO_DEVICE))) { && (pm8001_dev->dev_type == SAS_PHY_UNUSED))) {
kfree(pw); kfree(pw);
return; return;
} }
...@@ -3443,7 +3443,7 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3443,7 +3443,7 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)
sizeof(struct dev_to_host_fis)); sizeof(struct dev_to_host_fis));
phy->frame_rcvd_size = sizeof(struct dev_to_host_fis); phy->frame_rcvd_size = sizeof(struct dev_to_host_fis);
phy->identify.target_port_protocols = SAS_PROTOCOL_SATA; phy->identify.target_port_protocols = SAS_PROTOCOL_SATA;
phy->identify.device_type = SATA_DEV; phy->identify.device_type = SAS_SATA_DEV;
pm8001_get_attached_sas_addr(phy, phy->sas_phy.attached_sas_addr); pm8001_get_attached_sas_addr(phy, phy->sas_phy.attached_sas_addr);
spin_unlock_irqrestore(&phy->sas_phy.frame_rcvd_lock, flags); spin_unlock_irqrestore(&phy->sas_phy.frame_rcvd_lock, flags);
pm8001_bytes_dmaed(pm8001_ha, phy_id); pm8001_bytes_dmaed(pm8001_ha, phy_id);
...@@ -4465,7 +4465,7 @@ pm8001_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id) ...@@ -4465,7 +4465,7 @@ pm8001_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id)
payload.ase_sh_lm_slr_phyid = cpu_to_le32(SPINHOLD_DISABLE | payload.ase_sh_lm_slr_phyid = cpu_to_le32(SPINHOLD_DISABLE |
LINKMODE_AUTO | LINKRATE_15 | LINKMODE_AUTO | LINKRATE_15 |
LINKRATE_30 | LINKRATE_60 | phy_id); LINKRATE_30 | LINKRATE_60 | phy_id);
payload.sas_identify.dev_type = SAS_END_DEV;