Exemplo n.º 1
0
eEsifError EsifAppsEventByDomainType(
	enum esif_domain_type domainType,
	eEsifEventType eventType,
	EsifDataPtr eventData
	)
{
	u8 i     = 0;
	u8 found = ESIF_FALSE;

	for (i = 0; i < MAX_PARTICIPANT_ENTRY; i++) {
		EsifUpPtr upPtr = EsifUpPm_GetAvailableParticipantByInstance(i);
		if (NULL == upPtr) {
			continue;
		}

		if (upPtr->fMetadata.fAcpiType == domainType) {
			found = ESIF_TRUE;
			EsifUp_PutRef(upPtr);
			break;
		}

		EsifUp_PutRef(upPtr);
	}

	if (ESIF_FALSE == found) {
		return ESIF_E_NOT_FOUND;
	} else {
		return EsifEventMgr_SignalEvent(i, EVENT_MGR_DOMAIN_NA, eventType, eventData);
	}
}
Exemplo n.º 2
0
static eEsifError ESIF_CALLCONV EsifActIface_ReceiveEventV1(
	const esif_handle_t participantHandle,
	enum esif_event_type eventType,
	UInt16 domain,
	const EsifDataPtr dataPtr
	)
{
	return EsifEventMgr_SignalEvent((UInt8)(size_t)participantHandle, domain, eventType, dataPtr);
}
Exemplo n.º 3
0
static eEsifError ActionConfigSignalChangeEvents(
	EsifUpPtr upPtr,
	const EsifPrimitiveTuple tuple,
	const EsifDataPtr requestPtr
	)
{
	eEsifError rc    = ESIF_OK;
	eEsifEventType targetEvent = 0;
	char domainStr[8] = "";
	esif_temp_t hysteresis_val = 0;
	esif_temp_t *hysteresis_ptr = NULL;
	esif_time_t polling_val = 0;
	esif_time_t *polling_ptr = NULL;

	ESIF_ASSERT(upPtr != NULL);

	switch (tuple.id) {
	case SET_TRIP_POINT_ACTIVE:
	case SET_TRIP_POINT_CRITICAL:
	case SET_TRIP_POINT_HOT:
	case SET_TRIP_POINT_PASSIVE:
	case SET_TRIP_POINT_WARM:
		targetEvent = ESIF_EVENT_PARTICIPANT_SPEC_INFO_CHANGED;
		break;
	case SET_THERMAL_RELATIONSHIP_TABLE:
		targetEvent = ESIF_EVENT_APP_THERMAL_RELATIONSHIP_CHANGED;
		break;
	case SET_PASSIVE_RELATIONSHIP_TABLE:
		targetEvent = ESIF_EVENT_PASSIVE_TABLE_CHANGED;
		break;
	case SET_ACTIVE_RELATIONSHIP_TABLE:
		targetEvent = ESIF_EVENT_APP_ACTIVE_RELATIONSHIP_CHANGED;
		break;
	case SET_ADAPTIVE_PERFORMANCE_CONDITIONS_TABLE:
		targetEvent = ESIF_EVENT_ADAPTIVE_PERFORMANCE_CONDITIONS_TABLE_CHANGED;
		break;
	case SET_ADAPTIVE_PERFORMANCE_ACTIONS_TABLE:
		targetEvent = ESIF_EVENT_ADAPTIVE_PERFORMANCE_ACTIONS_TABLE_CHANGED;
		break;
	case SET_ADAPTIVE_PERFORMANCE_PARTICIPANT_CONDITION_TABLE:
		targetEvent = ESIF_EVENT_ADAPTIVE_PERFORMANCE_PARTICIPANT_CONDITION_TABLE_CHANGED;
		break;
	case SET_VIRTUAL_SENSOR_CALIB_TABLE:
		targetEvent = ESIF_EVENT_VIRTUAL_SENSOR_CALIB_TABLE_CHANGED;
		break;
	case SET_VIRTUAL_SENSOR_POLLING_TABLE:
		targetEvent = ESIF_EVENT_VIRTUAL_SENSOR_POLLING_TABLE_CHANGED;
		break;
	case SET_RAPL_POWER_CONTROL_CAPABILITIES:
		targetEvent = ESIF_EVENT_DOMAIN_POWER_CAPABILITY_CHANGED;
		break;
	case SET_PROC_PERF_PSTATE_DEPTH_LIMIT:
	case SET_PERF_PSTATE_DEPTH_LIMIT:
	case SET_PERF_SUPPORT_STATE:
		targetEvent = ESIF_EVENT_DOMAIN_PERF_CAPABILITY_CHANGED;
		break;
	case SET_TEMPERATURE:
		targetEvent = ESIF_EVENT_DOMAIN_TEMP_THRESHOLD_CROSSED;
		break;
	case SET_TEMPERATURE_THRESHOLD_HYSTERESIS:
		targetEvent = ESIF_EVENT_PARTICIPANT_SPEC_INFO_CHANGED;
		if (requestPtr != NULL) {
			if (requestPtr->buf_ptr == NULL) {
				rc = ESIF_E_PARAMETER_IS_NULL;
				goto exit;
			}
			hysteresis_val = *(esif_temp_t *)requestPtr->buf_ptr;
			hysteresis_ptr = &hysteresis_val;

			esif_primitive_domain_str(tuple.domain, domainStr, sizeof(domainStr));
			ESIF_TRACE_DEBUG("Hysteresis changed for domain:%s\n", domainStr);
			EsifUp_UpdateHysteresis(upPtr, tuple.domain, hysteresis_ptr);
		}
		break;
	case SET_PARTICIPANT_SAMPLE_PERIOD:
		targetEvent = 0;
		if (requestPtr != NULL) {
			if (requestPtr->buf_ptr == NULL) {
				rc = ESIF_E_PARAMETER_IS_NULL;
				goto exit;
			}
			polling_val = *(esif_time_t *)requestPtr->buf_ptr;
			polling_ptr = &polling_val;

			esif_primitive_domain_str(tuple.domain, domainStr, sizeof(domainStr));
			ESIF_TRACE_DEBUG("Participant sample period changed for domain:%s\n", domainStr);
			EsifUp_UpdatePolling(upPtr, tuple.domain, polling_ptr);
		}
		break;
	case SET_DISPLAY_BRIGHTNESS_LEVELS:
	case SET_DISPLAY_CAPABILITY:
	case SET_DISPLAY_DEPTH_LIMIT:
		targetEvent = ESIF_EVENT_DOMAIN_DISPLAY_CAPABILITY_CHANGED;
		break;
	case SET_POWER_BOSS_CONDITIONS_TABLE:
		targetEvent = ESIF_EVENT_POWER_BOSS_CONDITIONS_TABLE_CHANGED;
		break;
	case SET_POWER_BOSS_ACTIONS_TABLE:
		targetEvent = ESIF_EVENT_POWER_BOSS_ACTIONS_TABLE_CHANGED;
		break;
	case SET_POWER_BOSS_MATH_TABLE:
		targetEvent = ESIF_EVENT_POWER_BOSS_MATH_TABLE_CHANGED;
		break;
	case SET_EMERGENCY_CALL_MODE_TABLE:
		targetEvent = ESIF_EVENT_EMERGENCY_CALL_MODE_TABLE_CHANGED;
		break;
	case SET_PID_ALGORITHM_TABLE:
		targetEvent = ESIF_EVENT_PID_ALGORITHM_TABLE_CHANGED;
		break;
	case SET_ACTIVE_CONTROL_POINT_RELATIONSHIP_TABLE:
		targetEvent = ESIF_EVENT_ACTIVE_CONTROL_POINT_RELATIONSHIP_TABLE_CHANGED;
		break;
	default:
		targetEvent = 0;
		break;
	}
	if (targetEvent > 0) {
		EsifEventMgr_SignalEvent(EsifUp_GetInstance(upPtr), tuple.domain, targetEvent, NULL);
	}	
exit:
	return rc;
}
Exemplo n.º 4
0
void EsifEvent_SignalIpcEvent(struct esif_ipc_event *eventHdrPtr)
{
#ifdef ESIF_FEAT_OPT_ACTION_SYSFS
	UNREFERENCED_PARAMETER(domainStr);
#else
	eEsifError rc = ESIF_OK;
	EsifData binaryData = {ESIF_DATA_BINARY, NULL, 0, 0};
	EsifData voidData = {ESIF_DATA_VOID, NULL, 0};
	EsifDataPtr dataPtr = NULL;
	UInt8 participantId;
	char domainStr[8] = "";
	esif_ccb_time_t now;

	UNREFERENCED_PARAMETER(domainStr);

	esif_ccb_system_time(&now);

	ESIF_TRACE_DEBUG(
		"\n"
		"===================================================\n"
		"ESIF IPC EVENT HEADER: Timestamp: %llu\n"
		"                         Latency: %u msec\n"
		"===================================================\n"
		"Version:     %d\n"
		"Type:        %s(%d)\n"
		"ID:          %llu\n"
		"Timestamp:   %llu\n"
		"Priority:    %s(%d)\n"
		"Source:      %d\n"
		"Dest:        %d\n"
		"Dest Domain: %s(%04X)\n"
		"Data Size:   %u\n\n",
		(u64)now,
		(int)(now - eventHdrPtr->timestamp),
		eventHdrPtr->version,
		esif_event_type_str(eventHdrPtr->type),
		eventHdrPtr->type,
		eventHdrPtr->id,
		eventHdrPtr->timestamp,
		esif_event_priority_str(eventHdrPtr->priority),
		eventHdrPtr->priority,
		eventHdrPtr->src_id,
		eventHdrPtr->dst_id,
		esif_primitive_domain_str(eventHdrPtr->dst_domain_id, domainStr, 8),
		eventHdrPtr->dst_domain_id,
		eventHdrPtr->data_len);

	dataPtr = &voidData;
	if (eventHdrPtr->data_len > 0) {
		binaryData.buf_ptr = eventHdrPtr + 1;
		binaryData.buf_len = eventHdrPtr->data_len;
		binaryData.data_len = eventHdrPtr->data_len;
		dataPtr = &binaryData;
	}

	/*
	* If the mapping function fails, we assume that the participant hasn't been created
	* In that case, we use 0 for the participant as the real ID will be gathered from
	* the creation data.
	*/
	participantId = eventHdrPtr->dst_id;
	if (eventHdrPtr->dst_id == ESIF_INSTANCE_UF) {
		rc = EsifUpPm_MapLpidToParticipantInstance(eventHdrPtr->src_id, &participantId);
		if (rc != ESIF_OK) {
			participantId = 0;
		}
	}

	// Best Effort Delivery
	EsifEventMgr_SignalEvent(participantId, eventHdrPtr->dst_domain_id, eventHdrPtr->type, dataPtr);

	return;
#endif
}
Exemplo n.º 5
0
static eEsifError ActionConfigSignalChangeEvents(
	EsifUpPtr upPtr,
	const EsifFpcPrimitivePtr primitivePtr,
	const EsifDataPtr requestPtr
	)
{
	eEsifError rc    = ESIF_OK;
	eEsifEventType targetEvent = 0;
	char domainStr[8] = "";
	struct esif_data voidData = {ESIF_DATA_VOID, NULL, 0};

	ESIF_ASSERT(upPtr != NULL);
	ESIF_ASSERT(primitivePtr != NULL);
	ESIF_ASSERT(requestPtr != NULL);

	switch (primitivePtr->tuple.id) {
	case SET_TRIP_POINT_ACTIVE:
	case SET_TRIP_POINT_CRITICAL:
	case SET_TRIP_POINT_HOT:
	case SET_TRIP_POINT_PASSIVE:
	case SET_TRIP_POINT_WARM:
		targetEvent = ESIF_EVENT_PARTICIPANT_SPEC_INFO_CHANGED;
		break;
	case SET_THERMAL_RELATIONSHIP_TABLE:
		targetEvent = ESIF_EVENT_APP_THERMAL_RELATIONSHIP_CHANGED;
		break;
	case SET_PASSIVE_RELATIONSHIP_TABLE:
		targetEvent = ESIF_EVENT_PASSIVE_TABLE_CHANGED;
		break;
	case SET_ACTIVE_RELATIONSHIP_TABLE:
		targetEvent = ESIF_EVENT_APP_ACTIVE_RELATIONSHIP_CHANGED;
		break;
	case SET_ADAPTIVE_PERFORMANCE_CONDITIONS_TABLE:
		targetEvent = ESIF_EVENT_ADAPTIVE_PERFORMANCE_CONDITIONS_CHANGED;
		break;
	case SET_ADAPTIVE_PERFORMANCE_ACTIONS_TABLE:
		targetEvent = ESIF_EVENT_ADAPTIVE_PERFORMANCE_ACTIONS_CHANGED;
		break;
	case SET_VIRTUAL_SENSOR_CALIB_TABLE:
		targetEvent = ESIF_EVENT_VIRTUAL_SENSOR_CALIB_TABLE_CHANGED;
		break;
	case SET_VIRTUAL_SENSOR_POLLING_TABLE:
		targetEvent = ESIF_EVENT_VIRTUAL_SENSOR_POLLING_TABLE_CHANGED;
		break;
	case SET_RAPL_POWER_CONTROL_CAPABILITIES:
		targetEvent = ESIF_EVENT_DOMAIN_POWER_CAPABILITY_CHANGED;
		break;
	case SET_PROC_PERF_PSTATE_DEPTH_LIMIT:
	case SET_PERF_PSTATE_DEPTH_LIMIT:
	case SET_PERF_SUPPORT_STATE:
		targetEvent = ESIF_EVENT_DOMAIN_PERF_CAPABILITY_CHANGED;
		break;
	case SET_TEMPERATURE:
		targetEvent = ESIF_EVENT_DOMAIN_TEMP_THRESHOLD_CROSSED;
		break;
	case SET_TEMPERATURE_THRESHOLD_HYSTERESIS:
		targetEvent = ESIF_EVENT_PARTICIPANT_SPEC_INFO_CHANGED;
		if (requestPtr->buf_ptr == NULL) {
			rc = ESIF_E_PARAMETER_IS_NULL;
			goto exit;
		}
		esif_primitive_domain_str(primitivePtr->tuple.domain, domainStr, sizeof(domainStr));
		ESIF_TRACE_DEBUG("Hysteresis changed for domain:%s\n", domainStr);
		EsifUp_UpdateHysteresis(upPtr, primitivePtr->tuple.domain, *(esif_temp_t *) requestPtr->buf_ptr);
		break;
	case SET_PARTICIPANT_SAMPLE_PERIOD:
		targetEvent = 0;
		if (requestPtr->buf_ptr == NULL) {
			rc = ESIF_E_PARAMETER_IS_NULL;
			goto exit;
		}
		esif_primitive_domain_str(primitivePtr->tuple.domain, domainStr, sizeof(domainStr));
		ESIF_TRACE_DEBUG("Participant sample period changed for domain:%s\n", domainStr);
		EsifUp_UpdatePolling(upPtr, primitivePtr->tuple.domain, *(UInt32 *) requestPtr->buf_ptr);
		break;
	case SET_DISPLAY_BRIGHTNESS_LEVELS:
	case SET_DISPLAY_CAPABILITY:
	case SET_DISPLAY_DEPTH_LIMIT:
		targetEvent = ESIF_EVENT_DOMAIN_DISPLAY_CAPABILITY_CHANGED;
		break;
	case SET_PDR_TABLE:
		targetEvent = ESIF_EVENT_OS_POWER_SOURCE_CHANGED;
		break;
	default:
		targetEvent = 0;
		break;
	}
	if (targetEvent > 0) {
		EsifEventMgr_SignalEvent(upPtr->fInstance, primitivePtr->tuple.domain, targetEvent, &voidData);
	}	
exit:
	return rc;
}
Exemplo n.º 6
0
/* Will sync any existing lower framework participatnts */
enum esif_rc sync_lf_participants()
{
	eEsifError rc = ESIF_OK;
	struct esif_command_get_participants *data_ptr = NULL;
	const UInt32 data_len = sizeof(struct esif_command_get_participants);
	struct esif_ipc_command *command_ptr = NULL;
	UInt8 i = 0;
	UInt32 count = 0;
	struct esif_ipc *ipc_ptr = NULL;
	
