Skip to content

Commit

Permalink
Update vchiq to match GPU version. Should still be compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix authored and bootc committed May 8, 2012
1 parent 7a948c3 commit e4206fd
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 19 deletions.
19 changes: 13 additions & 6 deletions drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c
Expand Up @@ -137,7 +137,7 @@ dump_phys_mem( void *virt_addr, uint32_t num_bytes );
***************************************************************************/

static inline USER_SERVICE_T *find_service_by_handle(
VCHIQ_INSTANCE_T instance, int handle )
VCHIQ_INSTANCE_T instance, int handle )
{
USER_SERVICE_T *user_service;

Expand Down Expand Up @@ -1094,7 +1094,7 @@ vchiq_dump(void *dump_context, const char *str, int len)
char cr = '\n';
if (copy_to_user(context->buf + context->actual - 1, &cr, 1))
{
context->actual = -EFAULT;
context->actual = -EFAULT;
}
}
}
Expand Down Expand Up @@ -1383,11 +1383,11 @@ hp_func(void *v)
}
if(arm_state->use_notify_pending)
{
send_pending = 1;
arm_state->use_notify_pending = 0;
send_pending = arm_state->use_notify_pending;
arm_state->use_notify_pending=0;
}
vcos_mutex_unlock(&arm_state->use_count_mutex);
if(send_pending)
while(send_pending--)
{
vcos_log_info( "%s sending VCHIQ_MSG_REMOTE_USE_ACTIVE", __func__);
if ( vchiq_send_remote_use_active(state) != VCHIQ_SUCCESS)
Expand Down Expand Up @@ -1587,7 +1587,7 @@ vchiq_use_internal(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, int block_whi
}
if(!block_while_resume)
{
arm_state->use_notify_pending = 1;
arm_state->use_notify_pending++;
vcos_event_signal(&arm_state->hp_evt); /* hp task will check if we need to resume and also send use notify */
}

Expand Down Expand Up @@ -1811,6 +1811,13 @@ void vchiq_on_remote_use_active(VCHIQ_STATE_T *state)
vcos_unused(state);
}

void vchiq_platform_conn_state_changed(VCHIQ_STATE_T *state, VCHIQ_CONNSTATE_T oldstate, VCHIQ_CONNSTATE_T newstate)
{
vcos_unused(state);
vcos_unused(oldstate);
vcos_unused(oldstate);
}


