svn commit: r256655 - in vendor-sys/acpica/dist: . generate/unix generate/unix/acpiexec generate/unix/iasl source/common source/compiler source/components/debugger source/components/events source/c...
Jung-uk Kim
jkim at FreeBSD.org
Thu Oct 17 00:06:45 UTC 2013
Author: jkim
Date: Thu Oct 17 00:06:42 2013
New Revision: 256655
URL: http://svnweb.freebsd.org/changeset/base/256655
Log:
Import ACPICA 20130927.
Added:
vendor-sys/acpica/dist/source/common/acgetline.c (contents, props changed)
Modified:
vendor-sys/acpica/dist/changes.txt
vendor-sys/acpica/dist/generate/unix/Makefile.config
vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile
vendor-sys/acpica/dist/generate/unix/iasl/Makefile
vendor-sys/acpica/dist/source/common/adfile.c
vendor-sys/acpica/dist/source/common/dmextern.c
vendor-sys/acpica/dist/source/compiler/aslcompiler.h
vendor-sys/acpica/dist/source/compiler/aslerror.c
vendor-sys/acpica/dist/source/compiler/aslmain.c
vendor-sys/acpica/dist/source/compiler/asloptions.c
vendor-sys/acpica/dist/source/compiler/aslstartup.c
vendor-sys/acpica/dist/source/components/debugger/dbexec.c
vendor-sys/acpica/dist/source/components/debugger/dbfileio.c
vendor-sys/acpica/dist/source/components/debugger/dbhistry.c
vendor-sys/acpica/dist/source/components/debugger/dbinput.c
vendor-sys/acpica/dist/source/components/debugger/dbnames.c
vendor-sys/acpica/dist/source/components/debugger/dbxface.c
vendor-sys/acpica/dist/source/components/events/evgpe.c
vendor-sys/acpica/dist/source/components/events/evxface.c
vendor-sys/acpica/dist/source/components/events/evxfevnt.c
vendor-sys/acpica/dist/source/components/events/evxfgpe.c
vendor-sys/acpica/dist/source/components/events/evxfregn.c
vendor-sys/acpica/dist/source/components/executer/exstore.c
vendor-sys/acpica/dist/source/components/hardware/hwtimer.c
vendor-sys/acpica/dist/source/components/hardware/hwxface.c
vendor-sys/acpica/dist/source/components/hardware/hwxfsleep.c
vendor-sys/acpica/dist/source/components/namespace/nsdump.c
vendor-sys/acpica/dist/source/components/namespace/nsxfeval.c
vendor-sys/acpica/dist/source/components/namespace/nsxfname.c
vendor-sys/acpica/dist/source/components/namespace/nsxfobj.c
vendor-sys/acpica/dist/source/components/resources/rsxface.c
vendor-sys/acpica/dist/source/components/tables/tbprint.c
vendor-sys/acpica/dist/source/components/tables/tbxface.c
vendor-sys/acpica/dist/source/components/tables/tbxfload.c
vendor-sys/acpica/dist/source/components/utilities/utalloc.c
vendor-sys/acpica/dist/source/components/utilities/utdebug.c
vendor-sys/acpica/dist/source/components/utilities/utexcep.c
vendor-sys/acpica/dist/source/components/utilities/utglobal.c
vendor-sys/acpica/dist/source/components/utilities/utstring.c
vendor-sys/acpica/dist/source/components/utilities/uttrack.c
vendor-sys/acpica/dist/source/components/utilities/utxface.c
vendor-sys/acpica/dist/source/components/utilities/utxferror.c
vendor-sys/acpica/dist/source/components/utilities/utxfinit.c
vendor-sys/acpica/dist/source/include/acconfig.h
vendor-sys/acpica/dist/source/include/acdebug.h
vendor-sys/acpica/dist/source/include/aclocal.h
vendor-sys/acpica/dist/source/include/acmacros.h
vendor-sys/acpica/dist/source/include/acnames.h
vendor-sys/acpica/dist/source/include/acpiosxf.h
vendor-sys/acpica/dist/source/include/acpixf.h
vendor-sys/acpica/dist/source/include/actypes.h
vendor-sys/acpica/dist/source/include/acutils.h
vendor-sys/acpica/dist/source/include/platform/acgcc.h
vendor-sys/acpica/dist/source/include/platform/aclinux.h
vendor-sys/acpica/dist/source/os_specific/service_layers/osunixxf.c
vendor-sys/acpica/dist/source/os_specific/service_layers/oswintbl.c
vendor-sys/acpica/dist/source/os_specific/service_layers/oswinxf.c
vendor-sys/acpica/dist/source/tools/acpidump/apdump.c
vendor-sys/acpica/dist/source/tools/acpiexec/aehandlers.c
vendor-sys/acpica/dist/source/tools/acpiexec/aemain.c
vendor-sys/acpica/dist/source/tools/acpiexec/aetables.c
vendor-sys/acpica/dist/source/tools/acpiexec/aetables.h
vendor-sys/acpica/dist/source/tools/acpisrc/acpisrc.h
vendor-sys/acpica/dist/source/tools/acpisrc/ascase.c
vendor-sys/acpica/dist/source/tools/acpisrc/asconvrt.c
vendor-sys/acpica/dist/source/tools/acpisrc/asfile.c
vendor-sys/acpica/dist/source/tools/acpisrc/asmain.c
vendor-sys/acpica/dist/source/tools/acpisrc/asremove.c
vendor-sys/acpica/dist/source/tools/acpisrc/astable.c
vendor-sys/acpica/dist/source/tools/acpixtract/acpixtract.c
Modified: vendor-sys/acpica/dist/changes.txt
==============================================================================
--- vendor-sys/acpica/dist/changes.txt Wed Oct 16 22:53:00 2013 (r256654)
+++ vendor-sys/acpica/dist/changes.txt Thu Oct 17 00:06:42 2013 (r256655)
@@ -1,4 +1,103 @@
----------------------------------------
+27 September 2013. Summary of changes for version 20130927:
+
+This release is available at https://acpica.org/downloads
+
+
+1) ACPICA kernel-resident subsystem:
+
+Fixed a problem with store operations to reference objects. This change
+fixes a problem where a Store operation to an ArgX object that contained a
+reference to a field object did not complete the automatic dereference and
+then write to the actual field object. Instead, the object type of the
+field object was inadvertently changed to match the type of the source
+operand. The new behavior will actually write to the field object (buffer
+field or field unit), thus matching the correct ACPI-defined behavior.
+
+Implemented support to allow the host to redefine individual OSL
+prototypes. This change enables the host to redefine OSL prototypes found
+in the acpiosxf.h file. This allows the host to implement OSL interfaces
+with a macro or inlined function. Further, it allows the host to add any
+additional required modifiers such as __iomem, __init, __exit, etc., as
+necessary on a per-interface basis. Enables maximum flexibility for the
+OSL interfaces. Lv Zheng.
+
+Hardcoded the access width for the FADT-defined reset register. The ACPI
+specification requires the reset register width to be 8 bits. ACPICA now
+hardcodes the width to 8 and ignores the FADT width value. This provides
+compatibility with other ACPI implementations that have allowed BIOS code
+with bad register width values to go unnoticed. Matthew Garett, Bob Moore,
+Lv Zheng.
+
+Changed the position/use of the ACPI_PRINTF_LIKE macro. This macro is used
+in the OSL header (acpiosxf). The change modifies the position of this
+macro in each instance where it is used (AcpiDebugPrint, etc.) to avoid
+build issues if the OSL defines the implementation of the interface to be
+an inline stub function. Lv Zheng.
+
+Deployed a new macro ACPI_EXPORT_SYMBOL_INIT for the main ACPICA
+initialization interfaces. This change adds a new macro for the main init
+and terminate external interfaces in order to support hosts that require
+additional or different processing for these functions. Changed from
+ACPI_EXPORT_SYMBOL to ACPI_EXPORT_SYMBOL_INIT for these functions. Lv
+Zheng, Bob Moore.
+
+Cleaned up the memory allocation macros for configurability. In the common
+case, the ACPI_ALLOCATE and related macros now resolve directly to their
+respective AcpiOs* OSL interfaces. Two options:
+1) The ACPI_ALLOCATE_ZEROED macro uses a simple local implementation by
+default, unless overridden by the USE_NATIVE_ALLOCATE_ZEROED define.
+2) For AcpiExec (and for debugging), the macros can optionally be resolved
+to the local ACPICA interfaces that track each allocation (local tracking
+is used to immediately detect memory leaks).
+Lv Zheng.
+
+Simplified the configuration for ACPI_REDUCED_HARDWARE. Allows the kernel
+to predefine this macro to either TRUE or FALSE during the system build.
+
+Replaced __FUNCTION_ with __func__ in the gcc-specific header.
+
+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.8K Code, 27.0K Data, 122.8K Total
+ Debug Version: 185.2K Code, 77.2K Data, 262.4K Total
+ Previous Release:
+ Non-Debug Version: 96.7K Code, 27.1K Data, 123.9K Total
+ Debug Version: 184.4K Code, 76.8K Data, 261.2K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+iASL: Implemented wildcard support for the -e option. This simplifies use
+when there are many SSDTs that must be included to resolve external method
+declarations. ACPICA BZ 1041. Example:
+ iasl -e ssdt*.dat -d dsdt.dat
+
+AcpiExec: Add history/line-editing for Unix/Linux systems. This change
+adds a portable module that implements full history and limited line
+editing for Unix and Linux systems. It does not use readline() due to
+portability issues. Instead it uses the POSIX termio interface to put the
+terminal in raw input mode so that the various special keys can be trapped
+(such as up/down-arrow for history support and left/right-arrow for line
+editing). Uses the existing debugger history mechanism. ACPICA BZ 1036.
+
+AcpiXtract: Add support to handle (ignore) "empty" lines containing only
+one or more spaces. This provides compatible with early or different
+versions of the AcpiDump utility. ACPICA BZ 1044.
+
+AcpiDump: Do not ignore tables that contain only an ACPI table header.
+Apparently, some BIOSs create SSDTs that contain an ACPI table header but
+no other data. This change adds support to dump these tables. Any tables
+shorter than the length of an ACPI table header remain in error (an error
+message is emitted). Reported by Yi Li.
+
+Debugger: Echo actual command along with the "unknown command" message.
+
+----------------------------------------
23 August 2013. Summary of changes for version 20130823:
1) ACPICA kernel-resident subsystem:
Modified: vendor-sys/acpica/dist/generate/unix/Makefile.config
==============================================================================
--- vendor-sys/acpica/dist/generate/unix/Makefile.config Wed Oct 16 22:53:00 2013 (r256654)
+++ vendor-sys/acpica/dist/generate/unix/Makefile.config Thu Oct 17 00:06:42 2013 (r256655)
@@ -193,20 +193,22 @@ endif
#
# Bison/Flex configuration
#
-# -v: verbose, produces a .output file
-# -d: produces the defines header file
# -y: act like yacc
#
# -i: generate case insensitive scanner
# -s: suppress default rule, abort on unknown input
#
+# Optional for Bison/yacc:
+# -v: verbose, produces a .output file
+# -d: produces the defines header file
+#
# Berkeley yacc configuration
#
#YACC= byacc
-#YFLAGS += -v -d
+#YFLAGS +=
#
YACC= bison
-YFLAGS += -v -d -y
+YFLAGS += -y
LEX= flex
LFLAGS += -i -s
Modified: vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile
==============================================================================
--- vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile Wed Oct 16 22:53:00 2013 (r256654)
+++ vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile Thu Oct 17 00:06:42 2013 (r256655)
@@ -39,6 +39,7 @@ HEADERS = \
$(wildcard $(ACPIEXEC)/*.h)
OBJECTS = \
+ $(OBJDIR)/acgetline.o\
$(OBJDIR)/aeexec.o\
$(OBJDIR)/aehandlers.o\
$(OBJDIR)/aemain.o\
Modified: vendor-sys/acpica/dist/generate/unix/iasl/Makefile
==============================================================================
--- vendor-sys/acpica/dist/generate/unix/iasl/Makefile Wed Oct 16 22:53:00 2013 (r256654)
+++ vendor-sys/acpica/dist/generate/unix/iasl/Makefile Thu Oct 17 00:06:42 2013 (r256655)
@@ -210,15 +210,9 @@ INTERMEDIATES = \
$(OBJDIR)/prparserparse.c
MISC = \
- $(OBJDIR)/aslcompilerparse.h\
$(OBJDIR)/aslcompiler.y.h\
- $(OBJDIR)/aslcompilerparse.output\
- $(OBJDIR)/dtparserparse.h\
$(OBJDIR)/dtparser.y.h\
- $(OBJDIR)/dtparserparse.output\
- $(OBJDIR)/prparserparse.h\
- $(OBJDIR)/prparser.y.h\
- $(OBJDIR)/prparserparse.output
+ $(OBJDIR)/prparser.y.h
#
# Flags specific to iASL compiler
@@ -237,39 +231,32 @@ include ../Makefile.rules
#
# Parser and Lexer - intermediate C files
#
-$(OBJDIR)/aslcompilerlex.c : $(ASL_COMPILER)/aslcompiler.l $(ASL_COMPILER)/aslsupport.l
+$(OBJDIR)/aslcompilerlex.c : $(ASL_COMPILER)/aslcompiler.l $(ASL_COMPILER)/aslsupport.l $(OBJDIR)/aslcompiler.y.h
$(LEX) $(LFLAGS) -PAslCompiler -o$@ $(ASL_COMPILER)/aslcompiler.l
-$(OBJDIR)/aslcompilerparse.c $(OBJDIR)/aslcompilerparse.h : $(ASL_COMPILER)/aslcompiler.y
- $(YACC) $(YFLAGS) -pAslCompiler -o$@ $?
+$(OBJDIR)/aslcompiler.y.h : $(ASL_COMPILER)/aslcompiler.y
+ $(YACC) $(YFLAGS) -pAslCompiler -o/dev/null --defines=$@ $<
-$(OBJDIR)/dtparserlex.c : $(ASL_COMPILER)/dtparser.l
- $(LEX) $(LFLAGS) -PDtParser -o$@ $?
+$(OBJDIR)/aslcompilerparse.c : $(ASL_COMPILER)/aslcompiler.y
+ $(YACC) $(YFLAGS) -pAslCompiler -o$@ --defines=/dev/null $<
-$(OBJDIR)/dtparserparse.c $(OBJDIR)/dtparserparse.h : $(ASL_COMPILER)/dtparser.y
- $(YACC) $(YFLAGS) -pDtParser -o$@ $?
+$(OBJDIR)/dtparserlex.c : $(ASL_COMPILER)/dtparser.l $(OBJDIR)/dtparser.y.h
+ $(LEX) $(LFLAGS) -PDtParser -o$@ $<
-$(OBJDIR)/prparserlex.c : $(ASL_COMPILER)/prparser.l
- $(LEX) $(LFLAGS) -PPrParser -o$@ $?
+$(OBJDIR)/dtparser.y.h : $(ASL_COMPILER)/dtparser.y
+ $(YACC) $(YFLAGS) -pDtParser -o/dev/null --defines=$@ $<
-$(OBJDIR)/prparserparse.c $(OBJDIR)/prparserparse.h : $(ASL_COMPILER)/prparser.y
- $(YACC) $(YFLAGS) -pPrParser -o$@ $?
+$(OBJDIR)/dtparserparse.c : $(ASL_COMPILER)/dtparser.y
+ $(YACC) $(YFLAGS) -pDtParser -o$@ --defines=/dev/null $<
+$(OBJDIR)/prparserlex.c : $(ASL_COMPILER)/prparser.l $(OBJDIR)/prparser.y.h
+ $(LEX) $(LFLAGS) -PPrParser -o$@ $<
-#
-# Rename the headers produced by bison/yacc
-#
-$(OBJDIR)/aslcompiler.y.h : $(OBJDIR)/aslcompilerparse.h
- @echo Copy intermediate file:
- @cp -f -v $(OBJDIR)/aslcompilerparse.h $(OBJDIR)/aslcompiler.y.h
-
-$(OBJDIR)/dtparser.y.h: $(OBJDIR)/dtparserparse.h
- @echo Copy intermediate file:
- @cp -f -v $(OBJDIR)/dtparserparse.h $(OBJDIR)/dtparser.y.h
+$(OBJDIR)/prparser.y.h : $(ASL_COMPILER)/prparser.y
+ $(YACC) $(YFLAGS) -pPrParser -o/dev/null --defines=$@ $<
-$(OBJDIR)/prparser.y.h: $(OBJDIR)/prparserparse.h
- @echo Copy intermediate file:
- @cp -f -v $(OBJDIR)/prparserparse.h $(OBJDIR)/prparser.y.h
+$(OBJDIR)/prparserparse.c : $(ASL_COMPILER)/prparser.y
+ $(YACC) $(YFLAGS) -pPrParser -o$@ --defines=/dev/null $<
#
@@ -279,19 +266,19 @@ $(OBJDIR)/prparser.y.h: $(OBJDIR)/prpars
# by the utilities above and they are not necessarily ANSI C, etc.
#
$(OBJDIR)/aslcompilerlex.o : $(OBJDIR)/aslcompilerlex.c
- $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $?
+ $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $<
$(OBJDIR)/aslcompilerparse.o : $(OBJDIR)/aslcompilerparse.c
- $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $?
+ $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $<
$(OBJDIR)/dtparserlex.o : $(OBJDIR)/dtparserlex.c
- $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $?
+ $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $<
$(OBJDIR)/dtparserparse.o : $(OBJDIR)/dtparserparse.c
- $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $?
+ $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $<
$(OBJDIR)/prparserlex.o : $(OBJDIR)/prparserlex.c
- $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $?
+ $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $<
$(OBJDIR)/prparserparse.o : $(OBJDIR)/prparserparse.c
- $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $?
+ $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $<
Added: vendor-sys/acpica/dist/source/common/acgetline.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor-sys/acpica/dist/source/common/acgetline.c Thu Oct 17 00:06:42 2013 (r256655)
@@ -0,0 +1,440 @@
+/******************************************************************************
+ *
+ * Module Name: acgetline - local line editing
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2013, 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.
+ */
+
+#include "acpi.h"
+#include "accommon.h"
+#include "amlcode.h"
+#include "acparser.h"
+#include "acdebug.h"
+
+#include <stdio.h>
+
+/*
+ * This is an os-independent implementation of line-editing services needed
+ * by the AcpiExec utility. It uses getchar() and putchar() and the existing
+ * history support provided by the AML debugger. It assumes that the terminal
+ * is in the correct line-editing mode such as raw and noecho. The OSL
+ * interface AcpiOsInitialize should do this. AcpiOsTerminate should put the
+ * terminal back into the original mode.
+ */
+#define _COMPONENT ACPI_OS_SERVICES
+ ACPI_MODULE_NAME ("acgetline")
+
+
+/* Local prototypes */
+
+static void
+AcpiAcClearLine (
+ UINT32 EndOfLine,
+ UINT32 CursorPosition);
+
+/* Various ASCII constants */
+
+#define _ASCII_NUL 0
+#define _ASCII_BACKSPACE 0x08
+#define _ASCII_TAB 0x09
+#define _ASCII_ESCAPE 0x1B
+#define _ASCII_SPACE 0x20
+#define _ASCII_LEFT_BRACKET 0x5B
+#define _ASCII_DEL 0x7F
+#define _ASCII_UP_ARROW 'A'
+#define _ASCII_DOWN_ARROW 'B'
+#define _ASCII_RIGHT_ARROW 'C'
+#define _ASCII_LEFT_ARROW 'D'
+#define _ASCII_NEWLINE '\n'
+
+extern UINT32 AcpiGbl_NextCmdNum;
+
+/* Erase a single character on the input command line */
+
+#define ACPI_CLEAR_CHAR() \
+ putchar (_ASCII_BACKSPACE); \
+ putchar (_ASCII_SPACE); \
+ putchar (_ASCII_BACKSPACE);
+
+/* Backup cursor by Count positions */
+
+#define ACPI_BACKUP_CURSOR(i, Count) \
+ for (i = 0; i < (Count); i++) \
+ {putchar (_ASCII_BACKSPACE);}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiAcClearLine
+ *
+ * PARAMETERS: EndOfLine - Current end-of-line index
+ * CursorPosition - Current cursor position within line
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Clear the entire command line the hard way, but probably the
+ * most portable.
+ *
+ *****************************************************************************/
+
+static void
+AcpiAcClearLine (
+ UINT32 EndOfLine,
+ UINT32 CursorPosition)
+{
+ UINT32 i;
+
+
+ if (CursorPosition < EndOfLine)
+ {
+ /* Clear line from current position to end of line */
+
+ for (i = 0; i < (EndOfLine - CursorPosition); i++)
+ {
+ putchar (' ');
+ }
+ }
+
+ /* Clear the entire line */
+
+ for (; EndOfLine > 0; EndOfLine--)
+ {
+ ACPI_CLEAR_CHAR ();
+ }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsGetLine
+ *
+ * PARAMETERS: Buffer - Where to return the command line
+ * BufferLength - Maximum length of Buffer
+ * BytesRead - Where the actual byte count is returned
+ *
+ * RETURN: Status and actual bytes read
+ *
+ * DESCRIPTION: Get the next input line from the terminal. NOTE: terminal
+ * is expected to be in a mode that supports line-editing (raw,
+ * noecho). This function is intended to be very portable. Also,
+ * it uses the history support implemented in the AML debugger.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsGetLine (
+ char *Buffer,
+ UINT32 BufferLength,
+ UINT32 *BytesRead)
+{
+ char *NextCommand;
+ UINT32 MaxCommandIndex = AcpiGbl_NextCmdNum - 1;
+ UINT32 CurrentCommandIndex = MaxCommandIndex;
+ UINT32 PreviousCommandIndex = MaxCommandIndex;
+ int InputChar;
+ UINT32 CursorPosition = 0;
+ UINT32 EndOfLine = 0;
+ UINT32 i;
+
+
+ /* Always clear the line buffer before we read a new line */
+
+ memset (Buffer, 0, BufferLength);
+
+ /*
+ * This loop gets one character at a time (except for esc sequences)
+ * until a newline or error is detected.
+ *
+ * Note: Don't attempt to write terminal control ESC sequences, even
+ * though it makes certain things more difficult.
+ */
+ while (1)
+ {
+ if (EndOfLine >= (BufferLength - 1))
+ {
+ return (AE_BUFFER_OVERFLOW);
+ }
+
+ InputChar = getchar ();
+ switch (InputChar)
+ {
+ default: /* This is the normal character case */
+
+ /* Echo the character (at EOL) and copy it to the line buffer */
+
+ if (EndOfLine == CursorPosition)
+ {
+ putchar (InputChar);
+ Buffer[EndOfLine] = (char) InputChar;
+
+ EndOfLine++;
+ CursorPosition++;
+ Buffer[EndOfLine] = 0;
+ continue;
+ }
+
+ /* Insert character into the middle of the buffer */
+
+ memmove (&Buffer[CursorPosition + 1], &Buffer[CursorPosition],
+ (EndOfLine - CursorPosition + 1));
+
+ Buffer [CursorPosition] = (char) InputChar;
+ Buffer [EndOfLine + 1] = 0;
+
+ /* Display the new part of line starting at the new character */
+
+ fprintf (stdout, "%s", &Buffer[CursorPosition]);
+
+ /* Restore cursor */
+
+ ACPI_BACKUP_CURSOR (i, EndOfLine - CursorPosition);
+ CursorPosition++;
+ EndOfLine++;
+ continue;
+
+ case _ASCII_DEL: /* Backspace key */
+
+ if (!EndOfLine) /* Any characters on the command line? */
+ {
+ continue;
+ }
+
+ if (EndOfLine == CursorPosition) /* Erase the final character */
+ {
+ ACPI_CLEAR_CHAR ();
+ EndOfLine--;
+ CursorPosition--;
+ continue;
+ }
+
+ if (!CursorPosition) /* Do not backup beyond start of line */
+ {
+ continue;
+ }
+
+ /* Remove the character from the line */
+
+ memmove (&Buffer[CursorPosition - 1], &Buffer[CursorPosition],
+ (EndOfLine - CursorPosition + 1));
+
+ /* Display the new part of line starting at the new character */
+
+ putchar (_ASCII_BACKSPACE);
+ fprintf (stdout, "%s ", &Buffer[CursorPosition - 1]);
+
+ /* Restore cursor */
+
+ ACPI_BACKUP_CURSOR (i, EndOfLine - CursorPosition + 1);
+ EndOfLine--;
+ if (CursorPosition > 0)
+ {
+ CursorPosition--;
+ }
+ continue;
+
+ case _ASCII_NEWLINE: /* Normal exit case at end of command line */
+ case _ASCII_NUL:
+
+ /* Return the number of bytes in the command line string */
+
+ if (BytesRead)
+ {
+ *BytesRead = EndOfLine;
+ }
+
+ /* Echo, terminate string buffer, and exit */
+
+ putchar (InputChar);
+ Buffer[EndOfLine] = 0;
+ return (AE_OK);
+
+ case _ASCII_TAB:
+
+ /* Ignore */
+
+ continue;
+
+ case EOF:
+
+ return (AE_ERROR);
+
+ case _ASCII_ESCAPE:
+
+ /* Check for escape sequences of the form "ESC[x" */
+
+ InputChar = getchar ();
+ if (InputChar != _ASCII_LEFT_BRACKET)
+ {
+ continue; /* Ignore this ESC, does not have the '[' */
+ }
+
+ /* Get the code following the ESC [ */
+
+ InputChar = getchar (); /* Backup one character */
+ switch (InputChar)
+ {
+ case _ASCII_LEFT_ARROW:
+
+ if (CursorPosition > 0)
+ {
+ putchar (_ASCII_BACKSPACE);
+ CursorPosition--;
+ }
+ continue;
+
+ case _ASCII_RIGHT_ARROW:
+ /*
+ * Move one character forward. Do this without sending
+ * ESC sequence to the terminal for max portability.
+ */
+ if (CursorPosition < EndOfLine)
+ {
+ /* Backup to start of line and print the entire line */
+
+ ACPI_BACKUP_CURSOR (i, CursorPosition);
+ fprintf (stdout, "%s", Buffer);
+
+ /* Backup to where the cursor should be */
+
+ CursorPosition++;
+ ACPI_BACKUP_CURSOR (i, EndOfLine - CursorPosition);
+ }
+ continue;
+
+ case _ASCII_UP_ARROW:
+
+ /* If no commands available or at start of history list, ignore */
+
+ if (!CurrentCommandIndex)
+ {
+ continue;
+ }
+
+ /* Manage our up/down progress */
+
+ if (CurrentCommandIndex > PreviousCommandIndex)
+ {
+ CurrentCommandIndex = PreviousCommandIndex;
+ }
+
+ /* Get the historical command from the debugger */
+
+ NextCommand = AcpiDbGetHistoryByIndex (CurrentCommandIndex);
+ if (!NextCommand)
+ {
+ return (AE_ERROR);
+ }
+
+ /* Make this the active command and echo it */
+
+ AcpiAcClearLine (EndOfLine, CursorPosition);
+ strcpy (Buffer, NextCommand);
+ fprintf (stdout, "%s", Buffer);
+ EndOfLine = CursorPosition = strlen (Buffer);
+
+ PreviousCommandIndex = CurrentCommandIndex;
+ CurrentCommandIndex--;
+ continue;
+
+ case _ASCII_DOWN_ARROW:
+
+ if (!MaxCommandIndex) /* Any commands available? */
+ {
+ continue;
+ }
+
+ /* Manage our up/down progress */
+
+ if (CurrentCommandIndex < PreviousCommandIndex)
+ {
+ CurrentCommandIndex = PreviousCommandIndex;
+ }
+
+ /* If we are the end of the history list, output a clear new line */
+
+ if ((CurrentCommandIndex + 1) > MaxCommandIndex)
+ {
+ AcpiAcClearLine (EndOfLine, CursorPosition);
+ EndOfLine = CursorPosition = 0;
+ PreviousCommandIndex = CurrentCommandIndex;
+ continue;
+ }
+
+ PreviousCommandIndex = CurrentCommandIndex;
+ CurrentCommandIndex++;
+
+ /* Get the historical command from the debugger */
+
+ NextCommand = AcpiDbGetHistoryByIndex (CurrentCommandIndex);
+ if (!NextCommand)
+ {
+ return (AE_ERROR);
+ }
+
+ /* Make this the active command and echo it */
+
+ AcpiAcClearLine (EndOfLine, CursorPosition);
+ strcpy (Buffer, NextCommand);
+ fprintf (stdout, "%s", Buffer);
+ EndOfLine = CursorPosition = strlen (Buffer);
+ continue;
+
+ case 0x31:
+ case 0x32:
+ case 0x33:
+ case 0x34:
+ case 0x35:
+ case 0x36:
+ /*
+ * Ignore the various keys like insert/delete/home/end, etc.
+ * But we must eat the final character of the ESC sequence.
+ */
+ InputChar = getchar ();
+ continue;
+
+ default:
+
+ /* Ignore random escape sequences that we don't care about */
+
+ continue;
+ }
+ continue;
+ }
+ }
+}
Modified: vendor-sys/acpica/dist/source/common/adfile.c
==============================================================================
--- vendor-sys/acpica/dist/source/common/adfile.c Wed Oct 16 22:53:00 2013 (r256654)
+++ vendor-sys/acpica/dist/source/common/adfile.c Thu Oct 17 00:06:42 2013 (r256655)
@@ -288,7 +288,6 @@ FlSplitInputPathname (
*OutDirectoryPath = NULL;
- *OutFilename = NULL;
if (!InputPath)
{
@@ -334,6 +333,10 @@ FlSplitInputPathname (
}
*OutDirectoryPath = DirectoryPath;
- *OutFilename = Filename;
+
+ if (OutFilename)
+ {
+ *OutFilename = Filename;
+ }
return (AE_OK);
}
Modified: vendor-sys/acpica/dist/source/common/dmextern.c
==============================================================================
--- vendor-sys/acpica/dist/source/common/dmextern.c Wed Oct 16 22:53:00 2013 (r256654)
+++ vendor-sys/acpica/dist/source/common/dmextern.c Thu Oct 17 00:06:42 2013 (r256655)
@@ -279,48 +279,41 @@ Cleanup:
ACPI_STATUS
AcpiDmAddToExternalFileList (
- char *PathList)
+ char *Pathname)
{
ACPI_EXTERNAL_FILE *ExternalFile;
- char *Path;
- char *TmpPath;
+ char *LocalPathname;
- if (!PathList)
+ if (!Pathname)
{
return (AE_OK);
}
- Path = strtok (PathList, ",");
-
- while (Path)
+ LocalPathname = ACPI_ALLOCATE (strlen (Pathname) + 1);
+ if (!LocalPathname)
{
- TmpPath = ACPI_ALLOCATE_ZEROED (ACPI_STRLEN (Path) + 1);
- if (!TmpPath)
- {
- return (AE_NO_MEMORY);
- }
-
- ACPI_STRCPY (TmpPath, Path);
+ return (AE_NO_MEMORY);
+ }
- ExternalFile = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_FILE));
- if (!ExternalFile)
- {
- ACPI_FREE (TmpPath);
- return (AE_NO_MEMORY);
- }
+ ExternalFile = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_FILE));
+ if (!ExternalFile)
+ {
+ ACPI_FREE (LocalPathname);
+ return (AE_NO_MEMORY);
+ }
- ExternalFile->Path = TmpPath;
+ /* Take a copy of the file pathname */
- if (AcpiGbl_ExternalFileList)
- {
- ExternalFile->Next = AcpiGbl_ExternalFileList;
- }
+ strcpy (LocalPathname, Pathname);
+ ExternalFile->Path = LocalPathname;
- AcpiGbl_ExternalFileList = ExternalFile;
- Path = strtok (NULL, ",");
+ if (AcpiGbl_ExternalFileList)
+ {
+ ExternalFile->Next = AcpiGbl_ExternalFileList;
}
+ AcpiGbl_ExternalFileList = ExternalFile;
return (AE_OK);
}
Modified: vendor-sys/acpica/dist/source/compiler/aslcompiler.h
==============================================================================
--- vendor-sys/acpica/dist/source/compiler/aslcompiler.h Wed Oct 16 22:53:00 2013 (r256654)
+++ vendor-sys/acpica/dist/source/compiler/aslcompiler.h Thu Oct 17 00:06:42 2013 (r256655)
@@ -123,11 +123,6 @@ ACPI_STATUS (*ASL_PATHNAME_CALLBACK) (
char *);
ACPI_STATUS
-AslDoOnePathname (
- char *Pathname,
- ASL_PATHNAME_CALLBACK Callback);
-
-ACPI_STATUS
AslDoOneFile (
char *Filename);
Modified: vendor-sys/acpica/dist/source/compiler/aslerror.c
==============================================================================
--- vendor-sys/acpica/dist/source/compiler/aslerror.c Wed Oct 16 22:53:00 2013 (r256654)
+++ vendor-sys/acpica/dist/source/compiler/aslerror.c Thu Oct 17 00:06:42 2013 (r256655)
@@ -611,7 +611,6 @@ AslCommonError (
char *Filename,
char *ExtraMessage)
{
- UINT32 MessageSize;
char *MessageBuffer = NULL;
ASL_ERROR_MSG *Enode;
@@ -622,8 +621,7 @@ AslCommonError (
{
/* Allocate a buffer for the message and a new error node */
- MessageSize = strlen (ExtraMessage) + 1;
- MessageBuffer = UtLocalCalloc (MessageSize);
+ MessageBuffer = UtLocalCalloc (strlen (ExtraMessage) + 1);
/* Keep a copy of the extra message */
Modified: vendor-sys/acpica/dist/source/compiler/aslmain.c
==============================================================================
--- vendor-sys/acpica/dist/source/compiler/aslmain.c Wed Oct 16 22:53:00 2013 (r256654)
+++ vendor-sys/acpica/dist/source/compiler/aslmain.c Thu Oct 17 00:06:42 2013 (r256655)
@@ -51,6 +51,17 @@
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslmain")
+/*
+ * Main routine for the iASL compiler.
+ *
+ * Portability note: The compiler depends upon the host for command-line
+ * wildcard support - it is not implemented locally. For example:
+ *
+ * Linux/Unix systems: Shell expands wildcards automatically.
+ *
+ * Windows: The setargv.obj module must be linked in to automatically
+ * expand wildcards.
+ */
/* Local prototypes */
@@ -131,13 +142,13 @@ Usage (
ACPI_OPTION ("-vt", "Create verbose template files (full disassembly)");
printf ("\nAML Disassembler:\n");
- ACPI_OPTION ("-d <f1,f2>", "Disassemble or decode binary ACPI tables to file (*.dsl)");
+ ACPI_OPTION ("-d <f1 f2 ...>", "Disassemble or decode binary ACPI tables to file (*.dsl)");
ACPI_OPTION ("", " (Optional, file type is automatically detected)");
- ACPI_OPTION ("-da <f1,f2>", "Disassemble multiple tables from single namespace");
+ ACPI_OPTION ("-da <f1 f2 ...>", "Disassemble multiple tables from single namespace");
ACPI_OPTION ("-db", "Do not translate Buffers to Resource Templates");
- ACPI_OPTION ("-dc <f1,f2>", "Disassemble AML and immediately compile it");
+ ACPI_OPTION ("-dc <f1 f2 ...>", "Disassemble AML and immediately compile it");
ACPI_OPTION ("", " (Obtain DSDT from current system if no input file)");
- ACPI_OPTION ("-e <f1,f2>", "Include ACPI table(s) for external symbol resolution");
+ ACPI_OPTION ("-e <f1 f2 ...>", "Include ACPI table(s) for external symbol resolution");
ACPI_OPTION ("-fe <file>", "Specify external symbol declaration file");
ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)");
ACPI_OPTION ("-in", "Ignore NoOp opcodes");
@@ -321,7 +332,7 @@ main (
{
while (argv[Index1])
{
- Status = AslDoOnePathname (argv[Index1], AcpiDmAddToExternalFileList);
+ Status = AcpiDmAddToExternalFileList (argv[Index1]);
if (ACPI_FAILURE (Status))
{
return (-1);
@@ -335,7 +346,16 @@ main (
while (argv[Index2])
{
- Status = AslDoOnePathname (argv[Index2], AslDoOneFile);
+ /*
+ * If -p not specified, we will use the input filename as the
+ * output filename prefix
+ */
+ if (Gbl_UseDefaultAmlFilename)
+ {
+ Gbl_OutputFilenamePrefix = argv[Index2];
+ }
+
+ Status = AslDoOneFile (argv[Index2]);
if (ACPI_FAILURE (Status))
{
return (-1);
Modified: vendor-sys/acpica/dist/source/compiler/asloptions.c
==============================================================================
--- vendor-sys/acpica/dist/source/compiler/asloptions.c Wed Oct 16 22:53:00 2013 (r256654)
+++ vendor-sys/acpica/dist/source/compiler/asloptions.c Thu Oct 17 00:06:42 2013 (r256655)
@@ -267,11 +267,21 @@ AslDoOptions (
case 'e': /* External files for disassembler */
- Status = AcpiDmAddToExternalFileList (AcpiGbl_Optarg);
- if (ACPI_FAILURE (Status))
+ /* Get entire list of external files */
+
+ AcpiGbl_Optind--;
+
+ while (argv[AcpiGbl_Optind] &&
+ (argv[AcpiGbl_Optind][0] != '-'))
{
- printf ("Could not add %s to external list\n", AcpiGbl_Optarg);
- return (-1);
+ Status = AcpiDmAddToExternalFileList (argv[AcpiGbl_Optind]);
+ if (ACPI_FAILURE (Status))
+ {
+ printf ("Could not add %s to external list\n", argv[AcpiGbl_Optind]);
+ return (-1);
+ }
+
+ AcpiGbl_Optind++;
}
break;
Modified: vendor-sys/acpica/dist/source/compiler/aslstartup.c
==============================================================================
--- vendor-sys/acpica/dist/source/compiler/aslstartup.c Wed Oct 16 22:53:00 2013 (r256654)
+++ vendor-sys/acpica/dist/source/compiler/aslstartup.c Thu Oct 17 00:06:42 2013 (r256655)
@@ -51,18 +51,8 @@
ACPI_MODULE_NAME ("aslstartup")
-#define ASL_MAX_FILES 256
-static char *FileList[ASL_MAX_FILES];
-static BOOLEAN AslToFile = TRUE;
-
-
/* Local prototypes */
-static char **
-AsDoWildcard (
- char *DirectoryPathname,
- char *FileSpecifier);
-
static UINT8
AslDetectSourceFileType (
ASL_FILE_INFO *Info);
@@ -72,6 +62,11 @@ AslDoDisassembly (
void);
+/* Globals */
+
+static BOOLEAN AslToFile = TRUE;
+
+
/*******************************************************************************
*
* FUNCTION: AslInitializeGlobals
@@ -131,82 +126,6 @@ AslInitializeGlobals (
}
-/******************************************************************************
- *
- * FUNCTION: AsDoWildcard
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Process files via wildcards. This function is for the Windows
- * case only.
- *
- ******************************************************************************/
-
-static char **
-AsDoWildcard (
- char *DirectoryPathname,
- char *FileSpecifier)
-{
-#ifdef WIN32
- void *DirInfo;
- char *Filename;
- int FileCount;
-
-
- FileCount = 0;
-
- /* Open parent directory */
-
- DirInfo = AcpiOsOpenDirectory (DirectoryPathname, FileSpecifier, REQUEST_FILE_ONLY);
- if (!DirInfo)
- {
- /* Either the directory of file does not exist */
-
- Gbl_Files[ASL_FILE_INPUT].Filename = FileSpecifier;
- FlFileError (ASL_FILE_INPUT, ASL_MSG_OPEN);
- AslAbort ();
- }
-
- /* Process each file that matches the wildcard specification */
-
- while ((Filename = AcpiOsGetNextFilename (DirInfo)))
- {
- /* Add the filename to the file list */
-
- FileList[FileCount] = AcpiOsAllocate (strlen (Filename) + 1);
- strcpy (FileList[FileCount], Filename);
- FileCount++;
-
- if (FileCount >= ASL_MAX_FILES)
- {
- printf ("Max files reached\n");
- FileList[0] = NULL;
- return (FileList);
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list