Commit cc3dbd0a authored by Artur Wojcik's avatar Artur Wojcik Committed by Dan Williams

isci: unify isci_host data structures

Make it explicit that isci_host and scic_sds_controller are one in the same
object.
Signed-off-by: default avatarArtur Wojcik <artur.wojcik@intel.com>
[removed ->ihost back pointer]
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent d06b487b
......@@ -214,7 +214,7 @@ static void scic_sds_controller_power_control_timer_handler(
static void scic_sds_controller_initialize_power_control(struct scic_sds_controller *scic)
{
struct isci_host *ihost = scic->ihost;
struct isci_host *ihost = scic_to_ihost(scic);
scic->power_control.timer = isci_timer_create(ihost,
scic,
scic_sds_controller_power_control_timer_handler);
......@@ -585,7 +585,7 @@ static void scic_sds_controller_transition_to_ready(
struct scic_sds_controller *scic,
enum sci_status status)
{
struct isci_host *ihost = scic->ihost;
struct isci_host *ihost = scic_to_ihost(scic);
if (scic->state_machine.current_state_id ==
SCI_BASE_CONTROLLER_STATE_STARTING) {
......@@ -603,7 +603,7 @@ static void scic_sds_controller_transition_to_ready(
static void scic_sds_controller_timeout_handler(void *_scic)
{
struct scic_sds_controller *scic = _scic;
struct isci_host *ihost = scic->ihost;
struct isci_host *ihost = scic_to_ihost(scic);
struct sci_base_state_machine *sm = &scic->state_machine;
if (sm->current_state_id == SCI_BASE_CONTROLLER_STATE_STARTING)
......@@ -771,7 +771,7 @@ static void scic_sds_controller_phy_startup_timeout_handler(void *_scic)
static enum sci_status scic_sds_controller_initialize_phy_startup(struct scic_sds_controller *scic)
{
struct isci_host *ihost = scic->ihost;
struct isci_host *ihost = scic_to_ihost(scic);
scic->phy_startup_timer = isci_timer_create(ihost,
scic,
......@@ -1775,7 +1775,7 @@ void scic_sds_controller_release_frame(
*/
static void scic_sds_controller_set_default_config_parameters(struct scic_sds_controller *scic)
{
struct isci_host *ihost = scic->ihost;
struct isci_host *ihost = scic_to_ihost(scic);
u16 index;
/* Default to APC mode. */
......@@ -2619,17 +2619,12 @@ static enum sci_status scic_controller_set_interrupt_coalescence(
}
struct scic_sds_controller *scic_controller_alloc(struct device *dev)
{
return devm_kzalloc(dev, sizeof(struct scic_sds_controller), GFP_KERNEL);
}
enum sci_status scic_controller_initialize(
struct scic_sds_controller *scic)
enum sci_status scic_controller_initialize(struct scic_sds_controller *scic)
{
struct sci_base_state_machine *sm = &scic->state_machine;
enum sci_status result = SCI_SUCCESS;
struct isci_host *ihost;
struct isci_host *ihost = scic_to_ihost(scic);
u32 index, state;
if (scic->state_machine.current_state_id !=
......@@ -2640,9 +2635,6 @@ enum sci_status scic_controller_initialize(
return SCI_FAILURE_INVALID_STATE;
}
ihost = scic->ihost;
sci_base_state_machine_change_state(sm, SCI_BASE_CONTROLLER_STATE_INITIALIZING);
scic->timeout_timer = isci_timer_create(ihost,
......
......@@ -125,18 +125,12 @@ struct scic_power_control {
};
struct isci_host;
/**
* struct scic_sds_controller -
*
* This structure represents the SCU controller object.
*/
struct scic_sds_controller {
/**
* The field specifies that the peer object for the controller.
*/
struct isci_host *ihost;
/**
* This field contains the information for the base controller state
* machine.
......
......@@ -339,7 +339,7 @@ enum sci_status scic_sds_phy_initialize(
struct scu_link_layer_registers __iomem *link_layer_registers)
{
struct scic_sds_controller *scic = scic_sds_phy_get_controller(sci_phy);
struct isci_host *ihost = scic->ihost;
struct isci_host *ihost = scic_to_ihost(scic);
/* Create the SIGNATURE FIS Timeout timer for this phy */
sci_phy->sata_timeout_timer =
......@@ -1790,7 +1790,7 @@ scic_sds_phy_stopped_state_start_handler(struct scic_sds_phy *sci_phy)
struct scic_sds_controller *scic;
scic = scic_sds_phy_get_controller(sci_phy),
ihost = scic->ihost;
ihost = scic_to_ihost(scic);
/* Create the SIGNATURE FIS Timeout timer for this phy */
sci_phy->sata_timeout_timer = isci_timer_create(ihost, sci_phy,
......@@ -2076,7 +2076,7 @@ static void scic_sds_phy_stopped_state_enter(void *object)
{
struct scic_sds_phy *sci_phy = object;
struct scic_sds_controller *scic = scic_sds_phy_get_controller(sci_phy);
struct isci_host *ihost = scic->ihost;
struct isci_host *ihost = scic_to_ihost(scic);
/*
* @todo We need to get to the controller to place this PE in a
......
......@@ -625,7 +625,7 @@ static void scic_sds_port_activate_phy(struct scic_sds_port *sci_port,
bool do_notify_user)
{
struct scic_sds_controller *scic = sci_port->owning_controller;
struct isci_host *ihost = scic->ihost;
struct isci_host *ihost = scic_to_ihost(scic);
if (sci_phy->protocol != SCIC_SDS_PHY_PROTOCOL_SATA)
scic_sds_phy_resume(sci_phy);
......@@ -644,7 +644,7 @@ void scic_sds_port_deactivate_phy(struct scic_sds_port *sci_port,
{
struct scic_sds_controller *scic = scic_sds_port_get_controller(sci_port);
struct isci_port *iport = sci_port->iport;
struct isci_host *ihost = scic->ihost;
struct isci_host *ihost = scic_to_ihost(scic);
struct isci_phy *iphy = sci_phy->iphy;
sci_port->active_phy_mask &= ~(1 << sci_phy->phy_index);
......@@ -667,12 +667,10 @@ void scic_sds_port_deactivate_phy(struct scic_sds_port *sci_port,
* This function will disable the phy and report that the phy is not valid for
* this port object. None
*/
static void scic_sds_port_invalid_link_up(
struct scic_sds_port *sci_port,
struct scic_sds_phy *sci_phy)
static void scic_sds_port_invalid_link_up(struct scic_sds_port *sci_port,
struct scic_sds_phy *sci_phy)
{
struct scic_sds_controller *scic =
scic_sds_port_get_controller(sci_port);
struct scic_sds_controller *scic = sci_port->owning_controller;
/*
* Check to see if we have alreay reported this link as bad and if
......@@ -681,7 +679,7 @@ static void scic_sds_port_invalid_link_up(
*/
if ((scic->invalid_phy_mask & (1 << sci_phy->phy_index)) == 0) {
scic_sds_controller_set_invalid_phy(scic, sci_phy);
isci_port_invalid_link_up(scic, sci_port, sci_phy);
dev_warn(&scic_to_ihost(scic)->pdev->dev, "Invalid link up!\n");
}
}
......@@ -971,7 +969,7 @@ void scic_sds_port_broadcast_change_received(
struct scic_sds_phy *sci_phy)
{
struct scic_sds_controller *scic = sci_port->owning_controller;
struct isci_host *ihost = scic->ihost;
struct isci_host *ihost = scic_to_ihost(scic);
/* notify the user. */
isci_port_bc_change_received(ihost, sci_port, sci_phy);
......@@ -1625,7 +1623,7 @@ static void scic_sds_port_ready_substate_operational_enter(void *object)
struct scic_sds_port *sci_port = object;
struct scic_sds_controller *scic =
scic_sds_port_get_controller(sci_port);
struct isci_host *ihost = scic->ihost;
struct isci_host *ihost = scic_to_ihost(scic);
struct isci_port *iport = sci_port->iport;
scic_sds_port_set_ready_state_handlers(
......@@ -1666,7 +1664,7 @@ static void scic_sds_port_ready_substate_operational_exit(void *object)
struct scic_sds_port *sci_port = object;
struct scic_sds_controller *scic =
scic_sds_port_get_controller(sci_port);
struct isci_host *ihost = scic->ihost;
struct isci_host *ihost = scic_to_ihost(scic);
struct isci_port *iport = sci_port->iport;
/*
......@@ -1697,7 +1695,7 @@ static void scic_sds_port_ready_substate_configuring_enter(void *object)
struct scic_sds_port *sci_port = object;
struct scic_sds_controller *scic =
scic_sds_port_get_controller(sci_port);
struct isci_host *ihost = scic->ihost;
struct isci_host *ihost = scic_to_ihost(scic);
struct isci_port *iport = sci_port->iport;
scic_sds_port_set_ready_state_handlers(
......@@ -1784,7 +1782,7 @@ static enum sci_status
scic_sds_port_stopped_state_start_handler(struct scic_sds_port *sci_port)
{
struct scic_sds_controller *scic = sci_port->owning_controller;
struct isci_host *ihost = scic->ihost;
struct isci_host *ihost = scic_to_ihost(scic);
enum sci_status status = SCI_SUCCESS;
u32 phy_mask;
......@@ -2259,16 +2257,12 @@ static void scic_sds_port_stopped_state_exit(void *object)
*/
static void scic_sds_port_ready_state_enter(void *object)
{
struct scic_sds_controller *scic;
struct scic_sds_port *sci_port = object;
struct isci_port *iport;
struct isci_host *ihost;
struct scic_sds_controller *scic = sci_port->owning_controller;
struct isci_host *ihost = scic_to_ihost(scic);
struct isci_port *iport = sci_port->iport;
u32 prev_state;
scic = scic_sds_port_get_controller(sci_port);
ihost = scic->ihost;
iport = sci_port->iport;
/* Put the ready state handlers in place though they will not be there long */
scic_sds_port_set_base_state_handlers(sci_port, SCI_BASE_PORT_STATE_READY);
......
......@@ -808,20 +808,13 @@ void scic_sds_port_configuration_agent_construct(
}
}
/**
*
* @controller: This is the controller object for which the port agent is being
* initialized.
*
* This method will construct the port configuration agent for this controller.
*/
enum sci_status scic_sds_port_configuration_agent_initialize(
struct scic_sds_controller *scic,
struct scic_sds_port_configuration_agent *port_agent)
{
enum sci_status status = SCI_SUCCESS;
enum scic_port_configuration_mode mode;
struct isci_host *ihost = scic->ihost;
struct isci_host *ihost = scic_to_ihost(scic);
mode = scic->oem_parameters.sds1.controller.mode_type;
......
......@@ -1545,7 +1545,7 @@ static void scic_sds_request_completed_state_enter(void *object)
struct scic_sds_request *sci_req = object;
struct scic_sds_controller *scic =
scic_sds_request_get_controller(sci_req);
struct isci_host *ihost = scic->ihost;
struct isci_host *ihost = scic_to_ihost(scic);
struct isci_request *ireq = sci_req->ireq;
SET_STATE_HANDLER(sci_req,
......
......@@ -65,9 +65,8 @@
irqreturn_t isci_msix_isr(int vec, void *data)
{
struct isci_host *ihost = data;
struct scic_sds_controller *scic = ihost->core_controller;
if (scic_sds_controller_isr(scic))
if (scic_sds_controller_isr(&ihost->sci))
tasklet_schedule(&ihost->completion_tasklet);
return IRQ_HANDLED;
......@@ -77,7 +76,7 @@ irqreturn_t isci_intx_isr(int vec, void *data)
{
irqreturn_t ret = IRQ_NONE;
struct isci_host *ihost = data;
struct scic_sds_controller *scic = ihost->core_controller;
struct scic_sds_controller *scic = &ihost->sci;
if (scic_sds_controller_isr(scic)) {
writel(SMU_ISR_COMPLETION, &scic->smu_registers->interrupt_status);
......@@ -96,10 +95,9 @@ irqreturn_t isci_intx_isr(int vec, void *data)
irqreturn_t isci_error_isr(int vec, void *data)
{
struct isci_host *ihost = data;
struct scic_sds_controller *scic = ihost->core_controller;
if (scic_sds_controller_error_isr(scic))
scic_sds_controller_error_handler(scic);
if (scic_sds_controller_error_isr(&ihost->sci))
scic_sds_controller_error_handler(&ihost->sci);
return IRQ_HANDLED;
}
......@@ -145,21 +143,20 @@ int isci_host_scan_finished(struct Scsi_Host *shost, unsigned long time)
void isci_host_scan_start(struct Scsi_Host *shost)
{
struct isci_host *ihost = SHOST_TO_SAS_HA(shost)->lldd_ha;
struct scic_sds_controller *scic = ihost->core_controller;
unsigned long tmo = scic_controller_get_suggested_start_timeout(scic);
unsigned long tmo = scic_controller_get_suggested_start_timeout(&ihost->sci);
set_bit(IHOST_START_PENDING, &ihost->flags);
spin_lock_irq(&ihost->scic_lock);
scic_controller_start(scic, tmo);
scic_controller_enable_interrupts(scic);
scic_controller_start(&ihost->sci, tmo);
scic_controller_enable_interrupts(&ihost->sci);
spin_unlock_irq(&ihost->scic_lock);
}
void isci_host_stop_complete(struct isci_host *ihost, enum sci_status completion_status)
{
isci_host_change_state(ihost, isci_stopped);
scic_controller_disable_interrupts(ihost->core_controller);
scic_controller_disable_interrupts(&ihost->sci);
clear_bit(IHOST_STOP_PENDING, &ihost->flags);
wake_up(&ihost->eventq);
}
......@@ -188,7 +185,7 @@ static void isci_host_completion_routine(unsigned long data)
spin_lock_irq(&isci_host->scic_lock);
scic_sds_controller_completion_handler(isci_host->core_controller);
scic_sds_controller_completion_handler(&isci_host->sci);
/* Take the lists of completed I/Os from the host. */
......@@ -276,7 +273,6 @@ static void isci_host_completion_routine(unsigned long data)
void isci_host_deinit(struct isci_host *ihost)
{
struct scic_sds_controller *scic = ihost->core_controller;
int i;
isci_host_change_state(ihost, isci_stopping);
......@@ -293,11 +289,11 @@ void isci_host_deinit(struct isci_host *ihost)
set_bit(IHOST_STOP_PENDING, &ihost->flags);
spin_lock_irq(&ihost->scic_lock);
scic_controller_stop(scic, SCIC_CONTROLLER_STOP_TIMEOUT);
scic_controller_stop(&ihost->sci, SCIC_CONTROLLER_STOP_TIMEOUT);
spin_unlock_irq(&ihost->scic_lock);
wait_for_stop(ihost);
scic_controller_reset(scic);
scic_controller_reset(&ihost->sci);
isci_timer_list_destroy(ihost);
}
......@@ -347,25 +343,12 @@ int isci_host_init(struct isci_host *isci_host)
{
int err = 0, i;
enum sci_status status;
struct scic_sds_controller *controller;
union scic_oem_parameters oem;
union scic_user_parameters scic_user_params;
struct isci_pci_info *pci_info = to_pci_info(isci_host->pdev);
isci_timer_list_construct(isci_host);
controller = scic_controller_alloc(&isci_host->pdev->dev);
if (!controller) {
dev_err(&isci_host->pdev->dev,
"%s: failed (%d)\n",
__func__,
err);
return -ENOMEM;
}
isci_host->core_controller = controller;
controller->ihost = isci_host;
spin_lock_init(&isci_host->state_lock);
spin_lock_init(&isci_host->scic_lock);
spin_lock_init(&isci_host->queue_lock);
......@@ -374,7 +357,7 @@ int isci_host_init(struct isci_host *isci_host)
isci_host_change_state(isci_host, isci_starting);
isci_host->can_queue = ISCI_CAN_QUEUE_VAL;
status = scic_controller_construct(controller, scu_base(isci_host),
status = scic_controller_construct(&isci_host->sci, scu_base(isci_host),
smu_base(isci_host));
if (status != SCI_SUCCESS) {
......@@ -393,7 +376,7 @@ int isci_host_init(struct isci_host *isci_host)
* parameters
*/
isci_user_parameters_get(isci_host, &scic_user_params);
status = scic_user_parameters_set(isci_host->core_controller,
status = scic_user_parameters_set(&isci_host->sci,
&scic_user_params);
if (status != SCI_SUCCESS) {
dev_warn(&isci_host->pdev->dev,
......@@ -402,7 +385,7 @@ int isci_host_init(struct isci_host *isci_host)
return -ENODEV;
}
scic_oem_parameters_get(controller, &oem);
scic_oem_parameters_get(&isci_host->sci, &oem);
/* grab any OEM parameters specified in orom */
if (pci_info->orom) {
......@@ -416,7 +399,7 @@ int isci_host_init(struct isci_host *isci_host)
}
}
status = scic_oem_parameters_set(isci_host->core_controller, &oem);
status = scic_oem_parameters_set(&isci_host->sci, &oem);
if (status != SCI_SUCCESS) {
dev_warn(&isci_host->pdev->dev,
"%s: scic_oem_parameters_set failed\n",
......@@ -431,7 +414,7 @@ int isci_host_init(struct isci_host *isci_host)
INIT_LIST_HEAD(&isci_host->requests_to_errorback);
spin_lock_irq(&isci_host->scic_lock);
status = scic_controller_initialize(isci_host->core_controller);
status = scic_controller_initialize(&isci_host->sci);
spin_unlock_irq(&isci_host->scic_lock);
if (status != SCI_SUCCESS) {
dev_warn(&isci_host->pdev->dev,
......@@ -441,7 +424,7 @@ int isci_host_init(struct isci_host *isci_host)
return -ENODEV;
}
err = scic_controller_mem_init(isci_host->core_controller);
err = scic_controller_mem_init(&isci_host->sci);
if (err)
return err;
......
......@@ -58,7 +58,7 @@
#define _SCI_HOST_H_
#include "phy.h"
/*#include "task.h"*/
#include "scic_sds_controller.h"
#include "timers.h"
#include "remote_device.h"
......@@ -75,7 +75,7 @@
#define SCIC_CONTROLLER_STOP_TIMEOUT 5000
struct isci_host {
struct scic_sds_controller *core_controller;
struct scic_sds_controller sci;
union scic_oem_parameters oem_parameters;
int id; /* unique within a given pci device */
......@@ -219,6 +219,14 @@ static inline struct isci_host *dev_to_ihost(struct domain_device *dev)
return dev->port->ha->lldd_ha;
}
static inline struct isci_host *scic_to_ihost(struct scic_sds_controller *scic)
{
/* XXX delete after merging scic_sds_contoller and isci_host */
struct isci_host *ihost = container_of(scic, typeof(*ihost), sci);
return ihost;
}
/**
* isci_host_scan_finished() -
*
......
......@@ -268,7 +268,7 @@ static void isci_unregister(struct isci_host *isci_host)
static int __devinit isci_pci_init(struct pci_dev *pdev)
{
int err, bar_num, bar_mask;
int err, bar_num, bar_mask = 0;
void __iomem * const *iomap;
err = pcim_enable_device(pdev);
......@@ -556,7 +556,7 @@ static void __devexit isci_pci_remove(struct pci_dev *pdev)
for_each_isci_host(i, isci_host, pdev) {
isci_unregister(isci_host);
isci_host_deinit(isci_host);
scic_controller_disable_interrupts(isci_host->core_controller);
scic_controller_disable_interrupts(&isci_host->sci);
}
}
......
......@@ -79,7 +79,6 @@ void isci_phy_init(
struct isci_host *isci_host,
int index)
{
struct scic_sds_controller *scic = isci_host->core_controller;
struct scic_sds_phy *scic_phy;
union scic_oem_parameters oem;
enum sci_status status = SCI_SUCCESS;
......@@ -87,7 +86,7 @@ void isci_phy_init(
/*--------------- SCU_Phy Initialization Stuff -----------------------*/
status = scic_controller_get_phy_handle(scic, index, &scic_phy);
status = scic_controller_get_phy_handle(&isci_host->sci, index, &scic_phy);
if (status == SCI_SUCCESS) {
phy->sci_phy_handle = scic_phy;
scic_phy->iphy = phy;
......@@ -95,7 +94,7 @@ void isci_phy_init(
dev_err(&isci_host->pdev->dev,
"failed scic_controller_get_phy_handle\n");
scic_oem_parameters_get(scic, &oem);
scic_oem_parameters_get(&isci_host->sci, &oem);
sas_addr = oem.sds1.phys[index].sas_address.high;
sas_addr <<= 32;
sas_addr |= oem.sds1.phys[index].sas_address.low;
......
......@@ -85,8 +85,6 @@ struct isci_phy {
#define to_isci_phy(p) \
container_of(p, struct isci_phy, sas_phy);
struct isci_host;
void isci_phy_init(
struct isci_phy *phy,
struct isci_host *isci_host,
......
......@@ -90,7 +90,6 @@ void isci_port_init(
int index)
{
struct scic_sds_port *scic_port;
struct scic_sds_controller *controller = isci_host->core_controller;
INIT_LIST_HEAD(&isci_port->remote_dev_list);
INIT_LIST_HEAD(&isci_port->domain_dev_list);
......@@ -99,7 +98,7 @@ void isci_port_init(
isci_port->isci_host = isci_host;
isci_port_change_state(isci_port, isci_freed);
(void)scic_controller_get_port_handle(controller, index, &scic_port);
(void)scic_controller_get_port_handle(&isci_host->sci, index, &scic_port);
isci_port->sci_port_handle = scic_port;
scic_port->iport = isci_port;
}
......@@ -415,33 +414,9 @@ int isci_port_perform_hard_reset(struct isci_host *ihost, struct isci_port *ipor
return ret;
}
/**
* isci_port_invalid_link_up() - This function informs the SCI Core user that
* a phy/link became ready, but the phy is not allowed in the port. In some
* situations the underlying hardware only allows for certain phy to port
* mappings. If these mappings are violated, then this API is invoked.
* @controller: This parameter represents the controller which contains the
* port.
* @port: This parameter specifies the SCI port object for which the callback
* is being invoked.
* @phy: This parameter specifies the phy that came ready, but the phy can't be
* a valid member of the port.
*
*/
void isci_port_invalid_link_up(struct scic_sds_controller *scic,
struct scic_sds_port *sci_port,
struct scic_sds_phy *phy)
{
struct isci_host *ihost = scic->ihost;
dev_warn(&ihost->pdev->dev, "Invalid link up!\n");
}
void isci_port_stop_complete(struct scic_sds_controller *scic,
struct scic_sds_port *sci_port,
enum sci_status completion_status)
{
struct isci_host *ihost = scic->ihost;
dev_dbg(&ihost->pdev->dev, "Port stop complete\n");
dev_dbg(&scic_to_ihost(scic)->pdev->dev, "Port stop complete\n");
}
......@@ -147,11 +147,6 @@ void isci_port_hard_reset_complete(
int isci_port_perform_hard_reset(struct isci_host *ihost, struct isci_port *iport,
struct isci_phy *iphy);
void isci_port_invalid_link_up(
struct scic_sds_controller *scic,
struct scic_sds_port *sci_port,
struct scic_sds_phy *phy);
void isci_port_stop_complete(
struct scic_sds_controller *scic,
struct scic_sds_port *sci_port,
......
......@@ -815,7 +815,7 @@ static void scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handl
* As a result, avoid sending the ready notification.
*/
if (sci_dev->state_machine.previous_state_id != SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ)
isci_remote_device_ready(scic->ihost, idev);
isci_remote_device_ready(scic_to_ihost(scic), idev);
}
static void scic_sds_remote_device_initial_state_enter(void *object)
......@@ -918,21 +918,16 @@ static void isci_remote_device_stop_complete(struct isci_host *ihost,
static void scic_sds_remote_device_stopped_state_enter(void *object)
{
struct scic_sds_remote_device *sci_dev = object;
struct scic_sds_controller *scic;
struct isci_remote_device *idev;
struct isci_host *ihost;
struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller;
struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
u32 prev_state;
scic = scic_sds_remote_device_get_controller(sci_dev);
ihost = scic->ihost;
idev = sci_dev_to_idev(sci_dev);
/* If we are entering from the stopping state let the SCI User know that
* the stop operation has completed.
*/
prev_state = sci_dev->state_machine.previous_state_id;
if (prev_state == SCI_BASE_REMOTE_DEVICE_STATE_STOPPING)
isci_remote_device_stop_complete(ihost, idev);
isci_remote_device_stop_complete(scic_to_ihost(scic), idev);
scic_sds_controller_remote_device_stopped(scic, sci_dev);
}
......@@ -941,7 +936,7 @@ static void scic_sds_remote_device_starting_state_enter(void *object)
{
struct scic_sds_remote_device *sci_dev = object;
struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
struct isci_host *ihost = scic->ihost;
struct isci_host *ihost = scic_to_ihost(scic);
struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
isci_remote_device_not_ready(ihost, idev,
......@@ -952,7 +947,8 @@ static void scic_sds_remote_device_ready_state_enter(void *object)
{
struct scic_sds_remote_device *sci_dev = object;
struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller;
struct domain_device *dev = sci_dev_to_domain(sci_dev);
struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
struct domain_device *dev = idev->domain_dev;
scic->remote_device_sequence[sci_dev->rnc.remote_node_index]++;
......@@ -963,7 +959,7 @@ static void scic_sds_remote_device_ready_state_enter(void *object)
sci_base_state_machine_change_state(&sci_dev->state_machine,
SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE);
} else
isci_remote_device_ready(scic->ihost, sci_dev_to_idev(sci_dev));
isci_remote_device_ready(scic_to_ihost(scic), idev);
}
static void scic_sds_remote_device_ready_state_exit(void *object)
......@@ -975,7 +971,7 @@ static void scic_sds_remote_device_ready_state_exit(void *object)
struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller;
struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
isci_remote_device_not_ready(scic->ihost, idev,
isci_remote_device_not_ready(scic_to_ihost(scic), idev,
SCIC_REMOTE_DEVICE_NOT_READY_STOP_REQUESTED);
}
}
......@@ -1019,7 +1015,7 @@ static void scic_sds_stp_remote_device_ready_cmd_substate_enter(void *object)
BUG_ON(sci_dev->working_request == NULL);
isci_remote_device_not_ready(scic->ihost, sci_dev_to_idev(sci_dev),
isci_remote_device_not_ready(scic_to_ihost(scic), sci_dev_to_idev(sci_dev),
SCIC_REMOTE_DEVICE_NOT_READY_SATA_REQUEST_STARTED);
}
......@@ -1030,7 +1026,7 @@ static void scic_sds_stp_remote_device_ready_ncq_error_substate_enter(void *obje
struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
if (sci_dev->not_ready_reason == SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED)
isci_remote_device_not_ready(scic->ihost, idev,
isci_remote_device_not_ready(scic_to_ihost(scic), idev,
sci_dev->not_ready_reason);
}
......@@ -1039,7 +1035,7 @@ static void scic_sds_smp_remote_device_ready_idle_substate_enter(void *object)
struct scic_sds_remote_device *sci_dev = object;
struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
isci_remote_device_ready(scic->ihost, sci_dev_to_idev(sci_dev));
isci_remote_device_ready(scic_to_ihost(scic), sci_dev_to_idev(sci_dev));
}
static void scic_sds_smp_remote_device_ready_cmd_substate_enter(void *object)
......@@ -1049,7 +1045,7 @@ static void scic_sds_smp_remote_device_ready_cmd_substate_enter(void *object)
BUG_ON(sci_dev->working_request == NULL);
isci_remote_device_not_ready(scic->ihost, sci_dev_to_idev(sci_dev),
isci_remote_device_not_ready(scic_to_ihost(scic), sci_dev_to_idev(sci_dev),
SCIC_REMOTE_DEVICE_NOT_READY_SMP_REQUEST_STARTED);
}
......
......@@ -201,7 +201,7 @@ static enum sci_status isci_io_request_build(
* we will let the core allocate the IO tag.
*/
status = scic_io_request_construct(
isci_host->core_controller,
&isci_host->sci,
sci_device,
SCI_CONTROLLER_INVALID_IO_TAG,
request,
......@@ -394,7 +394,7 @@ int isci_request_execute(
/* send the request, let the core assign the IO TAG. */
status = scic_controller_start_io(
isci_host->core_controller,
&isci_host->sci,
sci_device,
request->sci_request_handle,
SCI_CONTROLLER_INVALID_IO_TAG
......@@ -1186,7 +1186,7 @@ void isci_request_io_request_complete(
);
/* complete the io request to the core. */
scic_controller_complete_io(isci_host->core_controller,
scic_controller_complete_io(&isci_host->sci,
&isci_device->sci,
request->sci_request_handle);
/* NULL the request handle so it cannot be completed or
......
......@@ -62,9 +62,7 @@
static inline struct device *scic_to_dev(struct scic_sds_controller *scic)
{
struct isci_host *isci_host = scic->ihost;
return &isci_host->pdev->dev;
return &scic_to_ihost(scic)->pdev->dev;
}
static inline struct device *sciphy_to_dev(struct scic_sds_phy *sci_phy)
......
......@@ -299,7 +299,7 @@ static enum sci_status isci_task_request_build(
/* let the core do it's construct. */
status = scic_task_request_construct(
isci_host->core_controller,
&isci_host->sci,
sci_device,
SCI_CONTROLLER_INVALID_IO_TAG,
request,
......@@ -378,7 +378,7 @@ static void isci_tmf_timeout_cb(void *tmf_request_arg)
/* Terminate the TMF transmit request. */
status = scic_controller_terminate_request(
request->isci_host->core_controller,
&request->isci_host->sci,
&request->isci_device->sci,
request->sci_request_handle
);
......@@ -469,7 +469,7 @@ int isci_task_execute_tmf(
/* start the TMF io. */
status = scic_controller_start_task(
isci_host->core_controller,
&isci_host->sci,
sci_device,
request->sci_request_handle,
SCI_CONTROLLER_INVALID_IO_TAG
......@@ -772,7 +772,7 @@ static void isci_terminate_request_core(
was_terminated = true;
needs_cleanup_handling = true;
status = scic_controller_terminate_request(
isci_host->core_controller,
&isci_host->sci,
&isci_device->sci,
isci_request->sci_request_handle);
}
......@@ -1466,12 +1466,9 @@ isci_task_request_complete(struct isci_host *ihost,
/* PRINT_TMF( ((struct isci_tmf *)request->task)); */
tmf_complete = tmf->complete;
scic_controller_complete_io(ihost->core_controller,
&idev->sci,
scic_controller_complete_io(&ihost->sci, &idev->sci,
ireq->sci_request_handle);
/*
* NULL the request handle to make sure it cannot be terminated
/* NULL the request handle to make sure it cannot be terminated
* or completed again.
*/
ireq->sci_request_handle = NULL;
......
......@@ -52,14 +52,12 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#if !defined(_ISCI_TASK_H_)
#ifndef _ISCI_TASK_H_
#define _ISCI_TASK_H_
#include <scsi/sas_ata.h>
struct isci_request;
struct isci_host;
/**
* enum isci_tmf_cb_state - This enum defines the possible states in which the
......
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