mirror of
https://github.com/acpica/acpica/
synced 2025-02-24 01:14:46 +03:00
date 2000.10.10.22.45.00; author rmoore1; state Exp;
This commit is contained in:
parent
ea5e90c0d1
commit
3ec4f6432f
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslcodegen - AML code generation
|
||||
* $Revision: 1.4 $
|
||||
* $Revision: 1.5 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -116,21 +116,12 @@
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "AslCompiler.y.h"
|
||||
#include "AslCompiler.h"
|
||||
#include "acpi.h"
|
||||
#include "AslCompiler.y.h"
|
||||
#include "amlcode.h"
|
||||
|
||||
|
||||
|
||||
extern const char * const yytname[];
|
||||
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -146,33 +137,47 @@ extern const char * const yytname[];
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
CgGenerateOutput(
|
||||
void)
|
||||
CgAmlWriteWalk (
|
||||
ASL_PARSE_NODE *Node,
|
||||
UINT32 Level,
|
||||
void *Context)
|
||||
{
|
||||
|
||||
|
||||
if (!RootNode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UtPrintFormattedName (Node->ParseOpcode, Level);
|
||||
|
||||
DbgPrint ("\nGenerating AML opcodes\n\n");
|
||||
TgWalkParseTree (ASL_WALK_VISIT_UPWARD, CgAmlOpcodeWalk, NULL);
|
||||
if (Node->ParseOpcode == NAMESEG ||
|
||||
Node->ParseOpcode == NAMESTRING)
|
||||
{
|
||||
DbgPrint ("%4.4s ", Node->Value.String);
|
||||
}
|
||||
|
||||
DbgPrint ("\nGenerating Package lengths\n\n");
|
||||
TgWalkParseTree (ASL_WALK_VISIT_UPWARD, CgAmlPackageLengthWalk, NULL);
|
||||
else
|
||||
{
|
||||
DbgPrint (" ");
|
||||
}
|
||||
|
||||
DbgPrint ("Value %08X ParseOp 0x%04X AmlOp %04X OpLen %01X PByts %01X Len %04X SubLen %04X ParentSubLen %04X Node %X Chld %X Paren %X\n",
|
||||
Node->Value.Integer,
|
||||
Node->ParseOpcode,
|
||||
Node->AmlOpcode,
|
||||
Node->AmlOpcodeLength,
|
||||
Node->AmlPkgLenBytes,
|
||||
Node->AmlLength,
|
||||
Node->AmlSubtreeLength,
|
||||
Node->Parent ? Node->Parent->AmlSubtreeLength : 0,
|
||||
Node,
|
||||
Node->Child,
|
||||
Node->Parent);
|
||||
|
||||
DbgPrint ("\nWriting AML\n\n");
|
||||
TgWalkParseTree (ASL_WALK_VISIT_DOWNWARD, CgAmlWriteWalk, NULL);
|
||||
|
||||
|
||||
CgCloseTable ();
|
||||
fclose (Gbl_OutputAmlFile);
|
||||
CgWriteNode (Node);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION:
|
||||
@ -447,7 +452,7 @@ CgCloseTable (void)
|
||||
|
||||
void
|
||||
CgWriteNode (
|
||||
ASL_PARSE_NODE *Node)
|
||||
ASL_PARSE_NODE *Node)
|
||||
{
|
||||
|
||||
/* TEMP FIX: always check for DEFAULT_ARG */
|
||||
@ -489,164 +494,6 @@ CgWriteNode (
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#define TEXT_OFFSET 10
|
||||
|
||||
void
|
||||
CgPrintFormattedName (
|
||||
UINT16 ParseOpcode,
|
||||
UINT32 Level)
|
||||
{
|
||||
UINT32 i;
|
||||
|
||||
|
||||
for (i = 0; i < Level; i++)
|
||||
{
|
||||
DbgPrint (" ");
|
||||
}
|
||||
|
||||
|
||||
DbgPrint ("%-16.16s", yytname[ParseOpcode-255]);
|
||||
|
||||
|
||||
if (Level < TEXT_OFFSET)
|
||||
{
|
||||
for (i = 0; i < (TEXT_OFFSET - Level); i++)
|
||||
{
|
||||
DbgPrint (" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
CgAmlOpcodeWalk (
|
||||
ASL_PARSE_NODE *Node,
|
||||
UINT32 Level,
|
||||
void *Context)
|
||||
{
|
||||
|
||||
CgGenerateAmlOpcode (Node);
|
||||
CgGenerateAmlOperands (Node);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
CgAmlPackageLengthWalk (
|
||||
ASL_PARSE_NODE *Node,
|
||||
UINT32 Level,
|
||||
void *Context)
|
||||
{
|
||||
|
||||
|
||||
|
||||
/* TBD Do an "init nodes" walk */
|
||||
/*
|
||||
Node->AmlLength = 0;
|
||||
Node->AmlOpcodeLength = 0;
|
||||
Node->AmlSubtreeLength = 0;
|
||||
Node->AmlPkgLenBytes = 0;
|
||||
*/
|
||||
/*
|
||||
* generate the subtree length and
|
||||
* bubble it up to the parent
|
||||
*/
|
||||
CgGenerateAmlLengths (Node);
|
||||
if ((Node->Parent) &&
|
||||
(Node->ParseOpcode != DEFAULT_ARG))
|
||||
{
|
||||
Node->Parent->AmlSubtreeLength += (Node->AmlLength +
|
||||
Node->AmlOpcodeLength +
|
||||
Node->AmlPkgLenBytes + Node->AmlSubtreeLength);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
CgAmlWriteWalk (
|
||||
ASL_PARSE_NODE *Node,
|
||||
UINT32 Level,
|
||||
void *Context)
|
||||
{
|
||||
|
||||
|
||||
|
||||
CgPrintFormattedName (Node->ParseOpcode, Level);
|
||||
|
||||
if (Node->ParseOpcode == NAMESEG ||
|
||||
Node->ParseOpcode == NAMESTRING)
|
||||
{
|
||||
DbgPrint ("%4.4s ", Node->Value.String);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
DbgPrint (" ");
|
||||
}
|
||||
|
||||
DbgPrint ("Value %08X ParseOp 0x%04X AmlOp %04X OpLen %01X PByts %01X Len %04X SubLen %04X ParentSubLen %04X Node %X Chld %X Paren %X\n",
|
||||
Node->Value.Integer,
|
||||
Node->ParseOpcode,
|
||||
Node->AmlOpcode,
|
||||
Node->AmlOpcodeLength,
|
||||
Node->AmlPkgLenBytes,
|
||||
Node->AmlLength,
|
||||
Node->AmlSubtreeLength,
|
||||
Node->Parent ? Node->Parent->AmlSubtreeLength : 0,
|
||||
Node,
|
||||
Node->Child,
|
||||
Node->Parent);
|
||||
|
||||
CgWriteNode (Node);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslcompiler.h - common include file
|
||||
* $Revision: 1.4 $
|
||||
* $Revision: 1.5 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -120,14 +120,24 @@
|
||||
#define AslCompiler_C_INTERFACE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include "acpi.h"
|
||||
|
||||
|
||||
#define CompilerId "ACPI Component Architecture ASL Compiler"
|
||||
#define CompilerName "iasl"
|
||||
#define Version "X202"
|
||||
|
||||
|
||||
|
||||
|
||||
#define ASL_PARSE_OPCODE_BASE ACCESSAS /* First Lex type */
|
||||
|
||||
|
||||
/* TBD: define new (2.0) opcodes - move to amlcode.h */
|
||||
|
||||
#define AML_BREAKPOINT_OP (UINT16) 0x00FE
|
||||
#define AML_BUFF_OP (UINT16) 0x00FE
|
||||
#define AML_CASE_OP (UINT16) 0x00FE
|
||||
#define AML_CONCAT_TPL_OP (UINT16) 0x00FE
|
||||
@ -393,6 +403,9 @@ void
|
||||
CgCloseTable (void);
|
||||
|
||||
|
||||
void
|
||||
CgWriteNode (
|
||||
ASL_PARSE_NODE *Node);
|
||||
|
||||
|
||||
void
|
||||
@ -441,5 +454,32 @@ _TgLinkChildNode (
|
||||
ASL_PARSE_NODE *Node2);
|
||||
|
||||
|
||||
/* Utils */
|
||||
|
||||
void
|
||||
UtPrintFormattedName (
|
||||
UINT16 ParseOpcode,
|
||||
UINT32 Level);
|
||||
|
||||
ACPI_STATUS
|
||||
UtOpenAllFiles (
|
||||
char *InputFilename);
|
||||
|
||||
void
|
||||
UtDisplaySummary (
|
||||
void);
|
||||
|
||||
|
||||
UINT8
|
||||
UtHexCharToValue (
|
||||
int hc);
|
||||
|
||||
|
||||
char *
|
||||
UtGetOpName (
|
||||
UINT32 ParseOpcode);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslcompiler.y - Bison input file (ASL grammar and actions)
|
||||
* $Revision: 1.4 $
|
||||
* $Revision: 1.5 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -1906,7 +1906,7 @@ PackageElement
|
||||
|
||||
EISAIDTerm
|
||||
: EISAID '('
|
||||
StringData ')' {$$ = TgCreateLeafNode (EISAID, $3);}
|
||||
StringData ')' {$$ = TgUpdateNode (EISAID, $3);}
|
||||
;
|
||||
|
||||
|
||||
@ -1949,6 +1949,9 @@ DDBHandle
|
||||
;
|
||||
|
||||
|
||||
/******* Object References ***********************************************/
|
||||
|
||||
|
||||
NameString
|
||||
: NameSeg {}
|
||||
| NAMESTRING {$$ = TgCreateLeafNode (NAMESTRING, AslCompilerlval.s);}
|
||||
|
Loading…
x
Reference in New Issue
Block a user