Merge FreeBSD-specific changes with the ACPI CA 20010518 release.

This commit is contained in:
Mike Smith 2001-05-29 19:56:18 +00:00
parent e4b6428171
commit 6d804030e6
6 changed files with 887 additions and 665 deletions

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
* $Revision: 55 $
* $Revision: 64 $
*
*****************************************************************************/
@ -144,7 +144,7 @@
/* Version string */
#define ACPI_CA_VERSION 0x20010208
#define ACPI_CA_VERSION 0x20010518
/* Maximum objects in the various object caches */
@ -180,7 +180,7 @@
/*
* Debugger threading model
* Use single threaded if the entire subsystem is contained in an application
* Use multiple threaded when the the subsystem is running in the kernel.
* Use multiple threaded when the subsystem is running in the kernel.
*
* By default the model is single threaded if ACPI_APPLICATION is set,
* multi-threaded if ACPI_APPLICATION is not set.
@ -240,6 +240,11 @@
#define HI_RSDP_WINDOW_SIZE 0x20000
#define RSDP_SCAN_STEP 16
/* Maximum SpaceIds for Operation Regions */
#define ACPI_MAX_ADDRESS_SPACE 255
#define ACPI_NUM_ADDRESS_SPACES 256
#endif /* _ACCONFIG_H */

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acfreebsd.h - OS specific defines, etc.
* $Revision: 4 $
* $Revision: 6 $
*
*****************************************************************************/
@ -128,7 +128,7 @@
#include "acgcc.h"
#ifdef _KERNEL
#include "opt_acpi.h" /* collect build-time options here */
#include "opt_acpi.h"
#include <sys/ctype.h>
#include <sys/param.h>
@ -144,7 +144,7 @@
#ifdef DEBUGGER_THREADING
#undef DEBUGGER_THREADING
#endif /* DEBUGGER_THREADING */
#define DEBUGGER_THREADING 0 /* integrated with DDB */
#define DEBUGGER_THREADING 0 /* integrated with DDB */
#include "opt_ddb.h"
#ifdef DDB
#define ENABLE_DEBUGGER
@ -156,6 +156,9 @@
/* Not building kernel code, so use libc */
#define ACPI_USE_STANDARD_HEADERS
#define __cli()
#define __sti()
#endif /* _KERNEL */
/* Always use FreeBSD code over our local versions */
@ -167,8 +170,8 @@ strupr(char *str)
{
char *c = str;
while(*c) {
*c = toupper(*c);
c++;
*c = toupper(*c);
c++;
}
return(str);
}
@ -182,14 +185,14 @@ strstr(char *s, char *find)
size_t len;
if ((c = *find++) != 0) {
len = strlen(find);
do {
do {
if ((sc = *s++) == 0)
return (NULL);
} while (sc != c);
} while (strncmp(s, find, len) != 0);
s--;
len = strlen(find);
do {
do {
if ((sc = *s++) == 0)
return (NULL);
} while (sc != c);
} while (strncmp(s, find, len) != 0);
s--;
}
return ((char *)s);
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acgcc.h - GCC specific defines, etc.
* $Revision: 5 $
* $Revision: 6 $
*
*****************************************************************************/
@ -118,7 +118,6 @@
#define __ACGCC_H__
#ifdef __ia64__
#define _IA64

View File

