svn commit: r249109 - in vendor-sys/acpica/dist: . generate/unix/acpiexec generate/unix/acpihelp generate/unix/iasl source/common source/compiler source/components/debugger source/components/dispat...
Jung-uk Kim
jkim at FreeBSD.org
Thu Apr 4 21:19:00 UTC 2013
Author: jkim
Date: Thu Apr 4 21:18:57 2013
New Revision: 249109
URL: http://svnweb.freebsd.org/changeset/base/249109
Log:
Import ACPICA 20130328.
Added:
vendor-sys/acpica/dist/source/compiler/asllistsup.c (contents, props changed)
vendor-sys/acpica/dist/source/compiler/asloffset.c (contents, props changed)
vendor-sys/acpica/dist/source/components/utilities/utpredef.c (contents, props changed)
Modified:
vendor-sys/acpica/dist/changes.txt
vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile
vendor-sys/acpica/dist/generate/unix/acpihelp/Makefile
vendor-sys/acpica/dist/generate/unix/iasl/Makefile
vendor-sys/acpica/dist/source/common/ahpredef.c
vendor-sys/acpica/dist/source/compiler/aslcompile.c
vendor-sys/acpica/dist/source/compiler/aslcompiler.h
vendor-sys/acpica/dist/source/compiler/asldefine.h
vendor-sys/acpica/dist/source/compiler/aslerror.c
vendor-sys/acpica/dist/source/compiler/aslfiles.c
vendor-sys/acpica/dist/source/compiler/aslglobal.h
vendor-sys/acpica/dist/source/compiler/asllisting.c
vendor-sys/acpica/dist/source/compiler/aslmain.c
vendor-sys/acpica/dist/source/compiler/aslpredef.c
vendor-sys/acpica/dist/source/compiler/aslprepkg.c
vendor-sys/acpica/dist/source/compiler/aslresource.c
vendor-sys/acpica/dist/source/compiler/asltypes.h
vendor-sys/acpica/dist/source/compiler/aslwalks.c
vendor-sys/acpica/dist/source/components/debugger/dbmethod.c
vendor-sys/acpica/dist/source/components/debugger/dbnames.c
vendor-sys/acpica/dist/source/components/dispatcher/dsopcode.c
vendor-sys/acpica/dist/source/components/dispatcher/dswexec.c
vendor-sys/acpica/dist/source/components/events/evevent.c
vendor-sys/acpica/dist/source/components/executer/exoparg2.c
vendor-sys/acpica/dist/source/components/namespace/nseval.c
vendor-sys/acpica/dist/source/components/namespace/nspredef.c
vendor-sys/acpica/dist/source/components/tables/tbfadt.c
vendor-sys/acpica/dist/source/components/tables/tbxface.c
vendor-sys/acpica/dist/source/components/utilities/utdelete.c
vendor-sys/acpica/dist/source/components/utilities/utmutex.c
vendor-sys/acpica/dist/source/components/utilities/utosi.c
vendor-sys/acpica/dist/source/components/utilities/utxface.c
vendor-sys/acpica/dist/source/include/acglobal.h
vendor-sys/acpica/dist/source/include/aclocal.h
vendor-sys/acpica/dist/source/include/acnamesp.h
vendor-sys/acpica/dist/source/include/acpixf.h
vendor-sys/acpica/dist/source/include/acpredef.h
vendor-sys/acpica/dist/source/include/acutils.h
vendor-sys/acpica/dist/source/tools/acpihelp/ahdecode.c
vendor-sys/acpica/dist/source/tools/acpisrc/astable.c
Modified: vendor-sys/acpica/dist/changes.txt
==============================================================================
--- vendor-sys/acpica/dist/changes.txt Thu Apr 4 20:31:40 2013 (r249108)
+++ vendor-sys/acpica/dist/changes.txt Thu Apr 4 21:18:57 2013 (r249109)
@@ -1,4 +1,79 @@
----------------------------------------
+28 March 2013. Summary of changes for version 20130328:
+
+1) ACPICA kernel-resident subsystem:
+
+Fixed several possible race conditions with the internal object reference
+counting mechanism. Some of the external ACPICA interfaces update object
+reference counts without holding the interpreter or namespace lock. This
+change adds a spinlock to protect reference count updates on the internal
+ACPICA objects. Reported by and with assistance from Andriy Gapon
+(avg at FreeBSD.org).
+
+FADT support: Removed an extraneous warning for very large GPE register
+sets. This change removes a size mismatch warning if the legacy length
+field for a GPE register set is larger than the 64-bit GAS structure can
+accommodate. GPE register sets can be larger than the 255-bit width
+limitation of the GAS structure. Linn Crosetto (linn at hp.com).
+
+_OSI Support: handle any errors from AcpiOsAcquireMutex. Check for error
+return from this interface. Handles a possible timeout case if
+ACPI_WAIT_FOREVER is modified by the host to be a value less than
+"forever". Jung-uk Kim.
+
+Predefined name support: Add allowed/required argument type information to
+the master predefined info table. This change adds the infrastructure to
+enable typechecking on incoming arguments for all predefined
+methods/objects. It does not actually contain the code that will fully
+utilize this information, this is still under development. Also condenses
+some duplicate code for the predefined names into a new module,
+utilities/utpredef.c
+
+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.
+
+ Previous Release:
+ Non-Debug Version: 95.0K Code, 25.9K Data, 120.9K Total
+ Debug Version: 182.9K Code, 75.6K Data, 258.5K Total
+ Current Release:
+ Non-Debug Version: 95.2K Code, 26.4K Data, 121.6K Total
+ Debug Version: 183.0K Code, 76.0K Data, 259.0K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+iASL: Implemented a new option to simplify the development of ACPI-related
+BIOS code. Adds support for a new "offset table" output file. The -so
+option will create a C table containing the AML table offsets of various
+named objects in the namespace so that BIOS code can modify them easily at
+boot time. This can simplify BIOS runtime code by eliminating expensive
+searches for "magic values", enhancing boot times and adding greater
+reliability. With assistance from Lee Hamel.
+
+iASL: Allow additional predefined names to return zero-length packages.
+Now, all predefined names that are defined by the ACPI specification to
+return a "variable-length package of packages" are allowed to return a
+zero length top-level package. This allows the BIOS to tell the host that
+the requested feature is not supported, and supports existing BIOS/ASL
+code and practices.
+
+iASL: Changed the "result not used" warning to an error. This is the case
+where an ASL operator is effectively a NOOP because the result of the
+operation is not stored anywhere. For example:
+ Add (4, Local0)
+There is no target (missing 3rd argument), nor is the function return
+value used. This is potentially a very serious problem -- since the code
+was probably intended to do something, but for whatever reason, the value
+was not stored. Therefore, this issue has been upgraded from a warning to
+an error.
+
+AcpiHelp: Added allowable/required argument types to the predefined names
+info display. This feature utilizes the recent update to the predefined
+names table (above).
+
+----------------------------------------
14 February 2013. Summary of changes for version 20130214:
1) ACPICA Kernel-resident Subsystem:
Modified: vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile
==============================================================================
--- vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile Thu Apr 4 20:31:40 2013 (r249108)
+++ vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile Thu Apr 4 21:18:57 2013 (r249109)
@@ -202,6 +202,7 @@ OBJECTS = \
$(OBJDIR)/utobject.o\
$(OBJDIR)/utosi.o\
$(OBJDIR)/utownerid.o\
+ $(OBJDIR)/utpredef.o\
$(OBJDIR)/utresrc.o\
$(OBJDIR)/utstate.o\
$(OBJDIR)/utstring.o\
Modified: vendor-sys/acpica/dist/generate/unix/acpihelp/Makefile
==============================================================================
--- vendor-sys/acpica/dist/generate/unix/acpihelp/Makefile Thu Apr 4 20:31:40 2013 (r249108)
+++ vendor-sys/acpica/dist/generate/unix/acpihelp/Makefile Thu Apr 4 21:18:57 2013 (r249109)
@@ -34,7 +34,8 @@ OBJECTS = \
$(OBJDIR)/ahpredef.o\
$(OBJDIR)/ahmain.o\
$(OBJDIR)/getopt.o\
- $(OBJDIR)/utexcep.o
+ $(OBJDIR)/utexcep.o\
+ $(OBJDIR)/utpredef.o
#
# Flags specific to acpihelp
Modified: vendor-sys/acpica/dist/generate/unix/iasl/Makefile
==============================================================================
--- vendor-sys/acpica/dist/generate/unix/iasl/Makefile Thu Apr 4 20:31:40 2013 (r249108)
+++ vendor-sys/acpica/dist/generate/unix/iasl/Makefile Thu Apr 4 21:18:57 2013 (r249109)
@@ -58,12 +58,14 @@ OBJECTS = \
$(OBJDIR)/aslhex.o\
$(OBJDIR)/asllength.o\
$(OBJDIR)/asllisting.o\
+ $(OBJDIR)/asllistsup.o\
$(OBJDIR)/aslload.o\
$(OBJDIR)/asllookup.o\
$(OBJDIR)/aslmain.o\
$(OBJDIR)/aslmap.o\
$(OBJDIR)/aslmethod.o\
$(OBJDIR)/aslnamesp.o\
+ $(OBJDIR)/asloffset.o\
$(OBJDIR)/aslopcodes.o\
$(OBJDIR)/asloperands.o\
$(OBJDIR)/aslopt.o\
@@ -188,6 +190,7 @@ OBJECTS = \
$(OBJDIR)/utmutex.o\
$(OBJDIR)/utobject.o\
$(OBJDIR)/utownerid.o\
+ $(OBJDIR)/utpredef.o\
$(OBJDIR)/utresrc.o\
$(OBJDIR)/utstate.o\
$(OBJDIR)/utstring.o\
Modified: vendor-sys/acpica/dist/source/common/ahpredef.c
==============================================================================
--- vendor-sys/acpica/dist/source/common/ahpredef.c Thu Apr 4 20:31:40 2013 (r249108)
+++ vendor-sys/acpica/dist/source/common/ahpredef.c Thu Apr 4 21:18:57 2013 (r249109)
@@ -61,7 +61,7 @@
const AH_PREDEFINED_NAME AslPredefinedInfo[] =
{
AH_PREDEF ("_ACx", "Active Cooling", "Returns the active cooling policy threshold values"),
- AH_PREDEF ("_ADR", "Address", "Returns the address of a device on its parent bus"),
+ AH_PREDEF ("_ADR", "Address", "Returns address of a device on parent bus, and resource field"),
AH_PREDEF ("_AEI", "ACPI Event Interrupts", "Returns a list of GPIO events to be used as ACPI events"),
AH_PREDEF ("_ALC", "Ambient Light Chromaticity", "Returns the ambient light color chromaticity"),
AH_PREDEF ("_ALI", "Ambient Light Illuminance", "Returns the ambient light brightness"),
@@ -113,7 +113,7 @@ const AH_PREDEFINED_NAME AslPredefine
AH_PREDEF ("_DGS", "Display Graphics State", "Return the current state of the output device"),
AH_PREDEF ("_DIS", "Disable Device", "Disables a device"),
AH_PREDEF ("_DLM", "Device Lock Mutex", "Defines mutex for OS/AML sharing"),
- AH_PREDEF ("_DMA", "Direct Memory Access", "Returns a device's current resources for DMA transactions"),
+ AH_PREDEF ("_DMA", "Direct Memory Access", "Returns device current resources for DMA transactions, and resource field"),
AH_PREDEF ("_DOD", "Display Output Devices", "Enumerate all devices attached to the display adapter"),
AH_PREDEF ("_DOS", "Disable Output Switching", "Sets the display output switching mode"),
AH_PREDEF ("_DPL", "Device Selection Polarity", "Polarity of Device Selection signal, Resource Descriptor field"),
Modified: vendor-sys/acpica/dist/source/compiler/aslcompile.c
==============================================================================
--- vendor-sys/acpica/dist/source/compiler/aslcompile.c Thu Apr 4 20:31:40 2013 (r249108)
+++ vendor-sys/acpica/dist/source/compiler/aslcompile.c Thu Apr 4 21:18:57 2013 (r249109)
@@ -126,6 +126,7 @@ AslCompilerSignon (
break;
case ASL_FILE_C_SOURCE_OUTPUT:
+ case ASL_FILE_C_OFFSET_OUTPUT:
case ASL_FILE_C_INCLUDE_OUTPUT:
Prefix = " * ";
@@ -199,6 +200,7 @@ AslCompilerFileHeader (
break;
case ASL_FILE_C_SOURCE_OUTPUT:
+ case ASL_FILE_C_OFFSET_OUTPUT:
case ASL_FILE_C_INCLUDE_OUTPUT:
Prefix = " * ";
@@ -222,6 +224,7 @@ AslCompilerFileHeader (
switch (FileId)
{
case ASL_FILE_C_SOURCE_OUTPUT:
+ case ASL_FILE_C_OFFSET_OUTPUT:
case ASL_FILE_C_INCLUDE_OUTPUT:
FlPrintFile (FileId, " */\n");
break;
Modified: vendor-sys/acpica/dist/source/compiler/aslcompiler.h
==============================================================================
--- vendor-sys/acpica/dist/source/compiler/aslcompiler.h Thu Apr 4 20:31:40 2013 (r249108)
+++ vendor-sys/acpica/dist/source/compiler/aslcompiler.h Thu Apr 4 21:18:57 2013 (r249109)
@@ -350,22 +350,65 @@ LsDoListings (
void);
void
+LsWriteNodeToAsmListing (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+LsWriteNode (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 FileId);
+
+void
+LsDumpParseTree (
+ void);
+
+
+/*
+ * asllistsup - Listing file support utilities
+ */
+void
+LsDumpAscii (
+ UINT32 FileId,
+ UINT32 Count,
+ UINT8 *Buffer);
+
+void
LsDumpAsciiInComment (
UINT32 FileId,
UINT32 Count,
UINT8 *Buffer);
void
-LsWriteNodeToAsmListing (
- ACPI_PARSE_OBJECT *Op);
+LsCheckException (
+ UINT32 LineNumber,
+ UINT32 FileId);
void
-LsWriteNode (
- ACPI_PARSE_OBJECT *Op,
+LsFlushListingBuffer (
UINT32 FileId);
void
-LsDumpParseTree (
+LsWriteListingHexBytes (
+ UINT8 *Buffer,
+ UINT32 Length,
+ UINT32 FileId);
+
+void
+LsWriteSourceLines (
+ UINT32 ToLineNumber,
+ UINT32 ToLogicalLineNumber,
+ UINT32 FileId);
+
+UINT32
+LsWriteOneSourceLine (
+ UINT32 FileId);
+
+void
+LsPushNode (
+ char *Filename);
+
+ASL_LISTING_NODE *
+LsPopNode (
void);
@@ -388,6 +431,24 @@ OpcAmlConstantWalk (
/*
+ * asloffset - generate C offset file for BIOS support
+ */
+ACPI_STATUS
+LsAmlOffsetWalk (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+void
+LsDoOffsetTableHeader (
+ UINT32 FileId);
+
+void
+LsDoOffsetTableFooter (
+ UINT32 FileId);
+
+
+/*
* aslopcodes - generate AML opcodes
*/
ACPI_STATUS
Modified: vendor-sys/acpica/dist/source/compiler/asldefine.h
==============================================================================
--- vendor-sys/acpica/dist/source/compiler/asldefine.h Thu Apr 4 20:31:40 2013 (r249108)
+++ vendor-sys/acpica/dist/source/compiler/asldefine.h Thu Apr 4 21:18:57 2013 (r249109)
@@ -120,6 +120,7 @@
#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"
/* Types for input files */
@@ -138,6 +139,11 @@
#define ASL_EOF ACPI_UINT32_MAX
+/* Listings */
+
+#define ASL_LISTING_LINE_PREFIX ": "
+
+
/* Support for reserved method names */
#define ACPI_VALID_RESERVED_NAME_MAX 0x80000000
Modified: vendor-sys/acpica/dist/source/compiler/aslerror.c
==============================================================================
--- vendor-sys/acpica/dist/source/compiler/aslerror.c Thu Apr 4 20:31:40 2013 (r249108)
+++ vendor-sys/acpica/dist/source/compiler/aslerror.c Thu Apr 4 21:18:57 2013 (r249109)
@@ -302,12 +302,25 @@ AePrintException (
}
else
{
- while (RActual && SourceByte && (SourceByte != '\n') && (Total < 256))
+ /* Read/write the source line, up to the maximum line length */
+
+ while (RActual && SourceByte && (SourceByte != '\n'))
{
- if (fwrite (&SourceByte, 1, 1, OutputFile) != 1)
+ if (Total < 256)
{
- printf ("[*** iASL: Write error on output file ***]\n");
- return;
+ /* After the max line length, we will just read the line, no write */
+
+ if (fwrite (&SourceByte, 1, 1, OutputFile) != 1)
+ {
+ printf ("[*** iASL: Write error on output file ***]\n");
+ return;
+ }
+ }
+ else if (Total == 256)
+ {
+ fprintf (OutputFile,
+ "\n[*** iASL: Very long input line, message below refers to column %u ***]",
+ Enode->Column);
}
RActual = fread (&SourceByte, 1, 1, SourceFile);
@@ -320,13 +333,6 @@ AePrintException (
}
Total++;
}
-
- if (Total >= 256)
- {
- fprintf (OutputFile,
- "\n[*** iASL: Long input line, an error occurred at column %u ***]",
- Enode->Column);
- }
}
}
}
Modified: vendor-sys/acpica/dist/source/compiler/aslfiles.c
==============================================================================
--- vendor-sys/acpica/dist/source/compiler/aslfiles.c Thu Apr 4 20:31:40 2013 (r249108)
+++ vendor-sys/acpica/dist/source/compiler/aslfiles.c Thu Apr 4 21:18:57 2013 (r249109)
@@ -675,6 +675,27 @@ FlOpenMiscOutputFiles (
AslCompilerFileHeader (ASL_FILE_C_SOURCE_OUTPUT);
}
+ /* Create/Open a C code source output file for the offset table if asked */
+
+ if (Gbl_C_OffsetTableFlag)
+ {
+ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_C_OFFSET);
+ if (!Filename)
+ {
+ AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
+ 0, 0, 0, 0, NULL, NULL);
+ return (AE_ERROR);
+ }
+
+ /* Open the C code source file, text mode */
+
+ FlOpenFile (ASL_FILE_C_OFFSET_OUTPUT, Filename, "w+t");
+
+ FlPrintFile (ASL_FILE_C_OFFSET_OUTPUT, "/*\n");
+ AslCompilerSignon (ASL_FILE_C_OFFSET_OUTPUT);
+ AslCompilerFileHeader (ASL_FILE_C_OFFSET_OUTPUT);
+ }
+
/* Create/Open a assembly include output file if asked */
if (Gbl_AsmIncludeOutputFlag)
Modified: vendor-sys/acpica/dist/source/compiler/aslglobal.h
==============================================================================
--- vendor-sys/acpica/dist/source/compiler/aslglobal.h Thu Apr 4 20:31:40 2013 (r249108)
+++ vendor-sys/acpica/dist/source/compiler/aslglobal.h Thu Apr 4 21:18:57 2013 (r249109)
@@ -86,7 +86,8 @@ ASL_FILE_INFO Gbl_
{NULL, NULL, "ASM Source: ", "Assembly Code Output"},
{NULL, NULL, "C Source: ", "C Code Output"},
{NULL, NULL, "ASM Include: ", "Assembly Header Output"},
- {NULL, NULL, "C Include: ", "C Header Output"}
+ {NULL, NULL, "C Include: ", "C Header Output"},
+ {NULL, NULL, "Offset Table: ", "C Offset Table Output"}
};
#else
@@ -143,6 +144,7 @@ ASL_EXTERN BOOLEAN ASL_
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);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_OffsetTableFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmIncludeOutputFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_IncludeOutputFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ListingFlag, FALSE);
Modified: vendor-sys/acpica/dist/source/compiler/asllisting.c
==============================================================================
--- vendor-sys/acpica/dist/source/compiler/asllisting.c Thu Apr 4 20:31:40 2013 (r249108)
+++ vendor-sys/acpica/dist/source/compiler/asllisting.c Thu Apr 4 21:18:57 2013 (r249109)
@@ -41,896 +41,234 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
#include "aslcompiler.h"
#include "aslcompiler.y.h"
#include "amlcode.h"
#include "acparser.h"
#include "acnamesp.h"
-#define _COMPONENT ACPI_COMPILER
- ACPI_MODULE_NAME ("aslisting")
-
-/* Local prototypes */
-
-static void
-LsDumpAscii (
- UINT32 FileId,
- UINT32 Count,
- UINT8 *Buffer);
-
-static ACPI_STATUS
-LsAmlListingWalk (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context);
-
-static void
-LsGenerateListing (
- UINT32 FileId);
-
-static void
-LsPushNode (
- char *Filename);
-
-static ASL_LISTING_NODE *
-LsPopNode (
- void);
-
-static void
-LsCheckException (
- UINT32 LineNumber,
- UINT32 FileId);
-
-static void
-LsFlushListingBuffer (
- UINT32 FileId);
-
-static void
-LsWriteListingHexBytes (
- UINT8 *Buffer,
- UINT32 Length,
- UINT32 FileId);
-
-static UINT32
-LsWriteOneSourceLine (
- UINT32 FileId);
-
-static void
-LsFinishSourceListing (
- UINT32 FileId);
-
-static void
-LsWriteSourceLines (
- UINT32 ToLineNumber,
- UINT32 ToLogicalLineNumber,
- UINT32 FileId);
-
-static void
-LsWriteNodeToListing (
- ACPI_PARSE_OBJECT *Op,
- UINT32 FileId);
-
-static ACPI_STATUS
-LsTreeWriteWalk (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context);
-
-#define ASL_LISTING_LINE_PREFIX ": "
-
-
-/*******************************************************************************
- *
- * FUNCTION: LsDoListings
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Generate all requested listing files.
- *
- ******************************************************************************/
-
-void
-LsDoListings (
- void)
-{
-
- if (Gbl_C_OutputFlag)
- {
- LsGenerateListing (ASL_FILE_C_SOURCE_OUTPUT);
- }
-
- if (Gbl_ListingFlag)
- {
- LsGenerateListing (ASL_FILE_LISTING_OUTPUT);
- }
-
- if (Gbl_AsmOutputFlag)
- {
- LsGenerateListing (ASL_FILE_ASM_SOURCE_OUTPUT);
- }
-
- if (Gbl_C_IncludeOutputFlag)
- {
- LsGenerateListing (ASL_FILE_C_INCLUDE_OUTPUT);
- }
-
- if (Gbl_AsmIncludeOutputFlag)
- {
- LsGenerateListing (ASL_FILE_ASM_INCLUDE_OUTPUT);
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: LsTreeWriteWalk
- *
- * PARAMETERS: ASL_WALK_CALLBACK
- *
- *
- * RETURN: None
- *
- * DESCRIPTION: Dump entire parse tree, for compiler debug only
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-LsTreeWriteWalk (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context)
-{
-
- /* Debug output */
-
- DbgPrint (ASL_TREE_OUTPUT,
- "%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level);
- UtPrintFormattedName (Op->Asl.ParseOpcode, Level);
-
-
- DbgPrint (ASL_TREE_OUTPUT, "\n");
- return (AE_OK);
-}
-
-
-void
-LsDumpParseTree (
- void)
-{
-
- if (!Gbl_DebugFlag)
- {
- return;
- }
-
- DbgPrint (ASL_TREE_OUTPUT, "\nOriginal parse tree from parser:\n\n");
- TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
- LsTreeWriteWalk, NULL, NULL);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: LsDumpAscii
- *
- * PARAMETERS: FileId - ID of current listing file
- * Count - Number of bytes to convert
- * Buffer - Buffer of bytes to convert
- *
- * RETURN: None
- *
- * DESCRIPTION: Convert hex bytes to ascii
- *
- ******************************************************************************/
-
-static void
-LsDumpAscii (
- UINT32 FileId,
- UINT32 Count,
- UINT8 *Buffer)
-{
- UINT8 BufChar;
- UINT32 i;
-
-
- FlPrintFile (FileId, " \"");
- for (i = 0; i < Count; i++)
- {
- BufChar = Buffer[i];
- if (isprint (BufChar))
- {
- FlPrintFile (FileId, "%c", BufChar);
- }
- else
- {
- /* Not a printable character, just put out a dot */
-
- FlPrintFile (FileId, ".");
- }
- }
- FlPrintFile (FileId, "\"");
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: LsDumpAsciiInComment
- *
- * PARAMETERS: FileId - ID of current listing file
- * Count - Number of bytes to convert
- * Buffer - Buffer of bytes to convert
- *
- * RETURN: None
- *
- * DESCRIPTION: Convert hex bytes to ascii
- *
- ******************************************************************************/
-
-void
-LsDumpAsciiInComment (
- UINT32 FileId,
- UINT32 Count,
- UINT8 *Buffer)
-{
- UINT8 BufChar = 0;
- UINT8 LastChar;
- UINT32 i;
-
- FlPrintFile (FileId, " \"");
- for (i = 0; i < Count; i++)
- {
- LastChar = BufChar;
- BufChar = Buffer[i];
-
- if (isprint (BufChar))
- {
- /* Handle embedded C comment sequences */
-
- if (((LastChar == '*') && (BufChar == '/')) ||
- ((LastChar == '/') && (BufChar == '*')))
- {
- /* Insert a space to break the sequence */
-
- FlPrintFile (FileId, ".", BufChar);
- }
-
- FlPrintFile (FileId, "%c", BufChar);
- }
- else
- {
- /* Not a printable character, just put out a dot */
-
- FlPrintFile (FileId, ".");
- }
- }
- FlPrintFile (FileId, "\"");
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: LsAmlListingWalk
- *
- * PARAMETERS: ASL_WALK_CALLBACK
- *
- * RETURN: Status
- *
- * DESCRIPTION: Process one node during a listing file generation.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-LsAmlListingWalk (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context)
-{
- UINT8 FileByte;
- UINT32 i;
- UINT32 FileId = (UINT32) ACPI_TO_INTEGER (Context);
-
-
- LsWriteNodeToListing (Op, FileId);
-
- if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DATA)
- {
- /* Buffer is a resource template, don't dump the data all at once */
-
- return (AE_OK);
- }
-
- /* Write the hex bytes to the listing file(s) (if requested) */
-
- for (i = 0; i < Op->Asl.FinalAmlLength; i++)
- {
- if (ACPI_FAILURE (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte, 1)))
- {
- FlFileError (ASL_FILE_AML_OUTPUT, ASL_MSG_READ);
- AslAbort ();
- }
- LsWriteListingHexBytes (&FileByte, 1, FileId);
- }
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: LsGenerateListing
- *
- * PARAMETERS: FileId - ID of listing file
- *
- * RETURN: None
- *
- * DESCRIPTION: Generate a listing file. This can be one of the several types
- * of "listings" supported.
- *
- ******************************************************************************/
-
-static void
-LsGenerateListing (
- UINT32 FileId)
-{
-
- /* Start at the beginning of both the source and AML files */
-
- FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0);
- FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
- Gbl_SourceLine = 0;
- Gbl_CurrentHexColumn = 0;
- LsPushNode (Gbl_Files[ASL_FILE_INPUT].Filename);
-
- /* Process all parse nodes */
-
- TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, LsAmlListingWalk,
- NULL, (void *) ACPI_TO_POINTER (FileId));
-
- /* Final processing */
-
- LsFinishSourceListing (FileId);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: LsPushNode
- *
- * PARAMETERS: Filename - Pointer to the include filename
- *
- * RETURN: None
- *
- * DESCRIPTION: Push a listing node on the listing/include file stack. This
- * stack enables tracking of include files (infinitely nested)
- * and resumption of the listing of the parent file when the
- * include file is finished.
- *
- ******************************************************************************/
-
-static void
-LsPushNode (
- char *Filename)
-{
- ASL_LISTING_NODE *Lnode;
-
-
- /* Create a new node */
-
- Lnode = UtLocalCalloc (sizeof (ASL_LISTING_NODE));
-
- /* Initialize */
-
- Lnode->Filename = Filename;
- Lnode->LineNumber = 0;
-
- /* Link (push) */
-
- Lnode->Next = Gbl_ListingNode;
- Gbl_ListingNode = Lnode;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: LsPopNode
- *
- * PARAMETERS: None
- *
- * RETURN: List head after current head is popped off
- *
- * DESCRIPTION: Pop the current head of the list, free it, and return the
- * next node on the stack (the new current node).
- *
- ******************************************************************************/
-
-static ASL_LISTING_NODE *
-LsPopNode (
- void)
-{
- ASL_LISTING_NODE *Lnode;
-
-
- /* Just grab the node at the head of the list */
-
- Lnode = Gbl_ListingNode;
- if ((!Lnode) ||
- (!Lnode->Next))
- {
- AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, NULL,
- "Could not pop empty listing stack");
- return (Gbl_ListingNode);
- }
-
- Gbl_ListingNode = Lnode->Next;
- ACPI_FREE (Lnode);
-
- /* New "Current" node is the new head */
-
- return (Gbl_ListingNode);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: LsCheckException
- *
- * PARAMETERS: LineNumber - Current logical (cumulative) line #
- * FileId - ID of output listing file
- *
- * RETURN: None
- *
- * DESCRIPTION: Check if there is an exception for this line, and if there is,
- * put it in the listing immediately. Handles multiple errors
- * per line. Gbl_NextError points to the next error in the
- * sorted (by line #) list of compile errors/warnings.
- *
- ******************************************************************************/
-
-static void
-LsCheckException (
- UINT32 LineNumber,
- UINT32 FileId)
-{
-
- if ((!Gbl_NextError) ||
- (LineNumber < Gbl_NextError->LogicalLineNumber ))
- {
- return;
- }
-
- /* Handle multiple errors per line */
-
- if (FileId == ASL_FILE_LISTING_OUTPUT)
- {
- while (Gbl_NextError &&
- (LineNumber >= Gbl_NextError->LogicalLineNumber))
- {
- AePrintException (FileId, Gbl_NextError, "\n[****iasl****]\n");
-
- Gbl_NextError = Gbl_NextError->Next;
- }
-
- FlPrintFile (FileId, "\n");
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: LsFlushListingBuffer
- *
- * PARAMETERS: FileId - ID of the listing file
- *
- * RETURN: None
- *
- * DESCRIPTION: Flush out the current contents of the 16-byte hex AML code
- * buffer. Usually called at the termination of a single line
- * of source code or when the buffer is full.
- *
- ******************************************************************************/
-
-static void
-LsFlushListingBuffer (
- UINT32 FileId)
-{
- UINT32 i;
-
-
- if (Gbl_CurrentHexColumn == 0)
- {
- return;
- }
-
- /* Write the hex bytes */
-
- switch (FileId)
- {
- case ASL_FILE_LISTING_OUTPUT:
-
- for (i = 0; i < Gbl_CurrentHexColumn; i++)
- {
- FlPrintFile (FileId, "%2.2X ", Gbl_AmlBuffer[i]);
- }
-
- for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 3); i++)
- {
- FlWriteFile (FileId, ".", 1);
- }
-
- /* Write the ASCII character associated with each of the bytes */
-
- LsDumpAscii (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer);
- break;
-
-
- case ASL_FILE_ASM_SOURCE_OUTPUT:
-
- for (i = 0; i < Gbl_CurrentHexColumn; i++)
- {
- if (i > 0)
- {
- FlPrintFile (FileId, ",");
- }
- FlPrintFile (FileId, "0%2.2Xh", Gbl_AmlBuffer[i]);
- }
-
- for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 5); i++)
- {
- FlWriteFile (FileId, " ", 1);
- }
-
- FlPrintFile (FileId, " ;%8.8X",
- Gbl_CurrentAmlOffset - HEX_LISTING_LINE_SIZE);
-
- /* Write the ASCII character associated with each of the bytes */
-
- LsDumpAscii (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer);
- break;
-
-
- case ASL_FILE_C_SOURCE_OUTPUT:
-
- for (i = 0; i < Gbl_CurrentHexColumn; i++)
- {
- FlPrintFile (FileId, "0x%2.2X,", Gbl_AmlBuffer[i]);
- }
-
- for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 5); i++)
- {
- FlWriteFile (FileId, " ", 1);
- }
-
- FlPrintFile (FileId, " /* %8.8X",
- Gbl_CurrentAmlOffset - HEX_LISTING_LINE_SIZE);
-
- /* Write the ASCII character associated with each of the bytes */
-
- LsDumpAsciiInComment (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer);
- FlPrintFile (FileId, " */");
- break;
-
- default:
- /* No other types supported */
- return;
- }
-
- FlPrintFile (FileId, "\n");
-
- Gbl_CurrentHexColumn = 0;
- Gbl_HexBytesWereWritten = TRUE;
-}
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("asllisting")
-/*******************************************************************************
- *
- * FUNCTION: LsWriteListingHexBytes
- *
- * PARAMETERS: Buffer - AML code buffer
- * Length - Number of AML bytes to write
- * FileId - ID of current listing file.
- *
- * RETURN: None
- *
- * DESCRIPTION: Write the contents of the AML buffer to the listing file via
- * the listing buffer. The listing buffer is flushed every 16
- * AML bytes.
- *
- ******************************************************************************/
+/* Local prototypes */
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-vendor
mailing list