188f3b62aSDan Williams /*
288f3b62aSDan Williams  * This file is provided under a dual BSD/GPLv2 license.  When using or
388f3b62aSDan Williams  * redistributing this file, you may do so under either license.
488f3b62aSDan Williams  *
588f3b62aSDan Williams  * GPL LICENSE SUMMARY
688f3b62aSDan Williams  *
788f3b62aSDan Williams  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
888f3b62aSDan Williams  *
988f3b62aSDan Williams  * This program is free software; you can redistribute it and/or modify
1088f3b62aSDan Williams  * it under the terms of version 2 of the GNU General Public License as
1188f3b62aSDan Williams  * published by the Free Software Foundation.
1288f3b62aSDan Williams  *
1388f3b62aSDan Williams  * This program is distributed in the hope that it will be useful, but
1488f3b62aSDan Williams  * WITHOUT ANY WARRANTY; without even the implied warranty of
1588f3b62aSDan Williams  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1688f3b62aSDan Williams  * General Public License for more details.
1788f3b62aSDan Williams  *
1888f3b62aSDan Williams  * You should have received a copy of the GNU General Public License
1988f3b62aSDan Williams  * along with this program; if not, write to the Free Software
2088f3b62aSDan Williams  * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
2188f3b62aSDan Williams  * The full GNU General Public License is included in this distribution
2288f3b62aSDan Williams  * in the file called LICENSE.GPL.
2388f3b62aSDan Williams  *
2488f3b62aSDan Williams  * BSD LICENSE
2588f3b62aSDan Williams  *
2688f3b62aSDan Williams  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
2788f3b62aSDan Williams  * All rights reserved.
2888f3b62aSDan Williams  *
2988f3b62aSDan Williams  * Redistribution and use in source and binary forms, with or without
3088f3b62aSDan Williams  * modification, are permitted provided that the following conditions
3188f3b62aSDan Williams  * are met:
3288f3b62aSDan Williams  *
3388f3b62aSDan Williams  *   * Redistributions of source code must retain the above copyright
3488f3b62aSDan Williams  *     notice, this list of conditions and the following disclaimer.
3588f3b62aSDan Williams  *   * Redistributions in binary form must reproduce the above copyright
3688f3b62aSDan Williams  *     notice, this list of conditions and the following disclaimer in
3788f3b62aSDan Williams  *     the documentation and/or other materials provided with the
3888f3b62aSDan Williams  *     distribution.
3988f3b62aSDan Williams  *   * Neither the name of Intel Corporation nor the names of its
4088f3b62aSDan Williams  *     contributors may be used to endorse or promote products derived
4188f3b62aSDan Williams  *     from this software without specific prior written permission.
4288f3b62aSDan Williams  *
4388f3b62aSDan Williams  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4488f3b62aSDan Williams  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
4588f3b62aSDan Williams  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
4688f3b62aSDan Williams  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
4788f3b62aSDan Williams  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
4888f3b62aSDan Williams  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
4988f3b62aSDan Williams  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
5088f3b62aSDan Williams  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
5188f3b62aSDan Williams  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
5288f3b62aSDan Williams  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
5388f3b62aSDan Williams  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5488f3b62aSDan Williams  */
5588f3b62aSDan Williams 
5688f3b62aSDan Williams #ifndef __SCU_REMOTE_NODE_CONTEXT_HEADER__
5788f3b62aSDan Williams #define __SCU_REMOTE_NODE_CONTEXT_HEADER__
5888f3b62aSDan Williams 
5988f3b62aSDan Williams /**
6088f3b62aSDan Williams  * This file contains the structures and constatns used by the SCU hardware to
6188f3b62aSDan Williams  *    describe a remote node context.
6288f3b62aSDan Williams  *
6388f3b62aSDan Williams  *
6488f3b62aSDan Williams  */
6588f3b62aSDan Williams 
6688f3b62aSDan Williams /**
6788f3b62aSDan Williams  * struct ssp_remote_node_context - This structure contains the SCU hardware
6888f3b62aSDan Williams  *    definition for an SSP remote node.
6988f3b62aSDan Williams  *
7088f3b62aSDan Williams  *
7188f3b62aSDan Williams  */
7288f3b62aSDan Williams struct ssp_remote_node_context {
7388f3b62aSDan Williams 	/* WORD 0 */
7488f3b62aSDan Williams 
7588f3b62aSDan Williams 	/**
7688f3b62aSDan Williams 	 * This field is the remote node index assigned for this remote node. All
7788f3b62aSDan Williams 	 * remote nodes must have a unique remote node index. The value of the remote
7888f3b62aSDan Williams 	 * node index can not exceed the maximum number of remote nodes reported in
7988f3b62aSDan Williams 	 * the SCU device context capacity register.
8088f3b62aSDan Williams 	 */
8188f3b62aSDan Williams 	u32 remote_node_index:12;
8288f3b62aSDan Williams 	u32 reserved0_1:4;
8388f3b62aSDan Williams 
8488f3b62aSDan Williams 	/**
8588f3b62aSDan Williams 	 * This field tells the SCU hardware how many simultaneous connections that
8688f3b62aSDan Williams 	 * this remote node will support.
8788f3b62aSDan Williams 	 */
8888f3b62aSDan Williams 	u32 remote_node_port_width:4;
8988f3b62aSDan Williams 
9088f3b62aSDan Williams 	/**
9188f3b62aSDan Williams 	 * This field tells the SCU hardware which logical port to associate with this
9288f3b62aSDan Williams 	 * remote node.
9388f3b62aSDan Williams 	 */
9488f3b62aSDan Williams 	u32 logical_port_index:3;
9588f3b62aSDan Williams 	u32 reserved0_2:5;
9688f3b62aSDan Williams 
9788f3b62aSDan Williams 	/**
9888f3b62aSDan Williams 	 * This field will enable the I_T nexus loss timer for this remote node.
9988f3b62aSDan Williams 	 */
10088f3b62aSDan Williams 	u32 nexus_loss_timer_enable:1;
10188f3b62aSDan Williams 
10288f3b62aSDan Williams 	/**
10388f3b62aSDan Williams 	 * This field is the for driver debug only and is not used.
10488f3b62aSDan Williams 	 */
10588f3b62aSDan Williams 	u32 check_bit:1;
10688f3b62aSDan Williams 
10788f3b62aSDan Williams 	/**
10888f3b62aSDan Williams 	 * This field must be set to true when the hardware DMAs the remote node
10988f3b62aSDan Williams 	 * context to the hardware SRAM.  When the remote node is being invalidated
11088f3b62aSDan Williams 	 * this field must be set to false.
11188f3b62aSDan Williams 	 */
11288f3b62aSDan Williams 	u32 is_valid:1;
11388f3b62aSDan Williams 
11488f3b62aSDan Williams 	/**
11588f3b62aSDan Williams 	 * This field must be set to true.
11688f3b62aSDan Williams 	 */
11788f3b62aSDan Williams 	u32 is_remote_node_context:1;
11888f3b62aSDan Williams 
11988f3b62aSDan Williams 	/* WORD 1 - 2 */
12088f3b62aSDan Williams 
12188f3b62aSDan Williams 	/**
12288f3b62aSDan Williams 	 * This is the low word of the remote device SAS Address
12388f3b62aSDan Williams 	 */
12488f3b62aSDan Williams 	u32 remote_sas_address_lo;
12588f3b62aSDan Williams 
12688f3b62aSDan Williams 	/**
12788f3b62aSDan Williams 	 * This field is the high word of the remote device SAS Address
12888f3b62aSDan Williams 	 */
12988f3b62aSDan Williams 	u32 remote_sas_address_hi;
13088f3b62aSDan Williams 
13188f3b62aSDan Williams 	/* WORD 3 */
13288f3b62aSDan Williams 	/**
13388f3b62aSDan Williams 	 * This field reprensets the function number assigned to this remote device.
13488f3b62aSDan Williams 	 * This value must match the virtual function number that is being used to
13588f3b62aSDan Williams 	 * communicate to the device.
13688f3b62aSDan Williams 	 */
13788f3b62aSDan Williams 	u32 function_number:8;
13888f3b62aSDan Williams 	u32 reserved3_1:8;
13988f3b62aSDan Williams 
14088f3b62aSDan Williams 	/**
14188f3b62aSDan Williams 	 * This field provides the driver a way to cheat on the arbitration wait time
14288f3b62aSDan Williams 	 * for this remote node.
14388f3b62aSDan Williams 	 */
14488f3b62aSDan Williams 	u32 arbitration_wait_time:16;
14588f3b62aSDan Williams 
14688f3b62aSDan Williams 	/* WORD 4 */
14788f3b62aSDan Williams 	/**
14888f3b62aSDan Williams 	 * This field tells the SCU hardware how long this device may occupy the
14988f3b62aSDan Williams 	 * connection before it must be closed.
15088f3b62aSDan Williams 	 */
15188f3b62aSDan Williams 	u32 connection_occupancy_timeout:16;
15288f3b62aSDan Williams 
15388f3b62aSDan Williams 	/**
15488f3b62aSDan Williams 	 * This field tells the SCU hardware how long to maintain a connection when
15588f3b62aSDan Williams 	 * there are no frames being transmitted on the link.
15688f3b62aSDan Williams 	 */
15788f3b62aSDan Williams 	u32 connection_inactivity_timeout:16;
15888f3b62aSDan Williams 
15988f3b62aSDan Williams 	/* WORD  5 */
16088f3b62aSDan Williams 	/**
16188f3b62aSDan Williams 	 * This field allows the driver to cheat on the arbitration wait time for this
16288f3b62aSDan Williams 	 * remote node.
16388f3b62aSDan Williams 	 */
16488f3b62aSDan Williams 	u32 initial_arbitration_wait_time:16;
16588f3b62aSDan Williams 
16688f3b62aSDan Williams 	/**
16788f3b62aSDan Williams 	 * This field is tells the hardware what to program for the connection rate in
16888f3b62aSDan Williams 	 * the open address frame.  See the SAS spec for valid values.
16988f3b62aSDan Williams 	 */
17088f3b62aSDan Williams 	u32 oaf_connection_rate:4;
17188f3b62aSDan Williams 
17288f3b62aSDan Williams 	/**
17388f3b62aSDan Williams 	 * This field tells the SCU hardware what to program for the features in the
17488f3b62aSDan Williams 	 * open address frame.  See the SAS spec for valid values.
17588f3b62aSDan Williams 	 */
17688f3b62aSDan Williams 	u32 oaf_features:4;
17788f3b62aSDan Williams 
17888f3b62aSDan Williams 	/**
17988f3b62aSDan Williams 	 * This field tells the SCU hardware what to use for the source zone group in
18088f3b62aSDan Williams 	 * the open address frame.  See the SAS spec for more details on zoning.
18188f3b62aSDan Williams 	 */
18288f3b62aSDan Williams 	u32 oaf_source_zone_group:8;
18388f3b62aSDan Williams 
18488f3b62aSDan Williams 	/* WORD 6 */
18588f3b62aSDan Williams 	/**
18688f3b62aSDan Williams 	 * This field tells the SCU hardware what to use as the more capibilities in
18788f3b62aSDan Williams 	 * the open address frame. See the SAS Spec for details.
18888f3b62aSDan Williams 	 */
18988f3b62aSDan Williams 	u32 oaf_more_compatibility_features;
19088f3b62aSDan Williams 
19188f3b62aSDan Williams 	/* WORD 7 */
19288f3b62aSDan Williams 	u32 reserved7;
19388f3b62aSDan Williams 
19488f3b62aSDan Williams };
19588f3b62aSDan Williams 
19688f3b62aSDan Williams /**
19788f3b62aSDan Williams  * struct stp_remote_node_context - This structure contains the SCU hardware
19888f3b62aSDan Williams  *    definition for a STP remote node.
19988f3b62aSDan Williams  *
20088f3b62aSDan Williams  * STP Targets are not yet supported so this definition is a placeholder until
20188f3b62aSDan Williams  * we do support them.
20288f3b62aSDan Williams  */
20388f3b62aSDan Williams struct stp_remote_node_context {
20488f3b62aSDan Williams 	/**
20588f3b62aSDan Williams 	 * Placeholder data for the STP remote node.
20688f3b62aSDan Williams 	 */
20788f3b62aSDan Williams 	u32 data[8];
20888f3b62aSDan Williams 
20988f3b62aSDan Williams };
21088f3b62aSDan Williams 
21188f3b62aSDan Williams /**
21288f3b62aSDan Williams  * This union combines the SAS and SATA remote node definitions.
21388f3b62aSDan Williams  *
21488f3b62aSDan Williams  * union scu_remote_node_context
21588f3b62aSDan Williams  */
21688f3b62aSDan Williams union scu_remote_node_context {
21788f3b62aSDan Williams 	/**
21888f3b62aSDan Williams 	 * SSP Remote Node
21988f3b62aSDan Williams 	 */
22088f3b62aSDan Williams 	struct ssp_remote_node_context ssp;
22188f3b62aSDan Williams 
22288f3b62aSDan Williams 	/**
22388f3b62aSDan Williams 	 * STP Remote Node
22488f3b62aSDan Williams 	 */
22588f3b62aSDan Williams 	struct stp_remote_node_context stp;
22688f3b62aSDan Williams 
22788f3b62aSDan Williams };
22888f3b62aSDan Williams 
22988f3b62aSDan Williams #endif /* __SCU_REMOTE_NODE_CONTEXT_HEADER__ */
230