/****************************************************************************
*
Expand Down
25 changes: 21 additions & 4 deletions drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c
Expand Up @@ -139,10 +139,12 @@ make_service_callback(VCHIQ_SERVICE_T *service, VCHIQ_REASON_T reason,
static inline void
vchiq_set_conn_state(VCHIQ_STATE_T *state, VCHIQ_CONNSTATE_T newstate)
{
VCHIQ_CONNSTATE_T oldstate = state->conn_state;
vcos_log_info("%d: %s->%s", state->id,
conn_state_names[state->conn_state],
conn_state_names[oldstate],
conn_state_names[newstate]);
state->conn_state = newstate;
vchiq_platform_conn_state_changed(state, oldstate, newstate);
}

static inline void
Expand Down Expand Up @@ -2686,15 +2688,30 @@ vchiq_dump_service_state(void *dump_context, VCHIQ_SERVICE_T *service)

VCHIQ_STATUS_T vchiq_send_remote_use(VCHIQ_STATE_T * state)
{
return queue_message(state, NULL, VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_USE, 0, 0), NULL, 0, 0, 0);
VCHIQ_STATUS_T status = VCHIQ_RETRY;
if(state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED)
{
status = queue_message(state, NULL, VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_USE, 0, 0), NULL, 0, 0, 0);
}
return status;
}

VCHIQ_STATUS_T vchiq_send_remote_release(VCHIQ_STATE_T * state)
{
return queue_message(state, NULL, VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_RELEASE, 0, 0), NULL, 0, 0, 0);
VCHIQ_STATUS_T status = VCHIQ_RETRY;
if(state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED)
{
status = queue_message(state, NULL, VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_RELEASE, 0, 0), NULL, 0, 0, 0);
}
return status;
}

VCHIQ_STATUS_T vchiq_send_remote_use_active(VCHIQ_STATE_T * state)
{
return queue_message(state, NULL, VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_USE_ACTIVE, 0, 0), NULL, 0, 0, 0);
VCHIQ_STATUS_T status = VCHIQ_RETRY;
if(state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED)
{
status = queue_message(state, NULL, VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_USE_ACTIVE, 0, 0), NULL, 0, 0, 0);
}
return status;
}
3 changes: 2 additions & 1 deletion drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h
Expand Up @@ -500,6 +500,7 @@ vchiq_send_remote_release(VCHIQ_STATE_T * state);
extern VCHIQ_STATUS_T
vchiq_send_remote_use_active(VCHIQ_STATE_T * state);


extern void
vchiq_platform_conn_state_changed(VCHIQ_STATE_T* state, VCHIQ_CONNSTATE_T oldstate, VCHIQ_CONNSTATE_T newstate);

#endif
16 changes: 8 additions & 8 deletions drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
Expand Up @@ -91,15 +91,15 @@ typedef struct {
#define VCHIQ_IOC_QUEUE_MESSAGE _IOW(VCHIQ_IOC_MAGIC, 4, VCHIQ_QUEUE_MESSAGE_T)
#define VCHIQ_IOC_QUEUE_BULK_TRANSMIT _IOW(VCHIQ_IOC_MAGIC, 5, VCHIQ_QUEUE_BULK_TRANSFER_T)
#define VCHIQ_IOC_QUEUE_BULK_RECEIVE _IOW(VCHIQ_IOC_MAGIC, 6, VCHIQ_QUEUE_BULK_TRANSFER_T)
#define VCHIQ_IOC_AWAIT_COMPLETION _IOW(VCHIQ_IOC_MAGIC, 7, VCHIQ_AWAIT_COMPLETION_T)
#define VCHIQ_IOC_DEQUEUE_MESSAGE _IOW(VCHIQ_IOC_MAGIC, 8, VCHIQ_DEQUEUE_MESSAGE_T)
#define VCHIQ_IOC_AWAIT_COMPLETION _IOWR(VCHIQ_IOC_MAGIC, 7, VCHIQ_AWAIT_COMPLETION_T)
#define VCHIQ_IOC_DEQUEUE_MESSAGE _IOWR(VCHIQ_IOC_MAGIC, 8, VCHIQ_DEQUEUE_MESSAGE_T)
#define VCHIQ_IOC_GET_CLIENT_ID _IO(VCHIQ_IOC_MAGIC, 9)
#define VCHIQ_IOC_GET_CONFIG _IOW(VCHIQ_IOC_MAGIC, 10, VCHIQ_GET_CONFIG_T)
#define VCHIQ_IOC_CLOSE_SERVICE _IO(VCHIQ_IOC_MAGIC, 11)
#define VCHIQ_IOC_USE_SERVICE _IO(VCHIQ_IOC_MAGIC, 12)
#define VCHIQ_IOC_RELEASE_SERVICE _IO(VCHIQ_IOC_MAGIC, 13)
#define VCHIQ_IOC_SET_SERVICE_OPTION _IOW(VCHIQ_IOC_MAGIC, 14, VCHIQ_SET_SERVICE_OPTION_T)
#define VCHIQ_IOC_DUMP_PHYS_MEM _IOW(VCHIQ_IOC_MAGIC, 15, VCHIQ_DUMP_MEM_T)
#define VCHIQ_IOC_GET_CONFIG _IOWR(VCHIQ_IOC_MAGIC, 10, VCHIQ_GET_CONFIG_T)
#define VCHIQ_IOC_CLOSE_SERVICE _IO(VCHIQ_IOC_MAGIC, 11)
#define VCHIQ_IOC_USE_SERVICE _IO(VCHIQ_IOC_MAGIC, 12)
#define VCHIQ_IOC_RELEASE_SERVICE _IO(VCHIQ_IOC_MAGIC, 13)
#define VCHIQ_IOC_SET_SERVICE_OPTION _IOW(VCHIQ_IOC_MAGIC, 14, VCHIQ_SET_SERVICE_OPTION_T)
#define VCHIQ_IOC_DUMP_PHYS_MEM _IOW(VCHIQ_IOC_MAGIC, 15, VCHIQ_DUMP_MEM_T)
#define VCHIQ_IOC_MAX 15

#endif

0 comments on commit e4206fd

Please sign in to comment.