mirror of
https://github.com/acpica/acpica/
synced 2025-01-16 06:19:19 +03:00
date 2000.11.06.22.56.00; author rmoore1; state Exp;
This commit is contained in:
parent
d7e722ae13
commit
8c2daec72f
@ -1,8 +1,8 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslrestype1 - Short (type1) resource templates and descriptors
|
||||
* $Revision: 1.13 $
|
||||
* Module Name: aslrestype1 - Small (type1) resource templates and descriptors
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -10,8 +10,8 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
|
||||
* All rights reserved.
|
||||
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
|
||||
* reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
@ -116,26 +116,22 @@
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "aslcompiler.y.h"
|
||||
#include "AslCompiler.h"
|
||||
#include "AslCompiler.y.h"
|
||||
#include "aslresource.h"
|
||||
#include "amlcode.h"
|
||||
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
MODULE_NAME ("aslrestype1")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoDmaDescriptor
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS: Node - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION: Construct a short "DMA" descriptor
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -151,12 +147,12 @@ RsDoDmaDescriptor (
|
||||
UINT8 DmaChannelMask = 0;
|
||||
|
||||
|
||||
|
||||
InitializerNode = Node->Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (ASL_DMA_FORMAT_DESC));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Dma.DescriptorType = RESOURCE_DESC_DMA_FORMAT |
|
||||
ASL_RDESC_DMA_SIZE;
|
||||
Descriptor->Dma.DescriptorType = RESOURCE_DESC_DMA_FORMAT;
|
||||
|
||||
|
||||
/*
|
||||
@ -192,17 +188,6 @@ RsDoDmaDescriptor (
|
||||
UtAttachNamepathToOwner (Node, InitializerNode);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
||||
if (InitializerNode->ParseOpcode != DEFAULT_ARG)
|
||||
{
|
||||
DmaChannelMask |= (1 << InitializerNode->Value.Integer8);
|
||||
}
|
||||
|
||||
RsCreateByteField (InitializerNode, ASL_RESNAME_DMA,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.DmaChannelMask));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* DMA channel bytes are handled here, after the flags and name */
|
||||
@ -225,17 +210,16 @@ RsDoDmaDescriptor (
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoEndDependentDescriptor
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS: Node - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION: Construct a short "EndDependentFn" descriptor
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -248,27 +232,26 @@ RsDoEndDependentDescriptor (
|
||||
ASL_RESOURCE_NODE *Rnode;
|
||||
|
||||
|
||||
|
||||
Rnode = RsAllocateResourceNode (sizeof (ASL_END_DEPENDENT_DESC));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->End.DescriptorType = RESOURCE_DESC_END_DEPENDENT |
|
||||
ASL_RDESC_END_DEPEND_SIZE;
|
||||
Descriptor->End.DescriptorType = RESOURCE_DESC_END_DEPENDENT;
|
||||
|
||||
return (Rnode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoFixedIoDescriptor
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS: Node - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION: Construct a short "FixedIO" descriptor
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -283,12 +266,12 @@ RsDoFixedIoDescriptor (
|
||||
UINT32 i;
|
||||
|
||||
|
||||
|
||||
InitializerNode = Node->Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (ASL_FIXED_IO_PORT_DESC));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Iop.DescriptorType = RESOURCE_DESC_FIXED_IO_PORT |
|
||||
ASL_RDESC_FIXED_IO_SIZE;
|
||||
Descriptor->Iop.DescriptorType = RESOURCE_DESC_FIXED_IO_PORT;
|
||||
|
||||
|
||||
/*
|
||||
@ -328,15 +311,13 @@ RsDoFixedIoDescriptor (
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoIoDescriptor
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS: Node - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION: Construct a short "IO" descriptor
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -355,8 +336,7 @@ RsDoIoDescriptor (
|
||||
Rnode = RsAllocateResourceNode (sizeof (ASL_IO_PORT_DESC));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Iop.DescriptorType = RESOURCE_DESC_IO_PORT |
|
||||
ASL_RDESC_IO_SIZE;
|
||||
Descriptor->Iop.DescriptorType = RESOURCE_DESC_IO_PORT;
|
||||
|
||||
|
||||
/*
|
||||
@ -369,8 +349,6 @@ RsDoIoDescriptor (
|
||||
case 0: /* Decode size */
|
||||
|
||||
RsSetFlagBits (&Descriptor->Iop.Information, InitializerNode, 0, 1);
|
||||
RsCreateBitField (InitializerNode, ASL_RESNAME_DECODE,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Iop.Information), 0);
|
||||
break;
|
||||
|
||||
case 1: /* Min Address */
|
||||
@ -416,15 +394,13 @@ RsDoIoDescriptor (
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoIrqDescriptor
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS: Node - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION: Construct a short "IRQ" descriptor
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -440,14 +416,14 @@ RsDoIrqDescriptor (
|
||||
UINT16 IrqMask = 0;
|
||||
|
||||
|
||||
|
||||
InitializerNode = Node->Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (ASL_IRQ_FORMAT_DESC));
|
||||
|
||||
/* Length = 3 (with flag byte) */
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Irq.DescriptorType = RESOURCE_DESC_IRQ_FORMAT |
|
||||
(ASL_RDESC_IRQ_SIZE + 0x01);
|
||||
Descriptor->Irq.DescriptorType = RESOURCE_DESC_IRQ_FORMAT | 0x01;
|
||||
|
||||
|
||||
/*
|
||||
@ -488,10 +464,10 @@ RsDoIrqDescriptor (
|
||||
if (InitializerNode->ParseOpcode != DEFAULT_ARG)
|
||||
{
|
||||
IrqMask |= (1 << InitializerNode->Value.Integer8);
|
||||
}
|
||||
|
||||
RsCreateByteField (InitializerNode, ASL_RESNAME_INTERRUPT,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -516,17 +492,16 @@ RsDoIrqDescriptor (
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoIrqNoFlagsDescriptor
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS: Node - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION: Construct a short "IRQNoFlags" descriptor
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -542,12 +517,12 @@ RsDoIrqNoFlagsDescriptor (
|
||||
UINT16 IrqMask = 0;
|
||||
|
||||
|
||||
|
||||
InitializerNode = Node->Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (ASL_IRQ_NOFLAGS_DESC));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Irq.DescriptorType = RESOURCE_DESC_IRQ_FORMAT |
|
||||
ASL_RDESC_IRQ_SIZE;
|
||||
Descriptor->Irq.DescriptorType = RESOURCE_DESC_IRQ_FORMAT;
|
||||
|
||||
|
||||
/*
|
||||
@ -567,10 +542,10 @@ RsDoIrqNoFlagsDescriptor (
|
||||
if (InitializerNode->ParseOpcode != DEFAULT_ARG)
|
||||
{
|
||||
IrqMask |= (1 << InitializerNode->Value.Integer8);
|
||||
}
|
||||
|
||||
RsCreateByteField (InitializerNode, ASL_RESNAME_INTERRUPT,
|
||||
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -596,17 +571,16 @@ RsDoIrqNoFlagsDescriptor (
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoMemory24Descriptor
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS: Node - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION: Construct a short "Memory24" descriptor
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -621,6 +595,7 @@ RsDoMemory24Descriptor (
|
||||
UINT32 i;
|
||||
|
||||
|
||||
|
||||
InitializerNode = Node->Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (ASL_MEMORY_24_DESC));
|
||||
|
||||
@ -686,15 +661,13 @@ RsDoMemory24Descriptor (
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoMemory32Descriptor
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS: Node - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION: Construct a short "Memory32" descriptor
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -709,6 +682,7 @@ RsDoMemory32Descriptor (
|
||||
UINT32 i;
|
||||
|
||||
|
||||
|
||||
InitializerNode = Node->Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (ASL_MEMORY_32_DESC));
|
||||
|
||||
@ -774,15 +748,13 @@ RsDoMemory32Descriptor (
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoMemory32FixedDescriptor
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS: Node - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION: Construct a short "Memory32Fixed" descriptor
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -797,6 +769,7 @@ RsDoMemory32FixedDescriptor (
|
||||
UINT32 i;
|
||||
|
||||
|
||||
|
||||
InitializerNode = Node->Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (ASL_FIXED_MEMORY_32_DESC));
|
||||
|
||||
@ -846,17 +819,16 @@ RsDoMemory32FixedDescriptor (
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoStartDependentDescriptor
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS: Node - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION: Construct a short "StartDependentFn" descriptor
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -873,6 +845,7 @@ RsDoStartDependentDescriptor (
|
||||
UINT32 i;
|
||||
|
||||
|
||||
|
||||
InitializerNode = Node->Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (ASL_START_DEPENDENT_DESC));
|
||||
|
||||
@ -881,8 +854,7 @@ RsDoStartDependentDescriptor (
|
||||
|
||||
/* Descriptor has priority byte */
|
||||
|
||||
Descriptor->Std.DescriptorType = RESOURCE_DESC_START_DEPENDENT |
|
||||
(ASL_RDESC_ST_DEPEND_SIZE + 0x01);
|
||||
Descriptor->Std.DescriptorType = RESOURCE_DESC_START_DEPENDENT | 0x01;
|
||||
|
||||
|
||||
/*
|
||||
@ -896,7 +868,7 @@ RsDoStartDependentDescriptor (
|
||||
|
||||
if (InitializerNode->Value.Integer8 > 2)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_PRIORITY, InitializerNode, NULL);
|
||||
AslError (ASL_ERROR_INVALID_PRIORITY, InitializerNode->LineNumber);
|
||||
}
|
||||
|
||||
RsSetFlagBits (&Descriptor->Std.Flags, InitializerNode, 0, 0);
|
||||
@ -907,7 +879,7 @@ RsDoStartDependentDescriptor (
|
||||
|
||||
if (InitializerNode->Value.Integer8 > 2)
|
||||
{
|
||||
AslError (ASL_ERROR, ASL_MSG_INVALID_PERFORMANCE, InitializerNode, NULL);
|
||||
AslError (ASL_ERROR_INVALID_PERFORMANCE, InitializerNode->LineNumber);
|
||||
}
|
||||
|
||||
RsSetFlagBits (&Descriptor->Std.Flags, InitializerNode, 2, 0);
|
||||
@ -916,7 +888,10 @@ RsDoStartDependentDescriptor (
|
||||
|
||||
case 2:
|
||||
|
||||
/* Finished with the StartDependent descriptor */
|
||||
/* Finished with the StartDependent descriptor, update buffer pointer */
|
||||
|
||||
//*DescriptorPtr = NEXT_RESOURCE_DESC (Descriptor, ASL_START_DEPENDENT_DESC);
|
||||
|
||||
/* Fall through */
|
||||
|
||||
default:
|
||||
@ -943,15 +918,13 @@ RsDoStartDependentDescriptor (
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoStartDependentNoPriDescriptor
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS: Node - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION: Construct a short "StartDependentNoPri" descriptor
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -967,12 +940,12 @@ RsDoStartDependentNoPriDescriptor (
|
||||
ASL_RESOURCE_NODE *NextRnode;
|
||||
|
||||
|
||||
|
||||
InitializerNode = Node->Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (ASL_START_DEPENDENT_NOPRIO_DESC));
|
||||
|
||||
Descriptor = Rnode->Buffer;
|
||||
Descriptor->Std.DescriptorType = RESOURCE_DESC_START_DEPENDENT |
|
||||
ASL_RDESC_ST_DEPEND_SIZE;
|
||||
Descriptor->Std.DescriptorType = RESOURCE_DESC_START_DEPENDENT;
|
||||
PreviousRnode = Rnode;
|
||||
|
||||
/*
|
||||
@ -1000,15 +973,13 @@ RsDoStartDependentNoPriDescriptor (
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: RsDoVendorSmallDescriptor
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS: Node - Parent resource descriptor parse node
|
||||
* CurrentByteOffset - Offset into the resource template AML
|
||||
* buffer (to track references to the desc)
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Completed resource node
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION: Construct a short "VendorShort" descriptor
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -1023,6 +994,7 @@ RsDoVendorSmallDescriptor (
|
||||
UINT32 i;
|
||||
|
||||
|
||||
|
||||
InitializerNode = Node->Child;
|
||||
Rnode = RsAllocateResourceNode (sizeof (ASL_SMALL_VENDOR_DESC));
|
||||
|
||||
@ -1030,6 +1002,7 @@ RsDoVendorSmallDescriptor (
|
||||
Descriptor->Std.DescriptorType = RESOURCE_DESC_SMALL_VENDOR;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Process all child initialization nodes
|
||||
*/
|
||||
@ -1048,3 +1021,6 @@ RsDoVendorSmallDescriptor (
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslutils -- compiler utilities
|
||||
* $Revision: 1.30 $
|
||||
* $Revision: 1.9 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -10,8 +10,8 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
|
||||
* All rights reserved.
|
||||
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
|
||||
* reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
@ -116,31 +116,23 @@
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include "aslcompiler.h"
|
||||
#include "AslCompiler.h"
|
||||
#include "acnamesp.h"
|
||||
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
MODULE_NAME ("aslutils")
|
||||
|
||||
#ifdef _USE_BERKELEY_YACC
|
||||
extern const char * const AslCompilername[];
|
||||
static const char * const *yytname = &AslCompilername[255];
|
||||
#else
|
||||
extern const char * const yytname[];
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtLocalCalloc
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS: Size - Bytes to be allocated
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Pointer to the allocated memory. Guaranteed to be valid.
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION: Allocate zero-initialized memory. Aborts the compile on an
|
||||
* allocation failure, on the assumption that nothing more can be
|
||||
* accomplished.
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -151,14 +143,11 @@ UtLocalCalloc (
|
||||
void *Allocated;
|
||||
|
||||
|
||||
Allocated = AcpiCmCallocate (Size);
|
||||
Allocated = calloc (Size, 1);
|
||||
if (!Allocated)
|
||||
{
|
||||
AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
|
||||
Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
|
||||
Gbl_InputByteCount, Gbl_CurrentColumn,
|
||||
Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
|
||||
exit (1);
|
||||
AslError (ASL_ERROR_MEMORY_ALLOCATION, 0);
|
||||
/*TBD: Abort */
|
||||
}
|
||||
|
||||
return Allocated;
|
||||
@ -167,13 +156,48 @@ UtLocalCalloc (
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtHexCharToValue
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS: hc - Hex character in Ascii
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: The binary value of the hex character
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION: Perform ascii-to-hex translation
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void *
|
||||
UtLocalRealloc (
|
||||
void *Previous,
|
||||
UINT32 ValidSize,
|
||||
UINT32 AdditionalSize)
|
||||
{
|
||||
char *Allocated;
|
||||
|
||||
|
||||
Allocated = (char *) realloc (Previous, ValidSize + AdditionalSize);
|
||||
if (!Allocated)
|
||||
{
|
||||
AslError (ASL_ERROR_MEMORY_ALLOCATION, 0);
|
||||
/*TBD: Abort */
|
||||
}
|
||||
|
||||
/* Zero out the new part of the buffer */
|
||||
|
||||
memset (Allocated + ValidSize, 0, AdditionalSize);
|
||||
return Allocated;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -183,29 +207,27 @@ UtHexCharToValue (
|
||||
{
|
||||
if (hc <= 0x39)
|
||||
{
|
||||
return ((UINT8) (hc - 0x30));
|
||||
return (hc - 0x30);
|
||||
}
|
||||
|
||||
if (hc <= 0x46)
|
||||
{
|
||||
return ((UINT8) (hc - 0x37));
|
||||
return (hc - 0x37);
|
||||
}
|
||||
|
||||
return ((UINT8) (hc - 0x57));
|
||||
return (hc - 0x57);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtConvertByteToHex
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS: RawByte - Binary data
|
||||
* *Buffer - Pointer to where the hex bytes will be stored
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Ascii hex byte is stored in Buffer.
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed
|
||||
* with "0x"
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -223,23 +245,21 @@ UtConvertByteToHex (
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: DbgPrint
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS: Fmt - Printf format string
|
||||
* ... - variable printf list
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: None
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION: Conditional print statement. Prints to stderr only if the
|
||||
* debug flag is set.
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
int
|
||||
DbgPrint (
|
||||
UINT32 Type,
|
||||
char *Fmt,
|
||||
...)
|
||||
{
|
||||
@ -248,18 +268,7 @@ DbgPrint (
|
||||
|
||||
va_start (Args, Fmt);
|
||||
|
||||
if (!Gbl_DebugFlag)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if ((Type == ASL_PARSE_OUTPUT) &&
|
||||
(!(AslCompilerdebug)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (Gbl_DebugFlag)
|
||||
vfprintf (stderr, Fmt, Args);
|
||||
|
||||
va_end (Args);
|
||||
@ -267,16 +276,16 @@ DbgPrint (
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtPrintFormattedName
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS: ParseOpcode - Parser keyword ID
|
||||
* Level - Indentation level
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: None
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION: Print the ascii name of the parse opcode.
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -288,28 +297,26 @@ UtPrintFormattedName (
|
||||
UINT32 Level)
|
||||
{
|
||||
|
||||
DbgPrint (ASL_TREE_OUTPUT,
|
||||
"%*s %-16.16s", (3 * Level), " ",
|
||||
yytname[ParseOpcode-255]);
|
||||
|
||||
DbgPrint ("%*s %-16.16s", (4 * Level), " ", yytname[ParseOpcode-255]);
|
||||
|
||||
|
||||
if (Level < TEXT_OFFSET)
|
||||
{
|
||||
DbgPrint (ASL_TREE_OUTPUT,
|
||||
"%*s", (TEXT_OFFSET - Level) * 3, " ");
|
||||
DbgPrint ("%*s", (TEXT_OFFSET - Level) * 4, " ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtGetOpName
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS: ParseOpcode - Parser keyword ID
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Pointer to the opcode name
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION: Get the ascii name of the parse opcode
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -321,9 +328,10 @@ UtGetOpName (
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtDisplaySummary
|
||||
* FUNCTION: AslDisplaySummary
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
@ -335,92 +343,32 @@ UtGetOpName (
|
||||
|
||||
void
|
||||
UtDisplaySummary (
|
||||
UINT32 FileId)
|
||||
void)
|
||||
{
|
||||
|
||||
|
||||
FlPrintFile (FileId,
|
||||
"Compilation complete. %d Errors %d Warnings\n",
|
||||
Gbl_ExceptionCount[ASL_ERROR], Gbl_ExceptionCount[ASL_WARNING]);
|
||||
printf ("Compilation complete. %d Errors %d Warnings\n", ErrorCount, WarningCount);
|
||||
printf ("ASL Input: %d lines, %d bytes, %d keywords\n",
|
||||
Gbl_CurrentLineNumber, Gbl_InputByteCount, TotalKeywords);
|
||||
|
||||
FlPrintFile (FileId,
|
||||
"ASL Input: %s - %d lines, %d bytes, %d keywords\n",
|
||||
Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber,
|
||||
Gbl_InputByteCount, TotalKeywords);
|
||||
|
||||
if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors))
|
||||
if ((ErrorCount == 0) || (Gbl_IgnoreErrors))
|
||||
{
|
||||
FlPrintFile (FileId,
|
||||
"AML Output: %s - %d bytes %d named objects %d executable opcodes\n\n",
|
||||
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength,
|
||||
TotalNamedObjects, TotalExecutableOpcodes);
|
||||
printf ("AML Output: %s - %d bytes %d named objects %d executable opcodes\n\n",
|
||||
Gbl_OutputFilename, Gbl_TableLength, TotalNamedObjects, TotalExecutableOpcodes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtDisplaySummary
|
||||
*
|
||||
* PARAMETERS: Node - Integer parse node
|
||||
* LowValue - Smallest allowed value
|
||||
* HighValue - Largest allowed value
|
||||
*
|
||||
* RETURN: Node if OK, otherwise NULL
|
||||
*
|
||||
* DESCRIPTION: Check integer for an allowable range
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_PARSE_NODE *
|
||||
UtCheckIntegerRange (
|
||||
ASL_PARSE_NODE *Node,
|
||||
UINT32 LowValue,
|
||||
UINT32 HighValue)
|
||||
{
|
||||
char *ParseError = NULL;
|
||||
char Buffer[64];
|
||||
|
||||
|
||||
if (!Node)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (Node->Value.Integer64 < LowValue)
|
||||
{
|
||||
ParseError = "Value below valid range";
|
||||
}
|
||||
|
||||
if (Node->Value.Integer64 > HighValue)
|
||||
{
|
||||
ParseError = "Value above valid range";
|
||||
}
|
||||
|
||||
if (ParseError)
|
||||
{
|
||||
sprintf (Buffer, "%s 0x%X-0x%X", ParseError, LowValue, HighValue);
|
||||
AslCompilererror (Buffer);
|
||||
AcpiCmFree (Node);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return Node;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtAttachNamepathToOwner
|
||||
* FUNCTION:
|
||||
*
|
||||
* PARAMETERS: Node - Parent parse node
|
||||
* NameNode - Node that contains the name
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Sets the ExternalName and Namepath in the parent node
|
||||
* RETURN:
|
||||
*
|
||||
* DESCRIPTION: Store the name in two forms in the parent node: The original
|
||||
* (external) name, and the internalized name that is used within
|
||||
* the ACPI namespace manager.
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -432,6 +380,7 @@ UtAttachNamepathToOwner (
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
|
||||
Node->ExternalName = NameNode->Value.String;
|
||||
|
||||
Status = AcpiNsInternalizeName (NameNode->Value.String, &Node->Namepath);
|
||||
@ -443,202 +392,7 @@ UtAttachNamepathToOwner (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: strtoul
|
||||
*
|
||||
* PARAMETERS: String - Null terminated string
|
||||
* Terminater - Where a pointer to the terminating byte is returned
|
||||
* Base - Radix of the string
|
||||
*
|
||||
* RETURN: Converted value
|
||||
*
|
||||
* DESCRIPTION: Convert a string into an unsigned value.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define NEGATIVE 1
|
||||
#define POSITIVE 0
|
||||
|
||||
ACPI_INTEGER
|
||||
UtStrtoul64 (
|
||||
NATIVE_CHAR *String,
|
||||
NATIVE_CHAR **Terminator,
|
||||
UINT32 Base)
|
||||
{
|
||||
UINT32 converted = 0;
|
||||
UINT32 index;
|
||||
UINT32 sign;
|
||||
NATIVE_CHAR *StringStart;
|
||||
ACPI_INTEGER ReturnValue = 0;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
|
||||
|
||||
/*
|
||||
* Save the value of the pointer to the buffer's first
|
||||
* character, save the current errno value, and then
|
||||
* skip over any white space in the buffer:
|
||||
*/
|
||||
StringStart = String;
|
||||
while (isspace (*String) || *String == '\t')
|
||||
{
|
||||
++String;
|
||||
}
|
||||
|
||||
/*
|
||||
* The buffer may contain an optional plus or minus sign.
|
||||
* If it does, then skip over it but remember what is was:
|
||||
*/
|
||||
if (*String == '-')
|
||||
{
|
||||
sign = NEGATIVE;
|
||||
++String;
|
||||
}
|
||||
|
||||
else if (*String == '+')
|
||||
{
|
||||
++String;
|
||||
sign = POSITIVE;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
sign = POSITIVE;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the input parameter Base is zero, then we need to
|
||||
* determine if it is octal, decimal, or hexadecimal:
|
||||
*/
|
||||
if (Base == 0)
|
||||
{
|
||||
if (*String == '0')
|
||||
{
|
||||
if (tolower (*(++String)) == 'x')
|
||||
{
|
||||
Base = 16;
|
||||
++String;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Base = 8;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Base = 10;
|
||||
}
|
||||
}
|
||||
|
||||
else if (Base < 2 || Base > 36)
|
||||
{
|
||||
/*
|
||||
* The specified Base parameter is not in the domain of
|
||||
* this function:
|
||||
*/
|
||||
goto done;
|
||||
}
|
||||
|
||||
/*
|
||||
* For octal and hexadecimal bases, skip over the leading
|
||||
* 0 or 0x, if they are present.
|
||||
*/
|
||||
if (Base == 8 && *String == '0')
|
||||
{
|
||||
String++;
|
||||
}
|
||||
|
||||
if (Base == 16 &&
|
||||
*String == '0' &&
|
||||
tolower (*(++String)) == 'x')
|
||||
{
|
||||
String++;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Main loop: convert the string to an unsigned long:
|
||||
*/
|
||||
while (*String)
|
||||
{
|
||||
if (isdigit (*String))
|
||||
{
|
||||
index = *String - '0';
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
index = toupper (*String);
|
||||
if (isupper (index))
|
||||
{
|
||||
index = index - 'A' + 10;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if (index >= Base)
|
||||
{
|
||||
goto done;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check to see if value is out of range:
|
||||
*/
|
||||
|
||||
if (ReturnValue > ((ACPI_INTEGER_MAX - (ACPI_INTEGER) index) /
|
||||
(ACPI_INTEGER) Base))
|
||||
{
|
||||
Status = AE_ERROR;
|
||||
ReturnValue = 0L; /* reset */
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
ReturnValue *= Base;
|
||||
ReturnValue += index;
|
||||
converted = 1;
|
||||
}
|
||||
|
||||
++String;
|
||||
}
|
||||
|
||||
done:
|
||||
/*
|
||||
* If appropriate, update the caller's pointer to the next
|
||||
* unconverted character in the buffer.
|
||||
*/
|
||||
if (Terminator)
|
||||
{
|
||||
if (converted == 0 && ReturnValue == 0L && String != NULL)
|
||||
{
|
||||
*Terminator = (NATIVE_CHAR *) StringStart;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
*Terminator = (NATIVE_CHAR *) String;
|
||||
}
|
||||
}
|
||||
|
||||
if (Status == AE_ERROR)
|
||||
{
|
||||
ReturnValue = ACPI_INTEGER_MAX;
|
||||
}
|
||||
|
||||
/*
|
||||
* If a minus sign was present, then "the conversion is negated":
|
||||
*/
|
||||
if (sign == NEGATIVE)
|
||||
{
|
||||
ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1;
|
||||
}
|
||||
|
||||
return (ReturnValue);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user