这篇教程C++ ACPI_EXCEPTION函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ACPI_EXCEPTION函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_EXCEPTION函数的具体用法?C++ ACPI_EXCEPTION怎么用?C++ ACPI_EXCEPTION使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ACPI_EXCEPTION函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: AcpiEnterSleepStatePrepACPI_STATUSAcpiEnterSleepStatePrep ( UINT8 SleepState){ ACPI_STATUS Status; ACPI_OBJECT_LIST ArgList; ACPI_OBJECT Arg; ACPI_FUNCTION_TRACE (AcpiEnterSleepStatePrep); /* _PSW methods could be run here to enable wake-on keyboard, LAN, etc. */ Status = AcpiGetSleepTypeData (SleepState, &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Execute the _PTS method (Prepare To Sleep) */ ArgList.Count = 1; ArgList.Pointer = &Arg; Arg.Type = ACPI_TYPE_INTEGER; Arg.Integer.Value = SleepState; Status = AcpiEvaluateObject (NULL, METHOD_NAME__PTS, &ArgList, NULL); if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) { return_ACPI_STATUS (Status); } /* Setup the argument to the _SST method (System STatus) */ switch (SleepState) { case ACPI_STATE_S0: Arg.Integer.Value = ACPI_SST_WORKING; break; case ACPI_STATE_S1: case ACPI_STATE_S2: case ACPI_STATE_S3: Arg.Integer.Value = ACPI_SST_SLEEPING; break; case ACPI_STATE_S4: Arg.Integer.Value = ACPI_SST_SLEEP_CONTEXT; break; default: Arg.Integer.Value = ACPI_SST_INDICATOR_OFF; /* Default is off */ break; } /* * Set the system indicators to show the desired sleep state. * _SST is an optional method (return no error if not found) */ Status = AcpiEvaluateObject (NULL, METHOD_NAME__SST, &ArgList, NULL); if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) { ACPI_EXCEPTION ((AE_INFO, Status, "While executing method _SST")); } return_ACPI_STATUS (AE_OK);}
开发者ID:iversonjimmy,项目名称:acer_cloud_wifi_copy,代码行数:69,
示例2: AcpiDsInitializeObjectsACPI_STATUSAcpiDsInitializeObjects ( UINT32 TableIndex, ACPI_NAMESPACE_NODE *StartNode){ ACPI_STATUS Status; ACPI_INIT_WALK_INFO Info; ACPI_TABLE_HEADER *Table; ACPI_OWNER_ID OwnerId; ACPI_FUNCTION_TRACE (DsInitializeObjects); Status = AcpiTbGetOwnerId (TableIndex, &OwnerId); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "**** Starting initialization of namespace objects ****/n")); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Parsing all Control Methods:")); /* Set all init info to zero */ ACPI_MEMSET (&Info, 0, sizeof (ACPI_INIT_WALK_INFO)); Info.OwnerId = OwnerId; Info.TableIndex = TableIndex; /* Walk entire namespace from the supplied root */ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* * We don't use AcpiWalkNamespace since we do not want to acquire * the namespace reader lock. */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, AcpiDsInitOneObject, NULL, &Info, NULL); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace")); } (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); Status = AcpiGetTableByIndex (TableIndex, &Table); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "/nTable [%4.4s](id %4.4X) - %u Objects with %u Devices %u Methods %u Regions/n", Table->Signature, OwnerId, Info.ObjectCount, Info.DeviceCount, Info.MethodCount, Info.OpRegionCount)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "%u Methods, %u Regions/n", Info.MethodCount, Info.OpRegionCount)); return_ACPI_STATUS (AE_OK);}
开发者ID:ornarium,项目名称:freebsd,代码行数:67,
示例3: AcpiEvInitializeGpeBlockACPI_STATUSAcpiEvInitializeGpeBlock ( ACPI_GPE_XRUPT_INFO *GpeXruptInfo, ACPI_GPE_BLOCK_INFO *GpeBlock, void *Ignored){ ACPI_STATUS Status; ACPI_GPE_EVENT_INFO *GpeEventInfo; UINT32 GpeEnabledCount; UINT32 GpeIndex; UINT32 i; UINT32 j; ACPI_FUNCTION_TRACE (EvInitializeGpeBlock); /* * Ignore a null GPE block (e.g., if no GPE block 1 exists), and * any GPE blocks that have been initialized already. */ if (!GpeBlock || GpeBlock->Initialized) { return_ACPI_STATUS (AE_OK); } /* * Enable all GPEs that have a corresponding method and have the * ACPI_GPE_CAN_WAKE flag unset. Any other GPEs within this block * must be enabled via the acpi_enable_gpe() interface. */ GpeEnabledCount = 0; for (i = 0; i < GpeBlock->RegisterCount; i++) { for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { /* Get the info block for this particular GPE */ GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j; GpeEventInfo = &GpeBlock->EventInfo[GpeIndex]; /* * Ignore GPEs that have no corresponding _Lxx/_Exx method * and GPEs that are used to wake the system */ if ((ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == ACPI_GPE_DISPATCH_NONE) || (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == ACPI_GPE_DISPATCH_HANDLER) || (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == ACPI_GPE_DISPATCH_RAW_HANDLER) || (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE)) { continue; } Status = AcpiEvAddGpeReference (GpeEventInfo); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "Could not enable GPE 0x%02X", GpeIndex + GpeBlock->BlockBaseNumber)); continue; } GpeEnabledCount++; } } if (GpeEnabledCount) { ACPI_INFO ((AE_INFO, "Enabled %u GPEs in block %02X to %02X", GpeEnabledCount, (UINT32) GpeBlock->BlockBaseNumber, (UINT32) (GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1)))); } GpeBlock->Initialized = TRUE; return_ACPI_STATUS (AE_OK);}
开发者ID:Strongc,项目名称:reactos,代码行数:78,
示例4: AcpiDbExecuteMethodstatic ACPI_STATUSAcpiDbExecuteMethod ( ACPI_DB_METHOD_INFO *Info, ACPI_BUFFER *ReturnObj){ ACPI_STATUS Status; ACPI_OBJECT_LIST ParamObjects; ACPI_OBJECT Params[ACPI_DEBUGGER_MAX_ARGS + 1]; UINT32 i; ACPI_FUNCTION_TRACE (DbExecuteMethod); if (AcpiGbl_DbOutputToFile && !AcpiDbgLevel) { AcpiOsPrintf ("Warning: debug output is not enabled!/n"); } ParamObjects.Count = 0; ParamObjects.Pointer = NULL; /* Pass through any command-line arguments */ if (Info->Args && Info->Args[0]) { /* Get arguments passed on the command line */ for (i = 0; (Info->Args[i] && *(Info->Args[i])); i++) { /* Convert input string (token) to an actual ACPI_OBJECT */ Status = AcpiDbConvertToObject (Info->Types[i], Info->Args[i], &Params[i]); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "While parsing method arguments")); goto Cleanup; } } ParamObjects.Count = i; ParamObjects.Pointer = Params; } /* Prepare for a return object of arbitrary size */ ReturnObj->Pointer = AcpiGbl_DbBuffer; ReturnObj->Length = ACPI_DEBUG_BUFFER_SIZE; /* Do the actual method execution */ AcpiGbl_MethodExecuting = TRUE; Status = AcpiEvaluateObject (NULL, Info->Pathname, &ParamObjects, ReturnObj); AcpiGbl_CmSingleStep = FALSE; AcpiGbl_MethodExecuting = FALSE; if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "while executing %s from debugger", Info->Pathname)); if (Status == AE_BUFFER_OVERFLOW) { ACPI_ERROR ((AE_INFO, "Possible overflow of internal debugger " "buffer (size 0x%X needed 0x%X)", ACPI_DEBUG_BUFFER_SIZE, (UINT32) ReturnObj->Length)); } }Cleanup: AcpiDbDeleteObjects (ParamObjects.Count, Params); return_ACPI_STATUS (Status);}
开发者ID:JasonFord53,项目名称:freebsd,代码行数:78,
示例5: AcpiDsGetPredicateValueACPI_STATUSAcpiDsGetPredicateValue ( ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT *ResultObj){ ACPI_STATUS Status = AE_OK; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT *LocalObjDesc = NULL; ACPI_FUNCTION_TRACE_PTR (DsGetPredicateValue, WalkState); WalkState->ControlState->Common.State = 0; if (ResultObj) { Status = AcpiDsResultPop (&ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "Could not get result from predicate evaluation")); return_ACPI_STATUS (Status); } } else { Status = AcpiDsCreateOperand (WalkState, WalkState->Op, 0); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } ObjDesc = WalkState->Operands [0]; } if (!ObjDesc) { ACPI_ERROR ((AE_INFO, "No predicate ObjDesc=%p State=%p", ObjDesc, WalkState)); return_ACPI_STATUS (AE_AML_NO_OPERAND); } /* * Result of predicate evaluation must be an Integer * object. Implicitly convert the argument if necessary. */ Status = AcpiExConvertToInteger (ObjDesc, &LocalObjDesc, 16); if (ACPI_FAILURE (Status)) { goto Cleanup; } if (LocalObjDesc->Common.Type != ACPI_TYPE_INTEGER) { ACPI_ERROR ((AE_INFO, "Bad predicate (not an integer) ObjDesc=%p State=%p Type=0x%X", ObjDesc, WalkState, ObjDesc->Common.Type)); Status = AE_AML_OPERAND_TYPE; goto Cleanup; } /* Truncate the predicate to 32-bits if necessary */ AcpiExTruncateFor32bitTable (LocalObjDesc); /* * Save the result of the predicate evaluation on * the control stack */ if (LocalObjDesc->Integer.Value) { WalkState->ControlState->Common.Value = TRUE; } else { /* * Predicate is FALSE, we will just toss the * rest of the package */ WalkState->ControlState->Common.Value = FALSE; Status = AE_CTRL_FALSE; } /* Predicate can be used for an implicit return value */ (void) AcpiDsDoImplicitReturn (LocalObjDesc, WalkState, TRUE);Cleanup://.........这里部分代码省略.........
开发者ID:ErfanBagheri,项目名称:haiku,代码行数:101,
示例6: acpi_ev_gpe_initialize/******************************************************************************* * * FUNCTION: acpi_ev_gpe_initialize * * PARAMETERS: None * * RETURN: Status * * DESCRIPTION: Initialize the GPE data structures and the FADT GPE 0/1 blocks * ******************************************************************************/acpi_status acpi_ev_gpe_initialize(void){ u32 register_count0 = 0; u32 register_count1 = 0; u32 gpe_number_max = 0; acpi_status status; ACPI_FUNCTION_TRACE(ev_gpe_initialize); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } /* * Initialize the GPE Block(s) defined in the FADT * * Why the GPE register block lengths are divided by 2: From the ACPI * Spec, section "General-Purpose Event Registers", we have: * * "Each register block contains two registers of equal length * GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the * GPE0_STS and GPE0_EN registers is equal to half the GPE0_LEN * The length of the GPE1_STS and GPE1_EN registers is equal to * half the GPE1_LEN. If a generic register block is not supported * then its respective block pointer and block length values in the * FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need * to be the same size." */ /* * Determine the maximum GPE number for this machine. * * Note: both GPE0 and GPE1 are optional, and either can exist without * the other. * * If EITHER the register length OR the block address are zero, then that * particular block is not supported. */ if (acpi_gbl_FADT.gpe0_block_length && acpi_gbl_FADT.xgpe0_block.address) { /* GPE block 0 exists (has both length and address > 0) */ register_count0 = (u16)(acpi_gbl_FADT.gpe0_block_length / 2); gpe_number_max = (register_count0 * ACPI_GPE_REGISTER_WIDTH) - 1; /* Install GPE Block 0 */ status = acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device, &acpi_gbl_FADT.xgpe0_block, register_count0, 0, acpi_gbl_FADT.sci_interrupt, &acpi_gbl_gpe_fadt_blocks[0]); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Could not create GPE Block 0")); } } if (acpi_gbl_FADT.gpe1_block_length && acpi_gbl_FADT.xgpe1_block.address) { /* GPE block 1 exists (has both length and address > 0) */ register_count1 = (u16)(acpi_gbl_FADT.gpe1_block_length / 2); /* Check for GPE0/GPE1 overlap (if both banks exist) */ if ((register_count0) && (gpe_number_max >= acpi_gbl_FADT.gpe1_base)) { ACPI_ERROR((AE_INFO, "GPE0 block (GPE 0 to %u) overlaps the GPE1 block " "(GPE %u to %u) - Ignoring GPE1", gpe_number_max, acpi_gbl_FADT.gpe1_base, acpi_gbl_FADT.gpe1_base + ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1))); /* Ignore GPE1 block by setting the register count to zero */ register_count1 = 0; } else { /* Install GPE Block 1 */ status =//.........这里部分代码省略.........
开发者ID:08opt,项目名称:linux,代码行数:101,
示例7: AcpiEvDetachRegionvoidAcpiEvDetachRegion ( ACPI_OPERAND_OBJECT *RegionObj, BOOLEAN AcpiNsIsLocked){ ACPI_OPERAND_OBJECT *HandlerObj; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT *StartDesc; ACPI_OPERAND_OBJECT **LastObjPtr; ACPI_ADR_SPACE_SETUP RegionSetup; void **RegionContext; ACPI_OPERAND_OBJECT *RegionObj2; ACPI_STATUS Status; ACPI_FUNCTION_TRACE (EvDetachRegion); RegionObj2 = AcpiNsGetSecondaryObject (RegionObj); if (!RegionObj2) { return_VOID; } RegionContext = &RegionObj2->Extra.RegionContext; /* Get the address handler from the region object */ HandlerObj = RegionObj->Region.Handler; if (!HandlerObj) { /* This region has no handler, all done */ return_VOID; } /* Find this region in the handler's list */ ObjDesc = HandlerObj->AddressSpace.RegionList; StartDesc = ObjDesc; LastObjPtr = &HandlerObj->AddressSpace.RegionList; while (ObjDesc) { /* Is this the correct Region? */ if (ObjDesc == RegionObj) { ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Removing Region %p from address handler %p/n", RegionObj, HandlerObj)); /* This is it, remove it from the handler's list */ *LastObjPtr = ObjDesc->Region.Next; ObjDesc->Region.Next = NULL; /* Must clear field */ if (AcpiNsIsLocked) { Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return_VOID; } } /* Now stop region accesses by executing the _REG method */ Status = AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_DISCONNECT); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "from region _REG, [%s]", AcpiUtGetRegionName (RegionObj->Region.SpaceId))); } if (AcpiNsIsLocked) { Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return_VOID; } } /* * If the region has been activated, call the setup handler with * the deactivate notification */ if (RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE) { RegionSetup = HandlerObj->AddressSpace.Setup; Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE, HandlerObj->AddressSpace.Context, RegionContext); /* * RegionContext should have been released by the deactivate * operation. We don't need access to it anymore here. */ if (RegionContext) { *RegionContext = NULL;//.........这里部分代码省略.........
开发者ID:malattia,项目名称:acpica-tools,代码行数:101,
示例8: acpi_ds_initialize_objectsacpi_statusacpi_ds_initialize_objects(u32 table_index, struct acpi_namespace_node * start_node){ acpi_status status; struct acpi_init_walk_info info; struct acpi_table_header *table; acpi_owner_id owner_id; ACPI_FUNCTION_TRACE(ds_initialize_objects); status = acpi_tb_get_owner_id(table_index, &owner_id); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "**** Starting initialization of namespace objects ****/n")); ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "Parsing all Control Methods:")); /* Set all init info to zero */ ACPI_MEMSET(&info, 0, sizeof(struct acpi_init_walk_info)); info.owner_id = owner_id; info.table_index = table_index; /* Walk entire namespace from the supplied root */ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } /* * We don't use acpi_walk_namespace since we do not want to acquire * the namespace reader lock. */ status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, acpi_ds_init_one_object, NULL, &info, NULL); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace")); } (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); status = acpi_get_table_by_index(table_index, &table); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "/nTable [%4.4s](id %4.4X) - %u Objects with %u Devices %u Methods %u Regions/n", table->signature, owner_id, info.object_count, info.device_count, info.method_count, info.op_region_count)); ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "%u Methods, %u Regions/n", info.method_count, info.op_region_count)); return_ACPI_STATUS(AE_OK);}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:64,
示例9: acpi_ds_init_one_objectstatic acpi_statusacpi_ds_init_one_object(acpi_handle obj_handle, u32 level, void *context, void **return_value){ struct acpi_init_walk_info *info = (struct acpi_init_walk_info *)context; struct acpi_namespace_node *node = (struct acpi_namespace_node *)obj_handle; acpi_object_type type; acpi_status status; ACPI_FUNCTION_ENTRY(); /* * We are only interested in NS nodes owned by the table that * was just loaded */ if (node->owner_id != info->owner_id) { return (AE_OK); } info->object_count++; /* And even then, we are only interested in a few object types */ type = acpi_ns_get_type(obj_handle); switch (type) { case ACPI_TYPE_REGION: status = acpi_ds_initialize_region(obj_handle); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "During Region initialization %p [%4.4s]", obj_handle, acpi_ut_get_node_name(obj_handle))); } info->op_region_count++; break; case ACPI_TYPE_METHOD: info->method_count++; break; case ACPI_TYPE_DEVICE: info->device_count++; break; default: break; } /* * We ignore errors from above, and always return OK, since * we don't want to abort the walk on a single error. */ return (AE_OK);}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:61,
示例10: read_capabilitiesstatic int read_capabilities(struct acpi_power_meter_resource *resource){ int res = 0; int i; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_buffer state = { 0, NULL }; struct acpi_buffer format = { sizeof("NNNNNNNNNNN"), "NNNNNNNNNNN" }; union acpi_object *pss; acpi_string *str; acpi_status status; status = acpi_evaluate_object(resource->acpi_dev->handle, "_PMC", NULL, &buffer); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PMC")); return -ENODEV; } pss = buffer.pointer; if (!pss || pss->type != ACPI_TYPE_PACKAGE || pss->package.count != 14) { dev_err(&resource->acpi_dev->dev, ACPI_POWER_METER_NAME "Invalid _PMC data/n"); res = -EFAULT; goto end; } /* Grab all the integer data at once */ state.length = sizeof(struct acpi_power_meter_capabilities); state.pointer = &resource->caps; status = acpi_extract_package(pss, &format, &state); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Invalid data")); res = -EFAULT; goto end; } if (resource->caps.units) { dev_err(&resource->acpi_dev->dev, ACPI_POWER_METER_NAME "Unknown units %llu./n", resource->caps.units); res = -EINVAL; goto end; } /* Grab the string data */ str = &resource->model_number; for (i = 11; i < 14; i++) { union acpi_object *element = &(pss->package.elements[i]); if (element->type != ACPI_TYPE_STRING) { res = -EINVAL; goto error; } *str = kzalloc(sizeof(u8) * (element->string.length + 1), GFP_KERNEL); if (!*str) { res = -ENOMEM; goto error; } strncpy(*str, element->string.pointer, element->string.length); str++; } dev_info(&resource->acpi_dev->dev, "Found ACPI power meter./n"); goto end;error: str = &resource->model_number; for (i = 0; i < 3; i++, str++) kfree(*str);end: kfree(buffer.pointer); return res;}
开发者ID:debugevery,项目名称:android-kernel-samsung-dev,代码行数:79,
示例11: AcpiEvPciConfigRegionSetupACPI_STATUSAcpiEvPciConfigRegionSetup ( ACPI_HANDLE Handle, UINT32 Function, void *HandlerContext, void **RegionContext){ ACPI_STATUS Status = AE_OK; UINT64 PciValue; ACPI_PCI_ID *PciId = *RegionContext; ACPI_OPERAND_OBJECT *HandlerObj; ACPI_NAMESPACE_NODE *ParentNode; ACPI_NAMESPACE_NODE *PciRootNode; ACPI_NAMESPACE_NODE *PciDeviceNode; ACPI_OPERAND_OBJECT *RegionObj = (ACPI_OPERAND_OBJECT *) Handle; ACPI_FUNCTION_TRACE (EvPciConfigRegionSetup); HandlerObj = RegionObj->Region.Handler; if (!HandlerObj) { /* * No installed handler. This shouldn't happen because the dispatch * routine checks before we get here, but we check again just in case. */ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Attempting to init a region %p, with no handler/n", RegionObj)); return_ACPI_STATUS (AE_NOT_EXIST); } *RegionContext = NULL; if (Function == ACPI_REGION_DEACTIVATE) { if (PciId) { ACPI_FREE (PciId); } return_ACPI_STATUS (Status); } ParentNode = RegionObj->Region.Node->Parent; /* * Get the _SEG and _BBN values from the device upon which the handler * is installed. * * We need to get the _SEG and _BBN objects relative to the PCI BUS device. * This is the device the handler has been registered to handle. */ /* * If the AddressSpace.Node is still pointing to the root, we need * to scan upward for a PCI Root bridge and re-associate the OpRegion * handlers with that device. */ if (HandlerObj->AddressSpace.Node == AcpiGbl_RootNode) { /* Start search from the parent object */ PciRootNode = ParentNode; while (PciRootNode != AcpiGbl_RootNode) { /* Get the _HID/_CID in order to detect a RootBridge */ if (AcpiEvIsPciRootBridge (PciRootNode)) { /* Install a handler for this PCI root bridge */ Status = AcpiInstallAddressSpaceHandler ( (ACPI_HANDLE) PciRootNode, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL); if (ACPI_FAILURE (Status)) { if (Status == AE_SAME_HANDLER) { /* * It is OK if the handler is already installed on the * root bridge. Still need to return a context object * for the new PCI_Config operation region, however. */ Status = AE_OK; } else { ACPI_EXCEPTION ((AE_INFO, Status, "Could not install PciConfig handler " "for Root Bridge %4.4s", AcpiUtGetNodeName (PciRootNode))); } } break; } PciRootNode = PciRootNode->Parent; } /* PCI root bridge not found, use namespace root node *///.........这里部分代码省略.........
开发者ID:Raphine,项目名称:Raph_Kernel,代码行数:101,
示例12: read_domain_devicesstatic int read_domain_devices(struct acpi_power_meter_resource *resource){ int res = 0; int i; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; union acpi_object *pss; acpi_status status; status = acpi_evaluate_object(resource->acpi_dev->handle, "_PMD", NULL, &buffer); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PMD")); return -ENODEV; } pss = buffer.pointer; if (!pss || pss->type != ACPI_TYPE_PACKAGE) { dev_err(&resource->acpi_dev->dev, ACPI_POWER_METER_NAME "Invalid _PMD data/n"); res = -EFAULT; goto end; } if (!pss->package.count) goto end; resource->domain_devices = kzalloc(sizeof(struct acpi_device *) * pss->package.count, GFP_KERNEL); if (!resource->domain_devices) { res = -ENOMEM; goto end; } resource->holders_dir = kobject_create_and_add("measures", &resource->acpi_dev->dev.kobj); if (!resource->holders_dir) { res = -ENOMEM; goto exit_free; } resource->num_domain_devices = pss->package.count; for (i = 0; i < pss->package.count; i++) { struct acpi_device *obj; union acpi_object *element = &(pss->package.elements[i]); /* Refuse non-references */ if (element->type != ACPI_TYPE_LOCAL_REFERENCE) continue; /* Create a symlink to domain objects */ resource->domain_devices[i] = NULL; status = acpi_bus_get_device(element->reference.handle, &resource->domain_devices[i]); if (ACPI_FAILURE(status)) continue; obj = resource->domain_devices[i]; get_device(&obj->dev); res = sysfs_create_link(resource->holders_dir, &obj->dev.kobj, kobject_name(&obj->dev.kobj)); if (res) { put_device(&obj->dev); resource->domain_devices[i] = NULL; } } res = 0; goto end;exit_free: kfree(resource->domain_devices);end: kfree(buffer.pointer); return res;}
开发者ID:debugevery,项目名称:android-kernel-samsung-dev,代码行数:78,
示例13: acpi_bus_osc_support//.........这里部分代码省略......... break; case ACPI_NOTIFY_DEVICE_WAKE: acpi_handle_debug(handle, "ACPI_NOTIFY_DEVICE_WAKE event/n"); break; case ACPI_NOTIFY_EJECT_REQUEST: acpi_handle_debug(handle, "ACPI_NOTIFY_EJECT_REQUEST event/n"); hotplug_event = true; break; case ACPI_NOTIFY_DEVICE_CHECK_LIGHT: acpi_handle_debug(handle, "ACPI_NOTIFY_DEVICE_CHECK_LIGHT event/n"); /* TBD: Exactly what does 'light' mean? */ break; case ACPI_NOTIFY_FREQUENCY_MISMATCH: acpi_handle_err(handle, "Device cannot be configured due " "to a frequency mismatch/n"); break; case ACPI_NOTIFY_BUS_MODE_MISMATCH: acpi_handle_err(handle, "Device cannot be configured due " "to a bus mode mismatch/n"); break; case ACPI_NOTIFY_POWER_FAULT: acpi_handle_err(handle, "Device has suffered a power fault/n"); break; default: acpi_handle_debug(handle, "Unknown event type 0x%x/n", type); break; } adev = acpi_bus_get_acpi_device(handle); if (!adev) goto err; driver = adev->driver; if (driver && driver->ops.notify && (driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS)) driver->ops.notify(adev, type); if (hotplug_event && ACPI_SUCCESS(acpi_hotplug_schedule(adev, type))) return; acpi_bus_put_acpi_device(adev); return; err: acpi_evaluate_ost(handle, type, ost_code, NULL);}/* -------------------------------------------------------------------------- Initialization/Cleanup -------------------------------------------------------------------------- */static int __init acpi_bus_init_irq(void){ acpi_status status; char *message = NULL; /* * Let the system know what interrupt model we are using by * evaluating the /_PIC object, if exists. */ switch (acpi_irq_model) { case ACPI_IRQ_MODEL_PIC: message = "PIC"; break; case ACPI_IRQ_MODEL_IOAPIC: message = "IOAPIC"; break; case ACPI_IRQ_MODEL_IOSAPIC: message = "IOSAPIC"; break; case ACPI_IRQ_MODEL_GIC: message = "GIC"; break; case ACPI_IRQ_MODEL_PLATFORM: message = "platform specific model"; break; default: printk(KERN_WARNING PREFIX "Unknown interrupt routing model/n"); return -ENODEV; } printk(KERN_INFO PREFIX "Using %s for interrupt routing/n", message); status = acpi_execute_simple_method(NULL, "//_PIC", acpi_irq_model); if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PIC")); return -ENODEV; } return 0;}
开发者ID:ParrotSec,项目名称:linux-psec,代码行数:101,
示例14: AcpiLeaveSleepStateACPI_STATUSAcpiLeaveSleepState ( UINT8 SleepState){ ACPI_OBJECT_LIST ArgList; ACPI_OBJECT Arg; ACPI_STATUS Status; ACPI_BIT_REGISTER_INFO *SleepTypeRegInfo; ACPI_BIT_REGISTER_INFO *SleepEnableRegInfo; UINT32 Pm1aControl; UINT32 Pm1bControl; ACPI_FUNCTION_TRACE (AcpiLeaveSleepState); /* * Set SLP_TYPE and SLP_EN to state S0. * This is unclear from the ACPI Spec, but it is required * by some machines. */ Status = AcpiGetSleepTypeData (ACPI_STATE_S0, &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB); if (ACPI_SUCCESS (Status)) { SleepTypeRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_TYPE); SleepEnableRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_ENABLE); /* Get current value of PM1A control */ Status = AcpiHwRegisterRead (ACPI_REGISTER_PM1_CONTROL, &Pm1aControl); if (ACPI_SUCCESS (Status)) { /* Clear the SLP_EN and SLP_TYP fields */ Pm1aControl &= ~(SleepTypeRegInfo->AccessBitMask | SleepEnableRegInfo->AccessBitMask); Pm1bControl = Pm1aControl; /* Insert the SLP_TYP bits */ Pm1aControl |= (AcpiGbl_SleepTypeA << SleepTypeRegInfo->BitPosition); Pm1bControl |= (AcpiGbl_SleepTypeB << SleepTypeRegInfo->BitPosition); /* Write the control registers and ignore any errors */ (void) AcpiHwWritePm1Control (Pm1aControl, Pm1bControl); } } /* Ensure EnterSleepStatePrep -> EnterSleepState ordering */ AcpiGbl_SleepTypeA = ACPI_SLEEP_TYPE_INVALID; /* Setup parameter object */ ArgList.Count = 1; ArgList.Pointer = &Arg; Arg.Type = ACPI_TYPE_INTEGER; /* Ignore any errors from these methods */ Arg.Integer.Value = ACPI_SST_WAKING; Status = AcpiEvaluateObject (NULL, METHOD_NAME__SST, &ArgList, NULL); if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) { ACPI_EXCEPTION ((AE_INFO, Status, "During Method _SST")); } Arg.Integer.Value = SleepState; Status = AcpiEvaluateObject (NULL, METHOD_NAME__BFS, &ArgList, NULL); if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) { ACPI_EXCEPTION ((AE_INFO, Status, "During Method _BFS")); } Status = AcpiEvaluateObject (NULL, METHOD_NAME__WAK, &ArgList, NULL); if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) { ACPI_EXCEPTION ((AE_INFO, Status, "During Method _WAK")); } /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */ /* * Restore the GPEs: * 1) Disable/Clear all GPEs * 2) Enable all runtime GPEs */ Status = AcpiHwDisableAllGpes (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } AcpiGbl_SystemAwakeAndRunning = TRUE;//.........这里部分代码省略.........
开发者ID:iversonjimmy,项目名称:acer_cloud_wifi_copy,代码行数:101,
示例15: InitializeFullAcpistatic ACPI_STATUS InitializeFullAcpi (void){ ACPI_STATUS Status; /* Initialize the ACPICA subsystem */ Status = AcpiInitializeSubsystem (); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "While initializing ACPICA")); return (Status); } /* Initialize the ACPICA Table Manager and get all ACPI tables */ Status = AcpiInitializeTables (NULL, 0, FALSE); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "While initializing Table Manager")); return (Status); } /* Create the ACPI namespace from ACPI tables */ Status = AcpiLoadTables (); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "While loading ACPI tables")); return (Status); } /* Install local handlers */ Status = InstallHandlers (); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "While installing handlers")); return (Status); } /* Initialize the ACPI hardware */ Status = AcpiEnableSubsystem (ACPI_FULL_INITIALIZATION); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "While enabling ACPICA")); return (Status); } /* Complete the ACPI namespace object initialization */ Status = AcpiInitializeObjects (ACPI_FULL_INITIALIZATION); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "While initializing ACPICA objects")); return (Status); } return (AE_OK);}
开发者ID:olsner,项目名称:os,代码行数:61,
示例16: acpi_os_table_overridestruct acpi_table_header *acpi_tb_table_override(struct acpi_table_header *table_header, struct acpi_table_desc *table_desc){ acpi_status status; struct acpi_table_header *new_table = NULL; acpi_physical_address new_address = 0; u32 new_table_length = 0; u8 new_flags; char *override_type; /* (1) Attempt logical override (returns a logical address) */ status = acpi_os_table_override(table_header, &new_table); if (ACPI_SUCCESS(status) && new_table) { new_address = ACPI_PTR_TO_PHYSADDR(new_table); new_table_length = new_table->length; new_flags = ACPI_TABLE_ORIGIN_OVERRIDE; override_type = "Logical"; goto finish_override; } /* (2) Attempt physical override (returns a physical address) */ status = acpi_os_physical_table_override(table_header, &new_address, &new_table_length); if (ACPI_SUCCESS(status) && new_address && new_table_length) { /* Map the entire new table */ new_table = acpi_os_map_memory(new_address, new_table_length); if (!new_table) { ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY, "%4.4s %p Attempted physical table override failed", table_header->signature, ACPI_PHYSADDR_TO_PTR(table_desc->address))); return (NULL); } override_type = "Physical"; new_flags = ACPI_TABLE_ORIGIN_MAPPED; goto finish_override; } return (NULL); /* There was no override */finish_override: ACPI_INFO((AE_INFO, "%4.4s %p %s table override, new table: %p", table_header->signature, ACPI_PHYSADDR_TO_PTR(table_desc->address), override_type, new_table)); /* We can now unmap/delete the original table (if fully mapped) */ acpi_tb_delete_table(table_desc); /* Setup descriptor for the new table */ table_desc->address = new_address; table_desc->pointer = new_table; table_desc->length = new_table_length; table_desc->flags = new_flags; return (new_table);}
开发者ID:nmdanilov,项目名称:linux-imx_3.14.52,代码行数:69,
示例17: acpi_ev_update_gpesvoid acpi_ev_update_gpes(acpi_owner_id table_owner_id){ struct acpi_gpe_xrupt_info *gpe_xrupt_info; struct acpi_gpe_block_info *gpe_block; struct acpi_gpe_walk_info walk_info; acpi_status status = AE_OK; /* * Find any _Lxx/_Exx GPE methods that have just been loaded. * * Any GPEs that correspond to new _Lxx/_Exx methods are immediately * enabled. * * Examine the namespace underneath each gpe_device within the * gpe_block lists. */ status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); if (ACPI_FAILURE(status)) { return; } walk_info.count = 0; walk_info.owner_id = table_owner_id; walk_info.execute_by_owner_id = TRUE; /* Walk the interrupt level descriptor list */ gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; while (gpe_xrupt_info) { /* Walk all Gpe Blocks attached to this interrupt level */ gpe_block = gpe_xrupt_info->gpe_block_list_head; while (gpe_block) { walk_info.gpe_block = gpe_block; walk_info.gpe_device = gpe_block->node; status = acpi_ns_walk_namespace(ACPI_TYPE_METHOD, walk_info.gpe_device, ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, acpi_ev_match_gpe_method, NULL, &walk_info, NULL); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "While decoding _Lxx/_Exx methods")); } gpe_block = gpe_block->next; } gpe_xrupt_info = gpe_xrupt_info->next; } if (walk_info.count) { ACPI_INFO((AE_INFO, "Enabled %u new GPEs", walk_info.count)); } (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); return;}
开发者ID:08opt,项目名称:linux,代码行数:61,
示例18: AcpiEvAddressSpaceDispatchACPI_STATUSAcpiEvAddressSpaceDispatch ( ACPI_OPERAND_OBJECT *RegionObj, ACPI_OPERAND_OBJECT *FieldObj, UINT32 Function, UINT32 RegionOffset, UINT32 BitWidth, UINT64 *Value){ ACPI_STATUS Status; ACPI_ADR_SPACE_HANDLER Handler; ACPI_ADR_SPACE_SETUP RegionSetup; ACPI_OPERAND_OBJECT *HandlerDesc; ACPI_OPERAND_OBJECT *RegionObj2; void *RegionContext = NULL; ACPI_CONNECTION_INFO *Context; ACPI_PHYSICAL_ADDRESS Address; ACPI_FUNCTION_TRACE (EvAddressSpaceDispatch); RegionObj2 = AcpiNsGetSecondaryObject (RegionObj); if (!RegionObj2) { return_ACPI_STATUS (AE_NOT_EXIST); } /* Ensure that there is a handler associated with this region */ HandlerDesc = RegionObj->Region.Handler; if (!HandlerDesc) { ACPI_ERROR ((AE_INFO, "No handler for Region [%4.4s] (%p) [%s]", AcpiUtGetNodeName (RegionObj->Region.Node), RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId))); return_ACPI_STATUS (AE_NOT_EXIST); } Context = HandlerDesc->AddressSpace.Context; /* * It may be the case that the region has never been initialized. * Some types of regions require special init code */ if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)) { /* This region has not been initialized yet, do it */ RegionSetup = HandlerDesc->AddressSpace.Setup; if (!RegionSetup) { /* No initialization routine, exit with error */ ACPI_ERROR ((AE_INFO, "No init routine for region(%p) [%s]", RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId))); return_ACPI_STATUS (AE_NOT_EXIST); } /* * We must exit the interpreter because the region setup will * potentially execute control methods (for example, the _REG method * for this region) */ AcpiExExitInterpreter (); Status = RegionSetup (RegionObj, ACPI_REGION_ACTIVATE, Context, &RegionContext); /* Re-enter the interpreter */ AcpiExEnterInterpreter (); /* Check for failure of the Region Setup */ if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During region initialization: [%s]", AcpiUtGetRegionName (RegionObj->Region.SpaceId))); return_ACPI_STATUS (Status); } /* Region initialization may have been completed by RegionSetup */ if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)) { RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE; /* * Save the returned context for use in all accesses to * the handler for this particular region */ if (!(RegionObj2->Extra.RegionContext)) { RegionObj2->Extra.RegionContext = RegionContext; }//.........这里部分代码省略.........
开发者ID:malattia,项目名称:acpica-tools,代码行数:101,
示例19: AcpiPsParseLoopACPI_STATUSAcpiPsParseLoop ( ACPI_WALK_STATE *WalkState){ ACPI_STATUS Status = AE_OK; ACPI_PARSE_OBJECT *Op = NULL; /* current op */ ACPI_PARSE_STATE *ParserState; UINT8 *AmlOpStart = NULL; ACPI_FUNCTION_TRACE_PTR (PsParseLoop, WalkState); if (WalkState->DescendingCallback == NULL) { return_ACPI_STATUS (AE_BAD_PARAMETER); } ParserState = &WalkState->ParserState; WalkState->ArgTypes = 0;#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) if (WalkState->WalkType & ACPI_WALK_METHOD_RESTART) { /* We are restarting a preempted control method */ if (AcpiPsHasCompletedScope (ParserState)) { /* * We must check if a predicate to an IF or WHILE statement * was just completed */ if ((ParserState->Scope->ParseScope.Op) && ((ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_IF_OP) || (ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_WHILE_OP)) && (WalkState->ControlState) && (WalkState->ControlState->Common.State == ACPI_CONTROL_PREDICATE_EXECUTING)) { /* * A predicate was just completed, get the value of the * predicate and branch based on that value */ WalkState->Op = NULL; Status = AcpiDsGetPredicateValue (WalkState, ACPI_TO_POINTER (TRUE)); if (ACPI_FAILURE (Status) && ((Status & AE_CODE_MASK) != AE_CODE_CONTROL)) { if (Status == AE_AML_NO_RETURN_VALUE) { ACPI_EXCEPTION ((AE_INFO, Status, "Invoked method did not return a value")); } ACPI_EXCEPTION ((AE_INFO, Status, "GetPredicate Failed")); return_ACPI_STATUS (Status); } Status = AcpiPsNextParseState (WalkState, Op, Status); } AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount); ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p/n", Op)); } else if (WalkState->PrevOp) { /* We were in the middle of an op */ Op = WalkState->PrevOp; WalkState->ArgTypes = WalkState->PrevArgTypes; } }#endif /* Iterative parsing loop, while there is more AML to process: */ while ((ParserState->Aml < ParserState->AmlEnd) || (Op)) { AmlOpStart = ParserState->Aml; if (!Op) { Status = AcpiPsCreateOp (WalkState, AmlOpStart, &Op); if (ACPI_FAILURE (Status)) { if (Status == AE_CTRL_PARSE_CONTINUE) { continue; } if (Status == AE_CTRL_PARSE_PENDING) { Status = AE_OK; } if (Status == AE_CTRL_TERMINATE) { return_ACPI_STATUS (Status); }//.........这里部分代码省略.........
开发者ID:Strongc,项目名称:reactos,代码行数:101,
示例20: AcpiTbVerifyTempTableACPI_STATUSAcpiTbVerifyTempTable ( ACPI_TABLE_DESC *TableDesc, char *Signature, UINT32 *TableIndex){ ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_TRACE (TbVerifyTempTable); /* Validate the table */ Status = AcpiTbValidateTempTable (TableDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (AE_NO_MEMORY); } /* If a particular signature is expected (DSDT/FACS), it must match */ if (Signature && !ACPI_COMPARE_NAMESEG (&TableDesc->Signature, Signature)) { ACPI_BIOS_ERROR ((AE_INFO, "Invalid signature 0x%X for ACPI table, expected [%s]", TableDesc->Signature.Integer, Signature)); Status = AE_BAD_SIGNATURE; goto InvalidateAndExit; } if (AcpiGbl_EnableTableValidation) { /* Verify the checksum */ Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY, "%4.4s 0x%8.8X%8.8X" " Attempted table install failed", AcpiUtValidNameseg (TableDesc->Signature.Ascii) ? TableDesc->Signature.Ascii : "????", ACPI_FORMAT_UINT64 (TableDesc->Address))); goto InvalidateAndExit; } /* Avoid duplications */ if (TableIndex) { Status = AcpiTbCheckDuplication (TableDesc, TableIndex); if (ACPI_FAILURE (Status)) { if (Status != AE_CTRL_TERMINATE) { ACPI_EXCEPTION ((AE_INFO, Status, "%4.4s 0x%8.8X%8.8X" " Table is already loaded", AcpiUtValidNameseg (TableDesc->Signature.Ascii) ? TableDesc->Signature.Ascii : "????", ACPI_FORMAT_UINT64 (TableDesc->Address))); } goto InvalidateAndExit; } } TableDesc->Flags |= ACPI_TABLE_IS_VERIFIED; } return_ACPI_STATUS (Status);InvalidateAndExit: AcpiTbInvalidateTable (TableDesc); return_ACPI_STATUS (Status);}
开发者ID:ColinIanKing,项目名称:fwts,代码行数:79,
示例21: AcpiInitializeSubsystemACPI_STATUSAcpiInitializeSubsystem ( void){ ACPI_STATUS Status; ACPI_FUNCTION_TRACE (AcpiInitializeSubsystem); AcpiGbl_StartupFlags = ACPI_SUBSYSTEM_INITIALIZE; ACPI_DEBUG_EXEC (AcpiUtInitStackPtrTrace ()); /* Initialize the OS-Dependent layer */ Status = AcpiOsInitialize (); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During OSL initialization")); return_ACPI_STATUS (Status); } /* Initialize all globals used by the subsystem */ Status = AcpiUtInitGlobals (); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During initialization of globals")); return_ACPI_STATUS (Status); } /* Create the default mutex objects */ Status = AcpiUtMutexInitialize (); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During Global Mutex creation")); return_ACPI_STATUS (Status); } /* * Initialize the namespace manager and * the root of the namespace tree */ Status = AcpiNsRootInitialize (); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During Namespace initialization")); return_ACPI_STATUS (Status); } /* Initialize the global OSI interfaces list with the static names */ Status = AcpiUtInitializeInterfaces (); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During OSI interfaces initialization")); return_ACPI_STATUS (Status); } /* If configured, initialize the AML debugger */ ACPI_DEBUGGER_EXEC (Status = AcpiDbInitialize ()); return_ACPI_STATUS (Status);}
开发者ID:Xeffyr,项目名称:KolibriOS-Mod,代码行数:65,
示例22: acpi_hw_set_mode/****************************************************************************** * * FUNCTION: acpi_hw_set_mode * * PARAMETERS: Mode - SYS_MODE_ACPI or SYS_MODE_LEGACY * * RETURN: Status * * DESCRIPTION: Transitions the system into the requested mode. * ******************************************************************************/acpi_status acpi_hw_set_mode(u32 mode){ acpi_status status; u32 retry; ACPI_FUNCTION_TRACE(hw_set_mode); /* * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, * system does not support mode transition. */ if (!acpi_gbl_FADT.smi_command) { ACPI_ERROR((AE_INFO, "No SMI_CMD in FADT, mode transition failed")); return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); } /* * ACPI 2.0 clarified the meaning of ACPI_ENABLE and ACPI_DISABLE * in FADT: If it is zero, enabling or disabling is not supported. * As old systems may have used zero for mode transition, * we make sure both the numbers are zero to determine these * transitions are not supported. */ if (!acpi_gbl_FADT.acpi_enable && !acpi_gbl_FADT.acpi_disable) { ACPI_ERROR((AE_INFO, "No ACPI mode transition supported in this system (enable/disable both zero)")); return_ACPI_STATUS(AE_OK); } switch (mode) { case ACPI_SYS_MODE_ACPI: /* BIOS should have disabled ALL fixed and GP events */ status = acpi_os_write_port(acpi_gbl_FADT.smi_command, (u32) acpi_gbl_FADT.acpi_enable, 8); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Attempting to enable ACPI mode/n")); break; case ACPI_SYS_MODE_LEGACY: /* * BIOS should clear all fixed status bits and restore fixed event * enable bits to default */ status = acpi_os_write_port(acpi_gbl_FADT.smi_command, (u32) acpi_gbl_FADT.acpi_disable, 8); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Attempting to enable Legacy (non-ACPI) mode/n")); break; default: return_ACPI_STATUS(AE_BAD_PARAMETER); } if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Could not write ACPI mode change")); return_ACPI_STATUS(status); } /* * Some hardware takes a LONG time to switch modes. Give them 3 sec to * do so, but allow faster systems to proceed more quickly. */ retry = 3000; while (retry) { if (acpi_hw_get_mode() == mode) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Mode %X successfully enabled/n", mode)); return_ACPI_STATUS(AE_OK); } acpi_os_stall(1000); retry--; } ACPI_ERROR((AE_INFO, "Hardware did not change modes")); return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:95,
示例23: acpi_ns_simple_repairacpi_statusacpi_ns_simple_repair(struct acpi_evaluate_info *info, u32 expected_btypes, u32 package_index, union acpi_operand_object **return_object_ptr){ union acpi_operand_object *return_object = *return_object_ptr; union acpi_operand_object *new_object = NULL; acpi_status status; const struct acpi_simple_repair_info *predefined; ACPI_FUNCTION_NAME(ns_simple_repair); /* * Special repairs for certain names that are in the repair table. * Check if this name is in the list of repairable names. */ predefined = acpi_ns_match_simple_repair(info->node, info->return_btype, package_index); if (predefined) { if (!return_object) { ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, ACPI_WARN_ALWAYS, "Missing expected return value")); } status = predefined->object_converter(return_object, &new_object); if (ACPI_FAILURE(status)) { /* A fatal error occurred during a conversion */ ACPI_EXCEPTION((AE_INFO, status, "During return object analysis")); return (status); } if (new_object) { goto object_repaired; } } /* * Do not perform simple object repair unless the return type is not * expected. */ if (info->return_btype & expected_btypes) { return (AE_OK); } /* * At this point, we know that the type of the returned object was not * one of the expected types for this predefined name. Attempt to * repair the object by converting it to one of the expected object * types for this predefined name. */ /* * If there is no return value, check if we require a return value for * this predefined name. Either one return value is expected, or none, * for both methods and other objects. * * Exit now if there is no return object. Warning if one was expected. */ if (!return_object) { if (expected_btypes && (!(expected_btypes & ACPI_RTYPE_NONE))) { ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, ACPI_WARN_ALWAYS, "Missing expected return value")); return (AE_AML_NO_RETURN_VALUE); } } if (expected_btypes & ACPI_RTYPE_INTEGER) { status = acpi_ns_convert_to_integer(return_object, &new_object); if (ACPI_SUCCESS(status)) { goto object_repaired; } } if (expected_btypes & ACPI_RTYPE_STRING) { status = acpi_ns_convert_to_string(return_object, &new_object); if (ACPI_SUCCESS(status)) { goto object_repaired; } } if (expected_btypes & ACPI_RTYPE_BUFFER) { status = acpi_ns_convert_to_buffer(return_object, &new_object); if (ACPI_SUCCESS(status)) { goto object_repaired; } } if (expected_btypes & ACPI_RTYPE_PACKAGE) { /* * A package is expected. We will wrap the existing object with a * new package object. It is often the case that if a variable-length * package is required, but there is only a single object needed, the * BIOS will return that object instead of wrapping it with a Package * object. Note: after the wrapping, the package will be validated * for correct contents (expected object type or types).//.........这里部分代码省略.........
开发者ID:03199618,项目名称:linux,代码行数:101,
示例24: AcpiDsInitOneObjectstatic ACPI_STATUSAcpiDsInitOneObject ( ACPI_HANDLE ObjHandle, UINT32 Level, void *Context, void **ReturnValue){ ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context; ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; ACPI_OBJECT_TYPE Type; ACPI_STATUS Status; ACPI_FUNCTION_ENTRY (); /* * We are only interested in NS nodes owned by the table that * was just loaded */ if (Node->OwnerId != Info->OwnerId) { return (AE_OK); } Info->ObjectCount++; /* And even then, we are only interested in a few object types */ Type = AcpiNsGetType (ObjHandle); switch (Type) { case ACPI_TYPE_REGION: Status = AcpiDsInitializeRegion (ObjHandle); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During Region initialization %p [%4.4s]", ObjHandle, AcpiUtGetNodeName (ObjHandle))); } Info->OpRegionCount++; break; case ACPI_TYPE_METHOD: Info->MethodCount++; break; case ACPI_TYPE_DEVICE: Info->DeviceCount++; break; default: break; } /* * We ignore errors from above, and always return OK, since * we don't want to abort the walk on a single error. */ return (AE_OK);}
开发者ID:ornarium,项目名称:freebsd,代码行数:69,
示例25: acpi_ut_acquire_mutexacpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id){ acpi_status status; acpi_thread_id this_thread_id; ACPI_FUNCTION_NAME(ut_acquire_mutex); if (mutex_id > ACPI_MAX_MUTEX) { return (AE_BAD_PARAMETER); } this_thread_id = acpi_os_get_thread_id();#ifdef ACPI_MUTEX_DEBUG { u32 i; /* * Mutex debug code, for internal debugging only. * * Deadlock prevention. Check if this thread owns any mutexes of value * greater than or equal to this one. If so, the thread has violated * the mutex ordering rule. This indicates a coding error somewhere in * the ACPI subsystem code. */ for (i = mutex_id; i < ACPI_NUM_MUTEX; i++) { if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { if (i == mutex_id) { ACPI_ERROR((AE_INFO, "Mutex [%s] already acquired by this thread [%u]", acpi_ut_get_mutex_name (mutex_id), (u32)this_thread_id)); return (AE_ALREADY_ACQUIRED); } ACPI_ERROR((AE_INFO, "Invalid acquire order: Thread %u owns [%s], wants [%s]", (u32)this_thread_id, acpi_ut_get_mutex_name(i), acpi_ut_get_mutex_name(mutex_id))); return (AE_ACQUIRE_DEADLOCK); } } }#endif ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %u attempting to acquire Mutex [%s]/n", (u32)this_thread_id, acpi_ut_get_mutex_name(mutex_id))); status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, ACPI_WAIT_FOREVER); if (ACPI_SUCCESS(status)) { ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %u acquired Mutex [%s]/n", (u32)this_thread_id, acpi_ut_get_mutex_name(mutex_id))); acpi_gbl_mutex_info[mutex_id].use_count++; acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; } else { ACPI_EXCEPTION((AE_INFO, status, "Thread %u could not acquire Mutex [0x%X]", (u32)this_thread_id, mutex_id)); } return (status);}
开发者ID:1800alex,项目名称:linux,代码行数:71,
示例26: acpi_tb_verify_temp_tableacpi_statusacpi_tb_verify_temp_table(struct acpi_table_desc *table_desc, char *signature, u32 *table_index){ acpi_status status = AE_OK; ACPI_FUNCTION_TRACE(tb_verify_temp_table); /* Validate the table */ status = acpi_tb_validate_temp_table(table_desc); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(AE_NO_MEMORY); } /* If a particular signature is expected (DSDT/FACS), it must match */ if (signature && !ACPI_COMPARE_NAME(&table_desc->signature, signature)) { ACPI_BIOS_ERROR((AE_INFO, "Invalid signature 0x%X for ACPI table, expected [%s]", table_desc->signature.integer, signature)); status = AE_BAD_SIGNATURE; goto invalidate_and_exit; } if (acpi_gbl_enable_table_validation) { /* Verify the checksum */ status = acpi_tb_verify_checksum(table_desc->pointer, table_desc->length); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY, "%4.4s 0x%8.8X%8.8X" " Attempted table install failed", acpi_ut_valid_nameseg(table_desc-> signature. ascii) ? table_desc->signature.ascii : "????", ACPI_FORMAT_UINT64(table_desc-> address))); goto invalidate_and_exit; } /* Avoid duplications */ if (table_index) { status = acpi_tb_check_duplication(table_desc, table_index); if (ACPI_FAILURE(status)) { if (status != AE_CTRL_TERMINATE) { ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY, "%4.4s 0x%8.8X%8.8X" " Table is duplicated", acpi_ut_valid_nameseg (table_desc->signature. ascii) ? table_desc-> signature. ascii : "????", ACPI_FORMAT_UINT64 (table_desc->address))); } goto invalidate_and_exit; } } table_desc->flags |= ACPI_TABLE_IS_VERIFIED; } return_ACPI_STATUS(status);invalidate_and_exit: acpi_tb_invalidate_table(table_desc); return_ACPI_STATUS(status);}
开发者ID:CCNITSilchar,项目名称:linux,代码行数:78,
示例27: AcpiNsRootInitializeACPI_STATUSAcpiNsRootInitialize ( void){ ACPI_STATUS Status; const ACPI_PREDEFINED_NAMES *InitVal = NULL; ACPI_NAMESPACE_NODE *NewNode; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STRING Val = NULL; ACPI_FUNCTION_TRACE (NsRootInitialize); Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* * The global root ptr is initially NULL, so a non-NULL value indicates * that AcpiNsRootInitialize() has already been called; just return. */ if (AcpiGbl_RootNode) { Status = AE_OK; goto UnlockAndExit; } /* * Tell the rest of the subsystem that the root is initialized * (This is OK because the namespace is locked) */ AcpiGbl_RootNode = &AcpiGbl_RootNodeStruct; /* Enter the pre-defined names in the name table */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Entering predefined entries into namespace/n")); for (InitVal = AcpiGbl_PreDefinedNames; InitVal->Name; InitVal++) { /* _OSI is optional for now, will be permanent later */ if (!strcmp (InitVal->Name, "_OSI") && !AcpiGbl_CreateOsiMethod) { continue; } Status = AcpiNsLookup (NULL, __UNCONST(InitVal->Name), InitVal->Type, ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, NULL, &NewNode); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "Could not create predefined name %s", InitVal->Name)); continue; } /* * Name entered successfully. If entry in PreDefinedNames[] specifies * an initial value, create the initial value. */ if (InitVal->Val) { Status = AcpiOsPredefinedOverride (InitVal, &Val); if (ACPI_FAILURE (Status)) { ACPI_ERROR ((AE_INFO, "Could not override predefined %s", InitVal->Name)); } if (!Val) { Val = __UNCONST(InitVal->Val); } /* * Entry requests an initial value, allocate a * descriptor for it. */ ObjDesc = AcpiUtCreateInternalObject (InitVal->Type); if (!ObjDesc) { Status = AE_NO_MEMORY; goto UnlockAndExit; } /* * Convert value string from table entry to * internal representation. Only types actually * used for initial values are implemented here. */ switch (InitVal->Type) { case ACPI_TYPE_METHOD://.........这里部分代码省略.........
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:101,
注:本文中的ACPI_EXCEPTION函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ACPI_FAILURE函数代码示例 C++ ACPI_DIV_8函数代码示例 |