P_DEV_CHAR_TABLE_START_ADDR) /
sizeof(uint32_t)) +
(offset * sizeof(uint32_t));
- s->regs[dev_index] = pid & 0xffffffff;
- pid >>= 32;
+ s->regs[dev_index] = (pid >> 16) & 0xffffffff;
s->regs[dev_index + 1] = FIELD_DP32(s->regs[dev_index + 1],
DEVICE_CHARACTERISTIC_TABLE_LOC2,
- MSB_PID, pid);
+ MSB_PID, pid & 0xffff);
s->regs[dev_index + 2] = FIELD_DP32(s->regs[dev_index + 2],
DEVICE_CHARACTERISTIC_TABLE_LOC3, DCR,
dcr);
for (i = 0; i < cmd.dev_count; i++) {
uint8_t addr = dw_i3c_target_addr(s, cmd.dev_index + i);
union {
- uint64_t pid:48;
- uint8_t bcr;
- uint8_t dcr;
+ uint64_t d;
uint32_t w[2];
+ /* Per I3C spec: b[0]=PID MSB, b[5]=PID LSB, b[6]=BCR, b[7]=DCR */
uint8_t b[8];
} target_info;
err = DW_I3C_RESP_QUEUE_ERR_DAA_NACK;
break;
}
- dw_i3c_update_char_table(s, cmd.dev_index + i,
- target_info.pid, target_info.bcr,
- target_info.dcr, addr);
+ uint64_t pid = be64_to_cpu(target_info.d) >> 16;
+ dw_i3c_update_char_table(s, cmd.dev_index + i, pid, target_info.b[6],
+ target_info.b[7], addr);
/* Push the PID, BCR, and DCR to the RX queue. */
dw_i3c_push_rx(s, target_info.w[0]);
uint8_t static_address;
uint8_t dcr;
uint8_t bcr;
+ /*
+ * Provisioned ID. Since core.c sends this LSB-first during ENTDAA
+ * via (pid >> (offset * 8)) & 0xff, targets must store it
+ * pre-reversed so that pid[47:40] goes on the wire first, as
+ * required by the I3C spec.
+ * e.g. for a device with pid 0xAABBCCDDEEFF, store 0xFFEEDDCCBBAA.
+ */
uint64_t pid;
/* CCC State tracking. */