merge conflicts

This commit is contained in:
christos 2019-12-14 16:56:32 +00:00
parent 32aedd46ba
commit 1c66306845
32 changed files with 527 additions and 145 deletions

View File

@ -219,7 +219,7 @@ AdCreateTableHeader (
* makes it easier to rename the disassembled ASL file if needed.
*/
AcpiOsPrintf (
"DefinitionBlock (\"\", \"%4.4s\", %hhu, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
"DefinitionBlock (\"\", \"%4.4s\", %u, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
Table->Signature, Table->Revision,
Table->OemId, Table->OemTableId, Table->OemRevision);
}
@ -400,6 +400,8 @@ AdParseTable (
AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
ASL_CV_INIT_FILETREE(Table, AmlStart, AmlLength);
AcpiUtSetIntegerWidth (Table->Revision);
/* Create the root object */
AcpiGbl_ParseOpRoot = AcpiPsCreateScopeOp (AmlStart);
@ -435,7 +437,6 @@ AdParseTable (
}
WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
Status = AcpiPsParseAml (WalkState);
if (ACPI_FAILURE (Status))
@ -493,7 +494,7 @@ AdParseTable (
fprintf (stderr,
"Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n");
Status = AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot);
(void) AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot);
fprintf (stderr, "\n");
/* Process Resource Templates */

View File

@ -461,7 +461,7 @@ ApCheckForGpeNameConflict (
/* Need a null-terminated string version of NameSeg */
ACPI_MOVE_32_TO_32 (Name, &Op->Asl.NameSeg);
ACPI_MOVE_32_TO_32 (Name, Op->Asl.NameSeg);
Name[ACPI_NAMESEG_SIZE] = 0;
/*

View File

@ -112,6 +112,7 @@ CmDoCompile (
PrDoPreprocess ();
AslGbl_CurrentLineNumber = 1;
AslGbl_LogicalLineNumber = 1;
AslGbl_CurrentLineOffset = 0;
if (AslGbl_PreprocessOnly)
{
@ -174,25 +175,6 @@ CmDoCompile (
LsDumpParseTree ();
OpcGetIntegerWidth (AslGbl_ParseTreeRoot->Asl.Child);
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 (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
TrAmlTransformWalkBegin, TrAmlTransformWalkEnd, NULL);
UtEndEvent (Event);
/* Generate AML opcodes corresponding to the parse tokens */
Event = UtBeginEvent ("Generate AML opcodes");
DbgPrint (ASL_DEBUG_OUTPUT, "Generating AML opcodes\n\n");
TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,
OpcAmlOpcodeWalk, NULL);
UtEndEvent (Event);
UtEndEvent (FullCompile);
return (AE_OK);
@ -223,6 +205,25 @@ CmDoAslMiddleAndBackEnd (
ACPI_STATUS Status;
OpcGetIntegerWidth (AslGbl_ParseTreeRoot->Asl.Child);
/* Pre-process parse tree for any operator transforms */
Event = UtBeginEvent ("Parse tree transforms");
DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n");
TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
TrAmlTransformWalkBegin, TrAmlTransformWalkEnd, NULL);
UtEndEvent (Event);
/* Generate AML opcodes corresponding to the parse tokens */
Event = UtBeginEvent ("Generate AML opcodes");
DbgPrint (ASL_DEBUG_OUTPUT, "Generating AML opcodes\n\n");
TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,
NULL, OpcAmlOpcodeWalk, NULL);
UtEndEvent (Event);
/* Interpret and generate all compile-time constants */
Event = UtBeginEvent ("Constant folding via AML interpreter");

View File

