isci: unify isci_port and scic_sds_port

Remove the distinction between these two implementations and unify on
isci_port (local instances named iport).  The duplicate '->owning_port' and
'->isci_port' in both isci_phy and isci_remote_device will be fixed in a later
patch... this is just the straightforward rename/unification.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
Dan Williams 2011-06-29 13:09:25 -07:00
Родитель 76802ce675
Коммит ffe191c92f
10 изменённых файлов: 481 добавлений и 581 удалений

Просмотреть файл

@ -1054,9 +1054,9 @@ static enum sci_status scic_controller_start(struct scic_sds_controller *scic,
/* Start all of the ports on this controller */
for (index = 0; index < scic->logical_port_entries; index++) {
struct scic_sds_port *sci_port = &ihost->ports[index].sci;
struct isci_port *iport = &ihost->ports[index];
result = scic_sds_port_start(sci_port);
result = scic_sds_port_start(iport);
if (result)
return result;
}
@ -1306,8 +1306,8 @@ void isci_host_deinit(struct isci_host *ihost)
/* Cancel any/all outstanding port timers */
for (i = 0; i < ihost->sci.logical_port_entries; i++) {
struct scic_sds_port *sci_port = &ihost->ports[i].sci;
del_timer_sync(&sci_port->timer.timer);
struct isci_port *iport = &ihost->ports[i];
del_timer_sync(&iport->timer.timer);
}
/* Cancel any/all outstanding phy timers */
@ -1552,9 +1552,9 @@ static enum sci_status scic_sds_controller_stop_ports(struct scic_sds_controller
struct isci_host *ihost = scic_to_ihost(scic);
for (index = 0; index < scic->logical_port_entries; index++) {
struct scic_sds_port *sci_port = &ihost->ports[index].sci;
struct isci_port *iport = &ihost->ports[index];
port_status = scic_sds_port_stop(sci_port);
port_status = scic_sds_port_stop(iport);
if ((port_status != SCI_SUCCESS) &&
(port_status != SCI_FAILURE_INVALID_STATE)) {
@ -1564,7 +1564,7 @@ static enum sci_status scic_sds_controller_stop_ports(struct scic_sds_controller
"%s: Controller stop operation failed to "
"stop port %d because of status %d.\n",
__func__,
sci_port->logical_port_index,
iport->logical_port_index,
port_status);
}
}
@ -1780,14 +1780,14 @@ static enum sci_status scic_controller_construct(struct scic_sds_controller *sci
/* Construct the ports for this controller */
for (i = 0; i < SCI_MAX_PORTS; i++)
scic_sds_port_construct(&ihost->ports[i].sci, i, scic);
scic_sds_port_construct(&ihost->ports[i].sci, SCIC_SDS_DUMMY_PORT, scic);
scic_sds_port_construct(&ihost->ports[i], i, scic);
scic_sds_port_construct(&ihost->ports[i], SCIC_SDS_DUMMY_PORT, scic);
/* Construct the phys for this controller */
for (i = 0; i < SCI_MAX_PHYS; i++) {
/* Add all the PHYs to the dummy port */
scic_sds_phy_construct(&ihost->phys[i],
&ihost->ports[SCI_MAX_PORTS].sci, i);
&ihost->ports[SCI_MAX_PORTS], i);
}
scic->invalid_phy_mask = 0;
@ -2233,7 +2233,7 @@ static enum sci_status scic_controller_initialize(struct scic_sds_controller *sc
}
for (i = 0; i < scic->logical_port_entries; i++) {
result = scic_sds_port_initialize(&ihost->ports[i].sci,
result = scic_sds_port_initialize(&ihost->ports[i],
&scic->scu_registers->peg0.ptsg.port[i],
&scic->scu_registers->peg0.ptsg.protocol_engine,
&scic->scu_registers->peg0.viit[i]);
@ -2484,19 +2484,19 @@ int isci_host_init(struct isci_host *isci_host)
}
void scic_sds_controller_link_up(struct scic_sds_controller *scic,
struct scic_sds_port *port, struct isci_phy *iphy)
struct isci_port *iport, struct isci_phy *iphy)
{
switch (scic->sm.current_state_id) {
case SCIC_STARTING:
sci_del_timer(&scic->phy_timer);
scic->phy_startup_timer_pending = false;
scic->port_agent.link_up_handler(scic, &scic->port_agent,
port, iphy);
iport, iphy);
scic_sds_controller_start_next_phy(scic);
break;
case SCIC_READY:
scic->port_agent.link_up_handler(scic, &scic->port_agent,
port, iphy);
iport, iphy);
break;
default:
dev_dbg(scic_to_dev(scic),
@ -2507,13 +2507,13 @@ void scic_sds_controller_link_up(struct scic_sds_controller *scic,
}
void scic_sds_controller_link_down(struct scic_sds_controller *scic,
struct scic_sds_port *port, struct isci_phy *iphy)
struct isci_port *iport, struct isci_phy *iphy)
{
switch (scic->sm.current_state_id) {
case SCIC_STARTING:
case SCIC_READY:
scic->port_agent.link_down_handler(scic, &scic->port_agent,
port, iphy);
iport, iphy);
break;
default:
dev_dbg(scic_to_dev(scic),

Просмотреть файл

@ -108,7 +108,7 @@ struct scic_power_control {
struct scic_sds_port_configuration_agent;
typedef void (*port_config_fn)(struct scic_sds_controller *,
struct scic_sds_port_configuration_agent *,
struct scic_sds_port *, struct isci_phy *);
struct isci_port *, struct isci_phy *);
struct scic_sds_port_configuration_agent {
u16 phy_configured_mask;
@ -532,9 +532,8 @@ static inline struct device *sciphy_to_dev(struct isci_phy *iphy)
return &iphy->isci_port->isci_host->pdev->dev;
}
static inline struct device *sciport_to_dev(struct scic_sds_port *sci_port)
static inline struct device *sciport_to_dev(struct isci_port *iport)
{
struct isci_port *iport = sci_port_to_iport(sci_port);
if (!iport || !iport->isci_host)
return NULL;
@ -613,12 +612,12 @@ void scic_sds_controller_power_control_queue_remove(
void scic_sds_controller_link_up(
struct scic_sds_controller *scic,
struct scic_sds_port *sci_port,
struct isci_port *iport,
struct isci_phy *iphy);
void scic_sds_controller_link_down(
struct scic_sds_controller *scic,
struct scic_sds_port *sci_port,
struct isci_port *iport,
struct isci_phy *iphy);
void scic_sds_controller_remote_device_stopped(
@ -649,7 +648,7 @@ void isci_host_deinit(
void isci_host_port_link_up(
struct isci_host *,
struct scic_sds_port *,
struct isci_port *,
struct isci_phy *);
int isci_host_dev_found(struct domain_device *);

Просмотреть файл

@ -286,7 +286,7 @@ done:
* port (i.e. it's contained in the dummy port). !NULL All other
* values indicate a handle/pointer to the port containing the phy.
*/
struct scic_sds_port *phy_get_non_dummy_port(
struct isci_port *phy_get_non_dummy_port(
struct isci_phy *iphy)
{
if (scic_sds_port_get_index(iphy->owning_port) == SCIC_SDS_DUMMY_PORT)
@ -304,9 +304,9 @@ struct scic_sds_port *phy_get_non_dummy_port(
*/
void scic_sds_phy_set_port(
struct isci_phy *iphy,
struct scic_sds_port *sci_port)
struct isci_port *iport)
{
iphy->owning_port = sci_port;
iphy->owning_port = iport;
if (iphy->bcn_received_while_port_unassigned) {
iphy->bcn_received_while_port_unassigned = false;
@ -1291,12 +1291,12 @@ static const struct sci_base_state scic_sds_phy_state_table[] = {
};
void scic_sds_phy_construct(struct isci_phy *iphy,
struct scic_sds_port *owning_port, u8 phy_index)
struct isci_port *iport, u8 phy_index)
{
sci_init_sm(&iphy->sm, scic_sds_phy_state_table, SCI_PHY_INITIAL);
/* Copy the rest of the input data to our locals */
iphy->owning_port = owning_port;
iphy->owning_port = iport;
iphy->phy_index = phy_index;
iphy->bcn_received_while_port_unassigned = false;
iphy->protocol = SCIC_SDS_PHY_PROTOCOL_UNKNOWN;

Просмотреть файл

@ -93,7 +93,7 @@ enum scic_sds_phy_protocol {
*/
struct isci_phy {
struct sci_base_state_machine sm;
struct scic_sds_port *owning_port;
struct isci_port *owning_port;
enum sas_linkrate max_negotiated_speed;
enum scic_sds_phy_protocol protocol;
u8 phy_index;
@ -178,7 +178,7 @@ struct scic_phy_properties {
* supplied phy. This field may be set to NULL
* if the phy is not currently contained in a port.
*/
struct scic_sds_port *owning_port;
struct isci_port *iport;
/**
* This field specifies the link rate at which the phy is
@ -459,14 +459,14 @@ enum scic_sds_phy_states {
void scic_sds_phy_construct(
struct isci_phy *iphy,
struct scic_sds_port *owning_port,
struct isci_port *iport,
u8 phy_index);
struct scic_sds_port *phy_get_non_dummy_port(struct isci_phy *iphy);
struct isci_port *phy_get_non_dummy_port(struct isci_phy *iphy);
void scic_sds_phy_set_port(
struct isci_phy *iphy,
struct scic_sds_port *owning_port);
struct isci_port *iport);
enum sci_status scic_sds_phy_initialize(
struct isci_phy *iphy,

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -76,100 +76,19 @@ enum isci_status {
};
/**
* struct scic_sds_port
*
* The core port object provides the the abstraction for an SCU port.
*/
struct scic_sds_port {
/**
* This field contains the information for the base port state machine.
*/
struct sci_base_state_machine sm;
bool ready_exit;
/**
* This field is the port index that is reported to the SCI USER.
* This allows the actual hardware physical port to change without
* the SCI USER getting a different answer for the get port index.
*/
u8 logical_port_index;
/**
* This field is the port index used to program the SCU hardware.
*/
u8 physical_port_index;
/**
* This field contains the active phy mask for the port.
* This mask is used in conjunction with the phy state to determine
* which phy to select for some port operations.
*/
u8 active_phy_mask;
u16 reserved_rni;
u16 reserved_tag;
/**
* This field contains the count of the io requests started on this port
* object. It is used to control controller shutdown.
*/
u32 started_request_count;
/**
* This field contains the number of devices assigned to this port.
* It is used to control port start requests.
*/
u32 assigned_device_count;
/**
* This field contains the reason for the port not going ready. It is
* assigned in the state handlers and used in the state transition.
*/
u32 not_ready_reason;
/**
* This field is the table of phys assigned to the port.
*/
struct isci_phy *phy_table[SCI_MAX_PHYS];
/**
* This field is a pointer back to the controller that owns this
* port object.
*/
struct scic_sds_controller *owning_controller;
/* timer used for port start/stop operations */
struct sci_timer timer;
/**
* This field is the pointer to the port task scheduler registers
* for the SCU hardware.
*/
struct scu_port_task_scheduler_registers __iomem
*port_task_scheduler_registers;
/**
* This field is identical for all port objects and points to the port
* task scheduler group PE configuration registers.
* It is used to assign PEs to a port.
*/
u32 __iomem *port_pe_configuration_register;
/**
* This field is the VIIT register space for ths port object.
*/
struct scu_viit_entry __iomem *viit_registers;
};
/**
* struct isci_port - This class represents the port object used to internally
* represent libsas port objects. It also keeps a list of remote device
* objects.
*
*
* struct isci_port - isci direct attached sas port object
* @event: counts bcns and port stop events (for bcn filtering)
* @ready_exit: several states constitute 'ready'. When exiting ready we
* need to take extra port-teardown actions that are
* skipped when exiting to another 'ready' state.
* @logical_port_index: software port index
* @physical_port_index: hardware port index
* @active_phy_mask: identifies phy members
* @reserved_tag:
* @reserved_rni: reserver for port task scheduler workaround
* @started_request_count: reference count for outstanding commands
* @not_ready_reason: set during state transitions and notified
* @timer: timeout start/stop operations
*/
struct isci_port {
enum isci_status status;
@ -185,16 +104,25 @@ struct isci_port {
struct completion start_complete;
struct completion hard_reset_complete;
enum sci_status hard_reset_status;
struct scic_sds_port sci;
struct sci_base_state_machine sm;
bool ready_exit;
u8 logical_port_index;
u8 physical_port_index;
u8 active_phy_mask;
u16 reserved_rni;
u16 reserved_tag;
u32 started_request_count;
u32 assigned_device_count;
u32 not_ready_reason;
struct isci_phy *phy_table[SCI_MAX_PHYS];
struct scic_sds_controller *owning_controller;
struct sci_timer timer;
struct scu_port_task_scheduler_registers __iomem *port_task_scheduler_registers;
/* XXX rework: only one register, no need to replicate per-port */
u32 __iomem *port_pe_configuration_register;
struct scu_viit_entry __iomem *viit_registers;
};
static inline struct isci_port *sci_port_to_iport(struct scic_sds_port *sci_port)
{
struct isci_port *iport = container_of(sci_port, typeof(*iport), sci);
return iport;
}
enum scic_port_not_ready_reason_code {
SCIC_PORT_NOT_READY_NO_ACTIVE_PHYS,
SCIC_PORT_NOT_READY_HARD_RESET_REQUESTED,
@ -299,90 +227,90 @@ enum scic_sds_port_states {
((this_port)->physical_port_index)
static inline void scic_sds_port_decrement_request_count(struct scic_sds_port *sci_port)
static inline void scic_sds_port_decrement_request_count(struct isci_port *iport)
{
if (WARN_ONCE(sci_port->started_request_count == 0,
if (WARN_ONCE(iport->started_request_count == 0,
"%s: tried to decrement started_request_count past 0!?",
__func__))
/* pass */;
else
sci_port->started_request_count--;
iport->started_request_count--;
}
#define scic_sds_port_active_phy(port, phy) \
(((port)->active_phy_mask & (1 << (phy)->phy_index)) != 0)
void scic_sds_port_construct(
struct scic_sds_port *sci_port,
struct isci_port *iport,
u8 port_index,
struct scic_sds_controller *scic);
enum sci_status scic_sds_port_initialize(
struct scic_sds_port *sci_port,
struct isci_port *iport,
void __iomem *port_task_scheduler_registers,
void __iomem *port_configuration_regsiter,
void __iomem *viit_registers);
enum sci_status scic_sds_port_start(struct scic_sds_port *sci_port);
enum sci_status scic_sds_port_stop(struct scic_sds_port *sci_port);
enum sci_status scic_sds_port_start(struct isci_port *iport);
enum sci_status scic_sds_port_stop(struct isci_port *iport);
enum sci_status scic_sds_port_add_phy(
struct scic_sds_port *sci_port,
struct isci_port *iport,
struct isci_phy *iphy);
enum sci_status scic_sds_port_remove_phy(
struct scic_sds_port *sci_port,
struct isci_port *iport,
struct isci_phy *iphy);
void scic_sds_port_setup_transports(
struct scic_sds_port *sci_port,
struct isci_port *iport,
u32 device_id);
void isci_port_bcn_enable(struct isci_host *, struct isci_port *);
void scic_sds_port_deactivate_phy(
struct scic_sds_port *sci_port,
struct isci_port *iport,
struct isci_phy *iphy,
bool do_notify_user);
bool scic_sds_port_link_detected(
struct scic_sds_port *sci_port,
struct isci_port *iport,
struct isci_phy *iphy);
enum sci_status scic_sds_port_link_up(struct scic_sds_port *sci_port,
enum sci_status scic_sds_port_link_up(struct isci_port *iport,
struct isci_phy *iphy);
enum sci_status scic_sds_port_link_down(struct scic_sds_port *sci_port,
enum sci_status scic_sds_port_link_down(struct isci_port *iport,
struct isci_phy *iphy);
struct isci_request;
struct scic_sds_remote_device;
enum sci_status scic_sds_port_start_io(
struct scic_sds_port *sci_port,
struct isci_port *iport,
struct scic_sds_remote_device *sci_dev,
struct isci_request *ireq);
enum sci_status scic_sds_port_complete_io(
struct scic_sds_port *sci_port,
struct isci_port *iport,
struct scic_sds_remote_device *sci_dev,
struct isci_request *ireq);
enum sas_linkrate scic_sds_port_get_max_allowed_speed(
struct scic_sds_port *sci_port);
struct isci_port *iport);
void scic_sds_port_broadcast_change_received(
struct scic_sds_port *sci_port,
struct isci_port *iport,
struct isci_phy *iphy);
bool scic_sds_port_is_valid_phy_assignment(
struct scic_sds_port *sci_port,
struct isci_port *iport,
u32 phy_index);
void scic_sds_port_get_sas_address(
struct scic_sds_port *sci_port,
struct isci_port *iport,
struct sci_sas_address *sas_address);
void scic_sds_port_get_attached_sas_address(
struct scic_sds_port *sci_port,
struct isci_port *iport,
struct sci_sas_address *sas_address);
enum isci_status isci_port_get_state(

Просмотреть файл

@ -112,7 +112,7 @@ static s32 sci_sas_address_compare(
* port. port address if the port can be found to match the phy.
* NULL if there is no matching port for the phy.
*/
static struct scic_sds_port *scic_sds_port_configuration_agent_find_port(
static struct isci_port *scic_sds_port_configuration_agent_find_port(
struct scic_sds_controller *scic,
struct isci_phy *iphy)
{
@ -132,14 +132,14 @@ static struct scic_sds_port *scic_sds_port_configuration_agent_find_port(
for (i = 0; i < scic->logical_port_entries; i++) {
struct isci_host *ihost = scic_to_ihost(scic);
struct scic_sds_port *sci_port = &ihost->ports[i].sci;
struct isci_port *iport = &ihost->ports[i];
scic_sds_port_get_sas_address(sci_port, &port_sas_address);
scic_sds_port_get_attached_sas_address(sci_port, &port_attached_device_address);
scic_sds_port_get_sas_address(iport, &port_sas_address);
scic_sds_port_get_attached_sas_address(iport, &port_attached_device_address);
if (sci_sas_address_compare(port_sas_address, phy_sas_address) == 0 &&
sci_sas_address_compare(port_attached_device_address, phy_attached_device_address) == 0)
return sci_port;
return iport;
}
return NULL;
@ -315,7 +315,7 @@ static enum sci_status scic_sds_mpc_agent_validate_phy_configuration(
port_agent->phy_valid_port_range[phy_index].min_index = port_index;
port_agent->phy_valid_port_range[phy_index].max_index = phy_index;
scic_sds_port_add_phy(&ihost->ports[port_index].sci,
scic_sds_port_add_phy(&ihost->ports[port_index],
&ihost->phys[phy_index]);
assigned_phy_mask |= (1 << phy_index);
@ -367,22 +367,20 @@ done:
static void scic_sds_mpc_agent_link_up(struct scic_sds_controller *controller,
struct scic_sds_port_configuration_agent *port_agent,
struct scic_sds_port *port,
struct isci_port *iport,
struct isci_phy *iphy)
{
/* If the port has an invalid handle then the phy was not assigned to
* a port. This is because the phy was not given the same SAS Address
* as the other PHYs in the port.
/* If the port is NULL then the phy was not assigned to a port.
* This is because the phy was not given the same SAS Address as
* the other PHYs in the port.
*/
if (port != NULL) {
port_agent->phy_ready_mask |= (1 << scic_sds_phy_get_index(iphy));
if (!iport)
return;
scic_sds_port_link_up(port, iphy);
if ((port->active_phy_mask & (1 << scic_sds_phy_get_index(iphy))) != 0) {
port_agent->phy_configured_mask |= (1 << scic_sds_phy_get_index(iphy));
}
}
port_agent->phy_ready_mask |= (1 << scic_sds_phy_get_index(iphy));
scic_sds_port_link_up(iport, iphy);
if ((iport->active_phy_mask & (1 << scic_sds_phy_get_index(iphy))))
port_agent->phy_configured_mask |= (1 << scic_sds_phy_get_index(iphy));
}
/**
@ -405,10 +403,10 @@ static void scic_sds_mpc_agent_link_up(struct scic_sds_controller *controller,
static void scic_sds_mpc_agent_link_down(
struct scic_sds_controller *scic,
struct scic_sds_port_configuration_agent *port_agent,
struct scic_sds_port *sci_port,
struct isci_port *iport,
struct isci_phy *iphy)
{
if (sci_port != NULL) {
if (iport != NULL) {
/*
* If we can form a new port from the remainder of the phys
* then we want to start the timer to allow the SCI User to
@ -436,7 +434,7 @@ static void scic_sds_mpc_agent_link_down(
SCIC_SDS_MPC_RECONFIGURATION_TIMEOUT);
}
scic_sds_port_link_down(sci_port, iphy);
scic_sds_port_link_down(iport, iphy);
}
}
@ -496,14 +494,14 @@ static void scic_sds_apc_agent_configure_ports(struct scic_sds_controller *contr
{
u8 port_index;
enum sci_status status;
struct scic_sds_port *port;
struct isci_port *iport;
enum SCIC_SDS_APC_ACTIVITY apc_activity = SCIC_SDS_APC_SKIP_PHY;
struct isci_host *ihost = scic_to_ihost(controller);
port = scic_sds_port_configuration_agent_find_port(controller, iphy);
iport = scic_sds_port_configuration_agent_find_port(controller, iphy);
if (port != NULL) {
if (scic_sds_port_is_valid_phy_assignment(port, iphy->phy_index))
if (iport) {
if (scic_sds_port_is_valid_phy_assignment(iport, iphy->phy_index))
apc_activity = SCIC_SDS_APC_ADD_PHY;
else
apc_activity = SCIC_SDS_APC_SKIP_PHY;
@ -514,21 +512,19 @@ static void scic_sds_apc_agent_configure_ports(struct scic_sds_controller *contr
* the timer and wait to see if a wider port can be made.
*
* Note the break when we reach the condition of the port id == phy id */
for (
port_index = port_agent->phy_valid_port_range[iphy->phy_index].min_index;
port_index <= port_agent->phy_valid_port_range[iphy->phy_index].max_index;
port_index++
) {
for (port_index = port_agent->phy_valid_port_range[iphy->phy_index].min_index;
port_index <= port_agent->phy_valid_port_range[iphy->phy_index].max_index;
port_index++) {
port = &ihost->ports[port_index].sci;
iport = &ihost->ports[port_index];
/* First we must make sure that this PHY can be added to this Port. */
if (scic_sds_port_is_valid_phy_assignment(port, iphy->phy_index)) {
if (scic_sds_port_is_valid_phy_assignment(iport, iphy->phy_index)) {
/*
* Port contains a PHY with a greater PHY ID than the current
* PHY that has gone link up. This phy can not be part of any
* port so skip it and move on. */
if (port->active_phy_mask > (1 << iphy->phy_index)) {
if (iport->active_phy_mask > (1 << iphy->phy_index)) {
apc_activity = SCIC_SDS_APC_SKIP_PHY;
break;
}
@ -537,7 +533,7 @@ static void scic_sds_apc_agent_configure_ports(struct scic_sds_controller *contr
* We have reached the end of our Port list and have not found
* any reason why we should not either add the PHY to the port
* or wait for more phys to become active. */
if (port->physical_port_index == iphy->phy_index) {
if (iport->physical_port_index == iphy->phy_index) {
/*
* The Port either has no active PHYs.
* Consider that if the port had any active PHYs we would have
@ -554,10 +550,10 @@ static void scic_sds_apc_agent_configure_ports(struct scic_sds_controller *contr
* The current Port has no active PHYs and this PHY could be part
* of this Port. Since we dont know as yet setup to start the
* timer and see if there is a better configuration. */
if (port->active_phy_mask == 0) {
if (iport->active_phy_mask == 0) {
apc_activity = SCIC_SDS_APC_START_TIMER;
}
} else if (port->active_phy_mask != 0) {
} else if (iport->active_phy_mask != 0) {
/*
* The Port has an active phy and the current Phy can not
* participate in this port so skip the PHY and see if
@ -583,7 +579,7 @@ static void scic_sds_apc_agent_configure_ports(struct scic_sds_controller *contr
switch (apc_activity) {
case SCIC_SDS_APC_ADD_PHY:
status = scic_sds_port_add_phy(port, iphy);
status = scic_sds_port_add_phy(iport, iphy);
if (status == SCI_SUCCESS) {
port_agent->phy_configured_mask |= (1 << iphy->phy_index);
@ -625,18 +621,18 @@ static void scic_sds_apc_agent_configure_ports(struct scic_sds_controller *contr
*/
static void scic_sds_apc_agent_link_up(struct scic_sds_controller *scic,
struct scic_sds_port_configuration_agent *port_agent,
struct scic_sds_port *sci_port,
struct isci_port *iport,
struct isci_phy *iphy)
{
u8 phy_index = iphy->phy_index;
if (!sci_port) {
if (!iport) {
/* the phy is not the part of this port */
port_agent->phy_ready_mask |= 1 << phy_index;
scic_sds_apc_agent_configure_ports(scic, port_agent, iphy, true);
} else {
/* the phy is already the part of the port */
u32 port_state = sci_port->sm.current_state_id;
u32 port_state = iport->sm.current_state_id;
/* if the PORT'S state is resetting then the link up is from
* port hard reset in this case, we need to tell the port
@ -644,7 +640,7 @@ static void scic_sds_apc_agent_link_up(struct scic_sds_controller *scic,
*/
BUG_ON(port_state != SCI_PORT_RESETTING);
port_agent->phy_ready_mask |= 1 << phy_index;
scic_sds_port_link_up(sci_port, iphy);
scic_sds_port_link_up(iport, iphy);
}
}
@ -652,9 +648,9 @@ static void scic_sds_apc_agent_link_up(struct scic_sds_controller *scic,
*
* @controller: This is the controller object that receives the link down
* notification.
* @port: This is the port object associated with the phy. If the is no
* @iport: This is the port object associated with the phy. If the is no
* associated port this is an NULL.
* @phy: This is the phy object which has gone link down.
* @iphy: This is the phy object which has gone link down.
*
* This method handles the automatic port configuration link down
* notifications. not associated with a port there is no action taken. Is it
@ -664,21 +660,20 @@ static void scic_sds_apc_agent_link_up(struct scic_sds_controller *scic,
static void scic_sds_apc_agent_link_down(
struct scic_sds_controller *controller,
struct scic_sds_port_configuration_agent *port_agent,
struct scic_sds_port *port,
struct isci_port *iport,
struct isci_phy *iphy)
{
port_agent->phy_ready_mask &= ~(1 << scic_sds_phy_get_index(iphy));
if (port != NULL) {
if (port_agent->phy_configured_mask & (1 << iphy->phy_index)) {
enum sci_status status;
if (!iport)
return;
if (port_agent->phy_configured_mask & (1 << iphy->phy_index)) {
enum sci_status status;
status = scic_sds_port_remove_phy(port, iphy);
status = scic_sds_port_remove_phy(iport, iphy);
if (status == SCI_SUCCESS) {
port_agent->phy_configured_mask &= ~(1 << iphy->phy_index);
}
}
if (status == SCI_SUCCESS)
port_agent->phy_configured_mask &= ~(1 << iphy->phy_index);
}
}

Просмотреть файл

@ -450,11 +450,11 @@ static void scic_sds_remote_device_start_request(struct scic_sds_remote_device *
struct isci_request *ireq,
enum sci_status status)
{
struct scic_sds_port *sci_port = sci_dev->owning_port;
struct isci_port *iport = sci_dev->owning_port;
/* cleanup requests that failed after starting on the port */
if (status != SCI_SUCCESS)
scic_sds_port_complete_io(sci_port, sci_dev, ireq);
scic_sds_port_complete_io(iport, sci_dev, ireq);
else {
kref_get(&sci_dev_to_idev(sci_dev)->kref);
scic_sds_remote_device_increment_request_count(sci_dev);
@ -467,7 +467,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic
{
struct sci_base_state_machine *sm = &sci_dev->sm;
enum scic_sds_remote_device_states state = sm->current_state_id;
struct scic_sds_port *sci_port = sci_dev->owning_port;
struct isci_port *iport = sci_dev->owning_port;
enum sci_status status;
switch (state) {
@ -489,7 +489,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic
* successful it will start the request for the port object then
* increment its own request count.
*/
status = scic_sds_port_start_io(sci_port, sci_dev, ireq);
status = scic_sds_port_start_io(iport, sci_dev, ireq);
if (status != SCI_SUCCESS)
return status;
@ -511,7 +511,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic
enum scic_sds_remote_device_states new_state;
struct sas_task *task = isci_request_access_task(ireq);
status = scic_sds_port_start_io(sci_port, sci_dev, ireq);
status = scic_sds_port_start_io(iport, sci_dev, ireq);
if (status != SCI_SUCCESS)
return status;
@ -536,7 +536,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic
struct sas_task *task = isci_request_access_task(ireq);
if (task->ata_task.use_ncq) {
status = scic_sds_port_start_io(sci_port, sci_dev, ireq);
status = scic_sds_port_start_io(iport, sci_dev, ireq);
if (status != SCI_SUCCESS)
return status;
@ -552,7 +552,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic
case SCI_STP_DEV_AWAIT_RESET:
return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED;
case SCI_SMP_DEV_IDLE:
status = scic_sds_port_start_io(sci_port, sci_dev, ireq);
status = scic_sds_port_start_io(iport, sci_dev, ireq);
if (status != SCI_SUCCESS)
return status;
@ -579,7 +579,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic
return status;
}
static enum sci_status common_complete_io(struct scic_sds_port *sci_port,
static enum sci_status common_complete_io(struct isci_port *iport,
struct scic_sds_remote_device *sci_dev,
struct isci_request *ireq)
{
@ -589,7 +589,7 @@ static enum sci_status common_complete_io(struct scic_sds_port *sci_port,
if (status != SCI_SUCCESS)
return status;
status = scic_sds_port_complete_io(sci_port, sci_dev, ireq);
status = scic_sds_port_complete_io(iport, sci_dev, ireq);
if (status != SCI_SUCCESS)
return status;
@ -603,7 +603,7 @@ enum sci_status scic_sds_remote_device_complete_io(struct scic_sds_controller *s
{
struct sci_base_state_machine *sm = &sci_dev->sm;
enum scic_sds_remote_device_states state = sm->current_state_id;
struct scic_sds_port *sci_port = sci_dev->owning_port;
struct isci_port *iport = sci_dev->owning_port;
enum sci_status status;
switch (state) {
@ -621,12 +621,12 @@ enum sci_status scic_sds_remote_device_complete_io(struct scic_sds_controller *s
case SCI_DEV_READY:
case SCI_STP_DEV_AWAIT_RESET:
case SCI_DEV_RESETTING:
status = common_complete_io(sci_port, sci_dev, ireq);
status = common_complete_io(iport, sci_dev, ireq);
break;
case SCI_STP_DEV_CMD:
case SCI_STP_DEV_NCQ:
case SCI_STP_DEV_NCQ_ERROR:
status = common_complete_io(sci_port, sci_dev, ireq);
status = common_complete_io(iport, sci_dev, ireq);
if (status != SCI_SUCCESS)
break;
@ -641,13 +641,13 @@ enum sci_status scic_sds_remote_device_complete_io(struct scic_sds_controller *s
sci_change_state(sm, SCI_STP_DEV_IDLE);
break;
case SCI_SMP_DEV_CMD:
status = common_complete_io(sci_port, sci_dev, ireq);
status = common_complete_io(iport, sci_dev, ireq);
if (status != SCI_SUCCESS)
break;
sci_change_state(sm, SCI_SMP_DEV_IDLE);
break;
case SCI_DEV_STOPPING:
status = common_complete_io(sci_port, sci_dev, ireq);
status = common_complete_io(iport, sci_dev, ireq);
if (status != SCI_SUCCESS)
break;
@ -661,7 +661,7 @@ enum sci_status scic_sds_remote_device_complete_io(struct scic_sds_controller *s
if (status != SCI_SUCCESS)
dev_err(scirdev_to_dev(sci_dev),
"%s: Port:0x%p Device:0x%p Request:0x%p Status:0x%x "
"could not complete\n", __func__, sci_port,
"could not complete\n", __func__, iport,
sci_dev, ireq, status);
else
isci_put_device(sci_dev_to_idev(sci_dev));
@ -684,7 +684,7 @@ enum sci_status scic_sds_remote_device_start_task(struct scic_sds_controller *sc
{
struct sci_base_state_machine *sm = &sci_dev->sm;
enum scic_sds_remote_device_states state = sm->current_state_id;
struct scic_sds_port *sci_port = sci_dev->owning_port;
struct isci_port *iport = sci_dev->owning_port;
enum sci_status status;
switch (state) {
@ -706,7 +706,7 @@ enum sci_status scic_sds_remote_device_start_task(struct scic_sds_controller *sc
case SCI_STP_DEV_NCQ:
case SCI_STP_DEV_NCQ_ERROR:
case SCI_STP_DEV_AWAIT_RESET:
status = scic_sds_port_start_io(sci_port, sci_dev, ireq);
status = scic_sds_port_start_io(iport, sci_dev, ireq);
if (status != SCI_SUCCESS)
return status;
@ -746,7 +746,7 @@ enum sci_status scic_sds_remote_device_start_task(struct scic_sds_controller *sc
*/
return SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS;
case SCI_DEV_READY:
status = scic_sds_port_start_io(sci_port, sci_dev, ireq);
status = scic_sds_port_start_io(iport, sci_dev, ireq);
if (status != SCI_SUCCESS)
return status;
@ -1064,10 +1064,10 @@ static const struct sci_base_state scic_sds_remote_device_state_table[] = {
* scic_remote_device_[de]a_construct(). scic_remote_device_destruct()
* frees the remote_node_context(s) for the device.
*/
static void scic_remote_device_construct(struct scic_sds_port *sci_port,
static void scic_remote_device_construct(struct isci_port *iport,
struct scic_sds_remote_device *sci_dev)
{
sci_dev->owning_port = sci_port;
sci_dev->owning_port = iport;
sci_dev->started_request_count = 0;
sci_init_sm(&sci_dev->sm, scic_sds_remote_device_state_table, SCI_DEV_INITIAL);
@ -1090,20 +1090,20 @@ static void scic_remote_device_construct(struct scic_sds_port *sci_port,
* sata-only controller instance.
* SCI_FAILURE_INSUFFICIENT_RESOURCES - remote node contexts exhausted.
*/
static enum sci_status scic_remote_device_da_construct(struct scic_sds_port *sci_port,
static enum sci_status scic_remote_device_da_construct(struct isci_port *iport,
struct scic_sds_remote_device *sci_dev)
{
enum sci_status status;
struct domain_device *dev = sci_dev_to_domain(sci_dev);
scic_remote_device_construct(sci_port, sci_dev);
scic_remote_device_construct(iport, sci_dev);
/*
* This information is request to determine how many remote node context
* entries will be needed to store the remote node.
*/
sci_dev->is_direct_attached = true;
status = scic_sds_controller_allocate_remote_node_context(sci_port->owning_controller,
status = scic_sds_controller_allocate_remote_node_context(iport->owning_controller,
sci_dev,
&sci_dev->rnc.remote_node_index);
@ -1116,7 +1116,7 @@ static enum sci_status scic_remote_device_da_construct(struct scic_sds_port *sci
else
return SCI_FAILURE_UNSUPPORTED_PROTOCOL;
sci_dev->connection_rate = scic_sds_port_get_max_allowed_speed(sci_port);
sci_dev->connection_rate = scic_sds_port_get_max_allowed_speed(iport);
/* / @todo Should I assign the port width by reading all of the phys on the port? */
sci_dev->device_port_width = 1;
@ -1136,15 +1136,15 @@ static enum sci_status scic_remote_device_da_construct(struct scic_sds_port *sci
* sata-only controller instance.
* SCI_FAILURE_INSUFFICIENT_RESOURCES - remote node contexts exhausted.
*/
static enum sci_status scic_remote_device_ea_construct(struct scic_sds_port *sci_port,
static enum sci_status scic_remote_device_ea_construct(struct isci_port *iport,
struct scic_sds_remote_device *sci_dev)
{
struct domain_device *dev = sci_dev_to_domain(sci_dev);
enum sci_status status;
scic_remote_device_construct(sci_port, sci_dev);
scic_remote_device_construct(iport, sci_dev);
status = scic_sds_controller_allocate_remote_node_context(sci_port->owning_controller,
status = scic_sds_controller_allocate_remote_node_context(iport->owning_controller,
sci_dev,
&sci_dev->rnc.remote_node_index);
if (status != SCI_SUCCESS)
@ -1163,7 +1163,7 @@ static enum sci_status scic_remote_device_ea_construct(struct scic_sds_port *sci
* connection the logical link rate is that same as the
* physical. Furthermore, the SAS-2 and SAS-1.1 fields overlay
* one another, so this code works for both situations. */
sci_dev->connection_rate = min_t(u16, scic_sds_port_get_max_allowed_speed(sci_port),
sci_dev->connection_rate = min_t(u16, scic_sds_port_get_max_allowed_speed(iport),
dev->linkrate);
/* / @todo Should I assign the port width by reading all of the phys on the port? */
@ -1212,15 +1212,14 @@ static enum sci_status scic_remote_device_start(struct scic_sds_remote_device *s
static enum sci_status isci_remote_device_construct(struct isci_port *iport,
struct isci_remote_device *idev)
{
struct scic_sds_port *sci_port = &iport->sci;
struct isci_host *ihost = iport->isci_host;
struct domain_device *dev = idev->domain_dev;
enum sci_status status;
if (dev->parent && dev_is_expander(dev->parent))
status = scic_remote_device_ea_construct(sci_port, &idev->sci);
status = scic_remote_device_ea_construct(iport, &idev->sci);
else
status = scic_remote_device_da_construct(sci_port, &idev->sci);
status = scic_remote_device_da_construct(iport, &idev->sci);
if (status != SCI_SUCCESS) {
dev_dbg(&ihost->pdev->dev, "%s: construct failed: %d\n",

Просмотреть файл

@ -100,7 +100,7 @@ struct scic_sds_remote_device {
* This filed contains a pointer back to the port to which this device
* is assigned.
*/
struct scic_sds_port *owning_port;
struct isci_port *owning_port;
/**
* This field contains the SCU silicon remote node context specific
@ -387,14 +387,6 @@ static inline bool dev_is_expander(struct domain_device *dev)
#define scic_sds_remote_device_get_request_count(sci_dev) \
((sci_dev)->started_request_count)
/**
* scic_sds_remote_device_get_port() -
*
* This macro returns the owning port of this remote device obejct.
*/
#define scic_sds_remote_device_get_port(sci_dev) \
((sci_dev)->owning_port)
/**
* scic_sds_remote_device_get_controller() -
*

Просмотреть файл

@ -210,10 +210,10 @@ static void scu_ssp_reqeust_construct_task_context(
{
dma_addr_t dma_addr;
struct scic_sds_remote_device *target_device;
struct scic_sds_port *target_port;
struct isci_port *iport;
target_device = scic_sds_request_get_device(ireq);
target_port = scic_sds_request_get_port(ireq);
iport = scic_sds_request_get_port(ireq);
/* Fill in the TC with the its required data */
task_context->abort = 0;
@ -222,8 +222,7 @@ static void scu_ssp_reqeust_construct_task_context(
task_context->connection_rate = target_device->connection_rate;
task_context->protocol_engine_index =
scic_sds_controller_get_protocol_engine_group(controller);
task_context->logical_port_index =
scic_sds_port_get_index(target_port);
task_context->logical_port_index = scic_sds_port_get_index(iport);
task_context->protocol_type = SCU_TASK_CONTEXT_PROTOCOL_SSP;
task_context->valid = SCU_TASK_CONTEXT_VALID;
task_context->context_type = SCU_TASK_CONTEXT_TYPE;
@ -245,11 +244,11 @@ static void scu_ssp_reqeust_construct_task_context(
task_context->task_phase = 0x01;
ireq->post_context = (SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC |
(scic_sds_controller_get_protocol_engine_group(controller) <<
SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT) |
(scic_sds_port_get_index(target_port) <<
SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT) |
ISCI_TAG_TCI(ireq->io_tag));
(scic_sds_controller_get_protocol_engine_group(controller) <<
SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT) |
(scic_sds_port_get_index(iport) <<
SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT) |
ISCI_TAG_TCI(ireq->io_tag));
/*
* Copy the physical address for the command buffer to the
@ -350,10 +349,10 @@ static void scu_sata_reqeust_construct_task_context(
{
dma_addr_t dma_addr;
struct scic_sds_remote_device *target_device;
struct scic_sds_port *target_port;
struct isci_port *iport;
target_device = scic_sds_request_get_device(ireq);
target_port = scic_sds_request_get_port(ireq);
iport = scic_sds_request_get_port(ireq);
/* Fill in the TC with the its required data */
task_context->abort = 0;
@ -363,7 +362,7 @@ static void scu_sata_reqeust_construct_task_context(
task_context->protocol_engine_index =
scic_sds_controller_get_protocol_engine_group(controller);
task_context->logical_port_index =
scic_sds_port_get_index(target_port);
scic_sds_port_get_index(iport);
task_context->protocol_type = SCU_TASK_CONTEXT_PROTOCOL_STP;
task_context->valid = SCU_TASK_CONTEXT_VALID;
task_context->context_type = SCU_TASK_CONTEXT_TYPE;
@ -391,7 +390,7 @@ static void scu_sata_reqeust_construct_task_context(
ireq->post_context = (SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC |
(scic_sds_controller_get_protocol_engine_group(controller) <<
SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT) |
(scic_sds_port_get_index(target_port) <<
(scic_sds_port_get_index(iport) <<
SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT) |
ISCI_TAG_TCI(ireq->io_tag));
/*
@ -3105,7 +3104,7 @@ scic_io_request_construct_smp(struct device *dev,
struct scatterlist *sg = &task->smp_task.smp_req;
struct scic_sds_remote_device *sci_dev;
struct scu_task_context *task_context;
struct scic_sds_port *sci_port;
struct isci_port *iport;
struct smp_req *smp_req;
void *kaddr;
u8 req_len;
@ -3149,7 +3148,7 @@ scic_io_request_construct_smp(struct device *dev,
task_context = ireq->tc;
sci_dev = scic_sds_request_get_device(ireq);
sci_port = scic_sds_request_get_port(ireq);
iport = scic_sds_request_get_port(ireq);
/*
* Fill in the TC with the its required data
@ -3160,7 +3159,7 @@ scic_io_request_construct_smp(struct device *dev,
task_context->connection_rate = sci_dev->connection_rate;
task_context->protocol_engine_index =
scic_sds_controller_get_protocol_engine_group(scic);
task_context->logical_port_index = scic_sds_port_get_index(sci_port);
task_context->logical_port_index = scic_sds_port_get_index(iport);
task_context->protocol_type = SCU_TASK_CONTEXT_PROTOCOL_SMP;
task_context->abort = 0;
task_context->valid = SCU_TASK_CONTEXT_VALID;
@ -3204,7 +3203,7 @@ scic_io_request_construct_smp(struct device *dev,
ireq->post_context = (SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC |
(scic_sds_controller_get_protocol_engine_group(scic) <<
SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT) |
(scic_sds_port_get_index(sci_port) <<
(scic_sds_port_get_index(iport) <<
SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT) |
ISCI_TAG_TCI(ireq->io_tag));
/*