scic_sds_phy_registers.h revision 230557
1249259Sdim/*- 2249259Sdim * This file is provided under a dual BSD/GPLv2 license. When using or 3249259Sdim * redistributing this file, you may do so under either license. 4249259Sdim * 5249259Sdim * GPL LICENSE SUMMARY 6249259Sdim * 7249259Sdim * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 8249259Sdim * 9249259Sdim * This program is free software; you can redistribute it and/or modify 10249259Sdim * it under the terms of version 2 of the GNU General Public License as 11249259Sdim * published by the Free Software Foundation. 12249259Sdim * 13249259Sdim * This program is distributed in the hope that it will be useful, but 14249259Sdim * WITHOUT ANY WARRANTY; without even the implied warranty of 15249259Sdim * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16249259Sdim * General Public License for more details. 17249259Sdim * 18249259Sdim * You should have received a copy of the GNU General Public License 19249259Sdim * along with this program; if not, write to the Free Software 20249259Sdim * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 21249259Sdim * The full GNU General Public License is included in this distribution 22249259Sdim * in the file called LICENSE.GPL. 23249259Sdim * 24249259Sdim * BSD LICENSE 25263508Sdim * 26249259Sdim * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 27263508Sdim * All rights reserved. 28263508Sdim * 29249259Sdim * Redistribution and use in source and binary forms, with or without 30249259Sdim * modification, are permitted provided that the following conditions 31249259Sdim * are met: 32263508Sdim * 33249259Sdim * * Redistributions of source code must retain the above copyright 34249259Sdim * notice, this list of conditions and the following disclaimer. 35263508Sdim * * Redistributions in binary form must reproduce the above copyright 36249259Sdim * notice, this list of conditions and the following disclaimer in 37249259Sdim * the documentation and/or other materials provided with the 38249259Sdim * distribution. 39249259Sdim * 40263508Sdim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 41263508Sdim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 42249259Sdim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 43263508Sdim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 44263508Sdim * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45263508Sdim * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 46249259Sdim * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 47249259Sdim * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48249259Sdim * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 49251662Sdim * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 50249259Sdim * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 51249259Sdim * 52249259Sdim * $FreeBSD$ 53249259Sdim */ 54249259Sdim#ifndef _SCIC_SDS_PHY_REGISTERS_H_ 55249259Sdim#define _SCIC_SDS_PHY_REGISTERS_H_ 56249259Sdim 57249259Sdim/** 58249259Sdim * @file 59263508Sdim * 60263508Sdim * @brief This file contains the macros used by the phy object to read/write 61263508Sdim * to the SCU link layer registers. 62263508Sdim */ 63263508Sdim 64263508Sdim#ifdef __cplusplus 65263508Sdimextern "C" { 66263508Sdim#endif // __cplusplus 67263508Sdim 68263508Sdim#include <dev/isci/scil/scic_sds_controller.h> 69263508Sdim 70263508Sdim//***************************************************************************** 71263508Sdim//* SCU LINK LAYER REGISTER OPERATIONS 72263508Sdim//***************************************************************************** 73263508Sdim 74249259Sdim/** 75249259Sdim * Macro to read the transport layer register associated with this phy 76249259Sdim * object. 77249259Sdim */ 78249259Sdim#define scu_transport_layer_read(phy, reg) \ 79249259Sdim scu_register_read( \ 80249259Sdim scic_sds_phy_get_controller(phy), \ 81263508Sdim (phy)->transport_layer_registers->reg \ 82263508Sdim ) 83249259Sdim 84263508Sdim/** 85263508Sdim * Macro to write the transport layer register associated with this phy 86263508Sdim * object. 87263508Sdim */ 88263508Sdim#define scu_transport_layer_write(phy, reg, value) \ 89263508Sdim scu_register_write( \ 90263508Sdim scic_sds_phy_get_controller(phy), \ 91263508Sdim (phy)->transport_layer_registers->reg, \ 92263508Sdim (value) \ 93263508Sdim ) 94263508Sdim 95263508Sdim//**************************************************************************** 96263508Sdim//* Transport Layer registers controlled by the phy object 97263508Sdim//**************************************************************************** 98263508Sdim 99263508Sdim/** 100263508Sdim * This macro reads the Transport layer control register 101263508Sdim */ 102263508Sdim#define SCU_TLCR_READ(phy) \ 103263508Sdim scu_transport_layer_read(phy, control) 104263508Sdim 105263508Sdim/** 106263508Sdim * This macro writes the Transport layer control register 107263508Sdim */ 108249259Sdim#define SCU_TLCR_WRITE(phy, value) \ 109249259Sdim scu_transport_layer_write(phy, control, value) 110249259Sdim 111249259Sdim/** 112251662Sdim * This macro reads the Transport layer address translation register 113263508Sdim */ 114263508Sdim#define SCU_TLADTR_READ(phy) \ 115251662Sdim scu_transport_layer_read(phy, address_translation) 116263508Sdim 117263508Sdim/** 118263508Sdim * This macro writes the Transport layer address translation register 119263508Sdim */ 120263508Sdim#define SCU_TLADTR_WRITE(phy) \ 121263508Sdim scu_transport_layer_write(phy, address_translation, value) 122263508Sdim 123263508Sdim/** 124263508Sdim * This macro writes the STP Transport Layer Direct Attached RNi register. 125263508Sdim */ 126263508Sdim#define SCU_STPTLDARNI_WRITE(phy, index) \ 127263508Sdim scu_transport_layer_write(phy, stp_rni, index) 128263508Sdim 129263508Sdim/** 130263508Sdim * This macro reads the STP Transport Layer Direct Attached RNi register. 131263508Sdim */ 132263508Sdim#define SCU_STPTLDARNI_READ(phy) \ 133263508Sdim scu_transport_layer_read(phy, stp_rni) 134263508Sdim 135263508Sdim//***************************************************************************** 136263508Sdim//* SCU LINK LAYER REGISTER OPERATIONS 137263508Sdim//***************************************************************************** 138263508Sdim 139263508Sdim/** 140263508Sdim * THis macro requests the SCU register write for the specified link layer 141263508Sdim * register. 142249259Sdim */ 143249259Sdim#define scu_link_layer_register_read(phy, reg) \ 144249259Sdim scu_register_read( \ 145249259Sdim scic_sds_phy_get_controller(phy), \ 146249259Sdim (phy)->link_layer_registers->reg \ 147249259Sdim ) 148249259Sdim 149263508Sdim/** 150263508Sdim * This macro requests the SCU register read for the specified link layer 151263508Sdim * register. 152263508Sdim */ 153263508Sdim#define scu_link_layer_register_write(phy, reg, value) \ 154263508Sdim scu_register_write( \ 155263508Sdim scic_sds_phy_get_controller(phy), \ 156263508Sdim (phy)->link_layer_registers->reg, \ 157263508Sdim (value) \ 158263508Sdim ) 159263508Sdim 160263508Sdim//***************************************************************************** 161263508Sdim//* SCU LINK LAYER REGISTERS 162263508Sdim//***************************************************************************** 163263508Sdim 164263508Sdim/// This macro reads from the SAS Identify Frame PHY Identifier register 165263508Sdim#define SCU_SAS_TIPID_READ(phy) \ 166263508Sdim scu_link_layer_register_read(phy, identify_frame_phy_id) 167263508Sdim 168263508Sdim/// This macro writes to the SAS Identify Frame PHY Identifier register 169263508Sdim#define SCU_SAS_TIPID_WRITE(phy, value) \ 170263508Sdim scu_link_layer_register_write(phy, identify_frame_phy_id, value) 171263508Sdim 172263508Sdim/// This macro reads from the SAS Identification register 173263508Sdim#define SCU_SAS_TIID_READ(phy) \ 174263508Sdim scu_link_layer_register_read(phy, transmit_identification) 175263508Sdim 176263508Sdim/// This macro writes to the SAS Identification register 177263508Sdim#define SCU_SAS_TIID_WRITE(phy, value) \ 178263508Sdim scu_link_layer_register_write(phy, transmit_identification, value) 179263508Sdim 180263508Sdim/// This macro reads the SAS Device Name High register 181263508Sdim#define SCU_SAS_TIDNH_READ(phy) \ 182249259Sdim scu_link_layer_register_read(phy, sas_device_name_high) 183249259Sdim 184249259Sdim/// This macro writes the SAS Device Name High register 185249259Sdim#define SCU_SAS_TIDNH_WRITE(phy, value) \ 186249259Sdim scu_link_layer_register_write(phy, sas_device_name_high, value) 187263508Sdim 188249259Sdim/// This macro reads the SAS Device Name Low register 189249259Sdim#define SCU_SAS_TIDNL_READ(phy) \ 190249259Sdim scu_link_layer_register_read(phy, sas_device_name_low) 191249259Sdim 192249259Sdim/// This macro writes the SAS Device Name Low register 193249259Sdim#define SCU_SAS_TIDNL_WRITE(phy, value) \ 194249259Sdim scu_link_layer_register_write(phy, sas_device_name_low, value) 195249259Sdim 196249259Sdim/// This macro reads the Source SAS Address High register 197249259Sdim#define SCU_SAS_TISSAH_READ(phy) \ 198249259Sdim scu_link_layer_register_read(phy, source_sas_address_high) 199249259Sdim 200249259Sdim/// This macro writes the Source SAS Address High register 201249259Sdim#define SCU_SAS_TISSAH_WRITE(phy, value) \ 202249259Sdim scu_link_layer_register_write(phy, source_sas_address_high, value) 203249259Sdim 204263508Sdim/// This macro reads the Source SAS Address Low register 205263508Sdim#define SCU_SAS_TISSAL_READ(phy) \ 206263508Sdim scu_link_layer_register_read(phy, source_sas_address_low) 207263508Sdim 208249259Sdim/// This macro writes the Source SAS Address Low register 209249259Sdim#define SCU_SAS_TISSAL_WRITE(phy, value) \ 210249259Sdim scu_link_layer_register_write(phy, source_sas_address_low, value) 211249259Sdim 212249259Sdim/// This macro reads the PHY Configuration register 213249259Sdim#define SCU_SAS_PCFG_READ(phy) \ 214249259Sdim scu_link_layer_register_read(phy, phy_configuration); 215249259Sdim 216249259Sdim/// This macro writes the PHY Configuration register 217249259Sdim#define SCU_SAS_PCFG_WRITE(phy, value) \ 218249259Sdim scu_link_layer_register_write(phy, phy_configuration, value) 219249259Sdim 220249259Sdim/// This macro reads the PHY Enable Spinup register 221263508Sdim#define SCU_SAS_ENSPINUP_READ(phy) \ 222249259Sdim scu_link_layer_register_read(phy, notify_enable_spinup_control) 223249259Sdim 224249259Sdim/// This macro writes the PHY Enable Spinup register 225249259Sdim#define SCU_SAS_ENSPINUP_WRITE(phy, value) \ 226249259Sdim scu_link_layer_register_write(phy, notify_enable_spinup_control, value) 227249259Sdim 228249259Sdim/// This macro reads the CLKSM register 229249259Sdim#define SCU_SAS_CLKSM_READ(phy) \ 230249259Sdim scu_link_layer_register_read(phy, clock_skew_management) 231249259Sdim 232249259Sdim/// This macro writes the CLKSM register 233249259Sdim#define SCU_SAS_CLKSM_WRITE(phy, value) \ 234249259Sdim scu_link_layer_register_write(phy, clock_skew_management, value) 235249259Sdim 236249259Sdim/// This macro reads the PHY Capacity register 237263508Sdim#define SCU_SAS_PHYCAP_READ(phy) \ 238249259Sdim scu_link_layer_register_read(phy, phy_capabilities) 239249259Sdim 240249259Sdim/// This macro writes the PHY Capacity register 241249259Sdim#define SCU_SAS_PHYCAP_WRITE(phy, value) \ 242249259Sdim scu_link_layer_register_write(phy, phy_capabilities, value) 243249259Sdim 244249259Sdim/// This macro reads the Recieved PHY Capacity register 245249259Sdim#define SCU_SAS_RECPHYCAP_READ(phy) \ 246249259Sdim scu_link_layer_register_read(phy, receive_phycap) 247249259Sdim 248249259Sdim/// This macro reads the link layer control register 249249259Sdim#define SCU_SAS_LLCTL_READ(phy) \ 250249259Sdim scu_link_layer_register_read(phy, link_layer_control); 251249259Sdim 252249259Sdim/// This macro writes the link layer control register 253263508Sdim#define SCU_SAS_LLCTL_WRITE(phy, value) \ 254263508Sdim scu_link_layer_register_write(phy, link_layer_control, value); 255263508Sdim 256263508Sdim/// This macro reads the link layer status register 257263508Sdim#define SCU_SAS_LLSTA_READ(phy) \ 258263508Sdim scu_link_layer_register_read(phy, link_layer_status); 259263508Sdim 260263508Sdim#define SCU_SAS_ECENCR_READ(phy) \ 261263508Sdim scu_link_layer_register_read(phy, error_counter_event_notification_control) 262263508Sdim 263263508Sdim#define SCU_SAS_ECENCR_WRITE(phy, value) \ 264263508Sdim scu_link_layer_register_write(phy, error_counter_event_notification_control, value) 265249259Sdim 266249259Sdim#ifdef __cplusplus 267249259Sdim} 268249259Sdim#endif // __cplusplus 269263508Sdim 270249259Sdim#endif // _SCIC_SDS_PHY_REGISTERS_H_ 271263508Sdim