/** * to_sas_gpio_gp_bit - given the gpio frame data find the byte/bit position of 'od' * @od: od bit to find * @data: incoming bitstream (from frame) * @index: requested data register index (from frame) * @count: total number of registers in the bitstream (from frame) * @bit: bit position of 'od' in the returned byte * * returns NULL if 'od' is not in 'data' * * From SFF-8485 v0.7: * "In GPIO_TX[1], bit 0 of byte 3 contains the first bit (i.e., OD0.0) * and bit 7 of byte 0 contains the 32nd bit (i.e., OD10.1). * * In GPIO_TX[2], bit 0 of byte 3 contains the 33rd bit (i.e., OD10.2) * and bit 7 of byte 0 contains the 64th bit (i.e., OD21.0)." * * The general-purpose (raw-bitstream) RX registers have the same layout * although 'od' is renamed 'id' for 'input data'. * * SFF-8489 defines the behavior of the LEDs in response to the 'od' values.
*/ static u8 *to_sas_gpio_gp_bit(unsignedint od, u8 *data, u8 index, u8 count, u8 *bit)
{ unsignedint reg;
u8 byte;
/* gp registers start at index 1 */ if (index == 0) return NULL;
index--; /* make index 0-based */ if (od < index * 32) return NULL;
od -= index * 32;
reg = od >> 5;
if (reg >= count) return NULL;
od &= (1 << 5) - 1;
byte = 3 - (od >> 3);
*bit = od & ((1 << 3) - 1);
/* check to see if we have a valid d2h fis */ if (fis->fis_type != 0x34) return;
/* the d2h fis is required by the standard to be in LE format */ for (i = 0; i < 20; i += 4) {
u8 *dst = resp_data + 24 + i, *src =
&sas_ha->sas_phy[phy_id]->port->port_dev->frame_rcvd[i];
dst[0] = src[3];
dst[1] = src[2];
dst[2] = src[1];
dst[3] = src[0];
}
}
if (phy_id >= sas_ha->num_phys) {
resp_data[2] = SMP_RESP_NO_PHY; return;
}
asd_phy = sas_ha->sas_phy[phy_id]; switch (phy_op) { case PHY_FUNC_NOP: case PHY_FUNC_LINK_RESET: case PHY_FUNC_HARD_RESET: case PHY_FUNC_DISABLE: case PHY_FUNC_CLEAR_ERROR_LOG: case PHY_FUNC_CLEAR_AFFIL: case PHY_FUNC_TX_SATA_PS_SIGNAL: break;
/* eight is the minimum size for request and response frames */ if (job->request_payload.payload_len < 8 ||
job->reply_payload.payload_len < 8) goto out;
/* make sure frame can always be built ... we copy
* back only the requested length */
resp_data = kzalloc(max(job->reply_payload.payload_len, 128U),
GFP_KERNEL); if (!resp_data) goto out_free_req;
error = -EINVAL; if (req_data[0] != SMP_REQUEST) goto out_free_resp;
/* set up default don't know response */
resp_data[0] = SMP_RESPONSE;
resp_data[1] = req_data[1];
resp_data[2] = SMP_RESP_FUNC_UNK;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.