@ -227,7 +227,7 @@ AeAddToErrorLog (
* PARAMETERS: OutputFile - Output file
* Enode - Error node to print
* PrematureEOF - True = PrematureEOF has been reached
* Total - Total legth of line
* Total - Total length of line
*
* RETURN: None
*
@ -337,7 +337,7 @@ AeDecodeErrorMessageId (
* PARAMETERS: OutputFile - Output file
* Enode - Error node to print
* PrematureEOF - True = PrematureEOF has been reached
* Total - amount of characters printed so far
* Total - Number of characters printed so far
*
*
* RETURN: Status
@ -419,6 +419,7 @@ AePrintErrorSourceLine (
fprintf (OutputFile, "\n");
return AE_OK;
}
/*
* Seek to the offset in the combined source file,
* read the source line, and write it to the output.
@ -442,7 +443,8 @@ AePrintErrorSourceLine (
AslGbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
return AE_IO_ERROR;
}
/* Read/write the source line, up to the maximum line length */
/* Read/write the source line, up to the maximum line length */
while (RActual && SourceByte && (SourceByte != '\n'))
{
@ -624,7 +626,7 @@ AePrintException (
*
* RETURN: None
*
* DESCRIPTION: Print the contents of an error nodes. This function is tailored
* DESCRIPTION: Print the contents of an error node. This function is tailored
* to print error nodes that are SubErrors within ASL_ERROR_MSG
*
******************************************************************************/
@ -687,8 +689,8 @@ AePrintErrorLog (
* LogicalLineNumber - Cumulative line number
* LogicalByteOffset - Byte offset in source file
* Column - Column in current line
* Filename - source filename
* ExtraMessage - additional error message
* Filename - Source filename
* ExtraMessage - Additional error message
* SourceLine - Line of error source code
* SubError - SubError of this InputEnode
*
@ -755,10 +757,17 @@ static void AslInitEnode (
Enode->FilenameLength = 6;
}
FileNode = FlGetCurrentFileNode ();
/*
* Attempt to get the file node of the filename listed in the parse
* node. If the name doesn't exist in the global file node, it is
* because the file is included by #include or ASL include. In this
* case, get the current file node. The source output of the current
* file will contain the contents of the file listed in the parse node.
*/
FileNode = FlGetFileNode (ASL_FILE_INPUT, Filename);
if (!FileNode)
{
return;
FileNode = FlGetCurrentFileNode ();
}
Enode->SourceFilename =
@ -776,8 +785,8 @@ static void AslInitEnode (
* LineNumber - Actual file line number
* Column - Column in current line
* SourceLine - Actual source code line
* Filename - source filename
* ExtraMessage - additional error message
* Filename - Source filename
* ExtraMessage - Additional error message
*
* RETURN: None
*
@ -810,8 +819,8 @@ AslCommonError2 (
* LogicalLineNumber - Cumulative line number
* LogicalByteOffset - Byte offset in source file
* Column - Column in current line
* Filename - source filename
* ExtraMessage - additional error message
* Filename - Source filename
* ExtraMessage - Additional error message
*
* RETURN: None
*
@ -853,8 +862,8 @@ AslCommonError (
* LogicalLineNumber - Cumulative line number
* LogicalByteOffset - Byte offset in source file
* Column - Column in current line
* Filename - source filename
* Message - additional error message
* Filename - Source filename
* Message - Additional error message
* SourceLine - Actual line of source code
* SubError - Sub-error associated with this error
*
@ -917,7 +926,7 @@ AslLogNewError (
* PARAMETERS: Level - Seriousness (Warning/error, etc.)
* MessageId - Index into global message buffer
*
* RETURN: UINT8 - modified level
* RETURN: UINT8 - Modified level
*
* DESCRIPTION: Get the modified level of exception codes that are reported as
* errors from the -ww option.
@ -1261,7 +1270,7 @@ AslIsExceptionDisabled (
* MainMsg - Message pertaining to the MainOp
* SubMsgId - Index into global message buffer
* SubOp - Additional parse node for better message
* SubMsg - Message pertainint to SubOp
* SubMsg - Message pertaining to SubOp
*
*
* RETURN: None
@ -1313,7 +1322,7 @@ AslDualParseOpError (
* PARAMETERS: Level - Seriousness (Warning/error, etc.)
* MessageId - Index into global message buffer
* Op - Parse node where error happened
* ExtraMessage - additional error message
* ExtraMessage - Additional error message
*
* RETURN: None
*
@ -1351,7 +1360,7 @@ AslError (
*
* PARAMETERS: Op - Parse node where error happened
* Status - The ACPICA Exception
* ExtraMessage - additional error message
* ExtraMessage - Additional error message
* Abort - TRUE -> Abort compilation
*
* RETURN: None

View File

@ -99,12 +99,6 @@ FlInitOneFile (
NewFileNode = ACPI_CAST_PTR (ASL_GLOBAL_FILE_NODE,
UtLocalCacheCalloc (sizeof (ASL_GLOBAL_FILE_NODE)));
if (!NewFileNode)
{
AslError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, NULL, NULL);
return (AE_NO_MEMORY);
}
NewFileNode->ParserErrorDetected = FALSE;
NewFileNode->Next = AslGbl_FilesList;
@ -312,8 +306,22 @@ ASL_GLOBAL_FILE_NODE *
FlGetCurrentFileNode (
void)
{
return (FlGetFileNode (
ASL_FILE_INPUT,AslGbl_Files[ASL_FILE_INPUT].Filename));
ASL_GLOBAL_FILE_NODE *FileNode =
FlGetFileNode (ASL_FILE_INPUT,AslGbl_Files[ASL_FILE_INPUT].Filename);
if (!FileNode)
{
/*
* If the current file node does not exist after initializing the file
* node structures, something went wrong and this is an unrecoverable
* condition.
*/
FlFileError (ASL_FILE_INPUT, ASL_MSG_COMPILER_INTERNAL);
AslAbort ();
}
return (FileNode);
}

View File

@ -249,7 +249,7 @@ LdLoadFieldElements (
* The name already exists in this scope
* But continue processing the elements
*/
AslDualParseOpError (ASL_WARNING, ASL_MSG_NAME_EXISTS, Child,
AslDualParseOpError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Child,
Child->Asl.Value.String, ASL_MSG_FOUND_HERE, Node->Op,
Node->Op->Asl.ExternalName);
}
@ -418,13 +418,12 @@ LdNamespace1Begin (
case AML_INT_CONNECTION_OP:
if (Op->Asl.Child->Asl.AmlOpcode != AML_INT_NAMEPATH_OP)
{
break;
}
Arg = Op->Asl.Child;
Arg = Op->Asl.Child;
Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Asl.ExternalName,
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
WalkState, &Node);
@ -433,15 +432,6 @@ LdNamespace1Begin (
break;
}
if (Node->Type == ACPI_TYPE_BUFFER)
{
Arg->Asl.Node = Node;
Arg = Node->Op->Asl.Child; /* Get namepath */
Arg = Arg->Asl.Next; /* Get actual buffer */
Arg = Arg->Asl.Child; /* Buffer length */
Arg = Arg->Asl.Next; /* RAW_DATA buffer */
}
break;
default:
@ -468,7 +458,6 @@ LdNamespace1Begin (
* These opcodes are guaranteed to have a parent.
* Examine the parent opcode.
*/
Status = AE_OK;
ParentOp = Op->Asl.Parent;
OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Asl.AmlOpcode);
@ -889,12 +878,19 @@ FinishNode:
Op->Asl.Node = Node;
Node->Op = Op;
/* Set the actual data type if appropriate (EXTERNAL term only) */
/*
* Set the actual data type if appropriate (EXTERNAL term only)
* As of 11/19/2019, ASL External() does not support parameter
* counts. When an External method is loaded, the parameter count is
* unknown setting Node->Value to ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS
* indicates that the parameter count for this method is unknown.
* This information is used in ASL cross reference to help determine the
* parameter count through method calls.
*/
if (ActualObjectType != ACPI_TYPE_ANY)
{
Node->Type = (UINT8) ActualObjectType;
Node->Value = ASL_EXTERNAL_METHOD;
Node->Value = ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS;
}
if (Op->Asl.ParseOpcode == PARSEOP_METHOD)

View File

@ -111,7 +111,7 @@ AslCommandLine (
{
exit (-1);
}
exit (1);
exit (0);
}
/* Next parameter must be the input filename */

View File

@ -350,7 +350,7 @@ ApCheckPackage (
for (i = 0; i < Package->RetInfo4.Count1; ++i)
{
Status = ApCheckObjectType (Predefined->Info.Name, Op,
ApCheckObjectType (Predefined->Info.Name, Op,
Package->RetInfo4.ObjectType1, i);
Op = Op->Asl.Next;
}

View File

@ -115,7 +115,7 @@ UtQueryForOverwrite (
char *Pathname)
{
struct stat StatInfo;
int InChar = 0x34;
int InChar;
if (!stat (Pathname, &StatInfo))
@ -459,11 +459,6 @@ UtDisplayOneSummary (
/* Summary of main input and output files */
FileNode = FlGetCurrentFileNode ();
if (!FileNode)
{
fprintf (stderr, "Summary could not be generated");
return;
}
if (FileNode->ParserErrorDetected)
{

View File

@ -947,7 +947,7 @@ XfNamespaceLocateBegin (
NextOp = NextOp->Asl.Next;
}
if (Node->Value != ASL_EXTERNAL_METHOD &&
if (Node->Value != ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS &&
Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_EXTERNAL)
{
/*
@ -956,8 +956,18 @@ XfNamespaceLocateBegin (
*/
if (PassedArgs != Node->Value)
{
snprintf (AslGbl_MsgBuffer, sizeof(AslGbl_MsgBuffer), "%s requires %u", Op->Asl.ExternalName,
Node->Value);
if (Node->Flags & ANOBJ_IS_EXTERNAL)
{
snprintf (AslGbl_MsgBuffer, sizeof(AslGbl_MsgBuffer),
"according to previous use, %s requires %u",
Op->Asl.ExternalName, Node->Value);
}
else
{
snprintf (AslGbl_MsgBuffer, sizeof(AslGbl_MsgBuffer),
"%s requires %u", Op->Asl.ExternalName,
Node->Value);
}
if (PassedArgs < Node->Value)
{
@ -969,6 +979,22 @@ XfNamespaceLocateBegin (
}
}
}
/*
* At this point, a method call to an external method has been
* detected. As of 11/19/2019, iASL does not support parameter counts
* for methods declared as external. Therefore, save the parameter
* count of the first method call and use this count check other
* method calls to ensure that the methods are being called with the
* same amount of parameters.
*/
else if (Node->Type == ACPI_TYPE_METHOD &&
(Node->Flags & ANOBJ_IS_EXTERNAL) &&
Node->Value == ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS &&
Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_EXTERNAL)
{
Node->Value = PassedArgs;
}
}
/* 4) Check for an ASL Field definition */

View File

@ -153,18 +153,11 @@ DtDoCompile (
UtEndEvent (Event);
FileNode = FlGetCurrentFileNode ();
if (!FileNode)
{
fprintf (stderr, "Summary for %s could not be generated",
AslGbl_Files[ASL_FILE_INPUT].Filename);
}
else
{
FileNode->TotalLineCount = AslGbl_CurrentLineNumber;
FileNode->OriginalInputFileSize = AslGbl_InputByteCount;
DbgPrint (ASL_PARSE_OUTPUT, "Line count: %u input file size: %u\n",
FileNode->TotalLineCount, FileNode->OriginalInputFileSize);
}
FileNode->TotalLineCount = AslGbl_CurrentLineNumber;
FileNode->OriginalInputFileSize = AslGbl_InputByteCount;
DbgPrint (ASL_PARSE_OUTPUT, "Line count: %u input file size: %u\n",
FileNode->TotalLineCount, FileNode->OriginalInputFileSize);
if (ACPI_FAILURE (Status))
{
@ -195,11 +188,8 @@ DtDoCompile (
/* Save the compile time statistics to the current file node */
if (FileNode)
{
FileNode->TotalFields = AslGbl_InputFieldCount;
FileNode->OutputByteLength = AslGbl_TableLength;
}
FileNode->TotalFields = AslGbl_InputFieldCount;
FileNode->OutputByteLength = AslGbl_TableLength;
return (Status);
}
@ -465,7 +455,7 @@ DtCompileTable (
ACPI_STATUS Status = AE_OK;
if (!Field)
if (!Field || !Info)
{
return (AE_BAD_PARAMETER);
}
@ -536,6 +526,14 @@ DtCompileTable (
FieldType = DtGetFieldType (Info);
AslGbl_InputFieldCount++;
if (FieldType != DT_FIELD_TYPE_INLINE_SUBTABLE &&
strcmp (Info->Name, LocalField->Name))
{
sprintf (AslGbl_MsgBuffer, "found \"%s\" expected \"%s\"",
LocalField->Name, Info->Name);
DtError (ASL_ERROR, ASL_MSG_INVALID_LABEL, LocalField, AslGbl_MsgBuffer);
}
switch (FieldType)
{
case DT_FIELD_TYPE_FLAGS_INTEGER:

View File

@ -57,17 +57,24 @@ void * AslLocalAllocate (unsigned int Size);
int DtCompilerParserlex (void);
int DtCompilerParserparse (void);
#ifdef YYBYACC
struct YYLTYPE;
#endif
void DtCompilerParsererror (
#ifdef YYBYACC
YYLTYPE *loc,
struct YYLTYPE *loc,
#endif
char const *msg);
extern char *DtCompilerParsertext;
extern DT_FIELD *AslGbl_CurrentField;
extern int DtLabelByteOffset;
extern UINT64 DtCompilerParserResult; /* Expression return value */
extern UINT64 DtCompilerParserlineno; /* Current line number */
extern UINT32 DtTokenFirstLine;
extern UINT32 DtTokenFirstColumn;
/* Bison/yacc configuration */
#define yytname DtCompilerParsername
@ -82,42 +89,30 @@ extern UINT64 DtCompilerParserlineno; /* Current line number */
%}
%code requires {
typedef struct YYLTYPE {
int first_line;
int last_line;
int first_column;
int last_column;
int first_byte_offset;
} YYLTYPE;
#define YYLTYPE_IS_DECLARED 1
}
%union {
char *s;
DT_FIELD *f;
DT_TABLE_UNIT *u;
}
%type <f> Table
%token <s> DT_PARSEOP_DATA
%token <s> DT_PARSEOP_LABEL
%token <s> DT_PARSEOP_STRING_DATA
%token <s> DT_PARSEOP_LINE_CONTINUATION
%type <s> Data
%type <s> Datum
%type <s> MultiLineData
%type <s> MultiLineDataList
%token <u> DT_PARSEOP_DATA
%token <u> DT_PARSEOP_LABEL
%token <u> DT_PARSEOP_STRING_DATA
%token <u> DT_PARSEOP_LINE_CONTINUATION
%type <u> Data
%type <u> Datum
%type <u> MultiLineData
%type <u> MultiLineDataList
%%
Table
:
FieldList { DtCompilerParserResult = 5;}
FieldList { }
;
FieldList
@ -126,7 +121,7 @@ FieldList
;
Field
: DT_PARSEOP_LABEL ':' Data { DtCreateField ($1, $3, (@3).first_line, (@1).first_byte_offset, (@1).first_column, (@3).first_column); }
: DT_PARSEOP_LABEL ':' Data { DtCreateField ($1, $3, DtLabelByteOffset); }
;
Data
@ -136,7 +131,7 @@ Data
;
MultiLineDataList
: MultiLineDataList MultiLineData { $$ = AcpiUtStrcat(AcpiUtStrcat($1, " "), $2); } /* combine the strings with strcat */
: MultiLineDataList MultiLineData { $$ = DtCreateTableUnit (AcpiUtStrcat(AcpiUtStrcat($1->Value, " "), $2->Value), $1->Line, $1->Column); } /* combine the strings with strcat */
| MultiLineData { $$ = $1; }
;
@ -145,8 +140,14 @@ MultiLineData
;
Datum
: DT_PARSEOP_DATA { DbgPrint (ASL_PARSE_OUTPUT, "parser data: [%s]\n", DtCompilerParserlval.s); $$ = AcpiUtStrdup(DtCompilerParserlval.s); }
| DT_PARSEOP_STRING_DATA { DbgPrint (ASL_PARSE_OUTPUT, "parser string data: [%s]\n", DtCompilerParserlval.s); $$ = AcpiUtStrdup(DtCompilerParserlval.s); }
: DT_PARSEOP_DATA {
DbgPrint (ASL_PARSE_OUTPUT, "parser data: [%s]\n", DtCompilerParserlval.s);
$$ = DtCreateTableUnit (AcpiUtStrdup(DtCompilerParserlval.s), DtTokenFirstLine, DtTokenFirstColumn);
}
| DT_PARSEOP_STRING_DATA {
DbgPrint (ASL_PARSE_OUTPUT, "parser string data: [%s]\n", DtCompilerParserlval.s);
$$ = DtCreateTableUnit (AcpiUtStrdup(DtCompilerParserlval.s), DtTokenFirstLine, DtTokenFirstColumn);
}
;
@ -171,7 +172,7 @@ Datum
void
DtCompilerParsererror (
#ifdef YYBYACC
YYLTYPE *loc,
struct YYLTYPE *loc,
#endif
char const *Message)
{

View File

@ -468,6 +468,14 @@ DtCompileBuffer (
StringValue = DtNormalizeBuffer (StringValue, &Count);
Substring = StringValue;
if (Count != ByteLength)
{
sprintf(AslGbl_MsgBuffer,
"Found %u values, must match expected count: %u",
Count, ByteLength);
DtError (ASL_ERROR, ASL_MSG_BUFFER_LIST, Field, AslGbl_MsgBuffer);
goto Exit;
}
/* Each element of StringValue is now three chars (2 hex + 1 space) */
@ -613,3 +621,122 @@ DtCompileFlag (
*Buffer |= (UINT8) (Value << BitPosition);
}
/******************************************************************************
*
* FUNCTION: DtCreateField
*
* PARAMETERS: Name
* Value
* Line
* Offset
* Column
* NameColumn
*
* RETURN: None
*
* DESCRIPTION: Create a field
*
*****************************************************************************/
void
DtCreateField (
DT_TABLE_UNIT *FieldKey,
DT_TABLE_UNIT *FieldValue,
UINT32 Offset)
{
DT_FIELD *Field = UtFieldCacheCalloc ();
Field->StringLength = 0;
if (FieldKey->Value)
{
Field->Name =
strcpy (UtLocalCacheCalloc (strlen (FieldKey->Value) + 1), FieldKey->Value);
}
if (FieldValue->Value)
{
Field->StringLength = strlen (FieldValue->Value);
Field->Value =
strcpy (UtLocalCacheCalloc (Field->StringLength + 1), FieldValue->Value);
}
Field->Line = FieldValue->Line;
Field->ByteOffset = Offset;
Field->NameColumn = FieldKey->Column;
Field->Column = FieldValue->Column;
DtLinkField (Field);
DtDumpFieldList (AslGbl_FieldList);
}
/******************************************************************************
*
* FUNCTION: DtCreateTableUnit
*
* PARAMETERS: Data
* Line
* Column
*
* RETURN: a table unit
*
* DESCRIPTION: Create a table unit
*
*****************************************************************************/
DT_TABLE_UNIT *
DtCreateTableUnit (
char *Data,
UINT32 Line,
UINT32 Column)
{
DT_TABLE_UNIT *Unit = (DT_TABLE_UNIT *) UtFieldCacheCalloc ();
Unit->Value = Data;
Unit->Line = Line;
Unit->Column = Column;
return (Unit);
}
/******************************************************************************
*
* FUNCTION: DtLinkField
*
* PARAMETERS: Field - New field object to link
*
* RETURN: None
*
* DESCRIPTION: Link one field name and value to the list
*
*****************************************************************************/
void
DtLinkField (
DT_FIELD *Field)
{
DT_FIELD *Prev;
DT_FIELD *Next;
Prev = Next = AslGbl_FieldList;
while (Next)
{
Prev = Next;
Next = Next->Next;
}
if (Prev)
{
Prev->Next = Field;
}
else
{
AslGbl_FieldList = Field;
}
}

View File

@ -605,7 +605,6 @@ AcpiDbDisplayResults (
return;
}
ObjDesc = WalkState->MethodDesc;
Node = WalkState->MethodNode;
if (WalkState->Results)
@ -665,7 +664,6 @@ AcpiDbDisplayCallingTree (
return;
}
Node = WalkState->MethodNode;
AcpiOsPrintf ("Current Control Method Call Tree\n");
while (WalkState)

View File

@ -100,6 +100,7 @@ enum AcpiExDebuggerCommands
CMD_EVALUATE,
CMD_EXECUTE,
CMD_EXIT,
CMD_FIELDS,
CMD_FIND,
CMD_GO,
CMD_HANDLERS,
@ -179,6 +180,7 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] =
{"EVALUATE", 1},
{"EXECUTE", 1},
{"EXIT", 0},
{"FIELDS", 1},
{"FIND", 1},
{"GO", 0},
{"HANDLERS", 0},
@ -252,6 +254,7 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
{1, " Find <AcpiName> (? is wildcard)", "Find ACPI name(s) with wildcards\n"},
{1, " Integrity", "Validate namespace integrity\n"},
{1, " Methods", "Display list of loaded control methods\n"},
{1, " Fields <AddressSpaceId>", "Display list of loaded field units by space ID\n"},
{1, " Namespace [Object] [Depth]", "Display loaded namespace tree/subtree\n"},
{1, " Notify <Object> <Value>", "Send a notification on Object\n"},
{1, " Objects [ObjectType]", "Display summary of all objects or just given type\n"},
@ -575,6 +578,22 @@ AcpiDbGetNextToken (
}
break;
case '{':
/* This is the start of a field unit, scan until closing brace */
String++;
Start = String;
Type = ACPI_TYPE_FIELD_UNIT;
/* Find end of buffer */
while (*String && (*String != '}'))
{
String++;
}
break;
case '[':
/* This is the start of a package, scan until closing bracket */
@ -769,6 +788,7 @@ AcpiDbCommandDispatch (
ACPI_PARSE_OBJECT *Op)
{
UINT32 Temp;
UINT64 Temp64;
UINT32 CommandIndex;
UINT32 ParamCount;
char *CommandLine;
@ -786,7 +806,6 @@ AcpiDbCommandDispatch (
ParamCount = AcpiDbGetLine (InputBuffer);
CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]);
Temp = 0;
/*
* We don't want to add the !! command to the history buffer. It
@ -885,6 +904,21 @@ AcpiDbCommandDispatch (
Status = AcpiDbFindNameInNamespace (AcpiGbl_DbArgs[1]);
break;
case CMD_FIELDS:
Status = AcpiUtStrtoul64 (AcpiGbl_DbArgs[1], &Temp64);
if (ACPI_FAILURE (Status) || Temp64 >= ACPI_NUM_PREDEFINED_REGIONS)
{
AcpiOsPrintf (
"Invalid address space ID: must be between 0 and %u inclusive\n",
ACPI_NUM_PREDEFINED_REGIONS - 1);
return (AE_OK);
}
Status = AcpiDbDisplayFields ((UINT32) Temp64);
break;
case CMD_GO:
AcpiGbl_CmSingleStep = FALSE;

View File

@ -407,6 +407,11 @@ AcpiDbDisassembleMethod (
WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
Status = AcpiPsParseAml (WalkState);
if (ACPI_FAILURE(Status))
{
return (Status);
}
(void) AcpiDmParseDeferredOps (Op);
/* Now we can disassemble the method */

View File

@ -46,6 +46,7 @@
#include "acnamesp.h"
#include "acdebug.h"
#include "acpredef.h"
#include "acinterp.h"
#define _COMPONENT ACPI_CA_DEBUGGER
@ -614,6 +615,90 @@ AcpiDbWalkForObjectCounts (
}
/*******************************************************************************
*
* FUNCTION: AcpiDbWalkForFields
*
* PARAMETERS: Callback from WalkNamespace
*
* RETURN: Status
*
* DESCRIPTION: Display short info about objects in the namespace
*
******************************************************************************/
static ACPI_STATUS
AcpiDbWalkForFields (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue)
{
ACPI_OBJECT *RetValue;
ACPI_REGION_WALK_INFO *Info = (ACPI_REGION_WALK_INFO *) Context;
ACPI_BUFFER Buffer;
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node = AcpiNsValidateHandle (ObjHandle);
if (!Node)
{
return (AE_OK);
}
if (Node->Object->Field.RegionObj->Region.SpaceId != Info->AddressSpaceId)
{
return (AE_OK);
}
Info->Count++;
/* Get and display the full pathname to this object */
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, TRUE);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
return (AE_OK);
}
AcpiOsPrintf ("%s ", (char *) Buffer.Pointer);
ACPI_FREE (Buffer.Pointer);
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
AcpiEvaluateObject (ObjHandle, NULL, NULL, &Buffer);
/*
* Since this is a field unit, surround the output in braces
*/
AcpiOsPrintf ("{");
RetValue = (ACPI_OBJECT *) Buffer.Pointer;
switch (RetValue->Type)
{
case ACPI_TYPE_INTEGER:
AcpiOsPrintf ("%8.8X%8.8X", ACPI_FORMAT_UINT64 (RetValue->Integer.Value));
break;
case ACPI_TYPE_BUFFER:
AcpiUtDumpBuffer (RetValue->Buffer.Pointer,
RetValue->Buffer.Length, DB_DISPLAY_DATA_ONLY | DB_BYTE_DISPLAY, 0);
break;
default:
break;
}
AcpiOsPrintf ("}\n");
ACPI_FREE (Buffer.Pointer);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbWalkForSpecificObjects
@ -749,6 +834,42 @@ AcpiDbDisplayObjects (
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayFields
*
* PARAMETERS: ObjTypeArg - Type of object to display
* DisplayCountArg - Max depth to display
*
* RETURN: None
*
* DESCRIPTION: Display objects in the namespace of the requested type
*
******************************************************************************/
ACPI_STATUS
AcpiDbDisplayFields (
UINT32 AddressSpaceId)
{
ACPI_REGION_WALK_INFO Info;
Info.Count = 0;
Info.OwnerId = ACPI_OWNER_ID_MAX;
Info.DebugLevel = ACPI_UINT32_MAX;
Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
Info.AddressSpaceId = AddressSpaceId;
/* Walk the namespace from the root */
(void) AcpiWalkNamespace (ACPI_TYPE_LOCAL_REGION_FIELD, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, AcpiDbWalkForFields, NULL,
(void *) &Info, NULL);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbIntegrityWalk

View File

@ -333,7 +333,6 @@ AcpiDmResourceTemplate (
* missing EndDependentDescriptor.
*/
Level--;
DependentFns = FALSE;
/* Go ahead and insert EndDependentFn() */

View File

@ -849,7 +849,6 @@ AcpiDmDescendingOp (
* the buffer size Op. Open up a new block
*/
NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
NextOp = NextOp->Common.Next;
ASL_CV_CLOSE_PAREN (Op, Level);
/* Emit description comment for Name() with a predefined ACPI name */

View File

@ -127,7 +127,7 @@ AcpiDsExecBeginControlOp (
ControlState->Control.Opcode =
Op->Common.AmlOpcode;
ControlState->Control.LoopTimeout = AcpiOsGetTimer () +
(UINT64) (AcpiGbl_MaxLoopIterations * ACPI_100NSEC_PER_SEC);
((UINT64) AcpiGbl_MaxLoopIterations * ACPI_100NSEC_PER_SEC);
/* Push the control state on this walk's control stack */

View File

@ -266,6 +266,7 @@ AcpiDsInitBufferField (
}
ObjDesc->BufferField.BufferObj = BufferDesc;
ObjDesc->BufferField.IsCreateField = AmlOpcode == AML_CREATE_FIELD_OP;
/* Reference count for BufferDesc inherits ObjDesc count */

View File

@ -929,11 +929,11 @@ AcpiEvOrphanEcRegMethod (
Objects[1].Type = ACPI_TYPE_INTEGER;
Objects[1].Integer.Value = ACPI_REG_CONNECT;
Status = AcpiEvaluateObject (RegMethod, NULL, &Args, NULL);
(void) AcpiEvaluateObject (RegMethod, NULL, &Args, NULL);
Exit:
/* We ignore all errors from above, don't care */
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
(void) AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
return_VOID;
}

View File

@ -255,7 +255,6 @@ AcpiEvPciConfigRegionSetup (
* root bridge. Still need to return a context object
* for the new PCI_Config operation region, however.
*/
Status = AE_OK;
}
else
{

View File

@ -84,7 +84,7 @@ static ACPI_SLEEP_FUNCTIONS AcpiSleepDispatch[] =
ACPI_HW_OPTIONAL_FUNCTION (AcpiHwLegacyWakePrep)),
ACPI_STRUCT_INIT (ExtendedFunction,
AcpiHwExtendedWakePrep) },
{ACPI_STRUCT_INIT (Legacy_function,
{ACPI_STRUCT_INIT (LegacyFunction,
ACPI_HW_OPTIONAL_FUNCTION (AcpiHwLegacyWake)),
ACPI_STRUCT_INIT (ExtendedFunction,
AcpiHwExtendedWake) }
@ -249,6 +249,10 @@ AcpiEnterSleepStateS4bios (
Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand,
(UINT32) AcpiGbl_FADT.S4BiosRequest, 8);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
do {
AcpiOsStall (ACPI_USEC_PER_MSEC);

View File

@ -284,6 +284,10 @@ void
AcpiDbGetBusInfo (
void);
ACPI_STATUS
AcpiDbDisplayFields (
UINT32 AddressSpaceId);
/*
* dbdisply - debug display commands

View File

@ -46,7 +46,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20190816
#define ACPI_CA_VERSION 0x20191213
#include "acconfig.h"
#include "actypes.h"
@ -556,7 +556,13 @@ AcpiInstallTable (
ACPI_EXTERNAL_RETURN_STATUS (
ACPI_STATUS
AcpiLoadTable (
ACPI_TABLE_HEADER *Table))
ACPI_TABLE_HEADER *Table,
UINT32 *TableIdx))
ACPI_EXTERNAL_RETURN_STATUS (
ACPI_STATUS
AcpiUnloadTable (
UINT32 TableIndex))
ACPI_EXTERNAL_RETURN_STATUS (
ACPI_STATUS

View File

@ -182,10 +182,11 @@ typedef struct acpi_pkg_info
/* AcpiUtDumpBuffer */
#define DB_BYTE_DISPLAY 1
#define DB_WORD_DISPLAY 2
#define DB_DWORD_DISPLAY 4
#define DB_QWORD_DISPLAY 8
#define DB_BYTE_DISPLAY 0x01
#define DB_WORD_DISPLAY 0x02
#define DB_DWORD_DISPLAY 0x04
#define DB_QWORD_DISPLAY 0x08
#define DB_DISPLAY_DATA_ONLY 0x10
/*

View File

@ -369,7 +369,7 @@ AcpiNsDumpOneObject (
AcpiOsPrintf (" =");
for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++)
{
AcpiOsPrintf (" %.2hhX", ObjDesc->Buffer.Pointer[i]);
AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]);
}
}
AcpiOsPrintf ("\n");
@ -466,7 +466,7 @@ AcpiNsDumpOneObject (
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2hhd\n",
AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2X\n",
(ObjDesc->CommonField.BaseByteOffset * 8)
+ ObjDesc->CommonField.StartFieldBitOffset,
ObjDesc->CommonField.BitLength,
@ -651,8 +651,6 @@ AcpiNsDumpOneObject (
goto Cleanup;
}
ObjType = ACPI_TYPE_INVALID; /* Terminate loop after next pass */
}
Cleanup:

View File

@ -504,7 +504,7 @@ AcpiGetObjectInfo (
if (Cls)
{
NextIdString = AcpiNsCopyDeviceId (&Info->ClassCode,
(void) AcpiNsCopyDeviceId (&Info->ClassCode,
Cls, NextIdString);
}

View File

@ -1082,6 +1082,10 @@ AcpiTbLoadTable (
}
Status = AcpiNsLoadTable (TableIndex, ParentNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is

View File

@ -348,6 +348,8 @@ ACPI_EXPORT_SYMBOL_INIT (AcpiInstallTable)
*
* PARAMETERS: Table - Pointer to a buffer containing the ACPI
* table to be loaded.
* TableIdx - Pointer to a UINT32 for storing the table
* index, might be NULL
*
* RETURN: Status
*
@ -361,7 +363,8 @@ ACPI_EXPORT_SYMBOL_INIT (AcpiInstallTable)
ACPI_STATUS
AcpiLoadTable (
ACPI_TABLE_HEADER *Table)
ACPI_TABLE_HEADER *Table,
UINT32 *TableIdx)
{
ACPI_STATUS Status;
UINT32 TableIndex;
@ -382,6 +385,11 @@ AcpiLoadTable (
ACPI_INFO (("Host-directed Dynamic ACPI Table Load:"));
Status = AcpiTbInstallAndLoadTable (ACPI_PTR_TO_PHYSADDR (Table),
ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, FALSE, &TableIndex);
if (TableIdx)
{
*TableIdx = TableIndex;
}
if (ACPI_SUCCESS (Status))
{
/* Complete the initialization/resolution of new objects */
@ -485,3 +493,42 @@ AcpiUnloadParentTable (
}
ACPI_EXPORT_SYMBOL (AcpiUnloadParentTable)
/*******************************************************************************
*
* FUNCTION: AcpiUnloadTable
*
* PARAMETERS: TableIndex - Index as returned by AcpiLoadTable
*
* RETURN: Status
*
* DESCRIPTION: Via the TableIndex representing an SSDT or OEMx table, unloads
* the table and deletes all namespace objects associated with
* that table. Unloading of the DSDT is not allowed.
* Note: Mainly intended to support hotplug removal of SSDTs.
*
******************************************************************************/
ACPI_STATUS
AcpiUnloadTable (
UINT32 TableIndex)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (AcpiUnloadTable);
if (TableIndex == 1)
{
/* TableIndex==1 means DSDT is the owner. DSDT cannot be unloaded */
return_ACPI_STATUS (AE_TYPE);
}
Status = AcpiTbUnloadTable (TableIndex);
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiUnloadTable)

View File

@ -756,7 +756,7 @@ AcpiUtDumpAllocations (
case ACPI_DESC_TYPE_PARSER:
AcpiOsPrintf ("AmlOpcode 0x%04hX\n",
AcpiOsPrintf ("AmlOpcode 0x%04X\n",
Descriptor->Op.Asl.AmlOpcode);
break;