diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2015-06-16 19:48:16 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2015-06-16 19:48:16 +0000 |
commit | 8811b910b092027f905013bced1da3e87c6b07b9 (patch) | |
tree | b0c56a23f2d8877b9431deb3cab73df3c1913fb7 /source/components | |
parent | 0c85196b0c51b4e5eba8fcace026f947f9112c9e (diff) | |
download | src-test2-8811b910b092027f905013bced1da3e87c6b07b9.tar.gz src-test2-8811b910b092027f905013bced1da3e87c6b07b9.zip |
Notes
Diffstat (limited to 'source/components')
74 files changed, 752 insertions, 357 deletions
diff --git a/source/components/debugger/dbcmds.c b/source/components/debugger/dbcmds.c index 83167734039b..4a2c4e850107 100644 --- a/source/components/debugger/dbcmds.c +++ b/source/components/debugger/dbcmds.c @@ -111,7 +111,7 @@ AcpiDbConvertToNode ( { /* Numeric argument, convert */ - Address = ACPI_STRTOUL (InString, NULL, 16); + Address = strtoul (InString, NULL, 16); Node = ACPI_TO_POINTER (Address); if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) { @@ -189,7 +189,7 @@ AcpiDbSleep ( /* Convert argument to binary and invoke the sleep state */ - SleepState = (UINT8) ACPI_STRTOUL (ObjectArg, NULL, 0); + SleepState = (UINT8) strtoul (ObjectArg, NULL, 0); AcpiDbDoOneSleepState (SleepState); return_ACPI_STATUS (AE_OK); } @@ -561,7 +561,7 @@ AcpiDbDisplayInterfaces ( /* Install - install an interface */ - SubString = ACPI_STRSTR ("INSTALL", ActionArg); + SubString = strstr ("INSTALL", ActionArg); if (SubString) { Status = AcpiInstallInterface (InterfaceNameArg); @@ -575,7 +575,7 @@ AcpiDbDisplayInterfaces ( /* Remove - remove an interface */ - SubString = ACPI_STRSTR ("REMOVE", ActionArg); + SubString = strstr ("REMOVE", ActionArg); if (SubString) { Status = AcpiRemoveInterface (InterfaceNameArg); @@ -736,7 +736,7 @@ AcpiDmCompareAmlResources ( /* Check for descriptor byte match */ - else if (ACPI_MEMCMP (Aml1, Aml2, Aml1Length)) + else if (memcmp (Aml1, Aml2, Aml1Length)) { AcpiOsPrintf ( "**** Data mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X ****\n", @@ -1138,7 +1138,7 @@ AcpiDbDisplayResources ( /* Asterisk means "display resources for all devices" */ - if (!ObjectArg || (!ACPI_STRCMP (ObjectArg, "*"))) + if (!ObjectArg || (!strcmp (ObjectArg, "*"))) { (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, AcpiDbDeviceResources, NULL, NULL, NULL); @@ -1191,7 +1191,7 @@ AcpiDbGenerateGpe ( ACPI_GPE_EVENT_INFO *GpeEventInfo; - GpeNumber = ACPI_STRTOUL (GpeArg, NULL, 0); + GpeNumber = strtoul (GpeArg, NULL, 0); /* * If no block arg, or block arg == 0 or 1, use the FADT-defined @@ -1199,7 +1199,7 @@ AcpiDbGenerateGpe ( */ if (BlockArg) { - BlockNumber = ACPI_STRTOUL (BlockArg, NULL, 0); + BlockNumber = strtoul (BlockArg, NULL, 0); if (BlockNumber == 1) { BlockNumber = 0; diff --git a/source/components/debugger/dbconvert.c b/source/components/debugger/dbconvert.c index 2a517d2c7a9e..4c7b4ba4a717 100644 --- a/source/components/debugger/dbconvert.c +++ b/source/components/debugger/dbconvert.c @@ -77,7 +77,7 @@ AcpiDbHexCharToValue ( /* Digit must be ascii [0-9a-fA-F] */ - if (!ACPI_IS_XDIGIT (HexChar)) + if (!isxdigit (HexChar)) { return (AE_BAD_HEX_CONSTANT); } @@ -88,7 +88,7 @@ AcpiDbHexCharToValue ( } else { - Value = (UINT8) (ACPI_TOUPPER (HexChar) - 0x37); + Value = (UINT8) (toupper (HexChar) - 0x37); } *ReturnValue = Value; @@ -306,7 +306,7 @@ AcpiDbConvertToObject ( Object->Type = ACPI_TYPE_STRING; Object->String.Pointer = String; - Object->String.Length = (UINT32) ACPI_STRLEN (String); + Object->String.Length = (UINT32) strlen (String); break; case ACPI_TYPE_BUFFER: @@ -471,7 +471,7 @@ AcpiDbDumpPldBuffer ( /* The two bit-packed buffers should match */ - if (ACPI_MEMCMP (NewBuffer, BufferDesc->Buffer.Pointer, + if (memcmp (NewBuffer, BufferDesc->Buffer.Pointer, BufferDesc->Buffer.Length)) { AcpiOsPrintf ("Converted _PLD buffer does not compare. New:\n"); diff --git a/source/components/debugger/dbdisply.c b/source/components/debugger/dbdisply.c index ac8beebf8324..aedc8bfb8258 100644 --- a/source/components/debugger/dbdisply.c +++ b/source/components/debugger/dbdisply.c @@ -141,7 +141,7 @@ AcpiDbGetPointer ( ACPI_SIZE Address; - Address = ACPI_STRTOUL (Target, NULL, 16); + Address = strtoul (Target, NULL, 16); ObjPtr = ACPI_TO_POINTER (Address); return (ObjPtr); } diff --git a/source/components/debugger/dbexec.c b/source/components/debugger/dbexec.c index 1cf87603512b..433cc55c3b73 100644 --- a/source/components/debugger/dbexec.c +++ b/source/components/debugger/dbexec.c @@ -433,15 +433,15 @@ AcpiDbExecute ( } else { - NameString = ACPI_ALLOCATE (ACPI_STRLEN (Name) + 1); + NameString = ACPI_ALLOCATE (strlen (Name) + 1); if (!NameString) { return; } - ACPI_MEMSET (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); + memset (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); - ACPI_STRCPY (NameString, Name); + strcpy (NameString, Name); AcpiUtStrupr (NameString); AcpiGbl_DbMethodInfo.Name = NameString; AcpiGbl_DbMethodInfo.Args = Args; @@ -669,8 +669,8 @@ AcpiDbCreateExecutionThreads ( /* Get the arguments */ - NumThreads = ACPI_STRTOUL (NumThreadsArg, NULL, 0); - NumLoops = ACPI_STRTOUL (NumLoopsArg, NULL, 0); + NumThreads = strtoul (NumThreadsArg, NULL, 0); + NumLoops = strtoul (NumLoopsArg, NULL, 0); if (!NumThreads || !NumLoops) { @@ -714,7 +714,7 @@ AcpiDbCreateExecutionThreads ( return; } - ACPI_MEMSET (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); + memset (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); /* Array to store IDs of threads */ @@ -729,7 +729,7 @@ AcpiDbCreateExecutionThreads ( (void) AcpiOsDeleteSemaphore (InfoGate); return; } - ACPI_MEMSET (AcpiGbl_DbMethodInfo.Threads, 0, Size); + memset (AcpiGbl_DbMethodInfo.Threads, 0, Size); /* Setup the context to be passed to each thread */ diff --git a/source/components/debugger/dbfileio.c b/source/components/debugger/dbfileio.c index f9d7635ecd0c..5d526207a5cb 100644 --- a/source/components/debugger/dbfileio.c +++ b/source/components/debugger/dbfileio.c @@ -112,7 +112,7 @@ AcpiDbOpenDebugFile ( } AcpiOsPrintf ("Debug output file %s opened\n", Name); - ACPI_STRNCPY (AcpiGbl_DbDebugFilename, Name, + strncpy (AcpiGbl_DbDebugFilename, Name, sizeof (AcpiGbl_DbDebugFilename)); AcpiGbl_DbOutputToFile = TRUE; diff --git a/source/components/debugger/dbhistry.c b/source/components/debugger/dbhistry.c index 70bca4286de9..bc29d3b09ebc 100644 --- a/source/components/debugger/dbhistry.c +++ b/source/components/debugger/dbhistry.c @@ -92,7 +92,7 @@ AcpiDbAddToHistory ( /* Put command into the next available slot */ - CmdLen = (UINT16) ACPI_STRLEN (CommandLine); + CmdLen = (UINT16) strlen (CommandLine); if (!CmdLen) { return; @@ -100,7 +100,7 @@ AcpiDbAddToHistory ( if (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command != NULL) { - BufferLen = (UINT16) ACPI_STRLEN ( + BufferLen = (UINT16) strlen ( AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command); if (CmdLen > BufferLen) { @@ -116,7 +116,7 @@ AcpiDbAddToHistory ( AcpiOsAllocate (CmdLen + 1); } - ACPI_STRCPY (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command, + strcpy (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command, CommandLine); AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].CmdNum = @@ -217,7 +217,7 @@ AcpiDbGetFromHistory ( else { - CmdNum = ACPI_STRTOUL (CommandNumArg, NULL, 0); + CmdNum = strtoul (CommandNumArg, NULL, 0); } return (AcpiDbGetHistoryByIndex (CmdNum)); diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c index 80fd3e602b78..76d2455dc1ae 100644 --- a/source/components/debugger/dbinput.c +++ b/source/components/debugger/dbinput.c @@ -361,7 +361,7 @@ AcpiDbMatchCommandHelp ( while ((*Command) && (*Invocation) && (*Invocation != ' ')) { - if (ACPI_TOLOWER (*Command) != ACPI_TOLOWER (*Invocation)) + if (tolower (*Command) != tolower (*Invocation)) { return (FALSE); } @@ -702,7 +702,7 @@ AcpiDbMatchCommand ( for (i = CMD_FIRST_VALID; AcpiGbl_DbCommands[i].Name; i++) { - if (ACPI_STRSTR (AcpiGbl_DbCommands[i].Name, UserCommand) == + if (strstr (AcpiGbl_DbCommands[i].Name, UserCommand) == AcpiGbl_DbCommands[i].Name) { return (i); @@ -946,7 +946,7 @@ AcpiDbCommandDispatch ( else if (ParamCount == 2) { Temp = AcpiGbl_DbConsoleDebugLevel; - AcpiGbl_DbConsoleDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], + AcpiGbl_DbConsoleDebugLevel = strtoul (AcpiGbl_DbArgs[1], NULL, 16); AcpiOsPrintf ( "Debug Level for console output was %8.8lX, now %8.8lX\n", @@ -955,7 +955,7 @@ AcpiDbCommandDispatch ( else { Temp = AcpiGbl_DbDebugLevel; - AcpiGbl_DbDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16); + AcpiGbl_DbDebugLevel = strtoul (AcpiGbl_DbArgs[1], NULL, 16); AcpiOsPrintf ( "Debug Level for file output was %8.8lX, now %8.8lX\n", Temp, AcpiGbl_DbDebugLevel); @@ -994,7 +994,7 @@ AcpiDbCommandDispatch ( case CMD_NOTIFY: - Temp = ACPI_STRTOUL (AcpiGbl_DbArgs[2], NULL, 0); + Temp = strtoul (AcpiGbl_DbArgs[2], NULL, 0); AcpiDbSendNotify (AcpiGbl_DbArgs[1], Temp); break; diff --git a/source/components/debugger/dbmethod.c b/source/components/debugger/dbmethod.c index c658d6ade87a..2b03d359f3c7 100644 --- a/source/components/debugger/dbmethod.c +++ b/source/components/debugger/dbmethod.c @@ -89,7 +89,7 @@ AcpiDbSetMethodBreakpoint ( /* Get and verify the breakpoint address */ - Address = ACPI_STRTOUL (Location, NULL, 16); + Address = strtoul (Location, NULL, 16); if (Address <= Op->Common.AmlOffset) { AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n", @@ -174,7 +174,7 @@ AcpiDbSetMethodData ( return; } - Value = ACPI_STRTOUL (ValueArg, NULL, 16); + Value = strtoul (ValueArg, NULL, 16); if (Type == 'N') { @@ -196,7 +196,7 @@ AcpiDbSetMethodData ( /* Get the index and value */ - Index = ACPI_STRTOUL (IndexArg, NULL, 16); + Index = strtoul (IndexArg, NULL, 16); WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); if (!WalkState) @@ -304,7 +304,7 @@ AcpiDbDisassembleAml ( if (Statements) { - NumStatements = ACPI_STRTOUL (Statements, NULL, 0); + NumStatements = strtoul (Statements, NULL, 0); } AcpiDmDisassemble (NULL, Op, NumStatements); diff --git a/source/components/debugger/dbnames.c b/source/components/debugger/dbnames.c index 48aaeb0a5587..0b56f076bf7f 100644 --- a/source/components/debugger/dbnames.c +++ b/source/components/debugger/dbnames.c @@ -248,7 +248,7 @@ AcpiDbDumpNamespace ( if (DepthArg) { - MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0); + MaxDepth = strtoul (DepthArg, NULL, 0); } } @@ -319,13 +319,13 @@ AcpiDbDumpNamespaceByOwner ( ACPI_OWNER_ID OwnerId; - OwnerId = (ACPI_OWNER_ID) ACPI_STRTOUL (OwnerArg, NULL, 0); + OwnerId = (ACPI_OWNER_ID) strtoul (OwnerArg, NULL, 0); /* Now we can check for the depth argument */ if (DepthArg) { - MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0); + MaxDepth = strtoul (DepthArg, NULL, 0); } AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); @@ -426,7 +426,7 @@ AcpiDbFindNameInNamespace ( char *AcpiNamePtr = AcpiName; - if (ACPI_STRLEN (NameArg) > 4) + if (strlen (NameArg) > 4) { AcpiOsPrintf ("Name must be no longer than 4 characters\n"); return (AE_OK); @@ -830,7 +830,7 @@ AcpiDbFindReferences ( /* Convert string to object pointer */ - Address = ACPI_STRTOUL (ObjectArg, NULL, 16); + Address = strtoul (ObjectArg, NULL, 16); ObjDesc = ACPI_TO_POINTER (Address); /* Search all nodes in namespace */ diff --git a/source/components/debugger/dbtest.c b/source/components/debugger/dbtest.c index 72a4499ed747..8d68f535863d 100644 --- a/source/components/debugger/dbtest.c +++ b/source/components/debugger/dbtest.c @@ -646,7 +646,7 @@ AcpiDbTestBufferType ( * count is not an integral number of bytes. Zero out the * unused bits. */ - ACPI_MEMSET (Buffer, BUFFER_FILL_VALUE, ByteLength); + memset (Buffer, BUFFER_FILL_VALUE, ByteLength); ExtraBits = BitLength % 8; if (ExtraBits) { @@ -671,7 +671,7 @@ AcpiDbTestBufferType ( goto Exit; } - if (ACPI_MEMCMP (Temp2->Buffer.Pointer, Buffer, ByteLength)) + if (memcmp (Temp2->Buffer.Pointer, Buffer, ByteLength)) { AcpiOsPrintf (" MISMATCH 2: New buffer value"); } @@ -695,7 +695,7 @@ AcpiDbTestBufferType ( goto Exit; } - if (ACPI_MEMCMP (Temp1->Buffer.Pointer, Temp3->Buffer.Pointer, ByteLength)) + if (memcmp (Temp1->Buffer.Pointer, Temp3->Buffer.Pointer, ByteLength)) { AcpiOsPrintf (" MISMATCH 3: While restoring original buffer"); } @@ -751,7 +751,7 @@ AcpiDbTestStringType ( /* Write a new value */ WriteValue.Type = ACPI_TYPE_STRING; - WriteValue.String.Length = ACPI_STRLEN (ValueToWrite); + WriteValue.String.Length = strlen (ValueToWrite); WriteValue.String.Pointer = ValueToWrite; Status = AcpiDbWriteToObject (Node, &WriteValue); @@ -768,7 +768,7 @@ AcpiDbTestStringType ( goto Exit; } - if (ACPI_STRCMP (Temp2->String.Pointer, ValueToWrite)) + if (strcmp (Temp2->String.Pointer, ValueToWrite)) { AcpiOsPrintf (" MISMATCH 2: %s, expecting %s", Temp2->String.Pointer, ValueToWrite); @@ -776,7 +776,7 @@ AcpiDbTestStringType ( /* Write back the original value */ - WriteValue.String.Length = ACPI_STRLEN (Temp1->String.Pointer); + WriteValue.String.Length = strlen (Temp1->String.Pointer); WriteValue.String.Pointer = Temp1->String.Pointer; Status = AcpiDbWriteToObject (Node, &WriteValue); @@ -793,7 +793,7 @@ AcpiDbTestStringType ( goto Exit; } - if (ACPI_STRCMP (Temp1->String.Pointer, Temp3->String.Pointer)) + if (strcmp (Temp1->String.Pointer, Temp3->String.Pointer)) { AcpiOsPrintf (" MISMATCH 3: %s, expecting %s", Temp3->String.Pointer, Temp1->String.Pointer); @@ -926,7 +926,7 @@ AcpiDbWriteToObject ( /* Copy the incoming user parameter */ - ACPI_MEMCPY (&Params[1], Value, sizeof (ACPI_OBJECT)); + memcpy (&Params[1], Value, sizeof (ACPI_OBJECT)); ParamObjects.Count = 2; ParamObjects.Pointer = Params; @@ -970,7 +970,7 @@ AcpiDbEvaluateAllPredefinedNames ( if (CountArg) { - Info.MaxCount = ACPI_STRTOUL (CountArg, NULL, 0); + Info.MaxCount = strtoul (CountArg, NULL, 0); } /* Search all nodes in namespace */ @@ -1077,7 +1077,7 @@ AcpiDbEvaluateOnePredefinedName ( case ACPI_TYPE_STRING: ThisParam->String.Pointer = "This is the default argument string"; - ThisParam->String.Length = ACPI_STRLEN (ThisParam->String.Pointer); + ThisParam->String.Length = strlen (ThisParam->String.Pointer); break; case ACPI_TYPE_BUFFER: diff --git a/source/components/debugger/dbutils.c b/source/components/debugger/dbutils.c index 1b337527897b..a089344e2297 100644 --- a/source/components/debugger/dbutils.c +++ b/source/components/debugger/dbutils.c @@ -96,7 +96,7 @@ AcpiDbMatchArgument ( for (i = 0; Arguments[i].Name; i++) { - if (ACPI_STRSTR (Arguments[i].Name, UserArgument) == Arguments[i].Name) + if (strstr (Arguments[i].Name, UserArgument) == Arguments[i].Name) { return (i); } @@ -375,7 +375,7 @@ AcpiDbUint32ToHexString ( if (Value == 0) { - ACPI_STRCPY (Buffer, "0"); + strcpy (Buffer, "0"); return; } diff --git a/source/components/debugger/dbxface.c b/source/components/debugger/dbxface.c index 04b69adf97a2..33d5e363b649 100644 --- a/source/components/debugger/dbxface.c +++ b/source/components/debugger/dbxface.c @@ -431,7 +431,7 @@ AcpiDbInitialize ( { return_ACPI_STATUS (AE_NO_MEMORY); } - ACPI_MEMSET (AcpiGbl_DbBuffer, 0, ACPI_DEBUG_BUFFER_SIZE); + memset (AcpiGbl_DbBuffer, 0, ACPI_DEBUG_BUFFER_SIZE); /* Initial scope is the root */ diff --git a/source/components/disassembler/dmbuffer.c b/source/components/disassembler/dmbuffer.c index 8cd06a4b9a64..2291bb2c8d22 100644 --- a/source/components/disassembler/dmbuffer.c +++ b/source/components/disassembler/dmbuffer.c @@ -205,7 +205,7 @@ AcpiDmDisasmByteList ( } BufChar = ByteData[CurrentIndex]; - if (ACPI_IS_PRINT (BufChar)) + if (isprint (BufChar)) { AcpiOsPrintf ("%c", BufChar); } @@ -554,7 +554,7 @@ AcpiDmIsStringBuffer ( * they will be handled in the string output routine */ - if (!ACPI_IS_PRINT (ByteData[i])) + if (!isprint (ByteData[i])) { return (FALSE); } @@ -836,7 +836,7 @@ AcpiDmUnicode ( { AcpiOsPrintf ("\\%c", OutputValue); } - else if (!ACPI_IS_PRINT (OutputValue)) + else if (!isprint (OutputValue)) { AcpiOsPrintf ("\\x%2.2X", OutputValue); } @@ -902,7 +902,7 @@ AcpiDmGetHardwareIdType ( for (i = 0; i < 3; i++) { if (!ACPI_IS_ASCII (Prefix[i]) || - !ACPI_IS_ALPHA (Prefix[i])) + !isalpha (Prefix[i])) { return; } diff --git a/source/components/disassembler/dmcstyle.c b/source/components/disassembler/dmcstyle.c index 1f1381969f57..a6ec689e157e 100644 --- a/source/components/disassembler/dmcstyle.c +++ b/source/components/disassembler/dmcstyle.c @@ -337,23 +337,70 @@ AcpiDmCheckForSymbolicOpcode ( */ AcpiDmPromoteTarget (Op, Target); - /* - * Check for possible conversion to a "Compound Assignment". - * - * Determine if either operand is the same as the target - * and display compound assignment operator and other operand. - */ - if ((AcpiDmIsTargetAnOperand (Target, Child1, TRUE)) || - (AcpiDmIsTargetAnOperand (Target, Child2, TRUE))) + /* Check operands for conversion to a "Compound Assignment" */ + + switch (Op->Common.AmlOpcode) { - Target->Common.OperatorSymbol = - AcpiDmGetCompoundSymbol (Op->Common.AmlOpcode); + /* Commutative operators */ + + case AML_ADD_OP: + case AML_MULTIPLY_OP: + case AML_BIT_AND_OP: + case AML_BIT_OR_OP: + case AML_BIT_XOR_OP: + /* + * For the commutative operators, we can convert to a + * compound statement only if at least one (either) operand + * is the same as the target. + * + * Add (A, B, A) --> A += B + * Add (B, A, A) --> A += B + * Add (B, C, A) --> A = (B + C) + */ + if ((AcpiDmIsTargetAnOperand (Target, Child1, TRUE)) || + (AcpiDmIsTargetAnOperand (Target, Child2, TRUE))) + { + Target->Common.OperatorSymbol = + AcpiDmGetCompoundSymbol (Op->Common.AmlOpcode); - /* Convert operator to compound assignment */ + /* Convert operator to compound assignment */ - Op->Common.DisasmFlags |= ACPI_PARSEOP_COMPOUND; - Child1->Common.OperatorSymbol = NULL; - return (TRUE); + Op->Common.DisasmFlags |= ACPI_PARSEOP_COMPOUND; + Child1->Common.OperatorSymbol = NULL; + return (TRUE); + } + break; + + /* Non-commutative operators */ + + case AML_SUBTRACT_OP: + case AML_DIVIDE_OP: + case AML_MOD_OP: + case AML_SHIFT_LEFT_OP: + case AML_SHIFT_RIGHT_OP: + /* + * For the non-commutative operators, we can convert to a + * compound statement only if the target is the same as the + * first operand. + * + * Subtract (A, B, A) --> A -= B + * Subtract (B, A, A) --> A = (B - A) + */ + if ((AcpiDmIsTargetAnOperand (Target, Child1, TRUE))) + { + Target->Common.OperatorSymbol = + AcpiDmGetCompoundSymbol (Op->Common.AmlOpcode); + + /* Convert operator to compound assignment */ + + Op->Common.DisasmFlags |= ACPI_PARSEOP_COMPOUND; + Child1->Common.OperatorSymbol = NULL; + return (TRUE); + } + break; + + default: + break; } /* @@ -423,8 +470,12 @@ AcpiDmCheckForSymbolicOpcode ( * source so that the target is processed first. */ Target = Child1->Common.Next; - AcpiDmPromoteTarget (Op, Target); + if (!Target) + { + return (FALSE); + } + AcpiDmPromoteTarget (Op, Target); if (!Target->Common.OperatorSymbol) { Target->Common.OperatorSymbol = " = "; @@ -674,7 +725,8 @@ AcpiDmPromoteTarget ( * * DESCRIPTION: Determine if a Target Op is a placeholder Op or a real Target. * In other words, determine if the optional target is used or - * not. + * not. Note: If Target is NULL, something is seriously wrong, + * probably with the parse tree. * ******************************************************************************/ @@ -683,6 +735,11 @@ AcpiDmIsValidTarget ( ACPI_PARSE_OBJECT *Target) { + if (!Target) + { + return (FALSE); + } + if ((Target->Common.AmlOpcode == AML_INT_NAMEPATH_OP) && (Target->Common.Value.Arg == NULL)) { diff --git a/source/components/disassembler/dmopcode.c b/source/components/disassembler/dmopcode.c index d8ab1d51c758..a312582e595e 100644 --- a/source/components/disassembler/dmopcode.c +++ b/source/components/disassembler/dmopcode.c @@ -269,10 +269,10 @@ AcpiDmPredefinedDescription ( * Note: NameString is guaranteed to be upper case here. */ LastCharIsDigit = - (ACPI_IS_DIGIT (NameString[3])); /* d */ + (isdigit (NameString[3])); /* d */ LastCharsAreHex = - (ACPI_IS_XDIGIT (NameString[2]) && /* xx */ - ACPI_IS_XDIGIT (NameString[3])); + (isxdigit (NameString[2]) && /* xx */ + isxdigit (NameString[3])); switch (NameString[1]) { diff --git a/source/components/dispatcher/dsfield.c b/source/components/dispatcher/dsfield.c index 83100be4497e..69437de24982 100644 --- a/source/components/dispatcher/dsfield.c +++ b/source/components/dispatcher/dsfield.c @@ -530,7 +530,7 @@ AcpiDsCreateField ( } } - ACPI_MEMSET (&Info, 0, sizeof (ACPI_CREATE_FIELD_INFO)); + memset (&Info, 0, sizeof (ACPI_CREATE_FIELD_INFO)); /* Second arg is the field flags */ diff --git a/source/components/dispatcher/dsinit.c b/source/components/dispatcher/dsinit.c index 8957eff40572..aabd30b29448 100644 --- a/source/components/dispatcher/dsinit.c +++ b/source/components/dispatcher/dsinit.c @@ -224,7 +224,7 @@ AcpiDsInitializeObjects ( /* Set all init info to zero */ - ACPI_MEMSET (&Info, 0, sizeof (ACPI_INIT_WALK_INFO)); + memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO)); Info.OwnerId = OwnerId; Info.TableIndex = TableIndex; diff --git a/source/components/dispatcher/dsobject.c b/source/components/dispatcher/dsobject.c index 54899d7406a2..cdc84314c914 100644 --- a/source/components/dispatcher/dsobject.c +++ b/source/components/dispatcher/dsobject.c @@ -348,7 +348,7 @@ AcpiDsBuildInternalBufferObj ( if (ByteList) { - ACPI_MEMCPY (ObjDesc->Buffer.Pointer, ByteList->Named.Data, + memcpy (ObjDesc->Buffer.Pointer, ByteList->Named.Data, ByteListLength); } } @@ -775,7 +775,7 @@ AcpiDsInitObjectFromOp ( case ACPI_TYPE_STRING: ObjDesc->String.Pointer = Op->Common.Value.String; - ObjDesc->String.Length = (UINT32) ACPI_STRLEN (Op->Common.Value.String); + ObjDesc->String.Length = (UINT32) strlen (Op->Common.Value.String); /* * The string is contained in the ACPI table, don't ever try diff --git a/source/components/dispatcher/dsutils.c b/source/components/dispatcher/dsutils.c index fadc7c5cebf9..15c54fb21489 100644 --- a/source/components/dispatcher/dsutils.c +++ b/source/components/dispatcher/dsutils.c @@ -605,7 +605,7 @@ AcpiDsCreateOperand ( ObjDesc = AcpiUtCreateStringObject ((ACPI_SIZE) NameLength); - ACPI_STRNCPY (ObjDesc->String.Pointer, NameString, NameLength); + strncpy (ObjDesc->String.Pointer, NameString, NameLength); Status = AE_OK; } else diff --git a/source/components/dispatcher/dswload.c b/source/components/dispatcher/dswload.c index ab2d80d7dcae..37b7b39cbccc 100644 --- a/source/components/dispatcher/dswload.c +++ b/source/components/dispatcher/dswload.c @@ -325,9 +325,18 @@ AcpiDsLoad1BeginOp ( if ((WalkState->Opcode != AML_SCOPE_OP) && (!(WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP))) { - Flags |= ACPI_NS_ERROR_IF_FOUND; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n", - AcpiUtGetTypeName (ObjectType))); + if (WalkState->NamespaceOverride) + { + Flags |= ACPI_NS_OVERRIDE_IF_FOUND; + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Override allowed\n", + AcpiUtGetTypeName (ObjectType))); + } + else + { + Flags |= ACPI_NS_ERROR_IF_FOUND; + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n", + AcpiUtGetTypeName (ObjectType))); + } } else { diff --git a/source/components/events/evgpe.c b/source/components/events/evgpe.c index 4e635ce77e2b..2ce57f9d460c 100644 --- a/source/components/events/evgpe.c +++ b/source/components/events/evgpe.c @@ -104,6 +104,7 @@ AcpiEvUpdateGpeEnableMask ( { ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, (UINT8) RegisterBit); } + GpeRegisterInfo->EnableMask = GpeRegisterInfo->EnableForRun; return_ACPI_STATUS (AE_OK); } @@ -141,7 +142,7 @@ AcpiEvEnableGpe ( /* Enable the requested GPE */ - Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE_SAVE); + Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE); return_ACPI_STATUS (Status); } @@ -231,7 +232,7 @@ AcpiEvRemoveGpeReference ( Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo); if (ACPI_SUCCESS (Status)) { - Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE_SAVE); + Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); } if (ACPI_FAILURE (Status)) diff --git a/source/components/events/evgpeinit.c b/source/components/events/evgpeinit.c index 1943d23ea431..d23a345263d4 100644 --- a/source/components/events/evgpeinit.c +++ b/source/components/events/evgpeinit.c @@ -395,7 +395,7 @@ AcpiEvMatchGpeMethod ( /* 4) The last two characters of the name are the hex GPE Number */ - GpeNumber = ACPI_STRTOUL (&Name[2], NULL, 16); + GpeNumber = strtoul (&Name[2], NULL, 16); if (GpeNumber == ACPI_UINT32_MAX) { /* Conversion failed; invalid method, just ignore it */ diff --git a/source/components/executer/exconfig.c b/source/components/executer/exconfig.c index aa233b7eae4f..85389dde258b 100644 --- a/source/components/executer/exconfig.c +++ b/source/components/executer/exconfig.c @@ -515,7 +515,7 @@ AcpiExLoadOp ( return_ACPI_STATUS (AE_NO_MEMORY); } - ACPI_MEMCPY (Table, TableHeader, Length); + memcpy (Table, TableHeader, Length); break; default: diff --git a/source/components/executer/exconvrt.c b/source/components/executer/exconvrt.c index e0ef65357b45..b8f032c6774e 100644 --- a/source/components/executer/exconvrt.c +++ b/source/components/executer/exconvrt.c @@ -251,7 +251,7 @@ AcpiExConvertToBuffer ( /* Copy the integer to the buffer, LSB first */ NewBuf = ReturnDesc->Buffer.Pointer; - ACPI_MEMCPY (NewBuf, + memcpy (NewBuf, &ObjDesc->Integer.Value, AcpiGbl_IntegerByteWidth); break; @@ -276,7 +276,7 @@ AcpiExConvertToBuffer ( /* Copy the string to the buffer */ NewBuf = ReturnDesc->Buffer.Pointer; - ACPI_STRNCPY ((char *) NewBuf, (char *) ObjDesc->String.Pointer, + strncpy ((char *) NewBuf, (char *) ObjDesc->String.Pointer, ObjDesc->String.Length); break; diff --git a/source/components/executer/exdebug.c b/source/components/executer/exdebug.c index dd41f9334fa1..6ca866c01b04 100644 --- a/source/components/executer/exdebug.c +++ b/source/components/executer/exdebug.c @@ -81,6 +81,8 @@ AcpiExDoDebugObject ( { UINT32 i; UINT32 Timer; + ACPI_OPERAND_OBJECT *ObjectDesc; + UINT32 Value; ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc); @@ -267,8 +269,37 @@ AcpiExDoDebugObject ( } else { - AcpiExDoDebugObject (SourceDesc->Reference.Object, - Level+4, 0); + ObjectDesc = SourceDesc->Reference.Object; + Value = SourceDesc->Reference.Value; + + switch (ObjectDesc->Common.Type) + { + case ACPI_TYPE_BUFFER: + + AcpiOsPrintf ("Buffer[%u] = 0x%2.2X\n", + Value, *SourceDesc->Reference.IndexPointer); + break; + + case ACPI_TYPE_STRING: + + AcpiOsPrintf ("String[%u] = \"%c\" (0x%2.2X)\n", + Value, *SourceDesc->Reference.IndexPointer, + *SourceDesc->Reference.IndexPointer); + break; + + case ACPI_TYPE_PACKAGE: + + AcpiOsPrintf ("Package[%u] = ", Value); + AcpiExDoDebugObject (*SourceDesc->Reference.Where, + Level+4, 0); + break; + + default: + + AcpiOsPrintf ("Unknown Reference object type %X\n", + ObjectDesc->Common.Type); + break; + } } } break; diff --git a/source/components/executer/exdump.c b/source/components/executer/exdump.c index c76a1a4de36d..299a1a0928ed 100644 --- a/source/components/executer/exdump.c +++ b/source/components/executer/exdump.c @@ -238,7 +238,7 @@ static ACPI_EXDUMP_INFO AcpiExDumpIndexField[5] = {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.DataObj), "Data Object"} }; -static ACPI_EXDUMP_INFO AcpiExDumpReference[8] = +static ACPI_EXDUMP_INFO AcpiExDumpReference[9] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpReference), NULL}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.Class), "Class"}, @@ -247,6 +247,7 @@ static ACPI_EXDUMP_INFO AcpiExDumpReference[8] = {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Object), "Object Desc"}, {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Reference.Node), "Node"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Where), "Where"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.IndexPointer), "Index Pointer"}, {ACPI_EXD_REFERENCE,0, NULL} }; @@ -1053,16 +1054,18 @@ AcpiExDumpReferenceObj ( { if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) { - AcpiOsPrintf (" Target: %p", ObjDesc->Reference.Object); + AcpiOsPrintf ("%22s %p", "Target :", + ObjDesc->Reference.Object); if (ObjDesc->Reference.Class == ACPI_REFCLASS_TABLE) { - AcpiOsPrintf (" Table Index: %X\n", ObjDesc->Reference.Value); + AcpiOsPrintf (" Table Index: %X\n", + ObjDesc->Reference.Value); } else { - AcpiOsPrintf (" Target: %p [%s]\n", ObjDesc->Reference.Object, + AcpiOsPrintf (" [%s]\n", AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) - ObjDesc->Reference.Object)->Common.Type)); + ObjDesc->Reference.Object)->Common.Type)); } } else diff --git a/source/components/executer/exfield.c b/source/components/executer/exfield.c index 9407fa78976d..d0ebcf04cadb 100644 --- a/source/components/executer/exfield.c +++ b/source/components/executer/exfield.c @@ -460,7 +460,7 @@ AcpiExWriteDataToField ( } Buffer = BufferDesc->Buffer.Pointer; - ACPI_MEMCPY (Buffer, SourceDesc->Buffer.Pointer, Length); + memcpy (Buffer, SourceDesc->Buffer.Pointer, Length); /* Lock entire transaction if requested */ diff --git a/source/components/executer/exfldio.c b/source/components/executer/exfldio.c index 7e81d42b4b82..5c95223b2c64 100644 --- a/source/components/executer/exfldio.c +++ b/source/components/executer/exfldio.c @@ -456,7 +456,7 @@ AcpiExFieldDatumIo ( * Copy the data from the source buffer. * Length is the field width in bytes. */ - ACPI_MEMCPY (Value, + memcpy (Value, (ObjDesc->BufferField.BufferObj)->Buffer.Pointer + ObjDesc->BufferField.BaseByteOffset + FieldDatumByteOffset, @@ -468,7 +468,7 @@ AcpiExFieldDatumIo ( * Copy the data to the target buffer. * Length is the field width in bytes. */ - ACPI_MEMCPY ((ObjDesc->BufferField.BufferObj)->Buffer.Pointer + + memcpy ((ObjDesc->BufferField.BufferObj)->Buffer.Pointer + ObjDesc->BufferField.BaseByteOffset + FieldDatumByteOffset, Value, ObjDesc->CommonField.AccessByteWidth); @@ -748,7 +748,7 @@ AcpiExExtractFromField ( return_ACPI_STATUS (AE_BUFFER_OVERFLOW); } - ACPI_MEMSET (Buffer, 0, BufferLength); + memset (Buffer, 0, BufferLength); AccessBitWidth = ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth); /* Handle the simple case here */ @@ -765,7 +765,7 @@ AcpiExExtractFromField ( /* Use RawDatum (UINT64) to handle buffers < 64 bits */ Status = AcpiExFieldDatumIo (ObjDesc, 0, &RawDatum, ACPI_READ); - ACPI_MEMCPY (Buffer, &RawDatum, BufferLength); + memcpy (Buffer, &RawDatum, BufferLength); } return_ACPI_STATUS (Status); @@ -835,7 +835,7 @@ AcpiExExtractFromField ( /* Write merged datum to target buffer */ - ACPI_MEMCPY (((char *) Buffer) + BufferOffset, &MergedDatum, + memcpy (((char *) Buffer) + BufferOffset, &MergedDatum, ACPI_MIN(ObjDesc->CommonField.AccessByteWidth, BufferLength - BufferOffset)); @@ -853,7 +853,7 @@ AcpiExExtractFromField ( /* Write the last datum to the buffer */ - ACPI_MEMCPY (((char *) Buffer) + BufferOffset, &MergedDatum, + memcpy (((char *) Buffer) + BufferOffset, &MergedDatum, ACPI_MIN(ObjDesc->CommonField.AccessByteWidth, BufferLength - BufferOffset)); @@ -926,7 +926,7 @@ AcpiExInsertIntoField ( * at Byte zero. All unused (upper) bytes of the * buffer will be 0. */ - ACPI_MEMCPY ((char *) NewBuffer, (char *) Buffer, BufferLength); + memcpy ((char *) NewBuffer, (char *) Buffer, BufferLength); Buffer = NewBuffer; BufferLength = RequiredLength; } @@ -969,7 +969,7 @@ AcpiExInsertIntoField ( /* Get initial Datum from the input buffer */ - ACPI_MEMCPY (&RawDatum, Buffer, + memcpy (&RawDatum, Buffer, ACPI_MIN(ObjDesc->CommonField.AccessByteWidth, BufferLength - BufferOffset)); @@ -1021,7 +1021,7 @@ AcpiExInsertIntoField ( /* Get the next input datum from the buffer */ BufferOffset += ObjDesc->CommonField.AccessByteWidth; - ACPI_MEMCPY (&RawDatum, ((char *) Buffer) + BufferOffset, + memcpy (&RawDatum, ((char *) Buffer) + BufferOffset, ACPI_MIN(ObjDesc->CommonField.AccessByteWidth, BufferLength - BufferOffset)); diff --git a/source/components/executer/exmisc.c b/source/components/executer/exmisc.c index 49fad87fd8a6..2a7b6202a663 100644 --- a/source/components/executer/exmisc.c +++ b/source/components/executer/exmisc.c @@ -225,8 +225,8 @@ AcpiExConcatTemplate ( * EndTag descriptor is copied from Operand1. */ NewBuf = ReturnDesc->Buffer.Pointer; - ACPI_MEMCPY (NewBuf, Operand0->Buffer.Pointer, Length0); - ACPI_MEMCPY (NewBuf + Length0, Operand1->Buffer.Pointer, Length1); + memcpy (NewBuf, Operand0->Buffer.Pointer, Length0); + memcpy (NewBuf + Length0, Operand1->Buffer.Pointer, Length1); /* Insert EndTag and set the checksum to zero, means "ignore checksum" */ @@ -340,12 +340,12 @@ AcpiExDoConcatenate ( /* Copy the first integer, LSB first */ - ACPI_MEMCPY (NewBuf, &Operand0->Integer.Value, + memcpy (NewBuf, &Operand0->Integer.Value, AcpiGbl_IntegerByteWidth); /* Copy the second integer (LSB first) after the first */ - ACPI_MEMCPY (NewBuf + AcpiGbl_IntegerByteWidth, + memcpy (NewBuf + AcpiGbl_IntegerByteWidth, &LocalOperand1->Integer.Value, AcpiGbl_IntegerByteWidth); break; @@ -367,8 +367,8 @@ AcpiExDoConcatenate ( /* Concatenate the strings */ - ACPI_STRCPY (NewBuf, Operand0->String.Pointer); - ACPI_STRCPY (NewBuf + Operand0->String.Length, + strcpy (NewBuf, Operand0->String.Pointer); + strcpy (NewBuf + Operand0->String.Length, LocalOperand1->String.Pointer); break; @@ -389,9 +389,9 @@ AcpiExDoConcatenate ( /* Concatenate the buffers */ - ACPI_MEMCPY (NewBuf, Operand0->Buffer.Pointer, + memcpy (NewBuf, Operand0->Buffer.Pointer, Operand0->Buffer.Length); - ACPI_MEMCPY (NewBuf + Operand0->Buffer.Length, + memcpy (NewBuf + Operand0->Buffer.Length, LocalOperand1->Buffer.Pointer, LocalOperand1->Buffer.Length); break; @@ -712,7 +712,7 @@ AcpiExDoLogicalOp ( /* Lexicographic compare: compare the data bytes */ - Compare = ACPI_MEMCMP (Operand0->Buffer.Pointer, + Compare = memcmp (Operand0->Buffer.Pointer, LocalOperand1->Buffer.Pointer, (Length0 > Length1) ? Length1 : Length0); diff --git a/source/components/executer/exnames.c b/source/components/executer/exnames.c index dbadb5a69036..61a5bbd7d29c 100644 --- a/source/components/executer/exnames.c +++ b/source/components/executer/exnames.c @@ -221,7 +221,7 @@ AcpiExNameSegment ( if (NameString) { - ACPI_STRCAT (NameString, CharBuf); + strcat (NameString, CharBuf); ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Appended to - %s\n", NameString)); } diff --git a/source/components/executer/exoparg2.c b/source/components/executer/exoparg2.c index 419aa6d87792..a5b1513e4028 100644 --- a/source/components/executer/exoparg2.c +++ b/source/components/executer/exoparg2.c @@ -368,7 +368,7 @@ AcpiExOpcode_2A_1T_1R ( * Copy the raw buffer data with no transform. * (NULL terminated already) */ - ACPI_MEMCPY (ReturnDesc->String.Pointer, + memcpy (ReturnDesc->String.Pointer, Operand[0]->Buffer.Pointer, Length); break; @@ -412,6 +412,8 @@ AcpiExOpcode_2A_1T_1R ( } ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD; + ReturnDesc->Reference.IndexPointer = + &(Operand[0]->Buffer.Pointer [Index]); break; case ACPI_TYPE_BUFFER: @@ -423,6 +425,8 @@ AcpiExOpcode_2A_1T_1R ( } ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD; + ReturnDesc->Reference.IndexPointer = + &(Operand[0]->Buffer.Pointer [Index]); break; case ACPI_TYPE_PACKAGE: @@ -434,7 +438,8 @@ AcpiExOpcode_2A_1T_1R ( } ReturnDesc->Reference.TargetType = ACPI_TYPE_PACKAGE; - ReturnDesc->Reference.Where = &Operand[0]->Package.Elements [Index]; + ReturnDesc->Reference.Where = + &Operand[0]->Package.Elements [Index]; break; default: diff --git a/source/components/executer/exoparg3.c b/source/components/executer/exoparg3.c index 5f83f10d7db7..aa42edbfbfb9 100644 --- a/source/components/executer/exoparg3.c +++ b/source/components/executer/exoparg3.c @@ -261,7 +261,7 @@ AcpiExOpcode_3A_1T_1R ( { /* We have a buffer, copy the portion requested */ - ACPI_MEMCPY (Buffer, Operand[0]->String.Pointer + Index, + memcpy (Buffer, Operand[0]->String.Pointer + Index, Length); } diff --git a/source/components/executer/exregion.c b/source/components/executer/exregion.c index 6fcfa0ffb6ff..6aaf69c84b5a 100644 --- a/source/components/executer/exregion.c +++ b/source/components/executer/exregion.c @@ -558,13 +558,13 @@ AcpiExDataTableSpaceHandler ( { case ACPI_READ: - ACPI_MEMCPY (ACPI_CAST_PTR (char, Value), ACPI_PHYSADDR_TO_PTR (Address), + memcpy (ACPI_CAST_PTR (char, Value), ACPI_PHYSADDR_TO_PTR (Address), ACPI_DIV_8 (BitWidth)); break; case ACPI_WRITE: - ACPI_MEMCPY (ACPI_PHYSADDR_TO_PTR (Address), ACPI_CAST_PTR (char, Value), + memcpy (ACPI_PHYSADDR_TO_PTR (Address), ACPI_CAST_PTR (char, Value), ACPI_DIV_8 (BitWidth)); break; diff --git a/source/components/executer/exstorob.c b/source/components/executer/exstorob.c index 24db5ced2b6c..87791c03904a 100644 --- a/source/components/executer/exstorob.c +++ b/source/components/executer/exstorob.c @@ -109,8 +109,8 @@ AcpiExStoreBufferToBuffer ( { /* Clear existing buffer and copy in the new one */ - ACPI_MEMSET (TargetDesc->Buffer.Pointer, 0, TargetDesc->Buffer.Length); - ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer, Length); + memset (TargetDesc->Buffer.Pointer, 0, TargetDesc->Buffer.Length); + memcpy (TargetDesc->Buffer.Pointer, Buffer, Length); #ifdef ACPI_OBSOLETE_BEHAVIOR /* @@ -139,7 +139,7 @@ AcpiExStoreBufferToBuffer ( { /* Truncate the source, copy only what will fit */ - ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer, + memcpy (TargetDesc->Buffer.Pointer, Buffer, TargetDesc->Buffer.Length); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, @@ -203,9 +203,9 @@ AcpiExStoreStringToString ( * String will fit in existing non-static buffer. * Clear old string and copy in the new one */ - ACPI_MEMSET (TargetDesc->String.Pointer, 0, + memset (TargetDesc->String.Pointer, 0, (ACPI_SIZE) TargetDesc->String.Length + 1); - ACPI_MEMCPY (TargetDesc->String.Pointer, Buffer, Length); + memcpy (TargetDesc->String.Pointer, Buffer, Length); } else { @@ -229,7 +229,7 @@ AcpiExStoreStringToString ( } TargetDesc->Common.Flags &= ~AOPOBJ_STATIC_POINTER; - ACPI_MEMCPY (TargetDesc->String.Pointer, Buffer, Length); + memcpy (TargetDesc->String.Pointer, Buffer, Length); } /* Set the new target length */ diff --git a/source/components/executer/exutils.c b/source/components/executer/exutils.c index 25676a17472b..a4cc73af0404 100644 --- a/source/components/executer/exutils.c +++ b/source/components/executer/exutils.c @@ -433,6 +433,43 @@ AcpiExIntegerToString ( /******************************************************************************* * + * FUNCTION: AcpiExPciClsToString + * + * PARAMETERS: OutString - Where to put the converted string (7 bytes) + * PARAMETERS: ClassCode - PCI class code to be converted (3 bytes) + * + * RETURN: None + * + * DESCRIPTION: Convert 3-bytes PCI class code to string representation. + * Return buffer must be large enough to hold the string. The + * string returned is always exactly of length + * ACPI_PCICLS_STRING_SIZE (includes null terminator). + * + ******************************************************************************/ + +void +AcpiExPciClsToString ( + char *OutString, + UINT8 ClassCode[3]) +{ + + ACPI_FUNCTION_ENTRY (); + + + /* All 3 bytes are hexadecimal */ + + OutString[0] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[0], 4); + OutString[1] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[0], 0); + OutString[2] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[1], 4); + OutString[3] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[1], 0); + OutString[4] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[2], 4); + OutString[5] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[2], 0); + OutString[6] = 0; +} + + +/******************************************************************************* + * * FUNCTION: AcpiIsValidSpaceId * * PARAMETERS: SpaceId - ID to be validated diff --git a/source/components/hardware/hwgpe.c b/source/components/hardware/hwgpe.c index 2e616d4e4e12..1458f4fed22c 100644 --- a/source/components/hardware/hwgpe.c +++ b/source/components/hardware/hwgpe.c @@ -97,6 +97,8 @@ AcpiHwGetGpeRegisterBit ( * RETURN: Status * * DESCRIPTION: Enable or disable a single GPE in the parent enable register. + * The EnableMask field of the involved GPE register must be + * updated by the caller if necessary. * ******************************************************************************/ @@ -133,7 +135,7 @@ AcpiHwLowSetGpe ( /* Set or clear just the bit that corresponds to this GPE */ RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo); - switch (Action & ~ACPI_GPE_SAVE_MASK) + switch (Action) { case ACPI_GPE_CONDITIONAL_ENABLE: @@ -165,10 +167,6 @@ AcpiHwLowSetGpe ( /* Write the updated enable mask */ Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress); - if (ACPI_SUCCESS (Status) && (Action & ACPI_GPE_SAVE_MASK)) - { - GpeRegisterInfo->EnableMask = (UINT8) EnableMask; - } return (Status); } @@ -334,11 +332,8 @@ AcpiHwGpeEnableWrite ( ACPI_STATUS Status; + GpeRegisterInfo->EnableMask = EnableMask; Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress); - if (ACPI_SUCCESS (Status)) - { - GpeRegisterInfo->EnableMask = EnableMask; - } return (Status); } diff --git a/source/components/hardware/hwxfsleep.c b/source/components/hardware/hwxfsleep.c index 5576edec9fa0..7837c6f56bab 100644 --- a/source/components/hardware/hwxfsleep.c +++ b/source/components/hardware/hwxfsleep.c @@ -52,6 +52,12 @@ /* Local prototypes */ static ACPI_STATUS +AcpiHwSetFirmwareWakingVector ( + ACPI_TABLE_FACS *Facs, + ACPI_PHYSICAL_ADDRESS PhysicalAddress, + ACPI_PHYSICAL_ADDRESS PhysicalAddress64); + +static ACPI_STATUS AcpiHwSleepDispatch ( UINT8 SleepState, UINT32 FunctionId); @@ -77,29 +83,33 @@ static ACPI_SLEEP_FUNCTIONS AcpiSleepDispatch[] = /* * These functions are removed for the ACPI_REDUCED_HARDWARE case: * AcpiSetFirmwareWakingVector - * AcpiSetFirmwareWakingVector64 * AcpiEnterSleepStateS4bios */ #if (!ACPI_REDUCED_HARDWARE) /******************************************************************************* * - * FUNCTION: AcpiSetFirmwareWakingVector + * FUNCTION: AcpiHwSetFirmwareWakingVector * - * PARAMETERS: PhysicalAddress - 32-bit physical address of ACPI real mode - * entry point. + * PARAMETERS: Facs - Pointer to FACS table + * PhysicalAddress - 32-bit physical address of ACPI real mode + * entry point + * PhysicalAddress64 - 64-bit physical address of ACPI protected + * entry point * * RETURN: Status * - * DESCRIPTION: Sets the 32-bit FirmwareWakingVector field of the FACS + * DESCRIPTION: Sets the FirmwareWakingVector fields of the FACS * ******************************************************************************/ -ACPI_STATUS -AcpiSetFirmwareWakingVector ( - UINT32 PhysicalAddress) +static ACPI_STATUS +AcpiHwSetFirmwareWakingVector ( + ACPI_TABLE_FACS *Facs, + ACPI_PHYSICAL_ADDRESS PhysicalAddress, + ACPI_PHYSICAL_ADDRESS PhysicalAddress64) { - ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector); + ACPI_FUNCTION_TRACE (AcpiHwSetFirmwareWakingVector); /* @@ -112,60 +122,73 @@ AcpiSetFirmwareWakingVector ( /* Set the 32-bit vector */ - AcpiGbl_FACS->FirmwareWakingVector = PhysicalAddress; - - /* Clear the 64-bit vector if it exists */ + Facs->FirmwareWakingVector = (UINT32) PhysicalAddress; - if ((AcpiGbl_FACS->Length > 32) && (AcpiGbl_FACS->Version >= 1)) + if (Facs->Length > 32) { - AcpiGbl_FACS->XFirmwareWakingVector = 0; + if (Facs->Version >= 1) + { + /* Set the 64-bit vector */ + + Facs->XFirmwareWakingVector = PhysicalAddress64; + } + else + { + /* Clear the 64-bit vector if it exists */ + + Facs->XFirmwareWakingVector = 0; + } } return_ACPI_STATUS (AE_OK); } -ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector) - -#if ACPI_MACHINE_WIDTH == 64 /******************************************************************************* * - * FUNCTION: AcpiSetFirmwareWakingVector64 + * FUNCTION: AcpiSetFirmwareWakingVector * - * PARAMETERS: PhysicalAddress - 64-bit physical address of ACPI protected - * mode entry point. + * PARAMETERS: PhysicalAddress - 32-bit physical address of ACPI real mode + * entry point + * PhysicalAddress64 - 64-bit physical address of ACPI protected + * entry point * * RETURN: Status * - * DESCRIPTION: Sets the 64-bit X_FirmwareWakingVector field of the FACS, if - * it exists in the table. This function is intended for use with - * 64-bit host operating systems. + * DESCRIPTION: Sets the FirmwareWakingVector fields of the FACS * ******************************************************************************/ ACPI_STATUS -AcpiSetFirmwareWakingVector64 ( - UINT64 PhysicalAddress) +AcpiSetFirmwareWakingVector ( + ACPI_PHYSICAL_ADDRESS PhysicalAddress, + ACPI_PHYSICAL_ADDRESS PhysicalAddress64) { - ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector64); + ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector); - /* Determine if the 64-bit vector actually exists */ + /* If Hardware Reduced flag is set, there is no FACS */ - if ((AcpiGbl_FACS->Length <= 32) || (AcpiGbl_FACS->Version < 1)) + if (AcpiGbl_ReducedHardware) { - return_ACPI_STATUS (AE_NOT_EXIST); + return (AE_OK); } - /* Clear 32-bit vector, set the 64-bit X_ vector */ + if (AcpiGbl_Facs32) + { + (void) AcpiHwSetFirmwareWakingVector (AcpiGbl_Facs32, + PhysicalAddress, PhysicalAddress64); + } + if (AcpiGbl_Facs64) + { + (void) AcpiHwSetFirmwareWakingVector (AcpiGbl_Facs64, + PhysicalAddress, PhysicalAddress64); + } - AcpiGbl_FACS->FirmwareWakingVector = 0; - AcpiGbl_FACS->XFirmwareWakingVector = PhysicalAddress; return_ACPI_STATUS (AE_OK); } -ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector64) -#endif +ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector) /******************************************************************************* diff --git a/source/components/namespace/nsaccess.c b/source/components/namespace/nsaccess.c index 9729cd61e17a..615257aefee4 100644 --- a/source/components/namespace/nsaccess.c +++ b/source/components/namespace/nsaccess.c @@ -111,7 +111,7 @@ AcpiNsRootInitialize ( { /* _OSI is optional for now, will be permanent later */ - if (!ACPI_STRCMP (InitVal->Name, "_OSI") && !AcpiGbl_CreateOsiMethod) + if (!strcmp (InitVal->Name, "_OSI") && !AcpiGbl_CreateOsiMethod) { continue; } @@ -191,7 +191,7 @@ AcpiNsRootInitialize ( /* Build an object around the static string */ - ObjDesc->String.Length = (UINT32) ACPI_STRLEN (Val); + ObjDesc->String.Length = (UINT32) strlen (Val); ObjDesc->String.Pointer = Val; ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER; break; @@ -212,7 +212,7 @@ AcpiNsRootInitialize ( /* Special case for ACPI Global Lock */ - if (ACPI_STRCMP (InitVal->Name, "_GL_") == 0) + if (strcmp (InitVal->Name, "_GL_") == 0) { AcpiGbl_GlobalLockMutex = ObjDesc; @@ -319,7 +319,9 @@ AcpiNsLookup ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - LocalFlags = Flags & ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_SEARCH_PARENT); + LocalFlags = Flags & + ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_OVERRIDE_IF_FOUND | + ACPI_NS_SEARCH_PARENT); *ReturnNode = ACPI_ENTRY_NOT_FOUND; AcpiGbl_NsLookupCount++; @@ -571,6 +573,13 @@ AcpiNsLookup ( { LocalFlags |= ACPI_NS_ERROR_IF_FOUND; } + + /* Set override flag according to caller */ + + if (Flags & ACPI_NS_OVERRIDE_IF_FOUND) + { + LocalFlags |= ACPI_NS_OVERRIDE_IF_FOUND; + } } /* Extract one ACPI name from the front of the pathname */ diff --git a/source/components/namespace/nsconvert.c b/source/components/namespace/nsconvert.c index 6fa67faba264..c3ca5b8679be 100644 --- a/source/components/namespace/nsconvert.c +++ b/source/components/namespace/nsconvert.c @@ -202,7 +202,7 @@ AcpiNsConvertToString ( * Copy the raw buffer data with no transform. String is already NULL * terminated at Length+1. */ - ACPI_MEMCPY (NewObject->String.Pointer, + memcpy (NewObject->String.Pointer, OriginalObject->Buffer.Pointer, Length); break; @@ -269,7 +269,7 @@ AcpiNsConvertToBuffer ( return (AE_NO_MEMORY); } - ACPI_MEMCPY (NewObject->Buffer.Pointer, + memcpy (NewObject->Buffer.Pointer, OriginalObject->String.Pointer, OriginalObject->String.Length); break; diff --git a/source/components/namespace/nsdump.c b/source/components/namespace/nsdump.c index bbaff7d95b18..8e3c3ddc499e 100644 --- a/source/components/namespace/nsdump.c +++ b/source/components/namespace/nsdump.c @@ -122,7 +122,7 @@ AcpiNsPrintPathname ( { for (i = 0; i < 4; i++) { - ACPI_IS_PRINT (Pathname[i]) ? + isprint (Pathname[i]) ? AcpiOsPrintf ("%c", Pathname[i]) : AcpiOsPrintf ("?"); } diff --git a/source/components/namespace/nseval.c b/source/components/namespace/nseval.c index e5a0eb8290d7..6ab6a93a4771 100644 --- a/source/components/namespace/nseval.c +++ b/source/components/namespace/nseval.c @@ -63,15 +63,14 @@ AcpiNsExecModuleCode ( * * FUNCTION: AcpiNsEvaluate * - * PARAMETERS: Info - Evaluation info block, contains: + * PARAMETERS: Info - Evaluation info block, contains these fields + * and more: * PrefixNode - Prefix or Method/Object Node to execute * RelativePath - Name of method to execute, If NULL, the * Node is the object to execute * Parameters - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. - * ReturnObject - Where to put method's return value (if - * any). If NULL, no value is returned. * ParameterType - Type of Parameter list * ReturnObject - Where to put method's return value (if * any). If NULL, no value is returned. @@ -463,7 +462,7 @@ AcpiNsExecModuleCode ( /* Initialize the evaluation information block */ - ACPI_MEMSET (Info, 0, sizeof (ACPI_EVALUATE_INFO)); + memset (Info, 0, sizeof (ACPI_EVALUATE_INFO)); Info->PrefixNode = ParentNode; /* diff --git a/source/components/namespace/nsinit.c b/source/components/namespace/nsinit.c index d68ee203b98a..c80d2c88255a 100644 --- a/source/components/namespace/nsinit.c +++ b/source/components/namespace/nsinit.c @@ -105,7 +105,7 @@ AcpiNsInitializeObjects ( /* Set all init info to zero */ - ACPI_MEMSET (&Info, 0, sizeof (ACPI_INIT_WALK_INFO)); + memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO)); /* Walk entire namespace from the supplied root */ @@ -614,7 +614,7 @@ AcpiNsInitOneDevice ( ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname ( ACPI_TYPE_METHOD, DeviceNode, METHOD_NAME__INI)); - ACPI_MEMSET (Info, 0, sizeof (ACPI_EVALUATE_INFO)); + memset (Info, 0, sizeof (ACPI_EVALUATE_INFO)); Info->PrefixNode = DeviceNode; Info->RelativePathname = METHOD_NAME__INI; Info->Parameters = NULL; diff --git a/source/components/namespace/nsparse.c b/source/components/namespace/nsparse.c index fec9c51d6d10..bfc5615ade68 100644 --- a/source/components/namespace/nsparse.c +++ b/source/components/namespace/nsparse.c @@ -129,6 +129,14 @@ AcpiNsOneCompleteParse ( AmlStart, AmlLength, NULL, (UINT8) PassNumber); } + /* Found OSDT table, enable the namespace override feature */ + + if (ACPI_COMPARE_NAME(Table->Signature, ACPI_SIG_OSDT) && + PassNumber == ACPI_IMODE_LOAD_PASS1) + { + WalkState->NamespaceOverride = TRUE; + } + if (ACPI_FAILURE (Status)) { AcpiDsDeleteWalkState (WalkState); diff --git a/source/components/namespace/nsrepair2.c b/source/components/namespace/nsrepair2.c index 60b895b5dc62..e7efbae6f859 100644 --- a/source/components/namespace/nsrepair2.c +++ b/source/components/namespace/nsrepair2.c @@ -637,7 +637,7 @@ AcpiNsRepair_HID ( */ for (Dest = NewString->String.Pointer; *Source; Dest++, Source++) { - *Dest = (char) ACPI_TOUPPER (*Source); + *Dest = (char) toupper (*Source); } AcpiUtRemoveReference (ReturnObject); diff --git a/source/components/namespace/nssearch.c b/source/components/namespace/nssearch.c index 46794b69dcc2..c67abb59d3ff 100644 --- a/source/components/namespace/nssearch.c +++ b/source/components/namespace/nssearch.c @@ -338,10 +338,42 @@ AcpiNsSearchAndEnter ( * If we found it AND the request specifies that a find is an error, * return the error */ - if ((Status == AE_OK) && - (Flags & ACPI_NS_ERROR_IF_FOUND)) + if (Status == AE_OK) { - Status = AE_ALREADY_EXISTS; + /* The node was found in the namespace */ + + /* + * If the namespace override feature is enabled for this node, + * delete any existing attached sub-object and make the node + * look like a new node that is owned by the override table. + */ + if (Flags & ACPI_NS_OVERRIDE_IF_FOUND) + { + AcpiNsDeleteChildren (*ReturnNode); + if (AcpiGbl_RuntimeNamespaceOverride) + { + AcpiUtRemoveReference ((*ReturnNode)->Object); + (*ReturnNode)->Object = NULL; + (*ReturnNode)->OwnerId = WalkState->OwnerId; + } + else + { + AcpiNsRemoveNode (*ReturnNode); + *ReturnNode = ACPI_ENTRY_NOT_FOUND; + } + + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, + "Namespace override: %4.4s pass %u type %X Owner %X\n", + ACPI_CAST_PTR(char, &TargetName), InterpreterMode, + (*ReturnNode)->Type, WalkState->OwnerId)); + } + + /* Return an error if we don't expect to find the object */ + + else if (Flags & ACPI_NS_ERROR_IF_FOUND) + { + Status = AE_ALREADY_EXISTS; + } } #ifdef ACPI_ASL_COMPILER diff --git a/source/components/namespace/nsutils.c b/source/components/namespace/nsutils.c index becdf3336933..5335810c6028 100644 --- a/source/components/namespace/nsutils.c +++ b/source/components/namespace/nsutils.c @@ -347,7 +347,7 @@ AcpiNsBuildInternalName ( { /* Convert the character to uppercase and save it */ - Result[i] = (char) ACPI_TOUPPER ((int) *ExternalName); + Result[i] = (char) toupper ((int) *ExternalName); ExternalName++; } } diff --git a/source/components/namespace/nsxfeval.c b/source/components/namespace/nsxfeval.c index 547ed4d8ade4..1a867bda8366 100644 --- a/source/components/namespace/nsxfeval.c +++ b/source/components/namespace/nsxfeval.c @@ -758,7 +758,7 @@ AcpiNsGetDeviceCallback ( return (AE_CTRL_DEPTH); } - NoMatch = ACPI_STRCMP (Hid->String, Info->Hid); + NoMatch = strcmp (Hid->String, Info->Hid); ACPI_FREE (Hid); if (NoMatch) @@ -782,7 +782,7 @@ AcpiNsGetDeviceCallback ( Found = FALSE; for (i = 0; i < Cid->Count; i++) { - if (ACPI_STRCMP (Cid->Ids[i].String, Info->Hid) == 0) + if (strcmp (Cid->Ids[i].String, Info->Hid) == 0) { /* Found a matching CID */ diff --git a/source/components/namespace/nsxfname.c b/source/components/namespace/nsxfname.c index 3f6c74dca68e..7f92201843aa 100644 --- a/source/components/namespace/nsxfname.c +++ b/source/components/namespace/nsxfname.c @@ -126,7 +126,7 @@ AcpiGetHandle ( /* Special case for root-only, since we can't search for it */ - if (!ACPI_STRCMP (Pathname, ACPI_NS_ROOT_PATH)) + if (!strcmp (Pathname, ACPI_NS_ROOT_PATH)) { *RetHandle = ACPI_CAST_PTR (ACPI_HANDLE, AcpiGbl_RootNode); return (AE_OK); @@ -271,7 +271,7 @@ AcpiNsCopyDeviceId ( /* Copy actual string and return a pointer to the next string area */ - ACPI_MEMCPY (StringArea, Source->String, Source->Length); + memcpy (StringArea, Source->String, Source->Length); return (StringArea + Source->Length); } @@ -290,7 +290,7 @@ AcpiNsCopyDeviceId ( * control methods (Such as in the case of a device.) * * For Device and Processor objects, run the Device _HID, _UID, _CID, _SUB, - * _STA, _ADR, _SxW, and _SxD methods. + * _CLS, _STA, _ADR, _SxW, and _SxD methods. * * Note: Allocates the return buffer, must be freed by the caller. * @@ -307,11 +307,12 @@ AcpiGetObjectInfo ( ACPI_PNP_DEVICE_ID *Hid = NULL; ACPI_PNP_DEVICE_ID *Uid = NULL; ACPI_PNP_DEVICE_ID *Sub = NULL; + ACPI_PNP_DEVICE_ID *Cls = NULL; char *NextIdString; ACPI_OBJECT_TYPE Type; ACPI_NAME Name; UINT8 ParamCount= 0; - UINT8 Valid = 0; + UINT16 Valid = 0; UINT32 InfoSize; UINT32 i; ACPI_STATUS Status; @@ -359,7 +360,7 @@ AcpiGetObjectInfo ( { /* * Get extra info for ACPI Device/Processor objects only: - * Run the Device _HID, _UID, _SUB, and _CID methods. + * Run the Device _HID, _UID, _SUB, _CID, and _CLS methods. * * Note: none of these methods are required, so they may or may * not be present for this device. The Info->Valid bitfield is used @@ -403,6 +404,15 @@ AcpiGetObjectInfo ( InfoSize += (CidList->ListSize - sizeof (ACPI_PNP_DEVICE_ID_LIST)); Valid |= ACPI_VALID_CID; } + + /* Execute the Device._CLS method */ + + Status = AcpiUtExecute_CLS (Node, &Cls); + if (ACPI_SUCCESS (Status)) + { + InfoSize += Cls->Length; + Valid |= ACPI_VALID_CLS; + } } /* @@ -534,6 +544,12 @@ AcpiGetObjectInfo ( } } + if (Cls) + { + NextIdString = AcpiNsCopyDeviceId (&Info->ClassCode, + Cls, NextIdString); + } + /* Copy the fixed-length data */ Info->InfoSize = InfoSize; @@ -563,6 +579,10 @@ Cleanup: { ACPI_FREE (CidList); } + if (Cls) + { + ACPI_FREE (Cls); + } return (Status); } @@ -684,7 +704,7 @@ AcpiInstallMethod ( /* Copy the method AML to the local buffer */ - ACPI_MEMCPY (AmlBuffer, AmlStart, AmlLength); + memcpy (AmlBuffer, AmlStart, AmlLength); /* Initialize the method object with the new method's information */ diff --git a/source/components/parser/psutils.c b/source/components/parser/psutils.c index e95d16248534..55bf2ccff1b0 100644 --- a/source/components/parser/psutils.c +++ b/source/components/parser/psutils.c @@ -104,7 +104,7 @@ AcpiPsInitOp ( Op->Common.DescriptorType = ACPI_DESC_TYPE_PARSER; Op->Common.AmlOpcode = Opcode; - ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (Op->Common.AmlOpName, + ACPI_DISASM_ONLY_MEMBERS (strncpy (Op->Common.AmlOpName, (AcpiPsGetOpcodeInfo (Opcode))->Name, sizeof (Op->Common.AmlOpName))); } diff --git a/source/components/resources/rscreate.c b/source/components/resources/rscreate.c index 5b47e7e69474..551f59a6534c 100644 --- a/source/components/resources/rscreate.c +++ b/source/components/resources/rscreate.c @@ -374,12 +374,12 @@ AcpiRsCreatePciRoutingTable ( /* +1 to include null terminator */ - UserPrt->Length += (UINT32) ACPI_STRLEN (UserPrt->Source) + 1; + UserPrt->Length += (UINT32) strlen (UserPrt->Source) + 1; break; case ACPI_TYPE_STRING: - ACPI_STRCPY (UserPrt->Source, ObjDesc->String.Pointer); + strcpy (UserPrt->Source, ObjDesc->String.Pointer); /* * Add to the Length field the length of the string diff --git a/source/components/resources/rsmisc.c b/source/components/resources/rsmisc.c index 82df562541a2..83f50aa95dac 100644 --- a/source/components/resources/rsmisc.c +++ b/source/components/resources/rsmisc.c @@ -130,7 +130,7 @@ AcpiRsConvertAmlToResource ( /* * Get the resource type and the initial (minimum) length */ - ACPI_MEMSET (Resource, 0, INIT_RESOURCE_LENGTH (Info)); + memset (Resource, 0, INIT_RESOURCE_LENGTH (Info)); Resource->Type = INIT_RESOURCE_TYPE (Info); Resource->Length = INIT_RESOURCE_LENGTH (Info); break; @@ -326,13 +326,13 @@ AcpiRsConvertAmlToResource ( case ACPI_RSC_SET8: - ACPI_MEMSET (Destination, Info->AmlOffset, Info->Value); + memset (Destination, Info->AmlOffset, Info->Value); break; case ACPI_RSC_DATA8: Target = ACPI_ADD_PTR (char, Resource, Info->Value); - ACPI_MEMCPY (Destination, Source, ACPI_GET16 (Target)); + memcpy (Destination, Source, ACPI_GET16 (Target)); break; case ACPI_RSC_ADDRESS: @@ -505,7 +505,7 @@ AcpiRsConvertResourceToAml ( { case ACPI_RSC_INITSET: - ACPI_MEMSET (Aml, 0, INIT_RESOURCE_LENGTH (Info)); + memset (Aml, 0, INIT_RESOURCE_LENGTH (Info)); AmlLength = INIT_RESOURCE_LENGTH (Info); AcpiRsSetResourceHeader (INIT_RESOURCE_TYPE (Info), AmlLength, Aml); break; diff --git a/source/components/resources/rsutils.c b/source/components/resources/rsutils.c index 68407947e329..a5517c6bff92 100644 --- a/source/components/resources/rsutils.c +++ b/source/components/resources/rsutils.c @@ -174,7 +174,7 @@ AcpiRsMoveData ( case ACPI_RSC_MOVE_SERIAL_VEN: case ACPI_RSC_MOVE_SERIAL_RES: - ACPI_MEMCPY (Destination, Source, ItemCount); + memcpy (Destination, Source, ItemCount); return; /* @@ -408,11 +408,11 @@ AcpiRsGetResourceSource ( * * Zero the entire area of the buffer. */ - TotalLength = (UINT32) ACPI_STRLEN ( + TotalLength = (UINT32) strlen ( ACPI_CAST_PTR (char, &AmlResourceSource[1])) + 1; TotalLength = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (TotalLength); - ACPI_MEMSET (ResourceSource->StringPtr, 0, TotalLength); + memset (ResourceSource->StringPtr, 0, TotalLength); /* Copy the ResourceSource string to the destination */ @@ -477,7 +477,7 @@ AcpiRsSetResourceSource ( /* Copy the ResourceSource string */ - ACPI_STRCPY (ACPI_CAST_PTR (char, &AmlResourceSource[1]), + strcpy (ACPI_CAST_PTR (char, &AmlResourceSource[1]), ResourceSource->StringPtr); /* diff --git a/source/components/resources/rsxface.c b/source/components/resources/rsxface.c index cb64c1d08f7e..1008af010ff3 100644 --- a/source/components/resources/rsxface.c +++ b/source/components/resources/rsxface.c @@ -447,7 +447,7 @@ AcpiResourceToAddress64 ( /* Simple copy for 64 bit source */ - ACPI_MEMCPY (Out, &Resource->Data, sizeof (ACPI_RESOURCE_ADDRESS64)); + memcpy (Out, &Resource->Data, sizeof (ACPI_RESOURCE_ADDRESS64)); break; default: @@ -558,7 +558,7 @@ AcpiRsMatchVendorResource ( */ if ((Vendor->ByteLength < (ACPI_UUID_LENGTH + 1)) || (Vendor->UuidSubtype != Info->Uuid->Subtype) || - (ACPI_MEMCMP (Vendor->Uuid, Info->Uuid->Data, ACPI_UUID_LENGTH))) + (memcmp (Vendor->Uuid, Info->Uuid->Data, ACPI_UUID_LENGTH))) { return (AE_OK); } @@ -574,7 +574,7 @@ AcpiRsMatchVendorResource ( /* Found the correct resource, copy and return it */ - ACPI_MEMCPY (Buffer->Pointer, Resource, Resource->Length); + memcpy (Buffer->Pointer, Resource, Resource->Length); Buffer->Length = Resource->Length; /* Found the desired descriptor, terminate resource walk */ diff --git a/source/components/tables/tbdata.c b/source/components/tables/tbdata.c index 5c1cfe40d9f2..5769a8e70527 100644 --- a/source/components/tables/tbdata.c +++ b/source/components/tables/tbdata.c @@ -77,7 +77,7 @@ AcpiTbInitTableDescriptor ( * Initialize the table descriptor. Set the pointer to NULL, since the * table is not fully mapped at this time. */ - ACPI_MEMSET (TableDesc, 0, sizeof (ACPI_TABLE_DESC)); + memset (TableDesc, 0, sizeof (ACPI_TABLE_DESC)); TableDesc->Address = Address; TableDesc->Length = Table->Length; TableDesc->Flags = Flags; @@ -511,7 +511,7 @@ AcpiTbResizeRootTableList ( if (AcpiGbl_RootTableList.Tables) { - ACPI_MEMCPY (Tables, AcpiGbl_RootTableList.Tables, + memcpy (Tables, AcpiGbl_RootTableList.Tables, (ACPI_SIZE) TableCount * sizeof (ACPI_TABLE_DESC)); if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) diff --git a/source/components/tables/tbfadt.c b/source/components/tables/tbfadt.c index 6d57e8061257..871eb880ae9f 100644 --- a/source/components/tables/tbfadt.c +++ b/source/components/tables/tbfadt.c @@ -382,8 +382,16 @@ AcpiTbParseFadt ( if (!AcpiGbl_ReducedHardware) { - AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs, - ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS); + if (AcpiGbl_FADT.Facs) + { + AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.Facs, + ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS); + } + if (AcpiGbl_FADT.XFacs) + { + AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs, + ACPI_SIG_FACS, ACPI_TABLE_INDEX_X_FACS); + } } } @@ -425,11 +433,11 @@ AcpiTbCreateLocalFadt ( /* Clear the entire local FADT */ - ACPI_MEMSET (&AcpiGbl_FADT, 0, sizeof (ACPI_TABLE_FADT)); + memset (&AcpiGbl_FADT, 0, sizeof (ACPI_TABLE_FADT)); /* Copy the original FADT, up to sizeof (ACPI_TABLE_FADT) */ - ACPI_MEMCPY (&AcpiGbl_FADT, Table, + memcpy (&AcpiGbl_FADT, Table, ACPI_MIN (Length, sizeof (ACPI_TABLE_FADT))); /* Take a copy of the Hardware Reduced flag */ @@ -533,12 +541,9 @@ AcpiTbConvertFadt ( AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT); /* - * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary. + * Expand the 32-bit DSDT addresses to 64-bit as necessary. * Later ACPICA code will always use the X 64-bit field. */ - AcpiGbl_FADT.XFacs = AcpiTbSelectAddress ("FACS", - AcpiGbl_FADT.Facs, AcpiGbl_FADT.XFacs); - AcpiGbl_FADT.XDsdt = AcpiTbSelectAddress ("DSDT", AcpiGbl_FADT.Dsdt, AcpiGbl_FADT.XDsdt); diff --git a/source/components/tables/tbfind.c b/source/components/tables/tbfind.c index 13ed982ae543..af790924105c 100644 --- a/source/components/tables/tbfind.c +++ b/source/components/tables/tbfind.c @@ -83,16 +83,16 @@ AcpiTbFindTable ( /* Normalize the input strings */ - ACPI_MEMSET (&Header, 0, sizeof (ACPI_TABLE_HEADER)); + memset (&Header, 0, sizeof (ACPI_TABLE_HEADER)); ACPI_MOVE_NAME (Header.Signature, Signature); - ACPI_STRNCPY (Header.OemId, OemId, ACPI_OEM_ID_SIZE); - ACPI_STRNCPY (Header.OemTableId, OemTableId, ACPI_OEM_TABLE_ID_SIZE); + strncpy (Header.OemId, OemId, ACPI_OEM_ID_SIZE); + strncpy (Header.OemTableId, OemTableId, ACPI_OEM_TABLE_ID_SIZE); /* Search for the table */ for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) { - if (ACPI_MEMCMP (&(AcpiGbl_RootTableList.Tables[i].Signature), + if (memcmp (&(AcpiGbl_RootTableList.Tables[i].Signature), Header.Signature, ACPI_NAME_SIZE)) { /* Not the requested table */ @@ -120,13 +120,13 @@ AcpiTbFindTable ( /* Check for table match on all IDs */ - if (!ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->Signature, + if (!memcmp (AcpiGbl_RootTableList.Tables[i].Pointer->Signature, Header.Signature, ACPI_NAME_SIZE) && (!OemId[0] || - !ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->OemId, + !memcmp (AcpiGbl_RootTableList.Tables[i].Pointer->OemId, Header.OemId, ACPI_OEM_ID_SIZE)) && (!OemTableId[0] || - !ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->OemTableId, + !memcmp (AcpiGbl_RootTableList.Tables[i].Pointer->OemTableId, Header.OemTableId, ACPI_OEM_TABLE_ID_SIZE))) { *TableIndex = i; diff --git a/source/components/tables/tbinstal.c b/source/components/tables/tbinstal.c index e2c6833c36f6..c797efb808d3 100644 --- a/source/components/tables/tbinstal.c +++ b/source/components/tables/tbinstal.c @@ -94,7 +94,7 @@ AcpiTbCompareTables ( * not just the header. */ IsIdentical = (BOOLEAN)((TableDesc->Length != TableLength || - ACPI_MEMCMP (TableDesc->Pointer, Table, TableLength)) ? + memcmp (TableDesc->Pointer, Table, TableLength)) ? FALSE : TRUE); /* Release the acquired table */ @@ -309,7 +309,7 @@ AcpiTbInstallStandardTable ( */ if ((NewTableDesc.Signature.Ascii[0] != 0x00) && (!ACPI_COMPARE_NAME (&NewTableDesc.Signature, ACPI_SIG_SSDT)) && - (ACPI_STRNCMP (NewTableDesc.Signature.Ascii, "OEM", 3))) + (strncmp (NewTableDesc.Signature.Ascii, "OEM", 3))) { ACPI_BIOS_ERROR ((AE_INFO, "Table has invalid signature [%4.4s] (0x%8.8X), " diff --git a/source/components/tables/tbprint.c b/source/components/tables/tbprint.c index 48d8d50d461c..2563cec17ebb 100644 --- a/source/components/tables/tbprint.c +++ b/source/components/tables/tbprint.c @@ -84,7 +84,7 @@ AcpiTbFixString ( while (Length && *String) { - if (!ACPI_IS_PRINT (*String)) + if (!isprint (*String)) { *String = '?'; } @@ -114,7 +114,7 @@ AcpiTbCleanupTableHeader ( ACPI_TABLE_HEADER *Header) { - ACPI_MEMCPY (OutHeader, Header, sizeof (ACPI_TABLE_HEADER)); + memcpy (OutHeader, Header, sizeof (ACPI_TABLE_HEADER)); AcpiTbFixString (OutHeader->Signature, ACPI_NAME_SIZE); AcpiTbFixString (OutHeader->OemId, ACPI_OEM_ID_SIZE); @@ -156,7 +156,7 @@ AcpiTbPrintTableHeader ( { /* RSDP has no common fields */ - ACPI_MEMCPY (LocalHeader.OemId, + memcpy (LocalHeader.OemId, ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->OemId, ACPI_OEM_ID_SIZE); AcpiTbFixString (LocalHeader.OemId, ACPI_OEM_ID_SIZE); diff --git a/source/components/tables/tbutils.c b/source/components/tables/tbutils.c index 7159c6093430..79dde9ac9735 100644 --- a/source/components/tables/tbutils.c +++ b/source/components/tables/tbutils.c @@ -75,8 +75,13 @@ ACPI_STATUS AcpiTbInitializeFacs ( void) { - ACPI_STATUS Status; + /* If there is no FACS, just continue. There was already an error msg */ + + if (!AcpiGbl_FACS) + { + return (AE_OK); + } /* If Hardware Reduced flag is set, there is no FACS */ @@ -86,9 +91,25 @@ AcpiTbInitializeFacs ( return (AE_OK); } - Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, - ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &AcpiGbl_FACS)); - return (Status); + (void) AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, + ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &AcpiGbl_Facs32)); + (void) AcpiGetTableByIndex (ACPI_TABLE_INDEX_X_FACS, + ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &AcpiGbl_Facs64)); + if (!AcpiGbl_Facs32 && !AcpiGbl_Facs64) + { + return (AE_NO_MEMORY); + } + + if (AcpiGbl_Use32BitFacsAddresses) + { + AcpiGbl_FACS = AcpiGbl_Facs32 ? AcpiGbl_Facs32 : AcpiGbl_Facs64; + } + else + { + AcpiGbl_FACS = AcpiGbl_Facs64 ? AcpiGbl_Facs64 : AcpiGbl_Facs32; + } + + return (AE_OK); } #endif /* !ACPI_REDUCED_HARDWARE */ @@ -111,7 +132,7 @@ AcpiTbTablesLoaded ( void) { - if (AcpiGbl_RootTableList.CurrentTableCount >= 3) + if (AcpiGbl_RootTableList.CurrentTableCount >= 4) { return (TRUE); } @@ -190,7 +211,7 @@ AcpiTbCopyDsdt ( return (NULL); } - ACPI_MEMCPY (NewTable, TableDesc->Pointer, TableDesc->Length); + memcpy (NewTable, TableDesc->Pointer, TableDesc->Length); AcpiTbUninstallTable (TableDesc); AcpiTbInitTableDescriptor ( @@ -389,11 +410,11 @@ AcpiTbParseRootTable ( TableEntry = ACPI_ADD_PTR (UINT8, Table, sizeof (ACPI_TABLE_HEADER)); /* - * First two entries in the table array are reserved for the DSDT - * and FACS, which are not actually present in the RSDT/XSDT - they - * come from the FADT + * First three entries in the table array are reserved for the DSDT + * and 32bit/64bit FACS, which are not actually present in the + * RSDT/XSDT - they come from the FADT */ - AcpiGbl_RootTableList.CurrentTableCount = 2; + AcpiGbl_RootTableList.CurrentTableCount = 3; /* Initialize the root table array from the RSDT/XSDT */ diff --git a/source/components/tables/tbxface.c b/source/components/tables/tbxface.c index 7b4e7f0b71bc..bcaf6af2a990 100644 --- a/source/components/tables/tbxface.c +++ b/source/components/tables/tbxface.c @@ -132,7 +132,7 @@ AcpiInitializeTables ( { /* Root Table Array has been statically allocated by the host */ - ACPI_MEMSET (InitialTableArray, 0, + memset (InitialTableArray, 0, (ACPI_SIZE) InitialTableCount * sizeof (ACPI_TABLE_DESC)); AcpiGbl_RootTableList.Tables = InitialTableArray; @@ -271,7 +271,7 @@ AcpiGetTableHeader ( return (AE_NO_MEMORY); } - ACPI_MEMCPY (OutTableHeader, Header, + memcpy (OutTableHeader, Header, sizeof (ACPI_TABLE_HEADER)); AcpiOsUnmapMemory (Header, sizeof (ACPI_TABLE_HEADER)); } @@ -282,7 +282,7 @@ AcpiGetTableHeader ( } else { - ACPI_MEMCPY (OutTableHeader, + memcpy (OutTableHeader, AcpiGbl_RootTableList.Tables[i].Pointer, sizeof (ACPI_TABLE_HEADER)); } diff --git a/source/components/tables/tbxfload.c b/source/components/tables/tbxfload.c index 3473df878d6b..19c31e71cf94 100644 --- a/source/components/tables/tbxfload.c +++ b/source/components/tables/tbxfload.c @@ -164,7 +164,7 @@ AcpiTbLoadNamespace ( * Save the original DSDT header for detection of table corruption * and/or replacement of the DSDT from outside the OS. */ - ACPI_MEMCPY (&AcpiGbl_OriginalDsdtHeader, AcpiGbl_DSDT, + memcpy (&AcpiGbl_OriginalDsdtHeader, AcpiGbl_DSDT, sizeof (ACPI_TABLE_HEADER)); (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); @@ -182,10 +182,13 @@ AcpiTbLoadNamespace ( (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) { - if ((!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), + if (!AcpiGbl_RootTableList.Tables[i].Address || + (!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), ACPI_SIG_SSDT) && !ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), - ACPI_SIG_PSDT)) || + ACPI_SIG_PSDT) && + !ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), + ACPI_SIG_OSDT)) || ACPI_FAILURE (AcpiTbValidateTable ( &AcpiGbl_RootTableList.Tables[i]))) { @@ -238,11 +241,11 @@ AcpiInstallTable ( if (Physical) { - Flags = ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL; + Flags = ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL; } else { - Flags = ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL; + Flags = ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL; } Status = AcpiTbInstallStandardTable (Address, Flags, diff --git a/source/components/utilities/utalloc.c b/source/components/utilities/utalloc.c index bb4194df0d89..d0b5c920634c 100644 --- a/source/components/utilities/utalloc.c +++ b/source/components/utilities/utalloc.c @@ -79,7 +79,7 @@ AcpiOsAllocateZeroed ( { /* Clear the memory block */ - ACPI_MEMSET (Allocation, 0, Size); + memset (Allocation, 0, Size); } return (Allocation); @@ -189,7 +189,7 @@ AcpiUtDeleteCaches ( if (AcpiGbl_DisplayFinalMemStats) { - ACPI_STRCPY (Buffer, "MEMORY"); + strcpy (Buffer, "MEMORY"); (void) AcpiDbDisplayStatistics (Buffer); } #endif @@ -359,6 +359,6 @@ AcpiUtInitializeBuffer ( /* Have a valid buffer, clear it */ - ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength); + memset (Buffer->Pointer, 0, RequiredLength); return (AE_OK); } diff --git a/source/components/utilities/utbuffer.c b/source/components/utilities/utbuffer.c index cf99b769922e..16a593f111bc 100644 --- a/source/components/utilities/utbuffer.c +++ b/source/components/utilities/utbuffer.c @@ -168,7 +168,7 @@ AcpiUtDumpBuffer ( } BufChar = Buffer[(ACPI_SIZE) i + j]; - if (ACPI_IS_PRINT (BufChar)) + if (isprint (BufChar)) { AcpiOsPrintf ("%c", BufChar); } @@ -341,7 +341,7 @@ AcpiUtDumpBufferToFile ( } BufChar = Buffer[(ACPI_SIZE) i + j]; - if (ACPI_IS_PRINT (BufChar)) + if (isprint (BufChar)) { AcpiUtFilePrintf (File, "%c", BufChar); } diff --git a/source/components/utilities/utcache.c b/source/components/utilities/utcache.c index c2211cc2adb9..7a0f210dff6a 100644 --- a/source/components/utilities/utcache.c +++ b/source/components/utilities/utcache.c @@ -92,7 +92,7 @@ AcpiOsCreateCache ( /* Populate the cache object and return it */ - ACPI_MEMSET (Cache, 0, sizeof (ACPI_MEMORY_LIST)); + memset (Cache, 0, sizeof (ACPI_MEMORY_LIST)); Cache->ListName = CacheName; Cache->ObjectSize = ObjectSize; Cache->MaxDepth = MaxDepth; @@ -242,7 +242,7 @@ AcpiOsReleaseObject ( /* Mark the object as cached */ - ACPI_MEMSET (Object, 0xCA, Cache->ObjectSize); + memset (Object, 0xCA, Cache->ObjectSize); ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_CACHED); /* Put the object at the head of the cache list */ @@ -318,7 +318,7 @@ AcpiOsAcquireObject ( /* Clear (zero) the previously used Object */ - ACPI_MEMSET (Object, 0, Cache->ObjectSize); + memset (Object, 0, Cache->ObjectSize); } else { diff --git a/source/components/utilities/utclib.c b/source/components/utilities/utclib.c index e68634b18bbb..6e3e9b4eb5b2 100644 --- a/source/components/utilities/utclib.c +++ b/source/components/utilities/utclib.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: cmclib - Local implementation of C library functions + * Module Name: utclib - ACPICA implementations of C library functions * *****************************************************************************/ @@ -41,20 +41,59 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#define ACPI_CLIBRARY #include "acpi.h" #include "accommon.h" /* - * These implementations of standard C Library routines can optionally be - * used if a C library is not available. In general, they are less efficient - * than an inline or assembly implementation + * This module contains implementations of the standard C library functions + * that are required by the ACPICA code at both application level and kernel + * level. + * + * The module is an optional feature that can be used if a local/system + * C library is not available. Some operating system kernels may not have + * an internal C library. + * + * In general, these functions are less efficient than an inline or assembly + * code implementation. + * + * These C functions and the associated prototypes are enabled by default + * unless the ACPI_USE_SYSTEM_CLIBRARY symbol is defined. This is usually + * automatically defined for the ACPICA applications such as iASL and + * AcpiExec, so that these user-level applications use the local C library + * instead of the functions in this module. */ + +/******************************************************************************* + * + * Functions implemented in this module: + * + * FUNCTION: memcmp + * FUNCTION: memcpy + * FUNCTION: memset + * FUNCTION: strlen + * FUNCTION: strcpy + * FUNCTION: strncpy + * FUNCTION: strcmp + * FUNCTION: strchr + * FUNCTION: strncmp + * FUNCTION: strcat + * FUNCTION: strncat + * FUNCTION: strstr + * FUNCTION: strtoul + * FUNCTION: toupper + * FUNCTION: tolower + * FUNCTION: is* functions + * + ******************************************************************************/ + + #define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("cmclib") + ACPI_MODULE_NAME ("utclib") -#ifndef ACPI_USE_SYSTEM_CLIBRARY +#ifndef ACPI_USE_SYSTEM_CLIBRARY /* Entire module */ #define NEGATIVE 1 #define POSITIVE 0 @@ -62,7 +101,7 @@ /******************************************************************************* * - * FUNCTION: AcpiUtMemcmp (memcmp) + * FUNCTION: memcmp * * PARAMETERS: Buffer1 - First Buffer * Buffer2 - Second Buffer @@ -75,11 +114,14 @@ ******************************************************************************/ int -AcpiUtMemcmp ( - const char *Buffer1, - const char *Buffer2, +memcmp ( + void *VBuffer1, + void *VBuffer2, ACPI_SIZE Count) { + char *Buffer1 = (char *) VBuffer1; + char *Buffer2 = (char *) VBuffer2; + for ( ; Count-- && (*Buffer1 == *Buffer2); Buffer1++, Buffer2++) { @@ -92,7 +134,7 @@ AcpiUtMemcmp ( /******************************************************************************* * - * FUNCTION: AcpiUtMemcpy (memcpy) + * FUNCTION: memcpy * * PARAMETERS: Dest - Target of the copy * Src - Source buffer to copy @@ -105,7 +147,7 @@ AcpiUtMemcmp ( ******************************************************************************/ void * -AcpiUtMemcpy ( +memcpy ( void *Dest, const void *Src, ACPI_SIZE Count) @@ -128,7 +170,7 @@ AcpiUtMemcpy ( /******************************************************************************* * - * FUNCTION: AcpiUtMemset (memset) + * FUNCTION: memset * * PARAMETERS: Dest - Buffer to set * Value - Value to set each byte of memory @@ -141,9 +183,9 @@ AcpiUtMemcpy ( ******************************************************************************/ void * -AcpiUtMemset ( +memset ( void *Dest, - UINT8 Value, + int Value, ACPI_SIZE Count) { char *New = (char *) Dest; @@ -162,7 +204,7 @@ AcpiUtMemset ( /******************************************************************************* * - * FUNCTION: AcpiUtStrlen (strlen) + * FUNCTION: strlen * * PARAMETERS: String - Null terminated string * @@ -174,7 +216,7 @@ AcpiUtMemset ( ACPI_SIZE -AcpiUtStrlen ( +strlen ( const char *String) { UINT32 Length = 0; @@ -194,7 +236,7 @@ AcpiUtStrlen ( /******************************************************************************* * - * FUNCTION: AcpiUtStrcpy (strcpy) + * FUNCTION: strcpy * * PARAMETERS: DstString - Target of the copy * SrcString - The source string to copy @@ -206,7 +248,7 @@ AcpiUtStrlen ( ******************************************************************************/ char * -AcpiUtStrcpy ( +strcpy ( char *DstString, const char *SrcString) { @@ -232,7 +274,7 @@ AcpiUtStrcpy ( /******************************************************************************* * - * FUNCTION: AcpiUtStrncpy (strncpy) + * FUNCTION: strncpy * * PARAMETERS: DstString - Target of the copy * SrcString - The source string to copy @@ -245,7 +287,7 @@ AcpiUtStrcpy ( ******************************************************************************/ char * -AcpiUtStrncpy ( +strncpy ( char *DstString, const char *SrcString, ACPI_SIZE Count) @@ -275,7 +317,7 @@ AcpiUtStrncpy ( /******************************************************************************* * - * FUNCTION: AcpiUtStrcmp (strcmp) + * FUNCTION: strcmp * * PARAMETERS: String1 - First string * String2 - Second string @@ -287,7 +329,7 @@ AcpiUtStrncpy ( ******************************************************************************/ int -AcpiUtStrcmp ( +strcmp ( const char *String1, const char *String2) { @@ -307,7 +349,7 @@ AcpiUtStrcmp ( /******************************************************************************* * - * FUNCTION: AcpiUtStrchr (strchr) + * FUNCTION: strchr * * PARAMETERS: String - Search string * ch - character to search for @@ -319,7 +361,7 @@ AcpiUtStrcmp ( ******************************************************************************/ char * -AcpiUtStrchr ( +strchr ( const char *String, int ch) { @@ -339,7 +381,7 @@ AcpiUtStrchr ( /******************************************************************************* * - * FUNCTION: AcpiUtStrncmp (strncmp) + * FUNCTION: strncmp * * PARAMETERS: String1 - First string * String2 - Second string @@ -352,7 +394,7 @@ AcpiUtStrchr ( ******************************************************************************/ int -AcpiUtStrncmp ( +strncmp ( const char *String1, const char *String2, ACPI_SIZE Count) @@ -374,7 +416,7 @@ AcpiUtStrncmp ( /******************************************************************************* * - * FUNCTION: AcpiUtStrcat (Strcat) + * FUNCTION: strcat * * PARAMETERS: DstString - Target of the copy * SrcString - The source string to copy @@ -386,7 +428,7 @@ AcpiUtStrncmp ( ******************************************************************************/ char * -AcpiUtStrcat ( +strcat ( char *DstString, const char *SrcString) { @@ -409,7 +451,7 @@ AcpiUtStrcat ( /******************************************************************************* * - * FUNCTION: AcpiUtStrncat (strncat) + * FUNCTION: strncat * * PARAMETERS: DstString - Target of the copy * SrcString - The source string to copy @@ -423,7 +465,7 @@ AcpiUtStrcat ( ******************************************************************************/ char * -AcpiUtStrncat ( +strncat ( char *DstString, const char *SrcString, ACPI_SIZE Count) @@ -457,7 +499,7 @@ AcpiUtStrncat ( /******************************************************************************* * - * FUNCTION: AcpiUtStrstr (strstr) + * FUNCTION: strstr * * PARAMETERS: String1 - Target string * String2 - Substring to search for @@ -471,22 +513,22 @@ AcpiUtStrncat ( ******************************************************************************/ char * -AcpiUtStrstr ( +strstr ( char *String1, char *String2) { UINT32 Length; - Length = AcpiUtStrlen (String2); + Length = strlen (String2); if (!Length) { return (String1); } - while (AcpiUtStrlen (String1) >= Length) + while (strlen (String1) >= Length) { - if (AcpiUtMemcmp (String1, String2, Length) == 0) + if (memcmp (String1, String2, Length) == 0) { return (String1); } @@ -499,7 +541,7 @@ AcpiUtStrstr ( /******************************************************************************* * - * FUNCTION: AcpiUtStrtoul (strtoul) + * FUNCTION: strtoul * * PARAMETERS: String - Null terminated string * Terminater - Where a pointer to the terminating byte is @@ -509,12 +551,12 @@ AcpiUtStrstr ( * RETURN: Converted value * * DESCRIPTION: Convert a string into a 32-bit unsigned value. - * Note: use AcpiUtStrtoul64 for 64-bit integers. + * Note: use strtoul64 for 64-bit integers. * ******************************************************************************/ UINT32 -AcpiUtStrtoul ( +strtoul ( const char *String, char **Terminator, UINT32 Base) @@ -533,7 +575,7 @@ AcpiUtStrtoul ( * skip over any white space in the buffer: */ StringStart = String; - while (ACPI_IS_SPACE (*String) || *String == '\t') + while (isspace (*String) || *String == '\t') { ++String; } @@ -565,7 +607,7 @@ AcpiUtStrtoul ( { if (*String == '0') { - if (AcpiUtToLower (*(++String)) == 'x') + if (tolower (*(++String)) == 'x') { Base = 16; ++String; @@ -600,7 +642,7 @@ AcpiUtStrtoul ( if (Base == 16 && *String == '0' && - AcpiUtToLower (*(++String)) == 'x') + tolower (*(++String)) == 'x') { String++; } @@ -610,14 +652,14 @@ AcpiUtStrtoul ( */ while (*String) { - if (ACPI_IS_DIGIT (*String)) + if (isdigit (*String)) { index = (UINT32) ((UINT8) *String - '0'); } else { - index = (UINT32) AcpiUtToUpper (*String); - if (ACPI_IS_UPPER (index)) + index = (UINT32) toupper (*String); + if (isupper (index)) { index = index - 'A' + 10; } @@ -688,7 +730,7 @@ done: /******************************************************************************* * - * FUNCTION: AcpiUtToUpper (TOUPPER) + * FUNCTION: toupper * * PARAMETERS: c - Character to convert * @@ -699,17 +741,17 @@ done: ******************************************************************************/ int -AcpiUtToUpper ( +toupper ( int c) { - return (ACPI_IS_LOWER(c) ? ((c)-0x20) : (c)); + return (islower(c) ? ((c)-0x20) : (c)); } /******************************************************************************* * - * FUNCTION: AcpiUtToLower (TOLOWER) + * FUNCTION: tolower * * PARAMETERS: c - Character to convert * @@ -720,11 +762,11 @@ AcpiUtToUpper ( ******************************************************************************/ int -AcpiUtToLower ( +tolower ( int c) { - return (ACPI_IS_UPPER(c) ? ((c)+0x20) : (c)); + return (isupper(c) ? ((c)+0x20) : (c)); } diff --git a/source/components/utilities/utcopy.c b/source/components/utilities/utcopy.c index 932faa3638c1..dc5ecda7731c 100644 --- a/source/components/utilities/utcopy.c +++ b/source/components/utilities/utcopy.c @@ -146,7 +146,7 @@ AcpiUtCopyIsimpleToEsimple ( /* Always clear the external object */ - ACPI_MEMSET (ExternalObject, 0, sizeof (ACPI_OBJECT)); + memset (ExternalObject, 0, sizeof (ACPI_OBJECT)); /* * In general, the external object will be the same type as @@ -165,7 +165,7 @@ AcpiUtCopyIsimpleToEsimple ( *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD ( (ACPI_SIZE) InternalObject->String.Length + 1); - ACPI_MEMCPY ((void *) DataSpace, + memcpy ((void *) DataSpace, (void *) InternalObject->String.Pointer, (ACPI_SIZE) InternalObject->String.Length + 1); break; @@ -177,7 +177,7 @@ AcpiUtCopyIsimpleToEsimple ( *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD ( InternalObject->String.Length); - ACPI_MEMCPY ((void *) DataSpace, + memcpy ((void *) DataSpace, (void *) InternalObject->Buffer.Pointer, InternalObject->Buffer.Length); break; @@ -528,7 +528,7 @@ AcpiUtCopyEsimpleToIsimple ( goto ErrorExit; } - ACPI_MEMCPY (InternalObject->String.Pointer, + memcpy (InternalObject->String.Pointer, ExternalObject->String.Pointer, ExternalObject->String.Length); @@ -544,7 +544,7 @@ AcpiUtCopyEsimpleToIsimple ( goto ErrorExit; } - ACPI_MEMCPY (InternalObject->Buffer.Pointer, + memcpy (InternalObject->Buffer.Pointer, ExternalObject->Buffer.Pointer, ExternalObject->Buffer.Length); @@ -732,7 +732,7 @@ AcpiUtCopySimpleObject ( CopySize = sizeof (ACPI_NAMESPACE_NODE); } - ACPI_MEMCPY (ACPI_CAST_PTR (char, DestDesc), + memcpy (ACPI_CAST_PTR (char, DestDesc), ACPI_CAST_PTR (char, SourceDesc), CopySize); /* Restore the saved fields */ @@ -766,7 +766,7 @@ AcpiUtCopySimpleObject ( /* Copy the actual buffer data */ - ACPI_MEMCPY (DestDesc->Buffer.Pointer, + memcpy (DestDesc->Buffer.Pointer, SourceDesc->Buffer.Pointer, SourceDesc->Buffer.Length); } break; @@ -788,7 +788,7 @@ AcpiUtCopySimpleObject ( /* Copy the actual string data */ - ACPI_MEMCPY (DestDesc->String.Pointer, SourceDesc->String.Pointer, + memcpy (DestDesc->String.Pointer, SourceDesc->String.Pointer, (ACPI_SIZE) SourceDesc->String.Length + 1); } break; diff --git a/source/components/utilities/utids.c b/source/components/utilities/utids.c index 2affb2137bc6..1b7f1f5dad8a 100644 --- a/source/components/utilities/utids.c +++ b/source/components/utilities/utids.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: utids - support for device IDs - HID, UID, CID + * Module Name: utids - support for device IDs - HID, UID, CID, SUB, CLS * *****************************************************************************/ @@ -121,7 +121,7 @@ AcpiUtExecute_HID ( } else { - ACPI_STRCPY (Hid->String, ObjDesc->String.Pointer); + strcpy (Hid->String, ObjDesc->String.Pointer); } Hid->Length = Length; @@ -194,7 +194,7 @@ AcpiUtExecute_SUB ( /* Simply copy existing string */ - ACPI_STRCPY (Sub->String, ObjDesc->String.Pointer); + strcpy (Sub->String, ObjDesc->String.Pointer); Sub->Length = Length; *ReturnId = Sub; @@ -279,7 +279,7 @@ AcpiUtExecute_UID ( } else { - ACPI_STRCPY (Uid->String, ObjDesc->String.Pointer); + strcpy (Uid->String, ObjDesc->String.Pointer); } Uid->Length = Length; @@ -426,7 +426,7 @@ AcpiUtExecute_CID ( { /* Copy the String CID from the returned object */ - ACPI_STRCPY (NextIdString, CidObjects[i]->String.Pointer); + strcpy (NextIdString, CidObjects[i]->String.Pointer); Length = CidObjects[i]->String.Length + 1; } @@ -449,3 +449,97 @@ Cleanup: AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); } + + +/******************************************************************************* + * + * FUNCTION: AcpiUtExecute_CLS + * + * PARAMETERS: DeviceNode - Node for the device + * ReturnId - Where the _CLS is returned + * + * RETURN: Status + * + * DESCRIPTION: Executes the _CLS control method that returns PCI-defined + * class code of the device. The _CLS value is always a package + * containing PCI class information as a list of integers. + * The returned string has format "BBSSPP", where: + * BB = Base-class code + * SS = Sub-class code + * PP = Programming Interface code + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtExecute_CLS ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_PNP_DEVICE_ID **ReturnId) +{ + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT **ClsObjects; + UINT32 Count; + ACPI_PNP_DEVICE_ID *Cls; + UINT32 Length; + ACPI_STATUS Status; + UINT8 ClassCode[3] = {0, 0, 0}; + + + ACPI_FUNCTION_TRACE (UtExecute_CLS); + + + Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CLS, + ACPI_BTYPE_PACKAGE, &ObjDesc); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Get the size of the String to be returned, includes null terminator */ + + Length = ACPI_PCICLS_STRING_SIZE; + ClsObjects = ObjDesc->Package.Elements; + Count = ObjDesc->Package.Count; + + if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE) + { + if (Count > 0 && ClsObjects[0]->Common.Type == ACPI_TYPE_INTEGER) + { + ClassCode[0] = (UINT8) ClsObjects[0]->Integer.Value; + } + if (Count > 1 && ClsObjects[1]->Common.Type == ACPI_TYPE_INTEGER) + { + ClassCode[1] = (UINT8) ClsObjects[1]->Integer.Value; + } + if (Count > 2 && ClsObjects[2]->Common.Type == ACPI_TYPE_INTEGER) + { + ClassCode[2] = (UINT8) ClsObjects[2]->Integer.Value; + } + } + + /* Allocate a buffer for the CLS */ + + Cls = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); + if (!Cls) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + /* Area for the string starts after PNP_DEVICE_ID struct */ + + Cls->String = ACPI_ADD_PTR (char, Cls, sizeof (ACPI_PNP_DEVICE_ID)); + + /* Simply copy existing string */ + + AcpiExPciClsToString (Cls->String, ClassCode); + Cls->Length = Length; + *ReturnId = Cls; + + +Cleanup: + + /* On exit, we must delete the return object */ + + AcpiUtRemoveReference (ObjDesc); + return_ACPI_STATUS (Status); +} diff --git a/source/components/utilities/utmisc.c b/source/components/utilities/utmisc.c index d482ad58782a..8ac133a2c21a 100644 --- a/source/components/utilities/utmisc.c +++ b/source/components/utilities/utmisc.c @@ -71,10 +71,10 @@ AcpiUtIsPciRootBridge ( * Check if this is a PCI root bridge. * ACPI 3.0+: check for a PCI Express root also. */ - if (!(ACPI_STRCMP (Id, + if (!(strcmp (Id, PCI_ROOT_HID_STRING)) || - !(ACPI_STRCMP (Id, + !(strcmp (Id, PCI_EXPRESS_ROOT_HID_STRING))) { return (TRUE); @@ -108,7 +108,8 @@ AcpiUtIsAmlTable ( if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT) || ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_PSDT) || - ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_SSDT)) + ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_SSDT) || + ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_OSDT)) { return (TRUE); } diff --git a/source/components/utilities/utosi.c b/source/components/utilities/utosi.c index f2c1adf70c34..30cba5422389 100644 --- a/source/components/utilities/utosi.c +++ b/source/components/utilities/utosi.c @@ -256,7 +256,7 @@ AcpiUtInstallInterface ( return (AE_NO_MEMORY); } - InterfaceInfo->Name = ACPI_ALLOCATE_ZEROED (ACPI_STRLEN (InterfaceName) + 1); + InterfaceInfo->Name = ACPI_ALLOCATE_ZEROED (strlen (InterfaceName) + 1); if (!InterfaceInfo->Name) { ACPI_FREE (InterfaceInfo); @@ -265,7 +265,7 @@ AcpiUtInstallInterface ( /* Initialize new info and insert at the head of the global list */ - ACPI_STRCPY (InterfaceInfo->Name, InterfaceName); + strcpy (InterfaceInfo->Name, InterfaceName); InterfaceInfo->Flags = ACPI_OSI_DYNAMIC; InterfaceInfo->Next = AcpiGbl_SupportedInterfaces; @@ -298,7 +298,7 @@ AcpiUtRemoveInterface ( PreviousInterface = NextInterface = AcpiGbl_SupportedInterfaces; while (NextInterface) { - if (!ACPI_STRCMP (InterfaceName, NextInterface->Name)) + if (!strcmp (InterfaceName, NextInterface->Name)) { /* Found: name is in either the static list or was added at runtime */ @@ -419,7 +419,7 @@ AcpiUtGetInterface ( NextInterface = AcpiGbl_SupportedInterfaces; while (NextInterface) { - if (!ACPI_STRCMP (InterfaceName, NextInterface->Name)) + if (!strcmp (InterfaceName, NextInterface->Name)) { return (NextInterface); } diff --git a/source/components/utilities/utpredef.c b/source/components/utilities/utpredef.c index 205fa45e6f77..1b7ef34181cb 100644 --- a/source/components/utilities/utpredef.c +++ b/source/components/utilities/utpredef.c @@ -166,7 +166,7 @@ AcpiUtGetExpectedReturnTypes ( if (!ExpectedBtypes) { - ACPI_STRCPY (Buffer, "NONE"); + strcpy (Buffer, "NONE"); return; } @@ -180,7 +180,7 @@ AcpiUtGetExpectedReturnTypes ( if (ExpectedBtypes & ThisRtype) { - ACPI_STRCAT (Buffer, &UtRtypeNames[i][j]); + strcat (Buffer, &UtRtypeNames[i][j]); j = 0; /* Use name separator from now on */ } diff --git a/source/components/utilities/utprint.c b/source/components/utilities/utprint.c index ffb5e6ad24d1..832d04fd35c2 100644 --- a/source/components/utilities/utprint.c +++ b/source/components/utilities/utprint.c @@ -227,7 +227,7 @@ AcpiUtScanNumber ( UINT64 Number = 0; - while (ACPI_IS_DIGIT (*String)) + while (isdigit (*String)) { Number *= 10; Number += *(String++) - '0'; @@ -505,7 +505,7 @@ AcpiUtVsnprintf ( /* Process width */ Width = -1; - if (ACPI_IS_DIGIT (*Format)) + if (isdigit (*Format)) { Format = AcpiUtScanNumber (Format, &Number); Width = (INT32) Number; @@ -527,7 +527,7 @@ AcpiUtVsnprintf ( if (*Format == '.') { ++Format; - if (ACPI_IS_DIGIT(*Format)) + if (isdigit(*Format)) { Format = AcpiUtScanNumber (Format, &Number); Precision = (INT32) Number; diff --git a/source/components/utilities/utstring.c b/source/components/utilities/utstring.c index 035d5ba8d3b2..737903d334df 100644 --- a/source/components/utilities/utstring.c +++ b/source/components/utilities/utstring.c @@ -89,7 +89,7 @@ AcpiUtStrlwr ( for (String = SrcString; *String; String++) { - *String = (char) ACPI_TOLOWER (*String); + *String = (char) tolower (*String); } return; @@ -168,7 +168,7 @@ AcpiUtStrupr ( for (String = SrcString; *String; String++) { - *String = (char) ACPI_TOUPPER (*String); + *String = (char) toupper (*String); } return; @@ -234,7 +234,7 @@ AcpiUtStrtoul64 ( /* Skip over any white space in the buffer */ - while ((*String) && (ACPI_IS_SPACE (*String) || *String == '\t')) + while ((*String) && (isspace (*String) || *String == '\t')) { String++; } @@ -245,7 +245,7 @@ AcpiUtStrtoul64 ( * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'. * We need to determine if it is decimal or hexadecimal. */ - if ((*String == '0') && (ACPI_TOLOWER (*(String + 1)) == 'x')) + if ((*String == '0') && (tolower (*(String + 1)) == 'x')) { SignOf0x = 1; Base = 16; @@ -261,7 +261,7 @@ AcpiUtStrtoul64 ( /* Any string left? Check that '0x' is not followed by white space. */ - if (!(*String) || ACPI_IS_SPACE (*String) || *String == '\t') + if (!(*String) || isspace (*String) || *String == '\t') { if (ToIntegerOp) { @@ -283,7 +283,7 @@ AcpiUtStrtoul64 ( while (*String) { - if (ACPI_IS_DIGIT (*String)) + if (isdigit (*String)) { /* Convert ASCII 0-9 to Decimal value */ @@ -297,8 +297,8 @@ AcpiUtStrtoul64 ( } else { - ThisDigit = (UINT8) ACPI_TOUPPER (*String); - if (ACPI_IS_XDIGIT ((char) ThisDigit)) + ThisDigit = (UINT8) toupper (*String); + if (isxdigit ((char) ThisDigit)) { /* Convert ASCII Hex char to value */ @@ -469,7 +469,7 @@ AcpiUtPrintString ( /* Check for printable character or hex escape */ - if (ACPI_IS_PRINT (String[i])) + if (isprint (String[i])) { /* This is a normal character */ @@ -711,12 +711,12 @@ AcpiUtSafeStrcpy ( char *Source) { - if (ACPI_STRLEN (Source) >= DestSize) + if (strlen (Source) >= DestSize) { return (TRUE); } - ACPI_STRCPY (Dest, Source); + strcpy (Dest, Source); return (FALSE); } @@ -727,12 +727,12 @@ AcpiUtSafeStrcat ( char *Source) { - if ((ACPI_STRLEN (Dest) + ACPI_STRLEN (Source)) >= DestSize) + if ((strlen (Dest) + strlen (Source)) >= DestSize) { return (TRUE); } - ACPI_STRCAT (Dest, Source); + strcat (Dest, Source); return (FALSE); } @@ -746,14 +746,14 @@ AcpiUtSafeStrncat ( ACPI_SIZE ActualTransferLength; - ActualTransferLength = ACPI_MIN (MaxTransferLength, ACPI_STRLEN (Source)); + ActualTransferLength = ACPI_MIN (MaxTransferLength, strlen (Source)); - if ((ACPI_STRLEN (Dest) + ActualTransferLength) >= DestSize) + if ((strlen (Dest) + ActualTransferLength) >= DestSize) { return (TRUE); } - ACPI_STRNCAT (Dest, Source, MaxTransferLength); + strncat (Dest, Source, MaxTransferLength); return (FALSE); } #endif diff --git a/source/components/utilities/uttrack.c b/source/components/utilities/uttrack.c index 44ef0ed7eae4..7a594be88fc2 100644 --- a/source/components/utilities/uttrack.c +++ b/source/components/utilities/uttrack.c @@ -113,7 +113,7 @@ AcpiUtCreateList ( return (AE_NO_MEMORY); } - ACPI_MEMSET (Cache, 0, sizeof (ACPI_MEMORY_LIST)); + memset (Cache, 0, sizeof (ACPI_MEMORY_LIST)); Cache->ListName = ListName; Cache->ObjectSize = ObjectSize; @@ -445,7 +445,7 @@ AcpiUtTrackAllocation ( Allocation->Component = Component; Allocation->Line = Line; - ACPI_STRNCPY (Allocation->Module, Module, ACPI_MAX_MODULE_NAME); + strncpy (Allocation->Module, Module, ACPI_MAX_MODULE_NAME); Allocation->Module[ACPI_MAX_MODULE_NAME-1] = 0; if (!Element) @@ -556,7 +556,7 @@ AcpiUtRemoveAllocation ( /* Mark the segment as deleted */ - ACPI_MEMSET (&Allocation->UserSpace, 0xEA, Allocation->Size); + memset (&Allocation->UserSpace, 0xEA, Allocation->Size); Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY); return (Status); @@ -667,7 +667,7 @@ AcpiUtDumpAllocations ( while (Element) { if ((Element->Component & Component) && - ((Module == NULL) || (0 == ACPI_STRCMP (Module, Element->Module)))) + ((Module == NULL) || (0 == strcmp (Module, Element->Module)))) { Descriptor = ACPI_CAST_PTR (ACPI_DESCRIPTOR, &Element->UserSpace); diff --git a/source/components/utilities/utxface.c b/source/components/utilities/utxface.c index 4266dcebc1d7..2c6ff38c8d9a 100644 --- a/source/components/utilities/utxface.c +++ b/source/components/utilities/utxface.c @@ -263,7 +263,7 @@ AcpiGetStatistics ( Stats->SciCount = AcpiSciCount; Stats->GpeCount = AcpiGpeCount; - ACPI_MEMCPY (Stats->FixedEventCount, AcpiFixedEventCount, + memcpy (Stats->FixedEventCount, AcpiFixedEventCount, sizeof (AcpiFixedEventCount)); @@ -367,7 +367,7 @@ AcpiInstallInterface ( /* Parameter validation */ - if (!InterfaceName || (ACPI_STRLEN (InterfaceName) == 0)) + if (!InterfaceName || (strlen (InterfaceName) == 0)) { return (AE_BAD_PARAMETER); } @@ -432,7 +432,7 @@ AcpiRemoveInterface ( /* Parameter validation */ - if (!InterfaceName || (ACPI_STRLEN (InterfaceName) == 0)) + if (!InterfaceName || (strlen (InterfaceName) == 0)) { return (AE_BAD_PARAMETER); } |