@ -121,6 +121,7 @@
#include "actypes.h"
#include "actbl.h"
/*
* Global interfaces
*/
@ -155,6 +156,23 @@ AcpiFormatException (
ACPI_BUFFER *OutBuffer);
/*
* ACPI Memory manager
*/
void *
AcpiAllocate (
UINT32 Size);
void *
AcpiCallocate (
UINT32 Size);
void
AcpiFree (
void *Address);
/*
* ACPI table manipulation interfaces
*/
@ -197,14 +215,14 @@ AcpiWalkNamespace (
ACPI_OBJECT_TYPE Type,
ACPI_HANDLE StartObject,
UINT32 MaxDepth,
WALK_CALLBACK UserFunction,
ACPI_WALK_CALLBACK UserFunction,
void *Context,
void * *ReturnValue);
ACPI_STATUS
AcpiGetDevices (
NATIVE_CHAR *HID,
WALK_CALLBACK UserFunction,
ACPI_WALK_CALLBACK UserFunction,
void *Context,
void **ReturnValue);
@ -256,52 +274,52 @@ AcpiGetParent (
/*
* AcpiEvent handler interfaces
* Event handler interfaces
*/
ACPI_STATUS
AcpiInstallFixedEventHandler (
UINT32 AcpiEvent,
FIXED_EVENT_HANDLER Handler,
ACPI_EVENT_HANDLER Handler,
void *Context);
ACPI_STATUS
AcpiRemoveFixedEventHandler (
UINT32 AcpiEvent,
FIXED_EVENT_HANDLER Handler);
ACPI_EVENT_HANDLER Handler);
ACPI_STATUS
AcpiInstallNotifyHandler (
ACPI_HANDLE Device,
UINT32 HandlerType,
NOTIFY_HANDLER Handler,
ACPI_NOTIFY_HANDLER Handler,
void *Context);
ACPI_STATUS
AcpiRemoveNotifyHandler (
ACPI_HANDLE Device,
UINT32 HandlerType,
NOTIFY_HANDLER Handler);
ACPI_NOTIFY_HANDLER Handler);
ACPI_STATUS
AcpiInstallAddressSpaceHandler (
ACPI_HANDLE Device,
ACPI_ADDRESS_SPACE_TYPE SpaceId,
ADDRESS_SPACE_HANDLER Handler,
ADDRESS_SPACE_SETUP Setup,
ACPI_ADR_SPACE_TYPE SpaceId,
ACPI_ADR_SPACE_HANDLER Handler,
ACPI_ADR_SPACE_SETUP Setup,
void *Context);
ACPI_STATUS
AcpiRemoveAddressSpaceHandler (
ACPI_HANDLE Device,
ACPI_ADDRESS_SPACE_TYPE SpaceId,
ADDRESS_SPACE_HANDLER Handler);
ACPI_ADR_SPACE_TYPE SpaceId,
ACPI_ADR_SPACE_HANDLER Handler);
ACPI_STATUS
AcpiInstallGpeHandler (
UINT32 GpeNumber,
UINT32 Type,
GPE_HANDLER Handler,
ACPI_GPE_HANDLER Handler,
void *Context);
ACPI_STATUS
@ -315,7 +333,7 @@ AcpiReleaseGlobalLock (
ACPI_STATUS
AcpiRemoveGpeHandler (
UINT32 GpeNumber,
GPE_HANDLER Handler);
ACPI_GPE_HANDLER Handler);
ACPI_STATUS
AcpiEnableEvent (

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psparse - Parser top level AML parse routines
* $Revision: 74 $
* $Revision: 85 $
*
*****************************************************************************/
@ -130,8 +130,9 @@
#include "amlcode.h"
#include "acnamesp.h"
#include "acdebug.h"
#include "acinterp.h"
#define _COMPONENT PARSER
#define _COMPONENT ACPI_PARSER
MODULE_NAME ("psparse")
@ -203,9 +204,9 @@ AcpiPsPeekOpcode (
*
* if (Opcode == AML_EXTOP
* || (Opcode == AML_LNOT
* && (GET8 (AcpiAml) == AML_LEQUAL
* || GET8 (AcpiAml) == AML_LGREATER
* || GET8 (AcpiAml) == AML_LLESS)))
* && (GET8 (Aml) == AML_LEQUAL
* || GET8 (Aml) == AML_LGREATER
* || GET8 (Aml) == AML_LLESS)))
*
* extended Opcode, !=, <=, or >=
*/
@ -228,8 +229,8 @@ AcpiPsPeekOpcode (
*
* FUNCTION: AcpiPsCreateState
*
* PARAMETERS: AcpiAml - AcpiAml code pointer
* AcpiAmlSize - Length of AML code
* PARAMETERS: Aml - Aml code pointer
* AmlSize - Length of AML code
*
* RETURN: A new parser state object
*
@ -248,10 +249,10 @@ AcpiPsCreateState (
FUNCTION_TRACE ("PsCreateState");
ParserState = AcpiCmCallocate (sizeof (ACPI_PARSE_STATE));
ParserState = AcpiUtCallocate (sizeof (ACPI_PARSE_STATE));
if (!ParserState)
{
return_VALUE (NULL);
return_PTR (NULL);
}
ParserState->Aml = Aml;
@ -362,7 +363,7 @@ AcpiPsCompleteThisOp (
(OpcodeClass != OPTYPE_LOCAL_VARIABLE) &&
(OpcodeClass != OPTYPE_METHOD_ARGUMENT) &&
(OpcodeClass != OPTYPE_DATA_TERM) &&
(Op->Opcode != AML_NAMEPATH_OP))
(Op->Opcode != AML_INT_NAMEPATH_OP))
{
/* Make sure that we only delete this subtree */
@ -387,15 +388,15 @@ AcpiPsCompleteThisOp (
* op must be replace by a placeholder return op
*/
if ((Op->Parent->Opcode == AML_REGION_OP) ||
(Op->Parent->Opcode == AML_CREATE_FIELD_OP) ||
(Op->Parent->Opcode == AML_BIT_FIELD_OP) ||
(Op->Parent->Opcode == AML_BYTE_FIELD_OP) ||
(Op->Parent->Opcode == AML_WORD_FIELD_OP) ||
(Op->Parent->Opcode == AML_DWORD_FIELD_OP) ||
(Op->Parent->Opcode == AML_QWORD_FIELD_OP))
if ((Op->Parent->Opcode == AML_REGION_OP) ||
(Op->Parent->Opcode == AML_CREATE_FIELD_OP) ||
(Op->Parent->Opcode == AML_CREATE_BIT_FIELD_OP) ||
(Op->Parent->Opcode == AML_CREATE_BYTE_FIELD_OP) ||
(Op->Parent->Opcode == AML_CREATE_WORD_FIELD_OP) ||
(Op->Parent->Opcode == AML_CREATE_DWORD_FIELD_OP) ||
(Op->Parent->Opcode == AML_CREATE_QWORD_FIELD_OP))
{
ReplacementOp = AcpiPsAllocOp (AML_RETURN_VALUE_OP);
ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
if (!ReplacementOp)
{
return_VALUE (FALSE);
@ -405,7 +406,7 @@ AcpiPsCompleteThisOp (
break;
default:
ReplacementOp = AcpiPsAllocOp (AML_RETURN_VALUE_OP);
ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
if (!ReplacementOp)
{
return_VALUE (FALSE);
@ -621,7 +622,7 @@ AcpiPsParseLoop (
ACPI_PARSE2_OBJECT *DeferredOp;
UINT32 ArgCount; /* push for fixed or var args */
UINT32 ArgTypes = 0;
ACPI_PTRDIFF AmlOffset;
UINT32 AmlOffset;
UINT16 Opcode;
ACPI_PARSE_OBJECT PreOp;
ACPI_PARSE_STATE *ParserState;
@ -663,14 +664,13 @@ AcpiPsParseLoop (
{
if (Status == AE_AML_NO_RETURN_VALUE)
{
DEBUG_PRINT (ACPI_ERROR,
("PsParseLoop: Invoked method did not return a value, %s\n",
AcpiCmFormatException (Status)));
DEBUG_PRINTP (ACPI_ERROR,
("Invoked method did not return a value, %s\n",
AcpiUtFormatException (Status)));
}
DEBUG_PRINT (ACPI_ERROR,
("PsParseLoop: GetPredicate Failed, %s\n",
AcpiCmFormatException (Status)));
DEBUG_PRINTP (ACPI_ERROR, ("GetPredicate Failed, %s\n",
AcpiUtFormatException (Status)));
return_ACPI_STATUS (Status);
}
@ -678,7 +678,7 @@ AcpiPsParseLoop (
}
AcpiPsPopScope (ParserState, &Op, &ArgTypes, &ArgCount);
DEBUG_PRINT (TRACE_PARSE, ("ParseLoop: Popped scope, Op=%p\n", Op));
DEBUG_PRINTP (TRACE_PARSE, ("Popped scope, Op=%p\n", Op));
}
else if (WalkState->PrevOp)
@ -729,7 +729,7 @@ AcpiPsParseLoop (
* string. Convert the bare name string to a namepath.
*/
Opcode = AML_NAMEPATH_OP;
Opcode = AML_INT_NAMEPATH_OP;
ArgTypes = ARGP_NAMESTRING;
break;
@ -737,8 +737,8 @@ AcpiPsParseLoop (
/* The opcode is unrecognized. Just skip unknown opcodes */
DEBUG_PRINT (ACPI_ERROR,
("ParseLoop: Found unknown opcode %lX at AML offset %X, ignoring\n",
DEBUG_PRINTP (ACPI_ERROR,
("Found unknown opcode %lX at AML offset %X, ignoring\n",
Opcode, AmlOffset));
DUMP_BUFFER (ParserState->Aml, 128);
@ -835,11 +835,12 @@ AcpiPsParseLoop (
}
if ((Op->Opcode == AML_CREATE_FIELD_OP) ||
(Op->Opcode == AML_BIT_FIELD_OP) ||
(Op->Opcode == AML_BYTE_FIELD_OP) ||
(Op->Opcode == AML_WORD_FIELD_OP) ||
(Op->Opcode == AML_DWORD_FIELD_OP))
if ((Op->Opcode == AML_CREATE_FIELD_OP) ||
(Op->Opcode == AML_CREATE_BIT_FIELD_OP) ||
(Op->Opcode == AML_CREATE_BYTE_FIELD_OP) ||
(Op->Opcode == AML_CREATE_WORD_FIELD_OP) ||
(Op->Opcode == AML_CREATE_DWORD_FIELD_OP) ||
(Op->Opcode == AML_CREATE_QWORD_FIELD_OP))
{
/*
* Backup to beginning of CreateXXXfield declaration
@ -878,8 +879,8 @@ AcpiPsParseLoop (
if (OpInfo)
{
DEBUG_PRINT (TRACE_PARSE,
("ParseLoop: Op=%p Opcode=%4.4lX Aml %p Oft=%5.5lX\n",
DEBUG_PRINTP (TRACE_PARSE,
("Op=%p Opcode=%4.4lX Aml %p Oft=%5.5lX\n",
Op, Op->Opcode, ParserState->Aml, Op->AmlOffset));
}
}
@ -907,7 +908,7 @@ AcpiPsParseLoop (
GET_CURRENT_ARG_TYPE (ArgTypes), Op);
break;
case AML_NAMEPATH_OP: /* AML_NAMESTRING_ARG */
case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */
AcpiPsGetNextNamepath (ParserState, Op, &ArgCount, 1);
ArgTypes = 0;
@ -948,8 +949,8 @@ AcpiPsParseLoop (
*/
DeferredOp->Data = ParserState->Aml;
DeferredOp->Length = ParserState->PkgEnd -
ParserState->Aml;
DeferredOp->Length = (UINT32) (ParserState->PkgEnd -
ParserState->Aml);
/*
* Skip body of method. For OpRegions, we must continue
@ -994,18 +995,18 @@ AcpiPsParseLoop (
* know the length.
*/
DeferredOp->Length = ParserState->Aml -
DeferredOp->Data;
DeferredOp->Length = (UINT32) (ParserState->Aml -
DeferredOp->Data);
}
}
}
if ((Op->Opcode == AML_CREATE_FIELD_OP) ||
(Op->Opcode == AML_BIT_FIELD_OP) ||
(Op->Opcode == AML_BYTE_FIELD_OP) ||
(Op->Opcode == AML_WORD_FIELD_OP) ||
(Op->Opcode == AML_DWORD_FIELD_OP) ||
(Op->Opcode == AML_QWORD_FIELD_OP))
if ((Op->Opcode == AML_CREATE_FIELD_OP) ||
(Op->Opcode == AML_CREATE_BIT_FIELD_OP) ||
(Op->Opcode == AML_CREATE_BYTE_FIELD_OP) ||
(Op->Opcode == AML_CREATE_WORD_FIELD_OP) ||
(Op->Opcode == AML_CREATE_DWORD_FIELD_OP) ||
(Op->Opcode == AML_CREATE_QWORD_FIELD_OP))
{
/*
* Backup to beginning of CreateXXXfield declaration (1 for
@ -1014,7 +1015,8 @@ AcpiPsParseLoop (
* BodyLength is unknown until we parse the body
*/
DeferredOp = (ACPI_PARSE2_OBJECT *) Op;
DeferredOp->Length = ParserState->Aml - DeferredOp->Data;
DeferredOp->Length = (UINT32) (ParserState->Aml -
DeferredOp->Data);
}
/* This op complete, notify the dispatcher */
@ -1118,7 +1120,7 @@ AcpiPsParseLoop (
if (AcpiPsHasCompletedScope (ParserState))
{
AcpiPsPopScope (ParserState, &Op, &ArgTypes, &ArgCount);
DEBUG_PRINT (TRACE_PARSE, ("ParseLoop: Popped scope, Op=%p\n", Op));
DEBUG_PRINTP (TRACE_PARSE, ("Popped scope, Op=%p\n", Op));
}
else
@ -1149,7 +1151,7 @@ AcpiPsParseLoop (
* sequential closing braces). We want to terminate each one cleanly.
*/
DEBUG_PRINT (TRACE_PARSE, ("PsParseLoop: Package complete at Op %p\n", Op));
DEBUG_PRINTP (TRACE_PARSE, ("Package complete at Op %p\n", Op));
do
{
if (Op)
@ -1241,8 +1243,7 @@ AcpiPsParseAml (
FUNCTION_TRACE ("PsParseAml");
DEBUG_PRINT (TRACE_PARSE,
("PsParseAml: Entered with Scope=%p Aml=%p size=%lX\n",
DEBUG_PRINTP (TRACE_PARSE, ("Entered with Scope=%p Aml=%p size=%lX\n",
StartScope, Aml, AmlSize));
@ -1264,8 +1265,11 @@ AcpiPsParseAml (
/* Create and initialize a new walk list */
WalkList.WalkState = NULL;
WalkList.AcquiredMutexList.Prev = NULL;
WalkList.AcquiredMutexList.Next = NULL;
WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, ParserState->StartOp, MthDesc, &WalkList);
WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, ParserState->StartOp,
MthDesc, &WalkList);
if (!WalkState)
{
Status = AE_NO_MEMORY;
@ -1331,8 +1335,7 @@ AcpiPsParseAml (
* handles nested control method invocations without recursion.
*/
DEBUG_PRINT (TRACE_PARSE, ("PsParseAml: State=%p\n",
WalkState));
DEBUG_PRINTP (TRACE_PARSE, ("State=%p\n", WalkState));
while (WalkState)
{
@ -1341,9 +1344,8 @@ AcpiPsParseAml (
Status = AcpiPsParseLoop (WalkState);
}
DEBUG_PRINT (TRACE_PARSE,
("PsParseAml: Completed one call to walk loop, State=%p\n",
WalkState));
DEBUG_PRINTP (TRACE_PARSE,
("Completed one call to walk loop, State=%p\n", WalkState));
if (Status == AE_CTRL_TRANSFER)
{
@ -1381,12 +1383,11 @@ AcpiPsParseAml (
if (CallerReturnDesc && ReturnDesc)
{
EffectiveReturnDesc = ReturnDesc;
AcpiCmAddReference (EffectiveReturnDesc);
EffectiveReturnDesc = ReturnDesc;
AcpiUtAddReference (EffectiveReturnDesc);
}
DEBUG_PRINT (TRACE_PARSE,
("PsParseAml: ReturnValue=%p, State=%p\n",
DEBUG_PRINTP (TRACE_PARSE, ("ReturnValue=%p, State=%p\n",
WalkState->ReturnDesc, WalkState));
/* Reset the current scope to the beginning of scope stack */
@ -1406,7 +1407,7 @@ AcpiPsParseAml (
/* Delete this walk state and all linked control states */
AcpiPsCleanupScope (WalkState->ParserState);
AcpiCmFree (WalkState->ParserState);
AcpiUtFree (WalkState->ParserState);
AcpiDsDeleteWalkState (WalkState);
/* Check if we have restarted a preempted walk */
@ -1440,7 +1441,7 @@ AcpiPsParseAml (
if (ReturnDesc == NULL && EffectiveReturnDesc != NULL)
{
AcpiCmRemoveReference (ReturnDesc);
AcpiUtRemoveReference (ReturnDesc);
ReturnDesc = EffectiveReturnDesc;
}
*CallerReturnDesc = ReturnDesc; /* NULL if no return value */
@ -1450,13 +1451,14 @@ AcpiPsParseAml (
{
/* Caller doesn't want it, must delete it */
AcpiCmRemoveReference (ReturnDesc);
AcpiUtRemoveReference (ReturnDesc);
}
}
/* Normal exit */
AcpiExReleaseAllMutexes ((ACPI_OPERAND_OBJECT *) &WalkList.AcquiredMutexList);
AcpiGbl_CurrentWalkList = PrevWalkList;
return_ACPI_STATUS (Status);
@ -1467,8 +1469,9 @@ AcpiPsParseAml (
AcpiDsDeleteWalkState (WalkState);
AcpiPsCleanupScope (ParserState);
AcpiCmFree (ParserState);
AcpiUtFree (ParserState);
AcpiExReleaseAllMutexes ((ACPI_OPERAND_OBJECT *)&WalkList.AcquiredMutexList);
AcpiGbl_CurrentWalkList = PrevWalkList;
return_ACPI_STATUS (Status);