Exemplo n.º 1
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();
}
Exemplo n.º 2
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();
}
Exemplo n.º 3
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();
}
Exemplo n.º 4
0
void EsifAct_DestroyAction(
	EsifActPtr self
	)
{
	if (NULL == self) {
		goto exit;
	}

	self->markedForDelete = ESIF_TRUE;
	EsifAct_PutRef(self);

	ESIF_TRACE_INFO("Destroy action %d : waiting for delete event...\n", self->type);
	esif_ccb_event_wait(&self->deleteEvent);

	EsifAct_UnregisterEvents(self);

	EsifAct_CallIfaceDestroy(self);

	esif_ccb_event_uninit(&self->deleteEvent);
	esif_ccb_lock_uninit(&self->objLock);

	esif_ccb_free(self);
exit:
	return;
}
Exemplo n.º 5
0
/* Exit */
void esif_event_exit(void)
{
	esif_queue_destroy(g_event_queue);

	esif_ccb_lock_uninit(&g_event_lock);

	ESIF_TRACE_DYN_INIT("%s: Exit Event\n", ESIF_FUNC);
}
Exemplo n.º 6
0
void EsifDspMgrExit(void)
{
	ESIF_TRACE_ENTRY_INFO();

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

	ESIF_TRACE_EXIT_INFO();
}
Exemplo n.º 7
0
// destructor
static void DataVault_dtor(DataVaultPtr self)
{
	if (self) {
		DataCache_Destroy(self->cache);
		IOStream_Destroy(self->stream);
		esif_ccb_lock_uninit(&self->lock);
		WIPEPTR(self);
	}
}
Exemplo n.º 8
0
void DataBank_Destroy (DataBankPtr self)
{
	UInt32 idx;
	for (idx = 0; idx < self->size; idx++)
		DataVault_dtor(&self->elements[idx]);
	self->size = 0;
	esif_ccb_lock_uninit(&self->lock);
	esif_ccb_free(self);
}
Exemplo n.º 9
0
/* Exit manager */
void EsifUppMgrExit(void)
{
	/* Clean up resources */
	EsifUpManagerDestroyParticipants();

	/* Uninitialize Lock */
	esif_ccb_lock_uninit(&g_uppMgr.fLock);

	ESIF_TRACE_INFO("%s: Exit Upper Participant Manager (PM)", ESIF_FUNC);
}
Exemplo n.º 10
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();
}
Exemplo n.º 11
0
void esif_memtrace_exit()
{
	struct memalloc_s *mem = NULL;
	char tracefile[MAX_PATH] = {0};
	FILE *tracelog = NULL;

	esif_build_path(tracefile, sizeof(tracefile), ESIF_PATHTYPE_LOG, "memtrace.txt", NULL);
	esif_pathlist_exit();

	esif_ccb_write_lock(&g_memtrace.lock);
	mem = g_memtrace.allocated;
	g_memtrace.allocated = NULL;
	esif_ccb_write_unlock(&g_memtrace.lock);

	CMD_OUT("MemTrace: Allocs=" ATOMIC_FMT " Frees=" ATOMIC_FMT "\n", atomic_read(&g_memtrace.allocs), atomic_read(&g_memtrace.frees));
	if (!mem) {
		goto exit;
	}

	CMD_OUT("\n*** MEMORY LEAKS DETECTED ***\nFor details see %s\n", tracefile);
	esif_ccb_fopen(&tracelog, tracefile, "a");
	if (tracelog) {
		time_t now = time(NULL);
		char timestamp[MAX_CTIME_LEN] = {0};
		esif_ccb_ctime(timestamp, sizeof(timestamp), &now);
		fprintf(tracelog, "\n*** %.24s: MEMORY LEAKS DETECTED (%s) ***\n", timestamp, ESIF_UF_VERSION);
	}
	while (mem) {
		struct memalloc_s *node = mem;
		if (tracelog) {
			fprintf(tracelog, "[%s @%s:%d]: (%lld bytes) %p\n", mem->func, mem->file, mem->line, (long long)mem->size, mem->mem_ptr);
		}
		mem = mem->next;
		native_free(node->mem_ptr);
		native_free(node);
	}
	if (tracelog) {
		esif_ccb_fclose(tracelog);
	}
exit:
	esif_ccb_lock_uninit(&g_memtrace.lock);
}
Exemplo n.º 12
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();
}
Exemplo n.º 13
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();
}
Exemplo n.º 14
0
/*
 * This functions is expected to be called when the system is in a "known" state
 * where no attempts to create any timers are in flight as this function
 * destroys the lock controlling synchronization
 */
void esif_ccb_tmrm_exit(void)
{
	esif_ccb_timer_t cur_timer;

	if (!g_tmrm.enabled)
		goto exit;

	/* Mark to make sure no further timers are created */
	g_tmrm.marked_for_delete = ESIF_TRUE;

	/* Kill all existing timers and wait  for destruction */
	while(esif_ccb_tmrm_get_first_timer(&cur_timer) == ESIF_OK) {
		esif_ccb_timer_kill_w_wait(&cur_timer);
	}

	g_tmrm.enabled = ESIF_FALSE;
	esif_ccb_lock_uninit(&g_tmrm.mgr_lock);
	g_tmrm.marked_for_delete = ESIF_FALSE;

exit:
	return;
}
Exemplo n.º 15
0
/* Exit */
void esif_action_systemio_exit(void)
{
	ESIF_TRACE_DYN_INIT("Exit SYSTEMIO Action\n");
	esif_ccb_lock_uninit(&g_esif_action_systemio_lock);
}
Exemplo n.º 16
0
/* Exit */
void esif_action_mmio_exit(void)
{
	esif_ccb_lock_uninit(&g_esif_action_mmio_lock);
	ESIF_TRACE_DYN_INIT("Exit MMIO Action\n");
}