diff options
Diffstat (limited to 'sys/contrib/dev/acpica/compiler/aslcodegen.c')
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslcodegen.c | 113 |
1 files changed, 73 insertions, 40 deletions
diff --git a/sys/contrib/dev/acpica/compiler/aslcodegen.c b/sys/contrib/dev/acpica/compiler/aslcodegen.c index 6087bfbc72e6..234b17a17079 100644 --- a/sys/contrib/dev/acpica/compiler/aslcodegen.c +++ b/sys/contrib/dev/acpica/compiler/aslcodegen.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslcodegen - AML code generation - * $Revision: 51 $ + * $Revision: 1.57 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -116,13 +116,43 @@ *****************************************************************************/ -#include "aslcompiler.h" +#include <contrib/dev/acpica/compiler/aslcompiler.h> #include "aslcompiler.y.h" -#include "amlcode.h" +#include <contrib/dev/acpica/amlcode.h> #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslcodegen") +/* Local prototypes */ + +static ACPI_STATUS +CgAmlWriteWalk ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context); + +static void +CgLocalWriteAmlData ( + ACPI_PARSE_OBJECT *Op, + void *Buffer, + UINT32 Length); + +static void +CgWriteAmlOpcode ( + ACPI_PARSE_OBJECT *Op); + +static void +CgWriteTableHeader ( + ACPI_PARSE_OBJECT *Op); + +static void +CgCloseTable ( + void); + +static void +CgWriteNode ( + ACPI_PARSE_OBJECT *Op); + /******************************************************************************* * @@ -138,7 +168,8 @@ ******************************************************************************/ void -CgGenerateAmlOutput (void) +CgGenerateAmlOutput ( + void) { DbgPrint (ASL_DEBUG_OUTPUT, "\nWriting AML\n\n"); @@ -149,7 +180,8 @@ CgGenerateAmlOutput (void) Gbl_SourceLine = 0; Gbl_NextError = Gbl_ErrorLog; - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, CgAmlWriteWalk, NULL, NULL); + TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, + CgAmlWriteWalk, NULL, NULL); CgCloseTable (); } @@ -166,16 +198,15 @@ CgGenerateAmlOutput (void) * ******************************************************************************/ -ACPI_STATUS +static ACPI_STATUS CgAmlWriteWalk ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context) { - /* - * Debug output - */ + /* Debug output */ + DbgPrint (ASL_TREE_OUTPUT, "%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level); UtPrintFormattedName (Op->Asl.ParseOpcode, Level); @@ -210,9 +241,8 @@ CgAmlWriteWalk ( Op->Asl.Column, Op->Asl.LineNumber); - /* - * Generate the AML for this node - */ + /* Generate the AML for this node */ + CgWriteNode (Op); return (AE_OK); } @@ -222,7 +252,8 @@ CgAmlWriteWalk ( * * FUNCTION: CgLocalWriteAmlData * - * PARAMETERS: Buffer - Buffer to write + * PARAMETERS: Op - Current parse op + * Buffer - Buffer to write * Length - Size of data in buffer * * RETURN: None @@ -231,14 +262,13 @@ CgAmlWriteWalk ( * ******************************************************************************/ -void +static void CgLocalWriteAmlData ( ACPI_PARSE_OBJECT *Op, void *Buffer, UINT32 Length) { - /* Write the raw data to the AML file */ FlWriteFile (ASL_FILE_AML_OUTPUT, Buffer, Length); @@ -264,22 +294,21 @@ CgLocalWriteAmlData ( * ******************************************************************************/ -void +static void CgWriteAmlOpcode ( - ACPI_PARSE_OBJECT *Op) + ACPI_PARSE_OBJECT *Op) { + UINT8 PkgLenFirstByte; + UINT32 i; union { - UINT16 Opcode; - UINT8 OpcodeBytes[2]; + UINT16 Opcode; + UINT8 OpcodeBytes[2]; } Aml; union { - UINT32 Len; - UINT8 LenBytes[4]; + UINT32 Len; + UINT8 LenBytes[4]; } PkgLen; - UINT8 PkgLenFirstByte; - UINT32 i; - /* We expect some DEFAULT_ARGs, just ignore them */ @@ -360,13 +389,16 @@ CgWriteAmlOpcode ( * Encode the "bytes to follow" in the first byte, top two bits. * The low-order nybble of the length is in the bottom 4 bits */ - PkgLenFirstByte = (UINT8) (((UINT32) (Op->Asl.AmlPkgLenBytes - 1) << 6) | - (PkgLen.LenBytes[0] & 0x0F)); + PkgLenFirstByte = (UINT8) + (((UINT32) (Op->Asl.AmlPkgLenBytes - 1) << 6) | + (PkgLen.LenBytes[0] & 0x0F)); CgLocalWriteAmlData (Op, &PkgLenFirstByte, 1); - /* Shift the length over by the 4 bits we just stuffed in the first byte */ - + /* + * Shift the length over by the 4 bits we just stuffed + * in the first byte + */ PkgLen.Len >>= 4; /* Now we can write the remaining bytes - either 1, 2, or 3 bytes */ @@ -382,17 +414,17 @@ CgWriteAmlOpcode ( { case AML_BYTE_OP: - CgLocalWriteAmlData (Op, (UINT8 *) &Op->Asl.Value.Integer, 1); + CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 1); break; case AML_WORD_OP: - CgLocalWriteAmlData (Op, (UINT16 *) &Op->Asl.Value.Integer, 2); + CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 2); break; case AML_DWORD_OP: - CgLocalWriteAmlData (Op, (UINT32 *) &Op->Asl.Value.Integer, 4); + CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 4); break; case AML_QWORD_OP: @@ -418,17 +450,17 @@ CgWriteAmlOpcode ( * * PARAMETERS: Op - The DEFINITIONBLOCK node * - * RETURN: None. + * RETURN: None * * DESCRIPTION: Write a table header corresponding to the DEFINITIONBLOCK * ******************************************************************************/ -void +static void CgWriteTableHeader ( - ACPI_PARSE_OBJECT *Op) + ACPI_PARSE_OBJECT *Op) { - ACPI_PARSE_OBJECT *Child; + ACPI_PARSE_OBJECT *Child; /* AML filename */ @@ -475,7 +507,7 @@ CgWriteTableHeader ( TableHeader.AslCompilerRevision = CompilerCreatorRevision; - /* Table length. Checksum zero for now, will rewrite later */ + /* Table length. Checksum zero for now, will rewrite later */ TableHeader.Length = Gbl_TableLength; TableHeader.Checksum = 0; @@ -497,8 +529,9 @@ CgWriteTableHeader ( * ******************************************************************************/ -void -CgCloseTable (void) +static void +CgCloseTable ( + void) { signed char Sum; UINT8 FileByte; @@ -535,7 +568,7 @@ CgCloseTable (void) * ******************************************************************************/ -void +static void CgWriteNode ( ACPI_PARSE_OBJECT *Op) { |