	ESIF_TRACE_ENTRY_INFO();
	
	ipc_ptr = esif_ipc_alloc_command(&command_ptr, data_len);
	if (NULL == ipc_ptr || NULL == command_ptr) {
		ESIF_TRACE_ERROR("Fail to allocate esif_ipc/esif_ipc_command\n");
		rc = ESIF_E_NO_MEMORY;
		goto exit;
	}

	command_ptr->type = ESIF_COMMAND_TYPE_GET_PARTICIPANTS;
	command_ptr->req_data_type   = ESIF_DATA_VOID;
	command_ptr->req_data_offset = 0;
	command_ptr->req_data_len    = 0;
	command_ptr->rsp_data_type   = ESIF_DATA_STRUCTURE;
	command_ptr->rsp_data_offset = 0;
	command_ptr->rsp_data_len    = data_len;

	rc = ipc_execute(ipc_ptr);
	if (ESIF_OK != rc) {
		goto exit;
	}

	if (ESIF_OK != ipc_ptr->return_code) {
		rc = ipc_ptr->return_code;
		ESIF_TRACE_WARN("ipc_ptr return_code failure - %s\n", esif_rc_str(rc));
		goto exit;
	}

	if (ESIF_OK != command_ptr->return_code) {
		rc = command_ptr->return_code;
		ESIF_TRACE_WARN("command_ptr return_code failure - %s\n", esif_rc_str(rc));
		goto exit;
	}

	/* Participant Data */
	data_ptr = (struct esif_command_get_participants *)(command_ptr + 1);
	count    = data_ptr->count;

	for (i = 0; i < count; i++) {
		struct esif_ipc_event_data_create_participant participantData;
		EsifData esifParticipantData = {ESIF_DATA_BINARY, &participantData, sizeof(participantData), sizeof(participantData)};

		rc = get_participant_data(&participantData, i);
		if (ESIF_OK != rc) {
			rc = ESIF_OK; /* Ignore RC for get_participant_data */
			continue;
		}
		EsifEventMgr_SignalEvent(0, EVENT_MGR_DOMAIN_D0, ESIF_EVENT_PARTICIPANT_CREATE, &esifParticipantData);
	}
exit:
	ESIF_TRACE_INFO("rc = %s(%u)", esif_rc_str(rc), rc);

	if (NULL != ipc_ptr) {
		esif_ipc_free(ipc_ptr);
	}

	ESIF_TRACE_EXIT_INFO_W_STATUS(rc);
	return rc;
}