From 3dfcdeaf265fb8497d13e1d705d81c4c99466426 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Jun 30 2015 01:03:56 +0000 Subject: Imported Upstream version 20150619 --- diff --git a/changes.txt b/changes.txt index 511652f..9abe735 100755 --- a/changes.txt +++ b/changes.txt @@ -1,5 +1,130 @@ ---------------------------------------- -08 April 2015. Summary of changes for version 20150515: +19 June 2015. Summary of changes for version 20150619: + +Two regressions in version 20150616 have been addressed: + +Fixes some problems/issues with the C library macro removal (ACPI_STRLEN, +etc.) This update changes ACPICA to only use the standard headers for +functions, or the prototypes for the local versions of the C library +functions. Across the source code, this required some additional casts +for some Clib invocations for portability. Moved all local prototypes to +a new file, acclib.h + +Fixes several problems with recent changes to the handling of the FACS +table that could cause some systems not to boot. + + +---------------------------------------- +16 June 2015. Summary of changes for version 20150616: + + +1) ACPICA kernel-resident subsystem: + +Across the entire ACPICA source code base, the various macros for the C +library functions (such as ACPI_STRLEN, etc.) have been removed and +replaced by the standard C library names (strlen, etc.) The original +purpose for these macros is no longer applicable. This simplification +reduces the number of macros used in the ACPICA source code +significantly, improving readability and maintainability. + +Implemented support for a new ACPI table, the OSDT. This table, the +"override" SDT, can be loaded directly by the host OS at boot time. It +enables the replacement of existing namespace objects that were installed +via the DSDT and/or SSDTs. The primary purpose for this is to replace +buggy or incorrect ASL/AML code obtained via the BIOS. The OSDT is slated +for inclusion in a future version of the ACPI Specification. Lv Zheng/Bob +Moore. + +Added support for systems with (improperly) two FACS tables -- a "32-bit" +table (via FADT 32-bit legacy field) and a "64-bit" table (via the 64-bit +X field). This change will support both automatically. There continues to +be systems found with this issue. This support requires a change to the +AcpiSetFirmwareWakingVector interface. Also, a public global variable has +been added to allow the host to select which FACS is desired +(AcpiGbl_Use32BitFacsAddresses). See the ACPICA reference for more +details Lv Zheng. + +Added a new feature to allow for systems that do not contain an FACS. +Although this is already supported on hardware-reduced platforms, the +feature has been extended for all platforms. The reasoning is that we do +not want to abort the entire ACPICA initialization just because the +system is seriously buggy and has no FACS. + +Fixed a problem where the GUID strings for NFIT tables (in acuuid.h) were +not correctly transcribed from the ACPI specification in ACPICA version +20150515. + +Implemented support for the _CLS object in the AcpiGetObjectInfo external +interface. + +Updated the definitions of the TCPA and TPM2 ACPI tables to the more +recent TCG ACPI Specification, December 14, 2014. Table disassembler and +compiler also updated. Note: The TCPA "server" table is not supported by +the disassembler/table-compiler at this time. + +ACPI 6.0: Added definitions for the new GIC version field in the MADT. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. + + Current Release: + Non-Debug Version: 100.6K Code, 27.6K Data, 128.2K Total + Debug Version: 196.2K Code, 81.0K Data, 277.2K Total + Previous Release: + Non-Debug Version: 99.9K Code, 27.5K Data, 127.4K Total + Debug Version: 195.2K Code, 80.8K Data, 276.0K Total + + +2) iASL Compiler/Disassembler and Tools: + +Disassembler: Fixed a problem with the new symbolic operator disassembler +where incorrect ASL code could be emitted in some cases for the "non- +commutative" operators -- Subtract, Divide, Modulo, ShiftLeft, and +ShiftRight. The actual problem cases seem to be rather unusual in common +ASL code, however. David Box. + +Modified the linux version of acpidump to obtain ACPI tables from not +just /dev/mem (which may not exist) and /sys/firmware/acpi/tables. Lv +Zheng. + +iASL: Fixed a problem where the user preprocessor output file (.i) +contained extra data that was not expected. The compiler was using this +file as a temporary file and passed through #line directives in order to +keep compiler error messages in sync with the input file and line number +across multiple include files. The (.i) is no longer a temporary file as +the compiler uses a new, different file for the original purpose. + +iASL: Fixed a problem where comments within the original ASL source code +file were not passed through to the preprocessor output file, nor any +listing files. + +iASL: Fixed some issues for the handling of the "#include" preprocessor +directive and the similar (but not the same) "Include" ASL operator. + +iASL: Add support for the new OSDT in both the disassembler and compiler. + +iASL: Fixed a problem with the constant folding support where a Buffer +object could be incorrectly generated (incorrectly formed) during a +conversion to a Store() operator. + +AcpiHelp: Updated for new NFIT GUIDs, "External" AML opcode, and new +description text for the _REV predefined name. _REV now permanently +returns 2, as per the ACPI 6.0 specification. + +Debugger: Enhanced the output of the Debug ASL object for references +produced by the Index operator. For Buffers and strings, only output the +actual byte pointed to by the index. For packages, only print the single +package element decoded by the index. Previously, the entire +buffer/string/package was emitted. + +iASL/Table-compiler: Fixed a regression where the "generic" data types +were no longer recognized, causing errors. + + +---------------------------------------- +15 May 2015. Summary of changes for version 20150515: This release implements most of ACPI 6.0 as described below. @@ -34,7 +159,7 @@ iASL disassembler and table compiler: Added ACPI 6.0 changes to existing tables: FADT, MADT. iASL preprocessor: Added a new directive to enable inclusion of binary -blobs into ASL code. The new directive is #includebinary. It takes a +blobs into ASL code. The new directive is #includebuffer. It takes a binary file as input and emits a named ascii buffer object into the ASL code. diff --git a/source/common/adisasm.c b/source/common/adisasm.c index a092923..1fe6e06 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 f2f1786..0c0fc41 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 e728c64..8518249 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 929e3d6..d48ea40 100644 --- a/source/common/ahuuids.c +++ b/source/common/ahuuids.c @@ -43,6 +43,7 @@ #include "acpi.h" #include "accommon.h" +#include "acuuid.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("ahuuids") @@ -52,44 +53,36 @@ */ const AH_UUID AcpiUuids[] = { - {"PCI Host Bridge Device", - "33db4d5b-1ff7-401c-9657-7441c03dd766"}, - - {"Platform-wide Capabilities", - "0811b06e-4a27-44f9-8d60-3cbbc22e7b48"}, - - {"Dynamic Enumeration", - "d8c1a3a6-be9b-4c9b-91bf-c3cb81fc5daf"}, - - {"GPIO Controller", - "4f248f40-d5e2-499f-834c-27758ea1cd3f"}, - - {"Battery Thermal Limit", - "4c2067e3-887d-475c-9720-4af1d3ed602e"}, - - {"Thermal Extensions", - "14d399cd-7a27-4b18-8fb4-7cb7b9f4e500"}, - - {"USB Controller", - "ce2ee385-00e6-48cb-9f05-2edb927c4899"}, - - {"HID I2C Device", - "3cdff6f7-4267-4555-ad05-b30a3d8938de"}, - - {"Power Button Device", - "dfbcf3c5-e7a5-44e6-9c1f-29c76f6e059c"}, - - {"Device Labeling Interface", - "e5c937d0-3553-4d7a-9117-ea4d19c3434d"}, - - {"SATA Controller", - "e4db149b-fcfe-425b-a6d8-92357d78fc7f"}, - - {"Physical Presence Interface", - "3dddfaa6-361b-4eb4-a424-8d10089d1653"}, - - {"Device Properties for _DSD", - "daffd814-6eba-4d8c-8a91-bc9bbf4aa301"}, + {"[Controllers]", NULL}, + {"GPIO Controller", UUID_GPIO_CONTROLLER}, + {"USB Controller", UUID_USB_CONTROLLER}, + {"SATA Controller", UUID_SATA_CONTROLLER}, + + {"[Devices]", NULL}, + {"PCI Host Bridge Device", UUID_PCI_HOST_BRIDGE}, + {"HID I2C Device", UUID_I2C_DEVICE}, + {"Power Button Device", UUID_POWER_BUTTON}, + + {"[Interfaces]", NULL}, + {"Device Labeling Interface", UUID_DEVICE_LABELING}, + {"Physical Presence Interface", UUID_PHYSICAL_PRESENCE}, + + {"[Non-volatile DIMM and NFIT table]", NULL}, + {"Volatile Memory Region", UUID_VOLATILE_MEMORY}, + {"Persistent Memory Region", UUID_PERSISTENT_MEMORY}, + {"NVDIMM Control Region", UUID_CONTROL_REGION}, + {"NVDIMM Data Region", UUID_DATA_REGION}, + {"Volatile Virtual Disk", UUID_VOLATILE_VIRTUAL_DISK}, + {"Volatile Virtual CD", UUID_VOLATILE_VIRTUAL_CD}, + {"Persistent Virtual Disk", UUID_PERSISTENT_VIRTUAL_DISK}, + {"Persistent Virtual CD", UUID_PERSISTENT_VIRTUAL_CD}, + + {"[Miscellaneous]", NULL}, + {"Platform-wide Capabilities", UUID_PLATFORM_CAPABILITIES}, + {"Dynamic Enumeration", UUID_DYNAMIC_ENUMERATION}, + {"Battery Thermal Limit", UUID_BATTERY_THERMAL_LIMIT}, + {"Thermal Extensions", UUID_THERMAL_EXTENSIONS}, + {"Device Properties for _DSD", UUID_DEVICE_PROPERTIES}, {NULL, NULL} }; @@ -120,9 +113,16 @@ AcpiAhMatchUuid ( for (Info = AcpiUuids; Info->Description; Info++) { + /* Null string means desciption is a UUID class */ + + if (!Info->String) + { + continue; + } + 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 a24ce0b..30beba3 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 689240a..c10c364 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 125bd18..91fd6be 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 af69f56..4711b68 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 446e984..50a1ee0 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 276a83c..df06972 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 705cccf..45c4431 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 90abef2..7ff1c4a 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 38bf9cf..dc8b7d5 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 47f92b4..afc004d 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 0156961..dfe80c1 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 9da55bd..e0b2423 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 ((int) *AslCompilertext)) { sprintf (MsgBuffer, "Invalid character (%c), expecting ASL keyword or name", diff --git a/source/compiler/asldefine.h b/source/compiler/asldefine.h index 0697276..0b5f614 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 75c6d75..4f430d1 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 c7d398d..4db97a6 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 947e465..2ad62ec 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, DT_ALLOW_MULTILINE_QUOTES) != ASL_EOF) { if (Gbl_CurrentLineBuffer[0] == '#') { @@ -336,7 +344,7 @@ FlOpenIncludeWithPrefix ( Op, "use #include instead"); } } -#endif + Gbl_CurrentLineNumber = OriginalLineNumber; /* Must seek back to the start of the file */ @@ -579,8 +587,6 @@ FlOpenMiscOutputFiles ( /* Open the debug file as STDERR, text mode */ - /* TBD: hide this behind a FlReopenFile function */ - Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Filename = Filename; Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle = freopen (Filename, "w+t", stderr); @@ -588,13 +594,15 @@ FlOpenMiscOutputFiles ( if (!Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle) { /* - * A problem with freopen is that on error, - * we no longer have stderr. + * A problem with freopen is that on error, we no longer + * have stderr and cannot emit normal error messages. + * Emit error to stdout, close files, and exit. */ - Gbl_DebugFlag = FALSE; - memcpy (stderr, stdout, sizeof (FILE)); - FlFileError (ASL_FILE_DEBUG_OUTPUT, ASL_MSG_DEBUG_FILENAME); - AslAbort (); + fprintf (stdout, + "\nCould not open debug output file: %s\n\n", Filename); + + CmCleanupAndExit (); + exit (1); } AslCompilerSignon (ASL_FILE_DEBUG_OUTPUT); @@ -621,7 +629,7 @@ FlOpenMiscOutputFiles ( AslCompilerFileHeader (ASL_FILE_LISTING_OUTPUT); } - /* Create the preprocessor output file if preprocessor enabled */ + /* Create the preprocessor output temp file if preprocessor enabled */ if (Gbl_PreprocessFlag) { @@ -636,6 +644,23 @@ FlOpenMiscOutputFiles ( FlOpenFile (ASL_FILE_PREPROCESSOR, Filename, "w+t"); } + /* + * Create the "user" preprocessor output file if -li flag set. + * Note, this file contains no embedded #line directives. + */ + if (Gbl_PreprocessorOutputFlag) + { + Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_PREPROC_USER); + if (!Filename) + { + AslCommonError (ASL_ERROR, ASL_MSG_PREPROCESSOR_FILENAME, + 0, 0, 0, 0, NULL, NULL); + return (AE_ERROR); + } + + FlOpenFile (ASL_FILE_PREPROCESSOR_USER, Filename, "w+t"); + } + /* All done for data table compiler */ if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_DATA) diff --git a/source/compiler/aslfold.c b/source/compiler/aslfold.c index 8c11860..0b3ef8d 100644 --- a/source/compiler/aslfold.c +++ b/source/compiler/aslfold.c @@ -236,6 +236,8 @@ OpcAmlCheckForConstant ( */ if (WalkState->Opcode == AML_BUFFER_OP) { + DbgPrint (ASL_PARSE_OUTPUT, + "\nBuffer+Buffer->Buffer constant reduction is not supported yet"); Status = AE_TYPE; goto CleanupAndExit; } @@ -380,10 +382,12 @@ TrSimpleConstantReduction ( return (Status); } + /* Disconnect any existing children, install new constant */ + + Op->Asl.Child = NULL; TrInstallReducedConstant (Op, ObjDesc); UtSetParseOpName (Op); - Op->Asl.Child = NULL; return (AE_OK); } @@ -494,6 +498,10 @@ TrTransformToStoreOp ( goto EvalError; } + /* Truncate any subtree expressions, they have been evaluated */ + + Child1->Asl.Child = NULL; + /* Folded constant is in ObjDesc, store into Child1 */ TrInstallReducedConstant (Child1, ObjDesc); @@ -505,11 +513,6 @@ TrTransformToStoreOp ( UtSetParseOpName (Op); Op->Common.Parent = OriginalParent; - /* Truncate any subtree expressions, they have been evaluated */ - - Child1->Asl.Child = NULL; - Child2->Asl.Child = NULL; - /* First child is the folded constant */ /* Second child will be the target */ @@ -547,7 +550,8 @@ TrInstallReducedConstant ( ACPI_PARSE_OBJECT *Op, ACPI_OPERAND_OBJECT *ObjDesc) { - ACPI_PARSE_OBJECT *RootOp; + ACPI_PARSE_OBJECT *LengthOp; + ACPI_PARSE_OBJECT *DataOp; TotalFolds++; @@ -574,17 +578,22 @@ TrInstallReducedConstant ( Op->Asl.ParseOpcode = PARSEOP_STRING_LITERAL; Op->Common.AmlOpcode = AML_STRING_OP; - Op->Asl.AmlLength = ACPI_STRLEN (ObjDesc->String.Pointer) + 1; + Op->Asl.AmlLength = strlen (ObjDesc->String.Pointer) + 1; Op->Common.Value.String = ObjDesc->String.Pointer; DbgPrint (ASL_PARSE_OUTPUT, "Constant expression reduced to (STRING) %s\n\n", Op->Common.Value.String); - break; case ACPI_TYPE_BUFFER: - + /* + * Create a new parse subtree of the form: + * + * BUFFER (Buffer AML opcode) + * INTEGER (Buffer length in bytes) + * RAW_DATA (Buffer byte data) + */ Op->Asl.ParseOpcode = PARSEOP_BUFFER; Op->Common.AmlOpcode = AML_BUFFER_OP; Op->Asl.CompileFlags = NODE_AML_PACKAGE; @@ -592,28 +601,24 @@ TrInstallReducedConstant ( /* Child node is the buffer length */ - RootOp = TrAllocateNode (PARSEOP_INTEGER); + LengthOp = TrAllocateNode (PARSEOP_INTEGER); - RootOp->Asl.AmlOpcode = AML_DWORD_OP; - RootOp->Asl.Value.Integer = ObjDesc->Buffer.Length; - RootOp->Asl.Parent = Op; + LengthOp->Asl.AmlOpcode = AML_DWORD_OP; + LengthOp->Asl.Value.Integer = ObjDesc->Buffer.Length; + LengthOp->Asl.Parent = Op; + (void) OpcSetOptimalIntegerSize (LengthOp); - (void) OpcSetOptimalIntegerSize (RootOp); - - Op->Asl.Child = RootOp; - Op = RootOp; - UtSetParseOpName (Op); + Op->Asl.Child = LengthOp; - /* Peer to the child is the raw buffer data */ + /* Next child is the raw buffer data */ - 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; + 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; - 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 c61b8ff..0696b67 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 447b8cb..bbb9076 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 652871d..8ab3e62 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 c8d8c68..07ed89a 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 6ed0f62..6d53cec 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 0a22b79..fa3d1fc 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 2670670..174a53a 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 77b185e..7770f3e 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 51aae7a..57bb12b 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 9acc94b..fc32d0f 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 7cee85c..1ec9a35 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 b3149cf..0016626 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 4bd24da..343c364 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 6b94d28..8b77c8e 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 46cb526..86ca83a 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 8279055..58e749f 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/dtcompiler.h b/source/compiler/dtcompiler.h index 765e61c..44fc56d 100644 --- a/source/compiler/dtcompiler.h +++ b/source/compiler/dtcompiler.h @@ -181,7 +181,13 @@ DtCompilePadding ( UINT32 DtGetNextLine ( - FILE *Handle); + FILE *Handle, + UINT32 Flags); + +/* Flags for DtGetNextLine */ + +#define DT_ALLOW_MULTILINE_QUOTES 0x01 + DT_FIELD * DtScanFile ( diff --git a/source/compiler/dtexpress.c b/source/compiler/dtexpress.c index bf92795..97d0115 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 4a6f1bb..f083f05 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 a42ca2d..41b46b5 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); @@ -406,7 +406,8 @@ DtParseLine ( UINT32 DtGetNextLine ( - FILE *Handle) + FILE *Handle, + UINT32 Flags) { BOOLEAN LineNotAllBlanks = FALSE; UINT32 State = DT_NORMAL_TEXT; @@ -415,7 +416,7 @@ DtGetNextLine ( int c; - ACPI_MEMSET (Gbl_CurrentLineBuffer, 0, Gbl_LineBufferSize); + memset (Gbl_CurrentLineBuffer, 0, Gbl_LineBufferSize); for (i = 0; ;) { /* @@ -550,9 +551,12 @@ DtGetNextLine ( case '\n': - AcpiOsPrintf ("ERROR at line %u: Unterminated quoted string\n", - Gbl_CurrentLineNumber++); - State = DT_NORMAL_TEXT; + if (!(Flags & DT_ALLOW_MULTILINE_QUOTES)) + { + AcpiOsPrintf ("ERROR at line %u: Unterminated quoted string\n", + Gbl_CurrentLineNumber++); + State = DT_NORMAL_TEXT; + } break; default: /* Get next character */ @@ -746,7 +750,7 @@ DtScanFile ( /* Scan line-by-line */ - while ((Offset = DtGetNextLine (Handle)) != ASL_EOF) + while ((Offset = DtGetNextLine (Handle, 0)) != ASL_EOF) { ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Line %2.2u/%4.4X - %s", Gbl_CurrentLineNumber, Offset, Gbl_CurrentLineBuffer)); @@ -897,7 +901,7 @@ DtDumpBuffer ( } BufChar = Buffer[(ACPI_SIZE) i + j]; - if (ACPI_IS_PRINT (BufChar)) + if (isprint (BufChar)) { FlPrintFile (FileId, "%c", BufChar); } diff --git a/source/compiler/dtparser.y b/source/compiler/dtparser.y index fca1e90..f8bafbb 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 d7e4eff..0d77483 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 d7b2e90..22b4c9c 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 70dfe2d..3da0692 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 (" (AML byte code table)\n"); - AcpiOsPrintf (" */\n\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 1b27b4e..6d76f4d 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 5b88d11..95f005d 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 ((int) *ThisChar)) { /* Convert ASCII 0-9 to Decimal value */ @@ -249,8 +249,8 @@ DtStrtoul64 ( } else /* Letter */ { - ThisDigit = (UINT32) ACPI_TOUPPER (*ThisChar); - if (!ACPI_IS_XDIGIT ((char) ThisDigit)) + ThisDigit = (UINT32) toupper ((int) *ThisChar); + if (!isxdigit ((int) ThisDigit)) { /* Not A-F */ @@ -568,7 +568,7 @@ DtGetFieldLength ( Value = DtGetFieldValue (Field); if (Value) { - ByteLength = ACPI_STRLEN (Value) + 1; + ByteLength = strlen (Value) + 1; } else { /* At this point, this is a fatal error */ @@ -633,7 +633,7 @@ DtGetFieldLength ( /* TBD: error if Value is NULL? (as below?) */ - ByteLength = (ACPI_STRLEN (Value) + 1) * sizeof(UINT16); + ByteLength = (strlen (Value) + 1) * sizeof(UINT16); break; default: diff --git a/source/compiler/prparser.y b/source/compiler/prparser.y index f761233..6758733 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 47f772f..393d801 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 */ @@ -839,6 +848,107 @@ SyntaxError: /******************************************************************************* * + * 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 * * PARAMETERS: Directive - Pointer to directive name token diff --git a/source/compiler/prutils.c b/source/compiler/prutils.c index a802fcf..d967e5c 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 8316773..4a2c4e8 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 2a517d2..4c7b4ba 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 ac8beeb..aedc8bf 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 1cf8760..433cc55 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 f9d7635..5d52620 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 70bca42..bc29d3b 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 80fd3e6..e588167 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 ((int) *Command) != tolower ((int) *Invocation)) { return (FALSE); } @@ -702,7 +702,7 @@ AcpiDbMatchCommand ( for (i = CMD_FIRST_VALID; AcpiGbl_DbCommands[i].Name; i++) { - if (ACPI_STRSTR (AcpiGbl_DbCommands[i].Name, UserCommand) == + if (strstr (AcpiGbl_DbCommands[i].Name, UserCommand) == AcpiGbl_DbCommands[i].Name) { return (i); @@ -946,7 +946,7 @@ AcpiDbCommandDispatch ( else if (ParamCount == 2) { Temp = AcpiGbl_DbConsoleDebugLevel; - AcpiGbl_DbConsoleDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], + AcpiGbl_DbConsoleDebugLevel = strtoul (AcpiGbl_DbArgs[1], NULL, 16); AcpiOsPrintf ( "Debug Level for console output was %8.8lX, now %8.8lX\n", @@ -955,7 +955,7 @@ AcpiDbCommandDispatch ( else { Temp = AcpiGbl_DbDebugLevel; - AcpiGbl_DbDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16); + AcpiGbl_DbDebugLevel = strtoul (AcpiGbl_DbArgs[1], NULL, 16); AcpiOsPrintf ( "Debug Level for file output was %8.8lX, now %8.8lX\n", Temp, AcpiGbl_DbDebugLevel); @@ -994,7 +994,7 @@ AcpiDbCommandDispatch ( case CMD_NOTIFY: - Temp = ACPI_STRTOUL (AcpiGbl_DbArgs[2], NULL, 0); + Temp = strtoul (AcpiGbl_DbArgs[2], NULL, 0); AcpiDbSendNotify (AcpiGbl_DbArgs[1], Temp); break; diff --git a/source/components/debugger/dbmethod.c b/source/components/debugger/dbmethod.c index c658d6a..2b03d35 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 48aaeb0..0b56f07 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 72a4499..8d68f53 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 1b33752..a089344 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 04b69ad..33d5e36 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 8cd06a4..2291bb2 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 1f13819..a6ec689 100644 --- a/source/components/disassembler/dmcstyle.c +++ b/source/components/disassembler/dmcstyle.c @@ -337,23 +337,70 @@ AcpiDmCheckForSymbolicOpcode ( */ AcpiDmPromoteTarget (Op, Target); - /* - * Check for possible conversion to a "Compound Assignment". - * - * Determine if either operand is the same as the target - * and display compound assignment operator and other operand. - */ - if ((AcpiDmIsTargetAnOperand (Target, Child1, TRUE)) || - (AcpiDmIsTargetAnOperand (Target, Child2, TRUE))) + /* Check operands for conversion to a "Compound Assignment" */ + + switch (Op->Common.AmlOpcode) { - Target->Common.OperatorSymbol = - AcpiDmGetCompoundSymbol (Op->Common.AmlOpcode); + /* Commutative operators */ + + case AML_ADD_OP: + case AML_MULTIPLY_OP: + case AML_BIT_AND_OP: + case AML_BIT_OR_OP: + case AML_BIT_XOR_OP: + /* + * For the commutative operators, we can convert to a + * compound statement only if at least one (either) operand + * is the same as the target. + * + * Add (A, B, A) --> A += B + * Add (B, A, A) --> A += B + * Add (B, C, A) --> A = (B + C) + */ + if ((AcpiDmIsTargetAnOperand (Target, Child1, TRUE)) || + (AcpiDmIsTargetAnOperand (Target, Child2, TRUE))) + { + Target->Common.OperatorSymbol = + AcpiDmGetCompoundSymbol (Op->Common.AmlOpcode); - /* Convert operator to compound assignment */ + /* Convert operator to compound assignment */ - Op->Common.DisasmFlags |= ACPI_PARSEOP_COMPOUND; - Child1->Common.OperatorSymbol = NULL; - return (TRUE); + Op->Common.DisasmFlags |= ACPI_PARSEOP_COMPOUND; + Child1->Common.OperatorSymbol = NULL; + return (TRUE); + } + break; + + /* Non-commutative operators */ + + case AML_SUBTRACT_OP: + case AML_DIVIDE_OP: + case AML_MOD_OP: + case AML_SHIFT_LEFT_OP: + case AML_SHIFT_RIGHT_OP: + /* + * For the non-commutative operators, we can convert to a + * compound statement only if the target is the same as the + * first operand. + * + * Subtract (A, B, A) --> A -= B + * Subtract (B, A, A) --> A = (B - A) + */ + if ((AcpiDmIsTargetAnOperand (Target, Child1, TRUE))) + { + Target->Common.OperatorSymbol = + AcpiDmGetCompoundSymbol (Op->Common.AmlOpcode); + + /* Convert operator to compound assignment */ + + Op->Common.DisasmFlags |= ACPI_PARSEOP_COMPOUND; + Child1->Common.OperatorSymbol = NULL; + return (TRUE); + } + break; + + default: + break; } /* @@ -423,8 +470,12 @@ AcpiDmCheckForSymbolicOpcode ( * source so that the target is processed first. */ Target = Child1->Common.Next; - AcpiDmPromoteTarget (Op, Target); + if (!Target) + { + return (FALSE); + } + AcpiDmPromoteTarget (Op, Target); if (!Target->Common.OperatorSymbol) { Target->Common.OperatorSymbol = " = "; @@ -674,7 +725,8 @@ AcpiDmPromoteTarget ( * * DESCRIPTION: Determine if a Target Op is a placeholder Op or a real Target. * In other words, determine if the optional target is used or - * not. + * not. Note: If Target is NULL, something is seriously wrong, + * probably with the parse tree. * ******************************************************************************/ @@ -683,6 +735,11 @@ AcpiDmIsValidTarget ( ACPI_PARSE_OBJECT *Target) { + if (!Target) + { + return (FALSE); + } + if ((Target->Common.AmlOpcode == AML_INT_NAMEPATH_OP) && (Target->Common.Value.Arg == NULL)) { diff --git a/source/components/disassembler/dmopcode.c b/source/components/disassembler/dmopcode.c index d8ab1d5..60345fc 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 ((int) NameString[3])); /* d */ LastCharsAreHex = - (ACPI_IS_XDIGIT (NameString[2]) && /* xx */ - ACPI_IS_XDIGIT (NameString[3])); + (isxdigit ((int) NameString[2]) && /* xx */ + isxdigit ((int) NameString[3])); switch (NameString[1]) { diff --git a/source/components/dispatcher/dsfield.c b/source/components/dispatcher/dsfield.c index 83100be..69437de 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 8957eff..aabd30b 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 54899d7..cdc8431 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 fadc7c5..15c54fb 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 ab2d80d..37b7b39 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 4e635ce..2ce57f9 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 1943d23..d23a345 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 aa233b7..85389dd 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 e0ef653..b8f032c 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 dd41f93..6ca866c 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 c76a1a4..299a1a0 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 9407fa7..d0ebcf0 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 7e81d42..5c95223 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 49fad87..2a7b620 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 dbadb5a..61a5bbd 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 419aa6d..a5b1513 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 5f83f10..aa42edb 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 6fcfa0f..6aaf69c 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 24db5ce..87791c0 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 25676a1..a4cc73a 100644 --- a/source/components/executer/exutils.c +++ b/source/components/executer/exutils.c @@ -433,6 +433,43 @@ AcpiExIntegerToString ( /******************************************************************************* * + * FUNCTION: AcpiExPciClsToString + * + * PARAMETERS: OutString - Where to put the converted string (7 bytes) + * PARAMETERS: ClassCode - PCI class code to be converted (3 bytes) + * + * RETURN: None + * + * DESCRIPTION: Convert 3-bytes PCI class code to string representation. + * Return buffer must be large enough to hold the string. The + * string returned is always exactly of length + * ACPI_PCICLS_STRING_SIZE (includes null terminator). + * + ******************************************************************************/ + +void +AcpiExPciClsToString ( + char *OutString, + UINT8 ClassCode[3]) +{ + + ACPI_FUNCTION_ENTRY (); + + + /* All 3 bytes are hexadecimal */ + + OutString[0] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[0], 4); + OutString[1] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[0], 0); + OutString[2] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[1], 4); + OutString[3] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[1], 0); + OutString[4] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[2], 4); + OutString[5] = AcpiUtHexToAsciiChar ((UINT64) ClassCode[2], 0); + OutString[6] = 0; +} + + +/******************************************************************************* + * * FUNCTION: AcpiIsValidSpaceId * * PARAMETERS: SpaceId - ID to be validated diff --git a/source/components/hardware/hwgpe.c b/source/components/hardware/hwgpe.c index 2e616d4..1458f4f 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 5576ede..1642aa3 100644 --- a/source/components/hardware/hwxfsleep.c +++ b/source/components/hardware/hwxfsleep.c @@ -51,6 +51,14 @@ /* Local prototypes */ +#if (!ACPI_REDUCED_HARDWARE) +static ACPI_STATUS +AcpiHwSetFirmwareWakingVector ( + ACPI_TABLE_FACS *Facs, + ACPI_PHYSICAL_ADDRESS PhysicalAddress, + ACPI_PHYSICAL_ADDRESS PhysicalAddress64); +#endif + static ACPI_STATUS AcpiHwSleepDispatch ( UINT8 SleepState, @@ -77,29 +85,33 @@ static ACPI_SLEEP_FUNCTIONS AcpiSleepDispatch[] = /* * These functions are removed for the ACPI_REDUCED_HARDWARE case: * AcpiSetFirmwareWakingVector - * AcpiSetFirmwareWakingVector64 * AcpiEnterSleepStateS4bios */ #if (!ACPI_REDUCED_HARDWARE) /******************************************************************************* * - * FUNCTION: AcpiSetFirmwareWakingVector + * FUNCTION: AcpiHwSetFirmwareWakingVector * - * PARAMETERS: PhysicalAddress - 32-bit physical address of ACPI real mode - * entry point. + * PARAMETERS: Facs - Pointer to FACS table + * PhysicalAddress - 32-bit physical address of ACPI real mode + * entry point + * PhysicalAddress64 - 64-bit physical address of ACPI protected + * entry point * * RETURN: Status * - * DESCRIPTION: Sets the 32-bit FirmwareWakingVector field of the FACS + * DESCRIPTION: Sets the FirmwareWakingVector fields of the FACS * ******************************************************************************/ -ACPI_STATUS -AcpiSetFirmwareWakingVector ( - UINT32 PhysicalAddress) +static ACPI_STATUS +AcpiHwSetFirmwareWakingVector ( + ACPI_TABLE_FACS *Facs, + ACPI_PHYSICAL_ADDRESS PhysicalAddress, + ACPI_PHYSICAL_ADDRESS PhysicalAddress64) { - ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector); + ACPI_FUNCTION_TRACE (AcpiHwSetFirmwareWakingVector); /* @@ -112,60 +124,73 @@ 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); } -ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector) - -#if ACPI_MACHINE_WIDTH == 64 /******************************************************************************* * - * FUNCTION: AcpiSetFirmwareWakingVector64 + * FUNCTION: AcpiSetFirmwareWakingVector * - * PARAMETERS: PhysicalAddress - 64-bit physical address of ACPI protected - * mode entry point. + * PARAMETERS: PhysicalAddress - 32-bit physical address of ACPI real mode + * entry point + * PhysicalAddress64 - 64-bit physical address of ACPI protected + * entry point * * RETURN: Status * - * DESCRIPTION: Sets the 64-bit X_FirmwareWakingVector field of the FACS, if - * it exists in the table. This function is intended for use with - * 64-bit host operating systems. + * DESCRIPTION: Sets the FirmwareWakingVector fields of the FACS * ******************************************************************************/ ACPI_STATUS -AcpiSetFirmwareWakingVector64 ( - UINT64 PhysicalAddress) +AcpiSetFirmwareWakingVector ( + ACPI_PHYSICAL_ADDRESS PhysicalAddress, + ACPI_PHYSICAL_ADDRESS PhysicalAddress64) { - ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector64); + ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector); - /* Determine if the 64-bit vector actually exists */ + /* If Hardware Reduced flag is set, there is no FACS */ - if ((AcpiGbl_FACS->Length <= 32) || (AcpiGbl_FACS->Version < 1)) + if (AcpiGbl_ReducedHardware) { - return_ACPI_STATUS (AE_NOT_EXIST); + return_ACPI_STATUS (AE_OK); } - /* Clear 32-bit vector, set the 64-bit X_ vector */ + if (AcpiGbl_Facs32) + { + (void) AcpiHwSetFirmwareWakingVector (AcpiGbl_Facs32, + PhysicalAddress, PhysicalAddress64); + } + if (AcpiGbl_Facs64) + { + (void) AcpiHwSetFirmwareWakingVector (AcpiGbl_Facs64, + PhysicalAddress, PhysicalAddress64); + } - AcpiGbl_FACS->FirmwareWakingVector = 0; - AcpiGbl_FACS->XFirmwareWakingVector = PhysicalAddress; return_ACPI_STATUS (AE_OK); } -ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector64) -#endif +ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector) /******************************************************************************* diff --git a/source/components/namespace/nsaccess.c b/source/components/namespace/nsaccess.c index 9729cd6..615257a 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 6fa67fa..c3ca5b8 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 bbaff7d..0e692ba 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 ((int) Pathname[i]) ? AcpiOsPrintf ("%c", Pathname[i]) : AcpiOsPrintf ("?"); } diff --git a/source/components/namespace/nseval.c b/source/components/namespace/nseval.c index e5a0eb8..6ab6a93 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 d68ee20..c80d2c8 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 fec9c51..bfc5615 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 60b895b..f68f8bc 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 ((int) *Source); } AcpiUtRemoveReference (ReturnObject); diff --git a/source/components/namespace/nssearch.c b/source/components/namespace/nssearch.c index 46794b6..bdd4e86 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) + { + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, + "Namespace override: %4.4s pass %u type %X Owner %X\n", + ACPI_CAST_PTR(char, &TargetName), InterpreterMode, + (*ReturnNode)->Type, WalkState->OwnerId)); + + AcpiNsDeleteChildren (*ReturnNode); + if (AcpiGbl_RuntimeNamespaceOverride) + { + AcpiUtRemoveReference ((*ReturnNode)->Object); + (*ReturnNode)->Object = NULL; + (*ReturnNode)->OwnerId = WalkState->OwnerId; + } + else + { + AcpiNsRemoveNode (*ReturnNode); + *ReturnNode = ACPI_ENTRY_NOT_FOUND; + } + } + + /* Return an error if we don't expect to find the object */ + + else if (Flags & ACPI_NS_ERROR_IF_FOUND) + { + Status = AE_ALREADY_EXISTS; + } } #ifdef ACPI_ASL_COMPILER diff --git a/source/components/namespace/nsutils.c b/source/components/namespace/nsutils.c index becdf33..5335810 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 547ed4d..1a867bd 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 3f6c74d..7f92201 100644 --- a/source/components/namespace/nsxfname.c +++ b/source/components/namespace/nsxfname.c @@ -126,7 +126,7 @@ AcpiGetHandle ( /* Special case for root-only, since we can't search for it */ - if (!ACPI_STRCMP (Pathname, ACPI_NS_ROOT_PATH)) + if (!strcmp (Pathname, ACPI_NS_ROOT_PATH)) { *RetHandle = ACPI_CAST_PTR (ACPI_HANDLE, AcpiGbl_RootNode); return (AE_OK); @@ -271,7 +271,7 @@ AcpiNsCopyDeviceId ( /* Copy actual string and return a pointer to the next string area */ - ACPI_MEMCPY (StringArea, Source->String, Source->Length); + memcpy (StringArea, Source->String, Source->Length); return (StringArea + Source->Length); } @@ -290,7 +290,7 @@ AcpiNsCopyDeviceId ( * control methods (Such as in the case of a device.) * * For Device and Processor objects, run the Device _HID, _UID, _CID, _SUB, - * _STA, _ADR, _SxW, and _SxD methods. + * _CLS, _STA, _ADR, _SxW, and _SxD methods. * * Note: Allocates the return buffer, must be freed by the caller. * @@ -307,11 +307,12 @@ AcpiGetObjectInfo ( ACPI_PNP_DEVICE_ID *Hid = NULL; ACPI_PNP_DEVICE_ID *Uid = NULL; ACPI_PNP_DEVICE_ID *Sub = NULL; + ACPI_PNP_DEVICE_ID *Cls = NULL; char *NextIdString; ACPI_OBJECT_TYPE Type; ACPI_NAME Name; UINT8 ParamCount= 0; - UINT8 Valid = 0; + UINT16 Valid = 0; UINT32 InfoSize; UINT32 i; ACPI_STATUS Status; @@ -359,7 +360,7 @@ AcpiGetObjectInfo ( { /* * Get extra info for ACPI Device/Processor objects only: - * Run the Device _HID, _UID, _SUB, and _CID methods. + * Run the Device _HID, _UID, _SUB, _CID, and _CLS methods. * * Note: none of these methods are required, so they may or may * not be present for this device. The Info->Valid bitfield is used @@ -403,6 +404,15 @@ AcpiGetObjectInfo ( InfoSize += (CidList->ListSize - sizeof (ACPI_PNP_DEVICE_ID_LIST)); Valid |= ACPI_VALID_CID; } + + /* Execute the Device._CLS method */ + + Status = AcpiUtExecute_CLS (Node, &Cls); + if (ACPI_SUCCESS (Status)) + { + InfoSize += Cls->Length; + Valid |= ACPI_VALID_CLS; + } } /* @@ -534,6 +544,12 @@ AcpiGetObjectInfo ( } } + if (Cls) + { + NextIdString = AcpiNsCopyDeviceId (&Info->ClassCode, + Cls, NextIdString); + } + /* Copy the fixed-length data */ Info->InfoSize = InfoSize; @@ -563,6 +579,10 @@ Cleanup: { ACPI_FREE (CidList); } + if (Cls) + { + ACPI_FREE (Cls); + } return (Status); } @@ -684,7 +704,7 @@ AcpiInstallMethod ( /* Copy the method AML to the local buffer */ - ACPI_MEMCPY (AmlBuffer, AmlStart, AmlLength); + memcpy (AmlBuffer, AmlStart, AmlLength); /* Initialize the method object with the new method's information */ diff --git a/source/components/parser/psutils.c b/source/components/parser/psutils.c index e95d162..55bf2cc 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 5b47e7e..551f59a 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 82df562..83f50aa 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 6840794..a5517c6 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 cb64c1d..1008af0 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 5c1cfe4..5769a8e 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 6d57e80..871eb88 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 13ed982..af79092 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 e2c6833..c797efb 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 48d8d50..af73279 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 ((int) *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 7159c60..df1e053 100644 --- a/source/components/tables/tbutils.c +++ b/source/components/tables/tbutils.c @@ -75,8 +75,6 @@ ACPI_STATUS AcpiTbInitializeFacs ( void) { - ACPI_STATUS Status; - /* If Hardware Reduced flag is set, there is no FACS */ @@ -86,9 +84,23 @@ 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_Facs64 && (!AcpiGbl_Facs32 || !AcpiGbl_Use32BitFacsAddresses)) + { + AcpiGbl_FACS = AcpiGbl_Facs64; + } + else if (AcpiGbl_Facs32) + { + AcpiGbl_FACS = AcpiGbl_Facs32; + } + + /* If there is no FACS, just continue. There was already an error msg */ + + return (AE_OK); } #endif /* !ACPI_REDUCED_HARDWARE */ @@ -111,7 +123,7 @@ AcpiTbTablesLoaded ( void) { - if (AcpiGbl_RootTableList.CurrentTableCount >= 3) + if (AcpiGbl_RootTableList.CurrentTableCount >= 4) { return (TRUE); } @@ -190,7 +202,7 @@ AcpiTbCopyDsdt ( return (NULL); } - ACPI_MEMCPY (NewTable, TableDesc->Pointer, TableDesc->Length); + memcpy (NewTable, TableDesc->Pointer, TableDesc->Length); AcpiTbUninstallTable (TableDesc); AcpiTbInitTableDescriptor ( @@ -389,11 +401,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 7b4e7f0..bcaf6af 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 3473df8..19c31e7 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 bb4194d..d0b5c92 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 cf99b76..16a593f 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 c2211cc..7a0f210 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 e68634b..a93ed86 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,57 @@ * 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 +99,7 @@ /******************************************************************************* * - * FUNCTION: AcpiUtMemcmp (memcmp) + * FUNCTION: memcmp * * PARAMETERS: Buffer1 - First Buffer * Buffer2 - Second Buffer @@ -75,11 +112,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 +132,7 @@ AcpiUtMemcmp ( /******************************************************************************* * - * FUNCTION: AcpiUtMemcpy (memcpy) + * FUNCTION: memcpy * * PARAMETERS: Dest - Target of the copy * Src - Source buffer to copy @@ -105,7 +145,7 @@ AcpiUtMemcmp ( ******************************************************************************/ void * -AcpiUtMemcpy ( +memcpy ( void *Dest, const void *Src, ACPI_SIZE Count) @@ -128,7 +168,7 @@ AcpiUtMemcpy ( /******************************************************************************* * - * FUNCTION: AcpiUtMemset (memset) + * FUNCTION: memset * * PARAMETERS: Dest - Buffer to set * Value - Value to set each byte of memory @@ -141,9 +181,9 @@ AcpiUtMemcpy ( ******************************************************************************/ void * -AcpiUtMemset ( +memset ( void *Dest, - UINT8 Value, + int Value, ACPI_SIZE Count) { char *New = (char *) Dest; @@ -162,7 +202,7 @@ AcpiUtMemset ( /******************************************************************************* * - * FUNCTION: AcpiUtStrlen (strlen) + * FUNCTION: strlen * * PARAMETERS: String - Null terminated string * @@ -174,7 +214,7 @@ AcpiUtMemset ( ACPI_SIZE -AcpiUtStrlen ( +strlen ( const char *String) { UINT32 Length = 0; @@ -194,7 +234,7 @@ AcpiUtStrlen ( /******************************************************************************* * - * FUNCTION: AcpiUtStrcpy (strcpy) + * FUNCTION: strcpy * * PARAMETERS: DstString - Target of the copy * SrcString - The source string to copy @@ -206,7 +246,7 @@ AcpiUtStrlen ( ******************************************************************************/ char * -AcpiUtStrcpy ( +strcpy ( char *DstString, const char *SrcString) { @@ -232,7 +272,7 @@ AcpiUtStrcpy ( /******************************************************************************* * - * FUNCTION: AcpiUtStrncpy (strncpy) + * FUNCTION: strncpy * * PARAMETERS: DstString - Target of the copy * SrcString - The source string to copy @@ -245,7 +285,7 @@ AcpiUtStrcpy ( ******************************************************************************/ char * -AcpiUtStrncpy ( +strncpy ( char *DstString, const char *SrcString, ACPI_SIZE Count) @@ -275,7 +315,7 @@ AcpiUtStrncpy ( /******************************************************************************* * - * FUNCTION: AcpiUtStrcmp (strcmp) + * FUNCTION: strcmp * * PARAMETERS: String1 - First string * String2 - Second string @@ -287,7 +327,7 @@ AcpiUtStrncpy ( ******************************************************************************/ int -AcpiUtStrcmp ( +strcmp ( const char *String1, const char *String2) { @@ -307,7 +347,7 @@ AcpiUtStrcmp ( /******************************************************************************* * - * FUNCTION: AcpiUtStrchr (strchr) + * FUNCTION: strchr * * PARAMETERS: String - Search string * ch - character to search for @@ -319,7 +359,7 @@ AcpiUtStrcmp ( ******************************************************************************/ char * -AcpiUtStrchr ( +strchr ( const char *String, int ch) { @@ -339,7 +379,7 @@ AcpiUtStrchr ( /******************************************************************************* * - * FUNCTION: AcpiUtStrncmp (strncmp) + * FUNCTION: strncmp * * PARAMETERS: String1 - First string * String2 - Second string @@ -352,7 +392,7 @@ AcpiUtStrchr ( ******************************************************************************/ int -AcpiUtStrncmp ( +strncmp ( const char *String1, const char *String2, ACPI_SIZE Count) @@ -374,7 +414,7 @@ AcpiUtStrncmp ( /******************************************************************************* * - * FUNCTION: AcpiUtStrcat (Strcat) + * FUNCTION: strcat * * PARAMETERS: DstString - Target of the copy * SrcString - The source string to copy @@ -386,7 +426,7 @@ AcpiUtStrncmp ( ******************************************************************************/ char * -AcpiUtStrcat ( +strcat ( char *DstString, const char *SrcString) { @@ -409,7 +449,7 @@ AcpiUtStrcat ( /******************************************************************************* * - * FUNCTION: AcpiUtStrncat (strncat) + * FUNCTION: strncat * * PARAMETERS: DstString - Target of the copy * SrcString - The source string to copy @@ -423,7 +463,7 @@ AcpiUtStrcat ( ******************************************************************************/ char * -AcpiUtStrncat ( +strncat ( char *DstString, const char *SrcString, ACPI_SIZE Count) @@ -457,7 +497,7 @@ AcpiUtStrncat ( /******************************************************************************* * - * FUNCTION: AcpiUtStrstr (strstr) + * FUNCTION: strstr * * PARAMETERS: String1 - Target string * String2 - Substring to search for @@ -471,22 +511,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 +539,7 @@ AcpiUtStrstr ( /******************************************************************************* * - * FUNCTION: AcpiUtStrtoul (strtoul) + * FUNCTION: strtoul * * PARAMETERS: String - Null terminated string * Terminater - Where a pointer to the terminating byte is @@ -509,12 +549,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 +573,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 +605,7 @@ AcpiUtStrtoul ( { if (*String == '0') { - if (AcpiUtToLower (*(++String)) == 'x') + if (tolower (*(++String)) == 'x') { Base = 16; ++String; @@ -600,7 +640,7 @@ AcpiUtStrtoul ( if (Base == 16 && *String == '0' && - AcpiUtToLower (*(++String)) == 'x') + tolower (*(++String)) == 'x') { String++; } @@ -610,14 +650,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 +728,7 @@ done: /******************************************************************************* * - * FUNCTION: AcpiUtToUpper (TOUPPER) + * FUNCTION: toupper * * PARAMETERS: c - Character to convert * @@ -699,17 +739,17 @@ done: ******************************************************************************/ int -AcpiUtToUpper ( +toupper ( int c) { - return (ACPI_IS_LOWER(c) ? ((c)-0x20) : (c)); + return (islower(c) ? ((c)-0x20) : (c)); } /******************************************************************************* * - * FUNCTION: AcpiUtToLower (TOLOWER) + * FUNCTION: tolower * * PARAMETERS: c - Character to convert * @@ -720,23 +760,23 @@ AcpiUtToUpper ( ******************************************************************************/ int -AcpiUtToLower ( +tolower ( int c) { - return (ACPI_IS_UPPER(c) ? ((c)+0x20) : (c)); + return (isupper(c) ? ((c)+0x20) : (c)); } /******************************************************************************* * - * FUNCTION: is* functions + * FUNCTION: is* function array * * DESCRIPTION: is* functions use the ctype table below * ******************************************************************************/ -const UINT8 _acpi_ctype[257] = { +const UINT8 AcpiGbl_Ctypes[257] = { _ACPI_CN, /* 0x00 0 NUL */ _ACPI_CN, /* 0x01 1 SOH */ _ACPI_CN, /* 0x02 2 STX */ diff --git a/source/components/utilities/utcopy.c b/source/components/utilities/utcopy.c index 932faa3..dc5ecda 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 2affb21..1b7f1f5 100644 --- a/source/components/utilities/utids.c +++ b/source/components/utilities/utids.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: utids - support for device IDs - HID, UID, CID + * Module Name: utids - support for device IDs - HID, UID, CID, SUB, CLS * *****************************************************************************/ @@ -121,7 +121,7 @@ AcpiUtExecute_HID ( } else { - ACPI_STRCPY (Hid->String, ObjDesc->String.Pointer); + strcpy (Hid->String, ObjDesc->String.Pointer); } Hid->Length = Length; @@ -194,7 +194,7 @@ AcpiUtExecute_SUB ( /* Simply copy existing string */ - ACPI_STRCPY (Sub->String, ObjDesc->String.Pointer); + strcpy (Sub->String, ObjDesc->String.Pointer); Sub->Length = Length; *ReturnId = Sub; @@ -279,7 +279,7 @@ AcpiUtExecute_UID ( } else { - ACPI_STRCPY (Uid->String, ObjDesc->String.Pointer); + strcpy (Uid->String, ObjDesc->String.Pointer); } Uid->Length = Length; @@ -426,7 +426,7 @@ AcpiUtExecute_CID ( { /* Copy the String CID from the returned object */ - ACPI_STRCPY (NextIdString, CidObjects[i]->String.Pointer); + strcpy (NextIdString, CidObjects[i]->String.Pointer); Length = CidObjects[i]->String.Length + 1; } @@ -449,3 +449,97 @@ Cleanup: AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); } + + +/******************************************************************************* + * + * FUNCTION: AcpiUtExecute_CLS + * + * PARAMETERS: DeviceNode - Node for the device + * ReturnId - Where the _CLS is returned + * + * RETURN: Status + * + * DESCRIPTION: Executes the _CLS control method that returns PCI-defined + * class code of the device. The _CLS value is always a package + * containing PCI class information as a list of integers. + * The returned string has format "BBSSPP", where: + * BB = Base-class code + * SS = Sub-class code + * PP = Programming Interface code + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtExecute_CLS ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_PNP_DEVICE_ID **ReturnId) +{ + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT **ClsObjects; + UINT32 Count; + ACPI_PNP_DEVICE_ID *Cls; + UINT32 Length; + ACPI_STATUS Status; + UINT8 ClassCode[3] = {0, 0, 0}; + + + ACPI_FUNCTION_TRACE (UtExecute_CLS); + + + Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CLS, + ACPI_BTYPE_PACKAGE, &ObjDesc); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Get the size of the String to be returned, includes null terminator */ + + Length = ACPI_PCICLS_STRING_SIZE; + ClsObjects = ObjDesc->Package.Elements; + Count = ObjDesc->Package.Count; + + if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE) + { + if (Count > 0 && ClsObjects[0]->Common.Type == ACPI_TYPE_INTEGER) + { + ClassCode[0] = (UINT8) ClsObjects[0]->Integer.Value; + } + if (Count > 1 && ClsObjects[1]->Common.Type == ACPI_TYPE_INTEGER) + { + ClassCode[1] = (UINT8) ClsObjects[1]->Integer.Value; + } + if (Count > 2 && ClsObjects[2]->Common.Type == ACPI_TYPE_INTEGER) + { + ClassCode[2] = (UINT8) ClsObjects[2]->Integer.Value; + } + } + + /* Allocate a buffer for the CLS */ + + Cls = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); + if (!Cls) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + /* Area for the string starts after PNP_DEVICE_ID struct */ + + Cls->String = ACPI_ADD_PTR (char, Cls, sizeof (ACPI_PNP_DEVICE_ID)); + + /* Simply copy existing string */ + + AcpiExPciClsToString (Cls->String, ClassCode); + Cls->Length = Length; + *ReturnId = Cls; + + +Cleanup: + + /* On exit, we must delete the return object */ + + AcpiUtRemoveReference (ObjDesc); + return_ACPI_STATUS (Status); +} diff --git a/source/components/utilities/utmisc.c b/source/components/utilities/utmisc.c index d482ad5..8ac133a 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 f2c1adf..30cba54 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 205fa45..1b7ef34 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 ffb5e6a..6d7b87c 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 ((int) *String)) { Number *= 10; Number += *(String++) - '0'; @@ -505,7 +505,7 @@ AcpiUtVsnprintf ( /* Process width */ Width = -1; - if (ACPI_IS_DIGIT (*Format)) + if (isdigit ((int) *Format)) { Format = AcpiUtScanNumber (Format, &Number); Width = (INT32) Number; @@ -527,7 +527,7 @@ AcpiUtVsnprintf ( if (*Format == '.') { ++Format; - if (ACPI_IS_DIGIT(*Format)) + if (isdigit ((int) *Format)) { Format = AcpiUtScanNumber (Format, &Number); Precision = (INT32) Number; diff --git a/source/components/utilities/utstring.c b/source/components/utilities/utstring.c index 035d5ba..33060f0 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 ((int) *String); } return; @@ -168,7 +168,7 @@ AcpiUtStrupr ( for (String = SrcString; *String; String++) { - *String = (char) ACPI_TOUPPER (*String); + *String = (char) toupper ((int) *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 ((int) *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 ((int) *(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 ((int) *String) || *String == '\t') { if (ToIntegerOp) { @@ -283,7 +283,7 @@ AcpiUtStrtoul64 ( while (*String) { - if (ACPI_IS_DIGIT (*String)) + if (isdigit ((int) *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 ((int) *String); + if (isxdigit ((int) 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 ((int) 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 44ef0ed..7a594be 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 4266dce..2c6ff38 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/components/utilities/utxfinit.c b/source/components/utilities/utxfinit.c index cd43870..701b171 100644 --- a/source/components/utilities/utxfinit.c +++ b/source/components/utilities/utxfinit.c @@ -194,11 +194,14 @@ AcpiEnableSubsystem ( * Obtain a permanent mapping for the FACS. This is required for the * Global Lock and the Firmware Waking Vector */ - Status = AcpiTbInitializeFacs (); - if (ACPI_FAILURE (Status)) + if (!(Flags & ACPI_NO_FACS_INIT)) { - ACPI_WARNING ((AE_INFO, "Could not map the FACS table")); - return_ACPI_STATUS (Status); + Status = AcpiTbInitializeFacs (); + if (ACPI_FAILURE (Status)) + { + ACPI_WARNING ((AE_INFO, "Could not map the FACS table")); + return_ACPI_STATUS (Status); + } } #endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/source/include/acclib.h b/source/include/acclib.h new file mode 100644 index 0000000..ed310cc --- /dev/null +++ b/source/include/acclib.h @@ -0,0 +1,167 @@ +/****************************************************************************** + * + * Name: acclib.h -- C library support. Prototypes for the (optional) local + * implementations of required C library functions. + * + *****************************************************************************/ + +/* + * 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 _ACCLIB_H +#define _ACCLIB_H + + +/* + * Prototypes and macros for local implementations of C library functions + */ + +/* is* functions. The AcpiGbl_Ctypes array is defined in utclib.c */ + +extern const UINT8 AcpiGbl_Ctypes[]; + +#define _ACPI_XA 0x00 /* extra alphabetic - not supported */ +#define _ACPI_XS 0x40 /* extra space */ +#define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */ +#define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */ +#define _ACPI_DI 0x04 /* '0'-'9' */ +#define _ACPI_LO 0x02 /* 'a'-'z' */ +#define _ACPI_PU 0x10 /* punctuation */ +#define _ACPI_SP 0x08 /* space, tab, CR, LF, VT, FF */ +#define _ACPI_UP 0x01 /* 'A'-'Z' */ +#define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */ + +#define isdigit(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_DI)) +#define isspace(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_SP)) +#define isxdigit(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_XD)) +#define isupper(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_UP)) +#define islower(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_LO)) +#define isprint(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU)) +#define isalpha(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) + + +/* Strings */ + +char * +strcat ( + char *DstString, + const char *SrcString); + +char * +strchr ( + const char *String, + int ch); + +char * +strcpy ( + char *DstString, + const char *SrcString); + +int +strcmp ( + const char *String1, + const char *String2); + +ACPI_SIZE +strlen ( + const char *String); + +char * +strncat ( + char *DstString, + const char *SrcString, + ACPI_SIZE Count); + +int +strncmp ( + const char *String1, + const char *String2, + ACPI_SIZE Count); + +char * +strncpy ( + char *DstString, + const char *SrcString, + ACPI_SIZE Count); + +char * +strstr ( + char *String1, + char *String2); + + +/* Conversion */ + +UINT32 +strtoul ( + const char *String, + char **Terminator, + UINT32 Base); + + +/* Memory */ + +int +memcmp ( + void *Buffer1, + void *Buffer2, + ACPI_SIZE Count); + +void * +memcpy ( + void *Dest, + const void *Src, + ACPI_SIZE Count); + +void * +memset ( + void *Dest, + int Value, + ACPI_SIZE Count); + + +/* upper/lower case */ + +int +tolower ( + int c); + +int +toupper ( + int c); + +#endif /* _ACCLIB_H */ diff --git a/source/include/accommon.h b/source/include/accommon.h index e10471e..15a05b5 100644 --- a/source/include/accommon.h +++ b/source/include/accommon.h @@ -59,6 +59,9 @@ #include "acglobal.h" /* All global variables */ #include "achware.h" /* Hardware defines and interfaces */ #include "acutils.h" /* Utility interfaces */ +#ifndef ACPI_USE_SYSTEM_CLIBRARY +#include "acclib.h" /* C library interfaces */ +#endif /* !ACPI_USE_SYSTEM_CLIBRARY */ #endif /* __ACCOMMON_H__ */ diff --git a/source/include/acglobal.h b/source/include/acglobal.h index ab2fc26..9e7da94 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 66463d6..00eb8f0 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 4c96303..dc1afff 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 6bb6bbf..6887d42 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 07e76b5..786fd29 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 b7b624b..481eb44 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 ab07809..0ef98eb 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 e9180b3..9177fbd 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 0x20150619 #include "acconfig.h" #include "actypes.h" @@ -202,6 +202,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, * this value is set to TRUE if any Windows OSI strings have been @@ -222,6 +231,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 547921b..3a6faa6 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 2842195..a1fc7bf 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 962324a..3a11553 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 6f0c62e..02a3cb0 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 ACPI Specification, Family 1.2 and 2.0", + * December 19, 2014 * - * Conforms to "TCG PC Specific Implementation Specification", - * Version 1.1, August 18, 2003 + * 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 PlatformClass; + UINT32 MinimumLogLength; /* Minimum length for the event log area */ + UINT64 LogAddress; /* Address of the event log area */ + +} ACPI_TABLE_TCPA_CLIENT; + +typedef struct acpi_table_tcpa_server { ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT16 PlatformClass; UINT16 Reserved; - UINT32 MaxLogLength; /* Maximum length for the event log area */ + 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 */ -} ACPI_TABLE_TCPA; +#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 f575d08..7da6bc6 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 */ @@ -848,41 +848,6 @@ typedef struct 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) * Version 1 * diff --git a/source/include/actypes.h b/source/include/actypes.h index 0bee2a7..837c784 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)) /******************************************************************************* @@ -582,6 +582,7 @@ typedef UINT64 ACPI_INTEGER; #define ACPI_NO_ACPI_ENABLE 0x10 #define ACPI_NO_DEVICE_INIT 0x20 #define ACPI_NO_OBJECT_INIT 0x40 +#define ACPI_NO_FACS_INIT 0x80 /* * Initialization state @@ -767,10 +768,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 +1224,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 +1256,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 +1265,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 +1276,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 1be82c7..94f8591 100644 --- a/source/include/acutils.h +++ b/source/include/acutils.h @@ -246,116 +246,8 @@ AcpiUtSubsystemShutdown ( void); -/* - * utclib - Local implementations of C library functions - */ -#ifndef ACPI_USE_SYSTEM_CLIBRARY - -ACPI_SIZE -AcpiUtStrlen ( - const char *String); - -char * -AcpiUtStrchr ( - const char *String, - int ch); - -char * -AcpiUtStrcpy ( - char *DstString, - const char *SrcString); - -char * -AcpiUtStrncpy ( - char *DstString, - const char *SrcString, - ACPI_SIZE Count); - -int -AcpiUtMemcmp ( - const char *Buffer1, - const char *Buffer2, - ACPI_SIZE Count); - -int -AcpiUtStrncmp ( - const char *String1, - const char *String2, - ACPI_SIZE Count); - -int -AcpiUtStrcmp ( - const char *String1, - const char *String2); - -char * -AcpiUtStrcat ( - char *DstString, - const char *SrcString); - -char * -AcpiUtStrncat ( - char *DstString, - const char *SrcString, - ACPI_SIZE Count); - -UINT32 -AcpiUtStrtoul ( - const char *String, - char **Terminator, - UINT32 Base); - -char * -AcpiUtStrstr ( - char *String1, - char *String2); - -void * -AcpiUtMemcpy ( - void *Dest, - const void *Src, - ACPI_SIZE Count); - -void * -AcpiUtMemset ( - void *Dest, - UINT8 Value, - ACPI_SIZE Count); - -int -AcpiUtToUpper ( - int c); - -int -AcpiUtToLower ( - int c); - -extern const UINT8 _acpi_ctype[]; - -#define _ACPI_XA 0x00 /* extra alphabetic - not supported */ -#define _ACPI_XS 0x40 /* extra space */ -#define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */ -#define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */ -#define _ACPI_DI 0x04 /* '0'-'9' */ -#define _ACPI_LO 0x02 /* 'a'-'z' */ -#define _ACPI_PU 0x10 /* punctuation */ -#define _ACPI_SP 0x08 /* space, tab, CR, LF, VT, FF */ -#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)) - -#endif /* !ACPI_USE_SYSTEM_CLIBRARY */ - #define ACPI_IS_ASCII(c) ((c) < 0x80) - /* * utcopy - Object construction and conversion interfaces */ @@ -602,6 +494,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/acuuid.h b/source/include/acuuid.h index cfc4363..59c1768 100644 --- a/source/include/acuuid.h +++ b/source/include/acuuid.h @@ -50,15 +50,41 @@ * Note2: This file is standalone and should remain that way. */ -/* NFIT/NVDIMM */ +/* Controllers */ + +#define UUID_GPIO_CONTROLLER "4f248f40-d5e2-499f-834c-27758ea1cd3f" +#define UUID_USB_CONTROLLER "ce2ee385-00e6-48cb-9f05-2edb927c4899" +#define UUID_SATA_CONTROLLER "e4db149b-fcfe-425b-a6d8-92357d78fc7f" + +/* Devices */ + +#define UUID_PCI_HOST_BRIDGE "33db4d5b-1ff7-401c-9657-7441c03dd766" +#define UUID_I2C_DEVICE "3cdff6f7-4267-4555-ad05-b30a3d8938de" +#define UUID_POWER_BUTTON "dfbcf3c5-e7a5-44e6-9c1f-29c76f6e059c" + +/* Interfaces */ + +#define UUID_DEVICE_LABELING "e5c937d0-3553-4d7a-9117-ea4d19c3434d" +#define UUID_PHYSICAL_PRESENCE "3dddfaa6-361b-4eb4-a424-8d10089d1653" + +/* NVDIMM - NFIT table */ + +#define UUID_VOLATILE_MEMORY "7305944f-fdda-44e3-b16c-3f22d252e5d0" +#define UUID_PERSISTENT_MEMORY "66f0d379-b4f3-4074-ac43-0d3318b78cdb" +#define UUID_CONTROL_REGION "92f701f6-13b4-405d-910b-299367e8234c" +#define UUID_DATA_REGION "91af0530-5d86-470e-a6b0-0a2db9408249" +#define UUID_VOLATILE_VIRTUAL_DISK "77ab535a-45fc-624b-5560-f7b281d1f96e" +#define UUID_VOLATILE_VIRTUAL_CD "3d5abd30-4175-87ce-6d64-d2ade523c4bb" +#define UUID_PERSISTENT_VIRTUAL_DISK "5cea02c9-4d07-69d3-269f-4496fbe096f9" +#define UUID_PERSISTENT_VIRTUAL_CD "08018188-42cd-bb48-100f-5387d53ded3d" + +/* Miscellaneous */ + +#define UUID_PLATFORM_CAPABILITIES "0811b06e-4a27-44f9-8d60-3cbbc22e7b48" +#define UUID_DYNAMIC_ENUMERATION "d8c1a3a6-be9b-4c9b-91bf-c3cb81fc5daf" +#define UUID_BATTERY_THERMAL_LIMIT "4c2067e3-887d-475c-9720-4af1d3ed602e" +#define UUID_THERMAL_EXTENSIONS "14d399cd-7a27-4b18-8fb4-7cb7b9f4e500" +#define UUID_DEVICE_PROPERTIES "daffd814-6eba-4d8c-8a91-bc9bbf4aa301" -#define UUID_VOLATILE_MEMORY "4F940573-DAFD-E344-B16C-3F22D252E5D0" -#define UUID_PERSISTENT_MEMORY "79D3F066-F3B4-7440-AC43-0D3318B78CDB" -#define UUID_CONTROL_REGION "F601F792-B413-5D40-910B-299367E8234C" -#define UUID_DATA_REGION "3005AF91-865D-0E47-A6B0-0A2DB9408249" -#define UUID_VOLATILE_VIRTUAL_DISK "5A53AB77-FC45-4B62-5560-F7B281D1F96E" -#define UUID_VOLATILE_VIRTUAL_CD "30BD5A3D-7541-CE87-6D64-D2ADE523C4BB" -#define UUID_PERSISTENT_VIRTUAL_DISK "C902EA5C-074D-69D3-269F-4496FBE096F9" -#define UUID_PERSISTENT_VIRTUAL_CD "88810108-CD42-48BB-100F-5387D53DED3D" #endif /* __AUUID_H__ */ diff --git a/source/include/platform/acefi.h b/source/include/platform/acefi.h index ae39dc7..5deaa05 100644 --- a/source/include/platform/acefi.h +++ b/source/include/platform/acefi.h @@ -49,10 +49,153 @@ #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 +239,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 +255,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; -#endif +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 0000000..1eb1e57 --- /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 6d144fc..2a502ad 100644 --- a/source/include/platform/acenv.h +++ b/source/include/platform/acenv.h @@ -349,28 +349,6 @@ /* 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)) - #else /****************************************************************************** @@ -408,22 +386,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 6e1130e..c799fd8 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 2a27445..472b6d7 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 59e0b2d..da9df89 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 095d70c..ef69a6a 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 da9d4c6..a1ad9fe 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 b9b85c5..dd7c8d4 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 e090a3c..1ba362b 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)) + if (!Gbl_DumpCustomizedTables) { - return (Status); - } + /* Get RSDP from memory */ - /* Get XSDT from memory */ + Status = OslLoadRsdp (); + if (ACPI_FAILURE (Status)) + { + return (Status); + } - if (Gbl_Rsdp.Revision && !Gbl_DoNotDumpXsdt) - { - if (Gbl_Xsdt) + /* Get XSDT from memory */ + + if (Gbl_Rsdp.Revision && !Gbl_DoNotDumpXsdt) { - free (Gbl_Xsdt); - Gbl_Xsdt = NULL; + 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); + } } - Gbl_Revision = 2; - Status = OslGetBiosTable (ACPI_SIG_XSDT, 0, - ACPI_CAST_PTR (ACPI_TABLE_HEADER *, &Gbl_Xsdt), &Address); - if (ACPI_FAILURE (Status)) + /* Get RSDT from memory */ + + if (Gbl_Rsdp.RsdtPhysicalAddress) { - return (Status); + 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 RSDT from memory */ + /* Get FADT from memory */ - if (Gbl_Rsdp.RsdtPhysicalAddress) - { - if (Gbl_Rsdt) + if (Gbl_Fadt) { - free (Gbl_Rsdt); - Gbl_Rsdt = NULL; + free (Gbl_Fadt); + Gbl_Fadt = NULL; } - Status = OslGetBiosTable (ACPI_SIG_RSDT, 0, - ACPI_CAST_PTR (ACPI_TABLE_HEADER *, &Gbl_Rsdt), &Address); + Status = OslGetBiosTable (ACPI_SIG_FADT, 0, + ACPI_CAST_PTR (ACPI_TABLE_HEADER *, &Gbl_Fadt), &Gbl_FadtAddress); 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) - { /* 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 95993b2..53737bc 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 fad2ac7..aebafb9 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 c403734..3dfce10 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 da4c599..5355de2 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 1e51ed6..1b05984 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 ((int) Filename[0]); + Filename[1] = (char) tolower ((int) Filename[1]); + Filename[2] = (char) tolower ((int) Filename[2]); + Filename[3] = (char) tolower ((int) 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 682a0d5..efc7a6d 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 7bfbcfa..28ac7af 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 17ef9dd..895a27f 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 36463c5..d20211b 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 e1a450c..311b6ae 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 @@ DoFunction: /* * 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 88726a2..14452db 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 8d54887..1fc4c33 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 afd2400..95ea29e 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"); @@ -912,12 +912,32 @@ AhDisplayUuids ( const AH_UUID *Info; - printf ("ACPI-related UUIDs:\n\n"); + printf ("ACPI-related UUIDs/GUIDs:\n"); + + /* Display entire table of known ACPI-related UUIDs/GUIDs */ for (Info = AcpiUuids; Info->Description; Info++) { - printf ("%32s : %s\n", Info->Description, Info->String); + if (!Info->String) /* Null UUID string means group description */ + { + printf ("\n%36s\n", Info->Description); + } + else + { + printf ("%32s : %s\n", Info->Description, Info->String); + } } + + /* Help info on how UUIDs/GUIDs strings are encoded */ + + printf ("\n\nByte encoding of UUID/GUID strings" + " into ACPI Buffer objects (use ToUUID from ASL):\n\n"); + + printf ("%32s : %s\n", "Input UUID/GUID String format", + "aabbccdd-eeff-gghh-iijj-kkllmmnnoopp"); + + printf ("%32s : %s\n", "Expected output ACPI buffer", + "dd,cc,bb,aa, ff,ee, hh,gg, ii,jj, kk,ll,mm,nn,oo,pp"); } @@ -1005,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 59922fe..9646ba4 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 1eb21aa..d5dc9f8 100644 --- a/source/tools/acpisrc/acpisrc.h +++ b/source/tools/acpisrc/acpisrc.h @@ -261,11 +261,6 @@ AsRemoveLine ( char *Keyword); void -AsRemoveMacro ( - char *Buffer, - char *Keyword); - -void AsCheckForBraces ( char *Buffer, char *Filename); diff --git a/source/tools/acpisrc/asconvrt.c b/source/tools/acpisrc/asconvrt.c index fca19b8..5b0f5f4 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 9c4ea7a..1e686cf 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 28299a4..9a4e57c 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 073971f..a10681e 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 f4ce703..31103a0 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 ((int) *String); } } } diff --git a/tests/aapits/atexec.c b/tests/aapits/atexec.c index be86d00..25d98a5 100644 --- a/tests/aapits/atexec.c +++ b/tests/aapits/atexec.c @@ -305,7 +305,7 @@ AtBuildLocalDSDT ( * Examine the incoming user table. At this point, it has been verified * to be either a DSDT, SSDT, or a PSDT, but they must be handled differently */ - if (UserTable && !ACPI_STRNCMP ((char *) UserTable->Signature, ACPI_SIG_DSDT, 4)) + if (UserTable && !strncmp ((char *) UserTable->Signature, ACPI_SIG_DSDT, 4)) { /* User DSDT is installed directly into the FADT */ @@ -318,8 +318,8 @@ AtBuildLocalDSDT ( * or it is an SSDT or PSDT */ - ACPI_MEMSET (&LocalDSDT, 0, sizeof (ACPI_TABLE_HEADER)); - ACPI_STRNCPY (LocalDSDT.Signature, ACPI_SIG_DSDT, 4); + memset (&LocalDSDT, 0, sizeof (ACPI_TABLE_HEADER)); + strncpy (LocalDSDT.Signature, ACPI_SIG_DSDT, 4); LocalDSDT.Revision = 1; LocalDSDT.Length = sizeof (ACPI_TABLE_HEADER); LocalDSDT.Checksum = (UINT8)(0 - AcpiTbChecksum @@ -329,7 +329,7 @@ AtBuildLocalDSDT ( if (BldTask.ErrScale & BAD_SIGNATURE_DSDT) { - ACPI_STRNCPY ((*Actual_DSDT)->Signature, "BADS", 4); + strncpy ((*Actual_DSDT)->Signature, "BADS", 4); } if (BldTask.ErrScale & BAD_CHECKSUM_DSDT) { @@ -360,12 +360,12 @@ AtBuildLocalFACS1 ( ACPI_TABLE_FACS *LocalFACS, BLD_TABLES_TASK BldTask) { - ACPI_MEMSET (LocalFACS, 0, sizeof (ACPI_TABLE_FACS)); + memset (LocalFACS, 0, sizeof (ACPI_TABLE_FACS)); - ACPI_STRNCPY (LocalFACS->Signature, ACPI_SIG_FACS, 4); + strncpy (LocalFACS->Signature, ACPI_SIG_FACS, 4); if (BldTask.ErrScale & BAD_SIGNATURE_FACS) { - ACPI_STRNCPY (LocalFACS->Signature, "BADS", 4); + strncpy (LocalFACS->Signature, "BADS", 4); } LocalFACS->Length = sizeof (ACPI_TABLE_FACS); @@ -429,12 +429,12 @@ AtBuildLocalFADT1 ( AtBuildLocalDSDT(UserTable, BldTask, ActualDSDT); } - ACPI_MEMSET (LocalFADT, 0, sizeof (ACPI_TABLE_FADT)); - ACPI_STRNCPY (LocalFADT->Header.Signature, ACPI_SIG_FADT, 4); + memset (LocalFADT, 0, sizeof (ACPI_TABLE_FADT)); + strncpy (LocalFADT->Header.Signature, ACPI_SIG_FADT, 4); if (BldTask.ErrScale & BAD_SIGNATURE_FADT) { - ACPI_STRNCPY (LocalFADT->Header.Signature, "BADS", 4); + strncpy (LocalFADT->Header.Signature, "BADS", 4); } if (BldTask.ErrScale & NULL_ADDRESS_FACS) @@ -549,12 +549,12 @@ AtBuildLocalFADT2 ( AtBuildLocalDSDT(UserTable, BldTask, ActualDSDT); } - ACPI_MEMSET (LocalFADT, 0, sizeof (ACPI_TABLE_FADT)); - ACPI_STRNCPY (LocalFADT->Header.Signature, ACPI_SIG_FADT, 4); + memset (LocalFADT, 0, sizeof (ACPI_TABLE_FADT)); + strncpy (LocalFADT->Header.Signature, ACPI_SIG_FADT, 4); if (BldTask.ErrScale & BAD_SIGNATURE_FADT) { - ACPI_STRNCPY (LocalFADT->Header.Signature, "BADS", 4); + strncpy (LocalFADT->Header.Signature, "BADS", 4); } if (BldTask.ErrScale & NULL_ADDRESS_FACS) @@ -667,12 +667,12 @@ AtBuildLocalRSDT ( BldTask.NoTableScale |= BLD_NO_FADT; } - ACPI_MEMSET (LocalRSDT, 0, RSDT_SIZE); + memset (LocalRSDT, 0, RSDT_SIZE); - ACPI_STRNCPY (LocalRSDT->Header.Signature, ACPI_SIG_RSDT, 4); + strncpy (LocalRSDT->Header.Signature, ACPI_SIG_RSDT, 4); if (BldTask.ErrScale & BAD_SIGNATURE_RSDT) { - ACPI_STRNCPY (LocalRSDT->Header.Signature, "BADS", 4); + strncpy (LocalRSDT->Header.Signature, "BADS", 4); } if (!(BldTask.NoTableScale & BLD_NO_FADT)) @@ -684,8 +684,8 @@ AtBuildLocalRSDT ( } if (Actual_DSDT && - (!ACPI_STRNCMP ((char *) Actual_DSDT->Signature, ACPI_SIG_SSDT, 4) || - !ACPI_STRNCMP ((char *) Actual_DSDT->Signature, ACPI_SIG_PSDT, 4))) + (!strncmp ((char *) Actual_DSDT->Signature, ACPI_SIG_SSDT, 4) || + !strncmp ((char *) Actual_DSDT->Signature, ACPI_SIG_PSDT, 4))) { LocalRSDT->TableOffsetEntry[i++] = ACPI_PTR_TO_PHYSADDR (UserTable); } @@ -697,8 +697,8 @@ AtBuildLocalRSDT ( * we make sure that the CA core ignores it */ - ACPI_MEMSET (&LocalBADTABLE, 0, sizeof (ACPI_TABLE_HEADER)); - ACPI_STRNCPY (LocalBADTABLE.Signature, "BAD!", 4); + memset (&LocalBADTABLE, 0, sizeof (ACPI_TABLE_HEADER)); + strncpy (LocalBADTABLE.Signature, "BAD!", 4); LocalBADTABLE.Revision = 1; LocalBADTABLE.Length = sizeof (ACPI_TABLE_HEADER); @@ -731,8 +731,8 @@ AtBuildLocalRSDT ( if (!(BldTask.NoTableScale & BLD_NO_TEST)) { - ACPI_MEMSET (&LocalTEST, 0, sizeof (ACPI_TABLE_HEADER)); - ACPI_STRNCPY (LocalTEST.Signature, "TEST", 4); + memset (&LocalTEST, 0, sizeof (ACPI_TABLE_HEADER)); + strncpy (LocalTEST.Signature, "TEST", 4); LocalTEST.Revision = 1; LocalTEST.Length = sizeof (ACPI_TABLE_HEADER); @@ -787,12 +787,12 @@ AtBuildLocalXSDT ( BldTask.NoTableScale |= BLD_NO_FADT; } - ACPI_MEMSET (LocalXSDT, 0, RSDT_SIZE); + memset (LocalXSDT, 0, RSDT_SIZE); - ACPI_STRNCPY (LocalXSDT->Header.Signature, ACPI_SIG_XSDT, 4); + strncpy (LocalXSDT->Header.Signature, ACPI_SIG_XSDT, 4); if (BldTask.ErrScale & BAD_SIGNATURE_RSDT) { - ACPI_STRNCPY (LocalXSDT->Header.Signature, "BADS", 4); + strncpy (LocalXSDT->Header.Signature, "BADS", 4); } if (!(BldTask.NoTableScale & BLD_NO_BADT)) @@ -802,8 +802,8 @@ AtBuildLocalXSDT ( * we make sure that the CA core ignores it */ - ACPI_MEMSET (&LocalBADTABLE, 0, sizeof (ACPI_TABLE_HEADER)); - ACPI_STRNCPY (LocalBADTABLE.Signature, "BAD!", 4); + memset (&LocalBADTABLE, 0, sizeof (ACPI_TABLE_HEADER)); + strncpy (LocalBADTABLE.Signature, "BAD!", 4); LocalBADTABLE.Revision = 1; LocalBADTABLE.Length = sizeof (ACPI_TABLE_HEADER); @@ -819,8 +819,8 @@ AtBuildLocalXSDT ( } if (Actual_DSDT && - (!ACPI_STRNCMP ((char *) Actual_DSDT->Signature, ACPI_SIG_SSDT, 4) || - !ACPI_STRNCMP ((char *) Actual_DSDT->Signature, ACPI_SIG_PSDT, 4))) + (!strncmp ((char *) Actual_DSDT->Signature, ACPI_SIG_SSDT, 4) || + !strncmp ((char *) Actual_DSDT->Signature, ACPI_SIG_PSDT, 4))) { LocalXSDT->TableOffsetEntry[i++] = ACPI_PTR_TO_PHYSADDR (UserTable); } @@ -850,8 +850,8 @@ AtBuildLocalXSDT ( if (!(BldTask.NoTableScale & BLD_NO_TEST)) { - ACPI_MEMSET (&LocalTEST, 0, sizeof (ACPI_TABLE_HEADER)); - ACPI_STRNCPY (LocalTEST.Signature, "TEST", 4); + memset (&LocalTEST, 0, sizeof (ACPI_TABLE_HEADER)); + strncpy (LocalTEST.Signature, "TEST", 4); LocalTEST.Revision = 1; LocalTEST.Length = sizeof (ACPI_TABLE_HEADER); @@ -916,11 +916,11 @@ AtBuildLocalTables ( /* Build an RSDP */ - ACPI_MEMSET (&LocalRSDP, 0, sizeof (ACPI_TABLE_RSDP)); - ACPI_STRNCPY (LocalRSDP.Signature, ACPI_SIG_RSDP, 8); + memset (&LocalRSDP, 0, sizeof (ACPI_TABLE_RSDP)); + strncpy (LocalRSDP.Signature, ACPI_SIG_RSDP, 8); if (BldTask.ErrScale & BAD_SIGNATURE_RSDP) { - ACPI_STRNCPY (LocalRSDP.Signature, "BAD SIGN", 8); + strncpy (LocalRSDP.Signature, "BAD SIGN", 8); } #if ACPI_MACHINE_WIDTH == 64 LocalRSDP.Revision = 2; @@ -1222,7 +1222,7 @@ AeGetRegionBufferAddress ( return (RetAddress); } - ACPI_MEMSET (RegionElement->Buffer, 0, Length); + memset (RegionElement->Buffer, 0, Length); RegionElement->Address = BaseAddress; RegionElement->Length = Length; RegionElement->NextRegion = NULL; @@ -1444,14 +1444,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/tests/aapits/athardware.c b/tests/aapits/athardware.c index bb6d462..ae7fd2f 100644 --- a/tests/aapits/athardware.c +++ b/tests/aapits/athardware.c @@ -1095,7 +1095,7 @@ AtHardwTest0010(void) return (Status); } - Status = AcpiSetFirmwareWakingVector ((UINT32) PhysicalAddress); + Status = AcpiSetFirmwareWakingVector ((UINT32) PhysicalAddress, 0); if (ACPI_FAILURE(Status)) { AapiErrors++; @@ -1143,7 +1143,7 @@ AtHardwTest0011(void) return (Status); } - Status = AcpiSetFirmwareWakingVector((UINT32) PhysicalAddress); + Status = AcpiSetFirmwareWakingVector((UINT32) PhysicalAddress, 0); if (Status != AE_NO_ACPI_TABLES) { AapiErrors++; diff --git a/tests/aapits/oswinxf.c b/tests/aapits/oswinxf.c index af23654..e9c5258 100644 --- a/tests/aapits/oswinxf.c +++ b/tests/aapits/oswinxf.c @@ -484,7 +484,7 @@ AcpiOsActualTableOverride ( /* Construct a null-terminated string from table signature */ TableName[ACPI_NAME_SIZE] = 0; - ACPI_STRNCPY (TableName, ExistingTable->Signature, ACPI_NAME_SIZE); + strncpy (TableName, ExistingTable->Signature, ACPI_NAME_SIZE); *NewTable = OsGetTable (TableName); if (*NewTable) diff --git a/tests/aslts/bin/asltsrun b/tests/aslts/bin/asltsrun index 9dee1f9..8a4b020 100755 --- a/tests/aslts/bin/asltsrun +++ b/tests/aslts/bin/asltsrun @@ -888,7 +888,7 @@ if [ $ENABLELOG != 0 ]; then COMMONLOGFILE="$MULTIPATH/Summary" echo "# Trace and summary of $MULTINAME bunch of test runs." > "$COMMONLOGFILE" multi_log "" - multi_log "ASLTS_SYSTEM `uname -s` `uname -r` `uname -v` `uname -m` `uname -p` `uname -i` `uname -o`" + multi_log "ASLTS_SYSTEM `uname -a`" multi_log "" fi @@ -990,5 +990,3 @@ if [ $HAVE_LARGE_REF_CNT == yes ]; then fi exit $UTILSTATUS - - diff --git a/tests/aslts/src/runtime/collections/functional/constant/constants.asl b/tests/aslts/src/runtime/collections/functional/constant/constants.asl index 2d9d2c7..b159e53 100644 --- a/tests/aslts/src/runtime/collections/functional/constant/constants.asl +++ b/tests/aslts/src/runtime/collections/functional/constant/constants.asl @@ -55,7 +55,7 @@ Method(CST1,, Serialized) } } - if (LLess(Revision, 0x20050114)){ + if (LLess(Revision, 0x20140114)){ err(ts, z002, 4, 0, 0, Revision, 0x20050114) } @@ -63,7 +63,14 @@ Method(CST1,, Serialized) err(ts, z002, 5, 0, 0, Revision, 0x20500000) } - if (LNotEqual(\_REV, 5)){ - err(ts, z002, 6, 0, 0, \_REV, 5) + /* + * June, 2015: + * The _REV object is in the process of being deprecated, because + * other ACPI implementations permanently return 2. Thus, it + * has little or no value. Return 2 for compatibility with + * other ACPI implementations. + */ + if (LNotEqual(\_REV, 2)){ + err(ts, z002, 6, 0, 0, \_REV, 2) } } diff --git a/tests/misc/grammar.aml b/tests/misc/grammar.aml index 893915c..7ef8a4e 100755 Binary files a/tests/misc/grammar.aml and b/tests/misc/grammar.aml differ diff --git a/tests/misc/grammar.dsl b/tests/misc/grammar.dsl index 603def3..883232b 100755 --- a/tests/misc/grammar.dsl +++ b/tests/misc/grammar.dsl @@ -1,22 +1,22 @@ /* * Intel ACPI Component Architecture - * AML/ASL+ Disassembler version 20141107-32 [Nov 20 2014] - * Copyright (c) 2000 - 2014 Intel Corporation + * AML/ASL+ Disassembler version 20150515-32 + * Copyright (c) 2000 - 2015 Intel Corporation * * Disassembling to symbolic ASL+ operators * - * Disassembly of grammar.aml, Thu Nov 20 13:45:09 2014 + * Disassembly of grammar.aml, Thu Jun 04 10:01:34 2015 * * Original Table Header: * Signature "DSDT" - * Length 0x0000A8B3 (43187) + * Length 0x0000A9D4 (43476) * Revision 0x01 **** 32-bit table (V1), no 64-bit math support - * Checksum 0xFF + * Checksum 0x62 * OEM ID "Intel" * OEM Table ID "GRMTEST" * OEM Revision 0x20090511 (537462033) * Compiler ID "INTL" - * Compiler Version 0x20141107 (538185991) + * Compiler Version 0x20150515 (538248469) */ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) { @@ -752,7 +752,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) { Local0 = (0xFFFF0000 | Arg0) Local0 |= (Arg1 << 0x08) - Local0 -= Zero + Local0 = (Zero - Local0) } Else { @@ -1362,10 +1362,10 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Debug = "++++++++ Store (SizeOf (BUFO), Local0)" Local0 = SizeOf (BUFO) Debug = "++++++++ Concatenate (\"abd\", \"def\", Local0)" - Local0 = "abddef" + Concatenate ("abd", "def", Local0) Debug = Local0 Debug = "++++++++ Concatenate (\"abd\", 0x7B, Local0)" - Local0 = "abd0000007B" + Concatenate ("abd", 0x7B, Local0) Debug = Local0 Debug = "++++++++ Creating Event EVT2" Event (EVT2) @@ -1400,9 +1400,9 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (NUM1, 0, NotSerialized) { Debug = "++++++++ Add (0x12345678, 0x11111111, Local0)" - Local0 = 0x23456789 + Local0 = (0x12345678 + 0x11111111) Debug = "++++++++ Store (Add (0x12345678, 0x11111111), Local1)" - Local1 = 0x23456789 + Local1 = (0x12345678 + 0x11111111) Debug = "++++++++ Checking result from ADD" If ((Local0 != Local1)) { @@ -1410,9 +1410,9 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) } Debug = "++++++++ Subtract (0x87654321, 0x11111111, Local4)" - Local4 = 0x76543210 + Local4 = (0x87654321 - 0x11111111) Debug = "++++++++ Store (Subtract (0x87654321, 0x11111111), Local5)" - Local5 = 0x76543210 + Local5 = (0x87654321 - 0x11111111) Debug = "++++++++ Checking result from SUBTRACT" If ((Local4 != Local5)) { @@ -1420,9 +1420,9 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) } Debug = "++++++++ Multiply (33, 10, Local6)" - Local6 = 0x014A + Local6 = (0x21 * 0x0A) Debug = "++++++++ Store (Multiply (33, 10), Local7)" - Local7 = 0x014A + Local7 = (0x21 * 0x0A) Debug = "++++++++ Checking result from MULTIPLY" If ((Local6 != Local7)) { @@ -1432,7 +1432,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Debug = "++++++++ Divide (100, 9, Local1, Local2)" Divide (0x64, 0x09, Local1, Local2) Debug = "++++++++ Store (Divide (100, 9), Local3)" - Local3 = 0x0B + Local3 = (0x64 / 0x09) Debug = "++++++++ Checking (quotient) result from DIVIDE" If ((Local2 != Local3)) { @@ -1460,7 +1460,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) } Debug = "++++++++ ToBCD (0x1234, Local5)" - Local5 = 0x4660 + ToBCD (0x1234, Local5) Debug = "++++++++ FromBCD (Local5, Local6)" FromBCD (Local5, Local6) Debug = "++++++++ Return (Local6)" @@ -1515,56 +1515,56 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (BITZ, 0, NotSerialized) { Debug = "++++++++ FindSetLeftBit (0x00100100, Local0)" - Local0 = 0x15 + FindSetLeftBit (0x00100100, Local0) If ((Local0 != 0x15)) { ERR (One) } Debug = "++++++++ FindSetRightBit (0x00100100, Local1)" - Local1 = 0x09 + FindSetRightBit (0x00100100, Local1) If ((Local1 != 0x09)) { ERR (One) } Debug = "++++++++ And (0xF0F0F0F0, 0x11111111, Local2)" - Local2 = 0x10101010 + Local2 = (0xF0F0F0F0 & 0x11111111) If ((Local2 != 0x10101010)) { ERR (One) } Debug = "++++++++ NAnd (0xF0F0F0F0, 0x11111111, Local3)" - Local3 = 0xEFEFEFEF + NAnd (0xF0F0F0F0, 0x11111111, Local3) If ((Local3 != 0xEFEFEFEF)) { ERR (One) } Debug = "++++++++ Or (0x11111111, 0x22222222, Local4)" - Local4 = 0x33333333 + Local4 = (0x11111111 | 0x22222222) If ((Local4 != 0x33333333)) { ERR (One) } Debug = "++++++++ NOr (0x11111111, 0x22222222, Local5)" - Local5 = 0xCCCCCCCC + NOr (0x11111111, 0x22222222, Local5) If ((Local5 != 0xCCCCCCCC)) { ERR (One) } Debug = "++++++++ XOr (0x11113333, 0x22222222, Local6)" - Local6 = 0x33331111 + Local6 = (0x11113333 ^ 0x22222222) If ((Local6 != 0x33331111)) { ERR (One) } Debug = "++++++++ ShiftLeft (0x11112222, 2, Local7)" - Local7 = 0x44448888 + Local7 = (0x11112222 << 0x02) If ((Local7 != 0x44448888)) { ERR (One) @@ -1596,17 +1596,17 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Method (LOGS, 0, NotSerialized) { Debug = "++++++++ Store (LAnd (0xFFFFFFFF, 0x11111111), Local0)" - Local0 = Ones + Local0 = (Ones && 0x11111111) Debug = "++++++++ Store (LEqual (0xFFFFFFFF, 0x11111111), Local)" - Local1 = Zero + Local1 = (Ones == 0x11111111) Debug = "++++++++ Store (LGreater (0xFFFFFFFF, 0x11111111), Local2)" - Local2 = Ones + Local2 = (Ones > 0x11111111) Debug = "++++++++ Store (LGreaterEqual (0xFFFFFFFF, 0x11111111), Local3)" - Local3 = Ones + Local3 = (Ones >= 0x11111111) Debug = "++++++++ Store (LLess (0xFFFFFFFF, 0x11111111), Local4)" - Local4 = Zero + Local4 = (Ones < 0x11111111) Debug = "++++++++ Store (LLessEqual (0xFFFFFFFF, 0x11111111), Local5)" - Local5 = Zero + Local5 = (Ones <= 0x11111111) Debug = "++++++++ Store (LNot (0x31313131), Local6)" Local6 = 0x1111 Local7 = !Local6 @@ -1621,9 +1621,9 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) } Debug = "++++++++ Store (LNotEqual (0xFFFFFFFF, 0x11111111), Local7)" - Local7 = Ones + Local7 = (Ones != 0x11111111) Debug = "++++++++ Lor (0x0, 0x1)" - If (Ones) + If ((Zero || One)) { Debug = "+_+_+_+_+ Lor (0x0, 0x1) returned TRUE" } @@ -1652,23 +1652,23 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) } Debug = "++++++++ [LVL1] If (LGreater (0x2, 0x1))" - If (Ones) + If ((0x02 > One)) { Debug = "++++++++ [LVL2] If (LEqual (0x11111111, 0x22222222))" - If (Zero) + If ((0x11111111 == 0x22222222)) { Debug = "++++++++ ERROR: If (LEqual (0x11111111, 0x22222222)) returned TRUE" } Else { Debug = "++++++++ [LVL3] If (LNot (0x0))" - If (Ones) + If (!Zero) { Debug = "++++++++ [LVL4] If (LAnd (0xEEEEEEEE, 0x2))" - If (Ones) + If ((0xEEEEEEEE && 0x02)) { Debug = "++++++++ [LVL5] If (LLess (0x44444444, 0x3))" - If (Zero) + If ((0x44444444 < 0x03)) { Debug = "++++++++ ERROR: If (LLess (0x44444444, 0x3)) returned TRUE" } @@ -1682,23 +1682,23 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) } Debug = "++++++++ [LVL1] If (LGreater (0x2, 0x1))" - If (Ones) + If ((0x02 > One)) { Debug = "++++++++ [LVL2] If (LEqual (0x11111111, 0x22222222))" - If (Zero) + If ((0x11111111 == 0x22222222)) { Debug = "++++++++ ERROR: If (LEqual (0x11111111, 0x22222222)) returned TRUE" } Else { Debug = "++++++++ [LVL3] If (LNot (0x0))" - If (Ones) + If (!Zero) { Debug = "++++++++ [LVL4] If (LAnd (0xEEEEEEEE, 0x2))" - If (Ones) + If ((0xEEEEEEEE && 0x02)) { Debug = "++++++++ [LVL5] If (LLess (0x44444444, 0x3))" - If (Zero) + If ((0x44444444 < 0x03)) { Debug = "++++++++ ERROR: If (LLess (0x44444444, 0x3)) returned TRUE" } @@ -1916,7 +1916,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) { Debug = "++++++++ NoSave Test" Name (WRD, 0x1234) - If (One) + If ((0x03 & One)) { WRD = One } @@ -1925,7 +1925,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Return (One) } - If (Zero) + If ((0x04 & One)) { Return (0x02) } @@ -1934,7 +1934,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) WRD = 0x02 } - If (0xFFFFFFFE) + If (NAnd (0x03, One)) { WRD = 0x03 } @@ -1943,7 +1943,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Return (0x03) } - If (Zero) + If (NAnd (Ones, Ones)) { Return (0x04) } @@ -1952,7 +1952,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) WRD = 0x04 } - If (0xFFFFFFFE) + If (NOr (Zero, One)) { WRD = 0x05 } @@ -1961,7 +1961,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Return (0x05) } - If (Zero) + If (NOr (0xFFFFFFFE, One)) { Return (0x06) } @@ -1970,7 +1970,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) WRD = 0x06 } - If (0xFFFFFFFE) + If (~One) { WRD = 0x07 } @@ -1979,7 +1979,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Return (0x07) } - If (Zero) + If (~Ones) { Return (0x08) } @@ -1988,7 +1988,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) WRD = 0x08 } - If (0x03) + If ((0x03 | One)) { WRD = 0x09 } @@ -1997,7 +1997,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Return (0x09) } - If (Zero) + If ((Zero | Zero)) { Return (0x0A) } @@ -2006,7 +2006,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) WRD = 0x0A } - If (0x02) + If ((0x03 ^ One)) { WRD = 0x0B } @@ -2015,7 +2015,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Return (0x0B) } - If (Zero) + If ((0x03 ^ 0x03)) { Return (0x0C) } @@ -2024,7 +2024,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) WRD = 0x0C } - If (Ones) + If ((0x03 && 0x03)) { WRD = 0x15 } @@ -2033,7 +2033,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Return (0x15) } - If (Zero) + If ((0x03 && Zero)) { Return (0x16) } @@ -2042,7 +2042,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) WRD = 0x16 } - If (Zero) + If ((Zero && 0x03)) { Return (0x17) } @@ -2051,7 +2051,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) WRD = 0x17 } - If (Zero) + If ((Zero && Zero)) { Return (0x18) } @@ -2060,7 +2060,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) WRD = 0x18 } - If (Ones) + If ((0x03 == 0x03)) { WRD = 0x1F } @@ -2069,7 +2069,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Return (0x1F) } - If (Zero) + If ((One == 0x03)) { Return (0x20) } @@ -2078,7 +2078,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) WRD = 0x20 } - If (Ones) + If ((0x03 > One)) { WRD = 0x29 } @@ -2087,7 +2087,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Return (0x29) } - If (Zero) + If ((0x04 > 0x04)) { Return (0x2A) } @@ -2096,7 +2096,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) WRD = 0x2A } - If (Zero) + If ((One > 0x04)) { Return (0x2B) } @@ -2105,7 +2105,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) WRD = 0x2B } - If (Ones) + If ((0x03 >= One)) { WRD = 0x2C } @@ -2114,7 +2114,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Return (0x2C) } - If (Ones) + If ((0x03 >= 0x03)) { WRD = 0x2D } @@ -2123,7 +2123,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Return (0x2D) } - If (Zero) + If ((0x03 >= 0x04)) { Return (0x2E) } @@ -2132,7 +2132,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) WRD = 0x2E } - If (Ones) + If ((One < 0x03)) { WRD = 0x33 } @@ -2141,7 +2141,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Return (0x33) } - If (Zero) + If ((0x02 < 0x02)) { Return (0x34) } @@ -2150,7 +2150,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) WRD = 0x34 } - If (Zero) + If ((0x04 < 0x02)) { Return (0x35) } @@ -2159,7 +2159,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) WRD = 0x35 } - If (Ones) + If ((One <= 0x03)) { WRD = 0x36 } @@ -2168,7 +2168,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Return (0x36) } - If (Ones) + If ((0x02 <= 0x02)) { WRD = 0x37 } @@ -2177,7 +2177,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Return (0x37) } - If (Zero) + If ((0x04 <= 0x02)) { Return (0x38) } @@ -2186,7 +2186,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) WRD = 0x38 } - If (Ones) + If (!Zero) { WRD = 0x3D } @@ -2195,7 +2195,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Return (0x3D) } - If (Zero) + If (!One) { Return (0x3E) } @@ -2204,7 +2204,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) WRD = 0x3E } - If (Zero) + If ((0x03 != 0x03)) { Return (0x3F) } @@ -2213,7 +2213,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) WRD = 0x3F } - If (Ones) + If ((One != 0x03)) { WRD = 0x40 } @@ -2222,7 +2222,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Return (0x40) } - If (Ones) + If ((0x03 || One)) { WRD = 0x47 } @@ -2231,7 +2231,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Return (0x47) } - If (Ones) + If ((Zero || One)) { WRD = 0x48 } @@ -2240,7 +2240,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Return (0x48) } - If (Ones) + If ((0x03 || Zero)) { WRD = 0x49 } @@ -2249,7 +2249,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) Return (0x49) } - If (Zero) + If ((Zero || Zero)) { Return (0x4A) } @@ -5759,7 +5759,7 @@ DefinitionBlock ("grammar.aml", "DSDT", 1, "Intel", "GRMTEST", 0x20090511) { C19A = \_SB.C115 () ^^C19C._SCP (Zero) - Local1 = 0x0406 + Local1 = (0x0EB2 - 0x0AAC) Divide (Local1, 0x0A, Local0, Local2) \_SB.C005.C013.C058.C0AA (0x0E, Local2, Zero, Zero) C18D = DerefOf (Index (DerefOf (Index (C18C, C19A)), Zero))