本文整理匯總了C++中ACPI_FREE函數的典型用法代碼示例。如果您正苦於以下問題:C++ ACPI_FREE函數的具體用法?C++ ACPI_FREE怎麽用?C++ ACPI_FREE使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ACPI_FREE函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}
示例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);
}
示例3: AcpiExOpcode_3A_0T_0R
ACPI_STATUS
AcpiExOpcode_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);
}
示例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);
}
示例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);
}
示例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;
}
}
示例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;
}
}
示例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,
示例9: AcpiDsDeleteWalkState
void
AcpiDsDeleteWalkState (
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;
}
示例10: OptOptimizeNameDeclaration
static ACPI_STATUS
OptOptimizeNameDeclaration (
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);
}
示例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);
}
示例12: AdCreateTableHeader
void
AdCreateTableHeader (
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);
}
示例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;
}
}
示例14: MpNamespaceXrefBegin
static ACPI_STATUS
MpNamespaceXrefBegin (
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);
}
示例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_status
acpi_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);
}