Пример #1
0
/* Dispatch */
struct esif_ipc *esif_execute_ipc_command(
	struct esif_ipc *ipc_ptr
	)
{
	struct esif_ipc_command *command_ptr =
		(struct esif_ipc_command *)(ipc_ptr + 1);
	u32 data_size = 0;

	command_ptr->return_code = ESIF_E_COMMAND_DATA_INVALID;

	if (ESIF_COMMAND_VERSION != command_ptr->version)
		goto exit;

	data_size = ipc_ptr->data_len - sizeof(*command_ptr);

	if(((command_ptr->req_data_offset + command_ptr->req_data_len) > 
	     data_size) ||
	   ((command_ptr->rsp_data_offset + command_ptr->rsp_data_len) > 
	     data_size))
		goto exit;

	ESIF_TRACE_DYN_COMMAND("%s: COMMAND Received: ipc %p\n",
			       ESIF_FUNC,
			       ipc_ptr);
	ESIF_TRACE_DYN_DECODE("  Version:              %d\n"
			      "  Type:                 %s(%d)\n"
			      "  Priority:             %s(%d)\n"
			      "  Payload Length:       %d\n"
			      "  Request  Data Type:   %s(%d)\n"
			      "  Request  Data Offset: %d\n"
			      "  Request  Data Length: %d\n"
			      "  Response Data Type:   %s(%d)\n"
			      "  Response Data Offset: %d\n"
			      "  Response Data Length: %d\n",
			      (int)command_ptr->version,
			      esif_command_type_str(command_ptr->type),
			      (int)command_ptr->type,
			      esif_command_priority_str(command_ptr->priority),
			      (int)command_ptr->priority,
			      (int)command_ptr->payload_len,
			      esif_data_type_str(command_ptr->req_data_type),
			      (int)command_ptr->req_data_type,
			      (int)command_ptr->req_data_offset,
			      (int)command_ptr->req_data_len,
			      esif_data_type_str(command_ptr->rsp_data_type),
			      (int)command_ptr->rsp_data_type,
			      (int)command_ptr->rsp_data_offset,
			      (int)command_ptr->rsp_data_len);

	switch (command_ptr->type) {
	case ESIF_COMMAND_TYPE_SET_DEBUG_MODULES:
		esif_execute_ipc_command_set_debug_modules(command_ptr);
		break;

	case ESIF_COMMAND_TYPE_SET_DEBUG_MODULE_LEVEL:
		esif_execute_ipc_command_set_debug_module_level(command_ptr);
		break;

	case ESIF_COMMAND_TYPE_GET_DEBUG_MODULE_LEVEL:
		esif_execute_ipc_command_get_debug_module_level(command_ptr);
		break;

	case ESIF_COMMAND_TYPE_GET_KERNEL_INFO:
		esif_execute_ipc_command_get_kernel_info(command_ptr);
		break;

	case ESIF_COMMAND_TYPE_GET_MEMORY_STATS:
		esif_execute_ipc_command_get_memory_stats(command_ptr);
		break;

	case ESIF_COMMAND_TYPE_GET_PARTICIPANTS:
		esif_execute_ipc_command_get_participants(command_ptr);
		break;

	case ESIF_COMMAND_TYPE_GET_PARTICIPANT_DETAIL:
		esif_execute_ipc_command_get_participant_detail(command_ptr);
		break;

	default:
		ESIF_TRACE_DYN_COMMAND("%s: Unknown Command Type %d:\n",
				       ESIF_FUNC, command_ptr->type);
		break;
	}
	ESIF_TRACE_DYN_COMMAND("%s: COMMAND return result: %s(%d)\n", ESIF_FUNC,
			       esif_rc_str(
				       command_ptr->return_code),
			       command_ptr->return_code);
exit:
	/* Send To User */
	return ipc_ptr;
}
Пример #2
0
/* Documented In Header */
struct esif_event *esif_event_allocate(
	const enum esif_event_type type,
	const u16 size,
	const enum esif_event_priority priority,
	const u8 src,
	const u8 dst,
	const u16 dst_domain_id,
	const void *data_ptr
	)
{
	u16 new_size = size + sizeof(struct esif_event);
	struct esif_event *event_ptr = NULL;
	event_ptr = esif_ccb_memtype_zalloc(ESIF_MEMTYPE_TYPE_EVENT, new_size);

	if (event_ptr) {
		event_ptr->version       = ESIF_EVENT_VERSION;
		event_ptr->size          = new_size;
		event_ptr->type          = type;
		event_ptr->priority      = priority;
		event_ptr->src           = src;
		event_ptr->dst           = dst;
		event_ptr->dst_domain_id = dst_domain_id;
		event_ptr->data_size     = size;

		/*
		 *  Assign Function Pointers If Any
		 */
#ifdef ESIF_EVENT_DEBUG
		event_ptr->get_type_str     = esif_event_type_str;
		event_ptr->get_priority_str = esif_event_priority_str;
		event_ptr->dump = esif_dump_event;
#endif

		/*
		** Transaction ID
		*/
		esif_ccb_write_lock(&g_event_lock);
		event_ptr->id = g_event_transaction_id++;
		esif_ccb_write_unlock(&g_event_lock);

		/*
		** Time Stamp
		*/
		esif_ccb_system_time(&event_ptr->timestamp);

		/*
		** Make A Copy Of The Data To Make Sure It Is Contigous
		** In The Buffer
		*/
		if (NULL != data_ptr)
			esif_ccb_memcpy((event_ptr + 1), data_ptr, size);

		ESIF_TRACE_DYN_EVENT("%s: buf %p bytes %d\n",
				     ESIF_FUNC,
				     event_ptr,
				     new_size);
		ESIF_TRACE_DYN_DECODE("Version:     %d\n"
				      "Type:        %s(%d)\n"
				      "ID:          %llu\n"
				      "Timestamp:   %llu\n"
				      "Priority:    %s(%d)\n"
				      "Source:      %d\n"
				      "Destination: %d\n"
				      "Data Size: %d\n",
				      event_ptr->version,
				      esif_event_type_str(event_ptr->type),
				      event_ptr->type,
				      event_ptr->id,
				      (u64)event_ptr->timestamp,
				      esif_event_priority_str(
					event_ptr->priority),
				      event_ptr->priority,
				      event_ptr->src,
				      event_ptr->dst,
				      event_ptr->data_size);
	}
	return event_ptr;
}