![]() |
|
|||
0001 /* 0002 * This file is provided under a dual BSD/GPLv2 license. When using or 0003 * redistributing this file, you may do so under either license. 0004 * 0005 * GPL LICENSE SUMMARY 0006 * 0007 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 0008 * 0009 * This program is free software; you can redistribute it and/or modify 0010 * it under the terms of version 2 of the GNU General Public License as 0011 * published by the Free Software Foundation. 0012 * 0013 * This program is distributed in the hope that it will be useful, but 0014 * WITHOUT ANY WARRANTY; without even the implied warranty of 0015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0016 * General Public License for more details. 0017 * 0018 * You should have received a copy of the GNU General Public License 0019 * along with this program; if not, write to the Free Software 0020 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 0021 * The full GNU General Public License is included in this distribution 0022 * in the file called LICENSE.GPL. 0023 * 0024 * BSD LICENSE 0025 * 0026 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 0027 * All rights reserved. 0028 * 0029 * Redistribution and use in source and binary forms, with or without 0030 * modification, are permitted provided that the following conditions 0031 * are met: 0032 * 0033 * * Redistributions of source code must retain the above copyright 0034 * notice, this list of conditions and the following disclaimer. 0035 * * Redistributions in binary form must reproduce the above copyright 0036 * notice, this list of conditions and the following disclaimer in 0037 * the documentation and/or other materials provided with the 0038 * distribution. 0039 * * Neither the name of Intel Corporation nor the names of its 0040 * contributors may be used to endorse or promote products derived 0041 * from this software without specific prior written permission. 0042 * 0043 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 0044 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 0045 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 0046 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 0047 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 0048 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 0049 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 0050 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 0051 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0052 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 0053 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0054 */ 0055 0056 #ifndef _SCIC_SDS_REMOTE_NODE_TABLE_H_ 0057 #define _SCIC_SDS_REMOTE_NODE_TABLE_H_ 0058 0059 #include "isci.h" 0060 0061 /** 0062 * 0063 * 0064 * Remote node sets are sets of remote node index in the remote node table. The 0065 * SCU hardware requires that STP remote node entries take three consecutive 0066 * remote node index so the table is arranged in sets of three. The bits are 0067 * used as 0111 0111 to make a byte and the bits define the set of three remote 0068 * nodes to use as a sequence. 0069 */ 0070 #define SCIC_SDS_REMOTE_NODE_SETS_PER_BYTE 2 0071 0072 /** 0073 * 0074 * 0075 * Since the remote node table is organized as DWORDS take the remote node sets 0076 * in bytes and represent them in DWORDs. The lowest ordered bits are the ones 0077 * used in case full DWORD is not being used. i.e. 0000 0000 0000 0000 0111 0078 * 0111 0111 0111 // if only a single WORD is in use in the DWORD. 0079 */ 0080 #define SCIC_SDS_REMOTE_NODE_SETS_PER_DWORD \ 0081 (sizeof(u32) * SCIC_SDS_REMOTE_NODE_SETS_PER_BYTE) 0082 /** 0083 * 0084 * 0085 * This is a count of the numeber of remote nodes that can be represented in a 0086 * byte 0087 */ 0088 #define SCIC_SDS_REMOTE_NODES_PER_BYTE \ 0089 (SCU_STP_REMOTE_NODE_COUNT * SCIC_SDS_REMOTE_NODE_SETS_PER_BYTE) 0090 0091 /** 0092 * 0093 * 0094 * This is a count of the number of remote nodes that can be represented in a 0095 * DWROD 0096 */ 0097 #define SCIC_SDS_REMOTE_NODES_PER_DWORD \ 0098 (sizeof(u32) * SCIC_SDS_REMOTE_NODES_PER_BYTE) 0099 0100 /** 0101 * 0102 * 0103 * This is the number of bits in a remote node group 0104 */ 0105 #define SCIC_SDS_REMOTE_NODES_BITS_PER_GROUP 4 0106 0107 #define SCIC_SDS_REMOTE_NODE_TABLE_INVALID_INDEX (0xFFFFFFFF) 0108 #define SCIC_SDS_REMOTE_NODE_TABLE_FULL_SLOT_VALUE (0x07) 0109 #define SCIC_SDS_REMOTE_NODE_TABLE_EMPTY_SLOT_VALUE (0x00) 0110 0111 /** 0112 * 0113 * 0114 * Expander attached sata remote node count 0115 */ 0116 #define SCU_STP_REMOTE_NODE_COUNT 3 0117 0118 /** 0119 * 0120 * 0121 * Expander or direct attached ssp remote node count 0122 */ 0123 #define SCU_SSP_REMOTE_NODE_COUNT 1 0124 0125 /** 0126 * 0127 * 0128 * Direct attached STP remote node count 0129 */ 0130 #define SCU_SATA_REMOTE_NODE_COUNT 1 0131 0132 /** 0133 * struct sci_remote_node_table - 0134 * 0135 * 0136 */ 0137 struct sci_remote_node_table { 0138 /** 0139 * This field contains the array size in dwords 0140 */ 0141 u16 available_nodes_array_size; 0142 0143 /** 0144 * This field contains the array size of the 0145 */ 0146 u16 group_array_size; 0147 0148 /** 0149 * This field is the array of available remote node entries in bits. 0150 * Because of the way STP remote node data is allocated on the SCU hardware 0151 * the remote nodes must occupy three consecutive remote node context 0152 * entries. For ease of allocation and de-allocation we have broken the 0153 * sets of three into a single nibble. When the STP RNi is allocated all 0154 * of the bits in the nibble are cleared. This math results in a table size 0155 * of MAX_REMOTE_NODES / CONSECUTIVE RNi ENTRIES for STP / 2 entries per byte. 0156 */ 0157 u32 available_remote_nodes[ 0158 (SCI_MAX_REMOTE_DEVICES / SCIC_SDS_REMOTE_NODES_PER_DWORD) 0159 + ((SCI_MAX_REMOTE_DEVICES % SCIC_SDS_REMOTE_NODES_PER_DWORD) != 0)]; 0160 0161 /** 0162 * This field is the nibble selector for the above table. There are three 0163 * possible selectors each for fast lookup when trying to find one, two or 0164 * three remote node entries. 0165 */ 0166 u32 remote_node_groups[ 0167 SCU_STP_REMOTE_NODE_COUNT][ 0168 (SCI_MAX_REMOTE_DEVICES / (32 * SCU_STP_REMOTE_NODE_COUNT)) 0169 + ((SCI_MAX_REMOTE_DEVICES % (32 * SCU_STP_REMOTE_NODE_COUNT)) != 0)]; 0170 0171 }; 0172 0173 /* --------------------------------------------------------------------------- */ 0174 0175 void sci_remote_node_table_initialize( 0176 struct sci_remote_node_table *remote_node_table, 0177 u32 remote_node_entries); 0178 0179 u16 sci_remote_node_table_allocate_remote_node( 0180 struct sci_remote_node_table *remote_node_table, 0181 u32 remote_node_count); 0182 0183 void sci_remote_node_table_release_remote_node_index( 0184 struct sci_remote_node_table *remote_node_table, 0185 u32 remote_node_count, 0186 u16 remote_node_index); 0187 0188 #endif /* _SCIC_SDS_REMOTE_NODE_TABLE_H_ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |