这篇教程C++ ACPI_FREE函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ACPI_FREE函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_FREE函数的具体用法?C++ ACPI_FREE怎么用?C++ ACPI_FREE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ACPI_FREE函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: AdAmlDisassemble//.........这里部分代码省略......... { AcpiDmDumpTree (AcpiGbl_ParseOpRoot); } /* Find possible calls to external control methods */ AcpiDmFindOrphanMethods (AcpiGbl_ParseOpRoot); /* Convert fixed-offset references to resource descriptors to symbolic references */ AcpiDmConvertResourceIndexes (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode); /* * If we found any external control methods, we must reparse the entire * tree with the new information (namely, the number of arguments per * method) */ if (AcpiDmGetExternalMethodCount ()) { fprintf (stderr, "/nFound %d external control methods, reparsing with new information/n", AcpiDmGetExternalMethodCount ()); /* * Reparse, rebuild namespace. no need to xref namespace */ AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot); AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode); AcpiGbl_RootNode = NULL; AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME; AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED; AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE; AcpiGbl_RootNodeStruct.Child = NULL; AcpiGbl_RootNodeStruct.Peer = NULL; AcpiGbl_RootNodeStruct.Object = NULL; AcpiGbl_RootNodeStruct.Flags = ANOBJ_END_OF_PEER_LIST; Status = AcpiNsRootInitialize (); AcpiDmAddExternalsToNamespace (); /* Parse table. No need to reload it, however (FALSE) */ Status = AdParseTable (Table, NULL, FALSE, FALSE); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not parse ACPI tables, %s/n", AcpiFormatException (Status)); goto Cleanup; } if (AslCompilerdebug) { AcpiOsPrintf ("/**** After second load and resource conversion/n"); LsSetupNsList (File); LsDisplayNamespace (); AcpiOsPrintf ("*****//n"); AcpiDmDumpTree (AcpiGbl_ParseOpRoot); } } /* Optional displays */ if (AcpiGbl_DbOpt_disasm) { AdDisplayTables (Filename, Table); fprintf (stderr, "Disassembly completed, written to /"%s/"/n", DisasmFilename); } }Cleanup: if (Table && !AcpiUtIsAmlTable (Table)) { ACPI_FREE (Table); } if (DisasmFilename) { ACPI_FREE (DisasmFilename); } if (OutToFile && File) {#ifdef ASL_DISASM_DEBUG LsSetupNsList (File); LsDisplayNamespace ();#endif fclose (File); AcpiOsRedirectOutput (stdout); } AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot); AcpiGbl_ParseOpRoot = NULL; return (Status);}
开发者ID:luciang,项目名称:haiku,代码行数:101,
示例2: AcpiNsInitOneDevice//.........这里部分代码省略......... { WalkInfo->Num_STA++; } /* * Examine the PRESENT and FUNCTIONING status bits * * Note: ACPI spec does not seem to specify behavior for the present but * not functioning case, so we assume functioning if present. */ if (!(Flags & ACPI_STA_DEVICE_PRESENT)) { /* Device is not present, we must examine the Functioning bit */ if (Flags & ACPI_STA_DEVICE_FUNCTIONING) { /* * Device is not present but is "functioning". In this case, * we will not run _INI, but we continue to examine the children * of this device. * * From the ACPI spec, description of _STA: (Note - no mention * of whether to run _INI or not on the device in question) * * "_STA may return bit 0 clear (not present) with bit 3 set * (device is functional). This case is used to indicate a valid * device for which no device driver should be loaded (for example, * a bridge device.) Children of this device may be present and * valid. OSPM should continue enumeration below a device whose * _STA returns this bit combination" */ return_ACPI_STATUS (AE_OK); } else { /* * Device is not present and is not functioning. We must abort the * walk of this subtree immediately -- don't look at the children * of such a device. * * From the ACPI spec, description of _INI: * * "If the _STA method indicates that the device is not present, * OSPM will not run the _INI and will not examine the children * of the device for _INI methods" */ return_ACPI_STATUS (AE_CTRL_DEPTH); } } /* * The device is present or is assumed present if no _STA exists. * Run the _INI if it exists (not required to exist) * * Note: We know there is an _INI within this subtree, but it may not be * under this particular device, it may be lower in the branch. */ ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname ( ACPI_TYPE_METHOD, DeviceNode, METHOD_NAME__INI)); memset (Info, 0, sizeof (ACPI_EVALUATE_INFO)); Info->PrefixNode = DeviceNode; Info->RelativePathname = __UNCONST(METHOD_NAME__INI); Info->Parameters = NULL; Info->Flags = ACPI_IGNORE_RETURN_VALUE; Status = AcpiNsEvaluate (Info); if (ACPI_SUCCESS (Status)) { WalkInfo->Num_INI++; }#ifdef ACPI_DEBUG_OUTPUT else if (Status != AE_NOT_FOUND) { /* Ignore error and move on to next device */ char *ScopeName = AcpiNsGetExternalPathname (Info->Node); ACPI_EXCEPTION ((AE_INFO, Status, "during %s._INI execution", ScopeName)); ACPI_FREE (ScopeName); }#endif /* Ignore errors from above */ Status = AE_OK; /* * The _INI method has been run if present; call the Global Initialization * Handler for this device. */ if (AcpiGbl_InitHandler) { Status = AcpiGbl_InitHandler (DeviceNode, ACPI_INIT_DEVICE_INI); } return_ACPI_STATUS (Status);}
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:101,
示例3: AcpiExOpcode_3A_0T_0RACPI_STATUSAcpiExOpcode_3A_0T_0R ( ACPI_WALK_STATE *WalkState){ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; ACPI_SIGNAL_FATAL_INFO *Fatal; ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_TRACE_STR (ExOpcode_3A_0T_0R, AcpiPsGetOpcodeName (WalkState->Opcode)); switch (WalkState->Opcode) { case AML_FATAL_OP: /* Fatal (FatalType FatalCode FatalArg) */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "FatalOp: Type %X Code %X Arg %X " "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</n", (UINT32) Operand[0]->Integer.Value, (UINT32) Operand[1]->Integer.Value, (UINT32) Operand[2]->Integer.Value)); Fatal = ACPI_ALLOCATE (sizeof (ACPI_SIGNAL_FATAL_INFO)); if (Fatal) { Fatal->Type = (UINT32) Operand[0]->Integer.Value; Fatal->Code = (UINT32) Operand[1]->Integer.Value; Fatal->Argument = (UINT32) Operand[2]->Integer.Value; } /* Always signal the OS! */ Status = AcpiOsSignal (ACPI_SIGNAL_FATAL, Fatal); /* Might return while OS is shutting down, just continue */ ACPI_FREE (Fatal); goto Cleanup; case AML_EXTERNAL_OP: /* * If the interpreter sees this opcode, just ignore it. The External * op is intended for use by disassemblers in order to properly * disassemble control method invocations. The opcode or group of * opcodes should be surrounded by an "if (0)" clause to ensure that * AML interpreters never see the opcode. Thus, something is * wrong if an external opcode ever gets here. */ ACPI_ERROR ((AE_INFO, "Executed External Op")); Status = AE_OK; goto Cleanup; default: ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; }Cleanup: return_ACPI_STATUS (Status);}
开发者ID:ahs3,项目名称:acpica-tools,代码行数:68,
示例4: AcpiDbTestBufferType//.........这里部分代码省略......... { AcpiOsPrintf (" Ignoring zero length buffer"); return (AE_OK); } /* Allocate a local buffer */ Buffer = ACPI_ALLOCATE_ZEROED (ByteLength); if (!Buffer) { return (AE_NO_MEMORY); } /* Read the original value */ Status = AcpiDbReadFromObject (Node, ACPI_TYPE_BUFFER, &Temp1); if (ACPI_FAILURE (Status)) { goto Exit; } /* Emit a few bytes of the buffer */ AcpiOsPrintf (" (%4.4X/%3.3X)", BitLength, Temp1->Buffer.Length); for (i = 0; ((i < 4) && (i < ByteLength)); i++) { AcpiOsPrintf (" %2.2X", Temp1->Buffer.Pointer[i]); } AcpiOsPrintf ("... "); /* * Write a new value. * * Handle possible extra bits at the end of the buffer. Can * happen for FieldUnits larger than an integer, but the bit * count is not an integral number of bytes. Zero out the * unused bits. */ memset (Buffer, BUFFER_FILL_VALUE, ByteLength); ExtraBits = BitLength % 8; if (ExtraBits) { Buffer [ByteLength - 1] = ACPI_MASK_BITS_ABOVE (ExtraBits); } WriteValue.Type = ACPI_TYPE_BUFFER; WriteValue.Buffer.Length = ByteLength; WriteValue.Buffer.Pointer = Buffer; Status = AcpiDbWriteToObject (Node, &WriteValue); if (ACPI_FAILURE (Status)) { goto Exit; } /* Ensure that we can read back the new value */ Status = AcpiDbReadFromObject (Node, ACPI_TYPE_BUFFER, &Temp2); if (ACPI_FAILURE (Status)) { goto Exit; } if (memcmp (Temp2->Buffer.Pointer, Buffer, ByteLength)) { AcpiOsPrintf (" MISMATCH 2: New buffer value"); } /* Write back the original value */ WriteValue.Buffer.Length = ByteLength; WriteValue.Buffer.Pointer = Temp1->Buffer.Pointer; Status = AcpiDbWriteToObject (Node, &WriteValue); if (ACPI_FAILURE (Status)) { goto Exit; } /* Ensure that we can read back the original value */ Status = AcpiDbReadFromObject (Node, ACPI_TYPE_BUFFER, &Temp3); if (ACPI_FAILURE (Status)) { goto Exit; } if (memcmp (Temp1->Buffer.Pointer, Temp3->Buffer.Pointer, ByteLength)) { AcpiOsPrintf (" MISMATCH 3: While restoring original buffer"); }Exit: ACPI_FREE (Buffer); if (Temp1) {AcpiOsFree (Temp1);} if (Temp2) {AcpiOsFree (Temp2);} if (Temp3) {AcpiOsFree (Temp3);} return (Status);}
开发者ID:JamesLinus,项目名称:acpica,代码行数:101,
示例5: acpi_db_dump_pld_buffer//.........这里部分代码省略......... acpi_status status; /* Object must be of type Package with at least one Buffer element */ if (obj_desc->type != ACPI_TYPE_PACKAGE) { return; } buffer_desc = &obj_desc->package.elements[0]; if (buffer_desc->type != ACPI_TYPE_BUFFER) { return; } /* Convert _PLD buffer to local _PLD struct */ status = acpi_decode_pld_buffer(buffer_desc->buffer.pointer, buffer_desc->buffer.length, &pld_info); if (ACPI_FAILURE(status)) { return; } /* Encode local _PLD struct back to a _PLD buffer */ new_buffer = acpi_db_encode_pld_buffer(pld_info); if (!new_buffer) { goto exit; } /* The two bit-packed buffers should match */ if (memcmp(new_buffer, buffer_desc->buffer.pointer, buffer_desc->buffer.length)) { acpi_os_printf ("Converted _PLD buffer does not compare. New:/n"); acpi_ut_dump_buffer(new_buffer, buffer_desc->buffer.length, DB_BYTE_DISPLAY, 0); } /* First 32-bit dword */ acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Revision", pld_info->revision); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_IgnoreColor", pld_info->ignore_color); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Red", pld_info->red); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Green", pld_info->green); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Blue", pld_info->blue); /* Second 32-bit dword */ acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Width", pld_info->width); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Height", pld_info->height); /* Third 32-bit dword */ acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_UserVisible", pld_info->user_visible); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Dock", pld_info->dock); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Lid", pld_info->lid); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Panel", pld_info->panel); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_VerticalPosition", pld_info->vertical_position); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_HorizontalPosition", pld_info->horizontal_position); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Shape", pld_info->shape); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_GroupOrientation", pld_info->group_orientation); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_GroupToken", pld_info->group_token); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_GroupPosition", pld_info->group_position); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Bay", pld_info->bay); /* Fourth 32-bit dword */ acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Ejectable", pld_info->ejectable); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_EjectRequired", pld_info->ospm_eject_required); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_CabinetNumber", pld_info->cabinet_number); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_CardCageNumber", pld_info->card_cage_number); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Reference", pld_info->reference); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Rotation", pld_info->rotation); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Order", pld_info->order); /* Fifth 32-bit dword */ if (buffer_desc->buffer.length > 16) { acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_VerticalOffset", pld_info->vertical_offset); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_HorizontalOffset", pld_info->horizontal_offset); } ACPI_FREE(new_buffer);exit: ACPI_FREE(pld_info);}
开发者ID:faddat,项目名称:linux-mainline-next,代码行数:101,
示例6: MpEmitGpioInfo//.........这里部分代码省略......... { HidString = MpGetHidViaNamestring (Info->DeviceName); /* Print header info for the controller itself */ if (!PrevDeviceName || ACPI_STRCMP (PrevDeviceName, Info->DeviceName)) { FlPrintFile (ASL_FILE_MAP_OUTPUT, "/n/nGPIO Controller: %-8s %-28s", HidString, Info->DeviceName); HidInfo = AcpiAhMatchHardwareId (HidString); if (HidInfo) { FlPrintFile (ASL_FILE_MAP_OUTPUT, " // %s", HidInfo->Description); } FlPrintFile (ASL_FILE_MAP_OUTPUT, "/n/nPin Type Direction Polarity" " Dest _HID Destination/n"); } PrevDeviceName = Info->DeviceName; /* Setup various strings based upon the type (GpioInt or GpioIo) */ switch (Info->Type) { case AML_RESOURCE_GPIO_TYPE_INT: Type = "GpioInt"; Direction = "-Interrupt-"; Polarity = PolarityDecode[Info->Polarity]; break; case AML_RESOURCE_GPIO_TYPE_IO: Type = "GpioIo "; Direction = DirectionDecode[Info->Direction]; Polarity = " "; break; default: continue; } /* Emit the GPIO info */ FlPrintFile (ASL_FILE_MAP_OUTPUT, "%4.4X %s %s %s ", Info->PinNumber, Type, Direction, Polarity); ParentPathname = NULL; HidString = MpGetConnectionInfo (Info->Op, Info->PinIndex, &Info->TargetNode, &ParentPathname); if (HidString) { /* * This is a Connection() field * Attempt to find all references to the field. */ FlPrintFile (ASL_FILE_MAP_OUTPUT, "%8s %-28s", HidString, ParentPathname); MpXrefDevices (Info); } else { /* * For Devices, attempt to get the _HID description string. * Failing that (many _HIDs are not recognized), attempt to * get the _DDN description string. */ HidString = MpGetParentDeviceHid (Info->Op, &Info->TargetNode, &ParentPathname); FlPrintFile (ASL_FILE_MAP_OUTPUT, "%8s %-28s", HidString, ParentPathname); /* Get the _HID description or _DDN string */ HidInfo = AcpiAhMatchHardwareId (HidString); if (HidInfo) { FlPrintFile (ASL_FILE_MAP_OUTPUT, " // %s", HidInfo->Description); } else if ((Description = MpGetDdnValue (ParentPathname))) { FlPrintFile (ASL_FILE_MAP_OUTPUT, " // %s (_DDN)", Description); } } FlPrintFile (ASL_FILE_MAP_OUTPUT, "/n"); ACPI_FREE (ParentPathname); Info = Info->Next; }}
开发者ID:coyizumi,项目名称:cs111,代码行数:101,
示例7: MpEmitSerialInfo//.........这里部分代码省略......... const AH_DEVICE_ID *HidInfo; const char *Description; AML_RESOURCE *Resource; /* Walk the constructed serial descriptor list */ Info = Gbl_SerialList; while (Info) { Resource = Info->Resource; switch (Resource->CommonSerialBus.Type) { case AML_RESOURCE_I2C_SERIALBUSTYPE: Type = "I2C "; break; case AML_RESOURCE_SPI_SERIALBUSTYPE: Type = "SPI "; break; case AML_RESOURCE_UART_SERIALBUSTYPE: Type = "UART"; break; default: Type = "UNKN"; break; } HidString = MpGetHidViaNamestring (Info->DeviceName); /* Print header info for the controller itself */ if (!PrevDeviceName || ACPI_STRCMP (PrevDeviceName, Info->DeviceName)) { FlPrintFile (ASL_FILE_MAP_OUTPUT, "/n/n%s Controller: ", Type); FlPrintFile (ASL_FILE_MAP_OUTPUT, "%-8s %-28s", HidString, Info->DeviceName); HidInfo = AcpiAhMatchHardwareId (HidString); if (HidInfo) { FlPrintFile (ASL_FILE_MAP_OUTPUT, " // %s", HidInfo->Description); } FlPrintFile (ASL_FILE_MAP_OUTPUT, "/n/n"); FlPrintFile (ASL_FILE_MAP_OUTPUT, "Type Address Speed Dest _HID Destination/n"); } PrevDeviceName = Info->DeviceName; FlPrintFile (ASL_FILE_MAP_OUTPUT, "%s %4.4X %8.8X ", Type, Info->Address, Info->Speed); ParentPathname = NULL; HidString = MpGetConnectionInfo (Info->Op, 0, &Info->TargetNode, &ParentPathname); if (HidString) { /* * This is a Connection() field * Attempt to find all references to the field. */ FlPrintFile (ASL_FILE_MAP_OUTPUT, "%8s %-28s", HidString, ParentPathname); } else { /* Normal resource template */ HidString = MpGetParentDeviceHid (Info->Op, &Info->TargetNode, &ParentPathname); FlPrintFile (ASL_FILE_MAP_OUTPUT, "%8s %-28s", HidString, ParentPathname); /* Get the _HID description or _DDN string */ HidInfo = AcpiAhMatchHardwareId (HidString); if (HidInfo) { FlPrintFile (ASL_FILE_MAP_OUTPUT, " // %s", HidInfo->Description); } else if ((Description = MpGetDdnValue (ParentPathname))) { FlPrintFile (ASL_FILE_MAP_OUTPUT, " // %s (_DDN)", Description); } } FlPrintFile (ASL_FILE_MAP_OUTPUT, "/n"); ACPI_FREE (ParentPathname); Info = Info->Next; }}
开发者ID:coyizumi,项目名称:cs111,代码行数:101,
示例8: OptOptimizeNamePath//.........这里部分代码省略......... ASL_NO_ABORT); return_VOID; } TargetPath.Length--; /* Subtract one for null terminator */ /* CurrentPath is the path to this scope (where we are in the namespace) */ CurrentPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; Status = AcpiNsHandleToPathname (CurrentNode, &CurrentPath); if (ACPI_FAILURE (Status)) { AslCoreSubsystemError (Op, Status, "Getting Current NamePath", ASL_NO_ABORT); return_VOID; } CurrentPath.Length--; /* Subtract one for null terminator */ /* Debug output only */ Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, AmlNameString, NULL, &ExternalNameString); if (ACPI_FAILURE (Status)) { AslCoreSubsystemError (Op, Status, "Externalizing NamePath", ASL_NO_ABORT); return_VOID; } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "%37s (%2u) ==> %-32s(%2u) %-32s", (char *) CurrentPath.Pointer, (UINT32) CurrentPath.Length, (char *) TargetPath.Pointer, (UINT32) TargetPath.Length, ExternalNameString)); ACPI_FREE (ExternalNameString); /* * Attempt an optmization depending on the type of namepath */ if (Flags & (AML_NAMED | AML_CREATE)) { /* * This is a named opcode and the namepath is a name declaration, not * a reference. */ Status = OptOptimizeNameDeclaration (Op, WalkState, CurrentNode, TargetNode, AmlNameString, &NewPath); if (ACPI_FAILURE (Status)) { /* * 2) now attempt to * optimize the namestring with carats (up-arrow) */ Status = OptBuildShortestPath (Op, WalkState, CurrentNode, TargetNode, &CurrentPath, &TargetPath, AmlNameStringLength, 1, &NewPath); } } else { /* * This is a reference to an existing named object * * 1) Check if search-to-root can be utilized using the last * NameSeg of the NamePath */ Status = OptSearchToRoot (Op, WalkState, CurrentNode,
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:67,
示例9: AcpiDsDeleteWalkStatevoidAcpiDsDeleteWalkState ( ACPI_WALK_STATE *WalkState){ ACPI_GENERIC_STATE *State; ACPI_FUNCTION_TRACE_PTR (DsDeleteWalkState, WalkState); if (!WalkState) { return_VOID; } if (WalkState->DescriptorType != ACPI_DESC_TYPE_WALK) { ACPI_ERROR ((AE_INFO, "%p is not a valid walk state", WalkState)); return_VOID; } /* There should not be any open scopes */ if (WalkState->ParserState.Scope) { ACPI_ERROR ((AE_INFO, "%p walk still has a scope list", WalkState)); AcpiPsCleanupScope (&WalkState->ParserState); } /* Always must free any linked control states */ while (WalkState->ControlState) { State = WalkState->ControlState; WalkState->ControlState = State->Common.Next; AcpiUtDeleteGenericState (State); } /* Always must free any linked parse states */ while (WalkState->ScopeInfo) { State = WalkState->ScopeInfo; WalkState->ScopeInfo = State->Common.Next; AcpiUtDeleteGenericState (State); } /* Always must free any stacked result states */ while (WalkState->Results) { State = WalkState->Results; WalkState->Results = State->Common.Next; AcpiUtDeleteGenericState (State); } ACPI_FREE (WalkState); return_VOID;}
开发者ID:Paradoxianer,项目名称:haiku,代码行数:64,
示例10: OptOptimizeNameDeclarationstatic ACPI_STATUSOptOptimizeNameDeclaration ( ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE *CurrentNode, ACPI_NAMESPACE_NODE *TargetNode, char *AmlNameString, char **NewPath){ ACPI_STATUS Status; char *NewPathExternal; ACPI_GENERIC_STATE ScopeInfo; ACPI_NAMESPACE_NODE *Node; ACPI_FUNCTION_TRACE (OptOptimizeNameDeclaration); if (((CurrentNode == AcpiGbl_RootNode) || (Op->Common.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK)) && (AmlNameString[0] == '//')) { /* * The current scope is the root, and the namepath has a root prefix * that is therefore extraneous. Remove it. */ *NewPath = &AmlNameString[1]; /* Debug output */ Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, *NewPath, NULL, &NewPathExternal); if (ACPI_FAILURE (Status)) { AslCoreSubsystemError (Op, Status, "Externalizing NamePath", ASL_NO_ABORT); return (Status); } /* * Check to make sure that the optimization finds the node we are * looking for. This is simply a sanity check on the new * path that has been created. */ ScopeInfo.Scope.Node = CurrentNode; Status = AcpiNsLookup (&ScopeInfo, *NewPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); if (ACPI_SUCCESS (Status)) { /* Found the namepath, but make sure the node is correct */ if (Node == TargetNode) { /* The lookup matched the node, accept this optimization */ AslError (ASL_OPTIMIZATION, ASL_MSG_NAME_OPTIMIZATION, Op, NewPathExternal); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "AT ROOT: %-24s", NewPathExternal)); } else { /* Node is not correct, do not use this optimization */ Status = AE_NOT_FOUND; ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** WRONG NODE")); AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, "Not using optimized name - found wrong node"); } } else { /* The lookup failed, we obviously cannot use this optimization */ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** NOT FOUND")); AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, "Not using optimized name - did not find node"); } ACPI_FREE (NewPathExternal); return (Status); } /* Could not optimize */ return (AE_NOT_FOUND);}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:91,
示例11: OptBuildShortestPath//.........这里部分代码省略......... * target string */ Index = (NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1; /* Special handling for exact subpath in a name declaration */ if (IsDeclaration && SubPath && (CurrentPath->Length > TargetPath->Length)) { /* * The current path is longer than the target, and the target is a * subpath of the current path. We must include one more NameSeg of * the target path */ Index -= ACPI_PATH_SEGMENT_LENGTH; /* Special handling for Scope() operator */ if (Op->Asl.AmlOpcode == AML_SCOPE_OP) { NewPathExternal[i] = '^'; i++; ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "(EXTRA ^)")); } } /* Make sure we haven't gone off the end of the target path */ if (Index > TargetPath->Length) { Index = TargetPath->Length; } ACPI_STRCPY (&NewPathExternal[i], &((char *) TargetPath->Pointer)[Index]); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " %-24s", NewPathExternal)); /* * Internalize the new target string and check it against the original * string to make sure that this is in fact an optimization. If the * original string is already optimal, there is no point in continuing. */ Status = AcpiNsInternalizeName (NewPathExternal, &NewPath); if (ACPI_FAILURE (Status)) { AslCoreSubsystemError (Op, Status, "Internalizing new NamePath", ASL_NO_ABORT); ACPI_FREE (NewPathExternal); return (Status); } if (ACPI_STRLEN (NewPath) >= AmlNameStringLength) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " NOT SHORTER (New %u old %u)", (UINT32) ACPI_STRLEN (NewPath), (UINT32) AmlNameStringLength)); ACPI_FREE (NewPathExternal); return (AE_NOT_FOUND); } /* * Check to make sure that the optimization finds the node we are * looking for. This is simply a sanity check on the new * path that has been created. */ Status = AcpiNsLookup (&ScopeInfo, NewPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); if (ACPI_SUCCESS (Status)) { /* Found the namepath, but make sure the node is correct */ if (Node == TargetNode) { /* The lookup matched the node, accept this optimization */ AslError (ASL_OPTIMIZATION, ASL_MSG_NAME_OPTIMIZATION, Op, NewPathExternal); *ReturnNewPath = NewPath; } else { /* Node is not correct, do not use this optimization */ Status = AE_NOT_FOUND; ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** WRONG NODE")); AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, "Not using optimized name - found wrong node"); } } else { /* The lookup failed, we obviously cannot use this optimization */ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** NOT FOUND")); AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, "Not using optimized name - did not find node"); } ACPI_FREE (NewPathExternal); return (Status);}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:101,
示例12: AdCreateTableHeadervoidAdCreateTableHeader ( char *Filename, ACPI_TABLE_HEADER *Table){ char *NewFilename; UINT8 Checksum; /* * Print file header and dump original table header */ AdDisassemblerHeader (Filename); AcpiOsPrintf (" */n * Original Table Header:/n"); AcpiOsPrintf (" * Signature /"%4.4s/"/n", Table->Signature); AcpiOsPrintf (" * Length 0x%8.8X (%u)/n", Table->Length, Table->Length); /* Print and validate the revision */ AcpiOsPrintf (" * Revision 0x%2.2X", Table->Revision); switch (Table->Revision) { case 0: AcpiOsPrintf (" **** Invalid Revision"); break; case 1: /* Revision of DSDT controls the ACPI integer width */ if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT)) { AcpiOsPrintf (" **** ACPI 1.0, no 64-bit math support"); } break; default: break; } AcpiOsPrintf ("/n"); /* Print and validate the table checksum */ AcpiOsPrintf (" * Checksum 0x%2.2X", Table->Checksum); Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length); if (Checksum) { AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X", (UINT8) (Table->Checksum - Checksum)); } AcpiOsPrintf ("/n"); AcpiOsPrintf (" * OEM ID /"%.6s/"/n", Table->OemId); AcpiOsPrintf (" * OEM Table ID /"%.8s/"/n", Table->OemTableId); AcpiOsPrintf (" * OEM Revision 0x%8.8X (%u)/n", Table->OemRevision, Table->OemRevision); AcpiOsPrintf (" * Compiler ID /"%.4s/"/n", Table->AslCompilerId); AcpiOsPrintf (" * Compiler Version 0x%8.8X (%u)/n", Table->AslCompilerRevision, Table->AslCompilerRevision); AcpiOsPrintf (" *//n"); /* Create AML output filename based on input filename */ if (Filename) { NewFilename = FlGenerateFilename (Filename, "aml"); } else { NewFilename = ACPI_ALLOCATE_ZEROED (9); strncat (NewFilename, Table->Signature, 4); strcat (NewFilename, ".aml"); } /* Open the ASL definition block */ AcpiOsPrintf ( "DefinitionBlock (/"%s/", /"%4.4s/", %hd, /"%.6s/", /"%.8s/", 0x%8.8X)/n", NewFilename, Table->Signature, Table->Revision, Table->OemId, Table->OemTableId, Table->OemRevision); ACPI_FREE (NewFilename);}
开发者ID:luciang,项目名称:haiku,代码行数:83,
示例13: LsWriteNodeToListing//.........这里部分代码省略......... switch (Op->Asl.AmlOpcode) { case AML_SCOPE_OP: case AML_ALIAS_OP: /* These opcodes do not declare a new object, ignore them */ break; default: /* All other named object opcodes come here */ switch (FileId) { case ASL_FILE_ASM_SOURCE_OUTPUT: case ASL_FILE_C_SOURCE_OUTPUT: case ASL_FILE_ASM_INCLUDE_OUTPUT: case ASL_FILE_C_INCLUDE_OUTPUT: /* * For named objects, we will create a valid symbol so that the * AML code can be referenced from C or ASM */ if (Op->Asl.ExternalName) { /* Get the full pathname associated with this node */ Pathname = AcpiNsGetExternalPathname (Op->Asl.Node); Length = strlen (Pathname); if (Length >= 4) { /* Convert all dots in the path to underscores */ for (i = 0; i < Length; i++) { if (Pathname[i] == '.') { Pathname[i] = '_'; } } /* Create the appropriate symbol in the output file */ if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT) { FlPrintFile (FileId, "%s_%s_%s ///n", Gbl_TableSignature, Gbl_TableId, &Pathname[1]); } if (FileId == ASL_FILE_C_SOURCE_OUTPUT) { FlPrintFile (FileId, " unsigned char %s_%s_%s [] =/n {/n", Gbl_TableSignature, Gbl_TableId, &Pathname[1]); } if (FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) { FlPrintFile (FileId, "extrn %s_%s_%s : byte/n", Gbl_TableSignature, Gbl_TableId, &Pathname[1]); } if (FileId == ASL_FILE_C_INCLUDE_OUTPUT) { FlPrintFile (FileId, "extern unsigned char %s_%s_%s [];/n", Gbl_TableSignature, Gbl_TableId, &Pathname[1]); } } ACPI_FREE (Pathname); } break; default: /* Nothing to do for listing file */ break; } } break; case AML_CLASS_EXECUTE: case AML_CLASS_CREATE: default: if ((Op->Asl.ParseOpcode == PARSEOP_BUFFER) && (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC)) { return; } LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, FileId); break; case AML_CLASS_UNKNOWN: break; }}
开发者ID:99corps,项目名称:runtime,代码行数:101,
示例14: MpNamespaceXrefBeginstatic ACPI_STATUSMpNamespaceXrefBegin ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context){ ACPI_GPIO_INFO *Info = ACPI_CAST_PTR (ACPI_GPIO_INFO, Context); const ACPI_OPCODE_INFO *OpInfo; char *DevicePathname; ACPI_PARSE_OBJECT *ParentOp; char *HidString; ACPI_FUNCTION_TRACE_PTR (MpNamespaceXrefBegin, Op); /* * If this node is the actual declaration of a name * [such as the XXXX name in "Method (XXXX)"], * we are not interested in it here. We only care about names that * are references to other objects within the namespace and the * parent objects of name declarations */ if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION) { return (AE_OK); } /* We are only interested in opcodes that have an associated name */ OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); if ((OpInfo->Flags & AML_NAMED) || (OpInfo->Flags & AML_CREATE)) { return (AE_OK); } if ((Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) && (Op->Asl.ParseOpcode != PARSEOP_NAMESEG) && (Op->Asl.ParseOpcode != PARSEOP_METHODCALL)) { return (AE_OK); } if (!Op->Asl.Node) { return (AE_OK); } ParentOp = Op->Asl.Parent; if (ParentOp->Asl.ParseOpcode == PARSEOP_FIELD) { return (AE_OK); } if (Op->Asl.Node == Info->TargetNode) { while (ParentOp && (!ParentOp->Asl.Node)) { ParentOp = ParentOp->Asl.Parent; } if (ParentOp) { DevicePathname = AcpiNsGetExternalPathname ( ParentOp->Asl.Node); if (!Info->References) { FlPrintFile (ASL_FILE_MAP_OUTPUT, " // References:"); } HidString = MpGetHidViaNamestring (DevicePathname); FlPrintFile (ASL_FILE_MAP_OUTPUT, " %s [%s]", DevicePathname, HidString); Info->References++; ACPI_FREE (DevicePathname); } } return (AE_OK);}
开发者ID:coyizumi,项目名称:cs111,代码行数:85,
示例15: acpi_ns_execute_table/******************************************************************************* * * FUNCTION: ns_execute_table * * PARAMETERS: table_desc - An ACPI table descriptor for table to parse * start_node - Where to enter the table into the namespace * * RETURN: Status * * DESCRIPTION: Load ACPI/AML table by executing the entire table as a * term_list. * ******************************************************************************/acpi_statusacpi_ns_execute_table(u32 table_index, struct acpi_namespace_node *start_node){ acpi_status status; struct acpi_table_header *table; acpi_owner_id owner_id; struct acpi_evaluate_info *info = NULL; u32 aml_length; u8 *aml_start; union acpi_operand_object *method_obj = NULL; ACPI_FUNCTION_TRACE(ns_execute_table); status = acpi_get_table_by_index(table_index, &table); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } /* Table must consist of at least a complete header */ if (table->length < sizeof(struct acpi_table_header)) { return_ACPI_STATUS(AE_BAD_HEADER); } aml_start = (u8 *)table + sizeof(struct acpi_table_header); aml_length = table->length - sizeof(struct acpi_table_header); status = acpi_tb_get_owner_id(table_index, &owner_id); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } /* Create, initialize, and link a new temporary method object */ method_obj = acpi_ut_create_internal_object(ACPI_TYPE_METHOD); if (!method_obj) { return_ACPI_STATUS(AE_NO_MEMORY); } /* Allocate the evaluation information block */ info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); if (!info) { status = AE_NO_MEMORY; goto cleanup; } ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Create table code block: %p/n", method_obj)); method_obj->method.aml_start = aml_start; method_obj->method.aml_length = aml_length; method_obj->method.owner_id = owner_id; method_obj->method.info_flags |= ACPI_METHOD_MODULE_LEVEL; info->pass_number = ACPI_IMODE_EXECUTE; info->node = start_node; info->obj_desc = method_obj; info->node_flags = info->node->flags; info->full_pathname = acpi_ns_get_normalized_pathname(info->node, TRUE); if (!info->full_pathname) { status = AE_NO_MEMORY; goto cleanup; } status = acpi_ps_execute_table(info);cleanup: if (info) { ACPI_FREE(info->full_pathname); info->full_pathname = NULL; } ACPI_FREE(info); acpi_ut_remove_reference(method_obj); return_ACPI_STATUS(status);}
开发者ID:01org,项目名称:thunderbolt-software-kernel-tree,代码行数:89,
示例16: AcpiNsGetNodeACPI_STATUSAcpiNsGetNode ( ACPI_NAMESPACE_NODE *PrefixNode, const char *Pathname, UINT32 Flags, ACPI_NAMESPACE_NODE **ReturnNode){ ACPI_GENERIC_STATE ScopeInfo; ACPI_STATUS Status; char *InternalPath; ACPI_FUNCTION_TRACE_PTR (NsGetNode, ACPI_CAST_PTR (char, Pathname)); if (!Pathname) { *ReturnNode = PrefixNode; if (!PrefixNode) { *ReturnNode = AcpiGbl_RootNode; } return_ACPI_STATUS (AE_OK); } /* Convert path to internal representation */ Status = AcpiNsInternalizeName (Pathname, &InternalPath); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Must lock namespace during lookup */ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { goto Cleanup; } /* Setup lookup scope (search starting point) */ ScopeInfo.Scope.Node = PrefixNode; /* Lookup the name in the namespace */ Status = AcpiNsLookup (&ScopeInfo, InternalPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, (Flags | ACPI_NS_DONT_OPEN_SCOPE), NULL, ReturnNode); if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s, %s/n", Pathname, AcpiFormatException (Status))); } (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);Cleanup: ACPI_FREE (InternalPath); return_ACPI_STATUS (Status);}
开发者ID:AgamAgarwal,项目名称:minix,代码行数:62,
示例17: DtCompileTable//.........这里部分代码省略......... */ FlagBuffer += (Info->Offset - CurrentFlagByteOffset); CurrentFlagByteOffset = Info->Offset; DtCompileFlag (FlagBuffer, LocalField, Info); } else { /* TBD - this is an internal error */ } LocalField = LocalField->Next; *Field = LocalField; break; case DT_FIELD_TYPE_INLINE_SUBTABLE: /* * Recursion (one level max): compile GAS (Generic Address) * or Notify in-line subtable */ *Field = LocalField; switch (Info->Opcode) { case ACPI_DMT_GAS: Status = DtCompileTable (Field, AcpiDmTableInfoGas, &InlineSubtable, TRUE); break; case ACPI_DMT_HESTNTFY: Status = DtCompileTable (Field, AcpiDmTableInfoHestNotify, &InlineSubtable, TRUE); break; case ACPI_DMT_IORTMEM: Status = DtCompileTable (Field, AcpiDmTableInfoIortAcc, &InlineSubtable, TRUE); break; default: sprintf (MsgBuffer, "Invalid DMT opcode: 0x%.2X", Info->Opcode); DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer); Status = AE_BAD_DATA; break; } if (ACPI_FAILURE (Status)) { goto Error; } DtSetSubtableLength (InlineSubtable); ACPI_MEMCPY (Buffer, InlineSubtable->Buffer, FieldLength); LocalField = *Field; break; case DT_FIELD_TYPE_LABEL: DtWriteFieldToListing (Buffer, LocalField, 0); LocalField = LocalField->Next; break; default: /* Normal case for most field types (Integer, String, etc.) */ DtCompileOneField (Buffer, LocalField, FieldLength, FieldType, Info->Flags); DtWriteFieldToListing (Buffer, LocalField, FieldLength); LocalField = LocalField->Next; if (Info->Flags & DT_LENGTH) { /* Field is an Integer that will contain a subtable length */ Subtable->LengthField = Buffer; Subtable->SizeOfLengthField = FieldLength; } break; } Buffer += FieldLength; } *Field = LocalField; *RetSubtable = Subtable; return (AE_OK);Error: ACPI_FREE (Subtable->Buffer); ACPI_FREE (Subtable); return (Status);}
开发者ID:Yuki-Judai,项目名称:acpica,代码行数:101,
示例18: AcpiExStoreStringToStringACPI_STATUSAcpiExStoreStringToString ( ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *TargetDesc){ UINT32 Length; UINT8 *Buffer; ACPI_FUNCTION_TRACE_PTR (ExStoreStringToString, SourceDesc); /* If Source and Target are the same, just return */ if (SourceDesc == TargetDesc) { return_ACPI_STATUS (AE_OK); } /* We know that SourceDesc is a string by now */ Buffer = ACPI_CAST_PTR (UINT8, SourceDesc->String.Pointer); Length = SourceDesc->String.Length; /* * Replace existing string value if it will fit and the string * pointer is not a static pointer (part of an ACPI table) */ if ((Length < TargetDesc->String.Length) && (!(TargetDesc->Common.Flags & AOPOBJ_STATIC_POINTER))) { /* * String will fit in existing non-static buffer. * Clear old string and copy in the new one */ memset (TargetDesc->String.Pointer, 0, (ACPI_SIZE) TargetDesc->String.Length + 1); memcpy (TargetDesc->String.Pointer, Buffer, Length); } else { /* * Free the current buffer, then allocate a new buffer * large enough to hold the value */ if (TargetDesc->String.Pointer && (!(TargetDesc->Common.Flags & AOPOBJ_STATIC_POINTER))) { /* Only free if not a pointer into the DSDT */ ACPI_FREE (TargetDesc->String.Pointer); } TargetDesc->String.Pointer = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) Length + 1); if (!TargetDesc->String.Pointer) { return_ACPI_STATUS (AE_NO_MEMORY); } TargetDesc->Common.Flags &= ~AOPOBJ_STATIC_POINTER; memcpy (TargetDesc->String.Pointer, Buffer, Length); } /* Set the new target length */ TargetDesc->String.Length = Length; return_ACPI_STATUS (AE_OK);}
开发者ID:matter123,项目名称:mossy,代码行数:70,
示例19: acpi_ds_call_control_methodacpi_statusacpi_ds_call_control_method(struct acpi_thread_state *thread, struct acpi_walk_state *this_walk_state, union acpi_parse_object *op){ acpi_status status; struct acpi_namespace_node *method_node; struct acpi_walk_state *next_walk_state = NULL; union acpi_operand_object *obj_desc; struct acpi_evaluate_info *info; u32 i; ACPI_FUNCTION_TRACE_PTR(ds_call_control_method, this_walk_state); ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Calling method %p, currentstate=%p/n", this_walk_state->prev_op, this_walk_state)); /* * Get the namespace entry for the control method we are about to call */ method_node = this_walk_state->method_call_node; if (!method_node) { return_ACPI_STATUS(AE_NULL_ENTRY); } obj_desc = acpi_ns_get_attached_object(method_node); if (!obj_desc) { return_ACPI_STATUS(AE_NULL_OBJECT); } /* Init for new method, possibly wait on method mutex */ status = acpi_ds_begin_method_execution(method_node, obj_desc, this_walk_state); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } /* Begin method parse/execution. Create a new walk state */ next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, obj_desc, thread); if (!next_walk_state) { status = AE_NO_MEMORY; goto cleanup; } /* * The resolved arguments were put on the previous walk state's operand * stack. Operands on the previous walk state stack always * start at index 0. Also, null terminate the list of arguments */ this_walk_state->operands[this_walk_state->num_operands] = NULL; /* * Allocate and initialize the evaluation information block * TBD: this is somewhat inefficient, should change interface to * ds_init_aml_walk. For now, keeps this struct off the CPU stack */ info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); if (!info) { return_ACPI_STATUS(AE_NO_MEMORY); } info->parameters = &this_walk_state->operands[0]; status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node, obj_desc->method.aml_start, obj_desc->method.aml_length, info, ACPI_IMODE_EXECUTE); ACPI_FREE(info); if (ACPI_FAILURE(status)) { goto cleanup; } /* * Delete the operands on the previous walkstate operand stack * (they were copied to new objects) */ for (i = 0; i < obj_desc->method.param_count; i++) { acpi_ut_remove_reference(this_walk_state->operands[i]); this_walk_state->operands[i] = NULL; } /* Clear the operand stack */ this_walk_state->num_operands = 0; ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "**** Begin nested execution of [%4.4s] **** WalkState=%p/n", method_node->name.ascii, next_walk_state)); /* Invoke an internal method if necessary */ if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { status = obj_desc->method.implementation(next_walk_state); if (status == AE_OK) { status = AE_CTRL_TERMINATE;//.........这里部分代码省略.........
开发者ID:10x-Amin,项目名称:x10_Th_kernel,代码行数:101,
示例20: AcpiDbEvaluateOnePredefinedNamestatic ACPI_STATUSAcpiDbEvaluateOnePredefinedName ( ACPI_HANDLE ObjHandle, UINT32 NestingLevel, void *Context, void **ReturnValue){ ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; ACPI_DB_EXECUTE_WALK *Info = (ACPI_DB_EXECUTE_WALK *) Context; char *Pathname; const ACPI_PREDEFINED_INFO *Predefined; ACPI_DEVICE_INFO *ObjInfo; ACPI_OBJECT_LIST ParamObjects; ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; ACPI_OBJECT *ThisParam; ACPI_BUFFER ReturnObj; ACPI_STATUS Status; UINT16 ArgTypeList; UINT8 ArgCount; UINT8 ArgType; UINT32 i; /* The name must be a predefined ACPI name */ Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii); if (!Predefined) { return (AE_OK); } if (Node->Type == ACPI_TYPE_LOCAL_SCOPE) { return (AE_OK); } Pathname = AcpiNsGetNormalizedPathname (Node, TRUE); if (!Pathname) { return (AE_OK); } /* Get the object info for number of method parameters */ Status = AcpiGetObjectInfo (ObjHandle, &ObjInfo); if (ACPI_FAILURE (Status)) { ACPI_FREE (Pathname); return (Status); } ParamObjects.Count = 0; ParamObjects.Pointer = NULL; if (ObjInfo->Type == ACPI_TYPE_METHOD) { /* Setup default parameters (with proper types) */ ArgTypeList = Predefined->Info.ArgumentList; ArgCount = METHOD_GET_ARG_COUNT (ArgTypeList); /* * Setup the ACPI-required number of arguments, regardless of what * the actual method defines. If there is a difference, then the * method is wrong and a warning will be issued during execution. */ ThisParam = Params; for (i = 0; i < ArgCount; i++) { ArgType = METHOD_GET_NEXT_TYPE (ArgTypeList); ThisParam->Type = ArgType; switch (ArgType) { case ACPI_TYPE_INTEGER: ThisParam->Integer.Value = 1; break; case ACPI_TYPE_STRING: ThisParam->String.Pointer = "This is the default argument string"; ThisParam->String.Length = strlen (ThisParam->String.Pointer); break; case ACPI_TYPE_BUFFER: ThisParam->Buffer.Pointer = (UINT8 *) Params; /* just a garbage buffer */ ThisParam->Buffer.Length = 48; break; case ACPI_TYPE_PACKAGE: ThisParam->Package.Elements = NULL; ThisParam->Package.Count = 0; break; default://.........这里部分代码省略.........
开发者ID:JamesLinus,项目名称:acpica,代码行数:101,
示例21: AcpiEvDeleteGpeBlockACPI_STATUSAcpiEvDeleteGpeBlock ( ACPI_GPE_BLOCK_INFO *GpeBlock){ ACPI_STATUS Status; ACPI_CPU_FLAGS Flags; ACPI_FUNCTION_TRACE (EvInstallGpeBlock); Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Disable all GPEs in this block */ Status = AcpiHwDisableGpeBlock (GpeBlock->XruptBlock, GpeBlock, NULL); if (!GpeBlock->Previous && !GpeBlock->Next) { /* This is the last GpeBlock on this interrupt */ Status = AcpiEvDeleteGpeXrupt (GpeBlock->XruptBlock); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; } } else { /* Remove the block on this interrupt with lock */ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); if (GpeBlock->Previous) { GpeBlock->Previous->Next = GpeBlock->Next; } else { GpeBlock->XruptBlock->GpeBlockListHead = GpeBlock->Next; } if (GpeBlock->Next) { GpeBlock->Next->Previous = GpeBlock->Previous; } AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); } AcpiCurrentGpeCount -= GpeBlock->GpeCount; /* Free the GpeBlock */ ACPI_FREE (GpeBlock->RegisterInfo); ACPI_FREE (GpeBlock->EventInfo); ACPI_FREE (GpeBlock);UnlockAndExit: Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS); return_ACPI_STATUS (Status);}
开发者ID:Strongc,项目名称:reactos,代码行数:65,
示例22: AcpiNsInitializeDevicesACPI_STATUSAcpiNsInitializeDevices ( void){ ACPI_STATUS Status; ACPI_DEVICE_WALK_INFO Info; ACPI_FUNCTION_TRACE (NsInitializeDevices); /* Init counters */ Info.DeviceCount = 0; Info.Num_STA = 0; Info.Num_INI = 0; ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Initializing Device/Processor/Thermal objects " "and executing _INI/_STA methods:/n")); /* Tree analysis: find all subtrees that contain _INI methods */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, FALSE, AcpiNsFindIniMethods, NULL, &Info, NULL); if (ACPI_FAILURE (Status)) { goto ErrorExit; } /* Allocate the evaluation information block */ Info.EvaluateInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); if (!Info.EvaluateInfo) { Status = AE_NO_MEMORY; goto ErrorExit; } /* * Execute the "global" _INI method that may appear at the root. This * support is provided for Windows compatibility (Vista+) and is not * part of the ACPI specification. */ Info.EvaluateInfo->PrefixNode = AcpiGbl_RootNode; Info.EvaluateInfo->RelativePathname = __UNCONST(METHOD_NAME__INI); Info.EvaluateInfo->Parameters = NULL; Info.EvaluateInfo->Flags = ACPI_IGNORE_RETURN_VALUE; Status = AcpiNsEvaluate (Info.EvaluateInfo); if (ACPI_SUCCESS (Status)) { Info.Num_INI++; } /* Walk namespace to execute all _INIs on present devices */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, NULL, &Info, NULL); /* * Any _OSI requests should be completed by now. If the BIOS has * requested any Windows OSI strings, we will always truncate * I/O addresses to 16 bits -- for Windows compatibility. */ if (AcpiGbl_OsiData >= ACPI_OSI_WIN_2000) { AcpiGbl_TruncateIoAddresses = TRUE; } ACPI_FREE (Info.EvaluateInfo); if (ACPI_FAILURE (Status)) { goto ErrorExit; } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, " Executed %u _INI methods requiring %u _STA executions " "(examined %u objects)/n", Info.Num_INI, Info.Num_STA, Info.DeviceCount)); return_ACPI_STATUS (Status);ErrorExit: ACPI_EXCEPTION ((AE_INFO, Status, "During device initialization")); return_ACPI_STATUS (Status);}
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:88,
示例23: AcpiEvCreateGpeInfoBlocks//.........这里部分代码省略......... (ACPI_SIZE) GpeBlock->RegisterCount * sizeof (ACPI_GPE_REGISTER_INFO)); if (!GpeRegisterInfo) { ACPI_ERROR ((AE_INFO, "Could not allocate the GpeRegisterInfo table")); return_ACPI_STATUS (AE_NO_MEMORY); } /* * Allocate the GPE EventInfo block. There are eight distinct GPEs * per register. Initialization to zeros is sufficient. */ GpeEventInfo = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) GpeBlock->GpeCount * sizeof (ACPI_GPE_EVENT_INFO)); if (!GpeEventInfo) { ACPI_ERROR ((AE_INFO, "Could not allocate the GpeEventInfo table")); Status = AE_NO_MEMORY; goto ErrorExit; } /* Save the new Info arrays in the GPE block */ GpeBlock->RegisterInfo = GpeRegisterInfo; GpeBlock->EventInfo = GpeEventInfo; /* * Initialize the GPE Register and Event structures. A goal of these * tables is to hide the fact that there are two separate GPE register * sets in a given GPE hardware block, the status registers occupy the * first half, and the enable registers occupy the second half. */ ThisRegister = GpeRegisterInfo; ThisEvent = GpeEventInfo; for (i = 0; i < GpeBlock->RegisterCount; i++) { /* Init the RegisterInfo for this GPE register (8 GPEs) */ ThisRegister->BaseGpeNumber = (UINT16) (GpeBlock->BlockBaseNumber + (i * ACPI_GPE_REGISTER_WIDTH)); ThisRegister->StatusAddress.Address = GpeBlock->Address + i; ThisRegister->EnableAddress.Address = GpeBlock->Address + i + GpeBlock->RegisterCount; ThisRegister->StatusAddress.SpaceId = GpeBlock->SpaceId; ThisRegister->EnableAddress.SpaceId = GpeBlock->SpaceId; ThisRegister->StatusAddress.BitWidth = ACPI_GPE_REGISTER_WIDTH; ThisRegister->EnableAddress.BitWidth = ACPI_GPE_REGISTER_WIDTH; ThisRegister->StatusAddress.BitOffset = 0; ThisRegister->EnableAddress.BitOffset = 0; /* Init the EventInfo for each GPE within this register */ for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { ThisEvent->GpeNumber = (UINT8) (ThisRegister->BaseGpeNumber + j); ThisEvent->RegisterInfo = ThisRegister; ThisEvent++; } /* Disable all GPEs within this register */ Status = AcpiHwWrite (0x00, &ThisRegister->EnableAddress); if (ACPI_FAILURE (Status)) { goto ErrorExit; } /* Clear any pending GPE events within this register */ Status = AcpiHwWrite (0xFF, &ThisRegister->StatusAddress); if (ACPI_FAILURE (Status)) { goto ErrorExit; } ThisRegister++; } return_ACPI_STATUS (AE_OK);ErrorExit: if (GpeRegisterInfo) { ACPI_FREE (GpeRegisterInfo); } if (GpeEventInfo) { ACPI_FREE (GpeEventInfo); } return_ACPI_STATUS (Status);}
开发者ID:Strongc,项目名称:reactos,代码行数:101,
示例24: AcpiDbBusWalkstatic ACPI_STATUSAcpiDbBusWalk ( ACPI_HANDLE ObjHandle, UINT32 NestingLevel, void *Context, void **ReturnValue){ ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; ACPI_STATUS Status; ACPI_BUFFER Buffer; ACPI_NAMESPACE_NODE *TempNode; ACPI_DEVICE_INFO *Info; UINT32 i; if ((Node->Type != ACPI_TYPE_DEVICE) && (Node->Type != ACPI_TYPE_PROCESSOR)) { return (AE_OK); } /* Exit if there is no _PRT under this device */ Status = AcpiGetHandle (Node, METHOD_NAME__PRT, ACPI_CAST_PTR (ACPI_HANDLE, &TempNode)); if (ACPI_FAILURE (Status)) { return (AE_OK); } /* Get the full path to this device object */ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; Status = AcpiNsHandleToPathname (ObjHandle, &Buffer); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could Not get pathname for object %p/n", ObjHandle); return (AE_OK); } Status = AcpiGetObjectInfo (ObjHandle, &Info); if (ACPI_FAILURE (Status)) { return (AE_OK); } /* Display the full path */ AcpiOsPrintf ("%-32s Type %X", (char *) Buffer.Pointer, Node->Type); ACPI_FREE (Buffer.Pointer); if (Info->Flags & ACPI_PCI_ROOT_BRIDGE) { AcpiOsPrintf (" - Is PCI Root Bridge"); } AcpiOsPrintf ("/n"); /* _PRT info */ AcpiOsPrintf ("_PRT: %p/n", TempNode); /* Dump _ADR, _HID, _UID, _CID */ if (Info->Valid & ACPI_VALID_ADR) { AcpiOsPrintf ("_ADR: %8.8X%8.8X/n", ACPI_FORMAT_UINT64 (Info->Address)); } else { AcpiOsPrintf ("_ADR: <Not Present>/n"); } if (Info->Valid & ACPI_VALID_HID) { AcpiOsPrintf ("_HID: %s/n", Info->HardwareId.String); } else { AcpiOsPrintf ("_HID: <Not Present>/n"); } if (Info->Valid & ACPI_VALID_UID) { AcpiOsPrintf ("_UID: %s/n", Info->UniqueId.String); } else { AcpiOsPrintf ("_UID: <Not Present>/n"); } if (Info->Valid & ACPI_VALID_CID) { for (i = 0; i < Info->CompatibleIdList.Count; i++) { AcpiOsPrintf ("_CID: %s/n", Info->CompatibleIdList.Ids[i].String); } } else {//.........这里部分代码省略.........
开发者ID:cloudius-systems,项目名称:acpica,代码行数:101,
示例25: AcpiEvCreateGpeBlockACPI_STATUSAcpiEvCreateGpeBlock ( ACPI_NAMESPACE_NODE *GpeDevice, UINT64 Address, UINT8 SpaceId, UINT32 RegisterCount, UINT16 GpeBlockBaseNumber, UINT32 InterruptNumber, ACPI_GPE_BLOCK_INFO **ReturnGpeBlock){ ACPI_STATUS Status; ACPI_GPE_BLOCK_INFO *GpeBlock; ACPI_GPE_WALK_INFO WalkInfo; ACPI_FUNCTION_TRACE (EvCreateGpeBlock); if (!RegisterCount) { return_ACPI_STATUS (AE_OK); } /* Allocate a new GPE block */ GpeBlock = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_BLOCK_INFO)); if (!GpeBlock) { return_ACPI_STATUS (AE_NO_MEMORY); } /* Initialize the new GPE block */ GpeBlock->Address = Address; GpeBlock->SpaceId = SpaceId; GpeBlock->Node = GpeDevice; GpeBlock->GpeCount = (UINT16) (RegisterCount * ACPI_GPE_REGISTER_WIDTH); GpeBlock->Initialized = FALSE; GpeBlock->RegisterCount = RegisterCount; GpeBlock->BlockBaseNumber = GpeBlockBaseNumber; /* * Create the RegisterInfo and EventInfo sub-structures * Note: disables and clears all GPEs in the block */ Status = AcpiEvCreateGpeInfoBlocks (GpeBlock); if (ACPI_FAILURE (Status)) { ACPI_FREE (GpeBlock); return_ACPI_STATUS (Status); } /* Install the new block in the global lists */ Status = AcpiEvInstallGpeBlock (GpeBlock, InterruptNumber); if (ACPI_FAILURE (Status)) { ACPI_FREE (GpeBlock->RegisterInfo); ACPI_FREE (GpeBlock->EventInfo); ACPI_FREE (GpeBlock); return_ACPI_STATUS (Status); } AcpiGbl_AllGpesInitialized = FALSE; /* Find all GPE methods (_Lxx or_Exx) for this block */ WalkInfo.GpeBlock = GpeBlock; WalkInfo.GpeDevice = GpeDevice; WalkInfo.ExecuteByOwnerId = FALSE; Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice, ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, AcpiEvMatchGpeMethod, NULL, &WalkInfo, NULL); /* Return the new block */ if (ReturnGpeBlock) { (*ReturnGpeBlock) = GpeBlock; } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, " Initialized GPE %02X to %02X [%4.4s] %u regs on interrupt 0x%X%s/n", (UINT32) GpeBlock->BlockBaseNumber, (UINT32) (GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1)), GpeDevice->Name.Ascii, GpeBlock->RegisterCount, InterruptNumber, InterruptNumber == AcpiGbl_FADT.SciInterrupt ? " (SCI)" : "")); /* Update global count of currently available GPEs */ AcpiCurrentGpeCount += GpeBlock->GpeCount; return_ACPI_STATUS (AE_OK);}
开发者ID:Strongc,项目名称:reactos,代码行数:94,
注:本文中的ACPI_FREE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ACPI_FUNCTION_ENTRY函数代码示例 C++ ACPI_FORMAT_UINT64函数代码示例 |