remote_node_table.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. /*
  2. * This file is provided under a dual BSD/GPLv2 license. When using or
  3. * redistributing this file, you may do so under either license.
  4. *
  5. * GPL LICENSE SUMMARY
  6. *
  7. * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of version 2 of the GNU General Public License as
  11. * published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  21. * The full GNU General Public License is included in this distribution
  22. * in the file called LICENSE.GPL.
  23. *
  24. * BSD LICENSE
  25. *
  26. * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
  27. * All rights reserved.
  28. *
  29. * Redistribution and use in source and binary forms, with or without
  30. * modification, are permitted provided that the following conditions
  31. * are met:
  32. *
  33. * * Redistributions of source code must retain the above copyright
  34. * notice, this list of conditions and the following disclaimer.
  35. * * Redistributions in binary form must reproduce the above copyright
  36. * notice, this list of conditions and the following disclaimer in
  37. * the documentation and/or other materials provided with the
  38. * distribution.
  39. * * Neither the name of Intel Corporation nor the names of its
  40. * contributors may be used to endorse or promote products derived
  41. * from this software without specific prior written permission.
  42. *
  43. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  44. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  45. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  46. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  47. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  48. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  49. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  50. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  51. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  52. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  53. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  54. */
  55. /**
  56. * This file contains the implementation of the SCIC_SDS_REMOTE_NODE_TABLE
  57. * public, protected, and private methods.
  58. *
  59. *
  60. */
  61. #include "sci_util.h"
  62. #include "sci_environment.h"
  63. #include "remote_node_table.h"
  64. #include "remote_node_context.h"
  65. /**
  66. *
  67. * @remote_node_table: This is the remote node index table from which the
  68. * selection will be made.
  69. * @group_table_index: This is the index to the group table from which to
  70. * search for an available selection.
  71. *
  72. * This routine will find the bit position in absolute bit terms of the next 32
  73. * + bit position. If there are available bits in the first u32 then it is
  74. * just bit position. u32 This is the absolute bit position for an available
  75. * group.
  76. */
  77. static u32 scic_sds_remote_node_table_get_group_index(
  78. struct scic_remote_node_table *remote_node_table,
  79. u32 group_table_index)
  80. {
  81. u32 dword_index;
  82. u32 *group_table;
  83. u32 bit_index;
  84. group_table = remote_node_table->remote_node_groups[group_table_index];
  85. for (dword_index = 0; dword_index < remote_node_table->group_array_size; dword_index++) {
  86. if (group_table[dword_index] != 0) {
  87. for (bit_index = 0; bit_index < 32; bit_index++) {
  88. if ((group_table[dword_index] & (1 << bit_index)) != 0) {
  89. return (dword_index * 32) + bit_index;
  90. }
  91. }
  92. }
  93. }
  94. return SCIC_SDS_REMOTE_NODE_TABLE_INVALID_INDEX;
  95. }
  96. /**
  97. *
  98. * @out]: remote_node_table This the remote node table in which to clear the
  99. * selector.
  100. * @set_index: This is the remote node selector in which the change will be
  101. * made.
  102. * @group_index: This is the bit index in the table to be modified.
  103. *
  104. * This method will clear the group index entry in the specified group index
  105. * table. none
  106. */
  107. static void scic_sds_remote_node_table_clear_group_index(
  108. struct scic_remote_node_table *remote_node_table,
  109. u32 group_table_index,
  110. u32 group_index)
  111. {
  112. u32 dword_index;
  113. u32 bit_index;
  114. u32 *group_table;
  115. BUG_ON(group_table_index >= SCU_STP_REMOTE_NODE_COUNT);
  116. BUG_ON(group_index >= (u32)(remote_node_table->group_array_size * 32));
  117. dword_index = group_index / 32;
  118. bit_index = group_index % 32;
  119. group_table = remote_node_table->remote_node_groups[group_table_index];
  120. group_table[dword_index] = group_table[dword_index] & ~(1 << bit_index);
  121. }
  122. /**
  123. *
  124. * @out]: remote_node_table This the remote node table in which to set the
  125. * selector.
  126. * @group_table_index: This is the remote node selector in which the change
  127. * will be made.
  128. * @group_index: This is the bit position in the table to be modified.
  129. *
  130. * This method will set the group index bit entry in the specified gropu index
  131. * table. none
  132. */
  133. static void scic_sds_remote_node_table_set_group_index(
  134. struct scic_remote_node_table *remote_node_table,
  135. u32 group_table_index,
  136. u32 group_index)
  137. {
  138. u32 dword_index;
  139. u32 bit_index;
  140. u32 *group_table;
  141. BUG_ON(group_table_index >= SCU_STP_REMOTE_NODE_COUNT);
  142. BUG_ON(group_index >= (u32)(remote_node_table->group_array_size * 32));
  143. dword_index = group_index / 32;
  144. bit_index = group_index % 32;
  145. group_table = remote_node_table->remote_node_groups[group_table_index];
  146. group_table[dword_index] = group_table[dword_index] | (1 << bit_index);
  147. }
  148. /**
  149. *
  150. * @out]: remote_node_table This is the remote node table in which to modify
  151. * the remote node availability.
  152. * @remote_node_index: This is the remote node index that is being returned to
  153. * the table.
  154. *
  155. * This method will set the remote to available in the remote node allocation
  156. * table. none
  157. */
  158. static void scic_sds_remote_node_table_set_node_index(
  159. struct scic_remote_node_table *remote_node_table,
  160. u32 remote_node_index)
  161. {
  162. u32 dword_location;
  163. u32 dword_remainder;
  164. u32 slot_normalized;
  165. u32 slot_position;
  166. BUG_ON(
  167. (remote_node_table->available_nodes_array_size * SCIC_SDS_REMOTE_NODE_SETS_PER_DWORD)
  168. <= (remote_node_index / SCU_STP_REMOTE_NODE_COUNT)
  169. );
  170. dword_location = remote_node_index / SCIC_SDS_REMOTE_NODES_PER_DWORD;
  171. dword_remainder = remote_node_index % SCIC_SDS_REMOTE_NODES_PER_DWORD;
  172. slot_normalized = (dword_remainder / SCU_STP_REMOTE_NODE_COUNT) * sizeof(u32);
  173. slot_position = remote_node_index % SCU_STP_REMOTE_NODE_COUNT;
  174. remote_node_table->available_remote_nodes[dword_location] |=
  175. 1 << (slot_normalized + slot_position);
  176. }
  177. /**
  178. *
  179. * @out]: remote_node_table This is the remote node table from which to clear
  180. * the available remote node bit.
  181. * @remote_node_index: This is the remote node index which is to be cleared
  182. * from the table.
  183. *
  184. * This method clears the remote node index from the table of available remote
  185. * nodes. none
  186. */
  187. static void scic_sds_remote_node_table_clear_node_index(
  188. struct scic_remote_node_table *remote_node_table,
  189. u32 remote_node_index)
  190. {
  191. u32 dword_location;
  192. u32 dword_remainder;
  193. u32 slot_position;
  194. u32 slot_normalized;
  195. BUG_ON(
  196. (remote_node_table->available_nodes_array_size * SCIC_SDS_REMOTE_NODE_SETS_PER_DWORD)
  197. <= (remote_node_index / SCU_STP_REMOTE_NODE_COUNT)
  198. );
  199. dword_location = remote_node_index / SCIC_SDS_REMOTE_NODES_PER_DWORD;
  200. dword_remainder = remote_node_index % SCIC_SDS_REMOTE_NODES_PER_DWORD;
  201. slot_normalized = (dword_remainder / SCU_STP_REMOTE_NODE_COUNT) * sizeof(u32);
  202. slot_position = remote_node_index % SCU_STP_REMOTE_NODE_COUNT;
  203. remote_node_table->available_remote_nodes[dword_location] &=
  204. ~(1 << (slot_normalized + slot_position));
  205. }
  206. /**
  207. *
  208. * @out]: remote_node_table The remote node table from which the slot will be
  209. * cleared.
  210. * @group_index: The index for the slot that is to be cleared.
  211. *
  212. * This method clears the entire table slot at the specified slot index. none
  213. */
  214. static void scic_sds_remote_node_table_clear_group(
  215. struct scic_remote_node_table *remote_node_table,
  216. u32 group_index)
  217. {
  218. u32 dword_location;
  219. u32 dword_remainder;
  220. u32 dword_value;
  221. BUG_ON(
  222. (remote_node_table->available_nodes_array_size * SCIC_SDS_REMOTE_NODE_SETS_PER_DWORD)
  223. <= (group_index / SCU_STP_REMOTE_NODE_COUNT)
  224. );
  225. dword_location = group_index / SCIC_SDS_REMOTE_NODE_SETS_PER_DWORD;
  226. dword_remainder = group_index % SCIC_SDS_REMOTE_NODE_SETS_PER_DWORD;
  227. dword_value = remote_node_table->available_remote_nodes[dword_location];
  228. dword_value &= ~(SCIC_SDS_REMOTE_NODE_TABLE_FULL_SLOT_VALUE << (dword_remainder * 4));
  229. remote_node_table->available_remote_nodes[dword_location] = dword_value;
  230. }
  231. /**
  232. *
  233. * @remote_node_table:
  234. *
  235. * THis method sets an entire remote node group in the remote node table.
  236. */
  237. static void scic_sds_remote_node_table_set_group(
  238. struct scic_remote_node_table *remote_node_table,
  239. u32 group_index)
  240. {
  241. u32 dword_location;
  242. u32 dword_remainder;
  243. u32 dword_value;
  244. BUG_ON(
  245. (remote_node_table->available_nodes_array_size * SCIC_SDS_REMOTE_NODE_SETS_PER_DWORD)
  246. <= (group_index / SCU_STP_REMOTE_NODE_COUNT)
  247. );
  248. dword_location = group_index / SCIC_SDS_REMOTE_NODE_SETS_PER_DWORD;
  249. dword_remainder = group_index % SCIC_SDS_REMOTE_NODE_SETS_PER_DWORD;
  250. dword_value = remote_node_table->available_remote_nodes[dword_location];
  251. dword_value |= (SCIC_SDS_REMOTE_NODE_TABLE_FULL_SLOT_VALUE << (dword_remainder * 4));
  252. remote_node_table->available_remote_nodes[dword_location] = dword_value;
  253. }
  254. /**
  255. *
  256. * @remote_node_table: This is the remote node table that for which the group
  257. * value is to be returned.
  258. * @group_index: This is the group index to use to find the group value.
  259. *
  260. * This method will return the group value for the specified group index. The
  261. * bit values at the specified remote node group index.
  262. */
  263. static u8 scic_sds_remote_node_table_get_group_value(
  264. struct scic_remote_node_table *remote_node_table,
  265. u32 group_index)
  266. {
  267. u32 dword_location;
  268. u32 dword_remainder;
  269. u32 dword_value;
  270. dword_location = group_index / SCIC_SDS_REMOTE_NODE_SETS_PER_DWORD;
  271. dword_remainder = group_index % SCIC_SDS_REMOTE_NODE_SETS_PER_DWORD;
  272. dword_value = remote_node_table->available_remote_nodes[dword_location];
  273. dword_value &= (SCIC_SDS_REMOTE_NODE_TABLE_FULL_SLOT_VALUE << (dword_remainder * 4));
  274. dword_value = dword_value >> (dword_remainder * 4);
  275. return (u8)dword_value;
  276. }
  277. /**
  278. *
  279. * @out]: remote_node_table The remote that which is to be initialized.
  280. * @remote_node_entries: The number of entries to put in the table.
  281. *
  282. * This method will initialize the remote node table for use. none
  283. */
  284. void scic_sds_remote_node_table_initialize(
  285. struct scic_remote_node_table *remote_node_table,
  286. u32 remote_node_entries)
  287. {
  288. u32 index;
  289. /*
  290. * Initialize the raw data we could improve the speed by only initializing
  291. * those entries that we are actually going to be used */
  292. memset(
  293. remote_node_table->available_remote_nodes,
  294. 0x00,
  295. sizeof(remote_node_table->available_remote_nodes)
  296. );
  297. memset(
  298. remote_node_table->remote_node_groups,
  299. 0x00,
  300. sizeof(remote_node_table->remote_node_groups)
  301. );
  302. /* Initialize the available remote node sets */
  303. remote_node_table->available_nodes_array_size = (u16)
  304. (remote_node_entries / SCIC_SDS_REMOTE_NODES_PER_DWORD)
  305. + ((remote_node_entries % SCIC_SDS_REMOTE_NODES_PER_DWORD) != 0);
  306. /* Initialize each full DWORD to a FULL SET of remote nodes */
  307. for (index = 0; index < remote_node_entries; index++) {
  308. scic_sds_remote_node_table_set_node_index(remote_node_table, index);
  309. }
  310. remote_node_table->group_array_size = (u16)
  311. (remote_node_entries / (SCU_STP_REMOTE_NODE_COUNT * 32))
  312. + ((remote_node_entries % (SCU_STP_REMOTE_NODE_COUNT * 32)) != 0);
  313. for (index = 0; index < (remote_node_entries / SCU_STP_REMOTE_NODE_COUNT); index++) {
  314. /*
  315. * These are all guaranteed to be full slot values so fill them in the
  316. * available sets of 3 remote nodes */
  317. scic_sds_remote_node_table_set_group_index(remote_node_table, 2, index);
  318. }
  319. /* Now fill in any remainders that we may find */
  320. if ((remote_node_entries % SCU_STP_REMOTE_NODE_COUNT) == 2) {
  321. scic_sds_remote_node_table_set_group_index(remote_node_table, 1, index);
  322. } else if ((remote_node_entries % SCU_STP_REMOTE_NODE_COUNT) == 1) {
  323. scic_sds_remote_node_table_set_group_index(remote_node_table, 0, index);
  324. }
  325. }
  326. /**
  327. *
  328. * @out]: remote_node_table The remote node table from which to allocate a
  329. * remote node.
  330. * @table_index: The group index that is to be used for the search.
  331. *
  332. * This method will allocate a single RNi from the remote node table. The
  333. * table index will determine from which remote node group table to search.
  334. * This search may fail and another group node table can be specified. The
  335. * function is designed to allow a serach of the available single remote node
  336. * group up to the triple remote node group. If an entry is found in the
  337. * specified table the remote node is removed and the remote node groups are
  338. * updated. The RNi value or an invalid remote node context if an RNi can not
  339. * be found.
  340. */
  341. static u16 scic_sds_remote_node_table_allocate_single_remote_node(
  342. struct scic_remote_node_table *remote_node_table,
  343. u32 group_table_index)
  344. {
  345. u8 index;
  346. u8 group_value;
  347. u32 group_index;
  348. u16 remote_node_index = SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX;
  349. group_index = scic_sds_remote_node_table_get_group_index(
  350. remote_node_table, group_table_index);
  351. /* We could not find an available slot in the table selector 0 */
  352. if (group_index != SCIC_SDS_REMOTE_NODE_TABLE_INVALID_INDEX) {
  353. group_value = scic_sds_remote_node_table_get_group_value(
  354. remote_node_table, group_index);
  355. for (index = 0; index < SCU_STP_REMOTE_NODE_COUNT; index++) {
  356. if (((1 << index) & group_value) != 0) {
  357. /* We have selected a bit now clear it */
  358. remote_node_index = (u16)(group_index * SCU_STP_REMOTE_NODE_COUNT
  359. + index);
  360. scic_sds_remote_node_table_clear_group_index(
  361. remote_node_table, group_table_index, group_index
  362. );
  363. scic_sds_remote_node_table_clear_node_index(
  364. remote_node_table, remote_node_index
  365. );
  366. if (group_table_index > 0) {
  367. scic_sds_remote_node_table_set_group_index(
  368. remote_node_table, group_table_index - 1, group_index
  369. );
  370. }
  371. break;
  372. }
  373. }
  374. }
  375. return remote_node_index;
  376. }
  377. /**
  378. *
  379. * @remote_node_table: This is the remote node table from which to allocate the
  380. * remote node entries.
  381. * @group_table_index: THis is the group table index which must equal two (2)
  382. * for this operation.
  383. *
  384. * This method will allocate three consecutive remote node context entries. If
  385. * there are no remaining triple entries the function will return a failure.
  386. * The remote node index that represents three consecutive remote node entries
  387. * or an invalid remote node context if none can be found.
  388. */
  389. static u16 scic_sds_remote_node_table_allocate_triple_remote_node(
  390. struct scic_remote_node_table *remote_node_table,
  391. u32 group_table_index)
  392. {
  393. u32 group_index;
  394. u16 remote_node_index = SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX;
  395. group_index = scic_sds_remote_node_table_get_group_index(
  396. remote_node_table, group_table_index);
  397. if (group_index != SCIC_SDS_REMOTE_NODE_TABLE_INVALID_INDEX) {
  398. remote_node_index = (u16)group_index * SCU_STP_REMOTE_NODE_COUNT;
  399. scic_sds_remote_node_table_clear_group_index(
  400. remote_node_table, group_table_index, group_index
  401. );
  402. scic_sds_remote_node_table_clear_group(
  403. remote_node_table, group_index
  404. );
  405. }
  406. return remote_node_index;
  407. }
  408. /**
  409. *
  410. * @remote_node_table: This is the remote node table from which the remote node
  411. * allocation is to take place.
  412. * @remote_node_count: This is ther remote node count which is one of
  413. * SCU_SSP_REMOTE_NODE_COUNT(1) or SCU_STP_REMOTE_NODE_COUNT(3).
  414. *
  415. * This method will allocate a remote node that mataches the remote node count
  416. * specified by the caller. Valid values for remote node count is
  417. * SCU_SSP_REMOTE_NODE_COUNT(1) or SCU_STP_REMOTE_NODE_COUNT(3). u16 This is
  418. * the remote node index that is returned or an invalid remote node context.
  419. */
  420. u16 scic_sds_remote_node_table_allocate_remote_node(
  421. struct scic_remote_node_table *remote_node_table,
  422. u32 remote_node_count)
  423. {
  424. u16 remote_node_index = SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX;
  425. if (remote_node_count == SCU_SSP_REMOTE_NODE_COUNT) {
  426. remote_node_index =
  427. scic_sds_remote_node_table_allocate_single_remote_node(
  428. remote_node_table, 0);
  429. if (remote_node_index == SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) {
  430. remote_node_index =
  431. scic_sds_remote_node_table_allocate_single_remote_node(
  432. remote_node_table, 1);
  433. }
  434. if (remote_node_index == SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) {
  435. remote_node_index =
  436. scic_sds_remote_node_table_allocate_single_remote_node(
  437. remote_node_table, 2);
  438. }
  439. } else if (remote_node_count == SCU_STP_REMOTE_NODE_COUNT) {
  440. remote_node_index =
  441. scic_sds_remote_node_table_allocate_triple_remote_node(
  442. remote_node_table, 2);
  443. }
  444. return remote_node_index;
  445. }
  446. /**
  447. *
  448. * @remote_node_table:
  449. *
  450. * This method will free a single remote node index back to the remote node
  451. * table. This routine will update the remote node groups
  452. */
  453. static void scic_sds_remote_node_table_release_single_remote_node(
  454. struct scic_remote_node_table *remote_node_table,
  455. u16 remote_node_index)
  456. {
  457. u32 group_index;
  458. u8 group_value;
  459. group_index = remote_node_index / SCU_STP_REMOTE_NODE_COUNT;
  460. group_value = scic_sds_remote_node_table_get_group_value(remote_node_table, group_index);
  461. /*
  462. * Assert that we are not trying to add an entry to a slot that is already
  463. * full. */
  464. BUG_ON(group_value == SCIC_SDS_REMOTE_NODE_TABLE_FULL_SLOT_VALUE);
  465. if (group_value == 0x00) {
  466. /*
  467. * There are no entries in this slot so it must be added to the single
  468. * slot table. */
  469. scic_sds_remote_node_table_set_group_index(remote_node_table, 0, group_index);
  470. } else if ((group_value & (group_value - 1)) == 0) {
  471. /*
  472. * There is only one entry in this slot so it must be moved from the
  473. * single slot table to the dual slot table */
  474. scic_sds_remote_node_table_clear_group_index(remote_node_table, 0, group_index);
  475. scic_sds_remote_node_table_set_group_index(remote_node_table, 1, group_index);
  476. } else {
  477. /*
  478. * There are two entries in the slot so it must be moved from the dual
  479. * slot table to the tripple slot table. */
  480. scic_sds_remote_node_table_clear_group_index(remote_node_table, 1, group_index);
  481. scic_sds_remote_node_table_set_group_index(remote_node_table, 2, group_index);
  482. }
  483. scic_sds_remote_node_table_set_node_index(remote_node_table, remote_node_index);
  484. }
  485. /**
  486. *
  487. * @remote_node_table: This is the remote node table to which the remote node
  488. * index is to be freed.
  489. *
  490. * This method will release a group of three consecutive remote nodes back to
  491. * the free remote nodes.
  492. */
  493. static void scic_sds_remote_node_table_release_triple_remote_node(
  494. struct scic_remote_node_table *remote_node_table,
  495. u16 remote_node_index)
  496. {
  497. u32 group_index;
  498. group_index = remote_node_index / SCU_STP_REMOTE_NODE_COUNT;
  499. scic_sds_remote_node_table_set_group_index(
  500. remote_node_table, 2, group_index
  501. );
  502. scic_sds_remote_node_table_set_group(remote_node_table, group_index);
  503. }
  504. /**
  505. *
  506. * @remote_node_table: The remote node table to which the remote node index is
  507. * to be freed.
  508. * @remote_node_count: This is the count of consecutive remote nodes that are
  509. * to be freed.
  510. *
  511. * This method will release the remote node index back into the remote node
  512. * table free pool.
  513. */
  514. void scic_sds_remote_node_table_release_remote_node_index(
  515. struct scic_remote_node_table *remote_node_table,
  516. u32 remote_node_count,
  517. u16 remote_node_index)
  518. {
  519. if (remote_node_count == SCU_SSP_REMOTE_NODE_COUNT) {
  520. scic_sds_remote_node_table_release_single_remote_node(
  521. remote_node_table, remote_node_index);
  522. } else if (remote_node_count == SCU_STP_REMOTE_NODE_COUNT) {
  523. scic_sds_remote_node_table_release_triple_remote_node(
  524. remote_node_table, remote_node_index);
  525. }
  526. }