Ejemplo n.º 1
0
void EsifActConfigExit()
{
	if (NULL != g_actMgr.RemoveActType) {
		g_actMgr.RemoveActType(&g_actMgr, 0);
	}
	ESIF_TRACE_EXIT_INFO();
}
Ejemplo n.º 2
0
void EsifActExit()
{
	EsifActConfigExit();
	EsifActConstExit();
	EsifActSystemExit();
	ESIF_TRACE_EXIT_INFO();
}
Ejemplo n.º 3
0
void EsifAppMgrExit()
{
	u8 i = 0;
	EsifAppPtr a_app_ptr = NULL;

	ESIF_TRACE_ENTRY_INFO();

	EsifEventMgr_UnregisterEventByType(ESIF_EVENT_PARTICIPANT_SUSPEND, EVENT_MGR_MATCH_ANY, EVENT_MGR_DOMAIN_D0, EsifAppMgr_EventCallback, NULL);
	EsifEventMgr_UnregisterEventByType(ESIF_EVENT_PARTICIPANT_RESUME, EVENT_MGR_MATCH_ANY, EVENT_MGR_DOMAIN_D0, EsifAppMgr_EventCallback, NULL);

	EsifAppExit();
	ESIF_TRACE_DEBUG("Exit Action Manager (APPMGR)");

	esif_ccb_read_lock(&g_appMgr.fLock);
	for (i = 0; i < ESIF_MAX_APPS; i++) {
		a_app_ptr = &g_appMgr.fEntries[i];

		// Attempt to gracefully shutdown App before forcing library unload
		if (a_app_ptr->fLibNamePtr != NULL) {
			EsifAppStop(a_app_ptr);
		}
		if (a_app_ptr->fLibNamePtr != NULL) {
			esif_ccb_library_unload(a_app_ptr->fLibHandle);
			esif_ccb_free(a_app_ptr->fLibNamePtr);
			esif_ccb_memset(a_app_ptr, 0, sizeof(*a_app_ptr));
		}
	}
	esif_ccb_read_unlock(&g_appMgr.fLock);

	esif_ccb_lock_uninit(&g_appMgr.fLock);

	ESIF_TRACE_EXIT_INFO();
}
Ejemplo n.º 4
0
void EsifEventMgr_Exit(void)
{
	UInt8 i;
	EsifLinkListPtr listPtr = NULL;

	ESIF_TRACE_ENTRY_INFO();

	/* Remove all listeners */
	esif_ccb_write_lock(&g_EsifEventMgr.listLock);

	for (i = 0; i < NUM_EVENT_LISTS; i++) {
		listPtr = g_EsifEventMgr.observerLists[i];
		esif_link_list_free_data_and_destroy(listPtr, EsifEventMgr_LLEntryDestroyCallback);
		g_EsifEventMgr.observerLists[i] = NULL;
	}

	esif_ccb_write_unlock(&g_EsifEventMgr.listLock);

	/* Destroy the event thread */

	/* Event thread should already be destroyed in the disable func. Destroy the queue */
	esif_queue_destroy(g_EsifEventMgr.eventQueuePtr, EsifEventMgr_QueueDestroyCallback);
	g_EsifEventMgr.eventQueuePtr = NULL;


	/* Destroy the garbage list */
	esif_ccb_write_lock(&g_EsifEventMgr.listLock);
	esif_link_list_free_data_and_destroy(g_EsifEventMgr.garbageList, EsifEventMgr_LLEntryDestroyCallback);
	g_EsifEventMgr.garbageList = NULL;
	esif_ccb_write_unlock(&g_EsifEventMgr.listLock);

	esif_ccb_lock_uninit(&g_EsifEventMgr.listLock);

	ESIF_TRACE_EXIT_INFO();
}
Ejemplo n.º 5
0
void EsifActMgrExit()
{
	u8 i = 0;
	EsifActPtr a_act_ptr = NULL;

	ESIF_TRACE_ENTRY_INFO();

	/* Call before destroying action manager */
	EsifActExit();

	if (NULL != g_actMgr.fActTypes) {
		esif_link_list_destroy(g_actMgr.fActTypes);
		g_actMgr.fActTypes = NULL;  //set to null so that it will be caught if mid-execution
	}

	esif_ccb_read_lock(&g_actMgr.fLock);
	for (i = 0; i < ESIF_MAX_ACTIONS; i++) {
		a_act_ptr = &g_actMgr.fEnrtries[i];
		esif_ccb_free(a_act_ptr->fLibNamePtr);
		esif_ccb_library_unload(a_act_ptr->fLibHandle);
		esif_ccb_memset(a_act_ptr, 0, sizeof(*a_act_ptr));
	}
	esif_ccb_read_unlock(&g_actMgr.fLock);

	esif_ccb_lock_uninit(&g_actMgr.fLock);

	ESIF_TRACE_EXIT_INFO();
}
Ejemplo n.º 6
0
enum esif_rc EsifActSystemInit()
{
	if (NULL != g_actMgr.AddActType) {
		g_actMgr.AddActType(&g_actMgr, &g_system);
	}
	ESIF_TRACE_EXIT_INFO();
	return ESIF_OK;
}
Ejemplo n.º 7
0
eEsifError EsifActInit()
{
	EsifActConfigInit();
	EsifActConstInit();
	EsifActSystemInit();
	ESIF_TRACE_EXIT_INFO();
	return ESIF_OK;
}
Ejemplo n.º 8
0
enum esif_rc EsifActConfigInit()
{
	if (NULL != g_actMgr.AddActType) {
		g_actMgr.AddActType(&g_actMgr, &g_config);
	}
	ESIF_TRACE_EXIT_INFO();
	return ESIF_OK;
}
Ejemplo n.º 9
0
static void *ESIF_CALLCONV esif_web_worker_thread(void *ptr)
{
	UNREFERENCED_PARAMETER(ptr);

	ESIF_TRACE_ENTRY_INFO();
	esif_ws_init();
	ESIF_TRACE_EXIT_INFO();
	return 0;
}
Ejemplo n.º 10
0
void EsifDspMgrExit(void)
{
	ESIF_TRACE_ENTRY_INFO();

	esif_dsp_table_destroy();
	esif_ccb_lock_uninit(&g_dm.lock);

	ESIF_TRACE_EXIT_INFO();
}
Ejemplo n.º 11
0
static void EsifActMgr_UninitActions()
{
	EsifActConfigExit();
	EsifActConstExit();
	EsifActSystemExit();
	EsifActDelegateExit();
	esif_ccb_imp_spec_actions_exit();
	ESIF_TRACE_EXIT_INFO();
}
Ejemplo n.º 12
0
void EsifEventMgr_Disable(void)
{
	ESIF_TRACE_ENTRY_INFO();

	/* Release and destroy the event thread */
	g_EsifEventMgr.eventQueueExitFlag = ESIF_TRUE;
	esif_queue_signal_event(g_EsifEventMgr.eventQueuePtr);
	esif_ccb_thread_join(&g_EsifEventMgr.eventQueueThread);

	ESIF_TRACE_EXIT_INFO();
}
Ejemplo n.º 13
0
// IPC Disconnect
void ipc_disconnect()
{
	ESIF_TRACE_ENTRY_INFO();

	if (g_ipc_handle != ESIF_INVALID_HANDLE) {
		esif_ipc_disconnect(g_ipc_handle);
		g_ipc_handle = ESIF_INVALID_HANDLE;
		ESIF_TRACE_DEBUG("ESIF IPC Kernel Device Closed\n");
	}

	ESIF_TRACE_EXIT_INFO();
}
Ejemplo n.º 14
0
static eEsifError EsifActMgr_InitActions()
{
	EsifActMgr_RegisterDelayedLoadAction(ESIF_ACTION_DPTFWWAN);

	EsifActConfigInit();
	EsifActConstInit();
	EsifActSystemInit();
	EsifActDelegateInit();
	esif_ccb_imp_spec_actions_init();
	ESIF_TRACE_EXIT_INFO();
	return ESIF_OK;
}
Ejemplo n.º 15
0
eEsifError EsifCnjMgrInit()
{
    eEsifError rc = ESIF_OK;

    ESIF_TRACE_DEBUG("%s: Init Action Manager (CNJMGR)", ESIF_FUNC);

    esif_ccb_lock_init(&g_cnjMgr.fLock);

    EsifCnjInit();

    ESIF_TRACE_EXIT_INFO();
    return rc;
}
Ejemplo n.º 16
0
// Event Worker Thread
// Processes ESIF Events
void *esif_event_worker_thread(void *ptr)
{
	int rc = 0;
	fd_set rfds = {0};
	struct timeval tv = {0};

	UNREFERENCED_PARAMETER(ptr);
	ESIF_TRACE_ENTRY_INFO();
	CMD_OUT("Start ESIF Event Thread\n");

	// Connect To Kernel IPC with infinite timeout
	ipc_autoconnect(0);

	// Run Until Told To Quit
	while (!g_quit) {
#ifdef ESIF_FEAT_OPT_ACTION_SYSFS
		esif_ccb_sleep_msec(250);
#else
		if (g_ipc_handle == ESIF_INVALID_HANDLE) {
			break;
		}
		if (rc > 0) {
			EsifEvent_GetAndSignalIpcEvent();
		}
		FD_ZERO(&rfds);
		FD_SET((esif_ccb_socket_t)g_ipc_handle, &rfds);
		tv.tv_sec  = 0;
		tv.tv_usec = 50000;	/* 50 msec */

#ifdef ESIF_ATTR_OS_LINUX
		rc = select(g_ipc_handle + 1, &rfds, NULL, NULL, &tv);
#endif
		
#ifdef ESIF_ATTR_OS_WINDOWS
		// Windows does not support select/poll so we simulate here
		esif_ccb_sleep_msec(50);
		rc = 1;
#endif
		
#endif
	}

	if (g_ipc_handle != ESIF_INVALID_HANDLE) {
		ipc_disconnect();
	}

	ESIF_TRACE_EXIT_INFO();
	return 0;
}
Ejemplo n.º 17
0
void esif_memtrace_init()
{
	struct memalloc_s *mem = NULL;

	esif_ccb_lock_init(&g_memtrace.lock);
	esif_ccb_write_lock(&g_memtrace.lock);
	mem = g_memtrace.allocated;

	// Ignore any allocations made before this function was called
	while (mem) {
		struct memalloc_s *node = mem;
		mem = mem->next;
		native_free(node);
	}
	g_memtrace.allocated = NULL;
	esif_ccb_write_unlock(&g_memtrace.lock);
	ESIF_TRACE_EXIT_INFO();
}
Ejemplo n.º 18
0
void EsifLogMgrExit(void)
{
	int j;

	ESIF_TRACE_ENTRY_INFO();

	for (j=0; j < MAX_ESIFLOG; j++) {
		if (g_EsifLogFile[j].handle != NULL) {
			esif_ccb_fclose(g_EsifLogFile[j].handle);
		}
		esif_ccb_free(g_EsifLogFile[j].name);
		esif_ccb_free(g_EsifLogFile[j].filename);
		esif_ccb_lock_uninit(&g_EsifLogFile[j].lock);
	}
	esif_ccb_memset(g_EsifLogFile, 0, sizeof(g_EsifLogFile));

	ESIF_TRACE_EXIT_INFO();
}
Ejemplo n.º 19
0
eEsifError EsifLogMgrInit(void)
{
	int j;

	ESIF_TRACE_ENTRY_INFO();

	esif_ccb_memset(g_EsifLogFile, 0, sizeof(g_EsifLogFile));
	for (j=0; j < MAX_ESIFLOG; j++) {
		esif_ccb_lock_init(&g_EsifLogFile[j].lock);
	}
	g_EsifLogFile[ESIF_LOG_EVENTLOG].name = esif_ccb_strdup("event");
	g_EsifLogFile[ESIF_LOG_DEBUGGER].name = esif_ccb_strdup("debug");
	g_EsifLogFile[ESIF_LOG_SHELL].name    = esif_ccb_strdup("shell");
	g_EsifLogFile[ESIF_LOG_TRACE].name    = esif_ccb_strdup("trace");
	g_EsifLogFile[ESIF_LOG_UI].name       = esif_ccb_strdup("ui");

	ESIF_TRACE_EXIT_INFO();
	return ESIF_OK;
}
Ejemplo n.º 20
0
void EsifActMgrExit()
{
	ESIF_TRACE_ENTRY_INFO();

	/* Call before destroying action manager */
	EsifActMgr_UninitActions();

	esif_ccb_write_lock(&g_actMgr.mgrLock);

	esif_link_list_free_data_and_destroy(g_actMgr.actions, EsifActMgr_LLEntryDestroyCallback);
	g_actMgr.actions = NULL;

	esif_link_list_free_data_and_destroy(g_actMgr.possibleActions, EsifActMgr_LLEntryDestroyCallback);
	g_actMgr.possibleActions = NULL;

	esif_ccb_write_unlock(&g_actMgr.mgrLock);

	esif_ccb_lock_uninit(&g_actMgr.mgrLock);

	ESIF_TRACE_EXIT_INFO();
}
Ejemplo n.º 21
0
void EsifCnjMgrExit()
{
    u8 i = 0;
    EsifCnjPtr a_conjure_ptr = NULL;

    EsifCnjExit();
    ESIF_TRACE_DEBUG("%s: Exit Action Manager (CNJMGR)", ESIF_FUNC);

    esif_ccb_read_lock(&g_cnjMgr.fLock);
    for (i = 0; i < ESIF_MAX_CONJURES; i++) {
        a_conjure_ptr = &g_cnjMgr.fEnrtries[i];
        esif_ccb_free(a_conjure_ptr->fLibNamePtr);
        esif_ccb_library_unload(a_conjure_ptr->fLibHandle);
        esif_ccb_memset(a_conjure_ptr, 0, sizeof(*a_conjure_ptr));
    }
    esif_ccb_read_unlock(&g_cnjMgr.fLock);

    esif_ccb_lock_uninit(&g_cnjMgr.fLock);

    ESIF_TRACE_EXIT_INFO();
}
Ejemplo n.º 22
0
void esif_uf_exit()
{
	/* Stop event thread */
	g_quit = ESIF_TRUE;

	/* Stop web server if it is running */
	EsifWebStop();
	EsifDataLogStop();
	EsifUFPollStop();

	/* Stop all Apps before dependent components they may be using */
	EsifAppMgrExit();

	/* OS Specific */
	esif_uf_os_exit();

	/* OS Agnostic - Call in reverse order of Init */
	EsifUpPm_Exit();
	EsifActMgrExit();
	EsifDspMgrExit();
	EsifEventMgr_Exit();
	EsifCnjMgrExit();
	EsifCfgMgrExit();
	EsifLogMgrExit();
	esif_ccb_tmrm_exit();
	esif_ht_exit();
	esif_link_list_exit();
	esif_ccb_mempool_uninit_tracking();

	// Re-Initialize necessary global variables in case ESIF restarted
	g_esif_started = ESIF_FALSE;

	ESIF_TRACE_DEBUG("Exit Upper Framework (UF)");


#ifdef ESIF_ATTR_SHELL_LOCK
	esif_ccb_mutex_uninit(&g_shellLock);
#endif
	ESIF_TRACE_EXIT_INFO();
}
Ejemplo n.º 23
0
static void *ESIF_CALLCONV EsifDataLogWorkerThread(void *ptr)
{
	eEsifError rc = ESIF_OK;

	UNREFERENCED_PARAMETER(ptr);

	ESIF_TRACE_ENTRY_INFO();

	while (!g_dataLogQuit) {
		esif_ccb_time_t msecStart = 0;
		esif_ccb_time_t msecStop = 0;
		esif_ccb_time_t msecDif = 0;
		UInt32 sleepMs = 0;

		esif_ccb_system_time(&msecStart);
		EsifDataLogFire(0);
		esif_ccb_system_time(&msecStop);

		/* Determine how long processing actually took */
		msecDif = msecStop - msecStart;

		/* Determine next sleep time based on previous processing time*/
		sleepMs = g_dataLogInterval - ((int) msecDif);
		if ((sleepMs < MIN_STATUS_LOG_INTERVAL_ADJUSTED) || (msecDif > g_dataLogInterval)){
			sleepMs = MIN_STATUS_LOG_INTERVAL_ADJUSTED;
		}

		rc = EsifTimedEventWait(&g_dataLogQuitEvent, sleepMs);
		if (rc != ESIF_OK) {
			ESIF_TRACE_ERROR("Error waiting on data log event\n");
			goto exit;
		}
	}
exit:
	ESIF_TRACE_EXIT_INFO();
	return 0;
}
Ejemplo n.º 24
0
void EsifActConfigExit()
{
	EsifActMgr_UnregisterAction((EsifActIfacePtr)&g_config);
	ESIF_TRACE_EXIT_INFO();
}
Ejemplo n.º 25
0
eEsifError EsifActConfigInit()
{
	EsifActMgr_RegisterAction((EsifActIfacePtr)&g_config);
	ESIF_TRACE_EXIT_INFO();
	return ESIF_OK;
}
Ejemplo n.º 26
0
eEsifError EsifActDelegateInit()
{
	EsifActMgr_RegisterAction((EsifActIfacePtr)&g_delegate);
	ESIF_TRACE_EXIT_INFO();
	return ESIF_OK;
}
Ejemplo n.º 27
0
void EsifActDelegateExit()
{
	EsifActMgr_UnregisterAction((EsifActIfacePtr)&g_delegate);
	ESIF_TRACE_EXIT_INFO();
}
Ejemplo n.º 28
0
/* Create A Conjure Library */
static eEsifError ConjureCreate(
	EsifCnjPtr conjurePtr,
	GetIfaceFuncPtr ifaceFuncPtr
	)
{
	eEsifError rc = ESIF_OK;
	EsifConjureServiceInterface conjure_service_iface;

	char name[ESIF_NAME_LEN] = "";
	ESIF_DATA(data_name, ESIF_DATA_STRING, name, ESIF_NAME_LEN);

	char desc[ESIF_DESC_LEN] = "";
	ESIF_DATA(data_desc, ESIF_DATA_STRING, desc, ESIF_DESC_LEN);

	char version[ESIF_DESC_LEN] = "";
	ESIF_DATA(data_version, ESIF_DATA_STRING, version, ESIF_DESC_LEN);

	ESIF_ASSERT(conjurePtr != NULL);
	ESIF_ASSERT(ifaceFuncPtr != NULL);

	/* Assign the EsifInterface Functions */
	conjure_service_iface.fIfaceType    = eIfaceTypeConjureService;
	conjure_service_iface.fIfaceVersion = 1;
	conjure_service_iface.fIfaceSize    = (UInt16)sizeof(EsifConjureServiceInterface);

	conjure_service_iface.fRegisterParticipantFuncPtr   = RegisterParticipant;
	conjure_service_iface.fUnRegisterParticipantFuncPtr = UnRegisterParticipant;

	/* GetConjureInterface Handleshake send ESIF receive APP Interface */
	rc = ifaceFuncPtr(&conjurePtr->fInterface);
	if (ESIF_OK != rc) {
		goto exit;
	}

	/* Check EsifAppInterface */
	if (conjurePtr->fInterface.fIfaceType != eIfaceTypeConjure ||
		conjurePtr->fInterface.fIfaceSize != (UInt16)sizeof(EsifConjureInterface) ||
		conjurePtr->fInterface.fIfaceVersion != 1 ||

		/* Functions Pointers */
		conjurePtr->fInterface.fConjureCreateFuncPtr == NULL ||
		conjurePtr->fInterface.fConjureDestroyFuncPtr == NULL ||
		conjurePtr->fInterface.fConjureGetAboutFuncPtr == NULL ||
		conjurePtr->fInterface.fConjureGetDescriptionFuncPtr == NULL ||
		conjurePtr->fInterface.fConjureGetGuidFuncPtr == NULL ||
		conjurePtr->fInterface.fConjureGetNameFuncPtr == NULL ||
		conjurePtr->fInterface.fConjureGetVersionFuncPtr == NULL) {
		ESIF_TRACE_ERROR("The required function pointer of EsifConjureInterface is NULL\n");
		goto exit;
	}

	/* Callback for application information */
	rc = conjurePtr->fInterface.fConjureGetNameFuncPtr(&data_name);
	if (ESIF_OK != rc) {
		goto exit;
	}
	rc = conjurePtr->fInterface.fConjureGetDescriptionFuncPtr(&data_desc);
	if (ESIF_OK != rc) {
		goto exit;
	}

	rc = conjurePtr->fInterface.fConjureGetVersionFuncPtr(&data_version);
	if (ESIF_OK != rc) {
		goto exit;
	}

	ESIF_TRACE_DEBUG("%s\n\n"
					 "Conjure Lib Name   : %s\n"
					 "Conjure Lib Desc   : %s\n"
					 "Conjure Lib Type   : %s\n"
					 "Conjure Lib Version: %s\n\n",
					 ESIF_FUNC,
					 (EsifString)data_name.buf_ptr,
					 (EsifString)data_desc.buf_ptr,
					 (EsifString)"plugin",
					 (EsifString)data_version.buf_ptr);

	/* Create The Conjure */
	rc = conjurePtr->fInterface.fConjureCreateFuncPtr(
			&conjure_service_iface,
			NULL,
			&conjurePtr->fHandle);

	if (ESIF_OK != rc) {
		goto exit;
	}
exit:
	ESIF_TRACE_EXIT_INFO();
	return ESIF_OK;
}