From owner-svn-src-head@FreeBSD.ORG Thu Jun 27 00:16:58 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8B17FAB8; Thu, 27 Jun 2013 00:16:58 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7AC6D1865; Thu, 27 Jun 2013 00:16:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5R0Gw71018806; Thu, 27 Jun 2013 00:16:58 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5R0GtKe018785; Thu, 27 Jun 2013 00:16:55 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201306270016.r5R0GtKe018785@svn.freebsd.org> From: Jung-uk Kim Date: Thu, 27 Jun 2013 00:16:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r252279 - in head/sys/contrib/dev/acpica: . common compiler components/debugger components/disassembler components/events components/executer components/namespace components/resources c... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 00:16:58 -0000 Author: jkim Date: Thu Jun 27 00:16:54 2013 New Revision: 252279 URL: http://svnweb.freebsd.org/changeset/base/252279 Log: Merge ACPICA 20130626. Modified: head/sys/contrib/dev/acpica/acpica_prep.sh head/sys/contrib/dev/acpica/changes.txt (contents, props changed) head/sys/contrib/dev/acpica/common/dmrestag.c head/sys/contrib/dev/acpica/common/dmtable.c head/sys/contrib/dev/acpica/common/dmtbdump.c head/sys/contrib/dev/acpica/common/dmtbinfo.c head/sys/contrib/dev/acpica/compiler/aslcompile.c head/sys/contrib/dev/acpica/compiler/aslmessages.h head/sys/contrib/dev/acpica/compiler/asltree.c head/sys/contrib/dev/acpica/compiler/aslutils.c head/sys/contrib/dev/acpica/compiler/dtfield.c head/sys/contrib/dev/acpica/compiler/dtio.c head/sys/contrib/dev/acpica/compiler/dttable.c head/sys/contrib/dev/acpica/compiler/dttemplate.h head/sys/contrib/dev/acpica/compiler/dtutils.c head/sys/contrib/dev/acpica/compiler/preprocess.h head/sys/contrib/dev/acpica/compiler/prscan.c head/sys/contrib/dev/acpica/components/debugger/dbcmds.c head/sys/contrib/dev/acpica/components/debugger/dbdisply.c head/sys/contrib/dev/acpica/components/debugger/dbinput.c head/sys/contrib/dev/acpica/components/debugger/dbnames.c head/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c head/sys/contrib/dev/acpica/components/disassembler/dmopcode.c head/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c head/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c head/sys/contrib/dev/acpica/components/events/evgpeinit.c head/sys/contrib/dev/acpica/components/executer/exdump.c head/sys/contrib/dev/acpica/components/namespace/nsdump.c head/sys/contrib/dev/acpica/components/namespace/nsrepair2.c head/sys/contrib/dev/acpica/components/namespace/nsxfname.c head/sys/contrib/dev/acpica/components/resources/rsdump.c head/sys/contrib/dev/acpica/components/resources/rsutils.c head/sys/contrib/dev/acpica/components/tables/tbxfroot.c head/sys/contrib/dev/acpica/components/utilities/uteval.c head/sys/contrib/dev/acpica/components/utilities/utstring.c head/sys/contrib/dev/acpica/include/acdisasm.h head/sys/contrib/dev/acpica/include/acpixf.h head/sys/contrib/dev/acpica/include/actables.h head/sys/contrib/dev/acpica/include/actypes.h head/sys/contrib/dev/acpica/include/acutils.h Directory Properties: head/sys/contrib/dev/acpica/ (props changed) head/sys/contrib/dev/acpica/common/ (props changed) head/sys/contrib/dev/acpica/compiler/ (props changed) head/sys/contrib/dev/acpica/components/debugger/ (props changed) head/sys/contrib/dev/acpica/components/disassembler/ (props changed) head/sys/contrib/dev/acpica/components/events/ (props changed) head/sys/contrib/dev/acpica/components/executer/ (props changed) head/sys/contrib/dev/acpica/components/namespace/ (props changed) head/sys/contrib/dev/acpica/components/resources/ (props changed) head/sys/contrib/dev/acpica/components/tables/ (props changed) head/sys/contrib/dev/acpica/components/utilities/ (props changed) head/sys/contrib/dev/acpica/include/ (props changed) head/sys/contrib/dev/acpica/os_specific/ (props changed) Modified: head/sys/contrib/dev/acpica/acpica_prep.sh ============================================================================== --- head/sys/contrib/dev/acpica/acpica_prep.sh Thu Jun 27 00:08:25 2013 (r252278) +++ head/sys/contrib/dev/acpica/acpica_prep.sh Thu Jun 27 00:16:54 2013 (r252279) @@ -20,8 +20,8 @@ fulldirs="common compiler components inc stripdirs="generate libraries tests tools" stripfiles="Makefile README accygwin.h acefi.h achaiku.h acintel.h \ aclinux.h acmacosx.h acmsvc.h acnetbsd.h acos2.h acwin.h \ - acwin64.h new_table.txt oslinuxtbl.c osunixdir.c oswindir.c \ - oswintbl.c oswinxf.c readme.txt utclib.c" + acwin64.h new_table.txt osfreebsdtbl.c oslinuxtbl.c osunixdir.c \ + oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c" # include files to canonify src_headers="acapps.h acbuffer.h accommon.h acconfig.h acdebug.h \ Modified: head/sys/contrib/dev/acpica/changes.txt ============================================================================== --- head/sys/contrib/dev/acpica/changes.txt Thu Jun 27 00:08:25 2013 (r252278) +++ head/sys/contrib/dev/acpica/changes.txt Thu Jun 27 00:16:54 2013 (r252279) @@ -1,4 +1,60 @@ ---------------------------------------- +26 June 2013. Summary of changes for version 20130626: + +1) ACPICA kernel-resident subsystem: + +Fixed an issue with runtime repair of the _CST object. Null or invalid +elements were not always removed properly. Lv Zheng. + +Removed an arbitrary restriction of 256 GPEs per GPE block (such as the +FADT-defined GPE0 and GPE1). For GPE0, GPE1, and each GPE Block Device, +the maximum number of GPEs is 1016. Use of multiple GPE block devices +makes the system-wide number of GPEs essentially unlimited. + +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: 95.9K Code, 26.9K Data, 122.8K Total + Debug Version: 184.1K Code, 76.7K Data, 260.8K Total + Previous Release: + Non-Debug Version: 96.0K Code, 27.0K Data, 123.0K Total + Debug Version: 184.1K Code, 76.8K Data, 260.9K Total + + +2) iASL Compiler/Disassembler and Tools: + +Portable AcpiDump: Implemented full support for the Linux and FreeBSD +hosts. Now supports Linux, FreeBSD, and Windows. + +Disassembler: Added some missing types for the HEST and EINJ tables: "Set +Error Type With Address", "CMCI", "MCE", and "Flush Cacheline". + +iASL/Preprocessor: Implemented full support for nested +#if/#else/#elif/#endif blocks. Allows arbitrary depth of nested blocks. + +Disassembler: Expanded maximum output string length to 64K. Was 256 bytes +max. The original purpose of this constraint was to limit the amount of +debug output. However, the string function in question (UtPrintString) is +now used for the disassembler also, where 256 bytes is insufficient. +Reported by RehabMan@GitHub. + +iASL/DataTables: Fixed some problems and issues with compilation of DMAR +tables. ACPICA BZ 999. Lv Zheng. + +iASL: Fixed a couple of error exit issues that could result in a "Could +not delete " message during ASL compilation. + +AcpiDump: Allow "FADT" and "MADT" as valid table signatures, even though +the actual signatures for these tables are "FACP" and "APIC", +respectively. + +AcpiDump: Added support for multiple UEFI tables. Only SSDT and UEFI +tables are allowed to have multiple instances. + +---------------------------------------- 17 May 2013. Summary of changes for version 20130517: 1) ACPICA kernel-resident subsystem: Modified: head/sys/contrib/dev/acpica/common/dmrestag.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmrestag.c Thu Jun 27 00:08:25 2013 (r252278) +++ head/sys/contrib/dev/acpica/common/dmrestag.c Thu Jun 27 00:16:54 2013 (r252279) @@ -666,6 +666,7 @@ AcpiGetTagPathname ( Status = AcpiNsBuildExternalPath (BufferNode, RequiredSize, Pathname); if (ACPI_FAILURE (Status)) { + ACPI_FREE (Pathname); return (NULL); } Modified: head/sys/contrib/dev/acpica/common/dmtable.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtable.c Thu Jun 27 00:08:25 2013 (r252278) +++ head/sys/contrib/dev/acpica/common/dmtable.c Thu Jun 27 00:16:54 2013 (r252279) @@ -100,6 +100,7 @@ static const char *AcpiDmEinjA "Execute Operation", "Check Busy Status", "Get Command Status", + "Set Error Type With Address", "Unknown Action" }; @@ -110,6 +111,7 @@ static const char *AcpiDmEinjI "Write Register", "Write Register Value", "Noop", + "Flush Cacheline", "Unknown Instruction" }; @@ -180,6 +182,8 @@ static const char *AcpiDmHestN "Local Interrupt", "SCI", "NMI", + "CMCI", /* ACPI 5.0 */ + "MCE", /* ACPI 5.0 */ "Unknown Notify Type" /* Reserved */ }; @@ -744,6 +748,11 @@ AcpiDmDumpTable ( ByteLength = 8; break; + case ACPI_DMT_BUF10: + + ByteLength = 10; + break; + case ACPI_DMT_BUF16: case ACPI_DMT_UUID: @@ -862,6 +871,7 @@ AcpiDmDumpTable ( break; case ACPI_DMT_BUF7: + case ACPI_DMT_BUF10: case ACPI_DMT_BUF16: case ACPI_DMT_BUF128: /* Modified: head/sys/contrib/dev/acpica/common/dmtbdump.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtbdump.c Thu Jun 27 00:08:25 2013 (r252278) +++ head/sys/contrib/dev/acpica/common/dmtbdump.c Thu Jun 27 00:16:54 2013 (r252279) @@ -872,6 +872,7 @@ AcpiDmDumpDmar ( { return; } + AcpiOsPrintf ("\n"); switch (SubTable->Type) { @@ -924,6 +925,7 @@ AcpiDmDumpDmar ( { return; } + AcpiOsPrintf ("\n"); /* Dump the PCI Path entries for this device scope */ @@ -941,6 +943,7 @@ AcpiDmDumpDmar ( PathOffset += 2; PciPath += 2; + AcpiOsPrintf ("\n"); } /* Point to next device scope entry */ Modified: head/sys/contrib/dev/acpica/common/dmtbinfo.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtbinfo.c Thu Jun 27 00:08:25 2013 (r252278) +++ head/sys/contrib/dev/acpica/common/dmtbinfo.c Thu Jun 27 00:16:54 2013 (r252279) @@ -780,6 +780,7 @@ ACPI_DMTABLE_INFO AcpiDmTableI { {ACPI_DMT_UINT8, ACPI_DMAR_OFFSET (Width), "Host Address Width", 0}, {ACPI_DMT_UINT8, ACPI_DMAR_OFFSET (Flags), "Flags", 0}, + {ACPI_DMT_BUF10, ACPI_DMAR_OFFSET (Reserved[0]), "Reserved", 0}, ACPI_DMT_TERMINATOR }; Modified: head/sys/contrib/dev/acpica/compiler/aslcompile.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompile.c Thu Jun 27 00:08:25 2013 (r252278) +++ head/sys/contrib/dev/acpica/compiler/aslcompile.c Thu Jun 27 00:16:54 2013 (r252279) @@ -966,7 +966,19 @@ CmCleanupAndExit ( /* Close all open files */ - Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .i file is same as source file */ + /* + * Take care with the preprocessor file (.i), 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. + */ + if (Gbl_Files[ASL_FILE_PREPROCESSOR].Handle == + Gbl_Files[ASL_FILE_INPUT].Handle) + { + Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; + } + + /* Close the standard I/O files */ for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++) { Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmessages.h Thu Jun 27 00:08:25 2013 (r252278) +++ head/sys/contrib/dev/acpica/compiler/aslmessages.h Thu Jun 27 00:16:54 2013 (r252279) @@ -248,7 +248,7 @@ typedef enum ASL_MSG_TOO_MANY_ARGUMENTS, ASL_MSG_UNKNOWN_DIRECTIVE, ASL_MSG_UNKNOWN_PRAGMA, - + ASL_MSG_WARNING_DIRECTIVE, /* These messages are used by the data table compiler only */ @@ -433,6 +433,7 @@ char *AslMessages /* ASL_MSG_TOO_MANY_ARGUMENTS */ "Too many macro arguments", /* ASL_MSG_UNKNOWN_DIRECTIVE */ "Unknown directive", /* ASL_MSG_UNKNOWN_PRAGMA */ "Unknown pragma", +/* ASL_MSG_WARNING_DIRECTIVE */ "#warning", /* Table compiler */ Modified: head/sys/contrib/dev/acpica/compiler/asltree.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asltree.c Thu Jun 27 00:08:25 2013 (r252278) +++ head/sys/contrib/dev/acpica/compiler/asltree.c Thu Jun 27 00:16:54 2013 (r252279) @@ -823,6 +823,7 @@ TrLinkChildren ( { AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Child, "Child node list invalid"); + va_end(ap); return (Op); } @@ -869,8 +870,8 @@ TrLinkChildren ( } PrevChild = Child; } - va_end(ap); + va_end(ap); DbgPrint (ASL_PARSE_OUTPUT, "\n\n"); return (Op); } Modified: head/sys/contrib/dev/acpica/compiler/aslutils.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslutils.c Thu Jun 27 00:08:25 2013 (r252278) +++ head/sys/contrib/dev/acpica/compiler/aslutils.c Thu Jun 27 00:16:54 2013 (r252279) @@ -353,8 +353,6 @@ DbgPrint ( va_list Args; - va_start (Args, Fmt); - if (!Gbl_DebugFlag) { return; @@ -366,6 +364,7 @@ DbgPrint ( return; } + va_start (Args, Fmt); (void) vfprintf (stderr, Fmt, Args); va_end (Args); return; Modified: head/sys/contrib/dev/acpica/compiler/dtfield.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/dtfield.c Thu Jun 27 00:08:25 2013 (r252278) +++ head/sys/contrib/dev/acpica/compiler/dtfield.c Thu Jun 27 00:16:54 2013 (r252279) @@ -467,12 +467,13 @@ DtCompileBuffer ( if (ACPI_FAILURE (Status)) { DtError (ASL_ERROR, ASL_MSG_BUFFER_ELEMENT, Field, MsgBuffer); - return (ByteLength - Count); + goto Exit; } Buffer[i] = (UINT8) Value; } +Exit: ACPI_FREE (StringValue); return (ByteLength - Count); } Modified: head/sys/contrib/dev/acpica/compiler/dtio.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/dtio.c Thu Jun 27 00:08:25 2013 (r252278) +++ head/sys/contrib/dev/acpica/compiler/dtio.c Thu Jun 27 00:16:54 2013 (r252279) @@ -287,31 +287,21 @@ DtParseLine ( while (Start < Colon) { - if (*Start == ' ') - { - Start++; - continue; - } - - /* Found left bracket, go to the right bracket */ - if (*Start == '[') { + /* Found left bracket, go to the right bracket */ + while (Start < Colon && *Start != ']') { Start++; } - - if (Start == Colon) - { - break; - } - - Start++; - continue; + } + else if (*Start != ' ') + { + break; } - break; + Start++; } /* @@ -1138,4 +1128,5 @@ DtWriteTableToListing ( AcpiUtDumpBuffer (Buffer, Gbl_TableLength, DB_BYTE_DISPLAY, 0); AcpiOsRedirectOutput (stdout); + ACPI_FREE (Buffer); } Modified: head/sys/contrib/dev/acpica/compiler/dttable.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/dttable.c Thu Jun 27 00:08:25 2013 (r252278) +++ head/sys/contrib/dev/acpica/compiler/dttable.c Thu Jun 27 00:16:54 2013 (r252279) @@ -541,8 +541,9 @@ DtCompileDmar ( DT_FIELD *SubtableStart; ACPI_DMTABLE_INFO *InfoTable; ACPI_DMAR_HEADER *DmarHeader; - UINT8 *ReservedBuffer; - UINT32 ReservedSize; + ACPI_DMAR_DEVICE_SCOPE *DmarDeviceScope; + UINT32 DeviceScopeLength; + UINT32 PciPathLength; Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable, TRUE); @@ -553,17 +554,7 @@ DtCompileDmar ( ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); - - /* DMAR Reserved area */ - - ReservedSize = (UINT32) sizeof (((ACPI_TABLE_DMAR *) NULL)->Reserved); - ReservedBuffer = UtLocalCalloc (ReservedSize); - - DtCreateSubtable (ReservedBuffer, ReservedSize, &Subtable); - - ACPI_FREE (ReservedBuffer); - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); while (*PFieldList) { @@ -621,10 +612,13 @@ DtCompileDmar ( ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); /* Optional Device Scope subtables */ - while (*PFieldList) + DeviceScopeLength = DmarHeader->Length - Subtable->Length - + ParentTable->Length; + while (DeviceScopeLength) { Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope, &Subtable, FALSE); @@ -637,9 +631,12 @@ DtCompileDmar ( DtInsertSubtable (ParentTable, Subtable); DtPushSubtable (Subtable); + DmarDeviceScope = ACPI_CAST_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable->Buffer); + /* Optional PCI Paths */ - while (*PFieldList) + PciPathLength = DmarDeviceScope->Length - Subtable->Length; + while (PciPathLength) { Status = DtCompileTable (PFieldList, TableInfoDmarPciPath, &Subtable, FALSE); @@ -651,10 +648,15 @@ DtCompileDmar ( ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); + PciPathLength -= Subtable->Length; } + + DtPopSubtable (); + DeviceScopeLength -= DmarDeviceScope->Length; } DtPopSubtable (); + DtPopSubtable (); } return (AE_OK); Modified: head/sys/contrib/dev/acpica/compiler/dttemplate.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/dttemplate.h Thu Jun 27 00:08:25 2013 (r252278) +++ head/sys/contrib/dev/acpica/compiler/dttemplate.h Thu Jun 27 00:16:54 2013 (r252279) @@ -188,22 +188,22 @@ const unsigned char TemplateDbgp[] = const unsigned char TemplateDmar[] = { 0x44,0x4D,0x41,0x52,0x8C,0x00,0x00,0x00, /* 00000000 "DMAR...." */ - 0x01,0x15,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x01,0x03,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x28,0x05,0x10,0x20,0x2F,0x01,0x00,0x00, /* 00000020 "(.. /..." */ + 0x17,0x05,0x13,0x20,0x2F,0x01,0x00,0x00, /* 00000020 "... /..." */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ 0x00,0x00,0x18,0x00,0x01,0x00,0x00,0x00, /* 00000030 "........" */ - 0x00,0x00,0x02,0xFD,0x00,0x00,0x00,0x00, /* 00000038 "........" */ - 0x03,0x08,0x00,0x00,0x08,0xF0,0x1F,0x07, /* 00000040 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ + 0x03,0x08,0x00,0x00,0x08,0x00,0x00,0x01, /* 00000040 "........" */ 0x01,0x00,0x20,0x00,0x00,0x00,0x00,0x00, /* 00000048 ".. ....." */ - 0x00,0x10,0xC2,0x78,0x00,0x00,0x00,0x00, /* 00000050 "...x...." */ - 0xFF,0x3F,0xC2,0x78,0x00,0x00,0x00,0x00, /* 00000058 ".?.x...." */ - 0x01,0x08,0x00,0x00,0x00,0x00,0x1D,0x00, /* 00000060 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */ + 0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ + 0x01,0x08,0x00,0x00,0x00,0x00,0x00,0x02, /* 00000060 "........" */ 0x02,0x00,0x10,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */ - 0x02,0x08,0x00,0x00,0x00,0x00,0x01,0x00, /* 00000070 "........" */ + 0x02,0x08,0x00,0x00,0x00,0x00,0x00,0x03, /* 00000070 "........" */ 0x03,0x00,0x14,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */ - 0x00,0x00,0x02,0xFD,0x00,0x00,0x00,0x00, /* 00000080 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */ 0x00,0x00,0x00,0x00 /* 00000088 "...." */ }; Modified: head/sys/contrib/dev/acpica/compiler/dtutils.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/dtutils.c Thu Jun 27 00:08:25 2013 (r252278) +++ head/sys/contrib/dev/acpica/compiler/dtutils.c Thu Jun 27 00:16:54 2013 (r252279) @@ -397,6 +397,7 @@ DtGetFieldType ( case ACPI_DMT_BUFFER: case ACPI_DMT_BUF7: + case ACPI_DMT_BUF10: case ACPI_DMT_BUF16: case ACPI_DMT_BUF128: case ACPI_DMT_PCI_PATH: @@ -630,6 +631,11 @@ DtGetFieldLength ( } break; + case ACPI_DMT_BUF10: + + ByteLength = 10; + break; + case ACPI_DMT_BUF16: case ACPI_DMT_UUID: Modified: head/sys/contrib/dev/acpica/compiler/preprocess.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/preprocess.h Thu Jun 27 00:08:25 2013 (r252278) +++ head/sys/contrib/dev/acpica/compiler/preprocess.h Thu Jun 27 00:16:54 2013 (r252279) @@ -124,6 +124,17 @@ typedef struct pr_file_node } PR_FILE_NODE; +#define MAX_ARGUMENT_LENGTH 24 + +typedef struct directive_info +{ + struct directive_info *Next; + char Argument[MAX_ARGUMENT_LENGTH]; + int Directive; + BOOLEAN IgnoringThisCodeBlock; + +} DIRECTIVE_INFO; + /* * Globals @@ -136,12 +147,13 @@ PR_EXTERN char PR_INIT_ PR_EXTERN char PR_INIT_GLOBAL (*Gbl_MacroTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */ PR_EXTERN char PR_INIT_GLOBAL (*Gbl_ExpressionTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */ -PR_EXTERN PR_FILE_NODE *Gbl_InputFileList; -PR_EXTERN PR_DEFINE_INFO PR_INIT_GLOBAL (*Gbl_DefineList, NULL); PR_EXTERN UINT32 Gbl_PreprocessorLineNumber; PR_EXTERN int Gbl_IfDepth; +PR_EXTERN PR_FILE_NODE *Gbl_InputFileList; +PR_EXTERN PR_DEFINE_INFO PR_INIT_GLOBAL (*Gbl_DefineList, NULL); PR_EXTERN BOOLEAN PR_INIT_GLOBAL (Gbl_PreprocessorError, FALSE); - +PR_EXTERN BOOLEAN PR_INIT_GLOBAL (Gbl_IgnoringThisCodeBlock, FALSE); +PR_EXTERN DIRECTIVE_INFO PR_INIT_GLOBAL (*Gbl_DirectiveStack, NULL); /* * prscan - Preprocessor entry @@ -158,7 +170,7 @@ void PrTerminatePreprocessor ( void); -BOOLEAN +void PrDoPreprocess ( void); Modified: head/sys/contrib/dev/acpica/compiler/prscan.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/prscan.c Thu Jun 27 00:08:25 2013 (r252278) +++ head/sys/contrib/dev/acpica/compiler/prscan.c Thu Jun 27 00:16:54 2013 (r252279) @@ -65,13 +65,27 @@ PrPreprocessInputFile ( static void PrDoDirective ( char *DirectiveToken, - char **Next, - BOOLEAN *IgnoringThisCodeBlock); + char **Next); static int PrMatchDirective ( char *Directive); +static void +PrPushDirective ( + int Directive, + char *Argument); + +static ACPI_STATUS +PrPopDirective ( + void); + +static void +PrDbgPrint ( + char *Action, + char *DirectiveName); + + /* * Supported preprocessor directives */ @@ -156,11 +170,16 @@ PrInitializeGlobals ( { /* Init globals */ - Gbl_IfDepth = 0; Gbl_InputFileList = NULL; Gbl_CurrentLineNumber = 0; Gbl_PreprocessorLineNumber = 1; Gbl_PreprocessorError = FALSE; + + /* These are used to track #if/#else blocks (possibly nested) */ + + Gbl_IfDepth = 0; + Gbl_IgnoringThisCodeBlock = FALSE; + Gbl_DirectiveStack = NULL; } @@ -207,7 +226,7 @@ PrTerminatePreprocessor ( * * PARAMETERS: None * - * RETURN: Error Status. TRUE if error, FALSE if OK. + * RETURN: None * * DESCRIPTION: Main entry point for the iASL Preprocessor. Input file must * be already open. Handles multiple input files via the @@ -215,7 +234,7 @@ PrTerminatePreprocessor ( * ******************************************************************************/ -BOOLEAN +void PrDoPreprocess ( void) { @@ -237,20 +256,7 @@ PrDoPreprocess ( } while (MoreInputFiles); - - /* - * TBD: is this necessary? (Do we abort on any preprocessing errors?) - */ - if (Gbl_PreprocessorError) - { - /* TBD: can't use source_output file for preprocessor error reporting */ - - Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle = NULL; - PrTerminatePreprocessor (); - return (TRUE); - } - - /* Point compiler input to the new preprocessor file (.i) */ + /* Point compiler input to the new preprocessor output file (.i) */ FlCloseFile (ASL_FILE_INPUT); Gbl_Files[ASL_FILE_INPUT].Handle = Gbl_Files[ASL_FILE_PREPROCESSOR].Handle; @@ -262,7 +268,6 @@ PrDoPreprocess ( Gbl_CurrentLineNumber = 1; DbgPrint (ASL_DEBUG_OUTPUT, "Preprocessing phase complete \n\n"); - return (FALSE); } @@ -290,7 +295,6 @@ PrPreprocessInputFile ( char *ReplaceString; PR_DEFINE_INFO *DefineInfo; ACPI_SIZE TokenOffset; - BOOLEAN IgnoringThisCodeBlock = FALSE; char *Next; int OffsetAdjust; @@ -320,7 +324,7 @@ PrPreprocessInputFile ( /* Execute the directive, do not write line to output file */ - PrDoDirective (Token, &Next, &IgnoringThisCodeBlock); + PrDoDirective (Token, &Next); continue; } @@ -329,7 +333,7 @@ PrPreprocessInputFile ( * FALSE, ignore the line and do not write it to the output file. * This continues until an #else or #endif is encountered. */ - if (IgnoringThisCodeBlock == TRUE) + if (Gbl_IgnoringThisCodeBlock) { continue; } @@ -416,12 +420,8 @@ PrPreprocessInputFile ( * * PARAMETERS: Directive - Pointer to directive name token * Next - "Next" buffer from GetNextToken - * IgnoringThisCodeBlock - Where the "ignore code" flag is - * returned. * - * RETURN: IgnoringThisCodeBlock: Set to TRUE if we are skipping the FALSE - * part of an #if or #else block. Set to FALSE when the - * corresponding #else or #endif is encountered. + * RETURN: None. * * DESCRIPTION: Main processing for all preprocessor directives * @@ -430,8 +430,7 @@ PrPreprocessInputFile ( static void PrDoDirective ( char *DirectiveToken, - char **Next, - BOOLEAN *IgnoringThisCodeBlock) + char **Next) { char *Token = Gbl_MainTokenBuffer; char *Token2; @@ -459,14 +458,28 @@ PrDoDirective ( return; } - /* TBD: Need a faster way to do this: */ - - if ((Directive == PR_DIRECTIVE_ELIF) || - (Directive == PR_DIRECTIVE_ELSE) || - (Directive == PR_DIRECTIVE_ENDIF)) + /* + * If we are currently ignoring this block and we encounter a #else or + * #elif, we must ignore their blocks also if the parent block is also + * being ignored. + */ + if (Gbl_IgnoringThisCodeBlock) { - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "Begin #%s\n", - Gbl_CurrentLineNumber, Gbl_DirectiveInfo[Directive].Name); + switch (Directive) + { + case PR_DIRECTIVE_ELSE: + case PR_DIRECTIVE_ELIF: + + if (Gbl_DirectiveStack && Gbl_DirectiveStack->IgnoringThisCodeBlock) + { + PrDbgPrint ("Ignoring", Gbl_DirectiveInfo[Directive].Name); + return; + } + break; + + default: + break; + } } /* @@ -476,57 +489,54 @@ PrDoDirective ( */ switch (Directive) { + case PR_DIRECTIVE_ELSE: + + Gbl_IgnoringThisCodeBlock = !(Gbl_IgnoringThisCodeBlock); + PrDbgPrint ("Executing", "else block"); + return; + case PR_DIRECTIVE_ELIF: - *IgnoringThisCodeBlock = !(*IgnoringThisCodeBlock); - if (*IgnoringThisCodeBlock == TRUE) + Gbl_IgnoringThisCodeBlock = !(Gbl_IgnoringThisCodeBlock); + Directive = PR_DIRECTIVE_IF; + + if (Gbl_IgnoringThisCodeBlock == TRUE) { /* Not executing the ELSE part -- all done here */ + PrDbgPrint ("Ignoring", "elif block"); return; } - /* Will execute the ELSE..IF part */ + /* + * After this, we will execute the IF part further below. + * First, however, pop off the original #if directive. + */ + if (ACPI_FAILURE (PrPopDirective ())) + { + PrError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, + THIS_TOKEN_OFFSET (DirectiveToken)); + } - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID - "#elif - Executing else block\n", - Gbl_CurrentLineNumber); - Directive = PR_DIRECTIVE_IF; + PrDbgPrint ("Executing", "elif block"); break; - case PR_DIRECTIVE_ELSE: + case PR_DIRECTIVE_ENDIF: - *IgnoringThisCodeBlock = !(*IgnoringThisCodeBlock); - return; + PrDbgPrint ("Executing", "endif"); - case PR_DIRECTIVE_ENDIF: + /* Pop the owning #if/#ifdef/#ifndef */ - *IgnoringThisCodeBlock = FALSE; - Gbl_IfDepth--; - if (Gbl_IfDepth < 0) + if (ACPI_FAILURE (PrPopDirective ())) { PrError (ASL_ERROR, ASL_MSG_ENDIF_MISMATCH, THIS_TOKEN_OFFSET (DirectiveToken)); - Gbl_IfDepth = 0; } return; default: - break; } - /* - * At this point, if we are ignoring the current code block, - * do not process any more directives (i.e., ignore them also.) - */ - if (*IgnoringThisCodeBlock == TRUE) - { - return; - } - - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "Begin #%s\n", - Gbl_CurrentLineNumber, Gbl_DirectiveInfo[Directive].Name); - /* Most directives have at least one argument */ if (Gbl_DirectiveInfo[Directive].ArgCount == 1) @@ -538,8 +548,85 @@ PrDoDirective ( } } + /* + * At this point, if we are ignoring the current code block, + * do not process any more directives (i.e., ignore them also.) + * For "if" style directives, open/push a new block anyway. We + * must do this to keep track of #endif directives + */ + if (Gbl_IgnoringThisCodeBlock) + { + switch (Directive) + { + case PR_DIRECTIVE_IF: + case PR_DIRECTIVE_IFDEF: + case PR_DIRECTIVE_IFNDEF: + + PrPushDirective (Directive, Token); + PrDbgPrint ("Ignoring", Gbl_DirectiveInfo[Directive].Name); + break; + + default: + break; + } + + return; + } + + /* + * Execute the directive + */ + PrDbgPrint ("Begin execution", Gbl_DirectiveInfo[Directive].Name); + switch (Directive) { + case PR_DIRECTIVE_IF: + + TokenOffset = Token - Gbl_MainTokenBuffer; + + /* Need to expand #define macros in the expression string first */ + + Status = PrResolveIntegerExpression ( + &Gbl_CurrentLineBuffer[TokenOffset-1], &Value); + if (ACPI_FAILURE (Status)) + { + return; + } + + PrPushDirective (Directive, Token); + if (!Value) + { + Gbl_IgnoringThisCodeBlock = TRUE; + } + + DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID + "Resolved #if: %8.8X%8.8X %s\n", + Gbl_CurrentLineNumber, ACPI_FORMAT_UINT64 (Value), + Gbl_IgnoringThisCodeBlock ? "" : ""); + break; + + case PR_DIRECTIVE_IFDEF: + + PrPushDirective (Directive, Token); + if (!PrMatchDefine (Token)) + { + Gbl_IgnoringThisCodeBlock = TRUE; + } + + PrDbgPrint ("Evaluated", "ifdef"); + break; + + case PR_DIRECTIVE_IFNDEF: + + PrPushDirective (Directive, Token); + if (PrMatchDefine (Token)) + { + Gbl_IgnoringThisCodeBlock = TRUE; + } + + PrDbgPrint ("Evaluated", "ifndef"); + break; + case PR_DIRECTIVE_DEFINE: /* * By definition, if first char after the name is a paren, @@ -595,64 +682,15 @@ PrDoDirective ( case PR_DIRECTIVE_ERROR: - /* TBD compiler should abort */ /* Note: No macro expansion */ PrError (ASL_ERROR, ASL_MSG_ERROR_DIRECTIVE, THIS_TOKEN_OFFSET (Token)); - break; - - case PR_DIRECTIVE_IF: - - TokenOffset = Token - Gbl_MainTokenBuffer; - - /* Need to expand #define macros in the expression string first */ - - Status = PrResolveIntegerExpression ( - &Gbl_CurrentLineBuffer[TokenOffset-1], &Value); - if (ACPI_FAILURE (Status)) - { - return; - } - - if (!Value) - { - *IgnoringThisCodeBlock = TRUE; - } - - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID - "Resolved #if: %8.8X%8.8X %s\n", - Gbl_CurrentLineNumber, ACPI_FORMAT_UINT64 (Value), - *IgnoringThisCodeBlock ? "" : ""); - - Gbl_IfDepth++; - break; - - case PR_DIRECTIVE_IFDEF: - - if (!PrMatchDefine (Token)) - { - *IgnoringThisCodeBlock = TRUE; - } - - Gbl_IfDepth++; - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID - "Start #ifdef %s\n", Gbl_CurrentLineNumber, - *IgnoringThisCodeBlock ? "" : ""); - break; - - case PR_DIRECTIVE_IFNDEF: - - if (PrMatchDefine (Token)) - { - *IgnoringThisCodeBlock = TRUE; - } - Gbl_IfDepth++; - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID - "Start #ifndef %2.2X\n", Gbl_CurrentLineNumber, - *IgnoringThisCodeBlock, Gbl_CurrentLineNumber); - break; + Gbl_SourceLine = 0; + Gbl_NextError = Gbl_ErrorLog; + CmCleanupAndExit (); + exit(1); case PR_DIRECTIVE_INCLUDE: @@ -738,7 +776,7 @@ PrDoDirective ( case PR_DIRECTIVE_WARNING: - PrError (ASL_WARNING, ASL_MSG_ERROR_DIRECTIVE, + PrError (ASL_WARNING, ASL_MSG_WARNING_DIRECTIVE, THIS_TOKEN_OFFSET (Token)); break; @@ -753,7 +791,6 @@ PrDoDirective ( return; - SyntaxError: PrError (ASL_ERROR, ASL_MSG_DIRECTIVE_SYNTAX, @@ -796,3 +833,130 @@ PrMatchDirective ( return (ASL_DIRECTIVE_NOT_FOUND); /* Command not recognized */ } + + +/******************************************************************************* + * + * FUNCTION: PrPushDirective + * + * PARAMETERS: Directive - Encoded directive ID + * Argument - String containing argument to the + * directive + * + * RETURN: None + * + * DESCRIPTION: Push an item onto the directive stack. Used for processing + * nested #if/#else type conditional compilation directives. + * Specifically: Used on detection of #if/#ifdef/#ifndef to open + * a block. + * + ******************************************************************************/ + +static void +PrPushDirective ( + int Directive, + char *Argument) +{ + DIRECTIVE_INFO *Info; + + + /* Allocate and populate a stack info item */ + + Info = ACPI_ALLOCATE (sizeof (DIRECTIVE_INFO)); + + Info->Next = Gbl_DirectiveStack; + Info->Directive = Directive; + Info->IgnoringThisCodeBlock = Gbl_IgnoringThisCodeBlock; + strncpy (Info->Argument, Argument, MAX_ARGUMENT_LENGTH); + + DbgPrint (ASL_DEBUG_OUTPUT, + "Pr(%.4u) - [%u %s] %*s Pushed [#%s %s]: IgnoreFlag = %s\n", + Gbl_CurrentLineNumber, Gbl_IfDepth, + Gbl_IgnoringThisCodeBlock ? "I" : "E", + Gbl_IfDepth * 4, " ", + Gbl_DirectiveInfo[Directive].Name, + Argument, Gbl_IgnoringThisCodeBlock ? "TRUE" : "FALSE"); + + /* Push new item */ + + Gbl_DirectiveStack = Info; + Gbl_IfDepth++; +} + + +/******************************************************************************* + * + * FUNCTION: PrPopDirective + * + * PARAMETERS: None + * + * RETURN: Status. Error if the stack is empty. + * + * DESCRIPTION: Pop an item off the directive stack. Used for processing + * nested #if/#else type conditional compilation directives. + * Specifically: Used on detection of #elif and #endif to remove + * the original #if/#ifdef/#ifndef from the stack and close *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***