1230557Sjimharris/*- 2230557Sjimharris * This file is provided under a dual BSD/GPLv2 license. When using or 3230557Sjimharris * redistributing this file, you may do so under either license. 4230557Sjimharris * 5230557Sjimharris * GPL LICENSE SUMMARY 6230557Sjimharris * 7230557Sjimharris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 8230557Sjimharris * 9230557Sjimharris * This program is free software; you can redistribute it and/or modify 10230557Sjimharris * it under the terms of version 2 of the GNU General Public License as 11230557Sjimharris * published by the Free Software Foundation. 12230557Sjimharris * 13230557Sjimharris * This program is distributed in the hope that it will be useful, but 14230557Sjimharris * WITHOUT ANY WARRANTY; without even the implied warranty of 15230557Sjimharris * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16230557Sjimharris * General Public License for more details. 17230557Sjimharris * 18230557Sjimharris * You should have received a copy of the GNU General Public License 19230557Sjimharris * along with this program; if not, write to the Free Software 20230557Sjimharris * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 21230557Sjimharris * The full GNU General Public License is included in this distribution 22230557Sjimharris * in the file called LICENSE.GPL. 23230557Sjimharris * 24230557Sjimharris * BSD LICENSE 25230557Sjimharris * 26230557Sjimharris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 27230557Sjimharris * All rights reserved. 28230557Sjimharris * 29230557Sjimharris * Redistribution and use in source and binary forms, with or without 30230557Sjimharris * modification, are permitted provided that the following conditions 31230557Sjimharris * are met: 32230557Sjimharris * 33230557Sjimharris * * Redistributions of source code must retain the above copyright 34230557Sjimharris * notice, this list of conditions and the following disclaimer. 35230557Sjimharris * * Redistributions in binary form must reproduce the above copyright 36230557Sjimharris * notice, this list of conditions and the following disclaimer in 37230557Sjimharris * the documentation and/or other materials provided with the 38230557Sjimharris * distribution. 39230557Sjimharris * 40230557Sjimharris * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 41230557Sjimharris * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 42230557Sjimharris * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 43230557Sjimharris * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 44230557Sjimharris * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45230557Sjimharris * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 46230557Sjimharris * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 47230557Sjimharris * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48230557Sjimharris * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 49230557Sjimharris * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 50230557Sjimharris * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 51230557Sjimharris * 52230557Sjimharris * $FreeBSD: releng/10.3/sys/dev/isci/scil/scic_sds_phy_registers.h 231136 2012-02-07 17:43:58Z jimharris $ 53230557Sjimharris */ 54230557Sjimharris#ifndef _SCIC_SDS_PHY_REGISTERS_H_ 55230557Sjimharris#define _SCIC_SDS_PHY_REGISTERS_H_ 56230557Sjimharris 57230557Sjimharris/** 58230557Sjimharris * @file 59230557Sjimharris * 60230557Sjimharris * @brief This file contains the macros used by the phy object to read/write 61230557Sjimharris * to the SCU link layer registers. 62230557Sjimharris */ 63230557Sjimharris 64230557Sjimharris#ifdef __cplusplus 65230557Sjimharrisextern "C" { 66230557Sjimharris#endif // __cplusplus 67230557Sjimharris 68230557Sjimharris#include <dev/isci/scil/scic_sds_controller.h> 69230557Sjimharris 70230557Sjimharris//***************************************************************************** 71230557Sjimharris//* SCU LINK LAYER REGISTER OPERATIONS 72230557Sjimharris//***************************************************************************** 73230557Sjimharris 74230557Sjimharris/** 75230557Sjimharris * Macro to read the transport layer register associated with this phy 76230557Sjimharris * object. 77230557Sjimharris */ 78230557Sjimharris#define scu_transport_layer_read(phy, reg) \ 79230557Sjimharris scu_register_read( \ 80230557Sjimharris scic_sds_phy_get_controller(phy), \ 81230557Sjimharris (phy)->transport_layer_registers->reg \ 82230557Sjimharris ) 83230557Sjimharris 84230557Sjimharris/** 85230557Sjimharris * Macro to write the transport layer register associated with this phy 86230557Sjimharris * object. 87230557Sjimharris */ 88230557Sjimharris#define scu_transport_layer_write(phy, reg, value) \ 89230557Sjimharris scu_register_write( \ 90230557Sjimharris scic_sds_phy_get_controller(phy), \ 91230557Sjimharris (phy)->transport_layer_registers->reg, \ 92230557Sjimharris (value) \ 93230557Sjimharris ) 94230557Sjimharris 95230557Sjimharris//**************************************************************************** 96230557Sjimharris//* Transport Layer registers controlled by the phy object 97230557Sjimharris//**************************************************************************** 98230557Sjimharris 99230557Sjimharris/** 100230557Sjimharris * This macro reads the Transport layer control register 101230557Sjimharris */ 102230557Sjimharris#define SCU_TLCR_READ(phy) \ 103230557Sjimharris scu_transport_layer_read(phy, control) 104230557Sjimharris 105230557Sjimharris/** 106230557Sjimharris * This macro writes the Transport layer control register 107230557Sjimharris */ 108230557Sjimharris#define SCU_TLCR_WRITE(phy, value) \ 109230557Sjimharris scu_transport_layer_write(phy, control, value) 110230557Sjimharris 111230557Sjimharris/** 112230557Sjimharris * This macro reads the Transport layer address translation register 113230557Sjimharris */ 114230557Sjimharris#define SCU_TLADTR_READ(phy) \ 115230557Sjimharris scu_transport_layer_read(phy, address_translation) 116230557Sjimharris 117230557Sjimharris/** 118230557Sjimharris * This macro writes the Transport layer address translation register 119230557Sjimharris */ 120230557Sjimharris#define SCU_TLADTR_WRITE(phy) \ 121230557Sjimharris scu_transport_layer_write(phy, address_translation, value) 122230557Sjimharris 123230557Sjimharris/** 124230557Sjimharris * This macro writes the STP Transport Layer Direct Attached RNi register. 125230557Sjimharris */ 126230557Sjimharris#define SCU_STPTLDARNI_WRITE(phy, index) \ 127230557Sjimharris scu_transport_layer_write(phy, stp_rni, index) 128230557Sjimharris 129230557Sjimharris/** 130230557Sjimharris * This macro reads the STP Transport Layer Direct Attached RNi register. 131230557Sjimharris */ 132230557Sjimharris#define SCU_STPTLDARNI_READ(phy) \ 133230557Sjimharris scu_transport_layer_read(phy, stp_rni) 134230557Sjimharris 135230557Sjimharris//***************************************************************************** 136230557Sjimharris//* SCU LINK LAYER REGISTER OPERATIONS 137230557Sjimharris//***************************************************************************** 138230557Sjimharris 139230557Sjimharris/** 140230557Sjimharris * THis macro requests the SCU register write for the specified link layer 141230557Sjimharris * register. 142230557Sjimharris */ 143230557Sjimharris#define scu_link_layer_register_read(phy, reg) \ 144230557Sjimharris scu_register_read( \ 145230557Sjimharris scic_sds_phy_get_controller(phy), \ 146230557Sjimharris (phy)->link_layer_registers->reg \ 147230557Sjimharris ) 148230557Sjimharris 149230557Sjimharris/** 150230557Sjimharris * This macro requests the SCU register read for the specified link layer 151230557Sjimharris * register. 152230557Sjimharris */ 153230557Sjimharris#define scu_link_layer_register_write(phy, reg, value) \ 154230557Sjimharris scu_register_write( \ 155230557Sjimharris scic_sds_phy_get_controller(phy), \ 156230557Sjimharris (phy)->link_layer_registers->reg, \ 157230557Sjimharris (value) \ 158230557Sjimharris ) 159230557Sjimharris 160230557Sjimharris//***************************************************************************** 161230557Sjimharris//* SCU LINK LAYER REGISTERS 162230557Sjimharris//***************************************************************************** 163230557Sjimharris 164230557Sjimharris/// This macro reads from the SAS Identify Frame PHY Identifier register 165230557Sjimharris#define SCU_SAS_TIPID_READ(phy) \ 166230557Sjimharris scu_link_layer_register_read(phy, identify_frame_phy_id) 167230557Sjimharris 168230557Sjimharris/// This macro writes to the SAS Identify Frame PHY Identifier register 169230557Sjimharris#define SCU_SAS_TIPID_WRITE(phy, value) \ 170230557Sjimharris scu_link_layer_register_write(phy, identify_frame_phy_id, value) 171230557Sjimharris 172230557Sjimharris/// This macro reads from the SAS Identification register 173230557Sjimharris#define SCU_SAS_TIID_READ(phy) \ 174230557Sjimharris scu_link_layer_register_read(phy, transmit_identification) 175230557Sjimharris 176230557Sjimharris/// This macro writes to the SAS Identification register 177230557Sjimharris#define SCU_SAS_TIID_WRITE(phy, value) \ 178230557Sjimharris scu_link_layer_register_write(phy, transmit_identification, value) 179230557Sjimharris 180230557Sjimharris/// This macro reads the SAS Device Name High register 181230557Sjimharris#define SCU_SAS_TIDNH_READ(phy) \ 182230557Sjimharris scu_link_layer_register_read(phy, sas_device_name_high) 183230557Sjimharris 184230557Sjimharris/// This macro writes the SAS Device Name High register 185230557Sjimharris#define SCU_SAS_TIDNH_WRITE(phy, value) \ 186230557Sjimharris scu_link_layer_register_write(phy, sas_device_name_high, value) 187230557Sjimharris 188230557Sjimharris/// This macro reads the SAS Device Name Low register 189230557Sjimharris#define SCU_SAS_TIDNL_READ(phy) \ 190230557Sjimharris scu_link_layer_register_read(phy, sas_device_name_low) 191230557Sjimharris 192230557Sjimharris/// This macro writes the SAS Device Name Low register 193230557Sjimharris#define SCU_SAS_TIDNL_WRITE(phy, value) \ 194230557Sjimharris scu_link_layer_register_write(phy, sas_device_name_low, value) 195230557Sjimharris 196230557Sjimharris/// This macro reads the Source SAS Address High register 197230557Sjimharris#define SCU_SAS_TISSAH_READ(phy) \ 198230557Sjimharris scu_link_layer_register_read(phy, source_sas_address_high) 199230557Sjimharris 200230557Sjimharris/// This macro writes the Source SAS Address High register 201230557Sjimharris#define SCU_SAS_TISSAH_WRITE(phy, value) \ 202230557Sjimharris scu_link_layer_register_write(phy, source_sas_address_high, value) 203230557Sjimharris 204230557Sjimharris/// This macro reads the Source SAS Address Low register 205230557Sjimharris#define SCU_SAS_TISSAL_READ(phy) \ 206230557Sjimharris scu_link_layer_register_read(phy, source_sas_address_low) 207230557Sjimharris 208230557Sjimharris/// This macro writes the Source SAS Address Low register 209230557Sjimharris#define SCU_SAS_TISSAL_WRITE(phy, value) \ 210230557Sjimharris scu_link_layer_register_write(phy, source_sas_address_low, value) 211230557Sjimharris 212230557Sjimharris/// This macro reads the PHY Configuration register 213230557Sjimharris#define SCU_SAS_PCFG_READ(phy) \ 214230557Sjimharris scu_link_layer_register_read(phy, phy_configuration); 215230557Sjimharris 216230557Sjimharris/// This macro writes the PHY Configuration register 217230557Sjimharris#define SCU_SAS_PCFG_WRITE(phy, value) \ 218230557Sjimharris scu_link_layer_register_write(phy, phy_configuration, value) 219230557Sjimharris 220230557Sjimharris/// This macro reads the PHY Enable Spinup register 221230557Sjimharris#define SCU_SAS_ENSPINUP_READ(phy) \ 222230557Sjimharris scu_link_layer_register_read(phy, notify_enable_spinup_control) 223230557Sjimharris 224230557Sjimharris/// This macro writes the PHY Enable Spinup register 225230557Sjimharris#define SCU_SAS_ENSPINUP_WRITE(phy, value) \ 226230557Sjimharris scu_link_layer_register_write(phy, notify_enable_spinup_control, value) 227230557Sjimharris 228230557Sjimharris/// This macro reads the CLKSM register 229230557Sjimharris#define SCU_SAS_CLKSM_READ(phy) \ 230230557Sjimharris scu_link_layer_register_read(phy, clock_skew_management) 231230557Sjimharris 232230557Sjimharris/// This macro writes the CLKSM register 233230557Sjimharris#define SCU_SAS_CLKSM_WRITE(phy, value) \ 234230557Sjimharris scu_link_layer_register_write(phy, clock_skew_management, value) 235230557Sjimharris 236230557Sjimharris/// This macro reads the PHY Capacity register 237230557Sjimharris#define SCU_SAS_PHYCAP_READ(phy) \ 238230557Sjimharris scu_link_layer_register_read(phy, phy_capabilities) 239230557Sjimharris 240230557Sjimharris/// This macro writes the PHY Capacity register 241230557Sjimharris#define SCU_SAS_PHYCAP_WRITE(phy, value) \ 242230557Sjimharris scu_link_layer_register_write(phy, phy_capabilities, value) 243230557Sjimharris 244230557Sjimharris/// This macro reads the Recieved PHY Capacity register 245230557Sjimharris#define SCU_SAS_RECPHYCAP_READ(phy) \ 246230557Sjimharris scu_link_layer_register_read(phy, receive_phycap) 247230557Sjimharris 248230557Sjimharris/// This macro reads the link layer control register 249230557Sjimharris#define SCU_SAS_LLCTL_READ(phy) \ 250230557Sjimharris scu_link_layer_register_read(phy, link_layer_control); 251230557Sjimharris 252230557Sjimharris/// This macro writes the link layer control register 253230557Sjimharris#define SCU_SAS_LLCTL_WRITE(phy, value) \ 254230557Sjimharris scu_link_layer_register_write(phy, link_layer_control, value); 255230557Sjimharris 256230557Sjimharris/// This macro reads the link layer status register 257230557Sjimharris#define SCU_SAS_LLSTA_READ(phy) \ 258230557Sjimharris scu_link_layer_register_read(phy, link_layer_status); 259230557Sjimharris 260230557Sjimharris#define SCU_SAS_ECENCR_READ(phy) \ 261230557Sjimharris scu_link_layer_register_read(phy, error_counter_event_notification_control) 262230557Sjimharris 263230557Sjimharris#define SCU_SAS_ECENCR_WRITE(phy, value) \ 264230557Sjimharris scu_link_layer_register_write(phy, error_counter_event_notification_control, value) 265230557Sjimharris 266230557Sjimharris#ifdef __cplusplus 267230557Sjimharris} 268230557Sjimharris#endif // __cplusplus 269230557Sjimharris 270230557Sjimharris#endif // _SCIC_SDS_PHY_REGISTERS_H_ 271