drivers/scsi/isci/remote_node_table.c

Source file repositories/reference/linux-study-clean/drivers/scsi/isci/remote_node_table.c

File Facts

System
Linux kernel
Corpus path
drivers/scsi/isci/remote_node_table.c
Extension
.c
Size
21018 bytes
Lines
599
Domain
Driver Families
Bucket
drivers/scsi
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (group_table[dword_index] != 0) {
			for (bit_index = 0; bit_index < 32; bit_index++) {
				if ((group_table[dword_index] & (1 << bit_index)) != 0) {
					return (dword_index * 32) + bit_index;
				}
			}
		}
	}

	return SCIC_SDS_REMOTE_NODE_TABLE_INVALID_INDEX;
}

/**
 * sci_remote_node_table_clear_group_index()
 * @remote_node_table: This the remote node table in which to clear the
 *    selector.
 * @group_table_index: This is the remote node selector in which the change will be
 *    made.
 * @group_index: This is the bit index in the table to be modified.
 *
 * This method will clear the group index entry in the specified group index
 * table. none
 */
static void sci_remote_node_table_clear_group_index(
	struct sci_remote_node_table *remote_node_table,
	u32 group_table_index,
	u32 group_index)
{
	u32 dword_index;
	u32 bit_index;
	u32 *group_table;

	BUG_ON(group_table_index >= SCU_STP_REMOTE_NODE_COUNT);
	BUG_ON(group_index >= (u32)(remote_node_table->group_array_size * 32));

	dword_index = group_index / 32;
	bit_index   = group_index % 32;
	group_table = remote_node_table->remote_node_groups[group_table_index];

	group_table[dword_index] = group_table[dword_index] & ~(1 << bit_index);
}

/**
 * sci_remote_node_table_set_group_index()
 * @remote_node_table: This the remote node table in which to set the
 *    selector.
 * @group_table_index: This is the remote node selector in which the change
 *    will be made.
 * @group_index: This is the bit position in the table to be modified.
 *
 * This method will set the group index bit entry in the specified gropu index
 * table. none
 */
static void sci_remote_node_table_set_group_index(
	struct sci_remote_node_table *remote_node_table,
	u32 group_table_index,
	u32 group_index)
{
	u32 dword_index;
	u32 bit_index;
	u32 *group_table;

	BUG_ON(group_table_index >= SCU_STP_REMOTE_NODE_COUNT);
	BUG_ON(group_index >= (u32)(remote_node_table->group_array_size * 32));

	dword_index = group_index / 32;
	bit_index   = group_index % 32;
	group_table = remote_node_table->remote_node_groups[group_table_index];

	group_table[dword_index] = group_table[dword_index] | (1 << bit_index);
}

/**
 * sci_remote_node_table_set_node_index()
 * @remote_node_table: This is the remote node table in which to modify
 *    the remote node availability.
 * @remote_node_index: This is the remote node index that is being returned to
 *    the table.
 *
 * This method will set the remote to available in the remote node allocation
 * table. none
 */
static void sci_remote_node_table_set_node_index(
	struct sci_remote_node_table *remote_node_table,
	u32 remote_node_index)
{
	u32 dword_location;
	u32 dword_remainder;
	u32 slot_normalized;
	u32 slot_position;

Annotation

Implementation Notes