static eEsifError EsifSetActionDelegatePat1( const EsifUpDomainPtr domainPtr, const EsifDataPtr requestPtr) { eEsifError rc = ESIF_OK; u32 tempThreshold = ESIF_DOMAIN_TEMP_INVALID; EsifPrimitiveTuple auxTuple = {SET_TEMPERATURE_THRESHOLDS_SUR, 0, (UInt8)ESIF_DOMAIN_AUX1}; ESIF_ASSERT(domainPtr != NULL); ESIF_ASSERT(requestPtr != NULL); if (requestPtr->buf_ptr == NULL) { rc = ESIF_E_PARAMETER_IS_NULL; goto exit; } tempThreshold = *(u32 *) requestPtr->buf_ptr; ESIF_TRACE_DEBUG("Setting AUX1 = %d\n", tempThreshold); EsifUpDomain_SetTempThresh(domainPtr, ESIF_DOMAIN_AUX1, tempThreshold); auxTuple.domain = domainPtr->domain; rc = EsifUp_ExecutePrimitive(domainPtr->upPtr, &auxTuple, requestPtr, NULL); if (rc == ESIF_E_PRIMITIVE_NOT_FOUND_IN_DSP) rc = ESIF_OK; exit: return rc; }
static enum esif_rc esif_ccb_timer_obj_create( const esif_ccb_timer_cb function_ptr, /* Callback when timer fires */ void *context_ptr, /* Callback context if any */ struct esif_timer_obj **timer_obj_ptr ) { enum esif_rc rc = ESIF_OK; struct esif_timer_obj *new_timer_obj_ptr = NULL; ESIF_ASSERT(function_ptr != NULL); ESIF_ASSERT(timer_obj_ptr != NULL); new_timer_obj_ptr = (struct esif_timer_obj *)esif_ccb_malloc(sizeof(*new_timer_obj_ptr)); if (NULL == new_timer_obj_ptr) { rc = ESIF_E_NO_MEMORY; goto exit; } rc = esif_ccb_timer_obj_create_timer(new_timer_obj_ptr); if (rc != ESIF_OK) goto exit; new_timer_obj_ptr->function_ptr = function_ptr; new_timer_obj_ptr->context_ptr = context_ptr; *timer_obj_ptr = new_timer_obj_ptr; exit: if (rc != ESIF_OK) esif_ccb_timer_obj_destroy(new_timer_obj_ptr); return rc; }
static struct esif_link_list_node * esif_find_node_in_ht_ll( struct esif_link_list *ll_ptr, u8 *key_ptr, u32 key_length ) { struct esif_link_list_node *cur_ptr = NULL; struct esif_ht_node *ht_node = NULL; ESIF_ASSERT(ll_ptr != NULL); ESIF_ASSERT(key_ptr != NULL); cur_ptr = ll_ptr->head_ptr; while (cur_ptr) { ht_node = (struct esif_ht_node *)cur_ptr->data_ptr; if (ht_node != NULL) { if (esif_cmp_keys(key_ptr, key_length, ht_node->key_ptr, ht_node->key_length)) { break; } } cur_ptr = cur_ptr->next_ptr; } return cur_ptr; }
/* Get link list corresponding to the hash index */ struct esif_link_list * esif_ht_get_ll( struct esif_ht *self, u8 *key_ptr, u32 key_length ) { struct esif_link_list *ll_ptr = NULL; u32 hash_index; ESIF_ASSERT(key_ptr != NULL); ESIF_ASSERT(self != NULL); hash_index = esif_compute_hash(key_ptr, key_length) % self->size; ll_ptr = self->table[hash_index]; ESIF_TRACE_DYN_VERB( "Key %p, key size %d, table %p index %d ll %p\n", key_ptr, key_length, self, hash_index, ll_ptr); return ll_ptr; }
static struct esif_ht_node *esif_ht_get_ht_node( struct esif_ht *self, u8 *key_ptr, u32 key_length ) { struct esif_link_list *ll_ptr = NULL; struct esif_link_list_node *ll_node = NULL; struct esif_ht_node *ht_node = NULL; ESIF_ASSERT(key_ptr != NULL); ESIF_ASSERT(self != NULL); ll_ptr = esif_ht_get_ll(self, key_ptr, key_length); if (ll_ptr == NULL) { ESIF_ASSERT(ESIF_FALSE); /* Should never happen */ ESIF_TRACE_DYN_VERB("LL NULL for passed in key\n"); goto exit; } ll_node = esif_find_node_in_ht_ll(ll_ptr, key_ptr, key_length); if (ll_node == NULL) { ESIF_TRACE_DYN_VERB("LL node not found for passed in key\n"); goto exit; } ht_node = (struct esif_ht_node *)ll_node->data_ptr; exit: return ht_node; }
/* Map upper participant metadata to upper particpant instance. A participant that is created from the upperframework will never have a lower framework component. These participants are to cover the case were we either have no Kernel corresponding participant or in some cases we may not even have a lower frame work present. */ static void UpInitializeOriginUF( const EsifUpPtr upPtr, const void *upMetadataPtr ) { /* Upper Participant Metadata Format */ EsifParticipantIfacePtr metadata_ptr = (EsifParticipantIfacePtr)upMetadataPtr; ESIF_ASSERT(upPtr != NULL); ESIF_ASSERT(metadata_ptr != NULL); /* Store Lower Framework Instance */ upPtr->fLpInstance = 255; /* Not Used */ /* Common */ upPtr->fMetadata.fVersion = metadata_ptr->version; upPtr->fMetadata.fEnumerator = (enum esif_participant_enum)metadata_ptr->enumerator; upPtr->fMetadata.fFlags = metadata_ptr->flags; esif_ccb_memcpy(&upPtr->fMetadata.fDriverType, &metadata_ptr->class_guid, ESIF_GUID_LEN); esif_ccb_strcpy(upPtr->fMetadata.fName, metadata_ptr->name, ESIF_NAME_LEN); esif_ccb_strcpy(upPtr->fMetadata.fDesc, metadata_ptr->desc, ESIF_DESC_LEN); esif_ccb_strcpy(upPtr->fMetadata.fDriverName, metadata_ptr->driver_name, ESIF_NAME_LEN); esif_ccb_strcpy(upPtr->fMetadata.fDeviceName, metadata_ptr->device_name, ESIF_NAME_LEN); esif_ccb_strcpy(upPtr->fMetadata.fDevicePath, metadata_ptr->device_path, ESIF_PATH_LEN); esif_ccb_strcpy(upPtr->fMetadata.fAcpiScope, metadata_ptr->object_id, ESIF_SCOPE_LEN); }
static void esif_ccb_tmrm_add_destroy_event( struct esif_tmrm_item *self, esif_ccb_event_t *event_ptr ) { ESIF_ASSERT(self != NULL); ESIF_ASSERT(self->destroy_list_ptr != NULL); if (event_ptr != NULL) { esif_link_list_add_at_back(self->destroy_list_ptr, event_ptr); } }
static eEsifError EsifActMgr_GetTypeFromPossAct_Locked( EsifActMgrEntryPtr entryPtr, enum esif_action_type *typePtr ) { eEsifError rc = ESIF_OK; GetIfaceFuncPtr getIfacePtr = NULL; EsifActIface iface = {0}; ESIF_ASSERT(entryPtr != NULL); ESIF_ASSERT(typePtr != NULL); /* If we already have the type from a previous search, return it */ if (entryPtr->type != 0) { *typePtr = entryPtr->type; } /* If we don't already have the type; load the library and get the type */ rc = EsifActMgr_LoadAction(entryPtr, &getIfacePtr); if (rc != ESIF_OK) { goto exit; } iface.hdr.fIfaceType = eIfaceTypeAction; iface.hdr.fIfaceVersion = ESIF_INTERFACE_VERSION; iface.hdr.fIfaceSize = sizeof(iface); rc = getIfacePtr(&iface); if (ESIF_OK != rc) { goto exit; } /* Check EsifActIface */ if (iface.hdr.fIfaceType != eIfaceTypeAction || iface.hdr.fIfaceVersion > ESIF_ACT_FACE_VER_MAX || iface.hdr.fIfaceSize != EsifActIface_Sizeof(iface.hdr.fIfaceVersion)) { ESIF_TRACE_ERROR("The action interface does not meet requirements\n"); goto exit; } /* Check if this type is already available; we only allow one instance */ rc = EsifActIface_GetType(&iface, &entryPtr->type); if (rc != ESIF_OK) { goto exit; } *typePtr = entryPtr->type; exit: if (rc != ESIF_OK) { EsifActMgr_UnloadAction(entryPtr); } return rc; }
static eEsifError EsifEventMgr_ReleaseEntry( EsifFpcEventPtr fpcEventPtr, UInt8 participantId, UInt16 domainId, EVENT_OBSERVER_CALLBACK eventCallback, void *contextPtr ) { eEsifError rc = ESIF_OK; EsifLinkListPtr listPtr = NULL; EsifLinkListNodePtr nodePtr = NULL; EventMgrEntryPtr curEntryPtr = NULL; atomic_t refCount = -1; ESIF_ASSERT(eventCallback != NULL); ESIF_ASSERT(fpcEventPtr != NULL); esif_ccb_write_lock(&g_EsifEventMgr.listLock); listPtr = g_EsifEventMgr.observerLists[fpcEventPtr->esif_event % NUM_EVENT_LISTS]; if(NULL == listPtr) { rc = ESIF_E_UNSPECIFIED; goto exit; } /* Find the matching entry */ nodePtr = listPtr->head_ptr; while (nodePtr != NULL) { curEntryPtr = (EventMgrEntryPtr) nodePtr->data_ptr; if ((curEntryPtr->fpcEvent.esif_event == fpcEventPtr->esif_event) && (curEntryPtr->participantId == participantId) && (curEntryPtr->domainId == domainId) && (curEntryPtr->contextPtr == contextPtr) && (curEntryPtr->callback == eventCallback)){ break; } nodePtr = nodePtr->next_ptr; } if (nodePtr != NULL) { refCount = atomic_dec(&curEntryPtr->refCount); if (refCount <= 0) { EsifEventMgr_MoveEntryToGarbage(curEntryPtr); esif_link_list_node_remove(listPtr, nodePtr); } goto exit; } exit: esif_ccb_write_unlock(&g_EsifEventMgr.listLock); EsifEventMgr_DumpGarbage(); return rc; }
static eEsifError EsifGetActionDelegateTemp( const EsifUpDomainPtr domainPtr, const EsifDataPtr requestPtr, EsifDataPtr responsePtr ) { EsifPrimitiveTuple tempTuple = {GET_TEMPERATURE_SUR, 0, 255}; ESIF_ASSERT(NULL != domainPtr); ESIF_ASSERT(NULL != responsePtr); tempTuple.domain = domainPtr->domain; return EsifUp_ExecutePrimitive(domainPtr->upPtr, &tempTuple, requestPtr, responsePtr); }
static void esif_ccb_timer_obj_call_cb( struct esif_timer_obj *self ) { ESIF_ASSERT(self != NULL); self->function_ptr(self->context_ptr); }
eEsifError EsifCopyIntToBufBySize( size_t typeSize, void *dstPtr, u64 val ) { eEsifError rc = ESIF_OK; ESIF_ASSERT(dstPtr != NULL); switch(typeSize) { case sizeof(u8): *((u8 *)dstPtr) = (u8)val; break; case sizeof(u16): *((u16 *)dstPtr) = (u16)val; break; case sizeof(u32): *((u32 *)dstPtr) = (u32)val; break; case sizeof(u64): *((u64 *)dstPtr) = (u64)val; break; default: rc = ESIF_E_UNSUPPORTED_RESULT_DATA_TYPE; break; } return rc; }
static eEsifError EsifActIface_SendIfaceEvent( EsifActIfacePtr self, esif_context_t actCtx, enum esif_event_type eventType, UInt8 upInstance, UInt16 domainId, EsifDataPtr eventDataPtr ) { eEsifError rc = ESIF_OK; ESIF_ASSERT(self != NULL); switch (self->hdr.fIfaceVersion) { case ESIF_ACT_IFACE_VER_V1: if (NULL == self->actIfaceV1.rcvEventFuncPtr) { rc = ESIF_E_NOT_SUPPORTED; goto exit; } self->actIfaceV1.rcvEventFuncPtr(actCtx, (esif_handle_t)(size_t)upInstance, eventType, domainId, eventDataPtr ); break; case ESIF_ACT_IFACE_VER_STATIC: default: break; } exit: return rc; }
static eEsifError EsifApp_RegisterParticipantsWithApp( EsifAppPtr self ) { eEsifError rc = ESIF_OK; EsifUpPtr upPtr = NULL; UInt8 i = 0; ESIF_ASSERT(self != NULL); /* Skip 0 ESIF treats this as a participant no one else does :) */ /* TODO: Use iterator here. This function shouldn't know the number of participants */ for (i = 1; i < MAX_PARTICIPANT_ENTRY; i++) { upPtr = EsifUpPm_GetAvailableParticipantByInstance(i); if (NULL == upPtr) { continue; } rc = EsifAppCreateParticipant(self, upPtr); EsifUp_PutRef(upPtr); if (ESIF_OK != rc) { break; } } ESIF_TRACE_INFO("Register participants with App, status = %s\n", esif_rc_str(rc)); return rc; }
// Read a Section of a DataVault from Disk static eEsifError DataVault_GetFromSource( DataVaultPtr self, void *bufPtr, UInt32 bytes, size_t offset ) { eEsifError rc = ESIF_OK; size_t bytesRead = 0; ESIF_ASSERT(self != NULL); if (IOStream_Open(self->stream) != 0) { rc = ESIF_E_IO_ERROR; goto exit; } bytesRead = IOStream_ReadAt(self->stream, bufPtr, bytes, offset); if (bytesRead != bytes) { rc = ESIF_E_IO_ERROR; } exit: IOStream_Close(self->stream); return rc; }
/* Allocate Event IPC */ struct esif_ipc *esif_ipc_alloc_event( struct esif_ipc_event **event_ptr_ptr, u32 data_len ) { struct esif_ipc *ipc_ptr = NULL; ESIF_ASSERT(event_ptr_ptr != NULL); ipc_ptr = esif_ipc_alloc(ESIF_IPC_TYPE_EVENT, data_len + sizeof(**event_ptr_ptr)); if (NULL == ipc_ptr) { *event_ptr_ptr = NULL; } else { esif_ccb_time_t timestamp = {0}; struct esif_ipc_event *event_ptr = NULL; event_ptr = (struct esif_ipc_event *)(ipc_ptr + 1); event_ptr->version = ESIF_EVENT_VERSION; event_ptr->priority = ESIF_EVENT_PRIORITY_NORMAL; event_ptr->data_len = data_len; esif_ccb_system_time(×tamp); event_ptr->timestamp = (u64)timestamp; *event_ptr_ptr = event_ptr; } return ipc_ptr; }
// Resize an IString buffer (if dynamically allocated) ZString IString_Resize ( IStringPtr self, u32 buf_len ) { ESIF_ASSERT(self); // Allocate initial buffer if it has never been allocated if (self->buf_ptr == 0) { self->buf_ptr = esif_ccb_malloc(buf_len); if (self->buf_ptr) { self->buf_len = buf_len; self->data_len = 1; return (ZString)self->buf_ptr; } } // Resize buffer if it is not a static string if (self->buf_len > 0) { ZString buf_ptr = (ZString)esif_ccb_realloc(self->buf_ptr, buf_len); if (buf_ptr) { if (buf_len > self->buf_len) { esif_ccb_memset(buf_ptr + self->buf_len, 0, buf_len - self->buf_len); } self->buf_ptr = buf_ptr; self->buf_len = buf_len; return (ZString)self->buf_ptr; } } return 0; }
/* Allocate Command IPC */ struct esif_ipc *esif_ipc_alloc_command( struct esif_ipc_command **command_ptr_ptr, u32 data_len ) { struct esif_ipc *ipc_ptr = NULL; ESIF_ASSERT(command_ptr_ptr != NULL); ipc_ptr = esif_ipc_alloc(ESIF_IPC_TYPE_COMMAND, data_len + sizeof(**command_ptr_ptr)); if (NULL == ipc_ptr) { *command_ptr_ptr = NULL; } else { struct esif_ipc_command *command_ptr = NULL; command_ptr = (struct esif_ipc_command *)(ipc_ptr + 1); command_ptr->version = ESIF_COMMAND_VERSION; command_ptr->priority = ESIF_COMMAND_PRIORITY_NORMAL; command_ptr->payload_len = data_len; *command_ptr_ptr = command_ptr; } return ipc_ptr; }
/* Get By Instance From ID */ EsifUpPtr EsifUpManagerGetAvailableParticipantByInstance ( const UInt8 id ) { EsifUpPtr up_ptr = NULL; ESIF_TRACE_DEBUG("%s: instance %d\n", ESIF_FUNC, id); if (id >= MAX_PARTICIPANT_ENTRY) { ESIF_TRACE_ERROR("Instance id %d is out of range\n", id); ESIF_ASSERT(0); goto exit; } /* Lock manager */ esif_ccb_read_lock(&g_uppMgr.fLock); if (g_uppMgr.fEntries[id].fState > ESIF_PM_PARTICIPANT_REMOVED) { up_ptr = g_uppMgr.fEntries[id].fUpPtr; } /* Unlock Manager */ esif_ccb_read_unlock(&g_uppMgr.fLock); exit: if (NULL == up_ptr) { ESIF_TRACE_DEBUG("%s: instance %d NOT found or OUT OF BOUNDS\n", ESIF_FUNC, id); } return up_ptr; }
static eEsifError ESIF_CALLCONV ActionConfigGet( esif_context_t actCtx, EsifUpPtr upPtr, const EsifFpcPrimitivePtr primitivePtr, const EsifFpcActionPtr fpcActionPtr, const EsifDataPtr requestPtr, const EsifDataPtr responsePtr ) { eEsifError rc = ESIF_OK; EsifData params[2] = {0}; EsifString replacedStrs[2] = {0}; EsifString replacedStr = NULL; UInt8 i; UNREFERENCED_PARAMETER(actCtx); UNREFERENCED_PARAMETER(requestPtr); ESIF_ASSERT(NULL != responsePtr); ESIF_ASSERT(NULL != responsePtr->buf_ptr); rc = EsifFpcAction_GetParams(fpcActionPtr, params, sizeof(params)/sizeof(*params)); if (ESIF_OK != rc) { goto exit; } for (i = 0; i < sizeof(replacedStrs) / sizeof(*replacedStrs); i++) { replacedStr = EsifUp_CreateTokenReplacedParamString(upPtr, primitivePtr, params[i].buf_ptr); if (replacedStr != NULL) { params[i].buf_ptr = replacedStr; replacedStrs[i] = replacedStr; } } ESIF_ASSERT(NULL != params[0].buf_ptr); ESIF_ASSERT(ESIF_DATA_STRING == params[0].type); rc = EsifConfigGet(¶ms[0], ¶ms[1], responsePtr); exit: for (i = 0; i < sizeof(replacedStrs) / sizeof(*replacedStrs); i++) { esif_ccb_free(replacedStrs[i]); } return rc; }
/* ** Map lower participant metadata to upper participant instance. Every ** lower participant must have a corresponding upper particpant. Here we ** intialize the data from the upper participant from the lower participant ** registration data. */ static void UpInitializeOriginLF( const EsifUpPtr upPtr, const UInt8 lpInstance, const void *lpMetadataPtr ) { /* Lower Framework Participant Metadata Format */ struct esif_ipc_event_data_create_participant *metadata_ptr = (struct esif_ipc_event_data_create_participant *)lpMetadataPtr; ESIF_ASSERT(upPtr != NULL); ESIF_ASSERT(metadata_ptr != NULL); /* Store Lower Framework Instance. */ upPtr->fLpInstance = lpInstance; /* Common */ upPtr->fMetadata.fVersion = metadata_ptr->version; upPtr->fMetadata.fEnumerator = (enum esif_participant_enum)metadata_ptr->enumerator; upPtr->fMetadata.fFlags = metadata_ptr->flags; esif_ccb_memcpy(&upPtr->fMetadata.fDriverType, &metadata_ptr->class_guid, ESIF_GUID_LEN); esif_ccb_strcpy(upPtr->fMetadata.fName, metadata_ptr->name, ESIF_NAME_LEN); esif_ccb_strcpy(upPtr->fMetadata.fDesc, metadata_ptr->desc, ESIF_DESC_LEN); esif_ccb_strcpy(upPtr->fMetadata.fDriverName, metadata_ptr->driver_name, ESIF_NAME_LEN); esif_ccb_strcpy(upPtr->fMetadata.fDeviceName, metadata_ptr->device_name, ESIF_NAME_LEN); esif_ccb_strcpy(upPtr->fMetadata.fDevicePath, metadata_ptr->device_path, ESIF_PATH_LEN); /* ACPI */ esif_ccb_strcpy(upPtr->fMetadata.fAcpiUID, metadata_ptr->acpi_uid, sizeof(upPtr->fMetadata.fAcpiUID)); upPtr->fMetadata.fAcpiType = metadata_ptr->acpi_type; esif_ccb_strcpy(upPtr->fMetadata.fAcpiDevice, metadata_ptr->acpi_device, ESIF_NAME_LEN); esif_ccb_strcpy(upPtr->fMetadata.fAcpiScope, metadata_ptr->acpi_scope, ESIF_SCOPE_LEN); /* PCI */ upPtr->fMetadata.fPciVendor = (u16)metadata_ptr->pci_vendor; upPtr->fMetadata.fPciDevice = (u16)metadata_ptr->pci_device; upPtr->fMetadata.fPciBus = metadata_ptr->pci_bus; upPtr->fMetadata.fPciBusDevice = metadata_ptr->pci_bus_device; upPtr->fMetadata.fPciFunction = metadata_ptr->pci_function; upPtr->fMetadata.fPciRevision = metadata_ptr->pci_revision; upPtr->fMetadata.fPciClass = metadata_ptr->pci_class; upPtr->fMetadata.fPciSubClass = metadata_ptr->pci_sub_class; upPtr->fMetadata.fPciProgIf = metadata_ptr->pci_prog_if; }
void ESIF_INLINE IString_dtor (IStringPtr self) { ESIF_ASSERT(self); if (self->buf_len) { esif_ccb_free(self->buf_ptr); } WIPEPTR(self); }
// Truncate an IString void IString_Truncate (IStringPtr self) { ESIF_ASSERT(self); if (self->data_len) { *((ZString)(self->buf_ptr)) = 0; self->data_len = 1; } }
static eEsifError EsifSetActionDelegateAppc( const EsifUpDomainPtr domainPtr, const EsifDataPtr requestPtr, const EsifFpcActionPtr fpcActionPtr) { eEsifError rc = ESIF_E_PRIMITIVE_ACTION_FAILURE; EsifData p2 = { 0 }; EsifString appName = NULL; UInt32 opcode = 0; UNREFERENCED_PARAMETER(domainPtr); ESIF_ASSERT(NULL != domainPtr); ESIF_ASSERT(NULL != requestPtr); ESIF_ASSERT(NULL != requestPtr); // Action Parameter 2 is App Control Opcode ('STRT','STOP', etc) // Primitive requestPtr is App Name ("dptf", ...) rc = EsifFpcAction_GetParamAsEsifData(fpcActionPtr, 1, &p2); if ((ESIF_OK != rc) || (NULL == p2.buf_ptr)) { rc = ESIF_E_INVALID_ARGUMENT_COUNT; goto exit; } if ((p2.type == ESIF_DATA_UINT32) && (p2.data_len == sizeof(UInt32))) { opcode = *(UInt32 *)p2.buf_ptr; } if ((requestPtr->type == ESIF_DATA_STRING) && (NULL != requestPtr->buf_ptr)) { appName = (EsifString)requestPtr->buf_ptr; switch (opcode) { case 'TRTS': // STRT: Start App rc = EsifAppMgr_AppStart(appName); break; case 'POTS': // STOP: Stop App rc = EsifAppMgr_AppStop(appName); break; default: rc = ESIF_E_INVALID_REQUEST_TYPE; break; } } exit: return rc; }
static eEsifError EsifAct_RegisterEvents( EsifActPtr self ) { ESIF_ASSERT(self != NULL); return EsifActIface_RegisterEvents(&self->iface, (esif_handle_t)(size_t)self->type); }
enum esif_rc esif_ht_remove_item( struct esif_ht *self, u8 *key_ptr, u32 key_length ) { enum esif_rc rc = ESIF_OK; struct esif_link_list *ll_ptr = NULL; struct esif_link_list_node *ll_node = NULL; struct esif_ht_node *ht_node = NULL; if ((key_ptr == NULL) || (self == NULL)) { ESIF_TRACE_ERROR("NULL ptr passed in\n"); rc = ESIF_E_PARAMETER_IS_NULL; goto exit; } ll_ptr = esif_ht_get_ll(self, key_ptr, key_length); if (ll_ptr == NULL) { ESIF_ASSERT(ESIF_FALSE); /* Should never happen */ ESIF_TRACE_DYN_VERB("LL NULL for passed in key\n"); rc = ESIF_E_NOT_FOUND; goto exit; } ll_node = esif_find_node_in_ht_ll(ll_ptr, key_ptr, key_length); if (ll_node == NULL) { ESIF_TRACE_DYN_VERB("LL node not found for passed in key\n"); rc = ESIF_E_NOT_FOUND; goto exit; } ht_node = (struct esif_ht_node *)ll_node->data_ptr; if (ht_node == NULL) { ESIF_ASSERT(ESIF_FALSE); ESIF_TRACE_DYN_VERB("ht_node NULL\n"); rc = ESIF_E_PARAMETER_IS_NULL; goto exit; } esif_destroy_ht_node(ht_node); esif_link_list_node_remove(ll_ptr, ll_node); exit: return rc; }
static eEsifError EsifGetActionDelegateGtt1( const EsifUpDomainPtr domainPtr, EsifDataPtr responsePtr) { eEsifError rc = ESIF_OK; ESIF_ASSERT(domainPtr != NULL); ESIF_ASSERT(responsePtr != NULL); if (responsePtr->buf_ptr == NULL) { rc = ESIF_E_PARAMETER_IS_NULL; goto exit; } *(u32 *) responsePtr->buf_ptr = (u32) domainPtr->tempAux1; exit: return rc; }
static eEsifError EsifActMgr_CreateAction( EsifActMgrEntryPtr entryPtr, EsifActIfacePtr actIfacePtr ) { eEsifError rc = ESIF_OK; enum esif_action_type actType = 0; EsifActPtr actPtr = NULL; ESIF_ASSERT(entryPtr != NULL); ESIF_ASSERT(actIfacePtr != NULL); /* Check EsifActIface */ if (actIfacePtr->hdr.fIfaceType != eIfaceTypeAction || actIfacePtr->hdr.fIfaceVersion > ESIF_ACT_FACE_VER_MAX || actIfacePtr->hdr.fIfaceSize != EsifActIface_Sizeof(actIfacePtr->hdr.fIfaceVersion)) { ESIF_TRACE_ERROR("The action interface does not meet requirements\n"); goto exit; } /* Check if this type is already available; we only allow one instance */ rc = EsifActIface_GetType(actIfacePtr, &actType); if (rc != ESIF_OK) { goto exit; } actPtr = EsifActMgr_GetAction(actType, ACT_MGR_NO_UPINSTANCE); if (actPtr != NULL) { EsifAct_PutRef(actPtr); rc = ESIF_E_ACTION_ALREADY_STARTED; goto exit; } rc = EsifAct_CreateAction(actIfacePtr, entryPtr->upInstance, &actPtr); if (rc != ESIF_OK) { goto exit; } entryPtr->type = actPtr->type; entryPtr->actCtx = actPtr->actCtx; entryPtr->actPtr = actPtr; exit: return rc; }
static enum esif_rc esif_ccb_tmrm_create_tmrm_item( const esif_ccb_timer_cb function_ptr, /* Callback when timer fires */ void *context_ptr, /* Callback context if any */ struct esif_tmrm_item **tmrm_item_ptr ) { enum esif_rc rc = ESIF_E_NO_MEMORY; struct esif_tmrm_item *new_item_ptr = NULL; struct esif_timer_obj *timer_obj_ptr = NULL; esif_ccb_timer_handle_t handle = 0; ESIF_ASSERT(tmrm_item_ptr != NULL); ESIF_ASSERT(function_ptr != NULL); new_item_ptr = (struct esif_tmrm_item *) esif_ccb_malloc(sizeof(*new_item_ptr)); if (NULL == new_item_ptr) goto exit; new_item_ptr->destroy_list_ptr = esif_link_list_create(); if (NULL == new_item_ptr->destroy_list_ptr) goto exit; rc = esif_ccb_timer_obj_create(function_ptr, context_ptr, &timer_obj_ptr); if (rc != ESIF_OK) goto exit; new_item_ptr->timer_obj_ptr = timer_obj_ptr; rc = esif_ccb_tmrm_get_next_handle(&handle); if (rc != ESIF_OK) goto exit; new_item_ptr->timer_handle = handle; *tmrm_item_ptr = new_item_ptr; exit: if (rc != ESIF_OK) esif_ccb_tmrm_destroy_tmrm_item(new_item_ptr); return rc; }
/* * Handle ESIF Action "Get" Request */ static eEsifError ESIF_CALLCONV ActionSystemGet( const void *actionHandle, EsifUpPtr upPtr, const EsifFpcPrimitivePtr primitivePtr, const EsifFpcActionPtr actionPtr, const EsifDataPtr requestPtr, const EsifDataPtr responsePtr ) { eEsifError esifStatus = ESIF_E_ACTION_NOT_IMPLEMENTED; EsifData p1 = {0}; EsifString command = NULL; UNREFERENCED_PARAMETER(actionHandle); UNREFERENCED_PARAMETER(upPtr); UNREFERENCED_PARAMETER(primitivePtr); UNREFERENCED_PARAMETER(actionPtr); UNREFERENCED_PARAMETER(requestPtr); ESIF_ASSERT(NULL != responsePtr); ESIF_ASSERT(NULL != responsePtr->buf_ptr); esifStatus = EsifActionGetParamAsEsifData(actionPtr, 0, &p1); if (ESIF_OK != esifStatus) { goto exit; } ESIF_ASSERT(NULL != p1.buf_ptr); ESIF_ASSERT(ESIF_DATA_STRING == p1.type); command = (EsifString)p1.buf_ptr; if (!strcmp("SYSTEM_GET_CDPNAME0", command)) { esifStatus = system_get_ctdp_name(responsePtr, 0); } else if (!strcmp("SYSTEM_GET_CDPNAME1", command)) { esifStatus = system_get_ctdp_name(responsePtr, 1); } else if (!strcmp("SYSTEM_GET_CDPNAME2", command)) { esifStatus = system_get_ctdp_name(responsePtr, 2); } exit: return esifStatus; }