diff --git a/changes.txt b/changes.txt index 511652fced60..e3ecef022b00 100644 --- a/changes.txt +++ b/changes.txt @@ -1,5 +1,114 @@ ---------------------------------------- -08 April 2015. Summary of changes for version 20150515: +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 +143,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. diff --git a/source/common/adisasm.c b/source/common/adisasm.c index a092923ed27b..1fe6e06837ac 100644 --- a/source/common/adisasm.c +++ b/source/common/adisasm.c @@ -243,7 +243,7 @@ AdAmlDisassemble ( while (ExternalFileList) { ExternalFilename = ExternalFileList->Path; - if (!ACPI_STRCMP (ExternalFilename, Filename)) + if (!strcmp (ExternalFilename, Filename)) { /* Next external file */ diff --git a/source/common/ahids.c b/source/common/ahids.c index f2f178617c96..0c0fc41174ef 100644 --- a/source/common/ahids.c +++ b/source/common/ahids.c @@ -230,7 +230,7 @@ AcpiAhMatchHardwareId ( for (Info = AslDeviceIds; Info->Name; Info++) { - if (!ACPI_STRCMP (HardwareId, Info->Name)) + if (!strcmp (HardwareId, Info->Name)) { return (Info); } diff --git a/source/common/ahpredef.c b/source/common/ahpredef.c index e728c64b5bf0..85182495e901 100644 --- a/source/common/ahpredef.c +++ b/source/common/ahpredef.c @@ -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"), diff --git a/source/common/ahuuids.c b/source/common/ahuuids.c index 1d5e50a40050..d48ea40e6c57 100644 --- a/source/common/ahuuids.c +++ b/source/common/ahuuids.c @@ -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); } diff --git a/source/common/dmextern.c b/source/common/dmextern.c index a24ce0bd492a..30beba36d34e 100644 --- a/source/common/dmextern.c +++ b/source/common/dmextern.c @@ -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 */ diff --git a/source/common/dmrestag.c b/source/common/dmrestag.c index 689240a3b674..c10c364200f0 100644 --- a/source/common/dmrestag.c +++ b/source/common/dmrestag.c @@ -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 */ diff --git a/source/common/dmtable.c b/source/common/dmtable.c index 125bd180cd05..91fd6be87da7 100644 --- a/source/common/dmtable.c +++ b/source/common/dmtable.c @@ -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: diff --git a/source/common/dmtbdump.c b/source/common/dmtbdump.c index af69f5656563..4711b687ab0f 100644 --- a/source/common/dmtbdump.c +++ b/source/common/dmtbdump.c @@ -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); diff --git a/source/common/dmtbinfo.c b/source/common/dmtbinfo.c index 446e9849ab70..50a1ee07106b 100644 --- a/source/common/dmtbinfo.c +++ b/source/common/dmtbinfo.c @@ -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 diff --git a/source/common/getopt.c b/source/common/getopt.c index 276a83cd6081..df069728533f 100644 --- a/source/common/getopt.c +++ b/source/common/getopt.c @@ -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); diff --git a/source/compiler/aslanalyze.c b/source/compiler/aslanalyze.c index 705cccf85fb5..45c4431abb74 100644 --- a/source/compiler/aslanalyze.c +++ b/source/compiler/aslanalyze.c @@ -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; diff --git a/source/compiler/aslascii.c b/source/compiler/aslascii.c index 90abef24736d..7ff1c4a653c7 100644 --- a/source/compiler/aslascii.c +++ b/source/compiler/aslascii.c @@ -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)) { diff --git a/source/compiler/aslcodegen.c b/source/compiler/aslcodegen.c index 38bf9cf237f6..dc8b7d51e626 100644 --- a/source/compiler/aslcodegen.c +++ b/source/compiler/aslcodegen.c @@ -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 */ diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index 47f92b44e4df..afc004d7deee 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -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) { diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h index 0156961a310c..dfe80c19b2df 100644 --- a/source/compiler/aslcompiler.h +++ b/source/compiler/aslcompiler.h @@ -1003,7 +1003,7 @@ UtDoConstant ( char *String); ACPI_STATUS -UtStrtoul64 ( +stroul64 ( char *String, UINT32 Base, UINT64 *RetInteger); diff --git a/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l index 9da55bd1e4e3..d7b7e08370f9 100644 --- a/source/compiler/aslcompiler.l +++ b/source/compiler/aslcompiler.l @@ -709,7 +709,7 @@ NamePathTail [.]{NameSeg} return (PARSEOP_NAMESTRING); } . { count (1); - if (ACPI_IS_PRINT (*AslCompilertext)) + if (isprint (*AslCompilertext)) { sprintf (MsgBuffer, "Invalid character (%c), expecting ASL keyword or name", diff --git a/source/compiler/asldefine.h b/source/compiler/asldefine.h index 0697276d28a2..0b5f614a6481 100644 --- a/source/compiler/asldefine.h +++ b/source/compiler/asldefine.h @@ -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 */ diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c index 75c6d759edca..4f430d11d048 100644 --- a/source/compiler/aslerror.c +++ b/source/compiler/aslerror.c @@ -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 */ diff --git a/source/compiler/aslfileio.c b/source/compiler/aslfileio.c index c7d398d8423a..4db97a67358a 100644 --- a/source/compiler/aslfileio.c +++ b/source/compiler/aslfileio.c @@ -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 (); + } + } + } diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c index 947e465fe35a..fcdc3c28d84a 100644 --- a/source/compiler/aslfiles.c +++ b/source/compiler/aslfiles.c @@ -43,6 +43,7 @@ #include "aslcompiler.h" #include "acapps.h" +#include "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) != 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) diff --git a/source/compiler/aslfold.c b/source/compiler/aslfold.c index 8c11860e6813..6baa081359d8 100644 --- a/source/compiler/aslfold.c +++ b/source/compiler/aslfold.c @@ -380,10 +380,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); } @@ -547,7 +549,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 +577,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 +600,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", diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h index c61b8ff30099..0696b6751927 100644 --- a/source/compiler/aslglobal.h +++ b/source/compiler/aslglobal.h @@ -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); diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c index 447b8cb5b5a7..bbb907636b16 100644 --- a/source/compiler/aslmain.c +++ b/source/compiler/aslmain.c @@ -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++) { diff --git a/source/compiler/aslmapenter.c b/source/compiler/aslmapenter.c index 652871d860c3..8ab3e6273241 100644 --- a/source/compiler/aslmapenter.c +++ b/source/compiler/aslmapenter.c @@ -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; diff --git a/source/compiler/aslmapoutput.c b/source/compiler/aslmapoutput.c index c8d8c68dfb3e..07ed89a1eb59 100644 --- a/source/compiler/aslmapoutput.c +++ b/source/compiler/aslmapoutput.c @@ -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); diff --git a/source/compiler/aslmethod.c b/source/compiler/aslmethod.c index 6ed0f62ee8d3..6d53cec5555d 100644 --- a/source/compiler/aslmethod.c +++ b/source/compiler/aslmethod.c @@ -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; diff --git a/source/compiler/aslopcodes.c b/source/compiler/aslopcodes.c index 0a22b79a36ee..fa3d1fca0e11 100644 --- a/source/compiler/aslopcodes.c +++ b/source/compiler/aslopcodes.c @@ -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) diff --git a/source/compiler/asloperands.c b/source/compiler/asloperands.c index 26706709587f..174a53ac75ed 100644 --- a/source/compiler/asloperands.c +++ b/source/compiler/asloperands.c @@ -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 diff --git a/source/compiler/aslopt.c b/source/compiler/aslopt.c index 77b185e45700..7770f3eb4bb1 100644 --- a/source/compiler/aslopt.c +++ b/source/compiler/aslopt.c @@ -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 diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c index 51aae7a41ae1..57bb12b03f8e 100644 --- a/source/compiler/asloptions.c +++ b/source/compiler/asloptions.c @@ -194,6 +194,7 @@ AslDoOptions ( DtParserdebug = 1; PrParserdebug = 1; Gbl_DebugFlag = TRUE; + Gbl_KeepPreprocessorTempFile = TRUE; break; case 'p': /* Prune ASL parse tree */ diff --git a/source/compiler/aslprintf.c b/source/compiler/aslprintf.c index 9acc94b99d59..fc32d0fdafab 100644 --- a/source/compiler/aslprintf.c +++ b/source/compiler/aslprintf.c @@ -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; diff --git a/source/compiler/aslstartup.c b/source/compiler/aslstartup.c index 7cee85c59c11..1ec9a351e2cd 100644 --- a/source/compiler/aslstartup.c +++ b/source/compiler/aslstartup.c @@ -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]); diff --git a/source/compiler/aslsupport.l b/source/compiler/aslsupport.l index b3149cf4dc82..0016626e41f0 100644 --- a/source/compiler/aslsupport.l +++ b/source/compiler/aslsupport.l @@ -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); diff --git a/source/compiler/asltypes.h b/source/compiler/asltypes.h index 4bd24da18e5a..343c364c49ff 100644 --- a/source/compiler/asltypes.h +++ b/source/compiler/asltypes.h @@ -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 */ diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c index 6b94d2884f44..8b77c8e1f4fa 100644 --- a/source/compiler/aslutils.c +++ b/source/compiler/aslutils.c @@ -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) diff --git a/source/compiler/asluuid.c b/source/compiler/asluuid.c index 46cb526f99eb..86ca83a7fce7 100644 --- a/source/compiler/asluuid.c +++ b/source/compiler/asluuid.c @@ -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); } diff --git a/source/compiler/dtcompile.c b/source/compiler/dtcompile.c index 827905529d79..58e749f5bc73 100644 --- a/source/compiler/dtcompile.c +++ b/source/compiler/dtcompile.c @@ -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; diff --git a/source/compiler/dtexpress.c b/source/compiler/dtexpress.c index bf92795170e8..97d01151419a 100644 --- a/source/compiler/dtexpress.c +++ b/source/compiler/dtexpress.c @@ -413,7 +413,7 @@ DtLookupLabel ( LabelField = Gbl_LabelList; while (LabelField) { - if (!ACPI_STRCMP (Name, LabelField->Value)) + if (!strcmp (Name, LabelField->Value)) { return (LabelField); } diff --git a/source/compiler/dtfield.c b/source/compiler/dtfield.c index 4a6f1bb27fd2..f083f05ae3f5 100644 --- a/source/compiler/dtfield.c +++ b/source/compiler/dtfield.c @@ -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++)) diff --git a/source/compiler/dtio.c b/source/compiler/dtio.c index a42ca2d91bcc..3b108ec5071d 100644 --- a/source/compiler/dtio.c +++ b/source/compiler/dtio.c @@ -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); @@ -415,7 +415,7 @@ DtGetNextLine ( int c; - ACPI_MEMSET (Gbl_CurrentLineBuffer, 0, Gbl_LineBufferSize); + memset (Gbl_CurrentLineBuffer, 0, Gbl_LineBufferSize); for (i = 0; ;) { /* @@ -897,7 +897,7 @@ DtDumpBuffer ( } BufChar = Buffer[(ACPI_SIZE) i + j]; - if (ACPI_IS_PRINT (BufChar)) + if (isprint (BufChar)) { FlPrintFile (FileId, "%c", BufChar); } diff --git a/source/compiler/dtparser.y b/source/compiler/dtparser.y index fca1e90a7372..f8bafbb3d311 100644 --- a/source/compiler/dtparser.y +++ b/source/compiler/dtparser.y @@ -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, &$$);} ; %% diff --git a/source/compiler/dtsubtable.c b/source/compiler/dtsubtable.c index d7e4eff8bf75..0d774839129d 100644 --- a/source/compiler/dtsubtable.c +++ b/source/compiler/dtsubtable.c @@ -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); } diff --git a/source/compiler/dttable.c b/source/compiler/dttable.c index d7b2e90f3949..22b4c9c4c165 100644 --- a/source/compiler/dttable.c +++ b/source/compiler/dttable.c @@ -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; } diff --git a/source/compiler/dttemplate.c b/source/compiler/dttemplate.c index 70dfe2d81cde..3da0692bb086 100644 --- a/source/compiler/dttemplate.c +++ b/source/compiler/dttemplate.c @@ -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, diff --git a/source/compiler/dttemplate.h b/source/compiler/dttemplate.h index 1b27b4e7f01e..6d76f4d64b9c 100644 --- a/source/compiler/dttemplate.h +++ b/source/compiler/dttemplate.h @@ -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 */ diff --git a/source/compiler/dtutils.c b/source/compiler/dtutils.c index 5b88d117e477..51068ed7ba32 100644 --- a/source/compiler/dtutils.c +++ b/source/compiler/dtutils.c @@ -241,7 +241,7 @@ DtStrtoul64 ( while (*ThisChar) { - if (ACPI_IS_DIGIT (*ThisChar)) + if (isdigit (*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 (*ThisChar); + if (!isxdigit ((char) 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: diff --git a/source/compiler/prparser.y b/source/compiler/prparser.y index f76123364a32..67587331a119 100644 --- a/source/compiler/prparser.y +++ b/source/compiler/prparser.y @@ -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, &$$);} ; %% diff --git a/source/compiler/prscan.c b/source/compiler/prscan.c index 47f772ff33d2..393d80149fb1 100644 --- a/source/compiler/prscan.c +++ b/source/compiler/prscan.c @@ -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 diff --git a/source/compiler/prutils.c b/source/compiler/prutils.c index a802fcf3ca1b..d967e5cb19b8 100644 --- a/source/compiler/prutils.c +++ b/source/compiler/prutils.c @@ -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 */ diff --git a/source/components/debugger/dbcmds.c b/source/components/debugger/dbcmds.c index 83167734039b..4a2c4e850107 100644 --- a/source/components/debugger/dbcmds.c +++ b/source/components/debugger/dbcmds.c @@ -111,7 +111,7 @@ AcpiDbConvertToNode ( { /* Numeric argument, convert */ - Address = ACPI_STRTOUL (InString, NULL, 16); + Address = strtoul (InString, NULL, 16); Node = ACPI_TO_POINTER (Address); if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) { @@ -189,7 +189,7 @@ AcpiDbSleep ( /* Convert argument to binary and invoke the sleep state */ - SleepState = (UINT8) ACPI_STRTOUL (ObjectArg, NULL, 0); + SleepState = (UINT8) strtoul (ObjectArg, NULL, 0); AcpiDbDoOneSleepState (SleepState); return_ACPI_STATUS (AE_OK); } @@ -561,7 +561,7 @@ AcpiDbDisplayInterfaces ( /* Install - install an interface */ - SubString = ACPI_STRSTR ("INSTALL", ActionArg); + SubString = strstr ("INSTALL", ActionArg); if (SubString) { Status = AcpiInstallInterface (InterfaceNameArg); @@ -575,7 +575,7 @@ AcpiDbDisplayInterfaces ( /* Remove - remove an interface */ - SubString = ACPI_STRSTR ("REMOVE", ActionArg); + SubString = strstr ("REMOVE", ActionArg); if (SubString) { Status = AcpiRemoveInterface (InterfaceNameArg); @@ -736,7 +736,7 @@ AcpiDmCompareAmlResources ( /* Check for descriptor byte match */ - else if (ACPI_MEMCMP (Aml1, Aml2, Aml1Length)) + else if (memcmp (Aml1, Aml2, Aml1Length)) { AcpiOsPrintf ( "**** Data mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X ****\n", @@ -1138,7 +1138,7 @@ AcpiDbDisplayResources ( /* Asterisk means "display resources for all devices" */ - if (!ObjectArg || (!ACPI_STRCMP (ObjectArg, "*"))) + if (!ObjectArg || (!strcmp (ObjectArg, "*"))) { (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, AcpiDbDeviceResources, NULL, NULL, NULL); @@ -1191,7 +1191,7 @@ AcpiDbGenerateGpe ( ACPI_GPE_EVENT_INFO *GpeEventInfo; - GpeNumber = ACPI_STRTOUL (GpeArg, NULL, 0); + GpeNumber = strtoul (GpeArg, NULL, 0); /* * If no block arg, or block arg == 0 or 1, use the FADT-defined @@ -1199,7 +1199,7 @@ AcpiDbGenerateGpe ( */ if (BlockArg) { - BlockNumber = ACPI_STRTOUL (BlockArg, NULL, 0); + BlockNumber = strtoul (BlockArg, NULL, 0); if (BlockNumber == 1) { BlockNumber = 0; diff --git a/source/components/debugger/dbconvert.c b/source/components/debugger/dbconvert.c index 2a517d2c7a9e..4c7b4ba4a717 100644 --- a/source/components/debugger/dbconvert.c +++ b/source/components/debugger/dbconvert.c @@ -77,7 +77,7 @@ AcpiDbHexCharToValue ( /* Digit must be ascii [0-9a-fA-F] */ - if (!ACPI_IS_XDIGIT (HexChar)) + if (!isxdigit (HexChar)) { return (AE_BAD_HEX_CONSTANT); } @@ -88,7 +88,7 @@ AcpiDbHexCharToValue ( } else { - Value = (UINT8) (ACPI_TOUPPER (HexChar) - 0x37); + Value = (UINT8) (toupper (HexChar) - 0x37); } *ReturnValue = Value; @@ -306,7 +306,7 @@ AcpiDbConvertToObject ( Object->Type = ACPI_TYPE_STRING; Object->String.Pointer = String; - Object->String.Length = (UINT32) ACPI_STRLEN (String); + Object->String.Length = (UINT32) strlen (String); break; case ACPI_TYPE_BUFFER: @@ -471,7 +471,7 @@ AcpiDbDumpPldBuffer ( /* The two bit-packed buffers should match */ - if (ACPI_MEMCMP (NewBuffer, BufferDesc->Buffer.Pointer, + if (memcmp (NewBuffer, BufferDesc->Buffer.Pointer, BufferDesc->Buffer.Length)) { AcpiOsPrintf ("Converted _PLD buffer does not compare. New:\n"); diff --git a/source/components/debugger/dbdisply.c b/source/components/debugger/dbdisply.c index ac8beebf8324..aedc8bfb8258 100644 --- a/source/components/debugger/dbdisply.c +++ b/source/components/debugger/dbdisply.c @@ -141,7 +141,7 @@ AcpiDbGetPointer ( ACPI_SIZE Address; - Address = ACPI_STRTOUL (Target, NULL, 16); + Address = strtoul (Target, NULL, 16); ObjPtr = ACPI_TO_POINTER (Address); return (ObjPtr); } diff --git a/source/components/debugger/dbexec.c b/source/components/debugger/dbexec.c index 1cf87603512b..433cc55c3b73 100644 --- a/source/components/debugger/dbexec.c +++ b/source/components/debugger/dbexec.c @@ -433,15 +433,15 @@ AcpiDbExecute ( } else { - NameString = ACPI_ALLOCATE (ACPI_STRLEN (Name) + 1); + NameString = ACPI_ALLOCATE (strlen (Name) + 1); if (!NameString) { return; } - ACPI_MEMSET (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); + memset (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); - ACPI_STRCPY (NameString, Name); + strcpy (NameString, Name); AcpiUtStrupr (NameString); AcpiGbl_DbMethodInfo.Name = NameString; AcpiGbl_DbMethodInfo.Args = Args; @@ -669,8 +669,8 @@ AcpiDbCreateExecutionThreads ( /* Get the arguments */ - NumThreads = ACPI_STRTOUL (NumThreadsArg, NULL, 0); - NumLoops = ACPI_STRTOUL (NumLoopsArg, NULL, 0); + NumThreads = strtoul (NumThreadsArg, NULL, 0); + NumLoops = strtoul (NumLoopsArg, NULL, 0); if (!NumThreads || !NumLoops) { @@ -714,7 +714,7 @@ AcpiDbCreateExecutionThreads ( return; } - ACPI_MEMSET (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); + memset (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); /* Array to store IDs of threads */ @@ -729,7 +729,7 @@ AcpiDbCreateExecutionThreads ( (void) AcpiOsDeleteSemaphore (InfoGate); return; } - ACPI_MEMSET (AcpiGbl_DbMethodInfo.Threads, 0, Size); + memset (AcpiGbl_DbMethodInfo.Threads, 0, Size); /* Setup the context to be passed to each thread */ diff --git a/source/components/debugger/dbfileio.c b/source/components/debugger/dbfileio.c index f9d7635ecd0c..5d526207a5cb 100644 --- a/source/components/debugger/dbfileio.c +++ b/source/components/debugger/dbfileio.c @@ -112,7 +112,7 @@ AcpiDbOpenDebugFile ( } AcpiOsPrintf ("Debug output file %s opened\n", Name); - ACPI_STRNCPY (AcpiGbl_DbDebugFilename, Name, + strncpy (AcpiGbl_DbDebugFilename, Name, sizeof (AcpiGbl_DbDebugFilename)); AcpiGbl_DbOutputToFile = TRUE; diff --git a/source/components/debugger/dbhistry.c b/source/components/debugger/dbhistry.c index 70bca4286de9..bc29d3b09ebc 100644 --- a/source/components/debugger/dbhistry.c +++ b/source/components/debugger/dbhistry.c @@ -92,7 +92,7 @@ AcpiDbAddToHistory ( /* Put command into the next available slot */ - CmdLen = (UINT16) ACPI_STRLEN (CommandLine); + CmdLen = (UINT16) strlen (CommandLine); if (!CmdLen) { return; @@ -100,7 +100,7 @@ AcpiDbAddToHistory ( if (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command != NULL) { - BufferLen = (UINT16) ACPI_STRLEN ( + BufferLen = (UINT16) strlen ( AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command); if (CmdLen > BufferLen) { @@ -116,7 +116,7 @@ AcpiDbAddToHistory ( AcpiOsAllocate (CmdLen + 1); } - ACPI_STRCPY (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command, + strcpy (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command, CommandLine); AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].CmdNum = @@ -217,7 +217,7 @@ AcpiDbGetFromHistory ( else { - CmdNum = ACPI_STRTOUL (CommandNumArg, NULL, 0); + CmdNum = strtoul (CommandNumArg, NULL, 0); } return (AcpiDbGetHistoryByIndex (CmdNum)); diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c index 80fd3e602b78..76d2455dc1ae 100644 --- a/source/components/debugger/dbinput.c +++ b/source/components/debugger/dbinput.c @@ -361,7 +361,7 @@ AcpiDbMatchCommandHelp ( while ((*Command) && (*Invocation) && (*Invocation != ' ')) { - if (ACPI_TOLOWER (*Command) != ACPI_TOLOWER (*Invocation)) + if (tolower (*Command) != tolower (*Invocation)) { return (FALSE); } @@ -702,7 +702,7 @@ AcpiDbMatchCommand ( for (i = CMD_FIRST_VALID; AcpiGbl_DbCommands[i].Name; i++) { - if (ACPI_STRSTR (AcpiGbl_DbCommands[i].Name, UserCommand) == + if (strstr (AcpiGbl_DbCommands[i].Name, UserCommand) == AcpiGbl_DbCommands[i].Name) { return (i); @@ -946,7 +946,7 @@ AcpiDbCommandDispatch ( else if (ParamCount == 2) { Temp = AcpiGbl_DbConsoleDebugLevel; - AcpiGbl_DbConsoleDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], + AcpiGbl_DbConsoleDebugLevel = strtoul (AcpiGbl_DbArgs[1], NULL, 16); AcpiOsPrintf ( "Debug Level for console output was %8.8lX, now %8.8lX\n", @@ -955,7 +955,7 @@ AcpiDbCommandDispatch ( else { Temp = AcpiGbl_DbDebugLevel; - AcpiGbl_DbDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16); + AcpiGbl_DbDebugLevel = strtoul (AcpiGbl_DbArgs[1], NULL, 16); AcpiOsPrintf ( "Debug Level for file output was %8.8lX, now %8.8lX\n", Temp, AcpiGbl_DbDebugLevel); @@ -994,7 +994,7 @@ AcpiDbCommandDispatch ( case CMD_NOTIFY: - Temp = ACPI_STRTOUL (AcpiGbl_DbArgs[2], NULL, 0); + Temp = strtoul (AcpiGbl_DbArgs[2], NULL, 0); AcpiDbSendNotify (AcpiGbl_DbArgs[1], Temp); break; diff --git a/source/components/debugger/dbmethod.c b/source/components/debugger/dbmethod.c index c658d6ade87a..2b03d359f3c7 100644 --- a/source/components/debugger/dbmethod.c +++ b/source/components/debugger/dbmethod.c @@ -89,7 +89,7 @@ AcpiDbSetMethodBreakpoint ( /* Get and verify the breakpoint address */ - Address = ACPI_STRTOUL (Location, NULL, 16); + Address = strtoul (Location, NULL, 16); if (Address <= Op->Common.AmlOffset) { AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n", @@ -174,7 +174,7 @@ AcpiDbSetMethodData ( return; } - Value = ACPI_STRTOUL (ValueArg, NULL, 16); + Value = strtoul (ValueArg, NULL, 16); if (Type == 'N') { @@ -196,7 +196,7 @@ AcpiDbSetMethodData ( /* Get the index and value */ - Index = ACPI_STRTOUL (IndexArg, NULL, 16); + Index = strtoul (IndexArg, NULL, 16); WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); if (!WalkState) @@ -304,7 +304,7 @@ AcpiDbDisassembleAml ( if (Statements) { - NumStatements = ACPI_STRTOUL (Statements, NULL, 0); + NumStatements = strtoul (Statements, NULL, 0); } AcpiDmDisassemble (NULL, Op, NumStatements); diff --git a/source/components/debugger/dbnames.c b/source/components/debugger/dbnames.c index 48aaeb0a5587..0b56f076bf7f 100644 --- a/source/components/debugger/dbnames.c +++ b/source/components/debugger/dbnames.c @@ -248,7 +248,7 @@ AcpiDbDumpNamespace ( if (DepthArg) { - MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0); + MaxDepth = strtoul (DepthArg, NULL, 0); } } @@ -319,13 +319,13 @@ AcpiDbDumpNamespaceByOwner ( ACPI_OWNER_ID OwnerId; - OwnerId = (ACPI_OWNER_ID) ACPI_STRTOUL (OwnerArg, NULL, 0); + OwnerId = (ACPI_OWNER_ID) strtoul (OwnerArg, NULL, 0); /* Now we can check for the depth argument */ if (DepthArg) { - MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0); + MaxDepth = strtoul (DepthArg, NULL, 0); } AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); @@ -426,7 +426,7 @@ AcpiDbFindNameInNamespace ( char *AcpiNamePtr = AcpiName; - if (ACPI_STRLEN (NameArg) > 4) + if (strlen (NameArg) > 4) { AcpiOsPrintf ("Name must be no longer than 4 characters\n"); return (AE_OK); @@ -830,7 +830,7 @@ AcpiDbFindReferences ( /* Convert string to object pointer */ - Address = ACPI_STRTOUL (ObjectArg, NULL, 16); + Address = strtoul (ObjectArg, NULL, 16); ObjDesc = ACPI_TO_POINTER (Address); /* Search all nodes in namespace */ diff --git a/source/components/debugger/dbtest.c b/source/components/debugger/dbtest.c index 72a4499ed747..8d68f535863d 100644 --- a/source/components/debugger/dbtest.c +++ b/source/components/debugger/dbtest.c @@ -646,7 +646,7 @@ AcpiDbTestBufferType ( * count is not an integral number of bytes. Zero out the * unused bits. */ - ACPI_MEMSET (Buffer, BUFFER_FILL_VALUE, ByteLength); + memset (Buffer, BUFFER_FILL_VALUE, ByteLength); ExtraBits = BitLength % 8; if (ExtraBits) { @@ -671,7 +671,7 @@ AcpiDbTestBufferType ( goto Exit; } - if (ACPI_MEMCMP (Temp2->Buffer.Pointer, Buffer, ByteLength)) + if (memcmp (Temp2->Buffer.Pointer, Buffer, ByteLength)) { AcpiOsPrintf (" MISMATCH 2: New buffer value"); } @@ -695,7 +695,7 @@ AcpiDbTestBufferType ( goto Exit; } - if (ACPI_MEMCMP (Temp1->Buffer.Pointer, Temp3->Buffer.Pointer, ByteLength)) + if (memcmp (Temp1->Buffer.Pointer, Temp3->Buffer.Pointer, ByteLength)) { AcpiOsPrintf (" MISMATCH 3: While restoring original buffer"); } @@ -751,7 +751,7 @@ AcpiDbTestStringType ( /* Write a new value */ WriteValue.Type = ACPI_TYPE_STRING; - WriteValue.String.Length = ACPI_STRLEN (ValueToWrite); + WriteValue.String.Length = strlen (ValueToWrite); WriteValue.String.Pointer = ValueToWrite; Status = AcpiDbWriteToObject (Node, &WriteValue); @@ -768,7 +768,7 @@ AcpiDbTestStringType ( goto Exit; } - if (ACPI_STRCMP (Temp2->String.Pointer, ValueToWrite)) + if (strcmp (Temp2->String.Pointer, ValueToWrite)) { AcpiOsPrintf (" MISMATCH 2: %s, expecting %s", Temp2->String.Pointer, ValueToWrite); @@ -776,7 +776,7 @@ AcpiDbTestStringType ( /* Write back the original value */ - WriteValue.String.Length = ACPI_STRLEN (Temp1->String.Pointer); + WriteValue.String.Length = strlen (Temp1->String.Pointer); WriteValue.String.Pointer = Temp1->String.Pointer; Status = AcpiDbWriteToObject (Node, &WriteValue); @@ -793,7 +793,7 @@ AcpiDbTestStringType ( goto Exit; } - if (ACPI_STRCMP (Temp1->String.Pointer, Temp3->String.Pointer)) + if (strcmp (Temp1->String.Pointer, Temp3->String.Pointer)) { AcpiOsPrintf (" MISMATCH 3: %s, expecting %s", Temp3->String.Pointer, Temp1->String.Pointer); @@ -926,7 +926,7 @@ AcpiDbWriteToObject ( /* Copy the incoming user parameter */ - ACPI_MEMCPY (&Params[1], Value, sizeof (ACPI_OBJECT)); + memcpy (&Params[1], Value, sizeof (ACPI_OBJECT)); ParamObjects.Count = 2; ParamObjects.Pointer = Params; @@ -970,7 +970,7 @@ AcpiDbEvaluateAllPredefinedNames ( if (CountArg) { - Info.MaxCount = ACPI_STRTOUL (CountArg, NULL, 0); + Info.MaxCount = strtoul (CountArg, NULL, 0); } /* Search all nodes in namespace */ @@ -1077,7 +1077,7 @@ AcpiDbEvaluateOnePredefinedName ( case ACPI_TYPE_STRING: ThisParam->String.Pointer = "This is the default argument string"; - ThisParam->String.Length = ACPI_STRLEN (ThisParam->String.Pointer); + ThisParam->String.Length = strlen (ThisParam->String.Pointer); break; case ACPI_TYPE_BUFFER: diff --git a/source/components/debugger/dbutils.c b/source/components/debugger/dbutils.c index 1b337527897b..a089344e2297 100644 --- a/source/components/debugger/dbutils.c +++ b/source/components/debugger/dbutils.c @@ -96,7 +96,7 @@ AcpiDbMatchArgument ( for (i = 0; Arguments[i].Name; i++) { - if (ACPI_STRSTR (Arguments[i].Name, UserArgument) == Arguments[i].Name) + if (strstr (Arguments[i].Name, UserArgument) == Arguments[i].Name) { return (i); } @@ -375,7 +375,7 @@ AcpiDbUint32ToHexString ( if (Value == 0) { - ACPI_STRCPY (Buffer, "0"); + strcpy (Buffer, "0"); return; } diff --git a/source/components/debugger/dbxface.c b/source/components/debugger/dbxface.c index 04b69adf97a2..33d5e363b649 100644 --- a/source/components/debugger/dbxface.c +++ b/source/components/debugger/dbxface.c @@ -431,7 +431,7 @@ AcpiDbInitialize ( { return_ACPI_STATUS (AE_NO_MEMORY); } - ACPI_MEMSET (AcpiGbl_DbBuffer, 0, ACPI_DEBUG_BUFFER_SIZE); + memset (AcpiGbl_DbBuffer, 0, ACPI_DEBUG_BUFFER_SIZE); /* Initial scope is the root */ diff --git a/source/components/disassembler/dmbuffer.c b/source/components/disassembler/dmbuffer.c index 8cd06a4b9a64..2291bb2c8d22 100644 --- a/source/components/disassembler/dmbuffer.c +++ b/source/components/disassembler/dmbuffer.c @@ -205,7 +205,7 @@ AcpiDmDisasmByteList ( } BufChar = ByteData[CurrentIndex]; - if (ACPI_IS_PRINT (BufChar)) + if (isprint (BufChar)) { AcpiOsPrintf ("%c", BufChar); } @@ -554,7 +554,7 @@ AcpiDmIsStringBuffer ( * they will be handled in the string output routine */ - if (!ACPI_IS_PRINT (ByteData[i])) + if (!isprint (ByteData[i])) { return (FALSE); } @@ -836,7 +836,7 @@ AcpiDmUnicode ( { AcpiOsPrintf ("\\%c", OutputValue); } - else if (!ACPI_IS_PRINT (OutputValue)) + else if (!isprint (OutputValue)) { AcpiOsPrintf ("\\x%2.2X", OutputValue); } @@ -902,7 +902,7 @@ AcpiDmGetHardwareIdType ( for (i = 0; i < 3; i++) { if (!ACPI_IS_ASCII (Prefix[i]) || - !ACPI_IS_ALPHA (Prefix[i])) + !isalpha (Prefix[i])) { return; } diff --git a/source/components/disassembler/dmcstyle.c b/source/components/disassembler/dmcstyle.c index 1f1381969f57..a6ec689e157e 100644 --- a/source/components/disassembler/dmcstyle.c +++ b/source/components/disassembler/dmcstyle.c @@ -337,23 +337,70 @@ AcpiDmCheckForSymbolicOpcode ( */ AcpiDmPromoteTarget (Op, Target); - /* - * Check for possible conversion to a "Compound Assignment". - * - * Determine if either operand is the same as the target - * and display compound assignment operator and other operand. - */ - if ((AcpiDmIsTargetAnOperand (Target, Child1, TRUE)) || - (AcpiDmIsTargetAnOperand (Target, Child2, TRUE))) + /* Check operands for conversion to a "Compound Assignment" */ + + switch (Op->Common.AmlOpcode) { - Target->Common.OperatorSymbol = - AcpiDmGetCompoundSymbol (Op->Common.AmlOpcode); + /* Commutative operators */ - /* 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)) { diff --git a/source/components/disassembler/dmopcode.c b/source/components/disassembler/dmopcode.c index d8ab1d51c758..a312582e595e 100644 --- a/source/components/disassembler/dmopcode.c +++ b/source/components/disassembler/dmopcode.c @@ -269,10 +269,10 @@ AcpiDmPredefinedDescription ( * Note: NameString is guaranteed to be upper case here. */ LastCharIsDigit = - (ACPI_IS_DIGIT (NameString[3])); /* d */ + (isdigit (NameString[3])); /* d */ LastCharsAreHex = - (ACPI_IS_XDIGIT (NameString[2]) && /* xx */ - ACPI_IS_XDIGIT (NameString[3])); + (isxdigit (NameString[2]) && /* xx */ + isxdigit (NameString[3])); switch (NameString[1]) { diff --git a/source/components/dispatcher/dsfield.c b/source/components/dispatcher/dsfield.c index 83100be4497e..69437de24982 100644 --- a/source/components/dispatcher/dsfield.c +++ b/source/components/dispatcher/dsfield.c @@ -530,7 +530,7 @@ AcpiDsCreateField ( } } - ACPI_MEMSET (&Info, 0, sizeof (ACPI_CREATE_FIELD_INFO)); + memset (&Info, 0, sizeof (ACPI_CREATE_FIELD_INFO)); /* Second arg is the field flags */ diff --git a/source/components/dispatcher/dsinit.c b/source/components/dispatcher/dsinit.c index 8957eff40572..aabd30b29448 100644 --- a/source/components/dispatcher/dsinit.c +++ b/source/components/dispatcher/dsinit.c @@ -224,7 +224,7 @@ AcpiDsInitializeObjects ( /* Set all init info to zero */ - ACPI_MEMSET (&Info, 0, sizeof (ACPI_INIT_WALK_INFO)); + memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO)); Info.OwnerId = OwnerId; Info.TableIndex = TableIndex; diff --git a/source/components/dispatcher/dsobject.c b/source/components/dispatcher/dsobject.c index 54899d7406a2..cdc84314c914 100644 --- a/source/components/dispatcher/dsobject.c +++ b/source/components/dispatcher/dsobject.c @@ -348,7 +348,7 @@ AcpiDsBuildInternalBufferObj ( if (ByteList) { - ACPI_MEMCPY (ObjDesc->Buffer.Pointer, ByteList->Named.Data, + memcpy (ObjDesc->Buffer.Pointer, ByteList->Named.Data, ByteListLength); } } @@ -775,7 +775,7 @@ AcpiDsInitObjectFromOp ( case ACPI_TYPE_STRING: ObjDesc->String.Pointer = Op->Common.Value.String; - ObjDesc->String.Length = (UINT32) ACPI_STRLEN (Op->Common.Value.String); + ObjDesc->String.Length = (UINT32) strlen (Op->Common.Value.String); /* * The string is contained in the ACPI table, don't ever try diff --git a/source/components/dispatcher/dsutils.c b/source/components/dispatcher/dsutils.c index fadc7c5cebf9..15c54fb21489 100644 --- a/source/components/dispatcher/dsutils.c +++ b/source/components/dispatcher/dsutils.c @@ -605,7 +605,7 @@ AcpiDsCreateOperand ( ObjDesc = AcpiUtCreateStringObject ((ACPI_SIZE) NameLength); - ACPI_STRNCPY (ObjDesc->String.Pointer, NameString, NameLength); + strncpy (ObjDesc->String.Pointer, NameString, NameLength); Status = AE_OK; } else diff --git a/source/components/dispatcher/dswload.c b/source/components/dispatcher/dswload.c index ab2d80d7dcae..37b7b39cbccc 100644 --- a/source/components/dispatcher/dswload.c +++ b/source/components/dispatcher/dswload.c @@ -325,9 +325,18 @@ AcpiDsLoad1BeginOp ( if ((WalkState->Opcode != AML_SCOPE_OP) && (!(WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP))) { - Flags |= ACPI_NS_ERROR_IF_FOUND; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n", - AcpiUtGetTypeName (ObjectType))); + if (WalkState->NamespaceOverride) + { + Flags |= ACPI_NS_OVERRIDE_IF_FOUND; + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Override allowed\n", + AcpiUtGetTypeName (ObjectType))); + } + else + { + Flags |= ACPI_NS_ERROR_IF_FOUND; + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n", + AcpiUtGetTypeName (ObjectType))); + } } else { diff --git a/source/components/events/evgpe.c b/source/components/events/evgpe.c index 4e635ce77e2b..2ce57f9d460c 100644 --- a/source/components/events/evgpe.c +++ b/source/components/events/evgpe.c @@ -104,6 +104,7 @@ AcpiEvUpdateGpeEnableMask ( { ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, (UINT8) RegisterBit); } + GpeRegisterInfo->EnableMask = GpeRegisterInfo->EnableForRun; return_ACPI_STATUS (AE_OK); } @@ -141,7 +142,7 @@ AcpiEvEnableGpe ( /* Enable the requested GPE */ - Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE_SAVE); + Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE); return_ACPI_STATUS (Status); } @@ -231,7 +232,7 @@ AcpiEvRemoveGpeReference ( Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo); if (ACPI_SUCCESS (Status)) { - Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE_SAVE); + Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); } if (ACPI_FAILURE (Status)) diff --git a/source/components/events/evgpeinit.c b/source/components/events/evgpeinit.c index 1943d23ea431..d23a345263d4 100644 --- a/source/components/events/evgpeinit.c +++ b/source/components/events/evgpeinit.c @@ -395,7 +395,7 @@ AcpiEvMatchGpeMethod ( /* 4) The last two characters of the name are the hex GPE Number */ - GpeNumber = ACPI_STRTOUL (&Name[2], NULL, 16); + GpeNumber = strtoul (&Name[2], NULL, 16); if (GpeNumber == ACPI_UINT32_MAX) { /* Conversion failed; invalid method, just ignore it */ diff --git a/source/components/executer/exconfig.c b/source/components/executer/exconfig.c index aa233b7eae4f..85389dde258b 100644 --- a/source/components/executer/exconfig.c +++ b/source/components/executer/exconfig.c @@ -515,7 +515,7 @@ AcpiExLoadOp ( return_ACPI_STATUS (AE_NO_MEMORY); } - ACPI_MEMCPY (Table, TableHeader, Length); + memcpy (Table, TableHeader, Length); break; default: diff --git a/source/components/executer/exconvrt.c b/source/components/executer/exconvrt.c index e0ef65357b45..b8f032c6774e 100644 --- a/source/components/executer/exconvrt.c +++ b/source/components/executer/exconvrt.c @@ -251,7 +251,7 @@ AcpiExConvertToBuffer ( /* Copy the integer to the buffer, LSB first */ NewBuf = ReturnDesc->Buffer.Pointer; - ACPI_MEMCPY (NewBuf, + memcpy (NewBuf, &ObjDesc->Integer.Value, AcpiGbl_IntegerByteWidth); break; @@ -276,7 +276,7 @@ AcpiExConvertToBuffer ( /* Copy the string to the buffer */ NewBuf = ReturnDesc->Buffer.Pointer; - ACPI_STRNCPY ((char *) NewBuf, (char *) ObjDesc->String.Pointer, + strncpy ((char *) NewBuf, (char *) ObjDesc->String.Pointer, ObjDesc->String.Length); break; diff --git a/source/components/executer/exdebug.c b/source/components/executer/exdebug.c index dd41f9334fa1..6ca866c01b04 100644 --- a/source/components/executer/exdebug.c +++ b/source/components/executer/exdebug.c @@ -81,6 +81,8 @@ AcpiExDoDebugObject ( { UINT32 i; UINT32 Timer; + ACPI_OPERAND_OBJECT *ObjectDesc; + UINT32 Value; ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc); @@ -267,8 +269,37 @@ AcpiExDoDebugObject ( } else { - AcpiExDoDebugObject (SourceDesc->Reference.Object, - Level+4, 0); + ObjectDesc = SourceDesc->Reference.Object; + Value = SourceDesc->Reference.Value; + + switch (ObjectDesc->Common.Type) + { + case ACPI_TYPE_BUFFER: + + AcpiOsPrintf ("Buffer[%u] = 0x%2.2X\n", + Value, *SourceDesc->Reference.IndexPointer); + break; + + case ACPI_TYPE_STRING: + + AcpiOsPrintf ("String[%u] = \"%c\" (0x%2.2X)\n", + Value, *SourceDesc->Reference.IndexPointer, + *SourceDesc->Reference.IndexPointer); + break; + + case ACPI_TYPE_PACKAGE: + + AcpiOsPrintf ("Package[%u] = ", Value); + AcpiExDoDebugObject (*SourceDesc->Reference.Where, + Level+4, 0); + break; + + default: + + AcpiOsPrintf ("Unknown Reference object type %X\n", + ObjectDesc->Common.Type); + break; + } } } break; diff --git a/source/components/executer/exdump.c b/source/components/executer/exdump.c index c76a1a4de36d..299a1a0928ed 100644 --- a/source/components/executer/exdump.c +++ b/source/components/executer/exdump.c @@ -238,7 +238,7 @@ static ACPI_EXDUMP_INFO AcpiExDumpIndexField[5] = {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.DataObj), "Data Object"} }; -static ACPI_EXDUMP_INFO AcpiExDumpReference[8] = +static ACPI_EXDUMP_INFO AcpiExDumpReference[9] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpReference), NULL}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.Class), "Class"}, @@ -247,6 +247,7 @@ static ACPI_EXDUMP_INFO AcpiExDumpReference[8] = {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Object), "Object Desc"}, {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Reference.Node), "Node"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Where), "Where"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.IndexPointer), "Index Pointer"}, {ACPI_EXD_REFERENCE,0, NULL} }; @@ -1053,16 +1054,18 @@ AcpiExDumpReferenceObj ( { if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) { - AcpiOsPrintf (" Target: %p", ObjDesc->Reference.Object); + AcpiOsPrintf ("%22s %p", "Target :", + ObjDesc->Reference.Object); if (ObjDesc->Reference.Class == ACPI_REFCLASS_TABLE) { - AcpiOsPrintf (" Table Index: %X\n", ObjDesc->Reference.Value); + AcpiOsPrintf (" Table Index: %X\n", + ObjDesc->Reference.Value); } else { - AcpiOsPrintf (" Target: %p [%s]\n", ObjDesc->Reference.Object, + AcpiOsPrintf (" [%s]\n", AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) - ObjDesc->Reference.Object)->Common.Type)); + ObjDesc->Reference.Object)->Common.Type)); } } else diff --git a/source/components/executer/exfield.c b/source/components/executer/exfield.c index 9407fa78976d..d0ebcf04cadb 100644 --- a/source/components/executer/exfield.c +++ b/source/components/executer/exfield.c @@ -460,7 +460,7 @@ AcpiExWriteDataToField ( } Buffer = BufferDesc->Buffer.Pointer; - ACPI_MEMCPY (Buffer, SourceDesc->Buffer.Pointer, Length); + memcpy (Buffer, SourceDesc->Buffer.Pointer, Length); /* Lock entire transaction if requested */ diff --git a/source/components/executer/exfldio.c b/source/components/executer/exfldio.c index 7e81d42b4b82..5c95223b2c64 100644 --- a/source/components/executer/exfldio.c +++ b/source/components/executer/exfldio.c @@ -456,7 +456,7 @@ AcpiExFieldDatumIo ( * Copy the data from the source buffer. * Length is the field width in bytes. */ - ACPI_MEMCPY (Value, + memcpy (Value, (ObjDesc->BufferField.BufferObj)->Buffer.Pointer + ObjDesc->BufferField.BaseByteOffset + FieldDatumByteOffset, @@ -468,7 +468,7 @@ AcpiExFieldDatumIo ( * Copy the data to the target buffer. * Length is the field width in bytes. */ - ACPI_MEMCPY ((ObjDesc->BufferField.BufferObj)->Buffer.Pointer + + memcpy ((ObjDesc->BufferField.BufferObj)->Buffer.Pointer + ObjDesc->BufferField.BaseByteOffset + FieldDatumByteOffset, Value, ObjDesc->CommonField.AccessByteWidth); @@ -748,7 +748,7 @@ AcpiExExtractFromField ( return_ACPI_STATUS (AE_BUFFER_OVERFLOW); } - ACPI_MEMSET (Buffer, 0, BufferLength); + memset (Buffer, 0, BufferLength); AccessBitWidth = ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth); /* Handle the simple case here */ @@ -765,7 +765,7 @@ AcpiExExtractFromField ( /* Use RawDatum (UINT64) to handle buffers < 64 bits */ Status = AcpiExFieldDatumIo (ObjDesc, 0, &RawDatum, ACPI_READ); - ACPI_MEMCPY (Buffer, &RawDatum, BufferLength); + memcpy (Buffer, &RawDatum, BufferLength); } return_ACPI_STATUS (Status); @@ -835,7 +835,7 @@ AcpiExExtractFromField ( /* Write merged datum to target buffer */ - ACPI_MEMCPY (((char *) Buffer) + BufferOffset, &MergedDatum, + memcpy (((char *) Buffer) + BufferOffset, &MergedDatum, ACPI_MIN(ObjDesc->CommonField.AccessByteWidth, BufferLength - BufferOffset)); @@ -853,7 +853,7 @@ AcpiExExtractFromField ( /* Write the last datum to the buffer */ - ACPI_MEMCPY (((char *) Buffer) + BufferOffset, &MergedDatum, + memcpy (((char *) Buffer) + BufferOffset, &MergedDatum, ACPI_MIN(ObjDesc->CommonField.AccessByteWidth, BufferLength - BufferOffset)); @@ -926,7 +926,7 @@ AcpiExInsertIntoField ( * at Byte zero. All unused (upper) bytes of the * buffer will be 0. */ - ACPI_MEMCPY ((char *) NewBuffer, (char *) Buffer, BufferLength); + memcpy ((char *) NewBuffer, (char *) Buffer, BufferLength); Buffer = NewBuffer; BufferLength = RequiredLength; } @@ -969,7 +969,7 @@ AcpiExInsertIntoField ( /* Get initial Datum from the input buffer */ - ACPI_MEMCPY (&RawDatum, Buffer, + memcpy (&RawDatum, Buffer, ACPI_MIN(ObjDesc->CommonField.AccessByteWidth, BufferLength - BufferOffset)); @@ -1021,7 +1021,7 @@ AcpiExInsertIntoField ( /* Get the next input datum from the buffer */ BufferOffset += ObjDesc->CommonField.AccessByteWidth; - ACPI_MEMCPY (&RawDatum, ((char *) Buffer) + BufferOffset, + memcpy (&RawDatum, ((char *) Buffer) + BufferOffset, ACPI_MIN(ObjDesc->CommonField.AccessByteWidth, BufferLength - BufferOffset)); diff --git a/source/components/executer/exmisc.c b/source/components/executer/exmisc.c index 49fad87fd8a6..2a7b6202a663 100644 --- a/source/components/executer/exmisc.c +++ b/source/components/executer/exmisc.c @@ -225,8 +225,8 @@ AcpiExConcatTemplate ( * EndTag descriptor is copied from Operand1. */ NewBuf = ReturnDesc->Buffer.Pointer; - ACPI_MEMCPY (NewBuf, Operand0->Buffer.Pointer, Length0); - ACPI_MEMCPY (NewBuf + Length0, Operand1->Buffer.Pointer, Length1); + memcpy (NewBuf, Operand0->Buffer.Pointer, Length0); + memcpy (NewBuf + Length0, Operand1->Buffer.Pointer, Length1); /* Insert EndTag and set the checksum to zero, means "ignore checksum" */ @@ -340,12 +340,12 @@ AcpiExDoConcatenate ( /* Copy the first integer, LSB first */ - ACPI_MEMCPY (NewBuf, &Operand0->Integer.Value, + memcpy (NewBuf, &Operand0->Integer.Value, AcpiGbl_IntegerByteWidth); /* Copy the second integer (LSB first) after the first */ - ACPI_MEMCPY (NewBuf + AcpiGbl_IntegerByteWidth, + memcpy (NewBuf + AcpiGbl_IntegerByteWidth, &LocalOperand1->Integer.Value, AcpiGbl_IntegerByteWidth); break; @@ -367,8 +367,8 @@ AcpiExDoConcatenate ( /* Concatenate the strings */ - ACPI_STRCPY (NewBuf, Operand0->String.Pointer); - ACPI_STRCPY (NewBuf + Operand0->String.Length, + strcpy (NewBuf, Operand0->String.Pointer); + strcpy (NewBuf + Operand0->String.Length, LocalOperand1->String.Pointer); break; @@ -389,9 +389,9 @@ AcpiExDoConcatenate ( /* Concatenate the buffers */ - ACPI_MEMCPY (NewBuf, Operand0->Buffer.Pointer, + memcpy (NewBuf, Operand0->Buffer.Pointer, Operand0->Buffer.Length); - ACPI_MEMCPY (NewBuf + Operand0->Buffer.Length, + memcpy (NewBuf + Operand0->Buffer.Length, LocalOperand1->Buffer.Pointer, LocalOperand1->Buffer.Length); break; @@ -712,7 +712,7 @@ AcpiExDoLogicalOp ( /* Lexicographic compare: compare the data bytes */ - Compare = ACPI_MEMCMP (Operand0->Buffer.Pointer, + Compare = memcmp (Operand0->Buffer.Pointer, LocalOperand1->Buffer.Pointer, (Length0 > Length1) ? Length1 : Length0); diff --git a/source/components/executer/exnames.c b/source/components/executer/exnames.c index dbadb5a69036..61a5bbd7d29c 100644 --- a/source/components/executer/exnames.c +++ b/source/components/executer/exnames.c @@ -221,7 +221,7 @@ AcpiExNameSegment ( if (NameString) { - ACPI_STRCAT (NameString, CharBuf); + strcat (NameString, CharBuf); ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Appended to - %s\n", NameString)); } diff --git a/source/components/executer/exoparg2.c b/source/components/executer/exoparg2.c index 419aa6d87792..a5b1513e4028 100644 --- a/source/components/executer/exoparg2.c +++ b/source/components/executer/exoparg2.c @@ -368,7 +368,7 @@ AcpiExOpcode_2A_1T_1R ( * Copy the raw buffer data with no transform. * (NULL terminated already) */ - ACPI_MEMCPY (ReturnDesc->String.Pointer, + memcpy (ReturnDesc->String.Pointer, Operand[0]->Buffer.Pointer, Length); break; @@ -412,6 +412,8 @@ AcpiExOpcode_2A_1T_1R ( } ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD; + ReturnDesc->Reference.IndexPointer = + &(Operand[0]->Buffer.Pointer [Index]); break; case ACPI_TYPE_BUFFER: @@ -423,6 +425,8 @@ AcpiExOpcode_2A_1T_1R ( } ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD; + ReturnDesc->Reference.IndexPointer = + &(Operand[0]->Buffer.Pointer [Index]); break; case ACPI_TYPE_PACKAGE: @@ -434,7 +438,8 @@ AcpiExOpcode_2A_1T_1R ( } ReturnDesc->Reference.TargetType = ACPI_TYPE_PACKAGE; - ReturnDesc->Reference.Where = &Operand[0]->Package.Elements [Index]; + ReturnDesc->Reference.Where = + &Operand[0]->Package.Elements [Index]; break; default: diff --git a/source/components/executer/exoparg3.c b/source/components/executer/exoparg3.c index 5f83f10d7db7..aa42edbfbfb9 100644 --- a/source/components/executer/exoparg3.c +++ b/source/components/executer/exoparg3.c @@ -261,7 +261,7 @@ AcpiExOpcode_3A_1T_1R ( { /* We have a buffer, copy the portion requested */ - ACPI_MEMCPY (Buffer, Operand[0]->String.Pointer + Index, + memcpy (Buffer, Operand[0]->String.Pointer + Index, Length); } diff --git a/source/components/executer/exregion.c b/source/components/executer/exregion.c index 6fcfa0ffb6ff..6aaf69c84b5a 100644 --- a/source/components/executer/exregion.c +++ b/source/components/executer/exregion.c @@ -558,13 +558,13 @@ AcpiExDataTableSpaceHandler ( { case ACPI_READ: - ACPI_MEMCPY (ACPI_CAST_PTR (char, Value), ACPI_PHYSADDR_TO_PTR (Address), + memcpy (ACPI_CAST_PTR (char, Value), ACPI_PHYSADDR_TO_PTR (Address), ACPI_DIV_8 (BitWidth)); break; case ACPI_WRITE: - ACPI_MEMCPY (ACPI_PHYSADDR_TO_PTR (Address), ACPI_CAST_PTR (char, Value), + memcpy (ACPI_PHYSADDR_TO_PTR (Address), ACPI_CAST_PTR (char, Value), ACPI_DIV_8 (BitWidth)); break; diff --git a/source/components/executer/exstorob.c b/source/components/executer/exstorob.c index 24db5ced2b6c..87791c03904a 100644 --- a/source/components/executer/exstorob.c +++ b/source/components/executer/exstorob.c @@ -109,8 +109,8 @@ AcpiExStoreBufferToBuffer ( { /* Clear existing buffer and copy in the new one */ - ACPI_MEMSET (TargetDesc->Buffer.Pointer, 0, TargetDesc->Buffer.Length); - ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer, Length); + memset (TargetDesc->Buffer.Pointer, 0, TargetDesc->Buffer.Length); + memcpy (TargetDesc->Buffer.Pointer, Buffer, Length); #ifdef ACPI_OBSOLETE_BEHAVIOR /* @@ -139,7 +139,7 @@ AcpiExStoreBufferToBuffer ( { /* Truncate the source, copy only what will fit */ - ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer, + memcpy (TargetDesc->Buffer.Pointer, Buffer, TargetDesc->Buffer.Length); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, @@ -203,9 +203,9 @@ AcpiExStoreStringToString ( * String will fit in existing non-static buffer. * Clear old string and copy in the new one */ - ACPI_MEMSET (TargetDesc->String.Pointer, 0, + memset (TargetDesc->String.Pointer, 0, (ACPI_SIZE) TargetDesc->String.Length + 1); - ACPI_MEMCPY (TargetDesc->String.Pointer, Buffer, Length); + memcpy (TargetDesc->String.Pointer, Buffer, Length); } else { @@ -229,7 +229,7 @@ AcpiExStoreStringToString ( } TargetDesc->Common.Flags &= ~AOPOBJ_STATIC_POINTER; - ACPI_MEMCPY (TargetDesc->String.Pointer, Buffer, Length); + memcpy (TargetDesc->String.Pointer, Buffer, Length); } /* Set the new target length */ diff --git a/source/components/executer/exutils.c b/source/components/executer/exutils.c index 25676a17472b..a4cc73af0404 100644 --- a/source/components/executer/exutils.c +++ b/source/components/executer/exutils.c @@ -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 diff --git a/source/components/hardware/hwgpe.c b/source/components/hardware/hwgpe.c index 2e616d4e4e12..1458f4fed22c 100644 --- a/source/components/hardware/hwgpe.c +++ b/source/components/hardware/hwgpe.c @@ -97,6 +97,8 @@ AcpiHwGetGpeRegisterBit ( * RETURN: Status * * DESCRIPTION: Enable or disable a single GPE in the parent enable register. + * The EnableMask field of the involved GPE register must be + * updated by the caller if necessary. * ******************************************************************************/ @@ -133,7 +135,7 @@ AcpiHwLowSetGpe ( /* Set or clear just the bit that corresponds to this GPE */ RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo); - switch (Action & ~ACPI_GPE_SAVE_MASK) + switch (Action) { case ACPI_GPE_CONDITIONAL_ENABLE: @@ -165,10 +167,6 @@ AcpiHwLowSetGpe ( /* Write the updated enable mask */ Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress); - if (ACPI_SUCCESS (Status) && (Action & ACPI_GPE_SAVE_MASK)) - { - GpeRegisterInfo->EnableMask = (UINT8) EnableMask; - } return (Status); } @@ -334,11 +332,8 @@ AcpiHwGpeEnableWrite ( ACPI_STATUS Status; + GpeRegisterInfo->EnableMask = EnableMask; Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress); - if (ACPI_SUCCESS (Status)) - { - GpeRegisterInfo->EnableMask = EnableMask; - } return (Status); } diff --git a/source/components/hardware/hwxfsleep.c b/source/components/hardware/hwxfsleep.c index 5576edec9fa0..7837c6f56bab 100644 --- a/source/components/hardware/hwxfsleep.c +++ b/source/components/hardware/hwxfsleep.c @@ -51,6 +51,12 @@ /* Local prototypes */ +static ACPI_STATUS +AcpiHwSetFirmwareWakingVector ( + ACPI_TABLE_FACS *Facs, + ACPI_PHYSICAL_ADDRESS PhysicalAddress, + ACPI_PHYSICAL_ADDRESS PhysicalAddress64); + static ACPI_STATUS AcpiHwSleepDispatch ( UINT8 SleepState, @@ -77,29 +83,33 @@ static ACPI_SLEEP_FUNCTIONS AcpiSleepDispatch[] = /* * These functions are removed for the ACPI_REDUCED_HARDWARE case: * AcpiSetFirmwareWakingVector - * AcpiSetFirmwareWakingVector64 * AcpiEnterSleepStateS4bios */ #if (!ACPI_REDUCED_HARDWARE) /******************************************************************************* * - * FUNCTION: AcpiSetFirmwareWakingVector + * FUNCTION: AcpiHwSetFirmwareWakingVector * - * PARAMETERS: PhysicalAddress - 32-bit physical address of ACPI real mode - * entry point. + * PARAMETERS: Facs - Pointer to FACS table + * PhysicalAddress - 32-bit physical address of ACPI real mode + * entry point + * PhysicalAddress64 - 64-bit physical address of ACPI protected + * entry point * * RETURN: Status * - * DESCRIPTION: Sets the 32-bit FirmwareWakingVector field of the FACS + * DESCRIPTION: Sets the FirmwareWakingVector fields of the FACS * ******************************************************************************/ -ACPI_STATUS -AcpiSetFirmwareWakingVector ( - UINT32 PhysicalAddress) +static ACPI_STATUS +AcpiHwSetFirmwareWakingVector ( + ACPI_TABLE_FACS *Facs, + ACPI_PHYSICAL_ADDRESS PhysicalAddress, + ACPI_PHYSICAL_ADDRESS PhysicalAddress64) { - ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector); + ACPI_FUNCTION_TRACE (AcpiHwSetFirmwareWakingVector); /* @@ -112,13 +122,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 (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 +191,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 diff --git a/source/components/namespace/nsaccess.c b/source/components/namespace/nsaccess.c index 9729cd61e17a..615257aefee4 100644 --- a/source/components/namespace/nsaccess.c +++ b/source/components/namespace/nsaccess.c @@ -111,7 +111,7 @@ AcpiNsRootInitialize ( { /* _OSI is optional for now, will be permanent later */ - if (!ACPI_STRCMP (InitVal->Name, "_OSI") && !AcpiGbl_CreateOsiMethod) + if (!strcmp (InitVal->Name, "_OSI") && !AcpiGbl_CreateOsiMethod) { continue; } @@ -191,7 +191,7 @@ AcpiNsRootInitialize ( /* Build an object around the static string */ - ObjDesc->String.Length = (UINT32) ACPI_STRLEN (Val); + ObjDesc->String.Length = (UINT32) strlen (Val); ObjDesc->String.Pointer = Val; ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER; break; @@ -212,7 +212,7 @@ AcpiNsRootInitialize ( /* Special case for ACPI Global Lock */ - if (ACPI_STRCMP (InitVal->Name, "_GL_") == 0) + if (strcmp (InitVal->Name, "_GL_") == 0) { AcpiGbl_GlobalLockMutex = ObjDesc; @@ -319,7 +319,9 @@ AcpiNsLookup ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - LocalFlags = Flags & ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_SEARCH_PARENT); + LocalFlags = Flags & + ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_OVERRIDE_IF_FOUND | + ACPI_NS_SEARCH_PARENT); *ReturnNode = ACPI_ENTRY_NOT_FOUND; AcpiGbl_NsLookupCount++; @@ -571,6 +573,13 @@ AcpiNsLookup ( { LocalFlags |= ACPI_NS_ERROR_IF_FOUND; } + + /* Set override flag according to caller */ + + if (Flags & ACPI_NS_OVERRIDE_IF_FOUND) + { + LocalFlags |= ACPI_NS_OVERRIDE_IF_FOUND; + } } /* Extract one ACPI name from the front of the pathname */ diff --git a/source/components/namespace/nsconvert.c b/source/components/namespace/nsconvert.c index 6fa67faba264..c3ca5b8679be 100644 --- a/source/components/namespace/nsconvert.c +++ b/source/components/namespace/nsconvert.c @@ -202,7 +202,7 @@ AcpiNsConvertToString ( * Copy the raw buffer data with no transform. String is already NULL * terminated at Length+1. */ - ACPI_MEMCPY (NewObject->String.Pointer, + memcpy (NewObject->String.Pointer, OriginalObject->Buffer.Pointer, Length); break; @@ -269,7 +269,7 @@ AcpiNsConvertToBuffer ( return (AE_NO_MEMORY); } - ACPI_MEMCPY (NewObject->Buffer.Pointer, + memcpy (NewObject->Buffer.Pointer, OriginalObject->String.Pointer, OriginalObject->String.Length); break; diff --git a/source/components/namespace/nsdump.c b/source/components/namespace/nsdump.c index bbaff7d95b18..8e3c3ddc499e 100644 --- a/source/components/namespace/nsdump.c +++ b/source/components/namespace/nsdump.c @@ -122,7 +122,7 @@ AcpiNsPrintPathname ( { for (i = 0; i < 4; i++) { - ACPI_IS_PRINT (Pathname[i]) ? + isprint (Pathname[i]) ? AcpiOsPrintf ("%c", Pathname[i]) : AcpiOsPrintf ("?"); } diff --git a/source/components/namespace/nseval.c b/source/components/namespace/nseval.c index e5a0eb8290d7..6ab6a93a4771 100644 --- a/source/components/namespace/nseval.c +++ b/source/components/namespace/nseval.c @@ -63,15 +63,14 @@ AcpiNsExecModuleCode ( * * FUNCTION: AcpiNsEvaluate * - * PARAMETERS: Info - Evaluation info block, contains: + * PARAMETERS: Info - Evaluation info block, contains these fields + * and more: * PrefixNode - Prefix or Method/Object Node to execute * RelativePath - Name of method to execute, If NULL, the * Node is the object to execute * Parameters - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. - * ReturnObject - Where to put method's return value (if - * any). If NULL, no value is returned. * ParameterType - Type of Parameter list * ReturnObject - Where to put method's return value (if * any). If NULL, no value is returned. @@ -463,7 +462,7 @@ AcpiNsExecModuleCode ( /* Initialize the evaluation information block */ - ACPI_MEMSET (Info, 0, sizeof (ACPI_EVALUATE_INFO)); + memset (Info, 0, sizeof (ACPI_EVALUATE_INFO)); Info->PrefixNode = ParentNode; /* diff --git a/source/components/namespace/nsinit.c b/source/components/namespace/nsinit.c index d68ee203b98a..c80d2c88255a 100644 --- a/source/components/namespace/nsinit.c +++ b/source/components/namespace/nsinit.c @@ -105,7 +105,7 @@ AcpiNsInitializeObjects ( /* Set all init info to zero */ - ACPI_MEMSET (&Info, 0, sizeof (ACPI_INIT_WALK_INFO)); + memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO)); /* Walk entire namespace from the supplied root */ @@ -614,7 +614,7 @@ AcpiNsInitOneDevice ( ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname ( ACPI_TYPE_METHOD, DeviceNode, METHOD_NAME__INI)); - ACPI_MEMSET (Info, 0, sizeof (ACPI_EVALUATE_INFO)); + memset (Info, 0, sizeof (ACPI_EVALUATE_INFO)); Info->PrefixNode = DeviceNode; Info->RelativePathname = METHOD_NAME__INI; Info->Parameters = NULL; diff --git a/source/components/namespace/nsparse.c b/source/components/namespace/nsparse.c index fec9c51d6d10..bfc5615ade68 100644 --- a/source/components/namespace/nsparse.c +++ b/source/components/namespace/nsparse.c @@ -129,6 +129,14 @@ AcpiNsOneCompleteParse ( AmlStart, AmlLength, NULL, (UINT8) PassNumber); } + /* Found OSDT table, enable the namespace override feature */ + + if (ACPI_COMPARE_NAME(Table->Signature, ACPI_SIG_OSDT) && + PassNumber == ACPI_IMODE_LOAD_PASS1) + { + WalkState->NamespaceOverride = TRUE; + } + if (ACPI_FAILURE (Status)) { AcpiDsDeleteWalkState (WalkState); diff --git a/source/components/namespace/nsrepair2.c b/source/components/namespace/nsrepair2.c index 60b895b5dc62..e7efbae6f859 100644 --- a/source/components/namespace/nsrepair2.c +++ b/source/components/namespace/nsrepair2.c @@ -637,7 +637,7 @@ AcpiNsRepair_HID ( */ for (Dest = NewString->String.Pointer; *Source; Dest++, Source++) { - *Dest = (char) ACPI_TOUPPER (*Source); + *Dest = (char) toupper (*Source); } AcpiUtRemoveReference (ReturnObject); diff --git a/source/components/namespace/nssearch.c b/source/components/namespace/nssearch.c index 46794b69dcc2..c67abb59d3ff 100644 --- a/source/components/namespace/nssearch.c +++ b/source/components/namespace/nssearch.c @@ -338,10 +338,42 @@ AcpiNsSearchAndEnter ( * If we found it AND the request specifies that a find is an error, * return the error */ - if ((Status == AE_OK) && - (Flags & ACPI_NS_ERROR_IF_FOUND)) + if (Status == AE_OK) { - Status = AE_ALREADY_EXISTS; + /* The node was found in the namespace */ + + /* + * If the namespace override feature is enabled for this node, + * delete any existing attached sub-object and make the node + * look like a new node that is owned by the override table. + */ + if (Flags & ACPI_NS_OVERRIDE_IF_FOUND) + { + AcpiNsDeleteChildren (*ReturnNode); + if (AcpiGbl_RuntimeNamespaceOverride) + { + AcpiUtRemoveReference ((*ReturnNode)->Object); + (*ReturnNode)->Object = NULL; + (*ReturnNode)->OwnerId = WalkState->OwnerId; + } + else + { + AcpiNsRemoveNode (*ReturnNode); + *ReturnNode = ACPI_ENTRY_NOT_FOUND; + } + + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, + "Namespace override: %4.4s pass %u type %X Owner %X\n", + ACPI_CAST_PTR(char, &TargetName), InterpreterMode, + (*ReturnNode)->Type, WalkState->OwnerId)); + } + + /* Return an error if we don't expect to find the object */ + + else if (Flags & ACPI_NS_ERROR_IF_FOUND) + { + Status = AE_ALREADY_EXISTS; + } } #ifdef ACPI_ASL_COMPILER diff --git a/source/components/namespace/nsutils.c b/source/components/namespace/nsutils.c index becdf3336933..5335810c6028 100644 --- a/source/components/namespace/nsutils.c +++ b/source/components/namespace/nsutils.c @@ -347,7 +347,7 @@ AcpiNsBuildInternalName ( { /* Convert the character to uppercase and save it */ - Result[i] = (char) ACPI_TOUPPER ((int) *ExternalName); + Result[i] = (char) toupper ((int) *ExternalName); ExternalName++; } } diff --git a/source/components/namespace/nsxfeval.c b/source/components/namespace/nsxfeval.c index 547ed4d8ade4..1a867bda8366 100644 --- a/source/components/namespace/nsxfeval.c +++ b/source/components/namespace/nsxfeval.c @@ -758,7 +758,7 @@ AcpiNsGetDeviceCallback ( return (AE_CTRL_DEPTH); } - NoMatch = ACPI_STRCMP (Hid->String, Info->Hid); + NoMatch = strcmp (Hid->String, Info->Hid); ACPI_FREE (Hid); if (NoMatch) @@ -782,7 +782,7 @@ AcpiNsGetDeviceCallback ( Found = FALSE; for (i = 0; i < Cid->Count; i++) { - if (ACPI_STRCMP (Cid->Ids[i].String, Info->Hid) == 0) + if (strcmp (Cid->Ids[i].String, Info->Hid) == 0) { /* Found a matching CID */ diff --git a/source/components/namespace/nsxfname.c b/source/components/namespace/nsxfname.c index 3f6c74dca68e..7f92201843aa 100644 --- a/source/components/namespace/nsxfname.c +++ b/source/components/namespace/nsxfname.c @@ -126,7 +126,7 @@ AcpiGetHandle ( /* Special case for root-only, since we can't search for it */ - if (!ACPI_STRCMP (Pathname, ACPI_NS_ROOT_PATH)) + if (!strcmp (Pathname, ACPI_NS_ROOT_PATH)) { *RetHandle = ACPI_CAST_PTR (ACPI_HANDLE, AcpiGbl_RootNode); return (AE_OK); @@ -271,7 +271,7 @@ AcpiNsCopyDeviceId ( /* Copy actual string and return a pointer to the next string area */ - ACPI_MEMCPY (StringArea, Source->String, Source->Length); + memcpy (StringArea, Source->String, Source->Length); return (StringArea + Source->Length); } @@ -290,7 +290,7 @@ AcpiNsCopyDeviceId ( * control methods (Such as in the case of a device.) * * For Device and Processor objects, run the Device _HID, _UID, _CID, _SUB, - * _STA, _ADR, _SxW, and _SxD methods. + * _CLS, _STA, _ADR, _SxW, and _SxD methods. * * Note: Allocates the return buffer, must be freed by the caller. * @@ -307,11 +307,12 @@ AcpiGetObjectInfo ( ACPI_PNP_DEVICE_ID *Hid = NULL; ACPI_PNP_DEVICE_ID *Uid = NULL; ACPI_PNP_DEVICE_ID *Sub = NULL; + ACPI_PNP_DEVICE_ID *Cls = NULL; char *NextIdString; ACPI_OBJECT_TYPE Type; ACPI_NAME Name; UINT8 ParamCount= 0; - UINT8 Valid = 0; + UINT16 Valid = 0; UINT32 InfoSize; UINT32 i; ACPI_STATUS Status; @@ -359,7 +360,7 @@ AcpiGetObjectInfo ( { /* * Get extra info for ACPI Device/Processor objects only: - * Run the Device _HID, _UID, _SUB, and _CID methods. + * Run the Device _HID, _UID, _SUB, _CID, and _CLS methods. * * Note: none of these methods are required, so they may or may * not be present for this device. The Info->Valid bitfield is used @@ -403,6 +404,15 @@ AcpiGetObjectInfo ( InfoSize += (CidList->ListSize - sizeof (ACPI_PNP_DEVICE_ID_LIST)); Valid |= ACPI_VALID_CID; } + + /* Execute the Device._CLS method */ + + Status = AcpiUtExecute_CLS (Node, &Cls); + if (ACPI_SUCCESS (Status)) + { + InfoSize += Cls->Length; + Valid |= ACPI_VALID_CLS; + } } /* @@ -534,6 +544,12 @@ AcpiGetObjectInfo ( } } + if (Cls) + { + NextIdString = AcpiNsCopyDeviceId (&Info->ClassCode, + Cls, NextIdString); + } + /* Copy the fixed-length data */ Info->InfoSize = InfoSize; @@ -563,6 +579,10 @@ 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 */ diff --git a/source/components/parser/psutils.c b/source/components/parser/psutils.c index e95d16248534..55bf2ccff1b0 100644 --- a/source/components/parser/psutils.c +++ b/source/components/parser/psutils.c @@ -104,7 +104,7 @@ AcpiPsInitOp ( Op->Common.DescriptorType = ACPI_DESC_TYPE_PARSER; Op->Common.AmlOpcode = Opcode; - ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (Op->Common.AmlOpName, + ACPI_DISASM_ONLY_MEMBERS (strncpy (Op->Common.AmlOpName, (AcpiPsGetOpcodeInfo (Opcode))->Name, sizeof (Op->Common.AmlOpName))); } diff --git a/source/components/resources/rscreate.c b/source/components/resources/rscreate.c index 5b47e7e69474..551f59a6534c 100644 --- a/source/components/resources/rscreate.c +++ b/source/components/resources/rscreate.c @@ -374,12 +374,12 @@ AcpiRsCreatePciRoutingTable ( /* +1 to include null terminator */ - UserPrt->Length += (UINT32) ACPI_STRLEN (UserPrt->Source) + 1; + UserPrt->Length += (UINT32) strlen (UserPrt->Source) + 1; break; case ACPI_TYPE_STRING: - ACPI_STRCPY (UserPrt->Source, ObjDesc->String.Pointer); + strcpy (UserPrt->Source, ObjDesc->String.Pointer); /* * Add to the Length field the length of the string diff --git a/source/components/resources/rsmisc.c b/source/components/resources/rsmisc.c index 82df562541a2..83f50aa95dac 100644 --- a/source/components/resources/rsmisc.c +++ b/source/components/resources/rsmisc.c @@ -130,7 +130,7 @@ AcpiRsConvertAmlToResource ( /* * Get the resource type and the initial (minimum) length */ - ACPI_MEMSET (Resource, 0, INIT_RESOURCE_LENGTH (Info)); + memset (Resource, 0, INIT_RESOURCE_LENGTH (Info)); Resource->Type = INIT_RESOURCE_TYPE (Info); Resource->Length = INIT_RESOURCE_LENGTH (Info); break; @@ -326,13 +326,13 @@ AcpiRsConvertAmlToResource ( case ACPI_RSC_SET8: - ACPI_MEMSET (Destination, Info->AmlOffset, Info->Value); + memset (Destination, Info->AmlOffset, Info->Value); break; case ACPI_RSC_DATA8: Target = ACPI_ADD_PTR (char, Resource, Info->Value); - ACPI_MEMCPY (Destination, Source, ACPI_GET16 (Target)); + memcpy (Destination, Source, ACPI_GET16 (Target)); break; case ACPI_RSC_ADDRESS: @@ -505,7 +505,7 @@ AcpiRsConvertResourceToAml ( { case ACPI_RSC_INITSET: - ACPI_MEMSET (Aml, 0, INIT_RESOURCE_LENGTH (Info)); + memset (Aml, 0, INIT_RESOURCE_LENGTH (Info)); AmlLength = INIT_RESOURCE_LENGTH (Info); AcpiRsSetResourceHeader (INIT_RESOURCE_TYPE (Info), AmlLength, Aml); break; diff --git a/source/components/resources/rsutils.c b/source/components/resources/rsutils.c index 68407947e329..a5517c6bff92 100644 --- a/source/components/resources/rsutils.c +++ b/source/components/resources/rsutils.c @@ -174,7 +174,7 @@ AcpiRsMoveData ( case ACPI_RSC_MOVE_SERIAL_VEN: case ACPI_RSC_MOVE_SERIAL_RES: - ACPI_MEMCPY (Destination, Source, ItemCount); + memcpy (Destination, Source, ItemCount); return; /* @@ -408,11 +408,11 @@ AcpiRsGetResourceSource ( * * Zero the entire area of the buffer. */ - TotalLength = (UINT32) ACPI_STRLEN ( + TotalLength = (UINT32) strlen ( ACPI_CAST_PTR (char, &AmlResourceSource[1])) + 1; TotalLength = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (TotalLength); - ACPI_MEMSET (ResourceSource->StringPtr, 0, TotalLength); + memset (ResourceSource->StringPtr, 0, TotalLength); /* Copy the ResourceSource string to the destination */ @@ -477,7 +477,7 @@ AcpiRsSetResourceSource ( /* Copy the ResourceSource string */ - ACPI_STRCPY (ACPI_CAST_PTR (char, &AmlResourceSource[1]), + strcpy (ACPI_CAST_PTR (char, &AmlResourceSource[1]), ResourceSource->StringPtr); /* diff --git a/source/components/resources/rsxface.c b/source/components/resources/rsxface.c index cb64c1d08f7e..1008af010ff3 100644 --- a/source/components/resources/rsxface.c +++ b/source/components/resources/rsxface.c @@ -447,7 +447,7 @@ AcpiResourceToAddress64 ( /* Simple copy for 64 bit source */ - ACPI_MEMCPY (Out, &Resource->Data, sizeof (ACPI_RESOURCE_ADDRESS64)); + memcpy (Out, &Resource->Data, sizeof (ACPI_RESOURCE_ADDRESS64)); break; default: @@ -558,7 +558,7 @@ AcpiRsMatchVendorResource ( */ if ((Vendor->ByteLength < (ACPI_UUID_LENGTH + 1)) || (Vendor->UuidSubtype != Info->Uuid->Subtype) || - (ACPI_MEMCMP (Vendor->Uuid, Info->Uuid->Data, ACPI_UUID_LENGTH))) + (memcmp (Vendor->Uuid, Info->Uuid->Data, ACPI_UUID_LENGTH))) { return (AE_OK); } @@ -574,7 +574,7 @@ AcpiRsMatchVendorResource ( /* Found the correct resource, copy and return it */ - ACPI_MEMCPY (Buffer->Pointer, Resource, Resource->Length); + memcpy (Buffer->Pointer, Resource, Resource->Length); Buffer->Length = Resource->Length; /* Found the desired descriptor, terminate resource walk */ diff --git a/source/components/tables/tbdata.c b/source/components/tables/tbdata.c index 5c1cfe40d9f2..5769a8e70527 100644 --- a/source/components/tables/tbdata.c +++ b/source/components/tables/tbdata.c @@ -77,7 +77,7 @@ AcpiTbInitTableDescriptor ( * Initialize the table descriptor. Set the pointer to NULL, since the * table is not fully mapped at this time. */ - ACPI_MEMSET (TableDesc, 0, sizeof (ACPI_TABLE_DESC)); + memset (TableDesc, 0, sizeof (ACPI_TABLE_DESC)); TableDesc->Address = Address; TableDesc->Length = Table->Length; TableDesc->Flags = Flags; @@ -511,7 +511,7 @@ AcpiTbResizeRootTableList ( if (AcpiGbl_RootTableList.Tables) { - ACPI_MEMCPY (Tables, AcpiGbl_RootTableList.Tables, + memcpy (Tables, AcpiGbl_RootTableList.Tables, (ACPI_SIZE) TableCount * sizeof (ACPI_TABLE_DESC)); if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) diff --git a/source/components/tables/tbfadt.c b/source/components/tables/tbfadt.c index 6d57e8061257..871eb880ae9f 100644 --- a/source/components/tables/tbfadt.c +++ b/source/components/tables/tbfadt.c @@ -382,8 +382,16 @@ AcpiTbParseFadt ( if (!AcpiGbl_ReducedHardware) { - AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs, - ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS); + if (AcpiGbl_FADT.Facs) + { + AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.Facs, + ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS); + } + if (AcpiGbl_FADT.XFacs) + { + AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs, + ACPI_SIG_FACS, ACPI_TABLE_INDEX_X_FACS); + } } } @@ -425,11 +433,11 @@ AcpiTbCreateLocalFadt ( /* Clear the entire local FADT */ - ACPI_MEMSET (&AcpiGbl_FADT, 0, sizeof (ACPI_TABLE_FADT)); + memset (&AcpiGbl_FADT, 0, sizeof (ACPI_TABLE_FADT)); /* Copy the original FADT, up to sizeof (ACPI_TABLE_FADT) */ - ACPI_MEMCPY (&AcpiGbl_FADT, Table, + memcpy (&AcpiGbl_FADT, Table, ACPI_MIN (Length, sizeof (ACPI_TABLE_FADT))); /* Take a copy of the Hardware Reduced flag */ @@ -533,12 +541,9 @@ AcpiTbConvertFadt ( AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT); /* - * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary. + * Expand the 32-bit DSDT addresses to 64-bit as necessary. * Later ACPICA code will always use the X 64-bit field. */ - AcpiGbl_FADT.XFacs = AcpiTbSelectAddress ("FACS", - AcpiGbl_FADT.Facs, AcpiGbl_FADT.XFacs); - AcpiGbl_FADT.XDsdt = AcpiTbSelectAddress ("DSDT", AcpiGbl_FADT.Dsdt, AcpiGbl_FADT.XDsdt); diff --git a/source/components/tables/tbfind.c b/source/components/tables/tbfind.c index 13ed982ae543..af790924105c 100644 --- a/source/components/tables/tbfind.c +++ b/source/components/tables/tbfind.c @@ -83,16 +83,16 @@ AcpiTbFindTable ( /* Normalize the input strings */ - ACPI_MEMSET (&Header, 0, sizeof (ACPI_TABLE_HEADER)); + memset (&Header, 0, sizeof (ACPI_TABLE_HEADER)); ACPI_MOVE_NAME (Header.Signature, Signature); - ACPI_STRNCPY (Header.OemId, OemId, ACPI_OEM_ID_SIZE); - ACPI_STRNCPY (Header.OemTableId, OemTableId, ACPI_OEM_TABLE_ID_SIZE); + strncpy (Header.OemId, OemId, ACPI_OEM_ID_SIZE); + strncpy (Header.OemTableId, OemTableId, ACPI_OEM_TABLE_ID_SIZE); /* Search for the table */ for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) { - if (ACPI_MEMCMP (&(AcpiGbl_RootTableList.Tables[i].Signature), + if (memcmp (&(AcpiGbl_RootTableList.Tables[i].Signature), Header.Signature, ACPI_NAME_SIZE)) { /* Not the requested table */ @@ -120,13 +120,13 @@ AcpiTbFindTable ( /* Check for table match on all IDs */ - if (!ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->Signature, + if (!memcmp (AcpiGbl_RootTableList.Tables[i].Pointer->Signature, Header.Signature, ACPI_NAME_SIZE) && (!OemId[0] || - !ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->OemId, + !memcmp (AcpiGbl_RootTableList.Tables[i].Pointer->OemId, Header.OemId, ACPI_OEM_ID_SIZE)) && (!OemTableId[0] || - !ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->OemTableId, + !memcmp (AcpiGbl_RootTableList.Tables[i].Pointer->OemTableId, Header.OemTableId, ACPI_OEM_TABLE_ID_SIZE))) { *TableIndex = i; diff --git a/source/components/tables/tbinstal.c b/source/components/tables/tbinstal.c index e2c6833c36f6..c797efb808d3 100644 --- a/source/components/tables/tbinstal.c +++ b/source/components/tables/tbinstal.c @@ -94,7 +94,7 @@ AcpiTbCompareTables ( * not just the header. */ IsIdentical = (BOOLEAN)((TableDesc->Length != TableLength || - ACPI_MEMCMP (TableDesc->Pointer, Table, TableLength)) ? + memcmp (TableDesc->Pointer, Table, TableLength)) ? FALSE : TRUE); /* Release the acquired table */ @@ -309,7 +309,7 @@ AcpiTbInstallStandardTable ( */ if ((NewTableDesc.Signature.Ascii[0] != 0x00) && (!ACPI_COMPARE_NAME (&NewTableDesc.Signature, ACPI_SIG_SSDT)) && - (ACPI_STRNCMP (NewTableDesc.Signature.Ascii, "OEM", 3))) + (strncmp (NewTableDesc.Signature.Ascii, "OEM", 3))) { ACPI_BIOS_ERROR ((AE_INFO, "Table has invalid signature [%4.4s] (0x%8.8X), " diff --git a/source/components/tables/tbprint.c b/source/components/tables/tbprint.c index 48d8d50d461c..2563cec17ebb 100644 --- a/source/components/tables/tbprint.c +++ b/source/components/tables/tbprint.c @@ -84,7 +84,7 @@ AcpiTbFixString ( while (Length && *String) { - if (!ACPI_IS_PRINT (*String)) + if (!isprint (*String)) { *String = '?'; } @@ -114,7 +114,7 @@ AcpiTbCleanupTableHeader ( ACPI_TABLE_HEADER *Header) { - ACPI_MEMCPY (OutHeader, Header, sizeof (ACPI_TABLE_HEADER)); + memcpy (OutHeader, Header, sizeof (ACPI_TABLE_HEADER)); AcpiTbFixString (OutHeader->Signature, ACPI_NAME_SIZE); AcpiTbFixString (OutHeader->OemId, ACPI_OEM_ID_SIZE); @@ -156,7 +156,7 @@ AcpiTbPrintTableHeader ( { /* RSDP has no common fields */ - ACPI_MEMCPY (LocalHeader.OemId, + memcpy (LocalHeader.OemId, ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->OemId, ACPI_OEM_ID_SIZE); AcpiTbFixString (LocalHeader.OemId, ACPI_OEM_ID_SIZE); diff --git a/source/components/tables/tbutils.c b/source/components/tables/tbutils.c index 7159c6093430..79dde9ac9735 100644 --- a/source/components/tables/tbutils.c +++ b/source/components/tables/tbutils.c @@ -75,8 +75,13 @@ ACPI_STATUS AcpiTbInitializeFacs ( void) { - ACPI_STATUS Status; + /* If there is no FACS, just continue. There was already an error msg */ + + if (!AcpiGbl_FACS) + { + return (AE_OK); + } /* If Hardware Reduced flag is set, there is no FACS */ @@ -86,9 +91,25 @@ AcpiTbInitializeFacs ( return (AE_OK); } - Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, - ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &AcpiGbl_FACS)); - return (Status); + (void) AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, + ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &AcpiGbl_Facs32)); + (void) AcpiGetTableByIndex (ACPI_TABLE_INDEX_X_FACS, + ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &AcpiGbl_Facs64)); + if (!AcpiGbl_Facs32 && !AcpiGbl_Facs64) + { + return (AE_NO_MEMORY); + } + + if (AcpiGbl_Use32BitFacsAddresses) + { + AcpiGbl_FACS = AcpiGbl_Facs32 ? AcpiGbl_Facs32 : AcpiGbl_Facs64; + } + else + { + AcpiGbl_FACS = AcpiGbl_Facs64 ? AcpiGbl_Facs64 : AcpiGbl_Facs32; + } + + return (AE_OK); } #endif /* !ACPI_REDUCED_HARDWARE */ @@ -111,7 +132,7 @@ AcpiTbTablesLoaded ( void) { - if (AcpiGbl_RootTableList.CurrentTableCount >= 3) + if (AcpiGbl_RootTableList.CurrentTableCount >= 4) { return (TRUE); } @@ -190,7 +211,7 @@ AcpiTbCopyDsdt ( return (NULL); } - ACPI_MEMCPY (NewTable, TableDesc->Pointer, TableDesc->Length); + memcpy (NewTable, TableDesc->Pointer, TableDesc->Length); AcpiTbUninstallTable (TableDesc); AcpiTbInitTableDescriptor ( @@ -389,11 +410,11 @@ AcpiTbParseRootTable ( TableEntry = ACPI_ADD_PTR (UINT8, Table, sizeof (ACPI_TABLE_HEADER)); /* - * First two entries in the table array are reserved for the DSDT - * and FACS, which are not actually present in the RSDT/XSDT - they - * come from the FADT + * First three entries in the table array are reserved for the DSDT + * and 32bit/64bit FACS, which are not actually present in the + * RSDT/XSDT - they come from the FADT */ - AcpiGbl_RootTableList.CurrentTableCount = 2; + AcpiGbl_RootTableList.CurrentTableCount = 3; /* Initialize the root table array from the RSDT/XSDT */ diff --git a/source/components/tables/tbxface.c b/source/components/tables/tbxface.c index 7b4e7f0b71bc..bcaf6af2a990 100644 --- a/source/components/tables/tbxface.c +++ b/source/components/tables/tbxface.c @@ -132,7 +132,7 @@ AcpiInitializeTables ( { /* Root Table Array has been statically allocated by the host */ - ACPI_MEMSET (InitialTableArray, 0, + memset (InitialTableArray, 0, (ACPI_SIZE) InitialTableCount * sizeof (ACPI_TABLE_DESC)); AcpiGbl_RootTableList.Tables = InitialTableArray; @@ -271,7 +271,7 @@ AcpiGetTableHeader ( return (AE_NO_MEMORY); } - ACPI_MEMCPY (OutTableHeader, Header, + memcpy (OutTableHeader, Header, sizeof (ACPI_TABLE_HEADER)); AcpiOsUnmapMemory (Header, sizeof (ACPI_TABLE_HEADER)); } @@ -282,7 +282,7 @@ AcpiGetTableHeader ( } else { - ACPI_MEMCPY (OutTableHeader, + memcpy (OutTableHeader, AcpiGbl_RootTableList.Tables[i].Pointer, sizeof (ACPI_TABLE_HEADER)); } diff --git a/source/components/tables/tbxfload.c b/source/components/tables/tbxfload.c index 3473df878d6b..19c31e71cf94 100644 --- a/source/components/tables/tbxfload.c +++ b/source/components/tables/tbxfload.c @@ -164,7 +164,7 @@ AcpiTbLoadNamespace ( * Save the original DSDT header for detection of table corruption * and/or replacement of the DSDT from outside the OS. */ - ACPI_MEMCPY (&AcpiGbl_OriginalDsdtHeader, AcpiGbl_DSDT, + memcpy (&AcpiGbl_OriginalDsdtHeader, AcpiGbl_DSDT, sizeof (ACPI_TABLE_HEADER)); (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); @@ -182,10 +182,13 @@ AcpiTbLoadNamespace ( (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) { - if ((!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), + if (!AcpiGbl_RootTableList.Tables[i].Address || + (!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), ACPI_SIG_SSDT) && !ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), - ACPI_SIG_PSDT)) || + ACPI_SIG_PSDT) && + !ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), + ACPI_SIG_OSDT)) || ACPI_FAILURE (AcpiTbValidateTable ( &AcpiGbl_RootTableList.Tables[i]))) { @@ -238,11 +241,11 @@ AcpiInstallTable ( if (Physical) { - Flags = ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL; + Flags = ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL; } else { - Flags = ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL; + Flags = ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL; } Status = AcpiTbInstallStandardTable (Address, Flags, diff --git a/source/components/utilities/utalloc.c b/source/components/utilities/utalloc.c index bb4194df0d89..d0b5c920634c 100644 --- a/source/components/utilities/utalloc.c +++ b/source/components/utilities/utalloc.c @@ -79,7 +79,7 @@ AcpiOsAllocateZeroed ( { /* Clear the memory block */ - ACPI_MEMSET (Allocation, 0, Size); + memset (Allocation, 0, Size); } return (Allocation); @@ -189,7 +189,7 @@ AcpiUtDeleteCaches ( if (AcpiGbl_DisplayFinalMemStats) { - ACPI_STRCPY (Buffer, "MEMORY"); + strcpy (Buffer, "MEMORY"); (void) AcpiDbDisplayStatistics (Buffer); } #endif @@ -359,6 +359,6 @@ AcpiUtInitializeBuffer ( /* Have a valid buffer, clear it */ - ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength); + memset (Buffer->Pointer, 0, RequiredLength); return (AE_OK); } diff --git a/source/components/utilities/utbuffer.c b/source/components/utilities/utbuffer.c index cf99b769922e..16a593f111bc 100644 --- a/source/components/utilities/utbuffer.c +++ b/source/components/utilities/utbuffer.c @@ -168,7 +168,7 @@ AcpiUtDumpBuffer ( } BufChar = Buffer[(ACPI_SIZE) i + j]; - if (ACPI_IS_PRINT (BufChar)) + if (isprint (BufChar)) { AcpiOsPrintf ("%c", BufChar); } @@ -341,7 +341,7 @@ AcpiUtDumpBufferToFile ( } BufChar = Buffer[(ACPI_SIZE) i + j]; - if (ACPI_IS_PRINT (BufChar)) + if (isprint (BufChar)) { AcpiUtFilePrintf (File, "%c", BufChar); } diff --git a/source/components/utilities/utcache.c b/source/components/utilities/utcache.c index c2211cc2adb9..7a0f210dff6a 100644 --- a/source/components/utilities/utcache.c +++ b/source/components/utilities/utcache.c @@ -92,7 +92,7 @@ AcpiOsCreateCache ( /* Populate the cache object and return it */ - ACPI_MEMSET (Cache, 0, sizeof (ACPI_MEMORY_LIST)); + memset (Cache, 0, sizeof (ACPI_MEMORY_LIST)); Cache->ListName = CacheName; Cache->ObjectSize = ObjectSize; Cache->MaxDepth = MaxDepth; @@ -242,7 +242,7 @@ AcpiOsReleaseObject ( /* Mark the object as cached */ - ACPI_MEMSET (Object, 0xCA, Cache->ObjectSize); + memset (Object, 0xCA, Cache->ObjectSize); ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_CACHED); /* Put the object at the head of the cache list */ @@ -318,7 +318,7 @@ AcpiOsAcquireObject ( /* Clear (zero) the previously used Object */ - ACPI_MEMSET (Object, 0, Cache->ObjectSize); + memset (Object, 0, Cache->ObjectSize); } else { diff --git a/source/components/utilities/utclib.c b/source/components/utilities/utclib.c index e68634b18bbb..6e3e9b4eb5b2 100644 --- a/source/components/utilities/utclib.c +++ b/source/components/utilities/utclib.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: cmclib - Local implementation of C library functions + * Module Name: utclib - ACPICA implementations of C library functions * *****************************************************************************/ @@ -41,20 +41,59 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#define ACPI_CLIBRARY #include "acpi.h" #include "accommon.h" /* - * These implementations of standard C Library routines can optionally be - * used if a C library is not available. In general, they are less efficient - * than an inline or assembly implementation + * This module contains implementations of the standard C library functions + * that are required by the ACPICA code at both application level and kernel + * level. + * + * The module is an optional feature that can be used if a local/system + * C library is not available. Some operating system kernels may not have + * an internal C library. + * + * In general, these functions are less efficient than an inline or assembly + * code implementation. + * + * These C functions and the associated prototypes are enabled by default + * unless the ACPI_USE_SYSTEM_CLIBRARY symbol is defined. This is usually + * automatically defined for the ACPICA applications such as iASL and + * AcpiExec, so that these user-level applications use the local C library + * instead of the functions in this module. */ + +/******************************************************************************* + * + * Functions implemented in this module: + * + * FUNCTION: memcmp + * FUNCTION: memcpy + * FUNCTION: memset + * FUNCTION: strlen + * FUNCTION: strcpy + * FUNCTION: strncpy + * FUNCTION: strcmp + * FUNCTION: strchr + * FUNCTION: strncmp + * FUNCTION: strcat + * FUNCTION: strncat + * FUNCTION: strstr + * FUNCTION: strtoul + * FUNCTION: toupper + * FUNCTION: tolower + * FUNCTION: is* functions + * + ******************************************************************************/ + + #define _COMPONENT ACPI_UTILITIES - ACPI_MODULE_NAME ("cmclib") + ACPI_MODULE_NAME ("utclib") -#ifndef ACPI_USE_SYSTEM_CLIBRARY +#ifndef ACPI_USE_SYSTEM_CLIBRARY /* Entire module */ #define NEGATIVE 1 #define POSITIVE 0 @@ -62,7 +101,7 @@ /******************************************************************************* * - * FUNCTION: AcpiUtMemcmp (memcmp) + * FUNCTION: memcmp * * PARAMETERS: Buffer1 - First Buffer * Buffer2 - Second Buffer @@ -75,11 +114,14 @@ ******************************************************************************/ int -AcpiUtMemcmp ( - const char *Buffer1, - const char *Buffer2, +memcmp ( + void *VBuffer1, + void *VBuffer2, ACPI_SIZE Count) { + char *Buffer1 = (char *) VBuffer1; + char *Buffer2 = (char *) VBuffer2; + for ( ; Count-- && (*Buffer1 == *Buffer2); Buffer1++, Buffer2++) { @@ -92,7 +134,7 @@ AcpiUtMemcmp ( /******************************************************************************* * - * FUNCTION: AcpiUtMemcpy (memcpy) + * FUNCTION: memcpy * * PARAMETERS: Dest - Target of the copy * Src - Source buffer to copy @@ -105,7 +147,7 @@ AcpiUtMemcmp ( ******************************************************************************/ void * -AcpiUtMemcpy ( +memcpy ( void *Dest, const void *Src, ACPI_SIZE Count) @@ -128,7 +170,7 @@ AcpiUtMemcpy ( /******************************************************************************* * - * FUNCTION: AcpiUtMemset (memset) + * FUNCTION: memset * * PARAMETERS: Dest - Buffer to set * Value - Value to set each byte of memory @@ -141,9 +183,9 @@ AcpiUtMemcpy ( ******************************************************************************/ void * -AcpiUtMemset ( +memset ( void *Dest, - UINT8 Value, + int Value, ACPI_SIZE Count) { char *New = (char *) Dest; @@ -162,7 +204,7 @@ AcpiUtMemset ( /******************************************************************************* * - * FUNCTION: AcpiUtStrlen (strlen) + * FUNCTION: strlen * * PARAMETERS: String - Null terminated string * @@ -174,7 +216,7 @@ AcpiUtMemset ( ACPI_SIZE -AcpiUtStrlen ( +strlen ( const char *String) { UINT32 Length = 0; @@ -194,7 +236,7 @@ AcpiUtStrlen ( /******************************************************************************* * - * FUNCTION: AcpiUtStrcpy (strcpy) + * FUNCTION: strcpy * * PARAMETERS: DstString - Target of the copy * SrcString - The source string to copy @@ -206,7 +248,7 @@ AcpiUtStrlen ( ******************************************************************************/ char * -AcpiUtStrcpy ( +strcpy ( char *DstString, const char *SrcString) { @@ -232,7 +274,7 @@ AcpiUtStrcpy ( /******************************************************************************* * - * FUNCTION: AcpiUtStrncpy (strncpy) + * FUNCTION: strncpy * * PARAMETERS: DstString - Target of the copy * SrcString - The source string to copy @@ -245,7 +287,7 @@ AcpiUtStrcpy ( ******************************************************************************/ char * -AcpiUtStrncpy ( +strncpy ( char *DstString, const char *SrcString, ACPI_SIZE Count) @@ -275,7 +317,7 @@ AcpiUtStrncpy ( /******************************************************************************* * - * FUNCTION: AcpiUtStrcmp (strcmp) + * FUNCTION: strcmp * * PARAMETERS: String1 - First string * String2 - Second string @@ -287,7 +329,7 @@ AcpiUtStrncpy ( ******************************************************************************/ int -AcpiUtStrcmp ( +strcmp ( const char *String1, const char *String2) { @@ -307,7 +349,7 @@ AcpiUtStrcmp ( /******************************************************************************* * - * FUNCTION: AcpiUtStrchr (strchr) + * FUNCTION: strchr * * PARAMETERS: String - Search string * ch - character to search for @@ -319,7 +361,7 @@ AcpiUtStrcmp ( ******************************************************************************/ char * -AcpiUtStrchr ( +strchr ( const char *String, int ch) { @@ -339,7 +381,7 @@ AcpiUtStrchr ( /******************************************************************************* * - * FUNCTION: AcpiUtStrncmp (strncmp) + * FUNCTION: strncmp * * PARAMETERS: String1 - First string * String2 - Second string @@ -352,7 +394,7 @@ AcpiUtStrchr ( ******************************************************************************/ int -AcpiUtStrncmp ( +strncmp ( const char *String1, const char *String2, ACPI_SIZE Count) @@ -374,7 +416,7 @@ AcpiUtStrncmp ( /******************************************************************************* * - * FUNCTION: AcpiUtStrcat (Strcat) + * FUNCTION: strcat * * PARAMETERS: DstString - Target of the copy * SrcString - The source string to copy @@ -386,7 +428,7 @@ AcpiUtStrncmp ( ******************************************************************************/ char * -AcpiUtStrcat ( +strcat ( char *DstString, const char *SrcString) { @@ -409,7 +451,7 @@ AcpiUtStrcat ( /******************************************************************************* * - * FUNCTION: AcpiUtStrncat (strncat) + * FUNCTION: strncat * * PARAMETERS: DstString - Target of the copy * SrcString - The source string to copy @@ -423,7 +465,7 @@ AcpiUtStrcat ( ******************************************************************************/ char * -AcpiUtStrncat ( +strncat ( char *DstString, const char *SrcString, ACPI_SIZE Count) @@ -457,7 +499,7 @@ AcpiUtStrncat ( /******************************************************************************* * - * FUNCTION: AcpiUtStrstr (strstr) + * FUNCTION: strstr * * PARAMETERS: String1 - Target string * String2 - Substring to search for @@ -471,22 +513,22 @@ AcpiUtStrncat ( ******************************************************************************/ char * -AcpiUtStrstr ( +strstr ( char *String1, char *String2) { UINT32 Length; - Length = AcpiUtStrlen (String2); + Length = strlen (String2); if (!Length) { return (String1); } - while (AcpiUtStrlen (String1) >= Length) + while (strlen (String1) >= Length) { - if (AcpiUtMemcmp (String1, String2, Length) == 0) + if (memcmp (String1, String2, Length) == 0) { return (String1); } @@ -499,7 +541,7 @@ AcpiUtStrstr ( /******************************************************************************* * - * FUNCTION: AcpiUtStrtoul (strtoul) + * FUNCTION: strtoul * * PARAMETERS: String - Null terminated string * Terminater - Where a pointer to the terminating byte is @@ -509,12 +551,12 @@ AcpiUtStrstr ( * RETURN: Converted value * * DESCRIPTION: Convert a string into a 32-bit unsigned value. - * Note: use AcpiUtStrtoul64 for 64-bit integers. + * Note: use strtoul64 for 64-bit integers. * ******************************************************************************/ UINT32 -AcpiUtStrtoul ( +strtoul ( const char *String, char **Terminator, UINT32 Base) @@ -533,7 +575,7 @@ AcpiUtStrtoul ( * skip over any white space in the buffer: */ StringStart = String; - while (ACPI_IS_SPACE (*String) || *String == '\t') + while (isspace (*String) || *String == '\t') { ++String; } @@ -565,7 +607,7 @@ AcpiUtStrtoul ( { if (*String == '0') { - if (AcpiUtToLower (*(++String)) == 'x') + if (tolower (*(++String)) == 'x') { Base = 16; ++String; @@ -600,7 +642,7 @@ AcpiUtStrtoul ( if (Base == 16 && *String == '0' && - AcpiUtToLower (*(++String)) == 'x') + tolower (*(++String)) == 'x') { String++; } @@ -610,14 +652,14 @@ AcpiUtStrtoul ( */ while (*String) { - if (ACPI_IS_DIGIT (*String)) + if (isdigit (*String)) { index = (UINT32) ((UINT8) *String - '0'); } else { - index = (UINT32) AcpiUtToUpper (*String); - if (ACPI_IS_UPPER (index)) + index = (UINT32) toupper (*String); + if (isupper (index)) { index = index - 'A' + 10; } @@ -688,7 +730,7 @@ AcpiUtStrtoul ( /******************************************************************************* * - * FUNCTION: AcpiUtToUpper (TOUPPER) + * FUNCTION: toupper * * PARAMETERS: c - Character to convert * @@ -699,17 +741,17 @@ AcpiUtStrtoul ( ******************************************************************************/ int -AcpiUtToUpper ( +toupper ( int c) { - return (ACPI_IS_LOWER(c) ? ((c)-0x20) : (c)); + return (islower(c) ? ((c)-0x20) : (c)); } /******************************************************************************* * - * FUNCTION: AcpiUtToLower (TOLOWER) + * FUNCTION: tolower * * PARAMETERS: c - Character to convert * @@ -720,11 +762,11 @@ AcpiUtToUpper ( ******************************************************************************/ int -AcpiUtToLower ( +tolower ( int c) { - return (ACPI_IS_UPPER(c) ? ((c)+0x20) : (c)); + return (isupper(c) ? ((c)+0x20) : (c)); } diff --git a/source/components/utilities/utcopy.c b/source/components/utilities/utcopy.c index 932faa3638c1..dc5ecda7731c 100644 --- a/source/components/utilities/utcopy.c +++ b/source/components/utilities/utcopy.c @@ -146,7 +146,7 @@ AcpiUtCopyIsimpleToEsimple ( /* Always clear the external object */ - ACPI_MEMSET (ExternalObject, 0, sizeof (ACPI_OBJECT)); + memset (ExternalObject, 0, sizeof (ACPI_OBJECT)); /* * In general, the external object will be the same type as @@ -165,7 +165,7 @@ AcpiUtCopyIsimpleToEsimple ( *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD ( (ACPI_SIZE) InternalObject->String.Length + 1); - ACPI_MEMCPY ((void *) DataSpace, + memcpy ((void *) DataSpace, (void *) InternalObject->String.Pointer, (ACPI_SIZE) InternalObject->String.Length + 1); break; @@ -177,7 +177,7 @@ AcpiUtCopyIsimpleToEsimple ( *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD ( InternalObject->String.Length); - ACPI_MEMCPY ((void *) DataSpace, + memcpy ((void *) DataSpace, (void *) InternalObject->Buffer.Pointer, InternalObject->Buffer.Length); break; @@ -528,7 +528,7 @@ AcpiUtCopyEsimpleToIsimple ( goto ErrorExit; } - ACPI_MEMCPY (InternalObject->String.Pointer, + memcpy (InternalObject->String.Pointer, ExternalObject->String.Pointer, ExternalObject->String.Length); @@ -544,7 +544,7 @@ AcpiUtCopyEsimpleToIsimple ( goto ErrorExit; } - ACPI_MEMCPY (InternalObject->Buffer.Pointer, + memcpy (InternalObject->Buffer.Pointer, ExternalObject->Buffer.Pointer, ExternalObject->Buffer.Length); @@ -732,7 +732,7 @@ AcpiUtCopySimpleObject ( CopySize = sizeof (ACPI_NAMESPACE_NODE); } - ACPI_MEMCPY (ACPI_CAST_PTR (char, DestDesc), + memcpy (ACPI_CAST_PTR (char, DestDesc), ACPI_CAST_PTR (char, SourceDesc), CopySize); /* Restore the saved fields */ @@ -766,7 +766,7 @@ AcpiUtCopySimpleObject ( /* Copy the actual buffer data */ - ACPI_MEMCPY (DestDesc->Buffer.Pointer, + memcpy (DestDesc->Buffer.Pointer, SourceDesc->Buffer.Pointer, SourceDesc->Buffer.Length); } break; @@ -788,7 +788,7 @@ AcpiUtCopySimpleObject ( /* Copy the actual string data */ - ACPI_MEMCPY (DestDesc->String.Pointer, SourceDesc->String.Pointer, + memcpy (DestDesc->String.Pointer, SourceDesc->String.Pointer, (ACPI_SIZE) SourceDesc->String.Length + 1); } break; diff --git a/source/components/utilities/utids.c b/source/components/utilities/utids.c index 2affb2137bc6..1b7f1f5dad8a 100644 --- a/source/components/utilities/utids.c +++ b/source/components/utilities/utids.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: utids - support for device IDs - HID, UID, CID + * Module Name: utids - support for device IDs - HID, UID, CID, SUB, CLS * *****************************************************************************/ @@ -121,7 +121,7 @@ AcpiUtExecute_HID ( } else { - ACPI_STRCPY (Hid->String, ObjDesc->String.Pointer); + strcpy (Hid->String, ObjDesc->String.Pointer); } Hid->Length = Length; @@ -194,7 +194,7 @@ AcpiUtExecute_SUB ( /* Simply copy existing string */ - ACPI_STRCPY (Sub->String, ObjDesc->String.Pointer); + strcpy (Sub->String, ObjDesc->String.Pointer); Sub->Length = Length; *ReturnId = Sub; @@ -279,7 +279,7 @@ AcpiUtExecute_UID ( } else { - ACPI_STRCPY (Uid->String, ObjDesc->String.Pointer); + strcpy (Uid->String, ObjDesc->String.Pointer); } Uid->Length = Length; @@ -426,7 +426,7 @@ AcpiUtExecute_CID ( { /* Copy the String CID from the returned object */ - ACPI_STRCPY (NextIdString, CidObjects[i]->String.Pointer); + strcpy (NextIdString, CidObjects[i]->String.Pointer); Length = CidObjects[i]->String.Length + 1; } @@ -449,3 +449,97 @@ AcpiUtExecute_CID ( AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); } + + +/******************************************************************************* + * + * FUNCTION: AcpiUtExecute_CLS + * + * PARAMETERS: DeviceNode - Node for the device + * ReturnId - Where the _CLS is returned + * + * RETURN: Status + * + * DESCRIPTION: Executes the _CLS control method that returns PCI-defined + * class code of the device. The _CLS value is always a package + * containing PCI class information as a list of integers. + * The returned string has format "BBSSPP", where: + * BB = Base-class code + * SS = Sub-class code + * PP = Programming Interface code + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtExecute_CLS ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_PNP_DEVICE_ID **ReturnId) +{ + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT **ClsObjects; + UINT32 Count; + ACPI_PNP_DEVICE_ID *Cls; + UINT32 Length; + ACPI_STATUS Status; + UINT8 ClassCode[3] = {0, 0, 0}; + + + ACPI_FUNCTION_TRACE (UtExecute_CLS); + + + Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CLS, + ACPI_BTYPE_PACKAGE, &ObjDesc); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Get the size of the String to be returned, includes null terminator */ + + Length = ACPI_PCICLS_STRING_SIZE; + ClsObjects = ObjDesc->Package.Elements; + Count = ObjDesc->Package.Count; + + if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE) + { + if (Count > 0 && ClsObjects[0]->Common.Type == ACPI_TYPE_INTEGER) + { + ClassCode[0] = (UINT8) ClsObjects[0]->Integer.Value; + } + if (Count > 1 && ClsObjects[1]->Common.Type == ACPI_TYPE_INTEGER) + { + ClassCode[1] = (UINT8) ClsObjects[1]->Integer.Value; + } + if (Count > 2 && ClsObjects[2]->Common.Type == ACPI_TYPE_INTEGER) + { + ClassCode[2] = (UINT8) ClsObjects[2]->Integer.Value; + } + } + + /* Allocate a buffer for the CLS */ + + Cls = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); + if (!Cls) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + /* Area for the string starts after PNP_DEVICE_ID struct */ + + Cls->String = ACPI_ADD_PTR (char, Cls, sizeof (ACPI_PNP_DEVICE_ID)); + + /* Simply copy existing string */ + + AcpiExPciClsToString (Cls->String, ClassCode); + Cls->Length = Length; + *ReturnId = Cls; + + +Cleanup: + + /* On exit, we must delete the return object */ + + AcpiUtRemoveReference (ObjDesc); + return_ACPI_STATUS (Status); +} diff --git a/source/components/utilities/utmisc.c b/source/components/utilities/utmisc.c index d482ad58782a..8ac133a2c21a 100644 --- a/source/components/utilities/utmisc.c +++ b/source/components/utilities/utmisc.c @@ -71,10 +71,10 @@ AcpiUtIsPciRootBridge ( * Check if this is a PCI root bridge. * ACPI 3.0+: check for a PCI Express root also. */ - if (!(ACPI_STRCMP (Id, + if (!(strcmp (Id, PCI_ROOT_HID_STRING)) || - !(ACPI_STRCMP (Id, + !(strcmp (Id, PCI_EXPRESS_ROOT_HID_STRING))) { return (TRUE); @@ -108,7 +108,8 @@ AcpiUtIsAmlTable ( if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT) || ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_PSDT) || - ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_SSDT)) + ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_SSDT) || + ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_OSDT)) { return (TRUE); } diff --git a/source/components/utilities/utosi.c b/source/components/utilities/utosi.c index f2c1adf70c34..30cba5422389 100644 --- a/source/components/utilities/utosi.c +++ b/source/components/utilities/utosi.c @@ -256,7 +256,7 @@ AcpiUtInstallInterface ( return (AE_NO_MEMORY); } - InterfaceInfo->Name = ACPI_ALLOCATE_ZEROED (ACPI_STRLEN (InterfaceName) + 1); + InterfaceInfo->Name = ACPI_ALLOCATE_ZEROED (strlen (InterfaceName) + 1); if (!InterfaceInfo->Name) { ACPI_FREE (InterfaceInfo); @@ -265,7 +265,7 @@ AcpiUtInstallInterface ( /* Initialize new info and insert at the head of the global list */ - ACPI_STRCPY (InterfaceInfo->Name, InterfaceName); + strcpy (InterfaceInfo->Name, InterfaceName); InterfaceInfo->Flags = ACPI_OSI_DYNAMIC; InterfaceInfo->Next = AcpiGbl_SupportedInterfaces; @@ -298,7 +298,7 @@ AcpiUtRemoveInterface ( PreviousInterface = NextInterface = AcpiGbl_SupportedInterfaces; while (NextInterface) { - if (!ACPI_STRCMP (InterfaceName, NextInterface->Name)) + if (!strcmp (InterfaceName, NextInterface->Name)) { /* Found: name is in either the static list or was added at runtime */ @@ -419,7 +419,7 @@ AcpiUtGetInterface ( NextInterface = AcpiGbl_SupportedInterfaces; while (NextInterface) { - if (!ACPI_STRCMP (InterfaceName, NextInterface->Name)) + if (!strcmp (InterfaceName, NextInterface->Name)) { return (NextInterface); } diff --git a/source/components/utilities/utpredef.c b/source/components/utilities/utpredef.c index 205fa45e6f77..1b7ef34181cb 100644 --- a/source/components/utilities/utpredef.c +++ b/source/components/utilities/utpredef.c @@ -166,7 +166,7 @@ AcpiUtGetExpectedReturnTypes ( if (!ExpectedBtypes) { - ACPI_STRCPY (Buffer, "NONE"); + strcpy (Buffer, "NONE"); return; } @@ -180,7 +180,7 @@ AcpiUtGetExpectedReturnTypes ( if (ExpectedBtypes & ThisRtype) { - ACPI_STRCAT (Buffer, &UtRtypeNames[i][j]); + strcat (Buffer, &UtRtypeNames[i][j]); j = 0; /* Use name separator from now on */ } diff --git a/source/components/utilities/utprint.c b/source/components/utilities/utprint.c index ffb5e6ad24d1..832d04fd35c2 100644 --- a/source/components/utilities/utprint.c +++ b/source/components/utilities/utprint.c @@ -227,7 +227,7 @@ AcpiUtScanNumber ( UINT64 Number = 0; - while (ACPI_IS_DIGIT (*String)) + while (isdigit (*String)) { Number *= 10; Number += *(String++) - '0'; @@ -505,7 +505,7 @@ AcpiUtVsnprintf ( /* Process width */ Width = -1; - if (ACPI_IS_DIGIT (*Format)) + if (isdigit (*Format)) { Format = AcpiUtScanNumber (Format, &Number); Width = (INT32) Number; @@ -527,7 +527,7 @@ AcpiUtVsnprintf ( if (*Format == '.') { ++Format; - if (ACPI_IS_DIGIT(*Format)) + if (isdigit(*Format)) { Format = AcpiUtScanNumber (Format, &Number); Precision = (INT32) Number; diff --git a/source/components/utilities/utstring.c b/source/components/utilities/utstring.c index 035d5ba8d3b2..737903d334df 100644 --- a/source/components/utilities/utstring.c +++ b/source/components/utilities/utstring.c @@ -89,7 +89,7 @@ AcpiUtStrlwr ( for (String = SrcString; *String; String++) { - *String = (char) ACPI_TOLOWER (*String); + *String = (char) tolower (*String); } return; @@ -168,7 +168,7 @@ AcpiUtStrupr ( for (String = SrcString; *String; String++) { - *String = (char) ACPI_TOUPPER (*String); + *String = (char) toupper (*String); } return; @@ -234,7 +234,7 @@ AcpiUtStrtoul64 ( /* Skip over any white space in the buffer */ - while ((*String) && (ACPI_IS_SPACE (*String) || *String == '\t')) + while ((*String) && (isspace (*String) || *String == '\t')) { String++; } @@ -245,7 +245,7 @@ AcpiUtStrtoul64 ( * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'. * We need to determine if it is decimal or hexadecimal. */ - if ((*String == '0') && (ACPI_TOLOWER (*(String + 1)) == 'x')) + if ((*String == '0') && (tolower (*(String + 1)) == 'x')) { SignOf0x = 1; Base = 16; @@ -261,7 +261,7 @@ AcpiUtStrtoul64 ( /* Any string left? Check that '0x' is not followed by white space. */ - if (!(*String) || ACPI_IS_SPACE (*String) || *String == '\t') + if (!(*String) || isspace (*String) || *String == '\t') { if (ToIntegerOp) { @@ -283,7 +283,7 @@ AcpiUtStrtoul64 ( while (*String) { - if (ACPI_IS_DIGIT (*String)) + if (isdigit (*String)) { /* Convert ASCII 0-9 to Decimal value */ @@ -297,8 +297,8 @@ AcpiUtStrtoul64 ( } else { - ThisDigit = (UINT8) ACPI_TOUPPER (*String); - if (ACPI_IS_XDIGIT ((char) ThisDigit)) + ThisDigit = (UINT8) toupper (*String); + if (isxdigit ((char) ThisDigit)) { /* Convert ASCII Hex char to value */ @@ -469,7 +469,7 @@ AcpiUtPrintString ( /* Check for printable character or hex escape */ - if (ACPI_IS_PRINT (String[i])) + if (isprint (String[i])) { /* This is a normal character */ @@ -711,12 +711,12 @@ AcpiUtSafeStrcpy ( char *Source) { - if (ACPI_STRLEN (Source) >= DestSize) + if (strlen (Source) >= DestSize) { return (TRUE); } - ACPI_STRCPY (Dest, Source); + strcpy (Dest, Source); return (FALSE); } @@ -727,12 +727,12 @@ AcpiUtSafeStrcat ( char *Source) { - if ((ACPI_STRLEN (Dest) + ACPI_STRLEN (Source)) >= DestSize) + if ((strlen (Dest) + strlen (Source)) >= DestSize) { return (TRUE); } - ACPI_STRCAT (Dest, Source); + strcat (Dest, Source); return (FALSE); } @@ -746,14 +746,14 @@ AcpiUtSafeStrncat ( ACPI_SIZE ActualTransferLength; - ActualTransferLength = ACPI_MIN (MaxTransferLength, ACPI_STRLEN (Source)); + ActualTransferLength = ACPI_MIN (MaxTransferLength, strlen (Source)); - if ((ACPI_STRLEN (Dest) + ActualTransferLength) >= DestSize) + if ((strlen (Dest) + ActualTransferLength) >= DestSize) { return (TRUE); } - ACPI_STRNCAT (Dest, Source, MaxTransferLength); + strncat (Dest, Source, MaxTransferLength); return (FALSE); } #endif diff --git a/source/components/utilities/uttrack.c b/source/components/utilities/uttrack.c index 44ef0ed7eae4..7a594be88fc2 100644 --- a/source/components/utilities/uttrack.c +++ b/source/components/utilities/uttrack.c @@ -113,7 +113,7 @@ AcpiUtCreateList ( return (AE_NO_MEMORY); } - ACPI_MEMSET (Cache, 0, sizeof (ACPI_MEMORY_LIST)); + memset (Cache, 0, sizeof (ACPI_MEMORY_LIST)); Cache->ListName = ListName; Cache->ObjectSize = ObjectSize; @@ -445,7 +445,7 @@ AcpiUtTrackAllocation ( Allocation->Component = Component; Allocation->Line = Line; - ACPI_STRNCPY (Allocation->Module, Module, ACPI_MAX_MODULE_NAME); + strncpy (Allocation->Module, Module, ACPI_MAX_MODULE_NAME); Allocation->Module[ACPI_MAX_MODULE_NAME-1] = 0; if (!Element) @@ -556,7 +556,7 @@ AcpiUtRemoveAllocation ( /* Mark the segment as deleted */ - ACPI_MEMSET (&Allocation->UserSpace, 0xEA, Allocation->Size); + memset (&Allocation->UserSpace, 0xEA, Allocation->Size); Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY); return (Status); @@ -667,7 +667,7 @@ AcpiUtDumpAllocations ( while (Element) { if ((Element->Component & Component) && - ((Module == NULL) || (0 == ACPI_STRCMP (Module, Element->Module)))) + ((Module == NULL) || (0 == strcmp (Module, Element->Module)))) { Descriptor = ACPI_CAST_PTR (ACPI_DESCRIPTOR, &Element->UserSpace); diff --git a/source/components/utilities/utxface.c b/source/components/utilities/utxface.c index 4266dcebc1d7..2c6ff38c8d9a 100644 --- a/source/components/utilities/utxface.c +++ b/source/components/utilities/utxface.c @@ -263,7 +263,7 @@ AcpiGetStatistics ( Stats->SciCount = AcpiSciCount; Stats->GpeCount = AcpiGpeCount; - ACPI_MEMCPY (Stats->FixedEventCount, AcpiFixedEventCount, + memcpy (Stats->FixedEventCount, AcpiFixedEventCount, sizeof (AcpiFixedEventCount)); @@ -367,7 +367,7 @@ AcpiInstallInterface ( /* Parameter validation */ - if (!InterfaceName || (ACPI_STRLEN (InterfaceName) == 0)) + if (!InterfaceName || (strlen (InterfaceName) == 0)) { return (AE_BAD_PARAMETER); } @@ -432,7 +432,7 @@ AcpiRemoveInterface ( /* Parameter validation */ - if (!InterfaceName || (ACPI_STRLEN (InterfaceName) == 0)) + if (!InterfaceName || (strlen (InterfaceName) == 0)) { return (AE_BAD_PARAMETER); } diff --git a/source/include/acglobal.h b/source/include/acglobal.h index ab2fc26b9a18..9e7da94ccf3a 100644 --- a/source/include/acglobal.h +++ b/source/include/acglobal.h @@ -62,6 +62,8 @@ ACPI_GLOBAL (ACPI_TABLE_HEADER, AcpiGbl_OriginalDsdtHeader); #if (!ACPI_REDUCED_HARDWARE) ACPI_GLOBAL (ACPI_TABLE_FACS *, AcpiGbl_FACS); +ACPI_GLOBAL (ACPI_TABLE_FACS *, AcpiGbl_Facs32); +ACPI_GLOBAL (ACPI_TABLE_FACS *, AcpiGbl_Facs64); #endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/source/include/acinterp.h b/source/include/acinterp.h index 66463d6db8f7..00eb8f0d2545 100644 --- a/source/include/acinterp.h +++ b/source/include/acinterp.h @@ -638,6 +638,11 @@ AcpiExIntegerToString ( char *Dest, UINT64 Value); +void +AcpiExPciClsToString ( + char *Dest, + UINT8 ClassCode[3]); + BOOLEAN AcpiIsValidSpaceId ( UINT8 SpaceId); diff --git a/source/include/aclocal.h b/source/include/aclocal.h index 4c96303101ed..dc1afffde35a 100644 --- a/source/include/aclocal.h +++ b/source/include/aclocal.h @@ -238,6 +238,7 @@ typedef struct acpi_table_list #define ACPI_TABLE_INDEX_DSDT (0) #define ACPI_TABLE_INDEX_FACS (1) +#define ACPI_TABLE_INDEX_X_FACS (2) typedef struct acpi_find_context diff --git a/source/include/acnames.h b/source/include/acnames.h index 6bb6bbf9df6a..6887d42c92b7 100644 --- a/source/include/acnames.h +++ b/source/include/acnames.h @@ -51,6 +51,7 @@ #define METHOD_NAME__BBN "_BBN" #define METHOD_NAME__CBA "_CBA" #define METHOD_NAME__CID "_CID" +#define METHOD_NAME__CLS "_CLS" #define METHOD_NAME__CRS "_CRS" #define METHOD_NAME__DDN "_DDN" #define METHOD_NAME__HID "_HID" diff --git a/source/include/acnamesp.h b/source/include/acnamesp.h index 07e76b596649..786fd293688f 100644 --- a/source/include/acnamesp.h +++ b/source/include/acnamesp.h @@ -67,6 +67,7 @@ #define ACPI_NS_PREFIX_IS_SCOPE 0x10 #define ACPI_NS_EXTERNAL 0x20 #define ACPI_NS_TEMPORARY 0x40 +#define ACPI_NS_OVERRIDE_IF_FOUND 0x80 /* Flags for AcpiNsWalkNamespace */ diff --git a/source/include/acobject.h b/source/include/acobject.h index b7b624b70302..481eb449bbd3 100644 --- a/source/include/acobject.h +++ b/source/include/acobject.h @@ -430,13 +430,14 @@ typedef struct acpi_object_addr_handler typedef struct acpi_object_reference { ACPI_OBJECT_COMMON_HEADER - UINT8 Class; /* Reference Class */ - UINT8 TargetType; /* Used for Index Op */ - UINT8 Reserved; - void *Object; /* NameOp=>HANDLE to obj, IndexOp=>ACPI_OPERAND_OBJECT */ - ACPI_NAMESPACE_NODE *Node; /* RefOf or Namepath */ - union acpi_operand_object **Where; /* Target of Index */ - UINT32 Value; /* Used for Local/Arg/Index/DdbHandle */ + UINT8 Class; /* Reference Class */ + UINT8 TargetType; /* Used for Index Op */ + UINT8 Reserved; + void *Object; /* NameOp=>HANDLE to obj, IndexOp=>ACPI_OPERAND_OBJECT */ + ACPI_NAMESPACE_NODE *Node; /* RefOf or Namepath */ + union acpi_operand_object **Where; /* Target of Index */ + UINT8 *IndexPointer; /* Used for Buffers and Strings */ + UINT32 Value; /* Used for Local/Arg/Index/DdbHandle */ } ACPI_OBJECT_REFERENCE; diff --git a/source/include/acoutput.h b/source/include/acoutput.h index ab078091839f..0ef98eb4494d 100644 --- a/source/include/acoutput.h +++ b/source/include/acoutput.h @@ -298,8 +298,12 @@ /* DEBUG_PRINT functions */ -#define ACPI_DEBUG_PRINT(plist) ACPI_ACTUAL_DEBUG plist -#define ACPI_DEBUG_PRINT_RAW(plist) ACPI_ACTUAL_DEBUG_RAW plist +#ifndef COMPILER_VA_MACRO + +#define ACPI_DEBUG_PRINT(plist) AcpiDebugPrint plist +#define ACPI_DEBUG_PRINT_RAW(plist) AcpiDebugPrintRaw plist + +#else /* Helper macros for DEBUG_PRINT */ @@ -319,6 +323,11 @@ ACPI_DO_DEBUG_PRINT (AcpiDebugPrintRaw, Level, Line, \ Filename, Modulename, Component, __VA_ARGS__) +#define ACPI_DEBUG_PRINT(plist) ACPI_ACTUAL_DEBUG plist +#define ACPI_DEBUG_PRINT_RAW(plist) ACPI_ACTUAL_DEBUG_RAW plist + +#endif + /* * Function entry tracing diff --git a/source/include/acpixf.h b/source/include/acpixf.h index e9180b32032d..ab640f3a3261 100644 --- a/source/include/acpixf.h +++ b/source/include/acpixf.h @@ -46,7 +46,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20150515 +#define ACPI_CA_VERSION 0x20150616 #include "acconfig.h" #include "actypes.h" @@ -201,6 +201,15 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DoNotUseXsdt, FALSE); */ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_Use32BitFadtAddresses, FALSE); +/* + * Optionally use 32-bit FACS table addresses. + * It is reported that some platforms fail to resume from system suspending + * if 64-bit FACS table address is selected: + * https://bugzilla.kernel.org/show_bug.cgi?id=74021 + * Default is TRUE, favor the 32-bit addresses. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_Use32BitFacsAddresses, TRUE); + /* * Optionally truncate I/O addresses to 16 bits. Provides compatibility * with other ACPI implementations. NOTE: During ACPICA initialization, @@ -221,6 +230,11 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DisableAutoRepair, FALSE); */ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DisableSsdtTableInstall, FALSE); +/* + * Optionally enable runtime namespace override. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_RuntimeNamespaceOverride, TRUE); + /* * We keep track of the latest version of Windows that has been requested by * the BIOS. ACPI 5.0. @@ -1066,14 +1080,8 @@ AcpiLeaveSleepState ( ACPI_HW_DEPENDENT_RETURN_STATUS ( ACPI_STATUS AcpiSetFirmwareWakingVector ( - UINT32 PhysicalAddress)) - -#if ACPI_MACHINE_WIDTH == 64 -ACPI_HW_DEPENDENT_RETURN_STATUS ( -ACPI_STATUS -AcpiSetFirmwareWakingVector64 ( - UINT64 PhysicalAddress)) -#endif + ACPI_PHYSICAL_ADDRESS PhysicalAddress, + ACPI_PHYSICAL_ADDRESS PhysicalAddress64)) /* diff --git a/source/include/acstruct.h b/source/include/acstruct.h index 547921b34b40..3a6faa6bf06b 100644 --- a/source/include/acstruct.h +++ b/source/include/acstruct.h @@ -85,6 +85,7 @@ typedef struct acpi_walk_state UINT8 ReturnUsed; UINT8 ScopeDepth; UINT8 PassNumber; /* Parse pass during table load */ + BOOLEAN NamespaceOverride; /* Override existing objects */ UINT8 ResultSize; /* Total elements for the result stack */ UINT8 ResultCount; /* Current number of occupied elements of result stack */ UINT32 AmlOffset; diff --git a/source/include/actbl.h b/source/include/actbl.h index 28421950ca37..a1fc7bf80ae1 100644 --- a/source/include/actbl.h +++ b/source/include/actbl.h @@ -67,6 +67,7 @@ #define ACPI_SIG_DSDT "DSDT" /* Differentiated System Description Table */ #define ACPI_SIG_FADT "FACP" /* Fixed ACPI Description Table */ #define ACPI_SIG_FACS "FACS" /* Firmware ACPI Control Structure */ +#define ACPI_SIG_OSDT "OSDT" /* Override System Description Table */ #define ACPI_SIG_PSDT "PSDT" /* Persistent System Description Table */ #define ACPI_SIG_RSDP "RSD PTR " /* Root System Description Pointer */ #define ACPI_SIG_RSDT "RSDT" /* Root System Description Table */ diff --git a/source/include/actbl1.h b/source/include/actbl1.h index 962324add5e1..3a11553297dc 100644 --- a/source/include/actbl1.h +++ b/source/include/actbl1.h @@ -974,10 +974,22 @@ typedef struct acpi_madt_generic_distributor UINT64 BaseAddress; UINT32 GlobalIrqBase; UINT8 Version; - UINT8 Reserved2[3]; /* Reserved - must be zero */ + UINT8 Reserved2[3]; /* Reserved - must be zero */ } ACPI_MADT_GENERIC_DISTRIBUTOR; +/* Values for Version field above */ + +enum AcpiMadtGicVersion +{ + ACPI_MADT_GIC_VERSION_NONE = 0, + ACPI_MADT_GIC_VERSION_V1 = 1, + ACPI_MADT_GIC_VERSION_V2 = 2, + ACPI_MADT_GIC_VERSION_V3 = 3, + ACPI_MADT_GIC_VERSION_V4 = 4, + ACPI_MADT_GIC_VERSION_RESERVED = 5 /* 5 and greater are reserved */ +}; + /* 13: Generic MSI Frame (ACPI 5.1) */ diff --git a/source/include/actbl2.h b/source/include/actbl2.h index 6f0c62ee78e8..02a3cb0dceff 100644 --- a/source/include/actbl2.h +++ b/source/include/actbl2.h @@ -52,8 +52,8 @@ * These tables are not consumed directly by the ACPICA subsystem, but are * included here to support device drivers and the AML disassembler. * - * The tables in this file are defined by third-party specifications, and are - * not defined directly by the ACPI specification itself. + * Generally, the tables in this file are defined by third-party specifications, + * and are not defined directly by the ACPI specification itself. * ******************************************************************************/ @@ -82,6 +82,7 @@ #define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */ #define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */ #define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */ +#define ACPI_SIG_TPM2 "TPM2" /* Trusted Platform Module 2.0 H/W interface table */ #define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */ #define ACPI_SIG_VRTC "VRTC" /* Virtual Real Time Clock Table */ #define ACPI_SIG_WAET "WAET" /* Windows ACPI Emulated devices Table */ @@ -1368,21 +1369,91 @@ enum AcpiSpmiInterfaceTypes /******************************************************************************* * * TCPA - Trusted Computing Platform Alliance table - * Version 1 + * Version 2 * - * Conforms to "TCG PC Specific Implementation Specification", - * Version 1.1, August 18, 2003 + * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0", + * December 19, 2014 + * + * NOTE: There are two versions of the table with the same signature -- + * the client version and the server version. * ******************************************************************************/ -typedef struct acpi_table_tcpa +typedef struct acpi_table_tcpa_client { ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT16 Reserved; - UINT32 MaxLogLength; /* Maximum length for the event log area */ + UINT16 PlatformClass; + UINT32 MinimumLogLength; /* Minimum length for the event log area */ UINT64 LogAddress; /* Address of the event log area */ -} ACPI_TABLE_TCPA; +} ACPI_TABLE_TCPA_CLIENT; + +typedef struct acpi_table_tcpa_server +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT16 PlatformClass; + UINT16 Reserved; + UINT64 MinimumLogLength; /* Minimum length for the event log area */ + UINT64 LogAddress; /* Address of the event log area */ + UINT16 SpecRevision; + UINT8 DeviceFlags; + UINT8 InterruptFlags; + UINT8 GpeNumber; + UINT8 Reserved2[3]; + UINT32 GlobalInterrupt; + ACPI_GENERIC_ADDRESS Address; + UINT32 Reserved3; + ACPI_GENERIC_ADDRESS ConfigAddress; + UINT8 Group; + UINT8 Bus; /* PCI Bus/Segment/Function numbers */ + UINT8 Device; + UINT8 Function; + +} ACPI_TABLE_TCPA_SERVER; + +/* Values for DeviceFlags above */ + +#define ACPI_TCPA_PCI_DEVICE (1) +#define ACPI_TCPA_BUS_PNP (1<<1) +#define ACPI_TCPA_ADDRESS_VALID (1<<2) + +/* Values for InterruptFlags above */ + +#define ACPI_TCPA_INTERRUPT_MODE (1) +#define ACPI_TCPA_INTERRUPT_POLARITY (1<<1) +#define ACPI_TCPA_SCI_VIA_GPE (1<<2) +#define ACPI_TCPA_GLOBAL_INTERRUPT (1<<3) + + +/******************************************************************************* + * + * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table + * Version 4 + * + * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0", + * December 19, 2014 + * + ******************************************************************************/ + +typedef struct acpi_table_tpm2 +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT16 PlatformClass; + UINT16 Reserved; + UINT64 ControlAddress; + UINT32 StartMethod; + + /* Platform-specific data follows */ + +} ACPI_TABLE_TPM2; + +/* Values for StartMethod above */ + +#define ACPI_TPM2_NOT_ALLOWED 0 +#define ACPI_TPM2_START_METHOD 2 +#define ACPI_TPM2_MEMORY_MAPPED 6 +#define ACPI_TPM2_COMMAND_BUFFER 7 +#define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD 8 /******************************************************************************* diff --git a/source/include/actbl3.h b/source/include/actbl3.h index f575d086b55c..7da6bc68daee 100644 --- a/source/include/actbl3.h +++ b/source/include/actbl3.h @@ -52,7 +52,8 @@ * These tables are not consumed directly by the ACPICA subsystem, but are * included here to support device drivers and the AML disassembler. * - * The tables in this file are fully defined within the ACPI specification. + * In general, the tables in this file are fully defined within the ACPI + * specification. * ******************************************************************************/ @@ -71,7 +72,6 @@ #define ACPI_SIG_PMTT "PMTT" /* Platform Memory Topology Table */ #define ACPI_SIG_RASF "RASF" /* RAS Feature table */ #define ACPI_SIG_STAO "STAO" /* Status Override table */ -#define ACPI_SIG_TPM2 "TPM2" /* Trusted Platform Module 2.0 H/W interface table */ #define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */ #define ACPI_SIG_XENV "XENV" /* Xen Environment table */ @@ -846,41 +846,6 @@ typedef struct acpi_table_stao } ACPI_TABLE_STAO; -/******************************************************************************* - * - * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table - * Version 3 - * - * Conforms to "TPM 2.0 Hardware Interface Table (TPM2)" 29 November 2011 - * - ******************************************************************************/ - -typedef struct acpi_table_tpm2 -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 Flags; - UINT64 ControlAddress; - UINT32 StartMethod; - -} ACPI_TABLE_TPM2; - -/* Control area structure (not part of table, pointed to by ControlAddress) */ - -typedef struct acpi_tpm2_control -{ - UINT32 Reserved; - UINT32 Error; - UINT32 Cancel; - UINT32 Start; - UINT64 InterruptControl; - UINT32 CommandSize; - UINT64 CommandAddress; - UINT32 ResponseSize; - UINT64 ResponseAddress; - -} ACPI_TPM2_CONTROL; - - /******************************************************************************* * * WPBT - Windows Platform Environment Table (ACPI 6.0) diff --git a/source/include/actypes.h b/source/include/actypes.h index 0bee2a771b9d..ad00713139e9 100644 --- a/source/include/actypes.h +++ b/source/include/actypes.h @@ -555,14 +555,14 @@ typedef UINT64 ACPI_INTEGER; #define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (UINT32, (a)) == *ACPI_CAST_PTR (UINT32, (b))) #define ACPI_MOVE_NAME(dest,src) (*ACPI_CAST_PTR (UINT32, (dest)) = *ACPI_CAST_PTR (UINT32, (src))) #else -#define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE)) -#define ACPI_MOVE_NAME(dest,src) (ACPI_STRNCPY (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE)) +#define ACPI_COMPARE_NAME(a,b) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE)) +#define ACPI_MOVE_NAME(dest,src) (strncpy (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE)) #endif /* Support for the special RSDP signature (8 characters) */ -#define ACPI_VALIDATE_RSDP_SIG(a) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8)) -#define ACPI_MAKE_RSDP_SIG(dest) (ACPI_MEMCPY (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8)) +#define ACPI_VALIDATE_RSDP_SIG(a) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8)) +#define ACPI_MAKE_RSDP_SIG(dest) (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8)) /******************************************************************************* @@ -767,10 +767,6 @@ typedef UINT32 ACPI_EVENT_STATUS; #define ACPI_GPE_ENABLE 0 #define ACPI_GPE_DISABLE 1 #define ACPI_GPE_CONDITIONAL_ENABLE 2 -#define ACPI_GPE_SAVE_MASK 4 - -#define ACPI_GPE_ENABLE_SAVE (ACPI_GPE_ENABLE | ACPI_GPE_SAVE_MASK) -#define ACPI_GPE_DISABLE_SAVE (ACPI_GPE_DISABLE | ACPI_GPE_SAVE_MASK) /* * GPE info flags - Per GPE @@ -1227,6 +1223,10 @@ UINT32 (*ACPI_INTERFACE_HANDLER) ( #define ACPI_UUID_LENGTH 16 +/* Length of 3-byte PCI class code values when converted back to a string */ + +#define ACPI_PCICLS_STRING_SIZE 7 /* Includes null terminator */ + /* Structures used for device/processor HID, UID, CID, and SUB */ @@ -1255,7 +1255,7 @@ typedef struct acpi_device_info UINT32 Name; /* ACPI object Name */ ACPI_OBJECT_TYPE Type; /* ACPI object Type */ UINT8 ParamCount; /* If a method, required parameter count */ - UINT8 Valid; /* Indicates which optional fields are valid */ + UINT16 Valid; /* Indicates which optional fields are valid */ UINT8 Flags; /* Miscellaneous info */ UINT8 HighestDstates[4]; /* _SxD values: 0xFF indicates not valid */ UINT8 LowestDstates[5]; /* _SxW values: 0xFF indicates not valid */ @@ -1264,6 +1264,7 @@ typedef struct acpi_device_info ACPI_PNP_DEVICE_ID HardwareId; /* _HID value */ ACPI_PNP_DEVICE_ID UniqueId; /* _UID value */ ACPI_PNP_DEVICE_ID SubsystemId; /* _SUB value */ + ACPI_PNP_DEVICE_ID ClassCode; /* _CLS value */ ACPI_PNP_DEVICE_ID_LIST CompatibleIdList; /* _CID list */ } ACPI_DEVICE_INFO; @@ -1274,14 +1275,15 @@ typedef struct acpi_device_info /* Flags for Valid field above (AcpiGetObjectInfo) */ -#define ACPI_VALID_STA 0x01 -#define ACPI_VALID_ADR 0x02 -#define ACPI_VALID_HID 0x04 -#define ACPI_VALID_UID 0x08 -#define ACPI_VALID_SUB 0x10 -#define ACPI_VALID_CID 0x20 -#define ACPI_VALID_SXDS 0x40 -#define ACPI_VALID_SXWS 0x80 +#define ACPI_VALID_STA 0x0001 +#define ACPI_VALID_ADR 0x0002 +#define ACPI_VALID_HID 0x0004 +#define ACPI_VALID_UID 0x0008 +#define ACPI_VALID_SUB 0x0010 +#define ACPI_VALID_CID 0x0020 +#define ACPI_VALID_CLS 0x0040 +#define ACPI_VALID_SXDS 0x0100 +#define ACPI_VALID_SXWS 0x0200 /* Flags for _STA return value (CurrentStatus above) */ diff --git a/source/include/acutils.h b/source/include/acutils.h index 1be82c75999b..4f4a13efd7ff 100644 --- a/source/include/acutils.h +++ b/source/include/acutils.h @@ -251,85 +251,113 @@ AcpiUtSubsystemShutdown ( */ #ifndef ACPI_USE_SYSTEM_CLIBRARY +#ifdef memcmp +#error memcmp defined! +#endif + +#undef strstr +#undef strchr +#undef strlen +#undef strcpy +#undef strncpy +#undef strncmp +#undef strcmp +#undef strcat +#undef strncat +#undef strtoul +#undef memcmp +#undef memcpy +#undef memset +#undef toupper +#undef tolower +#undef isxdigit +#undef isdigit +#undef isspace +#undef isupper +#undef isprint +#undef isalpha + ACPI_SIZE -AcpiUtStrlen ( +strlen ( const char *String); char * -AcpiUtStrchr ( +strchr ( const char *String, int ch); char * -AcpiUtStrcpy ( +strcpy ( char *DstString, const char *SrcString); char * -AcpiUtStrncpy ( +strncpy ( char *DstString, const char *SrcString, ACPI_SIZE Count); int -AcpiUtMemcmp ( - const char *Buffer1, - const char *Buffer2, - ACPI_SIZE Count); - -int -AcpiUtStrncmp ( +strncmp ( const char *String1, const char *String2, ACPI_SIZE Count); int -AcpiUtStrcmp ( +strcmp ( const char *String1, const char *String2); char * -AcpiUtStrcat ( +strcat ( char *DstString, const char *SrcString); char * -AcpiUtStrncat ( +strncat ( char *DstString, const char *SrcString, ACPI_SIZE Count); UINT32 -AcpiUtStrtoul ( +strtoul ( const char *String, char **Terminator, UINT32 Base); char * -AcpiUtStrstr ( +strstr ( char *String1, char *String2); +int +memcmp ( + void *Buffer1, + void *Buffer2, + ACPI_SIZE Count); + void * -AcpiUtMemcpy ( +memcpy ( void *Dest, const void *Src, ACPI_SIZE Count); void * -AcpiUtMemset ( +memset ( void *Dest, - UINT8 Value, + int Value, ACPI_SIZE Count); int -AcpiUtToUpper ( +toupper ( int c); int -AcpiUtToLower ( +tolower ( int c); + + extern const UINT8 _acpi_ctype[]; #define _ACPI_XA 0x00 /* extra alphabetic - not supported */ @@ -343,13 +371,31 @@ extern const UINT8 _acpi_ctype[]; #define _ACPI_UP 0x01 /* 'A'-'Z' */ #define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */ -#define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI)) -#define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP)) -#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD)) -#define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP)) -#define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) -#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU)) -#define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) +#define isdigit(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI)) +#define isspace(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP)) +#define isxdigit(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD)) +#define isupper(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP)) +#define islower(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) +#define isprint(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU)) +#define isalpha(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) + +#ifndef ACPI_CLIBRARY +#define strstr(s1,s2) strstr ((s1), (s2)) +#define strchr(s1,c) strchr ((s1), (c)) +#define strlen(s) (ACPI_SIZE) strlen ((s)) +#define strcpy(d,s) (void) strcpy ((d), (s)) +#define strncpy(d,s,n) (void) strncpy ((d), (s), (ACPI_SIZE)(n)) +#define strncmp(d,s,n) strncmp ((d), (s), (ACPI_SIZE)(n)) +#define strcmp(d,s) strcmp ((d), (s)) +#define strcat(d,s) (void) strcat ((d), (s)) +#define strncat(d,s,n) strncat ((d), (s), (ACPI_SIZE)(n)) +#define strtoul(d,s,n) strtoul ((d), (s), (ACPI_SIZE)(n)) +#define memcmp(s1,s2,n) memcmp((void *)(s1), (void *)(s2), (ACPI_SIZE)(n)) +#define memcpy(d,s,n) (void) memcpy ((d), (s), (ACPI_SIZE)(n)) +#define memset(d,v,n) (void) memset ((d), (v), (ACPI_SIZE)(n)) +#define toupper(c) toupper ((int) (c)) +#define tolower(c) tolower ((int) (c)) +#endif /* ACPI_CLIBRARY */ #endif /* !ACPI_USE_SYSTEM_CLIBRARY */ @@ -602,6 +648,11 @@ AcpiUtExecute_CID ( ACPI_NAMESPACE_NODE *DeviceNode, ACPI_PNP_DEVICE_ID_LIST **ReturnCidList); +ACPI_STATUS +AcpiUtExecute_CLS ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_PNP_DEVICE_ID **ReturnId); + /* * utlock - reader/writer locks diff --git a/source/include/platform/acefi.h b/source/include/platform/acefi.h index ae39dc759dac..c19ce01586a8 100644 --- a/source/include/platform/acefi.h +++ b/source/include/platform/acefi.h @@ -49,10 +49,150 @@ #include #include #endif -#include -#include -#include +#if defined(__x86_64__) +#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) +#define USE_MS_ABI 1 +#endif +#endif + +#ifdef _MSC_EXTENSIONS +#define EFIAPI __cdecl +#elif USE_MS_ABI +#define EFIAPI __attribute__((ms_abi)) +#else +#define EFIAPI +#endif + +typedef uint8_t UINT8; +typedef uint16_t UINT16; +typedef int16_t INT16; +typedef uint32_t UINT32; +typedef int32_t INT32; +typedef uint64_t UINT64; +typedef int64_t INT64; +typedef uint8_t BOOLEAN; +typedef uint16_t CHAR16; + +#define VOID void + +#if defined(__ia64__) || defined(__x86_64__) + +#define ACPI_MACHINE_WIDTH 64 + +#if defined(__x86_64__) + +/* for x86_64, EFI_FUNCTION_WRAPPER must be defined */ + +#ifndef USE_MS_ABI +#define USE_EFI_FUNCTION_WRAPPER +#endif + +#ifdef _MSC_EXTENSIONS +#pragma warning ( disable : 4731 ) // Suppress warnings about modification of EBP +#endif + +#endif + +typedef uint64_t UINTN; +typedef int64_t INTN; + +#define EFIERR(a) (0x8000000000000000 | a) + +#else + +#define ACPI_MACHINE_WIDTH 32 +#define ACPI_USE_NATIVE_DIVIDE + +typedef uint32_t UINTN; +typedef int32_t INTN; + +#define EFIERR(a) (0x80000000 | a) + +#endif + + +#ifdef USE_EFI_FUNCTION_WRAPPER +#define __VA_NARG__(...) \ + __VA_NARG_(_0, ## __VA_ARGS__, __RSEQ_N()) +#define __VA_NARG_(...) \ + __VA_ARG_N(__VA_ARGS__) +#define __VA_ARG_N( \ + _0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,N,...) N +#define __RSEQ_N() \ + 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 + +#define __VA_ARG_NSUFFIX__(prefix,...) \ + __VA_ARG_NSUFFIX_N(prefix, __VA_NARG__(__VA_ARGS__)) +#define __VA_ARG_NSUFFIX_N(prefix,nargs) \ + __VA_ARG_NSUFFIX_N_(prefix, nargs) +#define __VA_ARG_NSUFFIX_N_(prefix,nargs) \ + prefix ## nargs + +/* Prototypes of EFI cdecl -> stdcall trampolines */ +UINT64 efi_call0(void *func); +UINT64 efi_call1(void *func, UINT64 arg1); +UINT64 efi_call2(void *func, UINT64 arg1, UINT64 arg2); +UINT64 efi_call3(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3); +UINT64 efi_call4(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, + UINT64 arg4); +UINT64 efi_call5(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, + UINT64 arg4, UINT64 arg5); +UINT64 efi_call6(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, + UINT64 arg4, UINT64 arg5, UINT64 arg6); +UINT64 efi_call7(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, + UINT64 arg4, UINT64 arg5, UINT64 arg6, UINT64 arg7); +UINT64 efi_call8(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, + UINT64 arg4, UINT64 arg5, UINT64 arg6, UINT64 arg7, + UINT64 arg8); +UINT64 efi_call9(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, + UINT64 arg4, UINT64 arg5, UINT64 arg6, UINT64 arg7, + UINT64 arg8, UINT64 arg9); +UINT64 efi_call10(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, + UINT64 arg4, UINT64 arg5, UINT64 arg6, UINT64 arg7, + UINT64 arg8, UINT64 arg9, UINT64 arg10); + +/* Front-ends to efi_callX to avoid compiler warnings */ +#define _cast64_efi_call0(f) \ + efi_call0(f) +#define _cast64_efi_call1(f,a1) \ + efi_call1(f, (UINT64)(a1)) +#define _cast64_efi_call2(f,a1,a2) \ + efi_call2(f, (UINT64)(a1), (UINT64)(a2)) +#define _cast64_efi_call3(f,a1,a2,a3) \ + efi_call3(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3)) +#define _cast64_efi_call4(f,a1,a2,a3,a4) \ + efi_call4(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4)) +#define _cast64_efi_call5(f,a1,a2,a3,a4,a5) \ + efi_call5(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \ + (UINT64)(a5)) +#define _cast64_efi_call6(f,a1,a2,a3,a4,a5,a6) \ + efi_call6(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \ + (UINT64)(a5), (UINT64)(a6)) +#define _cast64_efi_call7(f,a1,a2,a3,a4,a5,a6,a7) \ + efi_call7(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \ + (UINT64)(a5), (UINT64)(a6), (UINT64)(a7)) +#define _cast64_efi_call8(f,a1,a2,a3,a4,a5,a6,a7,a8) \ + efi_call8(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \ + (UINT64)(a5), (UINT64)(a6), (UINT64)(a7), (UINT64)(a8)) +#define _cast64_efi_call9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) \ + efi_call9(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \ + (UINT64)(a5), (UINT64)(a6), (UINT64)(a7), (UINT64)(a8), \ + (UINT64)(a9)) +#define _cast64_efi_call10(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) \ + efi_call10(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \ + (UINT64)(a5), (UINT64)(a6), (UINT64)(a7), (UINT64)(a8), \ + (UINT64)(a9), (UINT64)(a10)) + +/* main wrapper (va_num ignored) */ +#define uefi_call_wrapper(func,va_num,...) \ + __VA_ARG_NSUFFIX__(_cast64_efi_call, __VA_ARGS__) (func , ##__VA_ARGS__) + +#else + +#define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__) + +#endif /* AED EFI definitions */ @@ -96,10 +236,6 @@ #undef ACPI_USE_NATIVE_DIVIDE #define ACPI_USE_SYSTEM_INTTYPES -#define ACPI_FILE SIMPLE_TEXT_OUTPUT_INTERFACE * -#define ACPI_FILE_OUT ST->ConOut -#define ACPI_FILE_ERR ST->ConOut - /* * Math helpers */ @@ -116,21 +252,21 @@ (n_hi) >>= 1; \ } while (0) -/* - * EFI specific prototypes - */ -EFI_STATUS -efi_main ( - EFI_HANDLE Image, - EFI_SYSTEM_TABLE *SystemTab); - -int -acpi_main ( - int argc, - char *argv[]); - #endif +struct _SIMPLE_TEXT_OUTPUT_INTERFACE; +struct _SIMPLE_INPUT_INTERFACE; +struct _EFI_FILE_IO_INTERFACE; +struct _EFI_FILE_HANDLE; +struct _EFI_BOOT_SERVICES; +struct _EFI_SYSTEM_TABLE; + +extern struct _EFI_SYSTEM_TABLE *ST; +extern struct _EFI_BOOT_SERVICES *BS; + +#define ACPI_FILE struct _SIMPLE_TEXT_OUTPUT_INTERFACE * +#define ACPI_FILE_OUT ST->ConOut +#define ACPI_FILE_ERR ST->ConOut #endif /* __ACEFI_H__ */ diff --git a/source/include/platform/acefiex.h b/source/include/platform/acefiex.h new file mode 100644 index 000000000000..1eb1e573a428 --- /dev/null +++ b/source/include/platform/acefiex.h @@ -0,0 +1,855 @@ +/****************************************************************************** + * + * Name: acefiex.h - Extra OS specific defines, etc. for EFI + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2015, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef __ACEFIEX_H__ +#define __ACEFIEX_H__ + + +#define EFI_ERROR(a) (((INTN) a) < 0) +#define EFI_SUCCESS 0 +#define EFI_LOAD_ERROR EFIERR(1) +#define EFI_INVALID_PARAMETER EFIERR(2) +#define EFI_UNSUPPORTED EFIERR(3) +#define EFI_BAD_BUFFER_SIZE EFIERR(4) +#define EFI_BUFFER_TOO_SMALL EFIERR(5) +#define EFI_NOT_READY EFIERR(6) +#define EFI_DEVICE_ERROR EFIERR(7) +#define EFI_WRITE_PROTECTED EFIERR(8) +#define EFI_OUT_OF_RESOURCES EFIERR(9) +#define EFI_VOLUME_CORRUPTED EFIERR(10) +#define EFI_VOLUME_FULL EFIERR(11) +#define EFI_NO_MEDIA EFIERR(12) +#define EFI_MEDIA_CHANGED EFIERR(13) +#define EFI_NOT_FOUND EFIERR(14) +#define EFI_ACCESS_DENIED EFIERR(15) +#define EFI_NO_RESPONSE EFIERR(16) +#define EFI_NO_MAPPING EFIERR(17) +#define EFI_TIMEOUT EFIERR(18) +#define EFI_NOT_STARTED EFIERR(19) +#define EFI_ALREADY_STARTED EFIERR(20) +#define EFI_ABORTED EFIERR(21) +#define EFI_PROTOCOL_ERROR EFIERR(24) + + +typedef UINTN EFI_STATUS; +typedef VOID *EFI_HANDLE; +typedef VOID *EFI_EVENT; + +typedef struct { + UINT32 Data1; + UINT16 Data2; + UINT16 Data3; + UINT8 Data4[8]; +} EFI_GUID; + +typedef struct _EFI_DEVICE_PATH { + UINT8 Type; + UINT8 SubType; + UINT8 Length[2]; +} EFI_DEVICE_PATH; + +typedef UINT64 EFI_PHYSICAL_ADDRESS; +typedef UINT64 EFI_VIRTUAL_ADDRESS; + +typedef enum { + AllocateAnyPages, + AllocateMaxAddress, + AllocateAddress, + MaxAllocateType +} EFI_ALLOCATE_TYPE; + +typedef enum { + EfiReservedMemoryType, + EfiLoaderCode, + EfiLoaderData, + EfiBootServicesCode, + EfiBootServicesData, + EfiRuntimeServicesCode, + EfiRuntimeServicesData, + EfiConventionalMemory, + EfiUnusableMemory, + EfiACPIReclaimMemory, + EfiACPIMemoryNVS, + EfiMemoryMappedIO, + EfiMemoryMappedIOPortSpace, + EfiPalCode, + EfiMaxMemoryType +} EFI_MEMORY_TYPE; + +/* possible caching types for the memory range */ +#define EFI_MEMORY_UC 0x0000000000000001 +#define EFI_MEMORY_WC 0x0000000000000002 +#define EFI_MEMORY_WT 0x0000000000000004 +#define EFI_MEMORY_WB 0x0000000000000008 +#define EFI_MEMORY_UCE 0x0000000000000010 + +/* physical memory protection on range */ +#define EFI_MEMORY_WP 0x0000000000001000 +#define EFI_MEMORY_RP 0x0000000000002000 +#define EFI_MEMORY_XP 0x0000000000004000 + +/* range requires a runtime mapping */ +#define EFI_MEMORY_RUNTIME 0x8000000000000000 + +#define EFI_MEMORY_DESCRIPTOR_VERSION 1 +typedef struct { + UINT32 Type; + UINT32 Pad; + EFI_PHYSICAL_ADDRESS PhysicalStart; + EFI_VIRTUAL_ADDRESS VirtualStart; + UINT64 NumberOfPages; + UINT64 Attribute; +} EFI_MEMORY_DESCRIPTOR; + +typedef struct _EFI_TABLE_HEARDER { + UINT64 Signature; + UINT32 Revision; + UINT32 HeaderSize; + UINT32 CRC32; + UINT32 Reserved; +} EFI_TABLE_HEADER; + +typedef +EFI_STATUS +(EFIAPI *EFI_UNKNOWN_INTERFACE) ( + void); + + +/* + * Text output protocol + */ +#define SIMPLE_TEXT_OUTPUT_PROTOCOL \ + { 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } + +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_RESET) ( + struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, + BOOLEAN ExtendedVerification); + +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_OUTPUT_STRING) ( + struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, + CHAR16 *String); + +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_TEST_STRING) ( + struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, + CHAR16 *String); + +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_QUERY_MODE) ( + struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, + UINTN ModeNumber, + UINTN *Columns, + UINTN *Rows); + +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_SET_MODE) ( + struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, + UINTN ModeNumber); + +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_SET_ATTRIBUTE) ( + struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, + UINTN Attribute); + +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_CLEAR_SCREEN) ( + struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This); + +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_SET_CURSOR_POSITION) ( + struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, + UINTN Column, + UINTN Row); + +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_ENABLE_CURSOR) ( + struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, + BOOLEAN Enable); + +typedef struct { + INT32 MaxMode; + INT32 Mode; + INT32 Attribute; + INT32 CursorColumn; + INT32 CursorRow; + BOOLEAN CursorVisible; +} SIMPLE_TEXT_OUTPUT_MODE; + +typedef struct _SIMPLE_TEXT_OUTPUT_INTERFACE { + EFI_TEXT_RESET Reset; + + EFI_TEXT_OUTPUT_STRING OutputString; + EFI_TEXT_TEST_STRING TestString; + + EFI_TEXT_QUERY_MODE QueryMode; + EFI_TEXT_SET_MODE SetMode; + EFI_TEXT_SET_ATTRIBUTE SetAttribute; + + EFI_TEXT_CLEAR_SCREEN ClearScreen; + EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition; + EFI_TEXT_ENABLE_CURSOR EnableCursor; + + SIMPLE_TEXT_OUTPUT_MODE *Mode; +} SIMPLE_TEXT_OUTPUT_INTERFACE; + +/* + * Text input protocol + */ +#define SIMPLE_TEXT_INPUT_PROTOCOL \ + { 0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } + +typedef struct { + UINT16 ScanCode; + CHAR16 UnicodeChar; +} EFI_INPUT_KEY; + +/* + * Baseline unicode control chars + */ +#define CHAR_NULL 0x0000 +#define CHAR_BACKSPACE 0x0008 +#define CHAR_TAB 0x0009 +#define CHAR_LINEFEED 0x000A +#define CHAR_CARRIAGE_RETURN 0x000D + +typedef +EFI_STATUS +(EFIAPI *EFI_INPUT_RESET) ( + struct _SIMPLE_INPUT_INTERFACE *This, + BOOLEAN ExtendedVerification); + +typedef +EFI_STATUS +(EFIAPI *EFI_INPUT_READ_KEY) ( + struct _SIMPLE_INPUT_INTERFACE *This, + EFI_INPUT_KEY *Key); + +typedef struct _SIMPLE_INPUT_INTERFACE { + EFI_INPUT_RESET Reset; + EFI_INPUT_READ_KEY ReadKeyStroke; + EFI_EVENT WaitForKey; +} SIMPLE_INPUT_INTERFACE; + + +/* + * Simple file system protocol + */ +#define SIMPLE_FILE_SYSTEM_PROTOCOL \ + { 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } + +typedef +EFI_STATUS +(EFIAPI *EFI_VOLUME_OPEN) ( + struct _EFI_FILE_IO_INTERFACE *This, + struct _EFI_FILE_HANDLE **Root); + +#define EFI_FILE_IO_INTERFACE_REVISION 0x00010000 + +typedef struct _EFI_FILE_IO_INTERFACE { + UINT64 Revision; + EFI_VOLUME_OPEN OpenVolume; +} EFI_FILE_IO_INTERFACE; + +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_OPEN) ( + struct _EFI_FILE_HANDLE *File, + struct _EFI_FILE_HANDLE **NewHandle, + CHAR16 *FileName, + UINT64 OpenMode, + UINT64 Attributes); + +/* Values for OpenMode used above */ + +#define EFI_FILE_MODE_READ 0x0000000000000001 +#define EFI_FILE_MODE_WRITE 0x0000000000000002 +#define EFI_FILE_MODE_CREATE 0x8000000000000000 + +/* Values for Attribute used above */ + +#define EFI_FILE_READ_ONLY 0x0000000000000001 +#define EFI_FILE_HIDDEN 0x0000000000000002 +#define EFI_FILE_SYSTEM 0x0000000000000004 +#define EFI_FILE_RESERVIED 0x0000000000000008 +#define EFI_FILE_DIRECTORY 0x0000000000000010 +#define EFI_FILE_ARCHIVE 0x0000000000000020 +#define EFI_FILE_VALID_ATTR 0x0000000000000037 + +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_CLOSE) ( + struct _EFI_FILE_HANDLE *File); + +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_DELETE) ( + struct _EFI_FILE_HANDLE *File); + +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_READ) ( + struct _EFI_FILE_HANDLE *File, + UINTN *BufferSize, + VOID *Buffer); + +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_WRITE) ( + struct _EFI_FILE_HANDLE *File, + UINTN *BufferSize, + VOID *Buffer); + +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_SET_POSITION) ( + struct _EFI_FILE_HANDLE *File, + UINT64 Position); + +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_GET_POSITION) ( + struct _EFI_FILE_HANDLE *File, + UINT64 *Position); + +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_GET_INFO) ( + struct _EFI_FILE_HANDLE *File, + EFI_GUID *InformationType, + UINTN *BufferSize, + VOID *Buffer); + +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_SET_INFO) ( + struct _EFI_FILE_HANDLE *File, + EFI_GUID *InformationType, + UINTN BufferSize, + VOID *Buffer); + +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_FLUSH) ( + struct _EFI_FILE_HANDLE *File); + + +#define EFI_FILE_HANDLE_REVISION 0x00010000 + +typedef struct _EFI_FILE_HANDLE { + UINT64 Revision; + EFI_FILE_OPEN Open; + EFI_FILE_CLOSE Close; + EFI_FILE_DELETE Delete; + EFI_FILE_READ Read; + EFI_FILE_WRITE Write; + EFI_FILE_GET_POSITION GetPosition; + EFI_FILE_SET_POSITION SetPosition; + EFI_FILE_GET_INFO GetInfo; + EFI_FILE_SET_INFO SetInfo; + EFI_FILE_FLUSH Flush; +} EFI_FILE, *EFI_FILE_HANDLE; + + +/* + * Loaded image protocol + */ +#define LOADED_IMAGE_PROTOCOL \ + { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} } + +typedef +EFI_STATUS +(EFIAPI *EFI_IMAGE_ENTRY_POINT) ( + EFI_HANDLE ImageHandle, + struct _EFI_SYSTEM_TABLE *SystemTable); + +typedef +EFI_STATUS +(EFIAPI *EFI_IMAGE_LOAD) ( + BOOLEAN BootPolicy, + EFI_HANDLE ParentImageHandle, + EFI_DEVICE_PATH *FilePath, + VOID *SourceBuffer, + UINTN SourceSize, + EFI_HANDLE *ImageHandle); + +typedef +EFI_STATUS +(EFIAPI *EFI_IMAGE_START) ( + EFI_HANDLE ImageHandle, + UINTN *ExitDataSize, + CHAR16 **ExitData); + +typedef +EFI_STATUS +(EFIAPI *EFI_EXIT) ( + EFI_HANDLE ImageHandle, + EFI_STATUS ExitStatus, + UINTN ExitDataSize, + CHAR16 *ExitData); + +typedef +EFI_STATUS +(EFIAPI *EFI_IMAGE_UNLOAD) ( + EFI_HANDLE ImageHandle); + + +#define EFI_IMAGE_INFORMATION_REVISION 0x1000 +typedef struct { + UINT32 Revision; + EFI_HANDLE ParentHandle; + struct _EFI_SYSTEM_TABLE *SystemTable; + EFI_HANDLE DeviceHandle; + EFI_DEVICE_PATH *FilePath; + VOID *Reserved; + UINT32 LoadOptionsSize; + VOID *LoadOptions; + VOID *ImageBase; + UINT64 ImageSize; + EFI_MEMORY_TYPE ImageCodeType; + EFI_MEMORY_TYPE ImageDataType; + EFI_IMAGE_UNLOAD Unload; + +} EFI_LOADED_IMAGE; + + +/* + * EFI Memory + */ +typedef +EFI_STATUS +(EFIAPI *EFI_ALLOCATE_PAGES) ( + EFI_ALLOCATE_TYPE Type, + EFI_MEMORY_TYPE MemoryType, + UINTN NoPages, + EFI_PHYSICAL_ADDRESS *Memory); + +typedef +EFI_STATUS +(EFIAPI *EFI_FREE_PAGES) ( + EFI_PHYSICAL_ADDRESS Memory, + UINTN NoPages); + +typedef +EFI_STATUS +(EFIAPI *EFI_GET_MEMORY_MAP) ( + UINTN *MemoryMapSize, + EFI_MEMORY_DESCRIPTOR *MemoryMap, + UINTN *MapKey, + UINTN *DescriptorSize, + UINT32 *DescriptorVersion); + +#define NextMemoryDescriptor(Ptr,Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size)) + +typedef +EFI_STATUS +(EFIAPI *EFI_ALLOCATE_POOL) ( + EFI_MEMORY_TYPE PoolType, + UINTN Size, + VOID **Buffer); + +typedef +EFI_STATUS +(EFIAPI *EFI_FREE_POOL) ( + VOID *Buffer); + + +/* + * Protocol handler functions + */ +typedef enum { + EFI_NATIVE_INTERFACE, + EFI_PCODE_INTERFACE +} EFI_INTERFACE_TYPE; + +typedef enum { + AllHandles, + ByRegisterNotify, + ByProtocol +} EFI_LOCATE_SEARCH_TYPE; + +typedef +EFI_STATUS +(EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) ( + EFI_HANDLE *Handle, + EFI_GUID *Protocol, + EFI_INTERFACE_TYPE InterfaceType, + VOID *Interface); + +typedef +EFI_STATUS +(EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) ( + EFI_HANDLE Handle, + EFI_GUID *Protocol, + VOID *OldInterface, + VOID *NewInterface); + +typedef +EFI_STATUS +(EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) ( + EFI_HANDLE Handle, + EFI_GUID *Protocol, + VOID *Interface); + +typedef +EFI_STATUS +(EFIAPI *EFI_HANDLE_PROTOCOL) ( + EFI_HANDLE Handle, + EFI_GUID *Protocol, + VOID **Interface); + +typedef +EFI_STATUS +(EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) ( + EFI_GUID *Protocol, + EFI_EVENT Event, + VOID **Registration); + +typedef +EFI_STATUS +(EFIAPI *EFI_LOCATE_HANDLE) ( + EFI_LOCATE_SEARCH_TYPE SearchType, + EFI_GUID *Protocol, + VOID *SearchKey, + UINTN *BufferSize, + EFI_HANDLE *Buffer); + +typedef +EFI_STATUS +(EFIAPI *EFI_LOCATE_DEVICE_PATH) ( + EFI_GUID *Protocol, + EFI_DEVICE_PATH **DevicePath, + EFI_HANDLE *Device); + +typedef +EFI_STATUS +(EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) ( + EFI_GUID *Guid, + VOID *Table); + +#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001 +#define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002 +#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004 +#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008 +#define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010 +#define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020 + +typedef +EFI_STATUS +(EFIAPI *EFI_OPEN_PROTOCOL) ( + EFI_HANDLE Handle, + EFI_GUID *Protocol, + VOID **Interface, + EFI_HANDLE AgentHandle, + EFI_HANDLE ControllerHandle, + UINT32 Attributes); + +typedef +EFI_STATUS +(EFIAPI *EFI_CLOSE_PROTOCOL) ( + EFI_HANDLE Handle, + EFI_GUID *Protocol, + EFI_HANDLE AgentHandle, + EFI_HANDLE ControllerHandle); + +typedef struct { + EFI_HANDLE AgentHandle; + EFI_HANDLE ControllerHandle; + UINT32 Attributes; + UINT32 OpenCount; +} EFI_OPEN_PROTOCOL_INFORMATION_ENTRY; + +typedef +EFI_STATUS +(EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) ( + EFI_HANDLE Handle, + EFI_GUID *Protocol, + EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer, + UINTN *EntryCount); + +typedef +EFI_STATUS +(EFIAPI *EFI_PROTOCOLS_PER_HANDLE) ( + EFI_HANDLE Handle, + EFI_GUID ***ProtocolBuffer, + UINTN *ProtocolBufferCount); + +typedef +EFI_STATUS +(EFIAPI *EFI_LOCATE_HANDLE_BUFFER) ( + EFI_LOCATE_SEARCH_TYPE SearchType, + EFI_GUID *Protocol, + VOID *SearchKey, + UINTN *NoHandles, + EFI_HANDLE **Buffer); + +typedef +EFI_STATUS +(EFIAPI *EFI_LOCATE_PROTOCOL) ( + EFI_GUID *Protocol, + VOID *Registration, + VOID **Interface); + +typedef +EFI_STATUS +(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) ( + EFI_HANDLE *Handle, + ...); + +typedef +EFI_STATUS +(EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) ( + EFI_HANDLE Handle, + ...); + +typedef +EFI_STATUS +(EFIAPI *EFI_CALCULATE_CRC32) ( + VOID *Data, + UINTN DataSize, + UINT32 *Crc32); + +typedef +VOID +(EFIAPI *EFI_COPY_MEM) ( + VOID *Destination, + VOID *Source, + UINTN Length); + +typedef +VOID +(EFIAPI *EFI_SET_MEM) ( + VOID *Buffer, + UINTN Size, + UINT8 Value); + +/* + * EFI Boot Services Table + */ +#define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42 +#define EFI_BOOT_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION) + +typedef struct _EFI_BOOT_SERVICES { + EFI_TABLE_HEADER Hdr; + +#if 0 + EFI_RAISE_TPL RaiseTPL; + EFI_RESTORE_TPL RestoreTPL; +#else + EFI_UNKNOWN_INTERFACE RaiseTPL; + EFI_UNKNOWN_INTERFACE RestoreTPL; +#endif + + EFI_ALLOCATE_PAGES AllocatePages; + EFI_FREE_PAGES FreePages; + EFI_GET_MEMORY_MAP GetMemoryMap; + EFI_ALLOCATE_POOL AllocatePool; + EFI_FREE_POOL FreePool; + +#if 0 + EFI_CREATE_EVENT CreateEvent; + EFI_SET_TIMER SetTimer; + EFI_WAIT_FOR_EVENT WaitForEvent; + EFI_SIGNAL_EVENT SignalEvent; + EFI_CLOSE_EVENT CloseEvent; + EFI_CHECK_EVENT CheckEvent; +#else + EFI_UNKNOWN_INTERFACE CreateEvent; + EFI_UNKNOWN_INTERFACE SetTimer; + EFI_UNKNOWN_INTERFACE WaitForEvent; + EFI_UNKNOWN_INTERFACE SignalEvent; + EFI_UNKNOWN_INTERFACE CloseEvent; + EFI_UNKNOWN_INTERFACE CheckEvent; +#endif + + EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface; + EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface; + EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface; + EFI_HANDLE_PROTOCOL HandleProtocol; + EFI_HANDLE_PROTOCOL PCHandleProtocol; + EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify; + EFI_LOCATE_HANDLE LocateHandle; + EFI_LOCATE_DEVICE_PATH LocateDevicePath; + EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable; + + EFI_IMAGE_LOAD LoadImage; + EFI_IMAGE_START StartImage; + EFI_EXIT Exit; + EFI_IMAGE_UNLOAD UnloadImage; + +#if 0 + EFI_EXIT_BOOT_SERVICES ExitBootServices; + EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount; + EFI_STALL Stall; + EFI_SET_WATCHDOG_TIMER SetWatchdogTimer; +#else + EFI_UNKNOWN_INTERFACE ExitBootServices; + EFI_UNKNOWN_INTERFACE GetNextMonotonicCount; + EFI_UNKNOWN_INTERFACE Stall; + EFI_UNKNOWN_INTERFACE SetWatchdogTimer; +#endif + +#if 0 + EFI_CONNECT_CONTROLLER ConnectController; + EFI_DISCONNECT_CONTROLLER DisconnectController; +#else + EFI_UNKNOWN_INTERFACE ConnectController; + EFI_UNKNOWN_INTERFACE DisconnectController; +#endif + + EFI_OPEN_PROTOCOL OpenProtocol; + EFI_CLOSE_PROTOCOL CloseProtocol; + EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation; + EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle; + EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer; + EFI_LOCATE_PROTOCOL LocateProtocol; + EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces; + EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces; + + EFI_CALCULATE_CRC32 CalculateCrc32; + + EFI_COPY_MEM CopyMem; + EFI_SET_MEM SetMem; + +#if 0 + EFI_CREATE_EVENT_EX CreateEventEx; +#else + EFI_UNKNOWN_INTERFACE CreateEventEx; +#endif +} EFI_BOOT_SERVICES; + + +/* + * EFI System Table + */ + +/* + * EFI Configuration Table and GUID definitions + */ +#define ACPI_TABLE_GUID \ + { 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } +#define ACPI_20_TABLE_GUID \ + { 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} } + +typedef struct _EFI_CONFIGURATION_TABLE { + EFI_GUID VendorGuid; + VOID *VendorTable; +} EFI_CONFIGURATION_TABLE; + + +#define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249 +#define EFI_SYSTEM_TABLE_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION) + +typedef struct _EFI_SYSTEM_TABLE { + EFI_TABLE_HEADER Hdr; + + CHAR16 *FirmwareVendor; + UINT32 FirmwareRevision; + + EFI_HANDLE ConsoleInHandle; + SIMPLE_INPUT_INTERFACE *ConIn; + + EFI_HANDLE ConsoleOutHandle; + SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut; + + EFI_HANDLE StandardErrorHandle; + SIMPLE_TEXT_OUTPUT_INTERFACE *StdErr; + +#if 0 + EFI_RUNTIME_SERVICES *RuntimeServices; +#else + EFI_HANDLE *RuntimeServices; +#endif + EFI_BOOT_SERVICES *BootServices; + + UINTN NumberOfTableEntries; + EFI_CONFIGURATION_TABLE *ConfigurationTable; + +} EFI_SYSTEM_TABLE; + + +/* GNU EFI definitions */ + +#if defined(_GNU_EFI) + +/* + * This is needed to hide platform specific code from ACPICA + */ +UINT64 +DivU64x32 ( + UINT64 Dividend, + UINTN Divisor, + UINTN *Remainder); + +/* + * EFI specific prototypes + */ +EFI_STATUS +efi_main ( + EFI_HANDLE Image, + EFI_SYSTEM_TABLE *SystemTab); + +int +acpi_main ( + int argc, + char *argv[]); + + +#endif + +extern EFI_GUID AcpiGbl_LoadedImageProtocol; +extern EFI_GUID AcpiGbl_TextInProtocol; +extern EFI_GUID AcpiGbl_TextOutProtocol; +extern EFI_GUID AcpiGbl_FileSystemProtocol; + +#endif /* __ACEFIEX_H__ */ diff --git a/source/include/platform/acenv.h b/source/include/platform/acenv.h index 6d144fc88ef6..768059c160d6 100644 --- a/source/include/platform/acenv.h +++ b/source/include/platform/acenv.h @@ -349,27 +349,49 @@ /* We will be linking to the standard Clib functions */ -#define ACPI_STRSTR(s1,s2) strstr((s1), (s2)) -#define ACPI_STRCHR(s1,c) strchr((s1), (c)) -#define ACPI_STRLEN(s) (ACPI_SIZE) strlen((s)) -#define ACPI_STRCPY(d,s) (void) strcpy((d), (s)) -#define ACPI_STRNCPY(d,s,n) (void) strncpy((d), (s), (ACPI_SIZE)(n)) -#define ACPI_STRNCMP(d,s,n) strncmp((d), (s), (ACPI_SIZE)(n)) -#define ACPI_STRCMP(d,s) strcmp((d), (s)) -#define ACPI_STRCAT(d,s) (void) strcat((d), (s)) -#define ACPI_STRNCAT(d,s,n) strncat((d), (s), (ACPI_SIZE)(n)) -#define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (ACPI_SIZE)(n)) -#define ACPI_MEMCMP(s1,s2,n) memcmp((const char *)(s1), (const char *)(s2), (ACPI_SIZE)(n)) -#define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (ACPI_SIZE)(n)) -#define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (ACPI_SIZE)(n)) -#define ACPI_TOUPPER(i) toupper((int) (i)) -#define ACPI_TOLOWER(i) tolower((int) (i)) -#define ACPI_IS_XDIGIT(i) isxdigit((int) (i)) -#define ACPI_IS_DIGIT(i) isdigit((int) (i)) -#define ACPI_IS_SPACE(i) isspace((int) (i)) -#define ACPI_IS_UPPER(i) isupper((int) (i)) -#define ACPI_IS_PRINT(i) isprint((int) (i)) -#define ACPI_IS_ALPHA(i) isalpha((int) (i)) +#undef strstr +#undef strchr +#undef strlen +#undef strcpy +#undef strncpy +#undef strncmp +#undef strcmp +#undef strcat +#undef strncat +#undef strtoul +#undef memcmp +#undef memcpy +#undef memset +#undef toupper +#undef tolower +#undef isxdigit +#undef isdigit +#undef isspace +#undef isupper +#undef isprint +#undef isalpha + +#define strstr(s1,s2) strstr((s1), (s2)) +#define strchr(s1,c) strchr((s1), (c)) +#define strlen(s) (ACPI_SIZE) strlen((s)) +#define strcpy(d,s) (void) strcpy((d), (s)) +#define strncpy(d,s,n) (void) strncpy((d), (s), (ACPI_SIZE)(n)) +#define strncmp(d,s,n) strncmp((d), (s), (ACPI_SIZE)(n)) +#define strcmp(d,s) strcmp((d), (s)) +#define strcat(d,s) (void) strcat((d), (s)) +#define strncat(d,s,n) strncat((d), (s), (ACPI_SIZE)(n)) +#define strtoul(d,s,n) strtoul((d), (s), (ACPI_SIZE)(n)) +#define memcmp(s1,s2,n) memcmp((const char *)(s1), (const char *)(s2), (ACPI_SIZE)(n)) +#define memcpy(d,s,n) (void) memcpy((d), (s), (ACPI_SIZE)(n)) +#define memset(d,s,n) (void) memset((d), (s), (ACPI_SIZE)(n)) +#define toupper(i) toupper((int) (i)) +#define tolower(i) tolower((int) (i)) +#define isxdigit(i) isxdigit((int) (i)) +#define isdigit(i) isdigit((int) (i)) +#define isspace(i) isspace((int) (i)) +#define isupper(i) isupper((int) (i)) +#define isprint(i) isprint((int) (i)) +#define isalpha(i) isalpha((int) (i)) #else @@ -408,22 +430,6 @@ typedef char *va_list; /* Use the local (ACPICA) definitions of the clib functions */ -#define ACPI_STRSTR(s1,s2) AcpiUtStrstr ((s1), (s2)) -#define ACPI_STRCHR(s1,c) AcpiUtStrchr ((s1), (c)) -#define ACPI_STRLEN(s) (ACPI_SIZE) AcpiUtStrlen ((s)) -#define ACPI_STRCPY(d,s) (void) AcpiUtStrcpy ((d), (s)) -#define ACPI_STRNCPY(d,s,n) (void) AcpiUtStrncpy ((d), (s), (ACPI_SIZE)(n)) -#define ACPI_STRNCMP(d,s,n) AcpiUtStrncmp ((d), (s), (ACPI_SIZE)(n)) -#define ACPI_STRCMP(d,s) AcpiUtStrcmp ((d), (s)) -#define ACPI_STRCAT(d,s) (void) AcpiUtStrcat ((d), (s)) -#define ACPI_STRNCAT(d,s,n) AcpiUtStrncat ((d), (s), (ACPI_SIZE)(n)) -#define ACPI_STRTOUL(d,s,n) AcpiUtStrtoul ((d), (s), (ACPI_SIZE)(n)) -#define ACPI_MEMCMP(s1,s2,n) AcpiUtMemcmp((const char *)(s1), (const char *)(s2), (ACPI_SIZE)(n)) -#define ACPI_MEMCPY(d,s,n) (void) AcpiUtMemcpy ((d), (s), (ACPI_SIZE)(n)) -#define ACPI_MEMSET(d,v,n) (void) AcpiUtMemset ((d), (v), (ACPI_SIZE)(n)) -#define ACPI_TOUPPER(c) AcpiUtToUpper ((int) (c)) -#define ACPI_TOLOWER(c) AcpiUtToLower ((int) (c)) - #endif /* ACPI_USE_SYSTEM_CLIBRARY */ #ifndef ACPI_FILE diff --git a/source/include/platform/acenvex.h b/source/include/platform/acenvex.h index 6e1130e02076..c799fd8adbbe 100644 --- a/source/include/platform/acenvex.h +++ b/source/include/platform/acenvex.h @@ -56,6 +56,12 @@ #if defined(_LINUX) || defined(__linux__) #include "aclinuxex.h" +#elif defined(_AED_EFI) +#include "acefiex.h" + +#elif defined(_GNU_EFI) +#include "acefiex.h" + #elif defined(__DragonFly__) #include "acdragonflyex.h" diff --git a/source/include/platform/acgcc.h b/source/include/platform/acgcc.h index 2a274451faff..472b6d7f8a1a 100644 --- a/source/include/platform/acgcc.h +++ b/source/include/platform/acgcc.h @@ -75,4 +75,8 @@ #undef strchr #endif +/* GCC supports __VA_ARGS__ in macros */ + +#define COMPILER_VA_MACRO 1 + #endif /* __ACGCC_H__ */ diff --git a/source/include/platform/acmsvc.h b/source/include/platform/acmsvc.h index 59e0b2d33e49..da9df8905354 100644 --- a/source/include/platform/acmsvc.h +++ b/source/include/platform/acmsvc.h @@ -44,6 +44,7 @@ #ifndef __ACMSVC_H__ #define __ACMSVC_H__ +/* Note: do not include any C library headers here */ /* * Map low I/O functions for MS. This allows us to disable MS language @@ -152,8 +153,6 @@ #ifdef _DEBUG #define _CRTDBG_MAP_ALLOC /* Enables specific file/lineno for leaks */ -#include -#include #include /* @@ -185,4 +184,9 @@ _CrtSetBreakAlloc (937); #endif +#if _MSC_VER > 1200 /* Versions above VC++ 6 */ +#define COMPILER_VA_MACRO 1 +#else +#endif + #endif /* __ACMSVC_H__ */ diff --git a/source/os_specific/service_layers/osbsdtbl.c b/source/os_specific/service_layers/osbsdtbl.c index 095d70c61c5a..ef69a6af2e45 100644 --- a/source/os_specific/service_layers/osbsdtbl.c +++ b/source/os_specific/service_layers/osbsdtbl.c @@ -171,7 +171,7 @@ AcpiOsGetTableByAddress ( return (AE_NO_MEMORY); } - ACPI_MEMCPY (LocalTable, MappedTable, MappedTable->Length); + memcpy (LocalTable, MappedTable, MappedTable->Length); AcpiOsUnmapMemory (MappedTable, MappedTable->Length); *Table = LocalTable; @@ -405,7 +405,7 @@ OslTableInitialize ( #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) else if (kenv (KENV_GET, SYSTEM_KENV, Buffer, sizeof (Buffer)) > 0) { - Address = ACPI_STRTOUL (Buffer, NULL, 0); + Address = strtoul (Buffer, NULL, 0); } #endif if (!Address) @@ -443,7 +443,7 @@ OslTableInitialize ( return (AE_ERROR); } - ACPI_MEMCPY (&Gbl_Rsdp, TableAddress, sizeof (Gbl_Rsdp)); + memcpy (&Gbl_Rsdp, TableAddress, sizeof (Gbl_Rsdp)); AcpiOsUnmapMemory (RsdpAddress, RsdpSize); /* Get XSDT from memory */ @@ -468,7 +468,7 @@ OslTableInitialize ( return (AE_NO_MEMORY); } - ACPI_MEMCPY (Gbl_Xsdt, MappedTable, MappedTable->Length); + memcpy (Gbl_Xsdt, MappedTable, MappedTable->Length); AcpiOsUnmapMemory (MappedTable, MappedTable->Length); } @@ -493,7 +493,7 @@ OslTableInitialize ( return (AE_NO_MEMORY); } - ACPI_MEMCPY (Gbl_Rsdt, MappedTable, MappedTable->Length); + memcpy (Gbl_Rsdt, MappedTable, MappedTable->Length); AcpiOsUnmapMemory (MappedTable, MappedTable->Length); } @@ -530,7 +530,7 @@ OslTableInitialize ( return (AE_NO_MEMORY); } - ACPI_MEMCPY (Gbl_Fadt, MappedTable, MappedTable->Length); + memcpy (Gbl_Fadt, MappedTable, MappedTable->Length); AcpiOsUnmapMemory (MappedTable, MappedTable->Length); Gbl_MainTableObtained = TRUE; return (AE_OK); @@ -692,7 +692,7 @@ OslGetTableViaRoot ( return (AE_NO_MEMORY); } - ACPI_MEMCPY (LocalTable, MappedTable, MappedTable->Length); + memcpy (LocalTable, MappedTable, MappedTable->Length); AcpiOsUnmapMemory (MappedTable, MappedTable->Length); *Table = LocalTable; *Address = TableAddress; diff --git a/source/os_specific/service_layers/osefitbl.c b/source/os_specific/service_layers/osefitbl.c index da9d4c659110..a1ad9fee5190 100644 --- a/source/os_specific/service_layers/osefitbl.c +++ b/source/os_specific/service_layers/osefitbl.c @@ -185,7 +185,7 @@ AcpiOsGetTableByAddress ( goto Exit; } - ACPI_MEMCPY (LocalTable, MappedTable, TableLength); + memcpy (LocalTable, MappedTable, TableLength); Exit: OslUnmapTable (MappedTable); @@ -456,7 +456,7 @@ OslLoadRsdp ( Gbl_RsdpAddress = RsdpBase + (ACPI_CAST8 (MappedTable) - RsdpAddress); - ACPI_MEMCPY (&Gbl_Rsdp, MappedTable, sizeof (ACPI_TABLE_RSDP)); + memcpy (&Gbl_Rsdp, MappedTable, sizeof (ACPI_TABLE_RSDP)); AcpiOsUnmapMemory (RsdpAddress, RsdpSize); return (AE_OK); @@ -911,7 +911,7 @@ OslGetTable ( goto Exit; } - ACPI_MEMCPY (LocalTable, MappedTable, TableLength); + memcpy (LocalTable, MappedTable, TableLength); *Address = TableAddress; *Table = LocalTable; diff --git a/source/os_specific/service_layers/osefixf.c b/source/os_specific/service_layers/osefixf.c index b9b85c59aaf5..dd7c8d4c5c11 100644 --- a/source/os_specific/service_layers/osefixf.c +++ b/source/os_specific/service_layers/osefixf.c @@ -91,6 +91,10 @@ AcpiEfiFlushFile ( /* Local variables */ static EFI_FILE_HANDLE AcpiGbl_EfiCurrentVolume = NULL; +EFI_GUID AcpiGbl_LoadedImageProtocol = LOADED_IMAGE_PROTOCOL; +EFI_GUID AcpiGbl_TextInProtocol = SIMPLE_TEXT_INPUT_PROTOCOL; +EFI_GUID AcpiGbl_TextOutProtocol = SIMPLE_TEXT_OUTPUT_PROTOCOL; +EFI_GUID AcpiGbl_FileSystemProtocol = SIMPLE_FILE_SYSTEM_PROTOCOL; /****************************************************************************** @@ -331,7 +335,7 @@ AcpiOsAllocateZeroed ( Mem = AcpiOsAllocate (Size); if (Mem) { - ACPI_MEMSET (Mem, 0, Size); + memset (Mem, 0, Size); } return (Mem); @@ -403,7 +407,7 @@ AcpiOsOpenFile ( /* Allocate path buffer */ - Count = ACPI_STRLEN (Path); + Count = strlen (Path); Path16 = ACPI_ALLOCATE_ZEROED ((Count + 1) * sizeof (CHAR16)); if (!Path16) { @@ -816,14 +820,14 @@ AcpiEfiArgify ( while (*String != '\0') { - while (ACPI_IS_SPACE (*String)) + while (isspace (*String)) { *String++ = '\0'; } Arg = CopyBuffer; while (*String != '\0') { - if (ACPI_IS_SPACE (*String) && + if (isspace (*String) && !IsSingleQuote && !IsDoubleQuote && !IsEscape) { *Arg++ = '\0'; @@ -1032,21 +1036,23 @@ efi_main ( EFI_FILE_IO_INTERFACE *Volume = NULL; - /* Initialize EFI library */ + /* Initialize global variables */ - InitializeLib (Image, SystemTab); + ST = SystemTab; + BS = SystemTab->BootServices; /* Retrieve image information */ EfiStatus = uefi_call_wrapper (BS->HandleProtocol, 3, - Image, &LoadedImageProtocol, ACPI_CAST_PTR (VOID, &Info)); + Image, &AcpiGbl_LoadedImageProtocol, ACPI_CAST_PTR (VOID, &Info)); if (EFI_ERROR (EfiStatus)) { AcpiLogError ("EFI_BOOT_SERVICES->HandleProtocol(LoadedImageProtocol) failure.\n"); return (EfiStatus); } + EfiStatus = uefi_call_wrapper (BS->HandleProtocol, 3, - Info->DeviceHandle, &FileSystemProtocol, (void **) &Volume); + Info->DeviceHandle, &AcpiGbl_FileSystemProtocol, (void **) &Volume); if (EFI_ERROR (EfiStatus)) { AcpiLogError ("EFI_BOOT_SERVICES->HandleProtocol(FileSystemProtocol) failure.\n"); diff --git a/source/os_specific/service_layers/oslinuxtbl.c b/source/os_specific/service_layers/oslinuxtbl.c index e090a3c94559..1ba362beb0d0 100644 --- a/source/os_specific/service_layers/oslinuxtbl.c +++ b/source/os_specific/service_layers/oslinuxtbl.c @@ -268,7 +268,7 @@ AcpiOsGetTableByAddress ( goto Exit; } - ACPI_MEMCPY (LocalTable, MappedTable, TableLength); + memcpy (LocalTable, MappedTable, TableLength); Exit: OslUnmapTable (MappedTable); @@ -624,7 +624,7 @@ OslLoadRsdp ( Gbl_RsdpAddress = RsdpBase + (ACPI_CAST8 (MappedTable) - RsdpAddress); - ACPI_MEMCPY (&Gbl_Rsdp, MappedTable, sizeof (ACPI_TABLE_RSDP)); + memcpy (&Gbl_Rsdp, MappedTable, sizeof (ACPI_TABLE_RSDP)); AcpiOsUnmapMemory (RsdpAddress, RsdpSize); return (AE_OK); @@ -686,68 +686,68 @@ OslTableInitialize ( return (AE_OK); } - /* Get RSDP from memory */ - - Status = OslLoadRsdp (); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Get XSDT from memory */ - - if (Gbl_Rsdp.Revision && !Gbl_DoNotDumpXsdt) - { - if (Gbl_Xsdt) - { - free (Gbl_Xsdt); - Gbl_Xsdt = NULL; - } - - Gbl_Revision = 2; - Status = OslGetBiosTable (ACPI_SIG_XSDT, 0, - ACPI_CAST_PTR (ACPI_TABLE_HEADER *, &Gbl_Xsdt), &Address); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - - /* Get RSDT from memory */ - - if (Gbl_Rsdp.RsdtPhysicalAddress) - { - if (Gbl_Rsdt) - { - free (Gbl_Rsdt); - Gbl_Rsdt = NULL; - } - - Status = OslGetBiosTable (ACPI_SIG_RSDT, 0, - ACPI_CAST_PTR (ACPI_TABLE_HEADER *, &Gbl_Rsdt), &Address); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - - /* Get FADT from memory */ - - if (Gbl_Fadt) - { - free (Gbl_Fadt); - Gbl_Fadt = NULL; - } - - Status = OslGetBiosTable (ACPI_SIG_FADT, 0, - ACPI_CAST_PTR (ACPI_TABLE_HEADER *, &Gbl_Fadt), &Gbl_FadtAddress); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - if (!Gbl_DumpCustomizedTables) { + /* Get RSDP from memory */ + + Status = OslLoadRsdp (); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Get XSDT from memory */ + + if (Gbl_Rsdp.Revision && !Gbl_DoNotDumpXsdt) + { + if (Gbl_Xsdt) + { + free (Gbl_Xsdt); + Gbl_Xsdt = NULL; + } + + Gbl_Revision = 2; + Status = OslGetBiosTable (ACPI_SIG_XSDT, 0, + ACPI_CAST_PTR (ACPI_TABLE_HEADER *, &Gbl_Xsdt), &Address); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + } + + /* Get RSDT from memory */ + + if (Gbl_Rsdp.RsdtPhysicalAddress) + { + if (Gbl_Rsdt) + { + free (Gbl_Rsdt); + Gbl_Rsdt = NULL; + } + + Status = OslGetBiosTable (ACPI_SIG_RSDT, 0, + ACPI_CAST_PTR (ACPI_TABLE_HEADER *, &Gbl_Rsdt), &Address); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + } + + /* Get FADT from memory */ + + if (Gbl_Fadt) + { + free (Gbl_Fadt); + Gbl_Fadt = NULL; + } + + Status = OslGetBiosTable (ACPI_SIG_FADT, 0, + ACPI_CAST_PTR (ACPI_TABLE_HEADER *, &Gbl_Fadt), &Gbl_FadtAddress); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + /* Add mandatory tables to global table list first */ Status = OslAddTableToList (ACPI_RSDP_NAME, 0); @@ -1102,7 +1102,7 @@ OslGetBiosTable ( goto Exit; } - ACPI_MEMCPY (LocalTable, MappedTable, TableLength); + memcpy (LocalTable, MappedTable, TableLength); *Address = TableAddress; *Table = LocalTable; diff --git a/source/os_specific/service_layers/osunixmap.c b/source/os_specific/service_layers/osunixmap.c index 95993b2667ad..53737bc23d3d 100644 --- a/source/os_specific/service_layers/osunixmap.c +++ b/source/os_specific/service_layers/osunixmap.c @@ -56,7 +56,7 @@ #define O_BINARY 0 #endif -#ifdef _FreeBSD +#if defined(_DragonFly) || defined(_FreeBSD) #define MMAP_FLAGS MAP_SHARED #else #define MMAP_FLAGS MAP_PRIVATE diff --git a/source/os_specific/service_layers/oswintbl.c b/source/os_specific/service_layers/oswintbl.c index fad2ac781cc3..aebafb960a0c 100644 --- a/source/os_specific/service_layers/oswintbl.c +++ b/source/os_specific/service_layers/oswintbl.c @@ -238,7 +238,7 @@ AcpiOsGetTableByName ( while (1) { - ACPI_STRCPY (KeyBuffer, "HARDWARE\\ACPI\\"); + strcpy (KeyBuffer, "HARDWARE\\ACPI\\"); if (AcpiUtSafeStrcat (KeyBuffer, sizeof (KeyBuffer), Signature)) { return (AE_BUFFER_OVERFLOW); diff --git a/source/tools/acpidump/acpidump.h b/source/tools/acpidump/acpidump.h index c40373459cc8..3dfce10cb9c3 100644 --- a/source/tools/acpidump/acpidump.h +++ b/source/tools/acpidump/acpidump.h @@ -67,7 +67,7 @@ EXTERN BOOLEAN INIT_GLOBAL (Gbl_SummaryMode, FALSE); EXTERN BOOLEAN INIT_GLOBAL (Gbl_VerboseMode, FALSE); EXTERN BOOLEAN INIT_GLOBAL (Gbl_BinaryMode, FALSE); -EXTERN BOOLEAN INIT_GLOBAL (Gbl_DumpCustomizedTables, FALSE); +EXTERN BOOLEAN INIT_GLOBAL (Gbl_DumpCustomizedTables, TRUE); EXTERN BOOLEAN INIT_GLOBAL (Gbl_DoNotDumpXsdt, FALSE); EXTERN ACPI_FILE INIT_GLOBAL (Gbl_OutputFile, NULL); EXTERN char INIT_GLOBAL (*Gbl_OutputFilename, NULL); diff --git a/source/tools/acpidump/apdump.c b/source/tools/acpidump/apdump.c index da4c599ee691..5355de2c5b50 100644 --- a/source/tools/acpidump/apdump.c +++ b/source/tools/acpidump/apdump.c @@ -375,7 +375,7 @@ ApDumpTableByName ( int TableStatus; - if (ACPI_STRLEN (Signature) != ACPI_NAME_SIZE) + if (strlen (Signature) != ACPI_NAME_SIZE) { AcpiLogError ( "Invalid table signature [%s]: must be exactly 4 characters\n", @@ -385,18 +385,18 @@ ApDumpTableByName ( /* Table signatures are expected to be uppercase */ - ACPI_STRCPY (LocalSignature, Signature); + strcpy (LocalSignature, Signature); AcpiUtStrupr (LocalSignature); /* To be friendly, handle tables whose signatures do not match the name */ if (ACPI_COMPARE_NAME (LocalSignature, "FADT")) { - ACPI_STRCPY (LocalSignature, ACPI_SIG_FADT); + strcpy (LocalSignature, ACPI_SIG_FADT); } else if (ACPI_COMPARE_NAME (LocalSignature, "MADT")) { - ACPI_STRCPY (LocalSignature, ACPI_SIG_MADT); + strcpy (LocalSignature, ACPI_SIG_MADT); } /* Dump all instances of this signature (to handle multiple SSDTs) */ diff --git a/source/tools/acpidump/apfiles.c b/source/tools/acpidump/apfiles.c index 1e51ed65bebf..9c187271371b 100644 --- a/source/tools/acpidump/apfiles.c +++ b/source/tools/acpidump/apfiles.c @@ -159,10 +159,10 @@ ApWriteToBinaryFile ( { ACPI_MOVE_NAME (Filename, Table->Signature); } - Filename[0] = (char) ACPI_TOLOWER (Filename[0]); - Filename[1] = (char) ACPI_TOLOWER (Filename[1]); - Filename[2] = (char) ACPI_TOLOWER (Filename[2]); - Filename[3] = (char) ACPI_TOLOWER (Filename[3]); + Filename[0] = (char) tolower (Filename[0]); + Filename[1] = (char) tolower (Filename[1]); + Filename[2] = (char) tolower (Filename[2]); + Filename[3] = (char) tolower (Filename[3]); Filename[ACPI_NAME_SIZE] = 0; /* Handle multiple SSDTs - create different filenames for each */ @@ -170,10 +170,10 @@ ApWriteToBinaryFile ( if (Instance > 0) { AcpiUtSnprintf (InstanceStr, sizeof (InstanceStr), "%u", Instance); - ACPI_STRCAT (Filename, InstanceStr); + strcat (Filename, InstanceStr); } - ACPI_STRCAT (Filename, ACPI_TABLE_FILE_SUFFIX); + strcat (Filename, ACPI_TABLE_FILE_SUFFIX); if (Gbl_VerboseMode) { diff --git a/source/tools/acpidump/apmain.c b/source/tools/acpidump/apmain.c index 682a0d537c7f..efc7a6d0b26a 100644 --- a/source/tools/acpidump/apmain.c +++ b/source/tools/acpidump/apmain.c @@ -92,7 +92,7 @@ UINT32 CurrentAction = 0; #define AP_UTILITY_NAME "ACPI Binary Table Dump Utility" -#define AP_SUPPORTED_OPTIONS "?a:bcf:hn:o:r:svxz" +#define AP_SUPPORTED_OPTIONS "?a:bc:f:hn:o:r:svxz" /****************************************************************************** @@ -111,7 +111,6 @@ ApDisplayUsage ( ACPI_USAGE_HEADER ("acpidump [options]"); ACPI_OPTION ("-b", "Dump tables to binary files"); - ACPI_OPTION ("-c", "Dump customized tables"); ACPI_OPTION ("-h -?", "This help message"); ACPI_OPTION ("-o ", "Redirect output to file"); ACPI_OPTION ("-r
", "Dump tables from specified RSDP"); @@ -122,6 +121,7 @@ ApDisplayUsage ( ACPI_USAGE_TEXT ("\nTable Options:\n"); ACPI_OPTION ("-a
", "Get table via a physical address"); + ACPI_OPTION ("-c ", "Turning on/off customized table dumping"); ACPI_OPTION ("-f ", "Get table via a binary file"); ACPI_OPTION ("-n ", "Get table via a name/signature"); ACPI_OPTION ("-x", "Do not use but dump XSDT"); @@ -205,7 +205,20 @@ ApDoOptions ( case 'c': /* Dump customized tables */ - Gbl_DumpCustomizedTables = TRUE; + if (!strcmp (AcpiGbl_Optarg, "on")) + { + Gbl_DumpCustomizedTables = TRUE; + } + else if (!strcmp (AcpiGbl_Optarg, "off")) + { + Gbl_DumpCustomizedTables = FALSE; + } + else + { + AcpiLogError ("%s: Cannot handle this switch, please use on|off\n", + AcpiGbl_Optarg); + return (-1); + } continue; case 'h': diff --git a/source/tools/acpiexec/aeexec.c b/source/tools/acpiexec/aeexec.c index 7bfbcfaf073e..28ac7afb25f5 100644 --- a/source/tools/acpiexec/aeexec.c +++ b/source/tools/acpiexec/aeexec.c @@ -164,7 +164,7 @@ AfInstallGpeBlock ( return; } - ACPI_MEMSET (&BlockAddress, 0, sizeof (ACPI_GENERIC_ADDRESS)); + memset (&BlockAddress, 0, sizeof (ACPI_GENERIC_ADDRESS)); BlockAddress.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY; BlockAddress.Address = 0x76540000; diff --git a/source/tools/acpiexec/aehandlers.c b/source/tools/acpiexec/aehandlers.c index 17ef9dd084eb..895a27fca7f2 100644 --- a/source/tools/acpiexec/aehandlers.c +++ b/source/tools/acpiexec/aehandlers.c @@ -378,7 +378,7 @@ AeExceptionHandler ( Arg[1].Type = ACPI_TYPE_STRING; Arg[1].String.Pointer = ACPI_CAST_PTR (char, Exception); - Arg[1].String.Length = ACPI_STRLEN (Exception); + Arg[1].String.Length = strlen (Exception); Arg[2].Type = ACPI_TYPE_INTEGER; Arg[2].Integer.Value = AcpiOsGetThreadId(); diff --git a/source/tools/acpiexec/aeinitfile.c b/source/tools/acpiexec/aeinitfile.c index 36463c5e3fbe..d20211b330c4 100644 --- a/source/tools/acpiexec/aeinitfile.c +++ b/source/tools/acpiexec/aeinitfile.c @@ -58,8 +58,9 @@ AeDoOneOverride ( ACPI_WALK_STATE *WalkState); -#define AE_FILE_BUFFER_SIZE 512 +#define AE_FILE_BUFFER_SIZE 512 +static char LineBuffer[AE_FILE_BUFFER_SIZE]; static char NameBuffer[AE_FILE_BUFFER_SIZE]; static char ValueBuffer[AE_FILE_BUFFER_SIZE]; static FILE *InitFile; @@ -127,15 +128,18 @@ AeDoObjectOverrides ( ObjDesc = AcpiUtCreateIntegerObject (0); WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); - NameBuffer[0] = '\\'; - /* Read the entire file line-by-line */ + /* Read the entire file line-by-line */ - while (fscanf (InitFile, "%s %s\n", - ACPI_CAST_PTR (char, &NameBuffer[1]), - ACPI_CAST_PTR (char, &ValueBuffer)) == 2) + while (fgets (LineBuffer, AE_FILE_BUFFER_SIZE, InitFile) != NULL) { + if (sscanf (LineBuffer, "%s %s\n", + &NameBuffer[1], ValueBuffer) != 2) + { + goto CleanupAndExit; + } + /* Add a root prefix if not present in the string */ i = 0; @@ -149,6 +153,7 @@ AeDoObjectOverrides ( /* Cleanup */ +CleanupAndExit: fclose (InitFile); AcpiDsDeleteWalkState (WalkState); AcpiUtRemoveReference (ObjDesc); @@ -200,7 +205,8 @@ AeDoOneOverride ( Status = AcpiUtStrtoul64 (ValueString, 0, &Value); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("%s\n", AcpiFormatException (Status)); + AcpiOsPrintf ("%s %s\n", ValueString, + AcpiFormatException (Status)); return; } diff --git a/source/tools/acpiexec/aeregion.c b/source/tools/acpiexec/aeregion.c index e1a450c3673c..311b6ae61756 100644 --- a/source/tools/acpiexec/aeregion.c +++ b/source/tools/acpiexec/aeregion.c @@ -732,7 +732,7 @@ AeRegionHandler ( /* Initialize the region with the default fill value */ - ACPI_MEMSET (RegionElement->Buffer, + memset (RegionElement->Buffer, AcpiGbl_RegionFillValue, RegionElement->Length); /* @@ -747,7 +747,7 @@ AeRegionHandler ( * Copy the old buffer to its same location within the new * buffer */ - ACPI_MEMCPY (BufferValue, OldBuffer, RegionLength); + memcpy (BufferValue, OldBuffer, RegionLength); AcpiOsFree (OldBuffer); } } @@ -776,7 +776,7 @@ AeRegionHandler ( /* Initialize the region with the default fill value */ - ACPI_MEMSET (RegionElement->Buffer, AcpiGbl_RegionFillValue, Length); + memset (RegionElement->Buffer, AcpiGbl_RegionFillValue, Length); RegionElement->Address = BaseAddress; RegionElement->Length = Length; @@ -843,14 +843,14 @@ AeRegionHandler ( /* * Set the pointer Value to whatever is in the buffer */ - ACPI_MEMCPY (Value, BufferValue, ByteWidth); + memcpy (Value, BufferValue, ByteWidth); break; case ACPI_WRITE: /* * Write the contents of Value to the buffer */ - ACPI_MEMCPY (BufferValue, Value, ByteWidth); + memcpy (BufferValue, Value, ByteWidth); break; default: diff --git a/source/tools/acpiexec/aetables.c b/source/tools/acpiexec/aetables.c index 88726a23920a..14452db5eda8 100644 --- a/source/tools/acpiexec/aetables.c +++ b/source/tools/acpiexec/aetables.c @@ -152,9 +152,9 @@ AeInitializeTableHeader ( Header->Length = Length; Header->OemRevision = 0x1001; - ACPI_STRNCPY (Header->OemId, "Intel", ACPI_OEM_ID_SIZE); - ACPI_STRNCPY (Header->OemTableId, "AcpiExec", ACPI_OEM_TABLE_ID_SIZE); - ACPI_STRNCPY (Header->AslCompilerId, "INTL", ACPI_NAME_SIZE); + strncpy (Header->OemId, "Intel", ACPI_OEM_ID_SIZE); + strncpy (Header->OemTableId, "AcpiExec", ACPI_OEM_TABLE_ID_SIZE); + strncpy (Header->AslCompilerId, "INTL", ACPI_NAME_SIZE); Header->AslCompilerRevision = 0x20131218; } @@ -215,7 +215,7 @@ AeBuildLocalTables ( return (AE_NO_MEMORY); } - ACPI_MEMSET (LocalXSDT, 0, XsdtSize); + memset (LocalXSDT, 0, XsdtSize); AeInitializeTableHeader ((void *) LocalXSDT, ACPI_SIG_XSDT, XsdtSize); LocalXSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (&LocalFADT); @@ -297,9 +297,9 @@ AeBuildLocalTables ( /* Build an RSDP. Contains a valid XSDT only, no RSDT */ - ACPI_MEMSET (&LocalRSDP, 0, sizeof (ACPI_TABLE_RSDP)); + memset (&LocalRSDP, 0, sizeof (ACPI_TABLE_RSDP)); ACPI_MAKE_RSDP_SIG (LocalRSDP.Signature); - ACPI_MEMCPY (LocalRSDP.OemId, "Intel", 6); + memcpy (LocalRSDP.OemId, "Intel", 6); LocalRSDP.Revision = 2; LocalRSDP.XsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR (LocalXSDT); @@ -361,7 +361,7 @@ AeBuildLocalTables ( } else if (AcpiGbl_UseHwReducedFadt) { - ACPI_MEMCPY (&LocalFADT, HwReducedFadtCode, sizeof (ACPI_TABLE_FADT)); + memcpy (&LocalFADT, HwReducedFadtCode, sizeof (ACPI_TABLE_FADT)); LocalFADT.Dsdt = (UINT32) DsdtAddress; LocalFADT.XDsdt = DsdtAddress; @@ -374,7 +374,7 @@ AeBuildLocalTables ( /* * Build a local FADT so we can test the hardware/event init */ - ACPI_MEMSET (&LocalFADT, 0, sizeof (ACPI_TABLE_FADT)); + memset (&LocalFADT, 0, sizeof (ACPI_TABLE_FADT)); LocalFADT.Header.Revision = 5; AeInitializeTableHeader ((void *) &LocalFADT, ACPI_SIG_FADT, sizeof (ACPI_TABLE_FADT)); @@ -423,7 +423,7 @@ AeBuildLocalTables ( /* Build a FACS */ - ACPI_MEMSET (&LocalFACS, 0, sizeof (ACPI_TABLE_FACS)); + memset (&LocalFACS, 0, sizeof (ACPI_TABLE_FACS)); ACPI_MOVE_NAME (LocalFACS.Signature, ACPI_SIG_FACS); LocalFACS.Length = sizeof (ACPI_TABLE_FACS); @@ -437,7 +437,7 @@ AeBuildLocalTables ( * Build a fake table [TEST] so that we make sure that the * ACPICA core ignores it */ - ACPI_MEMSET (&LocalTEST, 0, sizeof (ACPI_TABLE_HEADER)); + memset (&LocalTEST, 0, sizeof (ACPI_TABLE_HEADER)); ACPI_MOVE_NAME (LocalTEST.Signature, "TEST"); LocalTEST.Revision = 1; @@ -449,7 +449,7 @@ AeBuildLocalTables ( * Build a fake table with a bad signature [BAD!] so that we make * sure that the ACPICA core ignores it */ - ACPI_MEMSET (&LocalBADTABLE, 0, sizeof (ACPI_TABLE_HEADER)); + memset (&LocalBADTABLE, 0, sizeof (ACPI_TABLE_HEADER)); ACPI_MOVE_NAME (LocalBADTABLE.Signature, "BAD!"); LocalBADTABLE.Revision = 1; diff --git a/source/tools/acpihelp/ahamlops.c b/source/tools/acpihelp/ahamlops.c index 8d54887f7275..1fc4c3320657 100644 --- a/source/tools/acpihelp/ahamlops.c +++ b/source/tools/acpihelp/ahamlops.c @@ -85,7 +85,9 @@ const AH_AML_OPCODE AmlOpcodeInfo[] = "DefVarPackage := VarPackageOp PkgLength VarNumElements PackageElementList"}, {0x14, 0x14, "0x14", "MethodOp", "TermObject", "NameString ByteData", "TermList", "DefMethod := MethodOp PkgLength NameString MethodFlags TermList"}, - {0x15, 0x2D, "0x15-0x2D", NULL, NULL, NULL, NULL, + {0x15, 0x15, "0x15", "ExternalOp", "NameObject", "NameString ByteData ByteData", NULL, + "DefExternal := ExternalOp NameString ObjectType ArgumentCount"}, + {0x16, 0x2D, "0x16-0x2D", NULL, NULL, NULL, NULL, NULL}, {0x2E, 0x2E, "0x2E", "DualNamePrefix", "NameObject", "NameSeg NameSeg", NULL, "DualNamePath := DualNamePrefix NameSeg NameSeg"}, diff --git a/source/tools/acpihelp/ahdecode.c b/source/tools/acpihelp/ahdecode.c index cd841c3037f1..95ea29ebf1c0 100644 --- a/source/tools/acpihelp/ahdecode.c +++ b/source/tools/acpihelp/ahdecode.c @@ -397,7 +397,7 @@ AhDecodeAmlOpcode ( return; } - Opcode = ACPI_STRTOUL (OpcodeString, NULL, 16); + Opcode = strtoul (OpcodeString, NULL, 16); if (Opcode > ACPI_UINT16_MAX) { printf ("Invalid opcode (more than 16 bits)\n"); @@ -1025,7 +1025,7 @@ AhDecodeException ( /* Decode a single user-supplied exception code */ - Status = ACPI_STRTOUL (HexString, NULL, 16); + Status = strtoul (HexString, NULL, 16); if (!Status) { printf ("%s: Invalid hexadecimal exception code value\n", HexString); diff --git a/source/tools/acpinames/antables.c b/source/tools/acpinames/antables.c index 59922fe1760e..9646ba4974f7 100644 --- a/source/tools/acpinames/antables.c +++ b/source/tools/acpinames/antables.c @@ -124,7 +124,7 @@ AeBuildLocalTables ( return (AE_NO_MEMORY); } - ACPI_MEMSET (LocalXSDT, 0, XsdtSize); + memset (LocalXSDT, 0, XsdtSize); ACPI_MOVE_NAME (LocalXSDT->Header.Signature, ACPI_SIG_XSDT); LocalXSDT->Header.Length = XsdtSize; LocalXSDT->Header.Revision = 1; @@ -173,9 +173,9 @@ AeBuildLocalTables ( /* Build an RSDP */ - ACPI_MEMSET (&LocalRSDP, 0, sizeof (ACPI_TABLE_RSDP)); + memset (&LocalRSDP, 0, sizeof (ACPI_TABLE_RSDP)); ACPI_MAKE_RSDP_SIG (LocalRSDP.Signature); - ACPI_MEMCPY (LocalRSDP.OemId, "I_TEST", 6); + memcpy (LocalRSDP.OemId, "I_TEST", 6); LocalRSDP.Revision = 2; LocalRSDP.XsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR (LocalXSDT); LocalRSDP.Length = sizeof (ACPI_TABLE_XSDT); @@ -217,7 +217,7 @@ AeBuildLocalTables ( /* * Build a local FADT so we can test the hardware/event init */ - ACPI_MEMSET (&LocalFADT, 0, sizeof (ACPI_TABLE_FADT)); + memset (&LocalFADT, 0, sizeof (ACPI_TABLE_FADT)); ACPI_MOVE_NAME (LocalFADT.Header.Signature, ACPI_SIG_FADT); /* Setup FADT header and DSDT/FACS addresses */ @@ -268,7 +268,7 @@ AeBuildLocalTables ( /* Build a FACS */ - ACPI_MEMSET (&LocalFACS, 0, sizeof (ACPI_TABLE_FACS)); + memset (&LocalFACS, 0, sizeof (ACPI_TABLE_FACS)); ACPI_MOVE_NAME (LocalFACS.Signature, ACPI_SIG_FACS); LocalFACS.Length = sizeof (ACPI_TABLE_FACS); diff --git a/source/tools/acpisrc/acpisrc.h b/source/tools/acpisrc/acpisrc.h index 1eb21aa39a84..d5dc9f81d31e 100644 --- a/source/tools/acpisrc/acpisrc.h +++ b/source/tools/acpisrc/acpisrc.h @@ -260,11 +260,6 @@ AsRemoveLine ( char *Buffer, char *Keyword); -void -AsRemoveMacro ( - char *Buffer, - char *Keyword); - void AsCheckForBraces ( char *Buffer, diff --git a/source/tools/acpisrc/asconvrt.c b/source/tools/acpisrc/asconvrt.c index fca19b81fd0f..5b0f5f461596 100644 --- a/source/tools/acpisrc/asconvrt.c +++ b/source/tools/acpisrc/asconvrt.c @@ -272,8 +272,8 @@ AsMatchValidToken ( if ((*SubBuffer == '\n') || (!(*SubBuffer))) { - AsPrint ("Unbalanced quoted string", 1, Filename); - printf (" %.32s\n", StringStart); + AsPrint ("Unbalanced quoted string",1, Filename); + printf (" %.32s (line %u)\n", StringStart, TotalLines); break; } diff --git a/source/tools/acpisrc/asfile.c b/source/tools/acpisrc/asfile.c index 9c4ea7aabc55..1e686cff1a71 100644 --- a/source/tools/acpisrc/asfile.c +++ b/source/tools/acpisrc/asfile.c @@ -306,7 +306,6 @@ AsConvertFile ( ACPI_STRING_TABLE *StringTable; ACPI_IDENTIFIER_TABLE *ConditionalTable; ACPI_IDENTIFIER_TABLE *LineTable; - ACPI_IDENTIFIER_TABLE *MacroTable; ACPI_TYPED_IDENTIFIER_TABLE *StructTable; ACPI_IDENTIFIER_TABLE *SpecialMacroTable; @@ -319,7 +318,6 @@ AsConvertFile ( StringTable = ConversionTable->SourceStringTable; LineTable = ConversionTable->SourceLineTable; ConditionalTable = ConversionTable->SourceConditionalTable; - MacroTable = ConversionTable->SourceMacroTable; StructTable = ConversionTable->SourceStructTable; SpecialMacroTable = ConversionTable->SourceSpecialMacroTable; break; @@ -330,7 +328,6 @@ AsConvertFile ( StringTable = ConversionTable->HeaderStringTable; LineTable = ConversionTable->HeaderLineTable; ConditionalTable = ConversionTable->HeaderConditionalTable; - MacroTable = ConversionTable->HeaderMacroTable; StructTable = ConversionTable->HeaderStructTable; SpecialMacroTable = ConversionTable->HeaderSpecialMacroTable; break; @@ -341,7 +338,6 @@ AsConvertFile ( StringTable = ConversionTable->PatchStringTable; LineTable = ConversionTable->PatchLineTable; ConditionalTable = ConversionTable->PatchConditionalTable; - MacroTable = ConversionTable->PatchMacroTable; StructTable = ConversionTable->PatchStructTable; SpecialMacroTable = ConversionTable->PatchSpecialMacroTable; break; @@ -400,6 +396,7 @@ AsConvertFile ( } } +#ifdef _OBSOLETE_FUNCTIONS if (MacroTable) { for (i = 0; MacroTable[i].Identifier; i++) @@ -407,6 +404,7 @@ AsConvertFile ( AsRemoveMacro (FileBuffer, MacroTable[i].Identifier); } } +#endif if (StructTable) { diff --git a/source/tools/acpisrc/asremove.c b/source/tools/acpisrc/asremove.c index 28299a432328..9a4e57c2fae0 100644 --- a/source/tools/acpisrc/asremove.c +++ b/source/tools/acpisrc/asremove.c @@ -299,6 +299,7 @@ AsRemoveConditionalCompile ( } +#ifdef _OBSOLETE_FUNCTIONS /****************************************************************************** * * FUNCTION: AsRemoveMacro @@ -308,6 +309,11 @@ AsRemoveConditionalCompile ( * ******************************************************************************/ +NOTE: This function is no longer used and is commented out for now. + +Also, it appears to have one or more bugs in it. It can incorrectly remove +lines of code, producing some garbage. + void AsRemoveMacro ( char *Buffer, @@ -368,7 +374,7 @@ AsRemoveMacro ( } } } - +#endif /****************************************************************************** * diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c index 073971fb25f1..a10681ef0915 100644 --- a/source/tools/acpisrc/astable.c +++ b/source/tools/acpisrc/astable.c @@ -720,14 +720,6 @@ ACPI_IDENTIFIER_TABLE LinuxAddStruct[] = { }; -ACPI_IDENTIFIER_TABLE LinuxEliminateMacros[] = { - - {"ACPI_GET_ADDRESS"}, - {"ACPI_VALID_ADDRESS"}, - {NULL} -}; - - ACPI_IDENTIFIER_TABLE LinuxEliminateLines_C[] = { {"#define __"}, @@ -809,7 +801,7 @@ ACPI_CONVERSION_TABLE LinuxConversionTable = { LinuxDataTypes, LinuxEliminateLines_C, NULL, - LinuxEliminateMacros, + NULL, AcpiIdentifiers, NULL, (CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES | diff --git a/source/tools/acpisrc/asutils.c b/source/tools/acpisrc/asutils.c index f4ce703fe74f..03a45b910079 100644 --- a/source/tools/acpisrc/asutils.c +++ b/source/tools/acpisrc/asutils.c @@ -72,7 +72,7 @@ AsStrlwr ( { for (String = SrcString; *String; String++) { - *String = (char) ACPI_TOLOWER (*String); + *String = (char) tolower (*String); } } }