mirror of
https://github.com/acpica/acpica/
synced 2025-01-15 05:49:18 +03:00
Standardized all references to AML code to "AmlStart" and "AmlLength",
replacing things like Pcode, AmlPtr, etc. date 2001.09.11.21.16.00; author rmoore1; state Exp;
This commit is contained in:
parent
e603a99255
commit
0eb0b46952
@ -8,8 +8,8 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
|
||||
* reserved.
|
||||
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
@ -126,22 +126,13 @@ extern UINT8 *DsdtPtr;
|
||||
extern UINT32 AcpiDsdtLength;
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
extern UINT8 *AmlPtr;
|
||||
extern UINT32 AcpiAmlLength;
|
||||
extern UINT8 *AmlStart;
|
||||
extern UINT32 AmlLength;
|
||||
extern FILE *AcpiGbl_DebugFile;
|
||||
|
||||
extern char LineBuf[80];
|
||||
extern char CommandBuf[40];
|
||||
extern char ArgBuf[40];
|
||||
extern char ScopeBuf[40];
|
||||
extern char DebugFilename[40];
|
||||
extern FILE *DebugFile;
|
||||
extern char *Buffer;
|
||||
extern char *Filename;
|
||||
|
||||
#define BUFFER_SIZE 4196
|
||||
|
||||
/*
|
||||
* MCW 3/23/00 Debug Regions
|
||||
* Debug Regions
|
||||
*/
|
||||
typedef struct Region
|
||||
{
|
||||
@ -159,10 +150,10 @@ typedef struct DebugRegions
|
||||
|
||||
} DEBUG_REGIONS;
|
||||
|
||||
/*
|
||||
* MCW 3/23/00 End Debug regions
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pointer overlay for 16-bit code
|
||||
*/
|
||||
typedef union ptr_ovl
|
||||
{
|
||||
void *ptr;
|
||||
|
@ -1,6 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aeexec - Top level parse and execute routines
|
||||
* $Revision: 1.42 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -8,8 +9,8 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
|
||||
* reserved.
|
||||
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
@ -124,14 +125,14 @@
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#define _COMPONENT PARSER
|
||||
#define _COMPONENT ACPI_TOOLS
|
||||
MODULE_NAME ("aeexec")
|
||||
|
||||
|
||||
ACPI_PARSE_OBJECT *AcpiGbl_ParsedNamespaceRoot;
|
||||
ACPI_PARSE_OBJECT *root;
|
||||
UINT8 *AmlPtr;
|
||||
UINT32 AcpiAmlLength;
|
||||
UINT8 *AmlStart;
|
||||
UINT32 AmlLength;
|
||||
UINT8 *DsdtPtr;
|
||||
UINT32 AcpiDsdtLength;
|
||||
|
||||
@ -151,7 +152,7 @@ static char *AcpiGbl_RegionNames[] = /* printable names of AC
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiCmFormatSpaceId
|
||||
* FUNCTION: AcpiUtFormatSpaceId
|
||||
*
|
||||
* PARAMETERS: Status - Acpi status to be formatted
|
||||
*
|
||||
@ -162,7 +163,7 @@ static char *AcpiGbl_RegionNames[] = /* printable names of AC
|
||||
****************************************************************************/
|
||||
|
||||
char *
|
||||
AcpiCmFormatSpaceId (
|
||||
AcpiUtFormatSpaceId (
|
||||
UINT32 SpaceId)
|
||||
{
|
||||
|
||||
@ -177,7 +178,7 @@ AcpiCmFormatSpaceId (
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: RegionHandler
|
||||
* FUNCTION: AeRegionHandler
|
||||
*
|
||||
* PARAMETERS: Standard region handler parameters
|
||||
*
|
||||
@ -189,16 +190,16 @@ AcpiCmFormatSpaceId (
|
||||
*****************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
RegionHandler (
|
||||
UINT32 Function,
|
||||
ACPI_PHYSICAL_ADDRESS Address,
|
||||
UINT32 BitWidth,
|
||||
UINT32 *Value,
|
||||
void *HandlerContext,
|
||||
void *RegionContext)
|
||||
AeRegionHandler (
|
||||
UINT32 Function,
|
||||
ACPI_PHYSICAL_ADDRESS Address,
|
||||
UINT32 BitWidth,
|
||||
UINT32 *Value,
|
||||
void *HandlerContext,
|
||||
void *RegionContext)
|
||||
{
|
||||
|
||||
ACPI_OPERAND_OBJECT *RegionObject = (ACPI_OPERAND_OBJECT*)RegionContext;
|
||||
ACPI_OPERAND_OBJECT *RegionObject = (ACPI_OPERAND_OBJECT*) RegionContext;
|
||||
ACPI_PHYSICAL_ADDRESS BaseAddress;
|
||||
UINT32 Length;
|
||||
BOOLEAN BufferExists;
|
||||
@ -207,6 +208,9 @@ RegionHandler (
|
||||
UINT32 ByteWidth;
|
||||
|
||||
|
||||
PROC_NAME ("AeRegionHandler");
|
||||
|
||||
|
||||
/*
|
||||
* If the object is not a region, simply return
|
||||
*/
|
||||
@ -215,8 +219,8 @@ RegionHandler (
|
||||
return AE_OK;
|
||||
}
|
||||
|
||||
DEBUG_PRINT (TRACE_OPREGION, ("Operation Region request on %s at 0x%X\n",
|
||||
AcpiCmFormatSpaceId (RegionObject->Region.SpaceId),
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Operation Region request on %s at 0x%X\n",
|
||||
AcpiUtFormatSpaceId (RegionObject->Region.SpaceId),
|
||||
Address));
|
||||
|
||||
|
||||
@ -231,7 +235,6 @@ RegionHandler (
|
||||
* Search through the linked list for this region's buffer
|
||||
*/
|
||||
BufferExists = FALSE;
|
||||
|
||||
RegionElement = Regions.RegionList;
|
||||
|
||||
if (0 != Regions.NumberOfRegions)
|
||||
@ -264,20 +267,17 @@ RegionHandler (
|
||||
return AE_NO_MEMORY;
|
||||
}
|
||||
|
||||
RegionElement->Buffer = AcpiOsAllocate (Length);
|
||||
RegionElement->Buffer = AcpiOsCallocate (Length);
|
||||
if (!RegionElement->Buffer)
|
||||
{
|
||||
AcpiOsFree (RegionElement);
|
||||
return AE_NO_MEMORY;
|
||||
}
|
||||
|
||||
RegionElement->Address = BaseAddress;
|
||||
RegionElement->Address = BaseAddress;
|
||||
RegionElement->Length = Length;
|
||||
RegionElement->NextRegion = NULL;
|
||||
|
||||
RegionElement->Length = Length;
|
||||
|
||||
MEMSET(RegionElement->Buffer, 0, Length);
|
||||
|
||||
RegionElement->NextRegion = NULL;
|
||||
|
||||
/*
|
||||
* Increment the number of regions and put this one
|
||||
@ -306,34 +306,40 @@ RegionHandler (
|
||||
|
||||
/*
|
||||
* The buffer exists and is pointed to by RegionElement.
|
||||
* We now need to verify the request is valid and perform the operation.
|
||||
* We now need to verify the request is valid and perform the operation.
|
||||
*
|
||||
* NOTE: RegionElement->Length is in bytes, therefore it we compare against
|
||||
* ByteWidth (see above)
|
||||
* ByteWidth (see above)
|
||||
*/
|
||||
if ((Address + ByteWidth) > (RegionElement->Address + RegionElement->Length))
|
||||
if (((ACPI_INTEGER) Address + ByteWidth) >
|
||||
((ACPI_INTEGER)(RegionElement->Address) + RegionElement->Length))
|
||||
{
|
||||
return AE_BUFFER_OVERFLOW;
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Request on [%4.4s] is beyond region limit Req-%lX+%lX, Base=%lX, Len-%lX\n",
|
||||
&((RegionObject->Region.Node)->Name), (UINT32) Address, ByteWidth, (UINT32)(RegionElement->Address),
|
||||
RegionElement->Length));
|
||||
|
||||
return AE_AML_REGION_LIMIT;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get BufferValue to point to the "address" in the buffer
|
||||
*/
|
||||
BufferValue = ((UINT8 *)RegionElement->Buffer + (Address - RegionElement->Address));
|
||||
BufferValue = ((UINT8 *) RegionElement->Buffer +
|
||||
((ACPI_INTEGER) Address - (ACPI_INTEGER) RegionElement->Address));
|
||||
|
||||
/*
|
||||
* Perform a read or write to the buffer space
|
||||
*/
|
||||
switch (Function)
|
||||
{
|
||||
case ADDRESS_SPACE_READ:
|
||||
case ACPI_READ_ADR_SPACE:
|
||||
/*
|
||||
* Set the pointer Value to whatever is in the buffer
|
||||
*/
|
||||
MEMCPY (Value, BufferValue, ByteWidth);
|
||||
break;
|
||||
|
||||
case ADDRESS_SPACE_WRITE:
|
||||
case ACPI_WRITE_ADR_SPACE:
|
||||
/*
|
||||
* Write the contents of Value to the buffer
|
||||
*/
|
||||
@ -350,7 +356,7 @@ RegionHandler (
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: RegionInit
|
||||
* FUNCTION: AeRegionInit
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
@ -361,7 +367,7 @@ RegionHandler (
|
||||
*****************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
RegionInit (
|
||||
AeRegionInit (
|
||||
ACPI_HANDLE RegionHandle,
|
||||
UINT32 Function,
|
||||
void *HandlerContext,
|
||||
@ -378,7 +384,7 @@ RegionInit (
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: NotifyHandler
|
||||
* FUNCTION: AeNotifyHandler
|
||||
*
|
||||
* PARAMETERS: Standard notify handler parameters
|
||||
*
|
||||
@ -391,7 +397,7 @@ RegionInit (
|
||||
*****************************************************************************/
|
||||
|
||||
void
|
||||
NotifyHandler (
|
||||
AeNotifyHandler (
|
||||
ACPI_HANDLE Device,
|
||||
UINT32 Value,
|
||||
void *Context)
|
||||
@ -401,7 +407,7 @@ NotifyHandler (
|
||||
{
|
||||
case 0:
|
||||
printf ("**** Method Error 0x%X: Results not equal\n", Value);
|
||||
if (DebugFile)
|
||||
if (AcpiGbl_DebugFile)
|
||||
{
|
||||
AcpiOsPrintf ("**** Method Error: Results not equal\n");
|
||||
}
|
||||
@ -410,7 +416,7 @@ NotifyHandler (
|
||||
|
||||
case 1:
|
||||
printf ("**** Method Error: Incorrect numeric result\n");
|
||||
if (DebugFile)
|
||||
if (AcpiGbl_DebugFile)
|
||||
{
|
||||
AcpiOsPrintf ("**** Method Error: Incorrect numeric result\n");
|
||||
}
|
||||
@ -419,7 +425,7 @@ NotifyHandler (
|
||||
|
||||
case 2:
|
||||
printf ("**** Method Error: An operand was overwritten\n");
|
||||
if (DebugFile)
|
||||
if (AcpiGbl_DebugFile)
|
||||
{
|
||||
AcpiOsPrintf ("**** Method Error: An operand was overwritten\n");
|
||||
}
|
||||
@ -428,7 +434,7 @@ NotifyHandler (
|
||||
|
||||
default:
|
||||
printf ("**** Received a notify, value 0x%X\n", Value);
|
||||
if (DebugFile)
|
||||
if (AcpiGbl_DebugFile)
|
||||
{
|
||||
AcpiOsPrintf ("**** Received a notify, value 0x%X\n", Value);
|
||||
}
|
||||
@ -459,7 +465,7 @@ AeInstallHandlers (void)
|
||||
|
||||
|
||||
Status = AcpiInstallNotifyHandler (ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY,
|
||||
NotifyHandler, NULL);
|
||||
AeNotifyHandler, NULL);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
printf ("Could not install a global notify handler\n");
|
||||
@ -467,12 +473,14 @@ AeInstallHandlers (void)
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
Status = AcpiRemoveAddressSpaceHandler (AcpiGbl_RootNode, (ACPI_ADDRESS_SPACE_TYPE) i, RegionHandler);
|
||||
Status = AcpiRemoveAddressSpaceHandler (AcpiGbl_RootNode,
|
||||
(ACPI_ADR_SPACE_TYPE) i, AeRegionHandler);
|
||||
|
||||
/* Install handler at the root object.
|
||||
* TBD: all default handlers should be installed here!
|
||||
*/
|
||||
Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode, i, RegionHandler, RegionInit, NULL);
|
||||
Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode,
|
||||
(ACPI_ADR_SPACE_TYPE) i, AeRegionHandler, AeRegionInit, NULL);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
printf ("Could not install an OpRegion handler\n");
|
||||
@ -490,72 +498,4 @@ AeInstallHandlers (void)
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AdSecondPassParse
|
||||
*
|
||||
* PARAMETERS: Root - Root of the parse tree
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Need to wait until second pass to parse the control methods
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AdSecondPassParse (
|
||||
ACPI_PARSE_OBJECT *Root)
|
||||
{
|
||||
ACPI_PARSE_OBJECT *Op = Root;
|
||||
ACPI_PARSE2_OBJECT *Method;
|
||||
ACPI_PARSE_OBJECT *SearchOp;
|
||||
ACPI_PARSE_OBJECT *StartOp;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
UINT32 BaseAmlOffset;
|
||||
|
||||
|
||||
/* Walk entire tree */
|
||||
|
||||
while (Op)
|
||||
{
|
||||
/* We are looking for control methods */
|
||||
|
||||
if (Op->Opcode == AML_METHOD_OP)
|
||||
{
|
||||
Method = (ACPI_PARSE2_OBJECT *) Op;
|
||||
Status = AcpiPsParseAml (Op, Method->Data, Method->Length, 0,
|
||||
NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
|
||||
BaseAmlOffset = (Method->Value.Arg)->AmlOffset + 1;
|
||||
StartOp = (Method->Value.Arg)->Next;
|
||||
SearchOp = StartOp;
|
||||
|
||||
while (SearchOp)
|
||||
{
|
||||
SearchOp->AmlOffset += BaseAmlOffset;
|
||||
SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (Op->Opcode == AML_REGION_OP)
|
||||
{
|
||||
/* TBD: this isn't quite the right thing to do! */
|
||||
|
||||
// Method = (ACPI_PARSE2_OBJECT *) Op;
|
||||
// Status = AcpiPsParseAml (Op, Method->Body, Method->BodyLength);
|
||||
}
|
||||
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
Op = AcpiPsGetDepthNext (Root, Op);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user