提交 bc99aa47 编写于 作者: C Christoph Hellwig 提交者: Dan Williams

isci: remove mmio wrappers

Remove a couple of layers around read/writel to make the driver readable.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NDan Williams <dan.j.williams@intel.com>
上级 4393aa4e
......@@ -57,6 +57,7 @@
#define _SCIC_SDS_CONTROLLER_H_
#include <linux/string.h>
#include <linux/io.h>
/**
* This file contains the structures, constants and prototypes used for the
......@@ -80,7 +81,6 @@
#include "scu_unsolicited_frame.h"
#include "scic_sds_unsolicited_frame_control.h"
#include "scic_sds_port_configuration_agent.h"
#include "scic_sds_pci.h"
struct scic_sds_remote_device;
struct scic_sds_request;
......@@ -427,38 +427,6 @@ extern const struct scic_sds_controller_state_handler
#define scic_sds_controller_get_port_configuration_agent(controller) \
(&(controller)->port_agent)
/**
* smu_register_write() -
*
* This macro writes to the smu_register for this controller
*/
#define smu_register_write(controller, reg, value) \
scic_sds_pci_write_smu_dword((controller), &(reg), (value))
/**
* smu_register_read() -
*
* This macro reads the smu_register for this controller
*/
#define smu_register_read(controller, reg) \
scic_sds_pci_read_smu_dword((controller), &(reg))
/**
* scu_register_write() -
*
* This mcaro writes the scu_register for this controller
*/
#define scu_register_write(controller, reg, value) \
scic_sds_pci_write_scu_dword((controller), &(reg), (value))
/**
* scu_register_read() -
*
* This macro reads the scu_register for this controller
*/
#define scu_register_read(controller, reg) \
scic_sds_pci_read_scu_dword((controller), &(reg))
/**
* scic_sds_controller_get_protocol_engine_group() -
*
......
/*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* GPL LICENSE SUMMARY
*
* Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
* The full GNU General Public License is included in this distribution
* in the file called LICENSE.GPL.
*
* BSD LICENSE
*
* Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SCIC_SDS_CONTROLLER_REGISTERS_H_
#define _SCIC_SDS_CONTROLLER_REGISTERS_H_
/**
* This file contains macros used to perform the register reads/writes to the
* SCU hardware.
*
*
*/
#include "scu_registers.h"
#include "scic_sds_controller.h"
/**
* scic_sds_controller_smu_register_read() -
*
* SMU_REGISTER_ACCESS_MACROS
*/
#define scic_sds_controller_smu_register_read(controller, reg) \
smu_register_read(\
(controller), \
(controller)->smu_registers->reg \
)
#define scic_sds_controller_smu_register_write(controller, reg, value) \
smu_register_write(\
(controller), \
(controller)->smu_registers->reg, \
(value) \
)
/**
* scu_afe_register_write() -
*
* AFE_REGISTER_ACCESS_MACROS
*/
#define scu_afe_register_write(controller, reg, value) \
scu_register_write(\
(controller), \
(controller)->scu_registers->afe.reg, \
(value) \
)
#define scu_afe_txreg_write(controller, phy, reg, value) \
scu_register_write(\
(controller), \
(controller)->scu_registers->afe.scu_afe_xcvr[phy].reg,\
(value) \
)
#define scu_afe_register_read(controller, reg) \
scu_register_read(\
(controller), \
(controller)->scu_registers->afe.reg \
)
/**
* scu_controller_viit_register_write() -
*
* VIIT_REGISTER_ACCESS_MACROS
*/
#define scu_controller_viit_register_write(controller, index, reg, value) \
scu_register_write(\
(controller), \
(controller)->scu_registers->peg0.viit[index].reg, \
value \
)
/*
* *****************************************************************************
* * SMU REGISTERS
* ***************************************************************************** */
/**
* SMU_PCP_WRITE() -
*
* struct smu_registers
*/
#define SMU_PCP_WRITE(controller, value) \
scic_sds_controller_smu_register_write(\
controller, post_context_port, value \
)
#define SMU_TCR_READ(controller, value) \
scic_sds_controller_smu_register_read(\
controller, task_context_range \
)
#define SMU_TCR_WRITE(controller, value) \
scic_sds_controller_smu_register_write(\
controller, task_context_range, value \
)
#define SMU_HTTBAR_WRITE(controller, address) \
{ \
scic_sds_controller_smu_register_write(\
controller, \
host_task_table_lower, \
lower_32_bits(address) \
); \
scic_sds_controller_smu_register_write(\
controller, \
host_task_table_upper, \
upper_32_bits(address) \
); \
}
#define SMU_CQBAR_WRITE(controller, address) \
{ \
scic_sds_controller_smu_register_write(\
controller, \
completion_queue_lower, \
lower_32_bits(address) \
); \
scic_sds_controller_smu_register_write(\
controller, \
completion_queue_upper, \
upper_32_bits(address) \
); \
}
#define SMU_CQGR_WRITE(controller, value) \
scic_sds_controller_smu_register_write(\
controller, completion_queue_get, value \
)
#define SMU_CQGR_READ(controller, value) \
scic_sds_controller_smu_register_read(\
controller, completion_queue_get \
)
#define SMU_CQPR_WRITE(controller, value) \
scic_sds_controller_smu_register_write(\
controller, completion_queue_put, value \
)
#define SMU_RNCBAR_WRITE(controller, address) \
{ \
scic_sds_controller_smu_register_write(\
controller, \
remote_node_context_lower, \
lower_32_bits(address) \
); \
scic_sds_controller_smu_register_write(\
controller, \
remote_node_context_upper, \
upper_32_bits(address) \
); \
}
#define SMU_AMR_READ(controller) \
scic_sds_controller_smu_register_read(\
controller, address_modifier \
)
#define SMU_IMR_READ(controller) \
scic_sds_controller_smu_register_read(\
controller, interrupt_mask \
)
#define SMU_IMR_WRITE(controller, mask) \
scic_sds_controller_smu_register_write(\
controller, interrupt_mask, mask \
)
#define SMU_ISR_READ(controller) \
scic_sds_controller_smu_register_read(\
controller, interrupt_status \
)
#define SMU_ISR_WRITE(controller, status) \
scic_sds_controller_smu_register_write(\
controller, interrupt_status, status \
)
#define SMU_ICC_READ(controller) \
scic_sds_controller_smu_register_read(\
controller, interrupt_coalesce_control \
)
#define SMU_ICC_WRITE(controller, value) \
scic_sds_controller_smu_register_write(\
controller, interrupt_coalesce_control, value \
)
#define SMU_CQC_WRITE(controller, value) \
scic_sds_controller_smu_register_write(\
controller, completion_queue_control, value \
)
#define SMU_SMUSRCR_WRITE(controller, value) \
scic_sds_controller_smu_register_write(\
controller, soft_reset_control, value \
)
#define SMU_TCA_WRITE(controller, index, value) \
scic_sds_controller_smu_register_write(\
controller, task_context_assignment[index], value \
)
#define SMU_TCA_READ(controller, index) \
scic_sds_controller_smu_register_read(\
controller, task_context_assignment[index] \
)
#define SMU_DCC_READ(controller) \
scic_sds_controller_smu_register_read(\
controller, device_context_capacity \
)
#define SMU_DFC_READ(controller) \
scic_sds_controller_smu_register_read(\
controller, device_function_capacity \
)
#define SMU_SMUCSR_READ(controller) \
scic_sds_controller_smu_register_read(\
controller, control_status \
)
#define SMU_CQPR_READ(controller) \
scic_sds_controller_smu_register_read(\
controller, completion_queue_put \
)
/**
* scic_sds_controller_scu_register_read() -
*
* SCU_REGISTER_ACCESS_MACROS
*/
#define scic_sds_controller_scu_register_read(controller, reg) \
scu_register_read(\
(controller), \
(controller)->scu_registers->reg \
)
#define scic_sds_controller_scu_register_write(controller, reg, value) \
scu_register_write(\
(controller), \
(controller)->scu_registers->reg, \
(value) \
)
/*
* ****************************************************************************
* * SCU SDMA REGISTERS
* **************************************************************************** */
/**
* scu_sdma_register_read() -
*
* SCU_SDMA_REGISTER_ACCESS_MACROS
*/
#define scu_sdma_register_read(controller, reg) \
scu_register_read(\
(controller), \
(controller)->scu_registers->sdma.reg \
)
#define scu_sdma_register_write(controller, reg, value) \
scu_register_write(\
(controller), \
(controller)->scu_registers->sdma.reg, \
(value) \
)
/**
* SCU_PUFATHAR_WRITE() -
*
* struct scu_sdma_registers
*/
#define SCU_PUFATHAR_WRITE(controller, address) \
{ \
scu_sdma_register_write(\
controller, \
uf_address_table_lower, \
lower_32_bits(address) \
); \
scu_sdma_register_write(\
controller, \
uf_address_table_upper, \
upper_32_bits(address) \
); \
}
#define SCU_UFHBAR_WRITE(controller, address) \
{ \
scu_sdma_register_write(\
controller, \
uf_header_base_address_lower, \
lower_32_bits(address) \
); \
scu_sdma_register_write(\
controller, \
uf_header_base_address_upper, \
upper_32_bits(address) \
); \
}
#define SCU_UFQC_READ(controller) \
scu_sdma_register_read(\
controller, \
unsolicited_frame_queue_control \
)
#define SCU_UFQC_WRITE(controller, value) \
scu_sdma_register_write(\
controller, \
unsolicited_frame_queue_control, \
value \
)
#define SCU_UFQPP_READ(controller) \
scu_sdma_register_read(\
controller, \
unsolicited_frame_put_pointer \
)
#define SCU_UFQPP_WRITE(controller, value) \
scu_sdma_register_write(\
controller, \
unsolicited_frame_put_pointer, \
value \
)
#define SCU_UFQGP_WRITE(controller, value) \
scu_sdma_register_write(\
controller, \
unsolicited_frame_get_pointer, \
value \
)
#define SCU_PDMACR_READ(controller) \
scu_sdma_register_read(\
controller, \
pdma_configuration \
)
#define SCU_PDMACR_WRITE(controller, value) \
scu_sdma_register_write(\
controller, \
pdma_configuration, \
value \
)
#define SCU_CDMACR_READ(controller) \
scu_sdma_register_read(\
controller, \
cdma_configuration \
)
#define SCU_CDMACR_WRITE(controller, value) \
scu_sdma_register_write(\
controller, \
cdma_configuration, \
value \
)
/*
* *****************************************************************************
* * SCU Port Task Scheduler Group Registers
* ***************************************************************************** */
/**
* scu_ptsg_register_read() -
*
* SCU_PTSG_REGISTER_ACCESS_MACROS
*/
#define scu_ptsg_register_read(controller, reg) \
scu_register_read(\
(controller), \
(controller)->scu_registers->peg0.ptsg.reg \
)
#define scu_ptsg_register_write(controller, reg, value) \
scu_register_write(\
(controller), \
(controller)->scu_registers->peg0.ptsg.reg, \
(value) \
)
/**
* SCU_PTSGCR_READ() -
*
* SCU_PTSG_REGISTERS
*/
#define SCU_PTSGCR_READ(controller) \
scu_ptsg_register_read(\
(controller), \
control \
)
#define SCU_PTSGCR_WRITE(controller, value) \
scu_ptsg_register_write(\
(controller), \
control, \
value \
)
#define SCU_PTSGRTC_READ(controller) \
scu_ptsg_register_read(\
contoller, \
real_time_clock \
)
#endif /* _SCIC_SDS_CONTROLLER_REGISTERS_H_ */
/*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* GPL LICENSE SUMMARY
*
* Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
* The full GNU General Public License is included in this distribution
* in the file called LICENSE.GPL.
*
* BSD LICENSE
*
* Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SCIC_SDS_PCI_H_
#define _SCIC_SDS_PCI_H_
/**
* This file contains the prototypes/macros utilized in writing out PCI data
* for the SCI core.
*
*
*/
#include <asm/io.h>
struct scic_sds_controller;
void scic_sds_pci_bar_initialization(struct scic_sds_controller *scic);
/* for debug we separate scu and smu accesses and require a controller */
static inline u32 scic_sds_pci_read_smu_dword(struct scic_sds_controller *scic, void __iomem *addr)
{
return readl(addr);
}
static inline void scic_sds_pci_write_smu_dword(struct scic_sds_controller *scic, void __iomem *addr, u32 value)
{
writel(value, addr);
}
static inline u32 scic_sds_pci_read_scu_dword(struct scic_sds_controller *scic, void __iomem *addr)
{
return readl(addr);
}
static inline void scic_sds_pci_write_scu_dword(struct scic_sds_controller *scic, void __iomem *addr, u32 value)
{
writel(value, addr);
}
#endif /* _SCIC_SDS_PCI_H_ */
......@@ -60,7 +60,6 @@
#include "scic_phy.h"
#include "scic_sds_controller.h"
#include "scic_sds_phy.h"
#include "scic_sds_phy_registers.h"
#include "scic_sds_port.h"
#include "scic_sds_remote_node_context.h"
#include "sci_environment.h"
......@@ -98,12 +97,13 @@ static enum sci_status scic_sds_phy_transport_layer_initialization(
this_phy->transport_layer_registers = transport_layer_registers;
SCU_STPTLDARNI_WRITE(this_phy, SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX);
writel(SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX,
&this_phy->transport_layer_registers->stp_rni);
/* Hardware team recommends that we enable the STP prefetch for all transports */
tl_control = SCU_TLCR_READ(this_phy);
tl_control = readl(&this_phy->transport_layer_registers->control);
tl_control |= SCU_TLCR_GEN_BIT(STP_WRITE_DATA_PREFETCH);
SCU_TLCR_WRITE(this_phy, tl_control);
writel(tl_control, &this_phy->transport_layer_registers->control);
return SCI_SUCCESS;
}
......@@ -135,30 +135,36 @@ scic_sds_phy_link_layer_initialization(struct scic_sds_phy *sci_phy,
/* Set our IDENTIFY frame data */
#define SCI_END_DEVICE 0x01
SCU_SAS_TIID_WRITE(sci_phy, (SCU_SAS_TIID_GEN_BIT(SMP_INITIATOR) |
SCU_SAS_TIID_GEN_BIT(SSP_INITIATOR) |
SCU_SAS_TIID_GEN_BIT(STP_INITIATOR) |
SCU_SAS_TIID_GEN_BIT(DA_SATA_HOST) |
SCU_SAS_TIID_GEN_VAL(DEVICE_TYPE, SCI_END_DEVICE)));
writel(SCU_SAS_TIID_GEN_BIT(SMP_INITIATOR) |
SCU_SAS_TIID_GEN_BIT(SSP_INITIATOR) |
SCU_SAS_TIID_GEN_BIT(STP_INITIATOR) |
SCU_SAS_TIID_GEN_BIT(DA_SATA_HOST) |
SCU_SAS_TIID_GEN_VAL(DEVICE_TYPE, SCI_END_DEVICE),
&sci_phy->link_layer_registers->transmit_identification);
/* Write the device SAS Address */
SCU_SAS_TIDNH_WRITE(sci_phy, 0xFEDCBA98);
SCU_SAS_TIDNL_WRITE(sci_phy, phy_idx);
writel(0xFEDCBA98, &sci_phy->link_layer_registers->sas_device_name_high);
writel(phy_idx, &sci_phy->link_layer_registers->sas_device_name_low);
/* Write the source SAS Address */
SCU_SAS_TISSAH_WRITE(sci_phy, phy_oem->sas_address.high);
SCU_SAS_TISSAL_WRITE(sci_phy, phy_oem->sas_address.low);
writel(phy_oem->sas_address.high,
&sci_phy->link_layer_registers->source_sas_address_high);
writel(phy_oem->sas_address.low,
&sci_phy->link_layer_registers->source_sas_address_low);
/* Clear and Set the PHY Identifier */
SCU_SAS_TIPID_WRITE(sci_phy, 0x00000000);
SCU_SAS_TIPID_WRITE(sci_phy, SCU_SAS_TIPID_GEN_VALUE(ID, phy_idx));
writel(0, &sci_phy->link_layer_registers->identify_frame_phy_id);
writel(SCU_SAS_TIPID_GEN_VALUE(ID, phy_idx),
&sci_phy->link_layer_registers->identify_frame_phy_id);
/* Change the initial state of the phy configuration register */
phy_configuration = SCU_SAS_PCFG_READ(sci_phy);
phy_configuration =
readl(&sci_phy->link_layer_registers->phy_configuration);
/* Hold OOB state machine in reset */
phy_configuration |= SCU_SAS_PCFG_GEN_BIT(OOB_RESET);
SCU_SAS_PCFG_WRITE(sci_phy, phy_configuration);
writel(phy_configuration,
&sci_phy->link_layer_registers->phy_configuration);
/* Configure the SNW capabilities */
phy_capabilities.u.all = 0;
......@@ -188,13 +194,15 @@ scic_sds_phy_link_layer_initialization(struct scic_sds_phy *sci_phy,
if ((parity_count % 2) != 0)
phy_capabilities.u.bits.parity = 1;
SCU_SAS_PHYCAP_WRITE(sci_phy, phy_capabilities.u.all);
writel(phy_capabilities.u.all,
&sci_phy->link_layer_registers->phy_capabilities);
/* Set the enable spinup period but disable the ability to send
* notify enable spinup
*/
SCU_SAS_ENSPINUP_WRITE(sci_phy, SCU_ENSPINUP_GEN_VAL(COUNT,
phy_user->notify_enable_spin_up_insertion_frequency));
writel(SCU_ENSPINUP_GEN_VAL(COUNT,
phy_user->notify_enable_spin_up_insertion_frequency),
&sci_phy->link_layer_registers->notify_enable_spinup_control);
/* Write the ALIGN Insertion Ferequency for connected phy and
* inpendent of connected state
......@@ -205,10 +213,11 @@ scic_sds_phy_link_layer_initialization(struct scic_sds_phy *sci_phy,
clksm_value |= SCU_ALIGN_INSERTION_FREQUENCY_GEN_VAL(GENERAL,
phy_user->align_insertion_frequency);
SCU_SAS_CLKSM_WRITE(sci_phy, clksm_value);
writel(clksm_value, &sci_phy->link_layer_registers->clock_skew_management);
/* @todo Provide a way to write this register correctly */
scu_link_layer_register_write(sci_phy, afe_lookup_table_control, 0x02108421);
writel(0x02108421,
&sci_phy->link_layer_registers->afe_lookup_table_control);
llctl = SCU_SAS_LLCTL_GEN_VAL(NO_OUTBOUND_TASK_TIMEOUT,
(u8)scic->user_parameters.sds1.no_outbound_task_timeout);
......@@ -225,8 +234,7 @@ scic_sds_phy_link_layer_initialization(struct scic_sds_phy *sci_phy,
break;
}
llctl |= SCU_SAS_LLCTL_GEN_VAL(MAX_LINK_RATE, link_rate);
scu_link_layer_register_write(sci_phy, link_layer_control, llctl);
writel(llctl, &sci_phy->link_layer_registers->link_layer_control);
if (is_a0() || is_a2()) {
/* Program the max ARB time for the PHY to 700us so we inter-operate with
......@@ -234,16 +242,15 @@ scic_sds_phy_link_layer_initialization(struct scic_sds_phy *sci_phy,
* many breaks. This time value will guarantee that the initiator PHY will
* generate the break.
*/
scu_link_layer_register_write(sci_phy,
maximum_arbitration_wait_timer_timeout,
SCIC_SDS_PHY_MAX_ARBITRATION_WAIT_TIME);
writel(SCIC_SDS_PHY_MAX_ARBITRATION_WAIT_TIME,
&sci_phy->link_layer_registers->maximum_arbitration_wait_timer_timeout);
}
/*
* Set the link layer hang detection to 500ms (0x1F4) from its default
* value of 128ms. Max value is 511 ms. */
scu_link_layer_register_write(sci_phy, link_layer_hang_detection_timeout,
0x1F4);
* value of 128ms. Max value is 511 ms.
*/
writel(0x1F4, &sci_phy->link_layer_registers->link_layer_hang_detection_timeout);
/* We can exit the initial state to the stopped state */
sci_base_state_machine_change_state(&sci_phy->parent.state_machine,
......@@ -367,15 +374,15 @@ void scic_sds_phy_setup_transport(
{
u32 tl_control;
SCU_STPTLDARNI_WRITE(this_phy, device_id);
writel(device_id, &this_phy->transport_layer_registers->stp_rni);
/*
* The read should guarantee that the first write gets posted
* before the next write
*/
tl_control = SCU_TLCR_READ(this_phy);
tl_control = readl(&this_phy->transport_layer_registers->control);
tl_control |= SCU_TLCR_GEN_BIT(CLEAR_TCI_NCQ_MAPPING_TABLE);
SCU_TLCR_WRITE(this_phy, tl_control);
writel(tl_control, &this_phy->transport_layer_registers->control);
}
/**
......@@ -390,9 +397,12 @@ static void scic_sds_phy_suspend(
{
u32 scu_sas_pcfg_value;
scu_sas_pcfg_value = SCU_SAS_PCFG_READ(this_phy);
scu_sas_pcfg_value =
readl(&this_phy->link_layer_registers->phy_configuration);
scu_sas_pcfg_value |= SCU_SAS_PCFG_GEN_BIT(SUSPEND_PROTOCOL_ENGINE);
SCU_SAS_PCFG_WRITE(this_phy, scu_sas_pcfg_value);
writel(scu_sas_pcfg_value,
&this_phy->link_layer_registers->phy_configuration);
scic_sds_phy_setup_transport(this_phy, SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX);
}
......@@ -408,11 +418,11 @@ void scic_sds_phy_resume(
{
u32 scu_sas_pcfg_value;
scu_sas_pcfg_value = SCU_SAS_PCFG_READ(this_phy);
scu_sas_pcfg_value =
readl(&this_phy->link_layer_registers->phy_configuration);
scu_sas_pcfg_value &= ~SCU_SAS_PCFG_GEN_BIT(SUSPEND_PROTOCOL_ENGINE);
SCU_SAS_PCFG_WRITE(this_phy, scu_sas_pcfg_value);
writel(scu_sas_pcfg_value,
&this_phy->link_layer_registers->phy_configuration);
}
/**
......@@ -427,8 +437,8 @@ void scic_sds_phy_get_sas_address(
struct scic_sds_phy *this_phy,
struct sci_sas_address *sas_address)
{
sas_address->high = SCU_SAS_TISSAH_READ(this_phy);
sas_address->low = SCU_SAS_TISSAL_READ(this_phy);
sas_address->high = readl(&this_phy->link_layer_registers->source_sas_address_high);
sas_address->low = readl(&this_phy->link_layer_registers->source_sas_address_low);
}
/**
......@@ -460,7 +470,10 @@ void scic_sds_phy_get_protocols(
struct scic_sds_phy *this_phy,
struct sci_sas_identify_address_frame_protocols *protocols)
{
protocols->u.all = (u16)(SCU_SAS_TIID_READ(this_phy) & 0x0000FFFF);
protocols->u.all =
(u16)(readl(&this_phy->
link_layer_registers->transmit_identification) &
0x0000FFFF);
}
/**
......@@ -589,8 +602,8 @@ enum sci_status scic_sas_phy_get_properties(
sizeof(struct sci_sas_identify_address_frame)
);
properties->received_capabilities.u.all
= SCU_SAS_RECPHYCAP_READ(sci_phy);
properties->received_capabilities.u.all =
readl(&sci_phy->link_layer_registers->receive_phycap);
return SCI_SUCCESS;
}
......@@ -639,9 +652,11 @@ static void scic_sds_phy_start_sas_link_training(
{
u32 phy_control;
phy_control = SCU_SAS_PCFG_READ(this_phy);
phy_control =
readl(&this_phy->link_layer_registers->phy_configuration);
phy_control |= SCU_SAS_PCFG_GEN_BIT(SATA_SPINUP_HOLD);
SCU_SAS_PCFG_WRITE(this_phy, phy_control);
writel(phy_control,
&this_phy->link_layer_registers->phy_configuration);
sci_base_state_machine_change_state(
&this_phy->starting_substate_machine,
......@@ -1331,9 +1346,9 @@ static enum sci_status scic_sds_phy_starting_substate_await_sas_power_consume_po
{
u32 enable_spinup;
enable_spinup = SCU_SAS_ENSPINUP_READ(sci_phy);
enable_spinup = readl(&sci_phy->link_layer_registers->notify_enable_spinup_control);
enable_spinup |= SCU_ENSPINUP_GEN_BIT(ENABLE);
SCU_SAS_ENSPINUP_WRITE(sci_phy, enable_spinup);
writel(enable_spinup, &sci_phy->link_layer_registers->notify_enable_spinup_control);
/* Change state to the final state this substate machine has run to completion */
sci_base_state_machine_change_state(&sci_phy->starting_substate_machine,
......@@ -1357,16 +1372,19 @@ static enum sci_status scic_sds_phy_starting_substate_await_sata_power_consume_p
u32 scu_sas_pcfg_value;
/* Release the spinup hold state and reset the OOB state machine */
scu_sas_pcfg_value = SCU_SAS_PCFG_READ(sci_phy);
scu_sas_pcfg_value =
readl(&sci_phy->link_layer_registers->phy_configuration);
scu_sas_pcfg_value &=
~(SCU_SAS_PCFG_GEN_BIT(SATA_SPINUP_HOLD) | SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE));
scu_sas_pcfg_value |= SCU_SAS_PCFG_GEN_BIT(OOB_RESET);
SCU_SAS_PCFG_WRITE(sci_phy, scu_sas_pcfg_value);
writel(scu_sas_pcfg_value,
&sci_phy->link_layer_registers->phy_configuration);
/* Now restart the OOB operation */
scu_sas_pcfg_value &= ~SCU_SAS_PCFG_GEN_BIT(OOB_RESET);
scu_sas_pcfg_value |= SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE);
SCU_SAS_PCFG_WRITE(sci_phy, scu_sas_pcfg_value);
writel(scu_sas_pcfg_value,
&sci_phy->link_layer_registers->phy_configuration);
/* Change state to the final state this substate machine has run to completion */
sci_base_state_machine_change_state(&sci_phy->starting_substate_machine,
......@@ -2120,18 +2138,20 @@ static void scu_link_layer_stop_protocol_engine(
u32 enable_spinup_value;
/* Suspend the protocol engine and place it in a sata spinup hold state */
scu_sas_pcfg_value = SCU_SAS_PCFG_READ(this_phy);
scu_sas_pcfg_value =
readl(&this_phy->link_layer_registers->phy_configuration);
scu_sas_pcfg_value |= (
SCU_SAS_PCFG_GEN_BIT(OOB_RESET)
| SCU_SAS_PCFG_GEN_BIT(SUSPEND_PROTOCOL_ENGINE)
| SCU_SAS_PCFG_GEN_BIT(SATA_SPINUP_HOLD)
);
SCU_SAS_PCFG_WRITE(this_phy, scu_sas_pcfg_value);
writel(scu_sas_pcfg_value,
&this_phy->link_layer_registers->phy_configuration);
/* Disable the notify enable spinup primitives */
enable_spinup_value = SCU_SAS_ENSPINUP_READ(this_phy);
enable_spinup_value = readl(&this_phy->link_layer_registers->notify_enable_spinup_control);
enable_spinup_value &= ~SCU_ENSPINUP_GEN_BIT(ENABLE);
SCU_SAS_ENSPINUP_WRITE(this_phy, enable_spinup_value);
writel(enable_spinup_value, &this_phy->link_layer_registers->notify_enable_spinup_control);
}
/**
......@@ -2144,12 +2164,13 @@ static void scu_link_layer_start_oob(
{
u32 scu_sas_pcfg_value;
scu_sas_pcfg_value = SCU_SAS_PCFG_READ(this_phy);
scu_sas_pcfg_value =
readl(&this_phy->link_layer_registers->phy_configuration);
scu_sas_pcfg_value |= SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE);
scu_sas_pcfg_value &=
~(SCU_SAS_PCFG_GEN_BIT(OOB_RESET) | SCU_SAS_PCFG_GEN_BIT(HARD_RESET));
SCU_SAS_PCFG_WRITE(this_phy, scu_sas_pcfg_value);
writel(scu_sas_pcfg_value,
&this_phy->link_layer_registers->phy_configuration);
}
/**
......@@ -2168,15 +2189,18 @@ static void scu_link_layer_tx_hard_reset(
/*
* SAS Phys must wait for the HARD_RESET_TX event notification to transition
* to the starting state. */
phy_configuration_value = SCU_SAS_PCFG_READ(this_phy);
phy_configuration_value =
readl(&this_phy->link_layer_registers->phy_configuration);
phy_configuration_value |=
(SCU_SAS_PCFG_GEN_BIT(HARD_RESET) | SCU_SAS_PCFG_GEN_BIT(OOB_RESET));
SCU_SAS_PCFG_WRITE(this_phy, phy_configuration_value);
writel(phy_configuration_value,
&this_phy->link_layer_registers->phy_configuration);
/* Now take the OOB state machine out of reset */
phy_configuration_value |= SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE);
phy_configuration_value &= ~SCU_SAS_PCFG_GEN_BIT(OOB_RESET);
SCU_SAS_PCFG_WRITE(this_phy, phy_configuration_value);
writel(phy_configuration_value,
&this_phy->link_layer_registers->phy_configuration);
}
/*
......
/*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* GPL LICENSE SUMMARY
*
* Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
* The full GNU General Public License is included in this distribution
* in the file called LICENSE.GPL.
*
* BSD LICENSE
*
* Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SCIC_SDS_PHY_REGISTERS_H_
#define _SCIC_SDS_PHY_REGISTERS_H_
/**
* This file contains the macros used by the phy object to read/write to the
* SCU link layer registers.
*
*
*/
#include "scic_sds_controller.h"
/* **************************************************************************
* * SCU TRANSPORT LAYER REGISTER OPERATIONS
* ************************************************************************** */
/**
* Macro to read the transport layer register associated with this phy
* object.
*/
#define scu_transport_layer_read(phy, reg) \
scu_register_read( \
scic_sds_phy_get_controller(phy), \
(phy)->transport_layer_registers->reg \
)
/**
* Macro to write the transport layer register associated with this phy
* object.
*/
#define scu_transport_layer_write(phy, reg, value) \
scu_register_write( \
scic_sds_phy_get_controller(phy), \
(phy)->transport_layer_registers->reg, \
(value) \
)
/* **************************************************************************
* * Transport Layer registers controlled by the phy object
* ************************************************************************** */
/* This macro reads the Transport layer control register */
#define SCU_TLCR_READ(phy) \
scu_transport_layer_read(phy, control)
/* This macro writes the Transport layer control register */
#define SCU_TLCR_WRITE(phy, value) \
scu_transport_layer_write(phy, control, value)
/* This macro reads the Transport layer address translation register */
#define SCU_TLADTR_READ(phy) \
scu_transport_layer_read(phy, address_translation)
/* This macro writes the Transport layer address translation register */
#define SCU_TLADTR_WRITE(phy) \
scu_transport_layer_write(phy, address_translation, value)
/* This macro writes the STP Transport Layer Direct Attached RNi register */
#define SCU_STPTLDARNI_WRITE(phy, index) \
scu_transport_layer_write(phy, stp_rni, index)
/* This macro reads the STP Transport Layer Direct Attached RNi register */
#define SCU_STPTLDARNI_READ(phy) \
scu_transport_layer_read(phy, stp_rni)
/*
* *****************************************************************************
* * SCU LINK LAYER REGISTER OPERATIONS
* ***************************************************************************** */
/**
* scu_link_layer_register_read() -
*
* THis macro requests the SCU register write for the specified link layer
* register.
*/
#define scu_link_layer_register_read(phy, reg) \
scu_register_read(\
scic_sds_phy_get_controller(phy), \
(phy)->link_layer_registers->reg \
)
/**
* scu_link_layer_register_write() -
*
* This macro requests the SCU register read for the specified link layer
* register.
*/
#define scu_link_layer_register_write(phy, reg, value) \
scu_register_write(\
scic_sds_phy_get_controller(phy), \
(phy)->link_layer_registers->reg, \
(value) \
)
/*
* *****************************************************************************
* * SCU LINK LAYER REGISTERS
* ***************************************************************************** */
/* / This macro reads from the SAS Identify Frame PHY Identifier register */
#define SCU_SAS_TIPID_READ(phy) \
scu_link_layer_register_read(phy, identify_frame_phy_id)
/* / This macro writes to the SAS Identify Frame PHY Identifier register */
#define SCU_SAS_TIPID_WRITE(phy, value) \
scu_link_layer_register_write(phy, identify_frame_phy_id, value)
/* / This macro reads from the SAS Identification register */
#define SCU_SAS_TIID_READ(phy) \
scu_link_layer_register_read(phy, transmit_identification)
/* / This macro writes to the SAS Identification register */
#define SCU_SAS_TIID_WRITE(phy, value) \
scu_link_layer_register_write(phy, transmit_identification, value)
/* / This macro reads the SAS Device Name High register */
#define SCU_SAS_TIDNH_READ(phy) \
scu_link_layer_register_read(phy, sas_device_name_high)
/* / This macro writes the SAS Device Name High register */
#define SCU_SAS_TIDNH_WRITE(phy, value) \
scu_link_layer_register_write(phy, sas_device_name_high, value)
/* / This macro reads the SAS Device Name Low register */
#define SCU_SAS_TIDNL_READ(phy) \
scu_link_layer_register_read(phy, sas_device_name_low)
/* / This macro writes the SAS Device Name Low register */
#define SCU_SAS_TIDNL_WRITE(phy, value) \
scu_link_layer_register_write(phy, sas_device_name_low, value)
/* / This macro reads the Source SAS Address High register */
#define SCU_SAS_TISSAH_READ(phy) \
scu_link_layer_register_read(phy, source_sas_address_high)
/* / This macro writes the Source SAS Address High register */
#define SCU_SAS_TISSAH_WRITE(phy, value) \
scu_link_layer_register_write(phy, source_sas_address_high, value)
/* / This macro reads the Source SAS Address Low register */
#define SCU_SAS_TISSAL_READ(phy) \
scu_link_layer_register_read(phy, source_sas_address_low)
/* / This macro writes the Source SAS Address Low register */
#define SCU_SAS_TISSAL_WRITE(phy, value) \
scu_link_layer_register_write(phy, source_sas_address_low, value)
/* / This macro reads the PHY Configuration register */
#define SCU_SAS_PCFG_READ(phy) \
scu_link_layer_register_read(phy, phy_configuration);
/* / This macro writes the PHY Configuration register */
#define SCU_SAS_PCFG_WRITE(phy, value) \
scu_link_layer_register_write(phy, phy_configuration, value)
/* / This macro reads the PHY Enable Spinup register */
#define SCU_SAS_ENSPINUP_READ(phy) \
scu_link_layer_register_read(phy, notify_enable_spinup_control)
/* / This macro writes the PHY Enable Spinup register */
#define SCU_SAS_ENSPINUP_WRITE(phy, value) \
scu_link_layer_register_write(phy, notify_enable_spinup_control, value)
/* This macro reads the CLKSM register */
#define SCU_SAS_CLKSM_READ(phy) \
scu_link_layer_register_read(phy, clock_skew_management)
/* This macro writes the CLKSM register */
#define SCU_SAS_CLKSM_WRITE(phy, value) \
scu_link_layer_register_write(phy, clock_skew_management, value)
/* / This macro reads the PHY Capacity register */
#define SCU_SAS_PHYCAP_READ(phy) \
scu_link_layer_register_read(phy, phy_capabilities)
/* / This macro writes the PHY Capacity register */
#define SCU_SAS_PHYCAP_WRITE(phy, value) \
scu_link_layer_register_write(phy, phy_capabilities, value)
/* / This macro reads the Recieved PHY Capacity register */
#define SCU_SAS_RECPHYCAP_READ(phy) \
scu_link_layer_register_read(phy, receive_phycap)
/* / This macro reads the link layer control register */
#define SCU_SAS_LLCTL_READ(phy) \
scu_link_layer_register_read(phy, link_layer_control);
/* / This macro writes the link layer control register */
#define SCU_SAS_LLCTL_WRITE(phy, value) \
scu_link_layer_register_write(phy, link_layer_control, value);
#endif /* _SCIC_SDS_PHY_REGISTERS_H_ */
......@@ -60,14 +60,12 @@
#include "scic_port.h"
#include "scic_sds_controller.h"
#include "scic_sds_phy.h"
#include "scic_sds_phy_registers.h"
#include "scic_sds_port.h"
#include "scic_sds_port_registers.h"
#include "scic_sds_remote_device.h"
#include "scic_sds_remote_node_context.h"
#include "scic_sds_request.h"
#include "sci_environment.h"
#include "scic_sds_controller_registers.h"
#include "scu_registers.h"
#define SCIC_SDS_PORT_MIN_TIMER_COUNT (SCI_MAX_PORTS)
#define SCIC_SDS_PORT_MAX_TIMER_COUNT (SCI_MAX_PORTS)
......@@ -706,7 +704,8 @@ void scic_sds_port_deactivate_phy(struct scic_sds_port *sci_port,
sci_phy->max_negotiated_speed = SCI_SAS_NO_LINK_RATE;
/* Re-assign the phy back to the LP as if it were a narrow port */
SCU_PCSPExCR_WRITE(sci_port, sci_phy->phy_index, sci_phy->phy_index);
writel(sci_phy->phy_index,
&sci_port->port_pe_configuration_register[sci_phy->phy_index]);
if (do_notify_user == true)
isci_port_link_down(ihost, iphy, iport);
......@@ -969,25 +968,20 @@ static void scic_sds_port_update_viit_entry(struct scic_sds_port *this_port)
scic_sds_port_get_sas_address(this_port, &sas_address);
scu_port_viit_register_write(
this_port, initiator_sas_address_hi, sas_address.high);
scu_port_viit_register_write(
this_port, initiator_sas_address_lo, sas_address.low);
writel(sas_address.high,
&this_port->viit_registers->initiator_sas_address_hi);
writel(sas_address.low,
&this_port->viit_registers->initiator_sas_address_lo);
/* This value get cleared just in case its not already cleared */
scu_port_viit_register_write(
this_port, reserved, 0);
writel(0, &this_port->viit_registers->reserved);
/* We are required to update the status register last */
scu_port_viit_register_write(
this_port, status, (
SCU_VIIT_ENTRY_ID_VIIT
| SCU_VIIT_IPPT_INITIATOR
| ((1 << this_port->physical_port_index) << SCU_VIIT_ENTRY_LPVIE_SHIFT)
| SCU_VIIT_STATUS_ALL_VALID
)
);
writel(SCU_VIIT_ENTRY_ID_VIIT |
SCU_VIIT_IPPT_INITIATOR |
((1 << this_port->physical_port_index) << SCU_VIIT_ENTRY_LPVIE_SHIFT) |
SCU_VIIT_STATUS_ALL_VALID,
&this_port->viit_registers->status);
}
/**
......@@ -1059,10 +1053,12 @@ void scic_port_enable_broadcast_change_notification(
for (index = 0; index < SCI_MAX_PHYS; index++) {
phy = port->phy_table[index];
if (phy != NULL) {
register_value = SCU_SAS_LLCTL_READ(phy);
register_value =
readl(&phy->link_layer_registers->link_layer_control);
/* clear the bit by writing 1. */
SCU_SAS_LLCTL_WRITE(phy, register_value);
writel(register_value,
&phy->link_layer_registers->link_layer_control);
}
}
}
......@@ -1618,16 +1614,14 @@ scic_sds_port_ready_substate_handler_table[SCIC_SDS_PORT_READY_MAX_SUBSTATES] =
*
* This method will susped the port task scheduler for this port object. none
*/
static void scic_sds_port_suspend_port_task_scheduler(
struct scic_sds_port *this_port)
static void
scic_sds_port_suspend_port_task_scheduler(struct scic_sds_port *port)
{
u32 pts_control_value;
pts_control_value = scu_port_task_scheduler_read(this_port, control);
pts_control_value = readl(&port->port_task_scheduler_registers->control);
pts_control_value |= SCU_PTSxCR_GEN_BIT(SUSPEND);
scu_port_task_scheduler_write(this_port, control, pts_control_value);
writel(pts_control_value, &port->port_task_scheduler_registers->control);
}
/**
......@@ -1688,16 +1682,14 @@ static void scic_sds_port_abort_dummy_request(struct scic_sds_port *sci_port)
*
* This method will resume the port task scheduler for this port object. none
*/
static void scic_sds_port_resume_port_task_scheduler(
struct scic_sds_port *this_port)
static void
scic_sds_port_resume_port_task_scheduler(struct scic_sds_port *port)
{
u32 pts_control_value;
pts_control_value = scu_port_task_scheduler_read(this_port, control);
pts_control_value = readl(&port->port_task_scheduler_registers->control);
pts_control_value &= ~SCU_PTSxCR_GEN_BIT(SUSPEND);
scu_port_task_scheduler_write(this_port, control, pts_control_value);
writel(pts_control_value, &port->port_task_scheduler_registers->control);
}
/*
......@@ -1763,10 +1755,11 @@ static void scic_sds_port_ready_substate_operational_enter(
isci_port_ready(ihost, iport);
for (index = 0; index < SCI_MAX_PHYS; index++) {
if (sci_port->phy_table[index] != NULL)
scic_sds_port_write_phy_assignment(
sci_port,
sci_port->phy_table[index]);
if (sci_port->phy_table[index]) {
writel(sci_port->physical_port_index,
&sci_port->port_pe_configuration_register[
sci_port->phy_table[index]->phy_index]);
}
}
scic_sds_port_update_viit_entry(sci_port);
......@@ -2308,16 +2301,14 @@ scic_sds_port_state_handler_table[SCI_BASE_PORT_MAX_STATES] =
* This method will enable the SCU Port Task Scheduler for this port object but
* will leave the port task scheduler in a suspended state. none
*/
static void scic_sds_port_enable_port_task_scheduler(
struct scic_sds_port *this_port)
static void
scic_sds_port_enable_port_task_scheduler(struct scic_sds_port *port)
{
u32 pts_control_value;
pts_control_value = scu_port_task_scheduler_read(this_port, control);
pts_control_value = readl(&port->port_task_scheduler_registers->control);
pts_control_value |= SCU_PTSxCR_GEN_BIT(ENABLE) | SCU_PTSxCR_GEN_BIT(SUSPEND);
scu_port_task_scheduler_write(this_port, control, pts_control_value);
writel(pts_control_value, &port->port_task_scheduler_registers->control);
}
/**
......@@ -2327,17 +2318,15 @@ static void scic_sds_port_enable_port_task_scheduler(
* This method will disable the SCU port task scheduler for this port object.
* none
*/
static void scic_sds_port_disable_port_task_scheduler(
struct scic_sds_port *this_port)
static void
scic_sds_port_disable_port_task_scheduler(struct scic_sds_port *port)
{
u32 pts_control_value;
pts_control_value = scu_port_task_scheduler_read(this_port, control);
pts_control_value &= ~(SCU_PTSxCR_GEN_BIT(ENABLE)
| SCU_PTSxCR_GEN_BIT(SUSPEND));
scu_port_task_scheduler_write(this_port, control, pts_control_value);
pts_control_value = readl(&port->port_task_scheduler_registers->control);
pts_control_value &=
~(SCU_PTSxCR_GEN_BIT(ENABLE) | SCU_PTSxCR_GEN_BIT(SUSPEND));
writel(pts_control_value, &port->port_task_scheduler_registers->control);
}
static void scic_sds_port_post_dummy_remote_node(struct scic_sds_port *sci_port)
......@@ -2359,7 +2348,7 @@ static void scic_sds_port_post_dummy_remote_node(struct scic_sds_port *sci_port)
/* ensure hardware has seen the post rnc command and give it
* ample time to act before sending the suspend
*/
SMU_ISR_READ(scic); /* flush */
readl(&scic->smu_registers->interrupt_status); /* flush */
udelay(10);
command = SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX_RX |
......@@ -2384,7 +2373,7 @@ static void scic_sds_port_invalidate_dummy_remote_node(struct scic_sds_port *sci
* controller and give it ample time to act before posting the rnc
* invalidate
*/
SMU_ISR_READ(scic); /* flush */
readl(&scic->smu_registers->interrupt_status); /* flush */
udelay(10);
command = SCU_CONTEXT_COMMAND_POST_RNC_INVALIDATE |
......
......@@ -289,29 +289,6 @@ static inline void scic_sds_port_decrement_request_count(struct scic_sds_port *s
sci_port->started_request_count--;
}
/**
* scic_sds_port_write_phy_assignment() -
*
* Helper macro to write the phys port assignment
*/
#define scic_sds_port_write_phy_assignment(port, phy) \
SCU_PCSPExCR_WRITE(\
(port), \
(phy)->phy_index, \
(port)->physical_port_index \
)
/**
* scic_sds_port_read_phy_assignment() -
*
* Helper macro to read the phys port assignment
*/
#define scic_sds_port_read_phy_assignment(port, phy) \
SCU_PCSPExCR_READ(\
(port), \
(phy)->phy_index \
)
#define scic_sds_port_active_phy(port, phy) \
(((port)->active_phy_mask & (1 << (phy)->phy_index)) != 0)
......
......@@ -63,85 +63,4 @@
*
*/
/**
* scu_port_task_scheduler_read() -
*
* Macro to read the port task scheduler register associated with this port
* object
*/
#define scu_port_task_scheduler_read(port, reg) \
scu_register_read(\
scic_sds_port_get_controller(port), \
(port)->port_task_scheduler_registers->reg \
)
/**
* scu_port_task_scheduler_write() -
*
* Macro to write the port task scheduler register associated with this port
* object
*/
#define scu_port_task_scheduler_write(port, reg, value) \
scu_register_write(\
scic_sds_port_get_controller(port), \
(port)->port_task_scheduler_registers->reg, \
(value) \
)
#define scu_port_viit_register_write(port, reg, value) \
scu_register_write(\
scic_sds_port_get_controller(port), \
(port)->viit_registers->reg, \
(value) \
)
/*
* ****************************************************************************
* * Port Task Scheduler registers controlled by the port object
* **************************************************************************** */
/**
* SCU_PTSxCR_READ() -
*
* Macro to read the port task scheduler control register
*/
#define SCU_PTSxCR_READ(port) \
scu_port_task_scheduler_read(port, control)
/**
* SCU_PTSxCR_WRITE() -
*
* Macro to write the port task scheduler control regsister
*/
#define SCU_PTSxCR_WRITE(port, value) \
scu_port_task_scheduler_write(port, control, value)
/*
* ****************************************************************************
* * Port PE Configuration registers
* **************************************************************************** */
/**
* SCU_PCSPExCR_WRITE() -
*
* Macro to write the PE Port Configuration Register
*/
#define SCU_PCSPExCR_WRITE(port, phy_id, value) \
scu_register_write(\
scic_sds_port_get_controller(port), \
(port)->port_pe_configuration_register[phy_id], \
(value) \
)
/**
* SCU_PCSPExCR_READ() -
*
* Macro to read the PE Port Configuration Regsiter
*/
#define SCU_PCSPExCR_READ(port, phy_id) \
scu_register_read(\
scic_sds_port_get_controller(port), \
(port)->port_pe_configuration_register[phy_id] \
)
#endif /* _SCIC_SDS_PORT_REGISTERS_H_ */
......@@ -62,8 +62,7 @@
#include "scic_io_request.h"
#include "scic_remote_device.h"
#include "scic_sds_controller.h"
#include "scic_sds_controller_registers.h"
#include "scic_sds_pci.h"
#include "scu_registers.h"
#include "scic_sds_port.h"
#include "scic_sds_remote_device.h"
#include "scic_sds_request.h"
......@@ -862,20 +861,16 @@ u32 scic_io_request_get_number_of_bytes_transferred(
{
u32 ret_val = 0;
if (SMU_AMR_READ(scic_sds_request->owning_controller) == 0) {
if (readl(&scic_sds_request->owning_controller->smu_registers->address_modifier) == 0) {
/*
* get the bytes of data from the Address == BAR1 + 20002Ch + (256*TCi) where
* BAR1 is the scu_registers
* 0x20002C = 0x200000 + 0x2c
* = start of task context SRAM + offset of (type.ssp.data_offset)
* TCi is the io_tag of struct scic_sds_request */
ret_val = scic_sds_pci_read_scu_dword(
scic_sds_request->owning_controller,
(
(u8 *)scic_sds_request->owning_controller->scu_registers +
ret_val = readl((u8 *)scic_sds_request->owning_controller->scu_registers +
(SCU_TASK_CONTEXT_SRAM + SCI_FIELD_OFFSET(struct scu_task_context, type.ssp.data_offset)) +
((sizeof(struct scu_task_context)) * scic_sds_io_tag_get_index(scic_sds_request->io_tag))
)
);
}
......
......@@ -315,10 +315,7 @@ enum sci_status scic_sds_unsolicited_frame_control_get_buffer(
* @frame_index: This parameter specifies the frame index to attempt to release.
*
* This method returns an indication to the caller as to whether the
* unsolicited frame get pointer should be updated. true This value indicates
* the unsolicited frame get pointer should be updated (i.e. write
* SCU_UFQGP_WRITE). false This value indicates the get pointer should not be
* updated.
* unsolicited frame get pointer should be updated.
*/
bool scic_sds_unsolicited_frame_control_release_frame(
struct scic_sds_unsolicited_frame_control *uf_control,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册