Merge ACPICA 20150619.

This commit is contained in:
Jung-uk Kim 2015-06-18 23:14:45 +00:00
commit 5ef5072350
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=284583
147 changed files with 1669 additions and 806 deletions

View File

@ -19,20 +19,20 @@ fulldirs="common compiler components include os_specific"
# files to remove
stripdirs="generate libraries tests tools"
stripfiles="Makefile README accygwin.h acdragonfly.h acdragonflyex.h \
acefi.h achaiku.h acintel.h aclinux.h aclinuxex.h acmacosx.h \
acmsvc.h acnetbsd.h acos2.h acwin.h acwin64.h new_table.txt \
osbsdtbl.c osefitbl.c osefixf.c osfreebsdtbl.c oslinuxtbl.c \
osunixdir.c osunixmap.c oswindir.c oswintbl.c oswinxf.c \
readme.txt utclib.c"
acefi.h acefiex.h achaiku.h acintel.h aclinux.h aclinuxex.h \
acmacosx.h acmsvc.h acnetbsd.h acos2.h acwin.h acwin64.h \
new_table.txt osbsdtbl.c osefitbl.c osefixf.c osfreebsdtbl.c \
oslinuxtbl.c osunixdir.c osunixmap.c oswindir.c oswintbl.c \
oswinxf.c readme.txt utclib.c"
# include files to canonify
src_headers="acapps.h acbuffer.h accommon.h acconfig.h acdebug.h \
acdisasm.h acdispat.h acevents.h acexcep.h acglobal.h achware.h \
acinterp.h aclocal.h acmacros.h acnames.h acnamesp.h acobject.h \
acopcode.h acoutput.h acparser.h acpi.h acpiosxf.h acpixf.h \
acpredef.h acresrc.h acrestyp.h acstruct.h actables.h actbl.h \
actbl1.h actbl2.h actbl3.h actypes.h acutils.h amlcode.h \
amlresrc.h platform/acenv.h platform/acenvex.h \
src_headers="acapps.h acbuffer.h acclib.h accommon.h acconfig.h \
acdebug.h acdisasm.h acdispat.h acevents.h acexcep.h acglobal.h \
achware.h acinterp.h aclocal.h acmacros.h acnames.h acnamesp.h \
acobject.h acopcode.h acoutput.h acparser.h acpi.h acpiosxf.h \
acpixf.h acpredef.h acresrc.h acrestyp.h acstruct.h actables.h \
actbl.h actbl1.h actbl2.h actbl3.h actypes.h acutils.h acuuid.h \
amlcode.h amlresrc.h platform/acenv.h platform/acenvex.h \
platform/acfreebsd.h platform/acgcc.h"
comp_headers="aslcompiler.h asldefine.h aslglobal.h aslmessages.h \
aslsupport.l asltypes.h dtcompiler.h dttemplate.h preprocess.h"

View File

@ -1,5 +1,130 @@
----------------------------------------
08 April 2015. Summary of changes for version 20150515:
19 June 2015. Summary of changes for version 20150619:
Two regressions in version 20150616 have been addressed:
Fixes some problems/issues with the C library macro removal (ACPI_STRLEN,
etc.) This update changes ACPICA to only use the standard headers for
functions, or the prototypes for the local versions of the C library
functions. Across the source code, this required some additional casts
for some Clib invocations for portability. Moved all local prototypes to
a new file, acclib.h
Fixes several problems with recent changes to the handling of the FACS
table that could cause some systems not to boot.
----------------------------------------
16 June 2015. Summary of changes for version 20150616:
1) ACPICA kernel-resident subsystem:
Across the entire ACPICA source code base, the various macros for the C
library functions (such as ACPI_STRLEN, etc.) have been removed and
replaced by the standard C library names (strlen, etc.) The original
purpose for these macros is no longer applicable. This simplification
reduces the number of macros used in the ACPICA source code
significantly, improving readability and maintainability.
Implemented support for a new ACPI table, the OSDT. This table, the
"override" SDT, can be loaded directly by the host OS at boot time. It
enables the replacement of existing namespace objects that were installed
via the DSDT and/or SSDTs. The primary purpose for this is to replace
buggy or incorrect ASL/AML code obtained via the BIOS. The OSDT is slated
for inclusion in a future version of the ACPI Specification. Lv Zheng/Bob
Moore.
Added support for systems with (improperly) two FACS tables -- a "32-bit"
table (via FADT 32-bit legacy field) and a "64-bit" table (via the 64-bit
X field). This change will support both automatically. There continues to
be systems found with this issue. This support requires a change to the
AcpiSetFirmwareWakingVector interface. Also, a public global variable has
been added to allow the host to select which FACS is desired
(AcpiGbl_Use32BitFacsAddresses). See the ACPICA reference for more
details Lv Zheng.
Added a new feature to allow for systems that do not contain an FACS.
Although this is already supported on hardware-reduced platforms, the
feature has been extended for all platforms. The reasoning is that we do
not want to abort the entire ACPICA initialization just because the
system is seriously buggy and has no FACS.
Fixed a problem where the GUID strings for NFIT tables (in acuuid.h) were
not correctly transcribed from the ACPI specification in ACPICA version
20150515.
Implemented support for the _CLS object in the AcpiGetObjectInfo external
interface.
Updated the definitions of the TCPA and TPM2 ACPI tables to the more
recent TCG ACPI Specification, December 14, 2014. Table disassembler and
compiler also updated. Note: The TCPA "server" table is not supported by
the disassembler/table-compiler at this time.
ACPI 6.0: Added definitions for the new GIC version field in the MADT.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The
debug version of the code includes the debug output trace mechanism and
has a much larger code and data size.
Current Release:
Non-Debug Version: 100.6K Code, 27.6K Data, 128.2K Total
Debug Version: 196.2K Code, 81.0K Data, 277.2K Total
Previous Release:
Non-Debug Version: 99.9K Code, 27.5K Data, 127.4K Total
Debug Version: 195.2K Code, 80.8K Data, 276.0K Total
2) iASL Compiler/Disassembler and Tools:
Disassembler: Fixed a problem with the new symbolic operator disassembler
where incorrect ASL code could be emitted in some cases for the "non-
commutative" operators -- Subtract, Divide, Modulo, ShiftLeft, and
ShiftRight. The actual problem cases seem to be rather unusual in common
ASL code, however. David Box.
Modified the linux version of acpidump to obtain ACPI tables from not
just /dev/mem (which may not exist) and /sys/firmware/acpi/tables. Lv
Zheng.
iASL: Fixed a problem where the user preprocessor output file (.i)
contained extra data that was not expected. The compiler was using this
file as a temporary file and passed through #line directives in order to
keep compiler error messages in sync with the input file and line number
across multiple include files. The (.i) is no longer a temporary file as
the compiler uses a new, different file for the original purpose.
iASL: Fixed a problem where comments within the original ASL source code
file were not passed through to the preprocessor output file, nor any
listing files.
iASL: Fixed some issues for the handling of the "#include" preprocessor
directive and the similar (but not the same) "Include" ASL operator.
iASL: Add support for the new OSDT in both the disassembler and compiler.
iASL: Fixed a problem with the constant folding support where a Buffer
object could be incorrectly generated (incorrectly formed) during a
conversion to a Store() operator.
AcpiHelp: Updated for new NFIT GUIDs, "External" AML opcode, and new
description text for the _REV predefined name. _REV now permanently
returns 2, as per the ACPI 6.0 specification.
Debugger: Enhanced the output of the Debug ASL object for references
produced by the Index operator. For Buffers and strings, only output the
actual byte pointed to by the index. For packages, only print the single
package element decoded by the index. Previously, the entire
buffer/string/package was emitted.
iASL/Table-compiler: Fixed a regression where the "generic" data types
were no longer recognized, causing errors.
----------------------------------------
15 May 2015. Summary of changes for version 20150515:
This release implements most of ACPI 6.0 as described below.
@ -34,7 +159,7 @@ iASL disassembler and table compiler: Added ACPI 6.0 changes to existing
tables: FADT, MADT.
iASL preprocessor: Added a new directive to enable inclusion of binary
blobs into ASL code. The new directive is #includebinary. It takes a
blobs into ASL code. The new directive is #includebuffer. It takes a
binary file as input and emits a named ascii buffer object into the ASL
code.

View File

