|
|
|
|
@@ -380,9 +380,9 @@ make_service_callback(VCHIQ_SERVICE_T *service, VCHIQ_REASON_T reason,
|
|
|
|
|
VCHIQ_HEADER_T *header, void *bulk_userdata)
|
|
|
|
|
{
|
|
|
|
|
VCHIQ_STATUS_T status;
|
|
|
|
|
vchiq_log_trace(vchiq_core_log_level, "%d: callback:%d (%s, %x, %x)",
|
|
|
|
|
vchiq_log_trace(vchiq_core_log_level, "%d: callback:%d (%s, %pK, %pK)",
|
|
|
|
|
service->state->id, service->localport, reason_names[reason],
|
|
|
|
|
(unsigned int)header, (unsigned int)bulk_userdata);
|
|
|
|
|
header, bulk_userdata);
|
|
|
|
|
status = service->base.callback(reason, header, service->handle,
|
|
|
|
|
bulk_userdata);
|
|
|
|
|
if (status == VCHIQ_ERROR) {
|
|
|
|
|
@@ -620,8 +620,8 @@ process_free_queue(VCHIQ_STATE_T *state)
|
|
|
|
|
char *data = (char *)SLOT_DATA_FROM_INDEX(state, slot_index);
|
|
|
|
|
int data_found = 0;
|
|
|
|
|
|
|
|
|
|
vchiq_log_trace(vchiq_core_log_level, "%d: pfq %d=%x %x %x",
|
|
|
|
|
state->id, slot_index, (unsigned int)data,
|
|
|
|
|
vchiq_log_trace(vchiq_core_log_level, "%d: pfq %d=%pK %x %x",
|
|
|
|
|
state->id, slot_index, data,
|
|
|
|
|
local->slot_queue_recycle, slot_queue_available);
|
|
|
|
|
|
|
|
|
|
/* Initialise the bitmask for services which have used this
|
|
|
|
|
@@ -653,16 +653,10 @@ process_free_queue(VCHIQ_STATE_T *state)
|
|
|
|
|
up(&service_quota->quota_event);
|
|
|
|
|
else if (count == 0) {
|
|
|
|
|
vchiq_log_error(vchiq_core_log_level,
|
|
|
|
|
"service %d "
|
|
|
|
|
"message_use_count=%d "
|
|
|
|
|
"(header %x, msgid %x, "
|
|
|
|
|
"header->msgid %x, "
|
|
|
|
|
"header->size %x)",
|
|
|
|
|
"service %d message_use_count=%d (header %pK, msgid %x, header->msgid %x, header->size %x)",
|
|
|
|
|
port,
|
|
|
|
|
service_quota->
|
|
|
|
|
message_use_count,
|
|
|
|
|
(unsigned int)header, msgid,
|
|
|
|
|
header->msgid,
|
|
|
|
|
service_quota->message_use_count,
|
|
|
|
|
header, msgid, header->msgid,
|
|
|
|
|
header->size);
|
|
|
|
|
WARN(1, "invalid message use count\n");
|
|
|
|
|
}
|
|
|
|
|
@@ -684,26 +678,16 @@ process_free_queue(VCHIQ_STATE_T *state)
|
|
|
|
|
up(&service_quota->quota_event);
|
|
|
|
|
vchiq_log_trace(
|
|
|
|
|
vchiq_core_log_level,
|
|
|
|
|
"%d: pfq:%d %x@%x - "
|
|
|
|
|
"slot_use->%d",
|
|
|
|
|
"%d: pfq:%d %x@%pK - slot_use->%d",
|
|
|
|
|
state->id, port,
|
|
|
|
|
header->size,
|
|
|
|
|
(unsigned int)header,
|
|
|
|
|
header->size, header,
|
|
|
|
|
count - 1);
|
|
|
|
|
} else {
|
|
|
|
|
vchiq_log_error(
|
|
|
|
|
vchiq_core_log_level,
|
|
|
|
|
"service %d "
|
|
|
|
|
"slot_use_count"
|
|
|
|
|
"=%d (header %x"
|
|
|
|
|
", msgid %x, "
|
|
|
|
|
"header->msgid"
|
|
|
|
|
" %x, header->"
|
|
|
|
|
"size %x)",
|
|
|
|
|
port, count,
|
|
|
|
|
(unsigned int)header,
|
|
|
|
|
msgid,
|
|
|
|
|
header->msgid,
|
|
|
|
|
"service %d slot_use_count=%d (header %pK, msgid %x, header->msgid %x, header->size %x)",
|
|
|
|
|
port, count, header,
|
|
|
|
|
msgid, header->msgid,
|
|
|
|
|
header->size);
|
|
|
|
|
WARN(1, "bad slot use count\n");
|
|
|
|
|
}
|
|
|
|
|
@@ -715,10 +699,9 @@ process_free_queue(VCHIQ_STATE_T *state)
|
|
|
|
|
pos += calc_stride(header->size);
|
|
|
|
|
if (pos > VCHIQ_SLOT_SIZE) {
|
|
|
|
|
vchiq_log_error(vchiq_core_log_level,
|
|
|
|
|
"pfq - pos %x: header %x, msgid %x, "
|
|
|
|
|
"header->msgid %x, header->size %x",
|
|
|
|
|
pos, (unsigned int)header, msgid,
|
|
|
|
|
header->msgid, header->size);
|
|
|
|
|
"pfq - pos %x: header %pK, msgid %x, header->msgid %x, header->size %x",
|
|
|
|
|
pos, header, msgid, header->msgid,
|
|
|
|
|
header->size);
|
|
|
|
|
WARN(1, "invalid slot position\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -862,11 +845,9 @@ queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service,
|
|
|
|
|
int slot_use_count;
|
|
|
|
|
|
|
|
|
|
vchiq_log_info(vchiq_core_log_level,
|
|
|
|
|
"%d: qm %s@%x,%x (%d->%d)",
|
|
|
|
|
state->id,
|
|
|
|
|
msg_type_str(VCHIQ_MSG_TYPE(msgid)),
|
|
|
|
|
(unsigned int)header, size,
|
|
|
|
|
VCHIQ_MSG_SRCPORT(msgid),
|
|
|
|
|
"%d: qm %s@%pK,%x (%d->%d)",
|
|
|
|
|
state->id, msg_type_str(VCHIQ_MSG_TYPE(msgid)),
|
|
|
|
|
header, size, VCHIQ_MSG_SRCPORT(msgid),
|
|
|
|
|
VCHIQ_MSG_DSTPORT(msgid));
|
|
|
|
|
|
|
|
|
|
BUG_ON(!service);
|
|
|
|
|
@@ -930,10 +911,9 @@ queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service,
|
|
|
|
|
VCHIQ_SERVICE_STATS_ADD(service, ctrl_tx_bytes, size);
|
|
|
|
|
} else {
|
|
|
|
|
vchiq_log_info(vchiq_core_log_level,
|
|
|
|
|
"%d: qm %s@%x,%x (%d->%d)", state->id,
|
|
|
|
|
"%d: qm %s@%pK,%x (%d->%d)", state->id,
|
|
|
|
|
msg_type_str(VCHIQ_MSG_TYPE(msgid)),
|
|
|
|
|
(unsigned int)header, size,
|
|
|
|
|
VCHIQ_MSG_SRCPORT(msgid),
|
|
|
|
|
header, size, VCHIQ_MSG_SRCPORT(msgid),
|
|
|
|
|
VCHIQ_MSG_DSTPORT(msgid));
|
|
|
|
|
if (size != 0) {
|
|
|
|
|
WARN_ON(!((count == 1) && (size == elements[0].size)));
|
|
|
|
|
@@ -1015,10 +995,9 @@ queue_message_sync(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service,
|
|
|
|
|
int i, pos;
|
|
|
|
|
|
|
|
|
|
vchiq_log_info(vchiq_sync_log_level,
|
|
|
|
|
"%d: qms %s@%x,%x (%d->%d)", state->id,
|
|
|
|
|
"%d: qms %s@%pK,%x (%d->%d)", state->id,
|
|
|
|
|
msg_type_str(VCHIQ_MSG_TYPE(msgid)),
|
|
|
|
|
(unsigned int)header, size,
|
|
|
|
|
VCHIQ_MSG_SRCPORT(msgid),
|
|
|
|
|
header, size, VCHIQ_MSG_SRCPORT(msgid),
|
|
|
|
|
VCHIQ_MSG_DSTPORT(msgid));
|
|
|
|
|
|
|
|
|
|
for (i = 0, pos = 0; i < (unsigned int)count;
|
|
|
|
|
@@ -1047,10 +1026,9 @@ queue_message_sync(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service,
|
|
|
|
|
VCHIQ_SERVICE_STATS_ADD(service, ctrl_tx_bytes, size);
|
|
|
|
|
} else {
|
|
|
|
|
vchiq_log_info(vchiq_sync_log_level,
|
|
|
|
|
"%d: qms %s@%x,%x (%d->%d)", state->id,
|
|
|
|
|
"%d: qms %s@%pK,%x (%d->%d)", state->id,
|
|
|
|
|
msg_type_str(VCHIQ_MSG_TYPE(msgid)),
|
|
|
|
|
(unsigned int)header, size,
|
|
|
|
|
VCHIQ_MSG_SRCPORT(msgid),
|
|
|
|
|
header, size, VCHIQ_MSG_SRCPORT(msgid),
|
|
|
|
|
VCHIQ_MSG_DSTPORT(msgid));
|
|
|
|
|
if (size != 0) {
|
|
|
|
|
WARN_ON(!((count == 1) && (size == elements[0].size)));
|
|
|
|
|
@@ -1350,26 +1328,22 @@ resolve_bulks(VCHIQ_SERVICE_T *service, VCHIQ_BULK_QUEUE_T *queue)
|
|
|
|
|
"Send Bulk to" : "Recv Bulk from";
|
|
|
|
|
if (bulk->actual != VCHIQ_BULK_ACTUAL_ABORTED)
|
|
|
|
|
vchiq_log_info(SRVTRACE_LEVEL(service),
|
|
|
|
|
"%s %c%c%c%c d:%d len:%d %x<->%x",
|
|
|
|
|
"%s %c%c%c%c d:%d len:%d %pK<->%pK",
|
|
|
|
|
header,
|
|
|
|
|
VCHIQ_FOURCC_AS_4CHARS(
|
|
|
|
|
service->base.fourcc),
|
|
|
|
|
service->remoteport,
|
|
|
|
|
bulk->size,
|
|
|
|
|
(unsigned int)bulk->data,
|
|
|
|
|
(unsigned int)bulk->remote_data);
|
|
|
|
|
service->remoteport, bulk->size,
|
|
|
|
|
bulk->data, bulk->remote_data);
|
|
|
|
|
else
|
|
|
|
|
vchiq_log_info(SRVTRACE_LEVEL(service),
|
|
|
|
|
"%s %c%c%c%c d:%d ABORTED - tx len:%d,"
|
|
|
|
|
" rx len:%d %x<->%x",
|
|
|
|
|
" rx len:%d %pK<->%pK",
|
|
|
|
|
header,
|
|
|
|
|
VCHIQ_FOURCC_AS_4CHARS(
|
|
|
|
|
service->base.fourcc),
|
|
|
|
|
service->remoteport,
|
|
|
|
|
bulk->size,
|
|
|
|
|
bulk->remote_size,
|
|
|
|
|
(unsigned int)bulk->data,
|
|
|
|
|
(unsigned int)bulk->remote_data);
|
|
|
|
|
bulk->size, bulk->remote_size,
|
|
|
|
|
bulk->data, bulk->remote_data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vchiq_complete_bulk(bulk);
|
|
|
|
|
@@ -1505,9 +1479,8 @@ parse_open(VCHIQ_STATE_T *state, VCHIQ_HEADER_T *header)
|
|
|
|
|
|
|
|
|
|
fourcc = payload->fourcc;
|
|
|
|
|
vchiq_log_info(vchiq_core_log_level,
|
|
|
|
|
"%d: prs OPEN@%x (%d->'%c%c%c%c')",
|
|
|
|
|
state->id, (unsigned int)header,
|
|
|
|
|
localport,
|
|
|
|
|
"%d: prs OPEN@%pK (%d->'%c%c%c%c')",
|
|
|
|
|
state->id, header, localport,
|
|
|
|
|
VCHIQ_FOURCC_AS_4CHARS(fourcc));
|
|
|
|
|
|
|
|
|
|
service = get_listening_service(state, fourcc);
|
|
|
|
|
@@ -1678,21 +1651,18 @@ parse_rx_slots(VCHIQ_STATE_T *state)
|
|
|
|
|
remoteport);
|
|
|
|
|
if (service)
|
|
|
|
|
vchiq_log_warning(vchiq_core_log_level,
|
|
|
|
|
"%d: prs %s@%x (%d->%d) - "
|
|
|
|
|
"found connected service %d",
|
|
|
|
|
"%d: prs %s@%pK (%d->%d) - found connected service %d",
|
|
|
|
|
state->id, msg_type_str(type),
|
|
|
|
|
(unsigned int)header,
|
|
|
|
|
remoteport, localport,
|
|
|
|
|
header, remoteport, localport,
|
|
|
|
|
service->localport);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!service) {
|
|
|
|
|
vchiq_log_error(vchiq_core_log_level,
|
|
|
|
|
"%d: prs %s@%x (%d->%d) - "
|
|
|
|
|
"invalid/closed service %d",
|
|
|
|
|
"%d: prs %s@%pK (%d->%d) - invalid/closed service %d",
|
|
|
|
|
state->id, msg_type_str(type),
|
|
|
|
|
(unsigned int)header,
|
|
|
|
|
remoteport, localport, localport);
|
|
|
|
|
header, remoteport, localport,
|
|
|
|
|
localport);
|
|
|
|
|
goto skip_message;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
@@ -1720,9 +1690,8 @@ parse_rx_slots(VCHIQ_STATE_T *state)
|
|
|
|
|
if (((unsigned int)header & VCHIQ_SLOT_MASK) + calc_stride(size)
|
|
|
|
|
> VCHIQ_SLOT_SIZE) {
|
|
|
|
|
vchiq_log_error(vchiq_core_log_level,
|
|
|
|
|
"header %x (msgid %x) - size %x too big for "
|
|
|
|
|
"slot",
|
|
|
|
|
(unsigned int)header, (unsigned int)msgid,
|
|
|
|
|
"header %pK (msgid %x) - size %x too big for slot",
|
|
|
|
|
header, (unsigned int)msgid,
|
|
|
|
|
(unsigned int)size);
|
|
|
|
|
WARN(1, "oversized for slot\n");
|
|
|
|
|
}
|
|
|
|
|
@@ -1741,9 +1710,9 @@ parse_rx_slots(VCHIQ_STATE_T *state)
|
|
|
|
|
service->peer_version = payload->version;
|
|
|
|
|
}
|
|
|
|
|
vchiq_log_info(vchiq_core_log_level,
|
|
|
|
|
"%d: prs OPENACK@%x,%x (%d->%d) v:%d",
|
|
|
|
|
state->id, (unsigned int)header, size,
|
|
|
|
|
remoteport, localport, service->peer_version);
|
|
|
|
|
"%d: prs OPENACK@%pK,%x (%d->%d) v:%d",
|
|
|
|
|
state->id, header, size, remoteport, localport,
|
|
|
|
|
service->peer_version);
|
|
|
|
|
if (service->srvstate ==
|
|
|
|
|
VCHIQ_SRVSTATE_OPENING) {
|
|
|
|
|
service->remoteport = remoteport;
|
|
|
|
|
@@ -1759,9 +1728,8 @@ parse_rx_slots(VCHIQ_STATE_T *state)
|
|
|
|
|
WARN_ON(size != 0); /* There should be no data */
|
|
|
|
|
|
|
|
|
|
vchiq_log_info(vchiq_core_log_level,
|
|
|
|
|
"%d: prs CLOSE@%x (%d->%d)",
|
|
|
|
|
state->id, (unsigned int)header,
|
|
|
|
|
remoteport, localport);
|
|
|
|
|
"%d: prs CLOSE@%pK (%d->%d)",
|
|
|
|
|
state->id, header, remoteport, localport);
|
|
|
|
|
|
|
|
|
|
mark_service_closing_internal(service, 1);
|
|
|
|
|
|
|
|
|
|
@@ -1777,9 +1745,8 @@ parse_rx_slots(VCHIQ_STATE_T *state)
|
|
|
|
|
break;
|
|
|
|
|
case VCHIQ_MSG_DATA:
|
|
|
|
|
vchiq_log_info(vchiq_core_log_level,
|
|
|
|
|
"%d: prs DATA@%x,%x (%d->%d)",
|
|
|
|
|
state->id, (unsigned int)header, size,
|
|
|
|
|
remoteport, localport);
|
|
|
|
|
"%d: prs DATA@%pK,%x (%d->%d)",
|
|
|
|
|
state->id, header, size, remoteport, localport);
|
|
|
|
|
|
|
|
|
|
if ((service->remoteport == remoteport)
|
|
|
|
|
&& (service->srvstate ==
|
|
|
|
|
@@ -1802,8 +1769,7 @@ parse_rx_slots(VCHIQ_STATE_T *state)
|
|
|
|
|
break;
|
|
|
|
|
case VCHIQ_MSG_CONNECT:
|
|
|
|
|
vchiq_log_info(vchiq_core_log_level,
|
|
|
|
|
"%d: prs CONNECT@%x",
|
|
|
|
|
state->id, (unsigned int)header);
|
|
|
|
|
"%d: prs CONNECT@%pK", state->id, header);
|
|
|
|
|
state->version_common = ((VCHIQ_SLOT_ZERO_T *)
|
|
|
|
|
state->slot_data)->version;
|
|
|
|
|
up(&state->connect);
|
|
|
|
|
@@ -1837,12 +1803,10 @@ parse_rx_slots(VCHIQ_STATE_T *state)
|
|
|
|
|
wmb();
|
|
|
|
|
|
|
|
|
|
vchiq_log_info(vchiq_core_log_level,
|
|
|
|
|
"%d: prs %s@%x (%d->%d) %x@%x",
|
|
|
|
|
"%d: prs %s@%pK (%d->%d) %x@%pK",
|
|
|
|
|
state->id, msg_type_str(type),
|
|
|
|
|
(unsigned int)header,
|
|
|
|
|
remoteport, localport,
|
|
|
|
|
bulk->remote_size,
|
|
|
|
|
(unsigned int)bulk->remote_data);
|
|
|
|
|
header, remoteport, localport,
|
|
|
|
|
bulk->remote_size, bulk->remote_data);
|
|
|
|
|
|
|
|
|
|
queue->remote_insert++;
|
|
|
|
|
|
|
|
|
|
@@ -1895,11 +1859,10 @@ parse_rx_slots(VCHIQ_STATE_T *state)
|
|
|
|
|
if ((int)(queue->remote_insert -
|
|
|
|
|
queue->local_insert) >= 0) {
|
|
|
|
|
vchiq_log_error(vchiq_core_log_level,
|
|
|
|
|
"%d: prs %s@%x (%d->%d) "
|
|
|
|
|
"%d: prs %s@%pK (%d->%d) "
|
|
|
|
|
"unexpected (ri=%d,li=%d)",
|
|
|
|
|
state->id, msg_type_str(type),
|
|
|
|
|
(unsigned int)header,
|
|
|
|
|
remoteport, localport,
|
|
|
|
|
header, remoteport, localport,
|
|
|
|
|
queue->remote_insert,
|
|
|
|
|
queue->local_insert);
|
|
|
|
|
mutex_unlock(&service->bulk_mutex);
|
|
|
|
|
@@ -1915,11 +1878,10 @@ parse_rx_slots(VCHIQ_STATE_T *state)
|
|
|
|
|
queue->remote_insert++;
|
|
|
|
|
|
|
|
|
|
vchiq_log_info(vchiq_core_log_level,
|
|
|
|
|
"%d: prs %s@%x (%d->%d) %x@%x",
|
|
|
|
|
"%d: prs %s@%pK (%d->%d) %x@%pK",
|
|
|
|
|
state->id, msg_type_str(type),
|
|
|
|
|
(unsigned int)header,
|
|
|
|
|
remoteport, localport,
|
|
|
|
|
bulk->actual, (unsigned int)bulk->data);
|
|
|
|
|
header, remoteport, localport,
|
|
|
|
|
bulk->actual, bulk->data);
|
|
|
|
|
|
|
|
|
|
vchiq_log_trace(vchiq_core_log_level,
|
|
|
|
|
"%d: prs:%d %cx li=%x ri=%x p=%x",
|
|
|
|
|
@@ -1941,14 +1903,14 @@ parse_rx_slots(VCHIQ_STATE_T *state)
|
|
|
|
|
break;
|
|
|
|
|
case VCHIQ_MSG_PADDING:
|
|
|
|
|
vchiq_log_trace(vchiq_core_log_level,
|
|
|
|
|
"%d: prs PADDING@%x,%x",
|
|
|
|
|
state->id, (unsigned int)header, size);
|
|
|
|
|
"%d: prs PADDING@%pK,%x",
|
|
|
|
|
state->id, header, size);
|
|
|
|
|
break;
|
|
|
|
|
case VCHIQ_MSG_PAUSE:
|
|
|
|
|
/* If initiated, signal the application thread */
|
|
|
|
|
vchiq_log_trace(vchiq_core_log_level,
|
|
|
|
|
"%d: prs PAUSE@%x,%x",
|
|
|
|
|
state->id, (unsigned int)header, size);
|
|
|
|
|
"%d: prs PAUSE@%pK,%x",
|
|
|
|
|
state->id, header, size);
|
|
|
|
|
if (state->conn_state == VCHIQ_CONNSTATE_PAUSED) {
|
|
|
|
|
vchiq_log_error(vchiq_core_log_level,
|
|
|
|
|
"%d: PAUSE received in state PAUSED",
|
|
|
|
|
@@ -1971,8 +1933,8 @@ parse_rx_slots(VCHIQ_STATE_T *state)
|
|
|
|
|
break;
|
|
|
|
|
case VCHIQ_MSG_RESUME:
|
|
|
|
|
vchiq_log_trace(vchiq_core_log_level,
|
|
|
|
|
"%d: prs RESUME@%x,%x",
|
|
|
|
|
state->id, (unsigned int)header, size);
|
|
|
|
|
"%d: prs RESUME@%pK,%x",
|
|
|
|
|
state->id, header, size);
|
|
|
|
|
/* Release the slot mutex */
|
|
|
|
|
mutex_unlock(&state->slot_mutex);
|
|
|
|
|
if (state->is_master)
|
|
|
|
|
@@ -1993,8 +1955,8 @@ parse_rx_slots(VCHIQ_STATE_T *state)
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
vchiq_log_error(vchiq_core_log_level,
|
|
|
|
|
"%d: prs invalid msgid %x@%x,%x",
|
|
|
|
|
state->id, msgid, (unsigned int)header, size);
|
|
|
|
|
"%d: prs invalid msgid %x@%pK,%x",
|
|
|
|
|
state->id, msgid, header, size);
|
|
|
|
|
WARN(1, "invalid message\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
@@ -2159,11 +2121,9 @@ sync_func(void *v)
|
|
|
|
|
|
|
|
|
|
if (!service) {
|
|
|
|
|
vchiq_log_error(vchiq_sync_log_level,
|
|
|
|
|
"%d: sf %s@%x (%d->%d) - "
|
|
|
|
|
"invalid/closed service %d",
|
|
|
|
|
"%d: sf %s@%pK (%d->%d) - invalid/closed service %d",
|
|
|
|
|
state->id, msg_type_str(type),
|
|
|
|
|
(unsigned int)header,
|
|
|
|
|
remoteport, localport, localport);
|
|
|
|
|
header, remoteport, localport, localport);
|
|
|
|
|
release_message_sync(state, header);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
@@ -2193,9 +2153,9 @@ sync_func(void *v)
|
|
|
|
|
service->peer_version = payload->version;
|
|
|
|
|
}
|
|
|
|
|
vchiq_log_info(vchiq_sync_log_level,
|
|
|
|
|
"%d: sf OPENACK@%x,%x (%d->%d) v:%d",
|
|
|
|
|
state->id, (unsigned int)header, size,
|
|
|
|
|
remoteport, localport, service->peer_version);
|
|
|
|
|
"%d: sf OPENACK@%pK,%x (%d->%d) v:%d",
|
|
|
|
|
state->id, header, size, remoteport, localport,
|
|
|
|
|
service->peer_version);
|
|
|
|
|
if (service->srvstate == VCHIQ_SRVSTATE_OPENING) {
|
|
|
|
|
service->remoteport = remoteport;
|
|
|
|
|
vchiq_set_service_state(service,
|
|
|
|
|
@@ -2208,9 +2168,8 @@ sync_func(void *v)
|
|
|
|
|
|
|
|
|
|
case VCHIQ_MSG_DATA:
|
|
|
|
|
vchiq_log_trace(vchiq_sync_log_level,
|
|
|
|
|
"%d: sf DATA@%x,%x (%d->%d)",
|
|
|
|
|
state->id, (unsigned int)header, size,
|
|
|
|
|
remoteport, localport);
|
|
|
|
|
"%d: sf DATA@%pK,%x (%d->%d)",
|
|
|
|
|
state->id, header, size, remoteport, localport);
|
|
|
|
|
|
|
|
|
|
if ((service->remoteport == remoteport) &&
|
|
|
|
|
(service->srvstate ==
|
|
|
|
|
@@ -2228,8 +2187,8 @@ sync_func(void *v)
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
vchiq_log_error(vchiq_sync_log_level,
|
|
|
|
|
"%d: sf unexpected msgid %x@%x,%x",
|
|
|
|
|
state->id, msgid, (unsigned int)header, size);
|
|
|
|
|
"%d: sf unexpected msgid %x@%pK,%x",
|
|
|
|
|
state->id, msgid, header, size);
|
|
|
|
|
release_message_sync(state, header);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
@@ -2310,16 +2269,16 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero,
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
vchiq_log_warning(vchiq_core_log_level,
|
|
|
|
|
"%s: slot_zero = 0x%08lx, is_master = %d",
|
|
|
|
|
__func__, (unsigned long)slot_zero, is_master);
|
|
|
|
|
"%s: slot_zero = %pK, is_master = %d",
|
|
|
|
|
__func__, slot_zero, is_master);
|
|
|
|
|
|
|
|
|
|
/* Check the input configuration */
|
|
|
|
|
|
|
|
|
|
if (slot_zero->magic != VCHIQ_MAGIC) {
|
|
|
|
|
vchiq_loud_error_header();
|
|
|
|
|
vchiq_loud_error("Invalid VCHIQ magic value found.");
|
|
|
|
|
vchiq_loud_error("slot_zero=%x: magic=%x (expected %x)",
|
|
|
|
|
(unsigned int)slot_zero, slot_zero->magic, VCHIQ_MAGIC);
|
|
|
|
|
vchiq_loud_error("slot_zero=%pK: magic=%x (expected %x)",
|
|
|
|
|
slot_zero, slot_zero->magic, VCHIQ_MAGIC);
|
|
|
|
|
vchiq_loud_error_footer();
|
|
|
|
|
return VCHIQ_ERROR;
|
|
|
|
|
}
|
|
|
|
|
@@ -2327,10 +2286,8 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero,
|
|
|
|
|
if (slot_zero->version < VCHIQ_VERSION_MIN) {
|
|
|
|
|
vchiq_loud_error_header();
|
|
|
|
|
vchiq_loud_error("Incompatible VCHIQ versions found.");
|
|
|
|
|
vchiq_loud_error("slot_zero=%x: VideoCore version=%d "
|
|
|
|
|
"(minimum %d)",
|
|
|
|
|
(unsigned int)slot_zero, slot_zero->version,
|
|
|
|
|
VCHIQ_VERSION_MIN);
|
|
|
|
|
vchiq_loud_error("slot_zero=%pK: VideoCore version=%d (minimum %d)",
|
|
|
|
|
slot_zero, slot_zero->version, VCHIQ_VERSION_MIN);
|
|
|
|
|
vchiq_loud_error("Restart with a newer VideoCore image.");
|
|
|
|
|
vchiq_loud_error_footer();
|
|
|
|
|
return VCHIQ_ERROR;
|
|
|
|
|
@@ -2339,10 +2296,8 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero,
|
|
|
|
|
if (VCHIQ_VERSION < slot_zero->version_min) {
|
|
|
|
|
vchiq_loud_error_header();
|
|
|
|
|
vchiq_loud_error("Incompatible VCHIQ versions found.");
|
|
|
|
|
vchiq_loud_error("slot_zero=%x: version=%d (VideoCore "
|
|
|
|
|
"minimum %d)",
|
|
|
|
|
(unsigned int)slot_zero, VCHIQ_VERSION,
|
|
|
|
|
slot_zero->version_min);
|
|
|
|
|
vchiq_loud_error("slot_zero=%pK: version=%d (VideoCore minimum %d)",
|
|
|
|
|
slot_zero, VCHIQ_VERSION, slot_zero->version_min);
|
|
|
|
|
vchiq_loud_error("Restart with a newer kernel.");
|
|
|
|
|
vchiq_loud_error_footer();
|
|
|
|
|
return VCHIQ_ERROR;
|
|
|
|
|
@@ -2354,26 +2309,20 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero,
|
|
|
|
|
(slot_zero->max_slots_per_side != VCHIQ_MAX_SLOTS_PER_SIDE)) {
|
|
|
|
|
vchiq_loud_error_header();
|
|
|
|
|
if (slot_zero->slot_zero_size != sizeof(VCHIQ_SLOT_ZERO_T))
|
|
|
|
|
vchiq_loud_error("slot_zero=%x: slot_zero_size=%x "
|
|
|
|
|
"(expected %x)",
|
|
|
|
|
(unsigned int)slot_zero,
|
|
|
|
|
slot_zero->slot_zero_size,
|
|
|
|
|
sizeof(VCHIQ_SLOT_ZERO_T));
|
|
|
|
|
vchiq_loud_error("slot_zero=%pK: slot_zero_size=%d (expected %d)",
|
|
|
|
|
slot_zero, slot_zero->slot_zero_size,
|
|
|
|
|
(int)sizeof(VCHIQ_SLOT_ZERO_T));
|
|
|
|
|
if (slot_zero->slot_size != VCHIQ_SLOT_SIZE)
|
|
|
|
|
vchiq_loud_error("slot_zero=%x: slot_size=%d "
|
|
|
|
|
"(expected %d",
|
|
|
|
|
(unsigned int)slot_zero, slot_zero->slot_size,
|
|
|
|
|
vchiq_loud_error("slot_zero=%pK: slot_size=%d (expected %d)",
|
|
|
|
|
slot_zero, slot_zero->slot_size,
|
|
|
|
|
VCHIQ_SLOT_SIZE);
|
|
|
|
|
if (slot_zero->max_slots != VCHIQ_MAX_SLOTS)
|
|
|
|
|
vchiq_loud_error("slot_zero=%x: max_slots=%d "
|
|
|
|
|
"(expected %d)",
|
|
|
|
|
(unsigned int)slot_zero, slot_zero->max_slots,
|
|
|
|
|
vchiq_loud_error("slot_zero=%pK: max_slots=%d (expected %d)",
|
|
|
|
|
slot_zero, slot_zero->max_slots,
|
|
|
|
|
VCHIQ_MAX_SLOTS);
|
|
|
|
|
if (slot_zero->max_slots_per_side != VCHIQ_MAX_SLOTS_PER_SIDE)
|
|
|
|
|
vchiq_loud_error("slot_zero=%x: max_slots_per_side=%d "
|
|
|
|
|
"(expected %d)",
|
|
|
|
|
(unsigned int)slot_zero,
|
|
|
|
|
slot_zero->max_slots_per_side,
|
|
|
|
|
vchiq_loud_error("slot_zero=%pK: max_slots_per_side=%d (expected %d)",
|
|
|
|
|
slot_zero, slot_zero->max_slots_per_side,
|
|
|
|
|
VCHIQ_MAX_SLOTS_PER_SIDE);
|
|
|
|
|
vchiq_loud_error_footer();
|
|
|
|
|
return VCHIQ_ERROR;
|
|
|
|
|
@@ -2750,20 +2699,16 @@ release_service_messages(VCHIQ_SERVICE_T *service)
|
|
|
|
|
if ((port == service->localport) &&
|
|
|
|
|
(msgid & VCHIQ_MSGID_CLAIMED)) {
|
|
|
|
|
vchiq_log_info(vchiq_core_log_level,
|
|
|
|
|
" fsi - hdr %x",
|
|
|
|
|
(unsigned int)header);
|
|
|
|
|
" fsi - hdr %pK", header);
|
|
|
|
|
release_slot(state, slot_info, header,
|
|
|
|
|
NULL);
|
|
|
|
|
}
|
|
|
|
|
pos += calc_stride(header->size);
|
|
|
|
|
if (pos > VCHIQ_SLOT_SIZE) {
|
|
|
|
|
vchiq_log_error(vchiq_core_log_level,
|
|
|
|
|
"fsi - pos %x: header %x, "
|
|
|
|
|
"msgid %x, header->msgid %x, "
|
|
|
|
|
"header->size %x",
|
|
|
|
|
pos, (unsigned int)header,
|
|
|
|
|
msgid, header->msgid,
|
|
|
|
|
header->size);
|
|
|
|
|
"fsi - pos %x: header %pK, msgid %x, header->msgid %x, header->size %x",
|
|
|
|
|
pos, header, msgid,
|
|
|
|
|
header->msgid, header->size);
|
|
|
|
|
WARN(1, "invalid slot position\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -3335,10 +3280,9 @@ vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle,
|
|
|
|
|
wmb();
|
|
|
|
|
|
|
|
|
|
vchiq_log_info(vchiq_core_log_level,
|
|
|
|
|
"%d: bt (%d->%d) %cx %x@%x %x",
|
|
|
|
|
state->id,
|
|
|
|
|
service->localport, service->remoteport, dir_char,
|
|
|
|
|
size, (unsigned int)bulk->data, (unsigned int)userdata);
|
|
|
|
|
"%d: bt (%d->%d) %cx %x@%pK %pK",
|
|
|
|
|
state->id, service->localport, service->remoteport, dir_char,
|
|
|
|
|
size, bulk->data, userdata);
|
|
|
|
|
|
|
|
|
|
/* The slot mutex must be held when the service is being closed, so
|
|
|
|
|
claim it here to ensure that isn't happening */
|
|
|
|
|
@@ -3685,13 +3629,11 @@ vchiq_dump_state(void *dump_context, VCHIQ_STATE_T *state)
|
|
|
|
|
vchiq_dump(dump_context, buf, len + 1);
|
|
|
|
|
|
|
|
|
|
len = snprintf(buf, sizeof(buf),
|
|
|
|
|
" tx_pos=%x(@%x), rx_pos=%x(@%x)",
|
|
|
|
|
" tx_pos=%x(@%pK), rx_pos=%x(@%pK)",
|
|
|
|
|
state->local->tx_pos,
|
|
|
|
|
(uint32_t)state->tx_data +
|
|
|
|
|
(state->local_tx_pos & VCHIQ_SLOT_MASK),
|
|
|
|
|
state->tx_data + (state->local_tx_pos & VCHIQ_SLOT_MASK),
|
|
|
|
|
state->rx_pos,
|
|
|
|
|
(uint32_t)state->rx_data +
|
|
|
|
|
(state->rx_pos & VCHIQ_SLOT_MASK));
|
|
|
|
|
state->rx_data + (state->rx_pos & VCHIQ_SLOT_MASK));
|
|
|
|
|
vchiq_dump(dump_context, buf, len + 1);
|
|
|
|
|
|
|
|
|
|
len = snprintf(buf, sizeof(buf),
|
|
|
|
|
|