这篇教程C++ ACPI_FAILURE函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ACPI_FAILURE函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_FAILURE函数的具体用法?C++ ACPI_FAILURE怎么用?C++ ACPI_FAILURE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ACPI_FAILURE函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: OpcAmlConstantWalk//.........这里部分代码省略......... /* Allocate a new temporary root for this subtree */ RootOp = TrAllocateNode (PARSEOP_INTEGER); if (!RootOp) { return (AE_NO_MEMORY); } RootOp->Common.AmlOpcode = AML_INT_EVAL_SUBTREE_OP; OriginalParentOp = Op->Common.Parent; Op->Common.Parent = RootOp; /* Hand off the subtree to the AML interpreter */ Status = TrWalkParseTree (Op, ASL_WALK_VISIT_TWICE, OpcAmlEvaluationWalk1, OpcAmlEvaluationWalk2, WalkState); Op->Common.Parent = OriginalParentOp; /* TBD: we really *should* release the RootOp node */ if (ACPI_SUCCESS (Status)) { TotalFolds++; /* Get the final result */ Status = AcpiDsResultPop (&ObjDesc, WalkState); } /* Check for error from the ACPICA core */ if (ACPI_FAILURE (Status)) { AslCoreSubsystemError (Op, Status, "Failure during constant evaluation", FALSE); } } if (ACPI_FAILURE (Status)) { /* We could not resolve the subtree for some reason */ AslError (ASL_ERROR, ASL_MSG_CONSTANT_EVALUATION, Op, Op->Asl.ParseOpName); /* Set the subtree value to ZERO anyway. Eliminates further errors */ OpcUpdateIntegerNode (Op, 0); } else { AslError (ASL_OPTIMIZATION, ASL_MSG_CONSTANT_FOLDED, Op, Op->Asl.ParseOpName); /* * Because we know we executed type 3/4/5 opcodes above, we know that * the result must be either an Integer, String, or Buffer. */ switch (ObjDesc->Common.Type) { case ACPI_TYPE_INTEGER: OpcUpdateIntegerNode (Op, ObjDesc->Integer.Value);
开发者ID:cloudius-systems,项目名称:acpica,代码行数:66,
示例2: acpi_ns_delete_subtreestatic acpi_status acpi_ns_delete_subtree(acpi_handle start_handle){ acpi_status status; acpi_handle child_handle; acpi_handle parent_handle; acpi_handle next_child_handle; acpi_handle dummy; u32 level; ACPI_FUNCTION_TRACE(ns_delete_subtree); parent_handle = start_handle; child_handle = NULL; level = 1; /* * Traverse the tree of objects until we bubble back up * to where we started. */ while (level > 0) { /* Attempt to get the next object in this scope */ status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle, child_handle, &next_child_handle); child_handle = next_child_handle; /* Did we get a new object? */ if (ACPI_SUCCESS(status)) { /* Check if this object has any children */ if (ACPI_SUCCESS (acpi_get_next_object (ACPI_TYPE_ANY, child_handle, NULL, &dummy))) { /* * There is at least one child of this object, * visit the object */ level++; parent_handle = child_handle; child_handle = NULL; } } else { /* * No more children in this object, go back up to * the object's parent */ level--; /* Delete all children now */ acpi_ns_delete_children(child_handle); child_handle = parent_handle; status = acpi_get_parent(parent_handle, &parent_handle); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } } } /* Now delete the starting object, and we are done */ acpi_ns_remove_node(child_handle); return_ACPI_STATUS(AE_OK);}
开发者ID:AdrianHuang,项目名称:linux-3.8.13,代码行数:69,
示例3: acpi_processor_get_infostatic int acpi_processor_get_info(struct acpi_processor *pr){ acpi_status status = 0; union acpi_object object = { 0 }; struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; int cpu_index; static int cpu0_initialized; if (!pr) return -EINVAL; if (num_online_cpus() > 1) errata.smp = TRUE; acpi_processor_errata(pr); /* * Check to see if we have bus mastering arbitration control. This * is required for proper C3 usage (to maintain cache coherency). */ if (acpi_fadt.V1_pm2_cnt_blk && acpi_fadt.pm2_cnt_len) { pr->flags.bm_control = 1; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Bus mastering arbitration control present/n")); } else ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No bus mastering arbitration control/n")); /* * Evalute the processor object. Note that it is common on SMP to * have the first (boot) processor with a valid PBLK address while * all others have a NULL address. */ status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); if (ACPI_FAILURE(status)) { printk(KERN_ERR PREFIX "Evaluating processor object/n"); return -ENODEV; } /* * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP. * >>> 'acpi_get_processor_id(acpi_id, &id)' in arch/xxx/acpi.c */ pr->acpi_id = object.processor.proc_id; cpu_index = convert_acpiid_to_cpu(pr->acpi_id); /* Handle UP system running SMP kernel, with no LAPIC in MADT */ if (!cpu0_initialized && (cpu_index == -1) && (num_online_cpus() == 1)) { cpu_index = 0; } cpu0_initialized = 1; pr->id = cpu_index; /* * Extra Processor objects may be enumerated on MP systems with * less than the max # of CPUs. They should be ignored _iff * they are physically not present. */ if (cpu_index == -1) { if (ACPI_FAILURE (acpi_processor_hotadd_init(pr->handle, &pr->id)) && !processor_cntl_external()) { printk(KERN_ERR PREFIX "Getting cpuindex for acpiid 0x%x/n", pr->acpi_id); return -ENODEV; } } ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d:%d]/n", pr->id, pr->acpi_id)); if (!object.processor.pblk_address) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No PBLK (NULL address)/n")); else if (object.processor.pblk_length != 6) printk(KERN_ERR PREFIX "Invalid PBLK length [%d]/n", object.processor.pblk_length); else { pr->throttling.address = object.processor.pblk_address; pr->throttling.duty_offset = acpi_fadt.duty_offset; pr->throttling.duty_width = acpi_fadt.duty_width; pr->pblk = object.processor.pblk_address; /* * We don't care about error returns - we just try to mark * these reserved so that nobody else is confused into thinking * that this region might be unused.. * * (In particular, allocating the IO range for Cardbus) */ request_region(pr->throttling.address, 6, "ACPI CPU throttle"); } return 0;//.........这里部分代码省略.........
开发者ID:cywzl,项目名称:spice4xen,代码行数:101,
示例4: AslDoOneFileACPI_STATUSAslDoOneFile ( char *Filename){ ACPI_STATUS Status; /* Re-initialize "some" compiler/preprocessor globals */ AslInitializeGlobals (); PrInitializeGlobals (); /* * Extract the directory path. This path is used for possible include * files and the optional AML filename embedded in the input file * DefinitionBlock declaration. */ Status = FlSplitInputPathname (Filename, &Gbl_DirectoryPath, NULL); if (ACPI_FAILURE (Status)) { return (Status); } /* Take a copy of the input filename, convert any backslashes */ Gbl_Files[ASL_FILE_INPUT].Filename = UtStringCacheCalloc (strlen (Filename) + 1); strcpy (Gbl_Files[ASL_FILE_INPUT].Filename, Filename); UtConvertBackslashes (Gbl_Files[ASL_FILE_INPUT].Filename); /* * AML Disassembly (Optional) */ if (Gbl_DisasmFlag) { Status = AslDoDisassembly (); if (Status != AE_CTRL_CONTINUE) { return (Status); } } /* * Open the input file. Here, this should be an ASCII source file, * either an ASL file or a Data Table file */ Status = FlOpenInputFile (Gbl_Files[ASL_FILE_INPUT].Filename); if (ACPI_FAILURE (Status)) { AePrintErrorLog (ASL_FILE_STDERR); return (AE_ERROR); } /* Determine input file type */ Gbl_FileType = AslDetectSourceFileType (&Gbl_Files[ASL_FILE_INPUT]); if (Gbl_FileType == ASL_INPUT_TYPE_BINARY) { return (AE_ERROR); } /* * If -p not specified, we will use the input filename as the * output filename prefix */ if (Gbl_UseDefaultAmlFilename) { Gbl_OutputFilenamePrefix = Gbl_Files[ASL_FILE_INPUT].Filename; } /* Open the optional output files (listings, etc.) */ Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix); if (ACPI_FAILURE (Status)) { AePrintErrorLog (ASL_FILE_STDERR); return (AE_ERROR); } /* * Compilation of ASL source versus DataTable source uses different * compiler subsystems */ switch (Gbl_FileType) { /* * Data Table Compilation */ case ASL_INPUT_TYPE_ASCII_DATA: Status = DtDoCompile (); if (ACPI_FAILURE (Status)) { return (Status); } if (Gbl_Signature) { Gbl_Signature = NULL;//.........这里部分代码省略.........
开发者ID:macmade,项目名称:acpica,代码行数:101,
示例5: AcpiNsLookup//.........这里部分代码省略......... /* * Only allow automatic parent search (search rules) if the caller * requested it AND we have a single, non-fully-qualified NameSeg */ if ((SearchParentFlag != ACPI_NS_NO_UPSEARCH) && (Flags & ACPI_NS_SEARCH_PARENT)) { LocalFlags |= ACPI_NS_SEARCH_PARENT; } /* Set error flag according to caller */ if (Flags & ACPI_NS_ERROR_IF_FOUND) { LocalFlags |= ACPI_NS_ERROR_IF_FOUND; } /* Set override flag according to caller */ if (Flags & ACPI_NS_OVERRIDE_IF_FOUND) { LocalFlags |= ACPI_NS_OVERRIDE_IF_FOUND; } } /* Extract one ACPI name from the front of the pathname */ ACPI_MOVE_32_TO_32 (&SimpleName, Path); /* Try to find the single (4 character) ACPI name */ Status = AcpiNsSearchAndEnter (SimpleName, WalkState, CurrentNode, InterpreterMode, ThisSearchType, LocalFlags, &ThisNode); if (ACPI_FAILURE (Status)) { if (Status == AE_NOT_FOUND) { /* Name not found in ACPI namespace */ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Name [%4.4s] not found in scope [%4.4s] %p/n", (char *) &SimpleName, (char *) &CurrentNode->Name, CurrentNode)); } *ReturnNode = ThisNode; return_ACPI_STATUS (Status); } /* More segments to follow? */ if (NumSegments > 0) { /* * If we have an alias to an object that opens a scope (such as a * device or processor), we need to dereference the alias here so * that we can access any children of the original node (via the * remaining segments). */ if (ThisNode->Type == ACPI_TYPE_LOCAL_ALIAS) { if (!ThisNode->Object) { return_ACPI_STATUS (AE_NOT_EXIST); }
开发者ID:Strongc,项目名称:reactos,代码行数:66,
示例6: AcpiEvMatchGpeMethodACPI_STATUSAcpiEvMatchGpeMethod ( ACPI_HANDLE ObjHandle, UINT32 Level, void *Context, void **ReturnValue){ ACPI_NAMESPACE_NODE *MethodNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); ACPI_GPE_WALK_INFO *WalkInfo = ACPI_CAST_PTR (ACPI_GPE_WALK_INFO, Context); ACPI_GPE_EVENT_INFO *GpeEventInfo; ACPI_STATUS Status; UINT32 GpeNumber; UINT8 TempGpeNumber; char Name[ACPI_NAME_SIZE + 1]; UINT8 Type; ACPI_FUNCTION_TRACE (EvMatchGpeMethod); /* Check if requested OwnerId matches this OwnerId */ if ((WalkInfo->ExecuteByOwnerId) && (MethodNode->OwnerId != WalkInfo->OwnerId)) { return_ACPI_STATUS (AE_OK); } /* * Match and decode the _Lxx and _Exx GPE method names * * 1) Extract the method name and null terminate it */ ACPI_MOVE_32_TO_32 (Name, &MethodNode->Name.Integer); Name[ACPI_NAME_SIZE] = 0; /* 2) Name must begin with an underscore */ if (Name[0] != '_') { return_ACPI_STATUS (AE_OK); /* Ignore this method */ } /* * 3) Edge/Level determination is based on the 2nd character * of the method name */ switch (Name[1]) { case 'L': Type = ACPI_GPE_LEVEL_TRIGGERED; break; case 'E': Type = ACPI_GPE_EDGE_TRIGGERED; break; default: /* Unknown method type, just ignore it */ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Ignoring unknown GPE method type: %s " "(name not of form _Lxx or _Exx)", Name)); return_ACPI_STATUS (AE_OK); } /* 4) The last two characters of the name are the hex GPE Number */ Status = AcpiUtAsciiToHexByte (&Name[2], &TempGpeNumber); if (ACPI_FAILURE (Status)) { /* Conversion failed; invalid method, just ignore it */ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Could not extract GPE number from name: %s " "(name is not of form _Lxx or _Exx)", Name)); return_ACPI_STATUS (AE_OK); } /* Ensure that we have a valid GPE number for this GPE block */ GpeNumber = (UINT32) TempGpeNumber; GpeEventInfo = AcpiEvLowGetGpeInfo (GpeNumber, WalkInfo->GpeBlock); if (!GpeEventInfo) { /* * This GpeNumber is not valid for this GPE block, just ignore it. * However, it may be valid for a different GPE block, since GPE0 * and GPE1 methods both appear under /_GPE. */ return_ACPI_STATUS (AE_OK); } if ((ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == ACPI_GPE_DISPATCH_HANDLER) || (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == ACPI_GPE_DISPATCH_RAW_HANDLER))//.........这里部分代码省略.........
开发者ID:Paradoxianer,项目名称:haiku,代码行数:101,
示例7: AslDetectSourceFileTypestatic UINT8AslDetectSourceFileType ( ASL_FILE_INFO *Info){ char *FileChar; UINT8 Type; ACPI_STATUS Status; /* Check for a valid binary ACPI table */ Status = FlCheckForAcpiTable (Info->Handle); if (ACPI_SUCCESS (Status)) { Type = ASL_INPUT_TYPE_ACPI_TABLE; goto Cleanup; } /* Check for 100% ASCII source file (comments are ignored) */ Status = FlCheckForAscii (Info->Handle, Info->Filename, TRUE); if (ACPI_FAILURE (Status)) { printf ("Non-ascii input file - %s/n", Info->Filename); if (!Gbl_IgnoreErrors) { Type = ASL_INPUT_TYPE_BINARY; goto Cleanup; } } /* * File is ASCII. Determine if this is an ASL file or an ACPI data * table file. */ while (fgets (Gbl_CurrentLineBuffer, Gbl_LineBufferSize, Info->Handle)) { /* Uppercase the buffer for caseless compare */ FileChar = Gbl_CurrentLineBuffer; while (*FileChar) { *FileChar = (char) toupper ((int) *FileChar); FileChar++; } /* Presence of "DefinitionBlock" indicates actual ASL code */ if (strstr (Gbl_CurrentLineBuffer, "DEFINITIONBLOCK")) { /* Appears to be an ASL file */ Type = ASL_INPUT_TYPE_ASCII_ASL; goto Cleanup; } } /* Not an ASL source file, default to a data table source file */ Type = ASL_INPUT_TYPE_ASCII_DATA;Cleanup: /* Must seek back to the start of the file */ fseek (Info->Handle, 0, SEEK_SET); return (Type);}
开发者ID:macmade,项目名称:acpica,代码行数:69,
示例8: ipmi_acpi_attachstatic intipmi_acpi_attach(device_t dev){ ACPI_HANDLE devh; const char *mode; struct ipmi_get_info info; struct ipmi_softc *sc = device_get_softc(dev); int count, error, flags, i, type; int interface_type = 0, interface_version = 0; error = 0; devh = acpi_get_handle(dev); if (ACPI_FAILURE(acpi_GetInteger(devh, "_IFT", &interface_type))) return (ENXIO); if (ACPI_FAILURE(acpi_GetInteger(devh, "_SRV", &interface_version))) return (ENXIO); switch (interface_type) { case KCS_MODE: count = 2; mode = "KCS"; break; case SMIC_MODE: count = 3; mode = "SMIC"; break; case BT_MODE: device_printf(dev, "BT interface not supported/n"); return (ENXIO); case SSIF_MODE: if (ACPI_FAILURE(acpi_GetInteger(devh, "_ADR", &flags))) return (ENXIO); info.address = flags; device_printf(dev, "SSIF interface not supported on ACPI/n"); return (0); default: return (ENXIO); } if (bus_get_resource(dev, SYS_RES_IOPORT, 0, NULL, NULL) == 0) type = SYS_RES_IOPORT; else if (bus_get_resource(dev, SYS_RES_MEMORY, 0, NULL, NULL) == 0) type = SYS_RES_MEMORY; else { device_printf(dev, "unknown resource type/n"); return (ENXIO); } sc->ipmi_io_rid = 0; sc->ipmi_io_res[0] = bus_alloc_resource_any(dev, type, &sc->ipmi_io_rid, RF_ACTIVE); sc->ipmi_io_type = type; sc->ipmi_io_spacing = 1; if (sc->ipmi_io_res[0] == NULL) { device_printf(dev, "couldn't configure I/O resource/n"); return (ENXIO); } /* If we have multiple resources, allocate up to MAX_RES. */ for (i = 1; i < MAX_RES; i++) { sc->ipmi_io_rid = i; sc->ipmi_io_res[i] = bus_alloc_resource_any(dev, type, &sc->ipmi_io_rid, RF_ACTIVE); if (sc->ipmi_io_res[i] == NULL) break; } sc->ipmi_io_rid = 0; /* If we have multiple resources, make sure we have enough of them. */ if (sc->ipmi_io_res[1] != NULL && sc->ipmi_io_res[count - 1] == NULL) { device_printf(dev, "too few I/O resources/n"); error = ENXIO; goto bad; } device_printf(dev, "%s mode found at %s 0x%jx on %s/n", mode, type == SYS_RES_IOPORT ? "io" : "mem", (uintmax_t)rman_get_start(sc->ipmi_io_res[0]), device_get_name(device_get_parent(dev))); sc->ipmi_dev = dev; /* * Setup an interrupt if we have an interrupt resource. We * don't support GPE interrupts via _GPE yet. */ sc->ipmi_irq_rid = 0; sc->ipmi_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->ipmi_irq_rid, RF_SHAREABLE | RF_ACTIVE); /* Warn if _GPE exists. */ if (ACPI_SUCCESS(AcpiEvaluateObject(devh, "_GPE", NULL, NULL))) device_printf(dev, "_GPE support not implemented/n"); /* * We assume an alignment of 1 byte as currently the IPMI spec * doesn't provide any way to determine the alignment via ACPI. */ switch (interface_type) {//.........这里部分代码省略.........
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:101,
示例9: acpi_evaluate_referenceACPI_STATUSacpi_evaluate_reference ( ACPI_HANDLE handle, ACPI_STRING pathname, ACPI_OBJECT_LIST *arguments, struct acpi_handle_list *list){ ACPI_STATUS status = AE_OK; ACPI_OBJECT *package = NULL; ACPI_OBJECT *element = NULL; ACPI_BUFFER buffer = {ACPI_ALLOCATE_BUFFER, NULL}; UINT32 i = 0; ACPI_FUNCTION_TRACE("acpi_evaluate_reference"); if (!list) { return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Evaluate object. */ status = AcpiEvaluateObject(handle, pathname, arguments, &buffer); if (ACPI_FAILURE(status)) goto end; package = (ACPI_OBJECT *) buffer.Pointer; if ((buffer.Length == 0) || !package) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No return object (len %X ptr %p)/n", buffer.Length, package)); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; } if (package->Type != ACPI_TYPE_PACKAGE) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Expecting a [Package], found type %X/n", package->Type)); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; } if (!package->Package.Count) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "[Package] has zero elements (%p)/n", package)); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; } if (package->Package.Count > ACPI_MAX_HANDLES) { return AE_NO_MEMORY; } list->count = package->Package.Count; /* Extract package data. */ for (i = 0; i < list->count; i++) { element = &(package->Package.Elements[i]); if (element->Type != ACPI_TYPE_LOCAL_REFERENCE) { status = AE_BAD_DATA; ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Expecting a [Reference] package element, found type %X/n", element->type)); acpi_util_eval_error(handle, pathname, status); break; } if (!element->Reference.Handle) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid reference in" " package %s/n", pathname)); status = AE_NULL_ENTRY; break; } /* Get the ACPI_HANDLE. */ list->handles[i] = element->Reference.Handle; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found reference [%p]/n", list->handles[i])); }end: if (ACPI_FAILURE(status)) { list->count = 0; //ExFreePool(list->handles); } if (buffer.Pointer) AcpiOsFree(buffer.Pointer); return_ACPI_STATUS(status);}
开发者ID:reactos,项目名称:reactos,代码行数:96,
示例10: AcpiNsGetDeviceCallbackstatic ACPI_STATUSAcpiNsGetDeviceCallback ( ACPI_HANDLE ObjHandle, UINT32 NestingLevel, void *Context, void **ReturnValue){ ACPI_GET_DEVICES_INFO *Info = Context; ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node; UINT32 Flags; ACPI_DEVICE_ID *Hid; ACPI_DEVICE_ID_LIST *Cid; UINT32 i; BOOLEAN Found; int NoMatch; Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return (Status); } Node = AcpiNsMapHandleToNode (ObjHandle); Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return (Status); } if (!Node) { return (AE_BAD_PARAMETER); } /* Run _STA to determine if device is present */ Status = AcpiUtExecute_STA (Node, &Flags); if (ACPI_FAILURE (Status)) { return (AE_CTRL_DEPTH); } if (!(Flags & ACPI_STA_DEVICE_PRESENT) && !(Flags & ACPI_STA_DEVICE_FUNCTIONING)) { /* * Don't examine the children of the device only when the * device is neither present nor functional. See ACPI spec, * description of _STA for more information. */ return (AE_CTRL_DEPTH); } /* Filter based on device HID & CID */ if (Info->Hid != NULL) { Status = AcpiUtExecute_HID (Node, &Hid); if (Status == AE_NOT_FOUND) { return (AE_OK); } else if (ACPI_FAILURE (Status)) { return (AE_CTRL_DEPTH); } NoMatch = ACPI_STRCMP (Hid->String, Info->Hid); ACPI_FREE (Hid); if (NoMatch) { /* * HID does not match, attempt match within the * list of Compatible IDs (CIDs) */ Status = AcpiUtExecute_CID (Node, &Cid); if (Status == AE_NOT_FOUND) { return (AE_OK); } else if (ACPI_FAILURE (Status)) { return (AE_CTRL_DEPTH); } /* Walk the CID list */ Found = FALSE; for (i = 0; i < Cid->Count; i++) { if (ACPI_STRCMP (Cid->Ids[i].String, Info->Hid) == 0) { /* Found a matching CID */ Found = TRUE; break; }//.........这里部分代码省略.........
开发者ID:CoryXie,项目名称:BarrelfishOS,代码行数:101,
示例11: acpi_ns_evaluate_relativeacpi_statusacpi_ns_evaluate_relative ( acpi_namespace_node *handle, NATIVE_CHAR *pathname, acpi_operand_object **params, acpi_operand_object **return_object){ acpi_namespace_node *prefix_node; acpi_status status; acpi_namespace_node *node = NULL; NATIVE_CHAR *internal_path = NULL; acpi_generic_state scope_info; FUNCTION_TRACE ("Ns_evaluate_relative"); /* * Must have a valid object handle */ if (!handle) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* Build an internal name string for the method */ status = acpi_ns_internalize_name (pathname, &internal_path); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } /* Get the prefix handle and Node */ acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); prefix_node = acpi_ns_map_handle_to_node (handle); if (!prefix_node) { acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); status = AE_BAD_PARAMETER; goto cleanup; } /* Lookup the name in the namespace */ scope_info.scope.node = prefix_node; status = acpi_ns_lookup (&scope_info, internal_path, ACPI_TYPE_ANY, IMODE_EXECUTE, NS_NO_UPSEARCH, NULL, &node); acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (status)) { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object [%s] not found [%s]/n", pathname, acpi_format_exception (status))); goto cleanup; } /* * Now that we have a handle to the object, we can attempt * to evaluate it. */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s [%p] Value %p/n", pathname, node, node->object)); status = acpi_ns_evaluate_by_handle (node, params, return_object); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "*** Completed eval of object %s ***/n", pathname));cleanup: ACPI_MEM_FREE (internal_path); return_ACPI_STATUS (status);}
开发者ID:TitaniumBoy,项目名称:lin,代码行数:74,
示例12: AcpiWalkNamespaceACPI_STATUSAcpiWalkNamespace ( ACPI_OBJECT_TYPE Type, ACPI_HANDLE StartObject, UINT32 MaxDepth, ACPI_WALK_CALLBACK UserFunction, void *Context, void **ReturnValue){ ACPI_STATUS Status; ACPI_FUNCTION_TRACE (AcpiWalkNamespace); /* Parameter validation */ if ((Type > ACPI_TYPE_LOCAL_MAX) || (!MaxDepth) || (!UserFunction)) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* * Need to acquire the namespace reader lock to prevent interference * with any concurrent table unloads (which causes the deletion of * namespace objects). We cannot allow the deletion of a namespace node * while the user function is using it. The exception to this are the * nodes created and deleted during control method execution -- these * nodes are marked as temporary nodes and are ignored by the namespace * walk. Thus, control methods can be executed while holding the * namespace deletion lock (and the user function can execute control * methods.) */ Status = AcpiUtAcquireReadLock (&AcpiGbl_NamespaceRwLock); if (ACPI_FAILURE (Status)) { return (Status); } /* * Lock the namespace around the walk. The namespace will be * unlocked/locked around each call to the user function - since the user * function must be allowed to make ACPICA calls itself (for example, it * will typically execute control methods during device enumeration.) */ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; } Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth, ACPI_NS_WALK_UNLOCK, UserFunction, Context, ReturnValue); (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);UnlockAndExit: (void) AcpiUtReleaseReadLock (&AcpiGbl_NamespaceRwLock); return_ACPI_STATUS (Status);}
开发者ID:CoryXie,项目名称:BarrelfishOS,代码行数:62,
示例13: AcpiEvaluateObjectACPI_STATUSAcpiEvaluateObject ( ACPI_HANDLE Handle, ACPI_STRING Pathname, ACPI_OBJECT_LIST *ExternalParams, ACPI_BUFFER *ReturnBuffer){ ACPI_STATUS Status; ACPI_EVALUATE_INFO *Info; ACPI_SIZE BufferSpaceNeeded; UINT32 i; ACPI_FUNCTION_TRACE (AcpiEvaluateObject); /* Allocate and initialize the evaluation information block */ Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); if (!Info) { return_ACPI_STATUS (AE_NO_MEMORY); } Info->Pathname = Pathname; /* Convert and validate the device handle */ Info->PrefixNode = AcpiNsMapHandleToNode (Handle); if (!Info->PrefixNode) { Status = AE_BAD_PARAMETER; goto Cleanup; } /* * If there are parameters to be passed to a control method, the external * objects must all be converted to internal objects */ if (ExternalParams && ExternalParams->Count) { /* * Allocate a new parameter block for the internal objects * Add 1 to count to allow for null terminated internal list */ Info->Parameters = ACPI_ALLOCATE_ZEROED ( ((ACPI_SIZE) ExternalParams->Count + 1) * sizeof (void *)); if (!Info->Parameters) { Status = AE_NO_MEMORY; goto Cleanup; } /* Convert each external object in the list to an internal object */ for (i = 0; i < ExternalParams->Count; i++) { Status = AcpiUtCopyEobjectToIobject ( &ExternalParams->Pointer[i], &Info->Parameters[i]); if (ACPI_FAILURE (Status)) { goto Cleanup; } } Info->Parameters[ExternalParams->Count] = NULL; } /* * Three major cases: * 1) Fully qualified pathname * 2) No handle, not fully qualified pathname (error) * 3) Valid handle */ if ((Pathname) && (AcpiNsValidRootPrefix (Pathname[0]))) { /* The path is fully qualified, just evaluate by name */ Info->PrefixNode = NULL; Status = AcpiNsEvaluate (Info); } else if (!Handle) { /* * A handle is optional iff a fully qualified pathname is specified. * Since we've already handled fully qualified names above, this is * an error */ if (!Pathname) { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Both Handle and Pathname are NULL")); } else { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null Handle with relative pathname [%s]", Pathname)); } Status = AE_BAD_PARAMETER;//.........这里部分代码省略.........
开发者ID:CoryXie,项目名称:BarrelfishOS,代码行数:101,
示例14: AcpiEvaluateObjectTypedACPI_STATUSAcpiEvaluateObjectTyped ( ACPI_HANDLE Handle, ACPI_STRING Pathname, ACPI_OBJECT_LIST *ExternalParams, ACPI_BUFFER *ReturnBuffer, ACPI_OBJECT_TYPE ReturnType){ ACPI_STATUS Status; BOOLEAN MustFree = FALSE; ACPI_FUNCTION_TRACE (AcpiEvaluateObjectTyped); /* Return buffer must be valid */ if (!ReturnBuffer) { return_ACPI_STATUS (AE_BAD_PARAMETER); } if (ReturnBuffer->Length == ACPI_ALLOCATE_BUFFER) { MustFree = TRUE; } /* Evaluate the object */ Status = AcpiEvaluateObject (Handle, Pathname, ExternalParams, ReturnBuffer); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Type ANY means "don't care" */ if (ReturnType == ACPI_TYPE_ANY) { return_ACPI_STATUS (AE_OK); } if (ReturnBuffer->Length == 0) { /* Error because caller specifically asked for a return value */ ACPI_ERROR ((AE_INFO, "No return value")); return_ACPI_STATUS (AE_NULL_OBJECT); } /* Examine the object type returned from EvaluateObject */ if (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type == ReturnType) { return_ACPI_STATUS (AE_OK); } /* Return object type does not match requested type */ ACPI_ERROR ((AE_INFO, "Incorrect return type [%s] requested [%s]", AcpiUtGetTypeName (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type), AcpiUtGetTypeName (ReturnType))); if (MustFree) { /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ AcpiOsFree (ReturnBuffer->Pointer); ReturnBuffer->Pointer = NULL; } ReturnBuffer->Length = 0; return_ACPI_STATUS (AE_TYPE);}
开发者ID:CoryXie,项目名称:BarrelfishOS,代码行数:75,
示例15: AcpiEvGpeInitializeACPI_STATUSAcpiEvGpeInitialize ( void){ UINT32 RegisterCount0 = 0; UINT32 RegisterCount1 = 0; UINT32 GpeNumberMax = 0; ACPI_STATUS Status; ACPI_FUNCTION_TRACE (EvGpeInitialize); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Initializing General Purpose Events (GPEs):/n")); Status = AcpiUtAcquireMutex (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 (AcpiGbl_FADT.Gpe0BlockLength && AcpiGbl_FADT.XGpe0Block.Address) { /* GPE block 0 exists (has both length and address > 0) */ RegisterCount0 = (UINT16) (AcpiGbl_FADT.Gpe0BlockLength / 2); GpeNumberMax = (RegisterCount0 * ACPI_GPE_REGISTER_WIDTH) - 1; /* Install GPE Block 0 */ Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice, AcpiGbl_FADT.XGpe0Block.Address, AcpiGbl_FADT.XGpe0Block.SpaceId, RegisterCount0, 0, AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[0]); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "Could not create GPE Block 0")); } } if (AcpiGbl_FADT.Gpe1BlockLength && AcpiGbl_FADT.XGpe1Block.Address) { /* GPE block 1 exists (has both length and address > 0) */ RegisterCount1 = (UINT16) (AcpiGbl_FADT.Gpe1BlockLength / 2); /* Check for GPE0/GPE1 overlap (if both banks exist) */ if ((RegisterCount0) && (GpeNumberMax >= AcpiGbl_FADT.Gpe1Base)) { ACPI_ERROR ((AE_INFO, "GPE0 block (GPE 0 to %u) overlaps the GPE1 block " "(GPE %u to %u) - Ignoring GPE1", GpeNumberMax, AcpiGbl_FADT.Gpe1Base, AcpiGbl_FADT.Gpe1Base + ((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1))); /* Ignore GPE1 block by setting the register count to zero */ RegisterCount1 = 0; } else { /* Install GPE Block 1 */ Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice, AcpiGbl_FADT.XGpe1Block.Address, AcpiGbl_FADT.XGpe1Block.SpaceId,//.........这里部分代码省略.........
开发者ID:Paradoxianer,项目名称:haiku,代码行数:101,
示例16: AcpiEvUpdateGpesvoidAcpiEvUpdateGpes ( ACPI_OWNER_ID TableOwnerId){ ACPI_GPE_XRUPT_INFO *GpeXruptInfo; ACPI_GPE_BLOCK_INFO *GpeBlock; ACPI_GPE_WALK_INFO WalkInfo; 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 GpeDevice within the * GpeBlock lists. */ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); if (ACPI_FAILURE (Status)) { return; } WalkInfo.Count = 0; WalkInfo.OwnerId = TableOwnerId; WalkInfo.ExecuteByOwnerId = TRUE; /* Walk the interrupt level descriptor list */ GpeXruptInfo = AcpiGbl_GpeXruptListHead; while (GpeXruptInfo) { /* Walk all Gpe Blocks attached to this interrupt level */ GpeBlock = GpeXruptInfo->GpeBlockListHead; while (GpeBlock) { WalkInfo.GpeBlock = GpeBlock; WalkInfo.GpeDevice = GpeBlock->Node; Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, WalkInfo.GpeDevice, ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, AcpiEvMatchGpeMethod, NULL, &WalkInfo, NULL); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "While decoding _Lxx/_Exx methods")); } GpeBlock = GpeBlock->Next; } GpeXruptInfo = GpeXruptInfo->Next; } if (WalkInfo.Count) { ACPI_INFO (("Enabled %u new GPEs", WalkInfo.Count)); } (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); return;}
开发者ID:Paradoxianer,项目名称:haiku,代码行数:66,
示例17: read_log/* read binary bios log */int read_log(struct tpm_bios_log *log){ struct acpi_tcpa *buff; acpi_status status; void __iomem *virt; u64 len, start; if (log->bios_event_log != NULL) { printk(KERN_ERR "%s: ERROR - Eventlog already initialized/n", __func__); return -EFAULT; } /* Find TCPA entry in RSDT (ACPI_LOGICAL_ADDRESSING) */ status = acpi_get_table(ACPI_SIG_TCPA, 1, (struct acpi_table_header **)&buff); if (ACPI_FAILURE(status)) { printk(KERN_ERR "%s: ERROR - Could not get TCPA table/n", __func__); return -EIO; } switch(buff->platform_class) { case BIOS_SERVER: len = buff->server.log_max_len; start = buff->server.log_start_addr; break; case BIOS_CLIENT: default: len = buff->client.log_max_len; start = buff->client.log_start_addr; break; } if (!len) { printk(KERN_ERR "%s: ERROR - TCPA log area empty/n", __func__); return -EIO; } /* malloc EventLog space */ log->bios_event_log = kmalloc(len, GFP_KERNEL); if (!log->bios_event_log) { printk("%s: ERROR - Not enough Memory for BIOS measurements/n", __func__); return -ENOMEM; } log->bios_event_log_end = log->bios_event_log + len; virt = acpi_os_map_iomem(start, len); if (!virt) { kfree(log->bios_event_log); printk("%s: ERROR - Unable to map memory/n", __func__); return -EIO; } memcpy_fromio(log->bios_event_log, virt, len); acpi_os_unmap_iomem(virt, len); return 0;}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:63,
示例18: AcpiPsExecuteMethodACPI_STATUSAcpiPsExecuteMethod ( ACPI_EVALUATE_INFO *Info){ ACPI_STATUS Status; ACPI_PARSE_OBJECT *Op; ACPI_WALK_STATE *WalkState; ACPI_FUNCTION_TRACE (PsExecuteMethod); /* Quick validation of DSDT header */ AcpiTbCheckDsdtHeader (); /* Validate the Info and method Node */ if (!Info || !Info->ResolvedNode) { return_ACPI_STATUS (AE_NULL_ENTRY); } /* Init for new method, wait on concurrency semaphore */ Status = AcpiDsBeginMethodExecution (Info->ResolvedNode, Info->ObjDesc, NULL); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* * The caller "owns" the parameters, so give each one an extra reference */ AcpiPsUpdateParameterList (Info, REF_INCREMENT); /* Begin tracing if requested */ AcpiPsStartTrace (Info); /* * Execute the method. Performs parse simultaneously */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Begin Method Parse/Execute [%4.4s] **** Node=%p Obj=%p/n", Info->ResolvedNode->Name.Ascii, Info->ResolvedNode, Info->ObjDesc)); /* Create and init a Root Node */ Op = AcpiPsCreateScopeOp (); if (!Op) { Status = AE_NO_MEMORY; goto Cleanup; } /* Create and initialize a new walk state */ Info->PassNumber = ACPI_IMODE_EXECUTE; WalkState = AcpiDsCreateWalkState ( Info->ObjDesc->Method.OwnerId, NULL, NULL, NULL); if (!WalkState) { Status = AE_NO_MEMORY; goto Cleanup; } Status = AcpiDsInitAmlWalk (WalkState, Op, Info->ResolvedNode, Info->ObjDesc->Method.AmlStart, Info->ObjDesc->Method.AmlLength, Info, Info->PassNumber); if (ACPI_FAILURE (Status)) { AcpiDsDeleteWalkState (WalkState); goto Cleanup; } if (Info->ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL) { WalkState->ParseFlags |= ACPI_PARSE_MODULE_LEVEL; } /* Invoke an internal method if necessary */ if (Info->ObjDesc->Method.InfoFlags & ACPI_METHOD_INTERNAL_ONLY) { Status = Info->ObjDesc->Method.Dispatch.Implementation (WalkState); Info->ReturnObject = WalkState->ReturnDesc; /* Cleanup states */ AcpiDsScopeStackClear (WalkState); AcpiPsCleanupScope (&WalkState->ParserState); AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState); AcpiDsDeleteWalkState (WalkState); goto Cleanup; } /* * Start method evaluation with an implicit return of zero. * This is done for Windows compatibility.//.........这里部分代码省略.........
开发者ID:cloudius-systems,项目名称:acpica,代码行数:101,
示例19: AslDoDisassemblystatic ACPI_STATUSAslDoDisassembly ( void){ ACPI_STATUS Status; /* ACPICA subsystem initialization */ Status = AdInitialize (); if (ACPI_FAILURE (Status)) { return (Status); } Status = AcpiAllocateRootTable (4); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not initialize ACPI Table Manager, %s/n", AcpiFormatException (Status)); return (Status); } /* This is where the disassembly happens */ AcpiGbl_DbOpt_disasm = TRUE; Status = AdAmlDisassemble (AslToFile, Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_OutputFilenamePrefix, &Gbl_Files[ASL_FILE_INPUT].Filename); if (ACPI_FAILURE (Status)) { return (Status); } /* Check if any control methods were unresolved */ AcpiDmUnresolvedWarning (0);#if 0 /* TBD: Handle additional output files for disassembler */ Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix); NsDisplayNamespace ();#endif /* Shutdown compiler and ACPICA subsystem */ AeClearErrorLog (); (void) AcpiTerminate (); /* * Gbl_Files[ASL_FILE_INPUT].Filename was replaced with the * .DSL disassembly file, which can now be compiled if requested */ if (Gbl_DoCompile) { AcpiOsPrintf ("/nCompiling /"%s/"/n", Gbl_Files[ASL_FILE_INPUT].Filename); return (AE_CTRL_CONTINUE); } /* No need to free the filename string */ Gbl_Files[ASL_FILE_INPUT].Filename = NULL; CmDeleteCaches (); return (AE_OK);}
开发者ID:macmade,项目名称:acpica,代码行数:68,
示例20: AcpiDbGetTableFromFileACPI_STATUSAcpiDbGetTableFromFile ( char *Filename, ACPI_TABLE_HEADER **ReturnTable, BOOLEAN MustBeAmlFile){#ifdef ACPI_APPLICATION ACPI_STATUS Status; ACPI_TABLE_HEADER *Table; BOOLEAN IsAmlTable = TRUE; Status = AcpiUtReadTableFromFile (Filename, &Table); if (ACPI_FAILURE (Status)) { return (Status); } if (MustBeAmlFile) { IsAmlTable = AcpiUtIsAmlTable (Table); if (!IsAmlTable) { ACPI_EXCEPTION ((AE_INFO, AE_OK, "Input for -e is not an AML table: " "/"%4.4s/" (must be DSDT/SSDT)", Table->Signature)); return (AE_TYPE); } } if (IsAmlTable) { /* Attempt to recognize and install the table */ Status = AeLocalLoadTable (Table); if (ACPI_FAILURE (Status)) { if (Status == AE_ALREADY_EXISTS) { AcpiOsPrintf ("Table %4.4s is already installed/n", Table->Signature); } else { AcpiOsPrintf ("Could not install table, %s/n", AcpiFormatException (Status)); } return (Status); } AcpiTbPrintTableHeader (0, Table); fprintf (stderr, "Acpi table [%4.4s] successfully installed and loaded/n", Table->Signature); } AcpiGbl_AcpiHardwarePresent = FALSE; if (ReturnTable) { *ReturnTable = Table; }#endif /* ACPI_APPLICATION */ return (AE_OK);}
开发者ID:Yuki-Judai,项目名称:acpica,代码行数:69,
示例21: 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, 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 = 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:Strongc,项目名称:reactos,代码行数:101,
示例22: AcpiEnterSleepStatePrepACPI_STATUSAcpiEnterSleepStatePrep ( UINT8 SleepState){ ACPI_STATUS Status; ACPI_OBJECT_LIST ArgList; ACPI_OBJECT Arg; UINT32 SstValue; ACPI_FUNCTION_TRACE (AcpiEnterSleepStatePrep); 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_PATHNAME__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: SstValue = ACPI_SST_WORKING; break; case ACPI_STATE_S1: case ACPI_STATE_S2: case ACPI_STATE_S3: SstValue = ACPI_SST_SLEEPING; break; case ACPI_STATE_S4: SstValue = ACPI_SST_SLEEP_CONTEXT; break; default: SstValue = 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) */ AcpiHwExecuteSleepMethod (__UNCONST(METHOD_PATHNAME__SST), SstValue); return_ACPI_STATUS (AE_OK);}
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:67,
示例23: CmDoCompileintCmDoCompile ( void){ ACPI_STATUS Status; UINT8 FullCompile; UINT8 Event; FullCompile = UtBeginEvent ("*** Total Compile time ***"); Event = UtBeginEvent ("Open input and output files"); UtEndEvent (Event); Event = UtBeginEvent ("Preprocess input file"); if (Gbl_PreprocessFlag) { /* Preprocessor */ PrDoPreprocess (); if (Gbl_PreprocessOnly) { UtEndEvent (Event); CmCleanupAndExit (); return (0); } } UtEndEvent (Event); /* Build the parse tree */ Event = UtBeginEvent ("Parse source code and build parse tree"); AslCompilerparse(); UtEndEvent (Event); /* Check for parse errors */ Status = AslCheckForErrorExit (); if (ACPI_FAILURE (Status)) { fprintf (stderr, "Compiler aborting due to parser-detected syntax error(s)/n"); LsDumpParseTree (); goto ErrorExit; } /* Did the parse tree get successfully constructed? */ if (!RootNode) { /* * If there are no errors, then we have some sort of * internal problem. */ AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, NULL, "- Could not resolve parse tree root node"); goto ErrorExit; } /* Flush out any remaining source after parse tree is complete */ Event = UtBeginEvent ("Flush source input"); CmFlushSourceCode (); /* Optional parse tree dump, compiler debug output only */ LsDumpParseTree (); OpcGetIntegerWidth (RootNode); UtEndEvent (Event); /* Pre-process parse tree for any operator transforms */ Event = UtBeginEvent ("Parse tree transforms"); DbgPrint (ASL_DEBUG_OUTPUT, "/nParse tree transforms/n/n"); TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, TrAmlTransformWalk, NULL, NULL); UtEndEvent (Event); /* Generate AML opcodes corresponding to the parse tokens */ Event = UtBeginEvent ("Generate AML opcodes"); DbgPrint (ASL_DEBUG_OUTPUT, "/nGenerating AML opcodes/n/n"); TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, OpcAmlOpcodeWalk, NULL); UtEndEvent (Event); /* * Now that the input is parsed, we can open the AML output file. * Note: by default, the name of this file comes from the table descriptor * within the input file. */ Event = UtBeginEvent ("Open AML output file"); Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix); UtEndEvent (Event); if (ACPI_FAILURE (Status)) { AePrintErrorLog (ASL_FILE_STDERR); return (-1); }//.........这里部分代码省略.........
开发者ID:Alkzndr,项目名称:freebsd,代码行数:101,
示例24: ia64_probe_sapicsvoidia64_probe_sapics(void){ ACPI_PHYSICAL_ADDRESS rsdp_ptr; ACPI_SUBTABLE_HEADER *entry; ACPI_TABLE_MADT *table; ACPI_TABLE_RSDP *rsdp; ACPI_TABLE_XSDT *xsdt; char *end, *p; int t, tables; if ((rsdp_ptr = AcpiOsGetRootPointer()) == 0) return; rsdp = (ACPI_TABLE_RSDP *)IA64_PHYS_TO_RR7(rsdp_ptr); xsdt = (ACPI_TABLE_XSDT *)IA64_PHYS_TO_RR7(rsdp->XsdtPhysicalAddress); tables = (UINT64 *)((char *)xsdt + xsdt->Header.Length) - xsdt->TableOffsetEntry; for (t = 0; t < tables; t++) { table = (ACPI_TABLE_MADT *) IA64_PHYS_TO_RR7(xsdt->TableOffsetEntry[t]); if (bootverbose) printf("Table '%c%c%c%c' at %p/n", table->Header.Signature[0], table->Header.Signature[1], table->Header.Signature[2], table->Header.Signature[3], table); if (strncmp(table->Header.Signature, ACPI_SIG_MADT, ACPI_NAME_SIZE) != 0 || ACPI_FAILURE(AcpiTbChecksum((void *)table, table->Header.Length))) continue; /* Save the address of the processor interrupt block. */ if (bootverbose) printf("/tLocal APIC address=0x%x/n", table->Address); ia64_lapic_addr = table->Address; end = (char *)table + table->Header.Length; p = (char *)(table + 1); while (p < end) { entry = (ACPI_SUBTABLE_HEADER *)p; if (bootverbose) print_entry(entry); switch (entry->Type) { case ACPI_MADT_TYPE_IO_SAPIC: { ACPI_MADT_IO_SAPIC *sapic = (ACPI_MADT_IO_SAPIC *)entry; sapic_create(sapic->Id, sapic->GlobalIrqBase, sapic->Address); break; } case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE: { ACPI_MADT_LOCAL_APIC_OVERRIDE *lapic = (ACPI_MADT_LOCAL_APIC_OVERRIDE *)entry; ia64_lapic_addr = lapic->Address; break; }#ifdef SMP case ACPI_MADT_TYPE_LOCAL_SAPIC: { ACPI_MADT_LOCAL_SAPIC *sapic = (ACPI_MADT_LOCAL_SAPIC *)entry; if (sapic->LapicFlags & ACPI_MADT_ENABLED) cpu_mp_add(sapic->ProcessorId, sapic->Id, sapic->Eid); break; }#endif default: break; } p += entry->Length; } }}
开发者ID:JabirTech,项目名称:Source,代码行数:85,
示例25: acpi_ns_load_tableacpi_statusacpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node){ acpi_status status; ACPI_FUNCTION_TRACE(ns_load_table); /* * Parse the table and load the namespace with all named * objects found within. Control methods are NOT parsed * at this time. In fact, the control methods cannot be * parsed until the entire namespace is loaded, because * if a control method makes a forward reference (call) * to another control method, we can't continue parsing * because we don't know how many arguments to parse next! */ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } /* If table already loaded into namespace, just return */ if (acpi_tb_is_table_loaded(table_index)) { status = AE_ALREADY_EXISTS; goto unlock; } ACPI_DEBUG_PRINT((ACPI_DB_INFO, "**** Loading table into namespace ****/n")); status = acpi_tb_allocate_owner_id(table_index); if (ACPI_FAILURE(status)) { goto unlock; } status = acpi_ns_parse_table(table_index, node); if (ACPI_SUCCESS(status)) { acpi_tb_set_table_loaded_flag(table_index, TRUE); } else { (void)acpi_tb_release_owner_id(table_index); } unlock: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } /* * Now we can parse the control methods. We always parse * them here for a sanity check, and if configured for * just-in-time parsing, we delete the control method * parse trees. */ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "**** Begin Table Method Parsing and Object Initialization/n")); status = acpi_ds_initialize_objects(table_index, node); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "**** Completed Table Method Parsing and Object Initialization/n")); return_ACPI_STATUS(status);}
开发者ID:AdrianHuang,项目名称:linux-3.8.13,代码行数:66,
示例26: acpi_evaluate_referenceacpi_statusacpi_evaluate_reference(acpi_handle handle, acpi_string pathname, struct acpi_object_list *arguments, struct acpi_handle_list *list){ acpi_status status = AE_OK; union acpi_object *package = NULL; union acpi_object *element = NULL; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; u32 i = 0; if (!list) { return AE_BAD_PARAMETER; } /* Evaluate object. */ status = acpi_evaluate_object(handle, pathname, arguments, &buffer); if (ACPI_FAILURE(status)) goto end; package = buffer.pointer; if ((buffer.length == 0) || !package) { printk(KERN_ERR PREFIX "No return object (len %X ptr %p)/n", (unsigned)buffer.length, package); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; } if (package->type != ACPI_TYPE_PACKAGE) { printk(KERN_ERR PREFIX "Expecting a [Package], found type %X/n", package->type); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; } if (!package->package.count) { printk(KERN_ERR PREFIX "[Package] has zero elements (%p)/n", package); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; } if (package->package.count > ACPI_MAX_HANDLES) { return AE_NO_MEMORY; } list->count = package->package.count; /* Extract package data. */ for (i = 0; i < list->count; i++) { element = &(package->package.elements[i]); if (element->type != ACPI_TYPE_LOCAL_REFERENCE) { status = AE_BAD_DATA; printk(KERN_ERR PREFIX "Expecting a [Reference] package element, found type %X/n", element->type); acpi_util_eval_error(handle, pathname, status); break; } if (!element->reference.handle) { printk(KERN_WARNING PREFIX "Invalid reference in" " package %s/n", pathname); status = AE_NULL_ENTRY; break; } /* Get the acpi_handle. */ list->handles[i] = element->reference.handle; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found reference [%p]/n", list->handles[i])); } end: if (ACPI_FAILURE(status)) { list->count = 0; //kfree(list->handles); } kfree(buffer.pointer); return status;}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:90,
示例27: AcpiExReadDataFromFieldACPI_STATUSAcpiExReadDataFromField ( ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **RetBufferDesc){ ACPI_STATUS Status; ACPI_OPERAND_OBJECT *BufferDesc; ACPI_SIZE Length; void *Buffer; UINT32 Function; ACPI_FUNCTION_TRACE_PTR (ExReadDataFromField, ObjDesc); /* Parameter validation */ if (!ObjDesc) { return_ACPI_STATUS (AE_AML_NO_OPERAND); } if (!RetBufferDesc) { return_ACPI_STATUS (AE_BAD_PARAMETER); } if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) { /* * If the BufferField arguments have not been previously evaluated, * evaluate them now and save the results. */ if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)) { Status = AcpiDsGetBufferFieldArguments (ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } } else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI)) { /* * This is an SMBus or IPMI read. We must create a buffer to hold * the data and then directly access the region handler. * * Note: Smbus protocol value is passed in upper 16-bits of Function */ if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS) { Length = ACPI_SMBUS_BUFFER_SIZE; Function = ACPI_READ | (ObjDesc->Field.Attribute << 16); } else /* IPMI */ { Length = ACPI_IPMI_BUFFER_SIZE; Function = ACPI_READ; } BufferDesc = AcpiUtCreateBufferObject (Length); if (!BufferDesc) { return_ACPI_STATUS (AE_NO_MEMORY); } /* Lock entire transaction if requested */ AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); /* Call the region handler for the read */ Status = AcpiExAccessRegion (ObjDesc, 0, ACPI_CAST_PTR (UINT64, BufferDesc->Buffer.Pointer), Function); AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); goto Exit; } /* * Allocate a buffer for the contents of the field. * * If the field is larger than the current integer width, create * a BUFFER to hold it. Otherwise, use an INTEGER. This allows * the use of arithmetic operators on the returned value if the * field size is equal or smaller than an Integer. * * Note: Field.length is in bits. */ Length = (ACPI_SIZE) ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->Field.BitLength); if (Length > AcpiGbl_IntegerByteWidth) { /* Field is too large for an Integer, create a Buffer instead */ BufferDesc = AcpiUtCreateBufferObject (Length); if (!BufferDesc) {//.........这里部分代码省略.........
开发者ID:mluszczyk,项目名称:so-minix,代码行数:101,
示例28: AcpiTbInstallAndLoadTableACPI_STATUSAcpiTbInstallAndLoadTable ( ACPI_TABLE_HEADER *Table, ACPI_PHYSICAL_ADDRESS Address, UINT8 Flags, BOOLEAN Override, UINT32 *TableIndex){ ACPI_STATUS Status; UINT32 i; ACPI_OWNER_ID OwnerId; ACPI_FUNCTION_TRACE (AcpiLoadTable); (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); /* Install the table and load it into the namespace */ Status = AcpiTbInstallStandardTable (Address, Flags, TRUE, Override, &i); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; } /* * Note: Now table is "INSTALLED", it must be validated before * using. */ Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[i]); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; } (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); Status = AcpiNsLoadTable (i, AcpiGbl_RootNode); /* Execute any module-level code that was found in the table */ if (!AcpiGbl_ParseTableAsTermList && AcpiGbl_GroupModuleLevelCode) { AcpiNsExecModuleCodeList (); } /* * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is * responsible for discovering any new wake GPEs by running _PRW methods * that may have been loaded by this table. */ Status = AcpiTbGetOwnerId (i, &OwnerId); if (ACPI_SUCCESS (Status)) { AcpiEvUpdateGpes (OwnerId); } /* Invoke table handler if present */ if (AcpiGbl_TableHandler) { (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table, AcpiGbl_TableHandlerContext); } (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);UnlockAndExit: *TableIndex = i; (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_ACPI_STATUS (Status);}
开发者ID:jaredmcneill,项目名称:freebsd,代码行数:72,
注:本文中的ACPI_FAILURE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ACPI_FLUSH_CPU_CACHE函数代码示例 C++ ACPI_EXCEPTION函数代码示例 |