@ -243,7 +243,7 @@ AdAmlDisassemble (
while (ExternalFileList)
{
ExternalFilename = ExternalFileList->Path;
if (!ACPI_STRCMP (ExternalFilename, Filename))
if (!strcmp (ExternalFilename, Filename))
{
/* Next external file */

View File

@ -230,7 +230,7 @@ AcpiAhMatchHardwareId (
for (Info = AslDeviceIds; Info->Name; Info++)
{
if (!ACPI_STRCMP (HardwareId, Info->Name))
if (!strcmp (HardwareId, Info->Name))
{
return (Info);
}

View File

@ -249,7 +249,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] =
AH_PREDEF ("_RBW", "Register Bit Width", "Resource Descriptor field"),
AH_PREDEF ("_RDI", "Resource Dependencies for Idle", "Returns a list of dependencies for idle states"),
AH_PREDEF ("_REG", "Region Availability", "Inform AML code of an operation region availability change"),
AH_PREDEF ("_REV", "Supported ACPI Revision", "Returns the revision of the ACPI specification that is implemented"),
AH_PREDEF ("_REV", "Supported Integer Width", "Returns the supported integer width (<= 1: 32 bits only, >=2: both 32 and 64 bits"),
AH_PREDEF ("_RMV", "Removal Status", "Returns a device's removal ability status (docking)"),
AH_PREDEF ("_RNG", "Range", "Memory range type, Resource Descriptor field"),
AH_PREDEF ("_RST", "Device Reset", "Executes a reset on a device"),

View File

@ -122,7 +122,7 @@ AcpiAhMatchUuid (
AcpiUtConvertStringToUuid (Info->String, UuidBuffer);
if (!ACPI_MEMCMP (Data, UuidBuffer, UUID_BUFFER_LENGTH))
if (!memcmp (Data, UuidBuffer, UUID_BUFFER_LENGTH))
{
return (Info->Description);
}

View File

@ -224,7 +224,7 @@ AcpiDmNormalizeParentPrefix (
return (NULL);
}
Length = (ACPI_STRLEN (ParentPath) + ACPI_STRLEN (Path) + 1);
Length = (strlen (ParentPath) + strlen (Path) + 1);
if (ParentPath[1])
{
/*
@ -253,7 +253,7 @@ AcpiDmNormalizeParentPrefix (
*
* Copy the parent path
*/
ACPI_STRCPY (Fullpath, &ParentPath[Index]);
strcpy (Fullpath, &ParentPath[Index]);
/*
* Add dot separator
@ -261,12 +261,12 @@ AcpiDmNormalizeParentPrefix (
*/
if (ParentPath[1])
{
ACPI_STRCAT (Fullpath, ".");
strcat (Fullpath, ".");
}
/* Copy child path (carat parent prefix(es) were skipped above) */
ACPI_STRCAT (Fullpath, Path);
strcat (Fullpath, Path);
Cleanup:
ACPI_FREE (ParentPath);
@ -648,13 +648,13 @@ AcpiDmAddNodeToExternalList (
if ((*ExternalPath == AML_ROOT_PREFIX) && (ExternalPath[1]))
{
Temp = ACPI_ALLOCATE_ZEROED (ACPI_STRLEN (ExternalPath) + 1);
Temp = ACPI_ALLOCATE_ZEROED (strlen (ExternalPath) + 1);
if (!Temp)
{
return_VOID;
}
ACPI_STRCPY (Temp, &ExternalPath[1]);
strcpy (Temp, &ExternalPath[1]);
ACPI_FREE (ExternalPath);
ExternalPath = Temp;
}
@ -806,7 +806,7 @@ AcpiDmCreateNewExternal (
NextExternal = AcpiGbl_ExternalList;
while (NextExternal)
{
if (!ACPI_STRCMP (ExternalPath, NextExternal->Path))
if (!strcmp (ExternalPath, NextExternal->Path))
{
/* Duplicate method, check that the Value (ArgCount) is the same */
@ -849,7 +849,7 @@ AcpiDmCreateNewExternal (
NewExternal->Value = Value;
NewExternal->Path = ExternalPath;
NewExternal->Type = Type;
NewExternal->Length = (UINT16) ACPI_STRLEN (ExternalPath);
NewExternal->Length = (UINT16) strlen (ExternalPath);
NewExternal->InternalPath = InternalPath;
/* Link the new descriptor into the global list, alphabetically ordered */

View File

@ -679,10 +679,10 @@ AcpiGetTagPathname (
* end up in the final compiled AML, it's just an appearance issue for the
* disassembled code.
*/
Pathname[ACPI_STRLEN (Pathname) - ACPI_NAME_SIZE] = 0;
ACPI_STRNCAT (Pathname, ResourceNode->Name.Ascii, ACPI_NAME_SIZE);
ACPI_STRCAT (Pathname, ".");
ACPI_STRNCAT (Pathname, Tag, ACPI_NAME_SIZE);
Pathname[strlen (Pathname) - ACPI_NAME_SIZE] = 0;
strncat (Pathname, ResourceNode->Name.Ascii, ACPI_NAME_SIZE);
strcat (Pathname, ".");
strncat (Pathname, Tag, ACPI_NAME_SIZE);
/* Internalize the namepath to AML format */

View File

@ -528,7 +528,7 @@ AcpiDmDumpDataTable (
TableData = AcpiDmGetTableData (Table->Signature);
if (!TableData)
{
if (!ACPI_STRNCMP (Table->Signature, "OEM", 3))
if (!strncmp (Table->Signature, "OEM", 3))
{
AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
Table->Signature);
@ -856,7 +856,7 @@ AcpiDmDumpTable (
case ACPI_DMT_STRING:
ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1;
ByteLength = strlen (ACPI_CAST_PTR (char, Target)) + 1;
break;
case ACPI_DMT_GAS:

View File

@ -155,7 +155,7 @@ AcpiDmDumpUnicode (
for (i = 0; i < Length; i += 2)
{
if (!ACPI_IS_PRINT (Buffer[i]))
if (!isprint (Buffer[i]))
{
goto DumpRawBuffer;
}
@ -1701,7 +1701,7 @@ AcpiDmDumpIort (
InfoTable = AcpiDmTableInfoIort1;
Length = ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT, DeviceName);
String = ACPI_ADD_PTR (char, IortNode, NodeOffset + Length);
Length += ACPI_STRLEN (String) + 1;
Length += strlen (String) + 1;
break;
case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
@ -3344,7 +3344,7 @@ AcpiDmDumpStao (
while (Offset < Table->Length)
{
Namepath = ACPI_ADD_PTR (char, Table, Offset);
StringLength = ACPI_STRLEN (Namepath) + 1;
StringLength = strlen (Namepath) + 1;
AcpiDmLineHeader (Offset, StringLength, "Namestring");
AcpiOsPrintf ("\"%s\"\n", Namepath);

View File

@ -113,7 +113,7 @@
#define ACPI_SPMI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPMI,f)
#define ACPI_SRAT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SRAT,f)
#define ACPI_STAO_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_STAO,f)
#define ACPI_TCPA_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA,f)
#define ACPI_TCPA_CLIENT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA_CLIENT,f)
#define ACPI_TPM2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TPM2,f)
#define ACPI_UEFI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_UEFI,f)
#define ACPI_WAET_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WAET,f)
@ -2611,15 +2611,15 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoStaoStr[] =
/*******************************************************************************
*
* TCPA - Trusted Computing Platform Alliance table
* TCPA - Trusted Computing Platform Alliance table (Client)
*
******************************************************************************/
ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[] =
{
{ACPI_DMT_UINT16, ACPI_TCPA_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT32, ACPI_TCPA_OFFSET (MaxLogLength), "Max Event Log Length", 0},
{ACPI_DMT_UINT64, ACPI_TCPA_OFFSET (LogAddress), "Event Log Address", 0},
{ACPI_DMT_UINT16, ACPI_TCPA_CLIENT_OFFSET (PlatformClass), "Platform Class", 0},
{ACPI_DMT_UINT32, ACPI_TCPA_CLIENT_OFFSET (MinimumLogLength), "Min Event Log Length", 0},
{ACPI_DMT_UINT64, ACPI_TCPA_CLIENT_OFFSET (LogAddress), "Event Log Address", 0},
ACPI_DMT_TERMINATOR
};
@ -2632,7 +2632,8 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[] =
ACPI_DMTABLE_INFO AcpiDmTableInfoTpm2[] =
{
{ACPI_DMT_UINT32, ACPI_TPM2_OFFSET (Flags), "Flags", 0},
{ACPI_DMT_UINT16, ACPI_TPM2_OFFSET (PlatformClass), "Platform Class", 0},
{ACPI_DMT_UINT16, ACPI_TPM2_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT64, ACPI_TPM2_OFFSET (ControlAddress), "Control Address", 0},
{ACPI_DMT_UINT32, ACPI_TPM2_OFFSET (StartMethod), "Start Method", 0},
ACPI_DMT_TERMINATOR

View File

@ -145,7 +145,7 @@ AcpiGetopt(
{
return (ACPI_OPT_END);
}
else if (ACPI_STRCMP (argv[AcpiGbl_Optind], "--") == 0)
else if (strcmp (argv[AcpiGbl_Optind], "--") == 0)
{
AcpiGbl_Optind++;
return (ACPI_OPT_END);
@ -159,7 +159,7 @@ AcpiGetopt(
/* Make sure that the option is legal */
if (CurrentChar == ':' ||
(OptsPtr = ACPI_STRCHR (opts, CurrentChar)) == NULL)
(OptsPtr = strchr (opts, CurrentChar)) == NULL)
{
ACPI_OPTION_ERROR ("Illegal option: -", CurrentChar);

View File

@ -67,8 +67,8 @@ AnIsInternalMethod (
ACPI_PARSE_OBJECT *Op)
{
if ((!ACPI_STRCMP (Op->Asl.ExternalName, "\\_OSI")) ||
(!ACPI_STRCMP (Op->Asl.ExternalName, "_OSI")))
if ((!strcmp (Op->Asl.ExternalName, "\\_OSI")) ||
(!strcmp (Op->Asl.ExternalName, "_OSI")))
{
return (TRUE);
}
@ -94,8 +94,8 @@ AnGetInternalMethodReturnType (
ACPI_PARSE_OBJECT *Op)
{
if ((!ACPI_STRCMP (Op->Asl.ExternalName, "\\_OSI")) ||
(!ACPI_STRCMP (Op->Asl.ExternalName, "_OSI")))
if ((!strcmp (Op->Asl.ExternalName, "\\_OSI")) ||
(!strcmp (Op->Asl.ExternalName, "_OSI")))
{
return (ACPI_BTYPE_STRING);
}
@ -462,7 +462,7 @@ ApCheckForGpeNameConflict (
/* Verify 3rd/4th chars are a valid hex value */
GpeNumber = ACPI_STRTOUL (&Name[2], NULL, 16);
GpeNumber = strtoul (&Name[2], NULL, 16);
if (GpeNumber == ACPI_UINT32_MAX)
{
return;

View File

@ -226,7 +226,7 @@ FlCheckForAscii (
/* Ensure character is either printable or a "space" char */
else if (!ACPI_IS_PRINT (Byte) && !ACPI_IS_SPACE (Byte))
else if (!isprint (Byte) && !isspace (Byte))
{
if ((BadBytes < 10) && (DisplayErrors))
{

View File

@ -110,7 +110,7 @@ CgGenerateAmlOutput (
DbgPrint (ASL_TREE_OUTPUT,
"%*s Value P_Op A_Op OpLen PByts Len SubLen PSubLen OpPtr"
" Parent Child Next Flags AcTyp Final Col L\n",
" Parent Child Next Flags AcTyp Final Col L# EL# LL# ELL#\n",
76, " ");
CgCloseTable ();
@ -145,7 +145,7 @@ CgAmlWriteWalk (
"Final parse tree used for AML output:\n");
DbgPrint (ASL_TREE_OUTPUT,
"%*s Value P_Op A_Op OpLen PByts Len SubLen PSubLen OpPtr"
" Parent Child Next Flags AcTyp Final Col L\n",
" Parent Child Next Flags AcTyp Final Col L# EL# LL# ELL#\n",
76, " ");
}
@ -169,7 +169,7 @@ CgAmlWriteWalk (
DbgPrint (ASL_TREE_OUTPUT,
"%08X %04X %04X %01X %04X %04X %04X %04X "
"%08X %08X %08X %08X %08X %08X %04X %02d %02d\n",
"%08X %08X %08X %08X %08X %08X %04X %02d %02d %02d %02d %02d\n",
/* 1 */ (UINT32) Op->Asl.Value.Integer,
/* 2 */ Op->Asl.ParseOpcode,
/* 3 */ Op->Asl.AmlOpcode,
@ -186,7 +186,10 @@ CgAmlWriteWalk (
/* 14 */ Op->Asl.AcpiBtype,
/* 15 */ Op->Asl.FinalAmlLength,
/* 16 */ Op->Asl.Column,
/* 17 */ Op->Asl.LineNumber);
/* 17 */ Op->Asl.LineNumber,
/* 18 */ Op->Asl.EndLine,
/* 19 */ Op->Asl.LogicalLineNumber,
/* 20 */ Op->Asl.EndLogicalLine);
/* Generate the AML for this node */

View File

@ -103,6 +103,9 @@ CmDoCompile (
/* Preprocessor */
PrDoPreprocess ();
Gbl_CurrentLineNumber = 1;
Gbl_LogicalLineNumber = 1;
if (Gbl_PreprocessOnly)
{
UtEndEvent (Event);
@ -112,6 +115,7 @@ CmDoCompile (
}
UtEndEvent (Event);
/* Build the parse tree */
Event = UtBeginEvent ("Parse source code and build parse tree");
@ -708,7 +712,7 @@ CmCleanupAndExit (
/* Close all open files */
/*
* Take care with the preprocessor file (.i), it might be the same
* Take care with the preprocessor file (.pre), it might be the same
* as the "input" file, depending on where the compiler has terminated
* or aborted. Prevent attempt to close the same file twice in
* loop below.
@ -733,10 +737,9 @@ CmCleanupAndExit (
FlDeleteFile (ASL_FILE_AML_OUTPUT);
}
/* Delete the preprocessor output file (.i) unless -li flag is set */
/* Delete the preprocessor temp file unless full debug was specified */
if (!Gbl_PreprocessorOutputFlag &&
Gbl_PreprocessFlag)
if (Gbl_PreprocessFlag && !Gbl_KeepPreprocessorTempFile)
{
FlDeleteFile (ASL_FILE_PREPROCESSOR);
}
@ -752,8 +755,6 @@ CmCleanupAndExit (
* Note: Handles are cleared by FlCloseFile above, so we look at the
* filename instead, to determine if the .SRC file was actually
* created.
*
* TBD: SourceOutput should be .TMP, then rename if we want to keep it?
*/
if (!Gbl_SourceOutputFlag)
{

View File

@ -1003,7 +1003,7 @@ UtDoConstant (
char *String);
ACPI_STATUS
UtStrtoul64 (
stroul64 (
char *String,
UINT32 Base,
UINT64 *RetInteger);

View File

@ -709,7 +709,7 @@ NamePathTail [.]{NameSeg}
return (PARSEOP_NAMESTRING); }
. { count (1);
if (ACPI_IS_PRINT (*AslCompilertext))
if (isprint ((int) *AslCompilertext))
{
sprintf (MsgBuffer,
"Invalid character (%c), expecting ASL keyword or name",

View File

@ -105,7 +105,8 @@
/* filename suffixes for output files */
#define FILE_SUFFIX_PREPROCESSOR "i"
#define FILE_SUFFIX_PREPROC_USER "i "
#define FILE_SUFFIX_PREPROCESSOR "pre"
#define FILE_SUFFIX_AML_CODE "aml"
#define FILE_SUFFIX_MAP "map"
#define FILE_SUFFIX_LISTING "lst"
@ -136,6 +137,8 @@
#define ASL_ABORT TRUE
#define ASL_NO_ABORT FALSE
#define ASL_EOF ACPI_UINT32_MAX
#define ASL_WITHIN_COMMENT (ACPI_UINT32_MAX -1)
#define ASL_BLANK_LINE (ACPI_UINT32_MAX -1)
/* Listings */

View File

@ -561,11 +561,11 @@ AslCommonError2 (
/* Keep a copy of the extra message */
ACPI_STRCPY (MessageBuffer, ExtraMessage);
strcpy (MessageBuffer, ExtraMessage);
}
LineBuffer = UtLocalCalloc (strlen (SourceLine) + 1);
ACPI_STRCPY (LineBuffer, SourceLine);
strcpy (LineBuffer, SourceLine);
/* Initialize the error node */
@ -647,7 +647,7 @@ AslCommonError (
/* Keep a copy of the extra message */
ACPI_STRCPY (MessageBuffer, ExtraMessage);
strcpy (MessageBuffer, ExtraMessage);
}
/* Initialize the error node */

View File

@ -218,6 +218,19 @@ FlWriteFile (
FlFileError (FileId, ASL_MSG_WRITE);
AslAbort ();
}
if ((FileId == ASL_FILE_PREPROCESSOR) && Gbl_PreprocessorOutputFlag)
{
/* Duplicate the output to the user preprocessor (.i) file */
Actual = fwrite ((char *) Buffer, 1, Length,
Gbl_Files[ASL_FILE_PREPROCESSOR_USER].Handle);
if (Actual != Length)
{
FlFileError (FileId, ASL_MSG_WRITE);
AslAbort ();
}
}
}
@ -247,7 +260,6 @@ FlPrintFile (
va_start (Args, Format);
Actual = vfprintf (Gbl_Files[FileId].Handle, Format, Args);
va_end (Args);
@ -256,6 +268,30 @@ FlPrintFile (
FlFileError (FileId, ASL_MSG_WRITE);
AslAbort ();
}
if ((FileId == ASL_FILE_PREPROCESSOR) && Gbl_PreprocessorOutputFlag)
{
/*
* Duplicate the output to the user preprocessor (.i) file,
* except: no #line directives.
*/
if (!strncmp (Format, "#line", 5))
{
return;
}
va_start (Args, Format);
Actual = vfprintf (Gbl_Files[ASL_FILE_PREPROCESSOR_USER].Handle,
Format, Args);
va_end (Args);
if (Actual == -1)
{
FlFileError (FileId, ASL_MSG_WRITE);
AslAbort ();
}
}
}

View File

@ -43,6 +43,7 @@
#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include <contrib/dev/acpica/include/acapps.h>
#include <contrib/dev/acpica/compiler/dtcompiler.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslfiles")
@ -84,7 +85,6 @@ FlSetLineNumber (
LineNumber, Gbl_LogicalLineNumber);
Gbl_CurrentLineNumber = LineNumber;
Gbl_LogicalLineNumber = LineNumber;
}
@ -303,6 +303,7 @@ FlOpenIncludeWithPrefix (
{
FILE *IncludeFile;
char *Pathname;
UINT32 OriginalLineNumber;
/* Build the full pathname to the file */
@ -322,13 +323,20 @@ FlOpenIncludeWithPrefix (
return (NULL);
}
#ifdef _MUST_HANDLE_COMMENTS
/*
* Check entire include file for any # preprocessor directives.
* Check the entire include file for any # preprocessor directives.
* This is because there may be some confusion between the #include
* preprocessor directive and the ASL Include statement.
* preprocessor directive and the ASL Include statement. A file included
* by the ASL include cannot contain preprocessor directives because
* the preprocessor has already run by the time the ASL include is
* recognized (by the compiler, not the preprocessor.)
*
* Note: DtGetNextLine strips/ignores comments.
* Save current line number since DtGetNextLine modifies it.
*/
while (fgets (Gbl_CurrentLineBuffer, Gbl_LineBufferSize, IncludeFile))
Gbl_CurrentLineNumber--;
OriginalLineNumber = Gbl_CurrentLineNumber;
while (DtGetNextLine (IncludeFile, DT_ALLOW_MULTILINE_QUOTES) != ASL_EOF)
{
if (Gbl_CurrentLineBuffer[0] == '#')
{
@ -336,7 +344,7 @@ FlOpenIncludeWithPrefix (
Op, "use #include instead");
}
}
#endif
Gbl_CurrentLineNumber = OriginalLineNumber;
/* Must seek back to the start of the file */
@ -579,8 +587,6 @@ FlOpenMiscOutputFiles (
/* Open the debug file as STDERR, text mode */
/* TBD: hide this behind a FlReopenFile function */
Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Filename = Filename;
Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle =
freopen (Filename, "w+t", stderr);
@ -588,13 +594,15 @@ FlOpenMiscOutputFiles (
if (!Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle)
{
/*
* A problem with freopen is that on error,
* we no longer have stderr.
* A problem with freopen is that on error, we no longer
* have stderr and cannot emit normal error messages.
* Emit error to stdout, close files, and exit.
*/
Gbl_DebugFlag = FALSE;
memcpy (stderr, stdout, sizeof (FILE));
FlFileError (ASL_FILE_DEBUG_OUTPUT, ASL_MSG_DEBUG_FILENAME);
AslAbort ();
fprintf (stdout,
"\nCould not open debug output file: %s\n\n", Filename);
CmCleanupAndExit ();
exit (1);
}
AslCompilerSignon (ASL_FILE_DEBUG_OUTPUT);
@ -621,7 +629,7 @@ FlOpenMiscOutputFiles (
AslCompilerFileHeader (ASL_FILE_LISTING_OUTPUT);
}
/* Create the preprocessor output file if preprocessor enabled */
/* Create the preprocessor output temp file if preprocessor enabled */
if (Gbl_PreprocessFlag)
{
@ -636,6 +644,23 @@ FlOpenMiscOutputFiles (
FlOpenFile (ASL_FILE_PREPROCESSOR, Filename, "w+t");
}
/*
* Create the "user" preprocessor output file if -li flag set.
* Note, this file contains no embedded #line directives.
*/
if (Gbl_PreprocessorOutputFlag)
{
Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_PREPROC_USER);
if (!Filename)
{
AslCommonError (ASL_ERROR, ASL_MSG_PREPROCESSOR_FILENAME,
0, 0, 0, 0, NULL, NULL);
return (AE_ERROR);
}
FlOpenFile (ASL_FILE_PREPROCESSOR_USER, Filename, "w+t");
}
/* All done for data table compiler */
if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_DATA)

View File

@ -236,6 +236,8 @@ OpcAmlCheckForConstant (
*/
if (WalkState->Opcode == AML_BUFFER_OP)
{
DbgPrint (ASL_PARSE_OUTPUT,
"\nBuffer+Buffer->Buffer constant reduction is not supported yet");
Status = AE_TYPE;
goto CleanupAndExit;
}
@ -380,10 +382,12 @@ TrSimpleConstantReduction (
return (Status);
}
/* Disconnect any existing children, install new constant */
Op->Asl.Child = NULL;
TrInstallReducedConstant (Op, ObjDesc);
UtSetParseOpName (Op);
Op->Asl.Child = NULL;
return (AE_OK);
}
@ -494,6 +498,10 @@ TrTransformToStoreOp (
goto EvalError;
}
/* Truncate any subtree expressions, they have been evaluated */
Child1->Asl.Child = NULL;
/* Folded constant is in ObjDesc, store into Child1 */
TrInstallReducedConstant (Child1, ObjDesc);
@ -505,11 +513,6 @@ TrTransformToStoreOp (
UtSetParseOpName (Op);
Op->Common.Parent = OriginalParent;
/* Truncate any subtree expressions, they have been evaluated */
Child1->Asl.Child = NULL;
Child2->Asl.Child = NULL;
/* First child is the folded constant */
/* Second child will be the target */
@ -547,7 +550,8 @@ TrInstallReducedConstant (
ACPI_PARSE_OBJECT *Op,
ACPI_OPERAND_OBJECT *ObjDesc)
{
ACPI_PARSE_OBJECT *RootOp;
ACPI_PARSE_OBJECT *LengthOp;
ACPI_PARSE_OBJECT *DataOp;
TotalFolds++;
@ -574,17 +578,22 @@ TrInstallReducedConstant (
Op->Asl.ParseOpcode = PARSEOP_STRING_LITERAL;
Op->Common.AmlOpcode = AML_STRING_OP;
Op->Asl.AmlLength = ACPI_STRLEN (ObjDesc->String.Pointer) + 1;
Op->Asl.AmlLength = strlen (ObjDesc->String.Pointer) + 1;
Op->Common.Value.String = ObjDesc->String.Pointer;
DbgPrint (ASL_PARSE_OUTPUT,
"Constant expression reduced to (STRING) %s\n\n",
Op->Common.Value.String);
break;
case ACPI_TYPE_BUFFER:
/*
* Create a new parse subtree of the form:
*
* BUFFER (Buffer AML opcode)
* INTEGER (Buffer length in bytes)
* RAW_DATA (Buffer byte data)
*/
Op->Asl.ParseOpcode = PARSEOP_BUFFER;
Op->Common.AmlOpcode = AML_BUFFER_OP;
Op->Asl.CompileFlags = NODE_AML_PACKAGE;
@ -592,28 +601,24 @@ TrInstallReducedConstant (
/* Child node is the buffer length */
RootOp = TrAllocateNode (PARSEOP_INTEGER);
LengthOp = TrAllocateNode (PARSEOP_INTEGER);
RootOp->Asl.AmlOpcode = AML_DWORD_OP;
RootOp->Asl.Value.Integer = ObjDesc->Buffer.Length;
RootOp->Asl.Parent = Op;
LengthOp->Asl.AmlOpcode = AML_DWORD_OP;
LengthOp->Asl.Value.Integer = ObjDesc->Buffer.Length;
LengthOp->Asl.Parent = Op;
(void) OpcSetOptimalIntegerSize (LengthOp);
(void) OpcSetOptimalIntegerSize (RootOp);
Op->Asl.Child = LengthOp;
Op->Asl.Child = RootOp;
Op = RootOp;
UtSetParseOpName (Op);
/* Next child is the raw buffer data */
/* Peer to the child is the raw buffer data */
DataOp = TrAllocateNode (PARSEOP_RAW_DATA);
DataOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
DataOp->Asl.AmlLength = ObjDesc->Buffer.Length;
DataOp->Asl.Value.String = (char *) ObjDesc->Buffer.Pointer;
DataOp->Asl.Parent = Op;
RootOp = TrAllocateNode (PARSEOP_RAW_DATA);
RootOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
RootOp->Asl.AmlLength = ObjDesc->Buffer.Length;
RootOp->Asl.Value.String = (char *) ObjDesc->Buffer.Pointer;
RootOp->Asl.Parent = Op->Asl.Parent;
Op->Asl.Next = RootOp;
Op = RootOp;
LengthOp->Asl.Next = DataOp;
DbgPrint (ASL_PARSE_OUTPUT,
"Constant expression reduced to (BUFFER) length %X\n\n",

View File

@ -73,6 +73,7 @@ ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES] =
{NULL, NULL, "Binary Output:", "AML Output"},
{NULL, NULL, "Source Output:", "Source Output"},
{NULL, NULL, "Preprocessor: ", "Preprocessor Output"},
{NULL, NULL, "Preprocessor: ", "Preprocessor Temp File"},
{NULL, NULL, "Listing File: ", "Listing Output"},
{NULL, NULL, "Hex Dump: ", "Hex Table Output"},
{NULL, NULL, "Namespace: ", "Namespace Output"},
@ -123,10 +124,10 @@ ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_CurrentLineBuffer, NUL
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_LineBufPtr, NULL);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_LineBufferSize, ASL_DEFAULT_LINE_BUFFER_SIZE);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentColumn, 0);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_PreviousLineNumber, 0);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineNumber, 1);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_LogicalLineNumber, 1);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineOffset, 0);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_OriginalInputFileSize, 0);
ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_SyntaxError, 0);
/* Exception reporting */
@ -146,6 +147,7 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseDefaultAmlFilename,
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_MapfileFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessorOutputFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_KeepPreprocessorTempFile, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DebugFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmOutputFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_OutputFlag, FALSE);

View File

@ -261,7 +261,7 @@ AslSignalHandler (
/* Close all open files */
Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .i file is same as source file */
Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .pre file is same as source file */
for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++)
{

View File

@ -239,7 +239,7 @@ MpCreateGpioInfo (
/* Sort on source DeviceName first */
while (NextGpio &&
(ACPI_STRCMP (DeviceName, NextGpio->DeviceName) > 0))
(strcmp (DeviceName, NextGpio->DeviceName) > 0))
{
PrevGpio = NextGpio;
NextGpio = NextGpio->Next;
@ -249,7 +249,7 @@ MpCreateGpioInfo (
while (NextGpio &&
(NextGpio->PinNumber < PinNumber) &&
!ACPI_STRCMP (DeviceName, NextGpio->DeviceName))
!strcmp (DeviceName, NextGpio->DeviceName))
{
PrevGpio = NextGpio;
NextGpio = NextGpio->Next;
@ -316,7 +316,7 @@ MpCreateSerialInfo (
/* Sort on source DeviceName */
while (NextSerial &&
(ACPI_STRCMP (DeviceName, NextSerial->DeviceName) > 0))
(strcmp (DeviceName, NextSerial->DeviceName) > 0))
{
PrevSerial = NextSerial;
NextSerial = NextSerial->Next;
@ -326,7 +326,7 @@ MpCreateSerialInfo (
while (NextSerial &&
(NextSerial->Address < Address) &&
!ACPI_STRCMP (DeviceName, NextSerial->DeviceName))
!strcmp (DeviceName, NextSerial->DeviceName))
{
PrevSerial = NextSerial;
NextSerial = NextSerial->Next;

View File

@ -207,7 +207,7 @@ MpEmitGpioInfo (
/* Print header info for the controller itself */
if (!PrevDeviceName ||
ACPI_STRCMP (PrevDeviceName, Info->DeviceName))
strcmp (PrevDeviceName, Info->DeviceName))
{
FlPrintFile (ASL_FILE_MAP_OUTPUT,
"\n\nGPIO Controller: %-8s %-28s",
@ -360,7 +360,7 @@ MpEmitSerialInfo (
/* Print header info for the controller itself */
if (!PrevDeviceName ||
ACPI_STRCMP (PrevDeviceName, Info->DeviceName))
strcmp (PrevDeviceName, Info->DeviceName))
{
FlPrintFile (ASL_FILE_MAP_OUTPUT, "\n\n%s Controller: ",
Type);

View File

@ -430,7 +430,7 @@ MtMethodAnalysisWalkBegin (
/* Special typechecking for _HID */
if (!ACPI_STRCMP (METHOD_NAME__HID, Op->Asl.NameSeg))
if (!strcmp (METHOD_NAME__HID, Op->Asl.NameSeg))
{
Next = Op->Asl.Child->Asl.Next;
AnCheckId (Next, ASL_TYPE_HID);
@ -438,7 +438,7 @@ MtMethodAnalysisWalkBegin (
/* Special typechecking for _CID */
else if (!ACPI_STRCMP (METHOD_NAME__CID, Op->Asl.NameSeg))
else if (!strcmp (METHOD_NAME__CID, Op->Asl.NameSeg))
{
Next = Op->Asl.Child->Asl.Next;

View File

@ -636,7 +636,7 @@ OpcDoEisaId (
* The EISAID string must be exactly 7 characters and of the form
* "UUUXXXX" -- 3 uppercase letters and 4 hex digits (e.g., "PNP0001")
*/
if (ACPI_STRLEN (InString) != 7)
if (strlen (InString) != 7)
{
Status = AE_BAD_PARAMETER;
}
@ -855,7 +855,7 @@ OpcFindName (
for (i = 0, Str = List[0]; Str; i++, Str = List[i])
{
if (!(ACPI_STRNCMP (Str, Name, ACPI_STRLEN (Name))))
if (!(strncmp (Str, Name, strlen (Name))))
{
*Index = i;
return (TRUE);
@ -907,7 +907,7 @@ OpcDoPld (
return;
}
ACPI_MEMSET (&PldInfo, 0, sizeof (ACPI_PLD_INFO));
memset (&PldInfo, 0, sizeof (ACPI_PLD_INFO));
Node = Op->Asl.Child;
while (Node)

View File

@ -932,7 +932,7 @@ OpnDoDefinitionBlock (
if (Child->Asl.Value.String)
{
Gbl_TableSignature = Child->Asl.Value.String;
if (ACPI_STRLEN (Gbl_TableSignature) != 4)
if (strlen (Gbl_TableSignature) != 4)
{
AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child,
"Length not exactly 4");
@ -967,9 +967,9 @@ OpnDoDefinitionBlock (
Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
if (Child->Asl.Value.String)
{
Length = ACPI_STRLEN (Child->Asl.Value.String);
Length = strlen (Child->Asl.Value.String);
Gbl_TableId = UtStringCacheCalloc (Length + 1);
ACPI_STRCPY (Gbl_TableId, Child->Asl.Value.String);
strcpy (Gbl_TableId, Child->Asl.Value.String);
/*
* Convert anything non-alphanumeric to an underscore. This

View File

@ -168,9 +168,9 @@ OptSearchToRoot (
/* We must allocate a new string for the name (TargetPath gets deleted) */
*NewPath = UtStringCacheCalloc (ACPI_NAME_SIZE + 1);
ACPI_STRCPY (*NewPath, Path);
strcpy (*NewPath, Path);
if (ACPI_STRNCMP (*NewPath, "_T_", 3))
if (strncmp (*NewPath, "_T_", 3))
{
AslError (ASL_OPTIMIZATION, ASL_MSG_SINGLE_NAME_OPTIMIZATION, Op,
*NewPath);
@ -341,7 +341,7 @@ OptBuildShortestPath (
Index = TargetPath->Length;
}
ACPI_STRCPY (&NewPathExternal[i], &((char *) TargetPath->Pointer)[Index]);
strcpy (&NewPathExternal[i], &((char *) TargetPath->Pointer)[Index]);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " %-24s", NewPathExternal));
/*
@ -358,11 +358,11 @@ OptBuildShortestPath (
return (Status);
}
if (ACPI_STRLEN (NewPath) >= AmlNameStringLength)
if (strlen (NewPath) >= AmlNameStringLength)
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS,
" NOT SHORTER (New %u old %u)",
(UINT32) ACPI_STRLEN (NewPath), (UINT32) AmlNameStringLength));
(UINT32) strlen (NewPath), (UINT32) AmlNameStringLength));
ACPI_FREE (NewPathExternal);
return (AE_NOT_FOUND);
}
@ -597,7 +597,7 @@ OptOptimizeNamePath (
* The original path must be longer than one NameSeg (4 chars) for there
* to be any possibility that it can be optimized to a shorter string
*/
AmlNameStringLength = ACPI_STRLEN (AmlNameString);
AmlNameStringLength = strlen (AmlNameString);
if (AmlNameStringLength <= ACPI_NAME_SIZE)
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS,
@ -745,7 +745,7 @@ OptOptimizeNamePath (
*/
if (ACPI_SUCCESS (Status))
{
HowMuchShorter = (AmlNameStringLength - ACPI_STRLEN (NewPath));
HowMuchShorter = (AmlNameStringLength - strlen (NewPath));
OptTotal += HowMuchShorter;
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS,
@ -761,12 +761,12 @@ OptOptimizeNamePath (
* (alias name) is the second operand
*/
Op->Asl.Child->Asl.Next->Asl.Value.String = NewPath;
Op->Asl.Child->Asl.Next->Asl.AmlLength = ACPI_STRLEN (NewPath);
Op->Asl.Child->Asl.Next->Asl.AmlLength = strlen (NewPath);
}
else
{
Op->Asl.Child->Asl.Value.String = NewPath;
Op->Asl.Child->Asl.AmlLength = ACPI_STRLEN (NewPath);
Op->Asl.Child->Asl.AmlLength = strlen (NewPath);
}
}
else if (Flags & AML_CREATE)
@ -781,14 +781,14 @@ OptOptimizeNamePath (
/* Update the parse node with the new NamePath */
NextOp->Asl.Value.String = NewPath;
NextOp->Asl.AmlLength = ACPI_STRLEN (NewPath);
NextOp->Asl.AmlLength = strlen (NewPath);
}
else
{
/* Update the parse node with the new NamePath */
Op->Asl.Value.String = NewPath;
Op->Asl.AmlLength = ACPI_STRLEN (NewPath);
Op->Asl.AmlLength = strlen (NewPath);
}
}
else

View File

@ -194,6 +194,7 @@ AslDoOptions (
DtParserdebug = 1;
PrParserdebug = 1;
Gbl_DebugFlag = TRUE;
Gbl_KeepPreprocessorTempFile = TRUE;
break;
case 'p': /* Prune ASL parse tree */

View File

@ -186,7 +186,7 @@ OpcParsePrintf (
if (StringToProcess)
{
NewString = UtStringCacheCalloc (StringLength + 1);
ACPI_STRNCPY (NewString, StartPosition, StringLength);
strncpy (NewString, StartPosition, StringLength);
NewOp = TrAllocateNode (PARSEOP_STRING_LITERAL);
NewOp->Asl.Value.String = NewString;
@ -275,7 +275,7 @@ OpcParsePrintf (
if (StringToProcess)
{
NewString = UtStringCacheCalloc (StringLength + 1);
ACPI_STRNCPY (NewString, StartPosition, StringLength);
strncpy (NewString, StartPosition, StringLength);
NewOp = TrAllocateNode (PARSEOP_STRING_LITERAL);
NewOp->Asl.Value.String = NewString;

View File

@ -359,6 +359,8 @@ AslDoOneFile (
return (AE_ERROR);
}
Gbl_OriginalInputFileSize = FlGetFileSize (ASL_FILE_INPUT);
/* Determine input file type */
Gbl_FileType = AslDetectSourceFileType (&Gbl_Files[ASL_FILE_INPUT]);

View File

@ -113,6 +113,7 @@ AslDoLineDirective (
char *Filename;
UINT32 i;
Gbl_HasIncludeFiles = TRUE;
/* Eat the entire line that contains the #line directive */
@ -713,7 +714,7 @@ DoCharacter:
* string and resume processing of the next character
*/
ConvertBuffer[i] = 0;
Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 8);
Digit = (UINT8) strtoul (ConvertBuffer, NULL, 8);
/* Check for NULL or non-ascii character (ignore if so) */
@ -749,7 +750,7 @@ DoCharacter:
/* Up to two hex digits allowed */
if (!ACPI_IS_XDIGIT (StringChar) ||
if (!isxdigit (StringChar) ||
(i > 1))
{
/*
@ -757,7 +758,7 @@ DoCharacter:
* string and resume processing of the next character
*/
ConvertBuffer[i] = 0;
Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 16);
Digit = (UINT8) strtoul (ConvertBuffer, NULL, 16);
/* Check for NULL or non-ascii character (ignore if so) */
@ -830,7 +831,7 @@ CompletedString:
return (FALSE);
}
ACPI_STRCPY (CleanString, MsgBuffer);
strcpy (CleanString, MsgBuffer);
AslCompilerlval.s = CleanString;
return (TRUE);

View File

@ -148,32 +148,56 @@ typedef struct asl_file_status
/*
* File types. Note: Any changes to this table must also be reflected
* in the Gbl_Files array.
*
* Corresponding filename suffixes are in comments
*
* NOTE: Don't move the first 4 file types
*/
typedef enum
{
ASL_FILE_STDOUT = 0,
ASL_FILE_STDERR,
ASL_FILE_INPUT,
ASL_FILE_AML_OUTPUT, /* Don't move these first 4 file types */
ASL_FILE_SOURCE_OUTPUT,
ASL_FILE_PREPROCESSOR,
ASL_FILE_LISTING_OUTPUT,
ASL_FILE_HEX_OUTPUT,
ASL_FILE_NAMESPACE_OUTPUT,
ASL_FILE_DEBUG_OUTPUT,
ASL_FILE_ASM_SOURCE_OUTPUT,
ASL_FILE_C_SOURCE_OUTPUT,
ASL_FILE_ASM_INCLUDE_OUTPUT,
ASL_FILE_C_INCLUDE_OUTPUT,
ASL_FILE_C_OFFSET_OUTPUT,
ASL_FILE_MAP_OUTPUT
ASL_FILE_INPUT, /* .asl */
ASL_FILE_AML_OUTPUT, /* .aml */
ASL_FILE_SOURCE_OUTPUT, /* .src */
ASL_FILE_PREPROCESSOR, /* .pre */
ASL_FILE_PREPROCESSOR_USER, /* .i */
ASL_FILE_LISTING_OUTPUT, /* .lst */
ASL_FILE_HEX_OUTPUT, /* .hex */
ASL_FILE_NAMESPACE_OUTPUT, /* .nsp */
ASL_FILE_DEBUG_OUTPUT, /* .txt */
ASL_FILE_ASM_SOURCE_OUTPUT, /* .asm */
ASL_FILE_C_SOURCE_OUTPUT, /* .c */
ASL_FILE_ASM_INCLUDE_OUTPUT,/* .inc */
ASL_FILE_C_INCLUDE_OUTPUT, /* .h */
ASL_FILE_C_OFFSET_OUTPUT, /* offset.h */
ASL_FILE_MAP_OUTPUT /* .map */
} ASL_FILE_TYPES;
#define ASL_MAX_FILE_TYPE 15
#define ASL_MAX_FILE_TYPE 16
#define ASL_NUM_FILES (ASL_MAX_FILE_TYPE + 1)
/* filename suffixes for output files */
#define FILE_SUFFIX_PREPROC_USER "i "
#define FILE_SUFFIX_PREPROCESSOR "pre"
#define FILE_SUFFIX_AML_CODE "aml"
#define FILE_SUFFIX_MAP "map"
#define FILE_SUFFIX_LISTING "lst"
#define FILE_SUFFIX_HEX_DUMP "hex"
#define FILE_SUFFIX_DEBUG "txt"
#define FILE_SUFFIX_SOURCE "src"
#define FILE_SUFFIX_NAMESPACE "nsp"
#define FILE_SUFFIX_ASM_SOURCE "asm"
#define FILE_SUFFIX_C_SOURCE "c"
#define FILE_SUFFIX_DISASSEMBLY "dsl"
#define FILE_SUFFIX_ASM_INCLUDE "inc"
#define FILE_SUFFIX_C_INCLUDE "h"
#define FILE_SUFFIX_ASL_CODE "asl"
#define FILE_SUFFIX_C_OFFSET "offset.h"
/* Cache block structure for ParseOps and Strings */

View File

@ -441,17 +441,20 @@ UtDisplaySummary (
"%-14s %s - %u lines, %u bytes, %u keywords\n",
"ASL Input:",
Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber,
Gbl_InputByteCount, TotalKeywords);
Gbl_OriginalInputFileSize, TotalKeywords);
/* AML summary */
if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors))
{
FlPrintFile (FileId,
"%-14s %s - %u bytes, %u named objects, %u executable opcodes\n",
"AML Output:",
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength,
TotalNamedObjects, TotalExecutableOpcodes);
if (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle)
{
FlPrintFile (FileId,
"%-14s %s - %u bytes, %u named objects, %u executable opcodes\n",
"AML Output:",
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength,
TotalNamedObjects, TotalExecutableOpcodes);
}
}
}
@ -471,9 +474,9 @@ UtDisplaySummary (
continue;
}
/* .I is a temp file unless specifically requested */
/* .PRE is the preprocessor intermediate file */
if ((i == ASL_FILE_PREPROCESSOR) && (!Gbl_PreprocessorOutputFlag))
if ((i == ASL_FILE_PREPROCESSOR) && (!Gbl_KeepPreprocessorTempFile))
{
continue;
}
@ -932,7 +935,7 @@ UtDoConstant (
char ErrBuf[64];
Status = UtStrtoul64 (String, 0, &Converted);
Status = stroul64 (String, 0, &Converted);
if (ACPI_FAILURE (Status))
{
sprintf (ErrBuf, "%s %s\n", "Conversion error:",
@ -948,7 +951,7 @@ UtDoConstant (
/*******************************************************************************
*
* FUNCTION: UtStrtoul64
* FUNCTION: stroul64
*
* PARAMETERS: String - Null terminated string
* Terminater - Where a pointer to the terminating byte
@ -962,7 +965,7 @@ UtDoConstant (
******************************************************************************/
ACPI_STATUS
UtStrtoul64 (
stroul64 (
char *String,
UINT32 Base,
UINT64 *RetInteger)

View File

@ -69,7 +69,7 @@ AuValidateUuid (
UINT32 i;
if (!InString || (ACPI_STRLEN (InString) != UUID_STRING_LENGTH))
if (!InString || (strlen (InString) != UUID_STRING_LENGTH))
{
return (AE_BAD_PARAMETER);
}

View File

@ -302,7 +302,7 @@ DtCompileDataTable (
return (AE_ERROR);
}
Gbl_Signature = UtStringCacheCalloc (ACPI_STRLEN (Signature) + 1);
Gbl_Signature = UtStringCacheCalloc (strlen (Signature) + 1);
strcpy (Gbl_Signature, Signature);
/*
@ -358,6 +358,8 @@ DtCompileDataTable (
TableData = AcpiDmGetTableData (Signature);
if (!TableData || Gbl_CompileGeneric)
{
/* Unknown table signature and/or force generic compile */
DtCompileGeneric ((void **) FieldList, NULL, NULL);
goto FinishHeader;
}
@ -454,7 +456,7 @@ DtCompileTable (
/* Ignore optional subtable if name does not match */
if ((Info->Flags & DT_OPTIONAL) &&
ACPI_STRCMP ((*Field)->Name, Info->Name))
strcmp ((*Field)->Name, Info->Name))
{
*RetSubtable = NULL;
return (AE_OK);
@ -591,7 +593,7 @@ DtCompileTable (
DtSetSubtableLength (InlineSubtable);
ACPI_MEMCPY (Buffer, InlineSubtable->Buffer, FieldLength);
memcpy (Buffer, InlineSubtable->Buffer, FieldLength);
LocalField = *Field;
break;

View File

@ -181,7 +181,13 @@ DtCompilePadding (
UINT32
DtGetNextLine (
FILE *Handle);
FILE *Handle,
UINT32 Flags);
/* Flags for DtGetNextLine */
#define DT_ALLOW_MULTILINE_QUOTES 0x01
DT_FIELD *
DtScanFile (

View File

@ -413,7 +413,7 @@ DtLookupLabel (
LabelField = Gbl_LabelList;
while (LabelField)
{
if (!ACPI_STRCMP (Name, LabelField->Value))
if (!strcmp (Name, LabelField->Value))
{
return (LabelField);
}

View File

@ -166,7 +166,7 @@ DtCompileString (
UINT32 Length;
Length = ACPI_STRLEN (Field->Value);
Length = strlen (Field->Value);
/* Check if the string is too long for the field */
@ -177,7 +177,7 @@ DtCompileString (
Length = ByteLength;
}
ACPI_MEMCPY (Buffer, Field->Value, Length);
memcpy (Buffer, Field->Value, Length);
}
@ -212,7 +212,7 @@ DtCompileUnicode (
AsciiString = Field->Value;
UnicodeString = (UINT16 *) Buffer;
Count = ACPI_STRLEN (AsciiString) + 1;
Count = strlen (AsciiString) + 1;
/* Convert to Unicode string (including null terminator) */
@ -318,7 +318,7 @@ DtCompileInteger (
/* TBD: Should use a flag rather than compare "Reserved" */
if (!ACPI_STRCMP (Field->Name, "Reserved"))
if (!strcmp (Field->Name, "Reserved"))
{
if (Flags & DT_NON_ZERO)
{
@ -359,7 +359,7 @@ DtCompileInteger (
DtError (ASL_ERROR, ASL_MSG_INTEGER_SIZE, Field, MsgBuffer);
}
ACPI_MEMCPY (Buffer, &Value, ByteLength);
memcpy (Buffer, &Value, ByteLength);
return;
}
@ -391,7 +391,7 @@ DtNormalizeBuffer (
char c;
NewBuffer = UtLocalCalloc (ACPI_STRLEN (Buffer) + 1);
NewBuffer = UtLocalCalloc (strlen (Buffer) + 1);
TmpBuffer = NewBuffer;
while ((c = *Buffer++))

View File

@ -129,7 +129,7 @@ DtTrim (
/* Skip lines that start with a space */
if (!ACPI_STRCMP (String, " "))
if (!strcmp (String, " "))
{
ReturnString = UtStringCacheCalloc (1);
return (ReturnString);
@ -138,7 +138,7 @@ DtTrim (
/* Setup pointers to start and end of input string */
Start = String;
End = String + ACPI_STRLEN (String) - 1;
End = String + strlen (String) - 1;
/* Find first non-whitespace character */
@ -180,9 +180,9 @@ DtTrim (
Length = ACPI_PTR_DIFF (End, Start) + 1;
ReturnString = UtStringCacheCalloc (Length + 1);
if (ACPI_STRLEN (Start))
if (strlen (Start))
{
ACPI_STRNCPY (ReturnString, Start, Length);
strncpy (ReturnString, Start, Length);
}
ReturnString[Length] = 0;
@ -313,7 +313,7 @@ DtParseLine (
Length = ACPI_PTR_DIFF (End, Start);
TmpName = UtLocalCalloc (Length + 1);
ACPI_STRNCPY (TmpName, Start, Length);
strncpy (TmpName, Start, Length);
Name = DtTrim (TmpName);
ACPI_FREE (TmpName);
@ -360,7 +360,7 @@ DtParseLine (
Length = ACPI_PTR_DIFF (End, Start);
TmpValue = UtLocalCalloc (Length + 1);
ACPI_STRNCPY (TmpValue, Start, Length);
strncpy (TmpValue, Start, Length);
Value = DtTrim (TmpValue);
ACPI_FREE (TmpValue);
@ -406,7 +406,8 @@ DtParseLine (
UINT32
DtGetNextLine (
FILE *Handle)
FILE *Handle,
UINT32 Flags)
{
BOOLEAN LineNotAllBlanks = FALSE;
UINT32 State = DT_NORMAL_TEXT;
@ -415,7 +416,7 @@ DtGetNextLine (
int c;
ACPI_MEMSET (Gbl_CurrentLineBuffer, 0, Gbl_LineBufferSize);
memset (Gbl_CurrentLineBuffer, 0, Gbl_LineBufferSize);
for (i = 0; ;)
{
/*
@ -550,9 +551,12 @@ DtGetNextLine (
case '\n':
AcpiOsPrintf ("ERROR at line %u: Unterminated quoted string\n",
Gbl_CurrentLineNumber++);
State = DT_NORMAL_TEXT;
if (!(Flags & DT_ALLOW_MULTILINE_QUOTES))
{
AcpiOsPrintf ("ERROR at line %u: Unterminated quoted string\n",
Gbl_CurrentLineNumber++);
State = DT_NORMAL_TEXT;
}
break;
default: /* Get next character */
@ -746,7 +750,7 @@ DtScanFile (
/* Scan line-by-line */
while ((Offset = DtGetNextLine (Handle)) != ASL_EOF)
while ((Offset = DtGetNextLine (Handle, 0)) != ASL_EOF)
{
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Line %2.2u/%4.4X - %s",
Gbl_CurrentLineNumber, Offset, Gbl_CurrentLineBuffer));
@ -897,7 +901,7 @@ DtDumpBuffer (
}
BufChar = Buffer[(ACPI_SIZE) i + j];
if (ACPI_IS_PRINT (BufChar))
if (isprint (BufChar))
{
FlPrintFile (FileId, "%c", BufChar);
}

View File

@ -48,6 +48,13 @@
#define _COMPONENT DT_COMPILER
ACPI_MODULE_NAME ("dtparser")
void * AslLocalAllocate (unsigned int Size);
/* Bison/yacc configuration */
#undef alloca
#define alloca AslLocalAllocate
int DtParserlex (void);
int DtParserparse (void);
void DtParsererror (char const *msg);
@ -162,15 +169,15 @@ Expression
/* Default base for a non-prefixed integer is 16 */
| EXPOP_NUMBER { UtStrtoul64 (DtParsertext, 16, &$$);}
| EXPOP_NUMBER { stroul64 (DtParsertext, 16, &$$);}
/* Standard hex number (0x1234) */
| EXPOP_HEX_NUMBER { UtStrtoul64 (DtParsertext, 16, &$$);}
| EXPOP_HEX_NUMBER { stroul64 (DtParsertext, 16, &$$);}
/* TBD: Decimal number with prefix (0d1234) - Not supported by UtStrtoul64 at this time */
/* TBD: Decimal number with prefix (0d1234) - Not supported by stroul64 at this time */
| EXPOP_DECIMAL_NUMBER { UtStrtoul64 (DtParsertext, 10, &$$);}
| EXPOP_DECIMAL_NUMBER { stroul64 (DtParsertext, 10, &$$);}
;
%%

View File

@ -80,7 +80,7 @@ DtCreateSubtable (
String = UtStringCacheCalloc (Length);
Subtable->Buffer = ACPI_CAST_PTR (UINT8, String);
ACPI_MEMCPY (Subtable->Buffer, Buffer, Length);
memcpy (Subtable->Buffer, Buffer, Length);
Subtable->Length = Length;
Subtable->TotalLength = Length;
@ -379,6 +379,6 @@ DtSetSubtableLength (
return;
}
ACPI_MEMCPY (Subtable->LengthField, &Subtable->TotalLength,
memcpy (Subtable->LengthField, &Subtable->TotalLength,
Subtable->SizeOfLengthField);
}

View File

@ -1824,7 +1824,7 @@ DtCompileIvrs (
if (IvrsHeader->Type == ACPI_IVRS_TYPE_HARDWARE)
{
while (*PFieldList &&
!ACPI_STRCMP ((*PFieldList)->Name, "Entry Type"))
!strcmp ((*PFieldList)->Name, "Entry Type"))
{
SubtableStart = *PFieldList;
DtCompileInteger (&EntryType, *PFieldList, 1, 0);
@ -3403,13 +3403,13 @@ DtCompileGeneric (
/* Now we can actually compile the parse tree */
if (*Length)
if (Length && *Length)
{
*Length = 0;
}
while (*PFieldList)
{
if (Name && !ACPI_STRCMP ((*PFieldList)->Name, Name))
if (Name && !strcmp ((*PFieldList)->Name, Name))
{
break;
}

View File

@ -85,6 +85,7 @@ AcpiUtIsSpecialTable (
{
if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT) ||
ACPI_COMPARE_NAME (Signature, ACPI_SIG_OSDT) ||
ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT) ||
ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS) ||
ACPI_COMPARE_NAME (Signature, ACPI_RSDP_NAME))
@ -127,8 +128,8 @@ DtCreateTemplates (
}
AcpiUtStrupr (Signature);
if (!ACPI_STRCMP (Signature, "ALL") ||
!ACPI_STRCMP (Signature, "*"))
if (!strcmp (Signature, "ALL") ||
!strcmp (Signature, "*"))
{
/* Create all available/known templates */
@ -327,7 +328,7 @@ DtCreateOneTemplate (
AcpiOsPrintf ("/*\n");
AcpiOsPrintf (ACPI_COMMON_HEADER ("iASL Compiler/Disassembler", " * "));
AcpiOsPrintf (" * Template for [%4.4s] ACPI Table\n",
AcpiOsPrintf (" * Template for [%4.4s] ACPI Table",
Signature);
/* Dump the actual ACPI table */
@ -336,6 +337,8 @@ DtCreateOneTemplate (
{
/* Normal case, tables that appear in AcpiDmTableData */
AcpiOsPrintf (" (static data table)\n");
if (Gbl_VerboseTemplates)
{
AcpiOsPrintf (" * Format: [HexOffset DecimalOffset ByteLength]"
@ -344,7 +347,7 @@ DtCreateOneTemplate (
else
{
AcpiOsPrintf (" * Format: [ByteLength]"
" FieldName : HexFieldValue\n */\n\n");
" FieldName : HexFieldValue\n */\n");
}
AcpiDmDumpDataTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER,
@ -352,9 +355,11 @@ DtCreateOneTemplate (
}
else
{
/* Special ACPI tables - DSDT, SSDT, FADT, RSDP */
/* Special ACPI tables - DSDT, SSDT, OSDT, FADT, RSDP */
AcpiOsPrintf (" */\n\n");
AcpiOsPrintf (" (AML byte code table)\n");
AcpiOsPrintf (" */\n");
if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT))
{
Actual = fwrite (TemplateDsdt, 1, sizeof (TemplateDsdt) -1, File);
@ -377,6 +382,17 @@ DtCreateOneTemplate (
goto Cleanup;
}
}
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_OSDT))
{
Actual = fwrite (TemplateOsdt, 1, sizeof (TemplateOsdt) -1, File);
if (Actual != sizeof (TemplateOsdt) -1)
{
fprintf (stderr,
"Could not write to output file %s\n", DisasmFilename);
Status = AE_ERROR;
goto Cleanup;
}
}
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS)) /* FADT */
{
AcpiDmDumpDataTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER,

View File

@ -45,7 +45,7 @@
#define __DTTEMPLATE_H
/* Special templates for DSDT and SSDT (AML byte-code tables) */
/* Special templates for the ASL/AML tables: DSDT, SSDT, and OSDT */
const char TemplateDsdt[] =
"DefinitionBlock (\"dsdt.aml\", \"DSDT\", 2, \"Intel\", \"Template\", 0x00000001)\n"
@ -65,6 +65,15 @@ const char TemplateSsdt[] =
" }\n"
"}\n\n";
const char TemplateOsdt[] =
"DefinitionBlock (\"osdt.aml\", \"OSDT\", 2, \"Intel\", \"Template\", 0x00000001)\n"
"{\n"
" Method (MAIN, 0, NotSerialized)\n"
" {\n"
" Return (Zero)\n"
" }\n"
"}\n\n";
/* Templates for ACPI data tables */

View File

@ -241,7 +241,7 @@ DtStrtoul64 (
while (*ThisChar)
{
if (ACPI_IS_DIGIT (*ThisChar))
if (isdigit ((int) *ThisChar))
{
/* Convert ASCII 0-9 to Decimal value */
@ -249,8 +249,8 @@ DtStrtoul64 (
}
else /* Letter */
{
ThisDigit = (UINT32) ACPI_TOUPPER (*ThisChar);
if (!ACPI_IS_XDIGIT ((char) ThisDigit))
ThisDigit = (UINT32) toupper ((int) *ThisChar);
if (!isxdigit ((int) ThisDigit))
{
/* Not A-F */
@ -568,7 +568,7 @@ DtGetFieldLength (
Value = DtGetFieldValue (Field);
if (Value)
{
ByteLength = ACPI_STRLEN (Value) + 1;
ByteLength = strlen (Value) + 1;
}
else
{ /* At this point, this is a fatal error */
@ -633,7 +633,7 @@ DtGetFieldLength (
/* TBD: error if Value is NULL? (as below?) */
ByteLength = (ACPI_STRLEN (Value) + 1) * sizeof(UINT16);
ByteLength = (strlen (Value) + 1) * sizeof(UINT16);
break;
default:

View File

@ -48,6 +48,13 @@
#define _COMPONENT ASL_PREPROCESSOR
ACPI_MODULE_NAME ("prparser")
void * AslLocalAllocate (unsigned int Size);
/* Bison/yacc configuration */
#undef alloca
#define alloca AslLocalAllocate
int PrParserlex (void);
int PrParserparse (void);
void PrParsererror (char const *msg);
@ -175,11 +182,11 @@ Expression
/* Default base for a non-prefixed integer is 10 */
| EXPOP_NUMBER { UtStrtoul64 (PrParsertext, 10, &$$);}
| EXPOP_NUMBER { stroul64 (PrParsertext, 10, &$$);}
/* Standard hex number (0x1234) */
| EXPOP_HEX_NUMBER { UtStrtoul64 (PrParsertext, 16, &$$);}
| EXPOP_HEX_NUMBER { stroul64 (PrParsertext, 16, &$$);}
;
%%

View File

@ -67,6 +67,14 @@ PrDoDirective (
char *DirectiveToken,
char **Next);
static void
PrGetNextLineInit (
void);
static UINT32
PrGetNextLine (
FILE *Handle);
static int
PrMatchDirective (
char *Directive);
@ -186,7 +194,7 @@ PrInitializeGlobals (
/* Init globals */
Gbl_InputFileList = NULL;
Gbl_CurrentLineNumber = 0;
Gbl_CurrentLineNumber = 1;
Gbl_PreprocessorLineNumber = 1;
Gbl_PreprocessorError = FALSE;
@ -271,7 +279,7 @@ PrDoPreprocess (
} while (MoreInputFiles);
/* Point compiler input to the new preprocessor output file (.i) */
/* Point compiler input to the new preprocessor output file (.pre) */
FlCloseFile (ASL_FILE_INPUT);
Gbl_Files[ASL_FILE_INPUT].Handle = Gbl_Files[ASL_FILE_PREPROCESSOR].Handle;
@ -280,7 +288,10 @@ PrDoPreprocess (
/* Reset globals to allow compiler to run */
FlSeekFile (ASL_FILE_INPUT, 0);
Gbl_CurrentLineNumber = 1;
if (!Gbl_PreprocessOnly)
{
Gbl_CurrentLineNumber = 0;
}
DbgPrint (ASL_DEBUG_OUTPUT, "Preprocessing phase complete \n\n");
}
@ -297,7 +308,8 @@ PrDoPreprocess (
* DESCRIPTION: Preprocess one entire file, line-by-line.
*
* Input: Raw user ASL from ASL_FILE_INPUT
* Output: Preprocessed file written to ASL_FILE_PREPROCESSOR
* Output: Preprocessed file written to ASL_FILE_PREPROCESSOR and
* (optionally) ASL_FILE_PREPROCESSOR_USER
*
******************************************************************************/
@ -305,7 +317,7 @@ static void
PrPreprocessInputFile (
void)
{
UINT32 Offset;
UINT32 Status;
char *Token;
char *ReplaceString;
PR_DEFINE_INFO *DefineInfo;
@ -314,10 +326,21 @@ PrPreprocessInputFile (
int OffsetAdjust;
PrGetNextLineInit ();
/* Scan line-by-line. Comments and blank lines are skipped by this function */
while ((Offset = DtGetNextLine (Gbl_Files[ASL_FILE_INPUT].Handle)) != ASL_EOF)
while ((Status = PrGetNextLine (Gbl_Files[ASL_FILE_INPUT].Handle)) != ASL_EOF)
{
Gbl_CurrentLineNumber++;
Gbl_LogicalLineNumber++;
if ((Status == ASL_WITHIN_COMMENT) ||
(Status == ASL_BLANK_LINE))
{
goto WriteEntireLine;
}
/* Need a copy of the input line for strok() */
strcpy (Gbl_MainTokenBuffer, Gbl_CurrentLineBuffer);
@ -397,24 +420,13 @@ PrPreprocessInputFile (
Token = PrGetNextToken (NULL, PR_TOKEN_SEPARATORS, &Next);
}
/*
* Emit a #line directive if necessary, to keep the line numbers in
* the (.i) file synchronized with the original source code file, so
* that the correct line number appears in any error messages
* generated by the actual compiler.
*/
if (Gbl_CurrentLineNumber > (Gbl_PreviousLineNumber + 1))
{
FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u\n",
Gbl_CurrentLineNumber);
}
Gbl_PreviousLineNumber = Gbl_CurrentLineNumber;
Gbl_PreprocessorLineNumber++;
WriteEntireLine:
/*
* Now we can write the possibly modified source line to the
* preprocessor (.i) file
* preprocessor file(s).
*/
FlWriteFile (ASL_FILE_PREPROCESSOR, Gbl_CurrentLineBuffer,
strlen (Gbl_CurrentLineBuffer));
@ -654,7 +666,7 @@ PrDoDirective (
{
#ifndef MACROS_SUPPORTED
AcpiOsPrintf ("%s ERROR - line %u: #define macros are not supported yet\n",
Gbl_CurrentLineBuffer, Gbl_CurrentLineNumber);
Gbl_CurrentLineBuffer, Gbl_LogicalLineNumber);
exit(1);
#else
PrAddMacro (Token, Next);
@ -691,7 +703,7 @@ PrDoDirective (
#endif
DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID
"New #define: %s->%s\n",
Gbl_CurrentLineNumber, Token, Token2);
Gbl_LogicalLineNumber, Token, Token2);
PrAddDefine (Token, Token2, FALSE);
}
@ -760,10 +772,7 @@ PrDoDirective (
"User #line invocation %s\n", Gbl_CurrentLineNumber,
Token);
/* Update local line numbers */
Gbl_CurrentLineNumber = (UINT32) Value;
Gbl_PreviousLineNumber = 0;
/* Emit #line into the preprocessor file */
@ -837,6 +846,107 @@ PrDoDirective (
}
/*******************************************************************************
*
* FUNCTION: PrGetNextLine, PrGetNextLineInit
*
* PARAMETERS: Handle - Open file handle for the source file
*
* RETURN: Status of the GetLine operation:
* AE_OK - Normal line, OK status
* ASL_WITHIN_COMMENT - Line is part of a multi-line comment
* ASL_EOF - End-of-file reached
*
* DESCRIPTION: Get the next text line from the input file. Does not strip
* comments.
*
******************************************************************************/
#define PR_NORMAL_TEXT 0
#define PR_WITHIN_COMMENT 1
static UINT8 AcpiGbl_LineScanState = PR_NORMAL_TEXT;
static void
PrGetNextLineInit (
void)
{
AcpiGbl_LineScanState = 0;
}
static UINT32
PrGetNextLine (
FILE *Handle)
{
UINT32 i;
int c = 0;
int PreviousChar;
/* Always clear the global line buffer */
memset (Gbl_CurrentLineBuffer, 0, Gbl_LineBufferSize);
for (i = 0; ;)
{
/*
* If line is too long, expand the line buffers. Also increases
* Gbl_LineBufferSize.
*/
if (i >= Gbl_LineBufferSize)
{
UtExpandLineBuffers ();
}
PreviousChar = c;
c = getc (Handle);
if (c == EOF)
{
return (ASL_EOF);
}
/* We need to worry about multi-line slash-asterisk comments */
/* Check for comment open */
if ((AcpiGbl_LineScanState == PR_NORMAL_TEXT) &&
(PreviousChar == '/') && (c == '*'))
{
AcpiGbl_LineScanState = PR_WITHIN_COMMENT;
}
/* Check for comment close */
if ((AcpiGbl_LineScanState == PR_WITHIN_COMMENT) &&
(PreviousChar == '*') && (c == '/'))
{
AcpiGbl_LineScanState = PR_NORMAL_TEXT;
}
/* Always copy the character into line buffer */
Gbl_CurrentLineBuffer[i] = (char) c;
i++;
/* Always exit on end-of-line */
if (c == '\n')
{
/* Handle multi-line comments */
if (AcpiGbl_LineScanState == PR_WITHIN_COMMENT)
{
return (ASL_WITHIN_COMMENT);
}
if (i == 1)
{
return (ASL_BLANK_LINE);
}
return (AE_OK);
}
}
}
/*******************************************************************************
*
* FUNCTION: PrMatchDirective

View File

@ -382,6 +382,8 @@ PrPushInputFileStack (
PR_FILE_NODE *Fnode;
Gbl_HasIncludeFiles = TRUE;
/* Save the current state in an Fnode */
Fnode = UtLocalCalloc (sizeof (PR_FILE_NODE));
@ -406,11 +408,11 @@ PrPushInputFileStack (
strcpy (Gbl_Files[ASL_FILE_INPUT].Filename, Filename);
Gbl_Files[ASL_FILE_INPUT].Handle = InputFile;
Gbl_PreviousLineNumber = 0;
Gbl_CurrentLineNumber = 0;
Gbl_CurrentLineNumber = 1;
/* Emit a new #line directive for the include file */
Gbl_CurrentLineNumber = 1;
FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u \"%s\"\n", 1, Filename);
}
@ -460,12 +462,11 @@ PrPopInputFileStack (
Gbl_Files[ASL_FILE_INPUT].Filename = Fnode->Filename;
Gbl_Files[ASL_FILE_INPUT].Handle = Fnode->File;
Gbl_CurrentLineNumber = Fnode->CurrentLineNumber;
Gbl_PreviousLineNumber = 0;
/* Emit a new #line directive after the include file */
FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u \"%s\"\n",
Gbl_CurrentLineNumber + 1, Fnode->Filename);
Gbl_CurrentLineNumber, Fnode->Filename);
/* All done with this node */

View File

@ -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;

View File

@ -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");

View File

@ -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);
}

View File

@ -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 */

View File

@ -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;

View File

@ -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));

View File

@ -361,7 +361,7 @@ AcpiDbMatchCommandHelp (
while ((*Command) && (*Invocation) && (*Invocation != ' '))
{
if (ACPI_TOLOWER (*Command) != ACPI_TOLOWER (*Invocation))
if (tolower ((int) *Command) != tolower ((int) *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;

View File

@ -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);
}
#ifdef ACPI_DISASSEMBLER

View File

@ -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 */

View File

@ -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:

View File

@ -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;
}

View File

@ -435,7 +435,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 */

View File

@ -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;
}

View File

@ -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 */
/* Convert operator to compound assignment */
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);
Op->Common.DisasmFlags |= ACPI_PARSEOP_COMPOUND;
Child1->Common.OperatorSymbol = NULL;
return (TRUE);
/* Convert operator to compound assignment */
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))
{

View File

@ -269,10 +269,10 @@ AcpiDmPredefinedDescription (
* Note: NameString is guaranteed to be upper case here.
*/
LastCharIsDigit =
(ACPI_IS_DIGIT (NameString[3])); /* d */
(isdigit ((int) NameString[3])); /* d */
LastCharsAreHex =
(ACPI_IS_XDIGIT (NameString[2]) && /* xx */
ACPI_IS_XDIGIT (NameString[3]));
(isxdigit ((int) NameString[2]) && /* xx */
isxdigit ((int) NameString[3]));
switch (NameString[1])
{

View File

@ -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 */

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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
{

View File

@ -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))

View File

@ -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 */

View File

@ -515,7 +515,7 @@ AcpiExLoadOp (
return_ACPI_STATUS (AE_NO_MEMORY);
}
ACPI_MEMCPY (Table, TableHeader, Length);
memcpy (Table, TableHeader, Length);
break;
default:

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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 */

View File

@ -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));

View File

@ -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);

View File

@ -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));
}

View File

@ -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:

View File

@ -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);
}

View File

@ -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;

View File

@ -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 */

View File

@ -431,6 +431,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

View File

@ -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);
}

View File

@ -51,6 +51,14 @@
/* Local prototypes */
#if (!ACPI_REDUCED_HARDWARE)
static ACPI_STATUS
AcpiHwSetFirmwareWakingVector (
ACPI_TABLE_FACS *Facs,
ACPI_PHYSICAL_ADDRESS PhysicalAddress,
ACPI_PHYSICAL_ADDRESS PhysicalAddress64);
#endif
static ACPI_STATUS
AcpiHwSleepDispatch (
UINT8 SleepState,
@ -77,29 +85,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,13 +124,67 @@ AcpiSetFirmwareWakingVector (
/* Set the 32-bit vector */
AcpiGbl_FACS->FirmwareWakingVector = PhysicalAddress;
Facs->FirmwareWakingVector = (UINT32) PhysicalAddress;
/* Clear the 64-bit vector if it exists */
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);
}
/*******************************************************************************
*
* FUNCTION: AcpiSetFirmwareWakingVector
*
* 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 FirmwareWakingVector fields of the FACS
*
******************************************************************************/
ACPI_STATUS
AcpiSetFirmwareWakingVector (
ACPI_PHYSICAL_ADDRESS PhysicalAddress,
ACPI_PHYSICAL_ADDRESS PhysicalAddress64)
{
ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector);
/* If Hardware Reduced flag is set, there is no FACS */
if (AcpiGbl_ReducedHardware)
{
return_ACPI_STATUS (AE_OK);
}
if (AcpiGbl_Facs32)
{
(void) AcpiHwSetFirmwareWakingVector (AcpiGbl_Facs32,
PhysicalAddress, PhysicalAddress64);
}
if (AcpiGbl_Facs64)
{
(void) AcpiHwSetFirmwareWakingVector (AcpiGbl_Facs64,
PhysicalAddress, PhysicalAddress64);
}
return_ACPI_STATUS (AE_OK);
@ -127,47 +193,6 @@ AcpiSetFirmwareWakingVector (
ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector)
#if ACPI_MACHINE_WIDTH == 64
/*******************************************************************************
*
* FUNCTION: AcpiSetFirmwareWakingVector64
*
* PARAMETERS: PhysicalAddress - 64-bit physical address of ACPI protected
* mode 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.
*
******************************************************************************/
ACPI_STATUS
AcpiSetFirmwareWakingVector64 (
UINT64 PhysicalAddress)
{
ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector64);
/* Determine if the 64-bit vector actually exists */
if ((AcpiGbl_FACS->Length <= 32) || (AcpiGbl_FACS->Version < 1))
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
/* Clear 32-bit vector, set the 64-bit X_ vector */
AcpiGbl_FACS->FirmwareWakingVector = 0;
AcpiGbl_FACS->XFirmwareWakingVector = PhysicalAddress;
return_ACPI_STATUS (AE_OK);
}
ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector64)
#endif
/*******************************************************************************
*
* FUNCTION: AcpiEnterSleepStateS4bios

View File

@ -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 */

View File

@ -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;

View File

@ -122,7 +122,7 @@ AcpiNsPrintPathname (
{
for (i = 0; i < 4; i++)
{
ACPI_IS_PRINT (Pathname[i]) ?
isprint ((int) Pathname[i]) ?
AcpiOsPrintf ("%c", Pathname[i]) :
AcpiOsPrintf ("?");
}

View File

@ -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;
/*

View File

@ -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;

View File

@ -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);

View File

@ -637,7 +637,7 @@ AcpiNsRepair_HID (
*/
for (Dest = NewString->String.Pointer; *Source; Dest++, Source++)
{
*Dest = (char) ACPI_TOUPPER (*Source);
*Dest = (char) toupper ((int) *Source);
}
AcpiUtRemoveReference (ReturnObject);

View File

@ -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)
{
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));
AcpiNsDeleteChildren (*ReturnNode);
if (AcpiGbl_RuntimeNamespaceOverride)
{
AcpiUtRemoveReference ((*ReturnNode)->Object);
(*ReturnNode)->Object = NULL;
(*ReturnNode)->OwnerId = WalkState->OwnerId;
}
else
{
AcpiNsRemoveNode (*ReturnNode);
*ReturnNode = ACPI_ENTRY_NOT_FOUND;
}
}
/* 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

View File

@ -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++;
}
}

View File

@ -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 */

View File

@ -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 @@ AcpiGetObjectInfo (
{
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 */

Some files were not shown because too many files have changed in this diff Show More