Merge local changes.

Add a fix for a minor error in the PCI routing table creation handler
where the correct size for the buffer is not returned.
This commit is contained in:
Mike Smith 2001-11-28 04:34:52 +00:00
parent 1fd731fa25
commit 1b3eb6b30c
9 changed files with 592 additions and 457 deletions

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
* $Revision: 74 $
* $Revision: 78 $
*
*****************************************************************************/
@ -125,12 +125,13 @@
*****************************************************************************/
/*
* ACPI_DEBUG - This switch enables all the debug facilities of the ACPI
* subsystem. This includes the DEBUG_PRINT output statements
* When disabled, all DEBUG_PRINT statements are compiled out.
* ACPI_DEBUG - This switch enables all the debug facilities of the
* ACPI subsystem. This includes the DEBUG_PRINT output
* statements. When disabled, all DEBUG_PRINT
* statements are compiled out.
*
* ACPI_APPLICATION - Use this switch if the subsystem is going to be run
* at the application level.
* at the application level.
*
*/
@ -144,7 +145,7 @@
/* Version string */
#define ACPI_CA_VERSION 0x20011018
#define ACPI_CA_VERSION 0x20011120
/* Version of ACPI supported */
@ -153,17 +154,17 @@
/* Maximum objects in the various object caches */
#define MAX_STATE_CACHE_DEPTH 64 /* State objects for stacks */
#define MAX_STATE_CACHE_DEPTH 64 /* State objects for stacks */
#define MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */
#define MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */
#define MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */
#define MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks (method execution) */
#define MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */
/* String size constants */
#define MAX_STRING_LENGTH 512
#define PATHNAME_MAX 256 /* A full namespace pathname */
#define PATHNAME_MAX 256 /* A full namespace pathname */
/* Maximum count for a semaphore object */
@ -232,7 +233,7 @@
/* Names within the namespace are 4 bytes long */
#define ACPI_NAME_SIZE 4
#define PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 INT8 for separator */
#define PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */
#define PATH_SEPARATOR '.'
@ -244,10 +245,15 @@
#define HI_RSDP_WINDOW_SIZE 0x20000
#define RSDP_SCAN_STEP 16
/* Operation regions */
#define ACPI_NUM_PREDEFINED_REGIONS 7
#define ACPI_USER_REGION_BEGIN 0x80
/* 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: acgcc.h - GCC specific defines, etc.
* $Revision: 14 $
* $Revision: 15 $
*
*****************************************************************************/
@ -235,17 +235,17 @@
* Math helper asm macros
*/
#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
asm("divl %2;" \
:"=a"(q32), "=d"(r32) \
:"r"(d32), \
"0"(n_lo), "1"(n_hi))
asm("divl %2;" \
:"=a"(q32), "=d"(r32) \
:"r"(d32), \
"0"(n_lo), "1"(n_hi))
#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
asm("shrl $1,%2;" \
"rcrl $1,%3;" \
:"=r"(n_hi), "=r"(n_lo) \
:"0"(n_hi), "1"(n_lo))
asm("shrl $1,%2;" \
"rcrl $1,%3;" \
:"=r"(n_hi), "=r"(n_lo) \
:"0"(n_hi), "1"(n_lo))
/*! [End] no source code translation !*/

View File

@ -294,7 +294,7 @@ AcpiOsReadPort (
ACPI_STATUS
AcpiOsWritePort (
ACPI_IO_ADDRESS Address,
NATIVE_UINT Value,
ACPI_INTEGER Value,
UINT32 Width);
@ -312,7 +312,7 @@ AcpiOsReadMemory (
ACPI_STATUS
AcpiOsWriteMemory (
ACPI_PHYSICAL_ADDRESS Address,
NATIVE_UINT Value,
ACPI_INTEGER Value,
UINT32 Width);
@ -332,7 +332,7 @@ ACPI_STATUS
AcpiOsWritePciConfiguration (
ACPI_PCI_ID *PciId,
UINT32 Register,
NATIVE_UINT Value,
ACPI_INTEGER Value,
UINT32 Width);

View File

@ -158,6 +158,10 @@ const char *
AcpiFormatException (
ACPI_STATUS Exception);
ACPI_STATUS
AcpiPurgeCachedObjects (
void);
/*
* ACPI Memory manager
@ -249,6 +253,23 @@ AcpiGetHandle (
ACPI_STRING Pathname,
ACPI_HANDLE *RetHandle);
ACPI_STATUS
AcpiAttachData (
ACPI_HANDLE ObjHandle,
ACPI_OBJECT_HANDLER Handler,
void *Data);
ACPI_STATUS
AcpiDetachData (
ACPI_HANDLE ObjHandle,
ACPI_OBJECT_HANDLER Handler);
ACPI_STATUS
AcpiGetData (
ACPI_HANDLE ObjHandle,
ACPI_OBJECT_HANDLER Handler,
void **Data);
/*
* Object manipulation and enumeration
@ -406,6 +427,11 @@ ACPI_STATUS
AcpiGetFirmwareWakingVector (
ACPI_PHYSICAL_ADDRESS *PhysicalAddress);
ACPI_STATUS
AcpiEnterSleepStatePrep (
UINT8 SleepState);
ACPI_STATUS
AcpiEnterSleepState (
UINT8 SleepState);

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
* $Revision: 22 $
* $Revision: 25 $
*
*****************************************************************************/
@ -122,6 +122,9 @@
#define _COMPONENT ACPI_HARDWARE
MODULE_NAME ("hwsleep")
static UINT8 SleepTypeA;
static UINT8 SleepTypeB;
/******************************************************************************
*
@ -214,42 +217,40 @@ AcpiGetFirmwareWakingVector (
return_ACPI_STATUS (AE_OK);
}
/******************************************************************************
*
* FUNCTION: AcpiEnterSleepState
* FUNCTION: AcpiEnterSleepStatePrep
*
* PARAMETERS: SleepState - Which sleep state to enter
*
* RETURN: Status
*
* DESCRIPTION: Enter a system sleep state (see ACPI 2.0 spec p 231)
* DESCRIPTION: Prepare to enter a system sleep state (see ACPI 2.0 spec p 231)
* This function must execute with interrupts enabled.
* We break sleeping into 2 stages so that OSPM can handle
* various OS-specific tasks between the two steps.
*
******************************************************************************/
ACPI_STATUS
AcpiEnterSleepState (
AcpiEnterSleepStatePrep (
UINT8 SleepState)
{
ACPI_STATUS Status;
ACPI_OBJECT_LIST ArgList;
ACPI_OBJECT Arg;
UINT8 TypeA;
UINT8 TypeB;
UINT16 PM1AControl;
UINT16 PM1BControl;
UINT32 Retry;
FUNCTION_TRACE ("AcpiEnterSleepState");
FUNCTION_TRACE ("AcpiEnterSleepStatePrep");
/*
* _PSW methods could be run here to enable wake-on keyboard, LAN, etc.
*/
Status = AcpiHwObtainSleepTypeRegisterData (SleepState, &TypeA, &TypeB);
Status = AcpiHwObtainSleepTypeRegisterData (SleepState, &SleepTypeA, &SleepTypeB);
if (!ACPI_SUCCESS (Status))
{
return Status;
return_ACPI_STATUS (Status);
}
/* run the _PTS and _GTS methods */
@ -265,11 +266,50 @@ AcpiEnterSleepState (
AcpiEvaluateObject (NULL, "\\_PTS", &ArgList, NULL);
AcpiEvaluateObject (NULL, "\\_GTS", &ArgList, NULL);
return_ACPI_STATUS (AE_OK);
}
/******************************************************************************
*
* FUNCTION: AcpiEnterSleepState
*
* PARAMETERS: SleepState - Which sleep state to enter
*
* RETURN: Status
*
* DESCRIPTION: Enter a system sleep state (see ACPI 2.0 spec p 231)
* THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
*
******************************************************************************/
ACPI_STATUS
AcpiEnterSleepState (
UINT8 SleepState)
{
UINT16 PM1AControl;
UINT16 PM1BControl;
UINT32 Retry;
FUNCTION_TRACE ("AcpiEnterSleepState");
if ((SleepTypeA > ACPI_SLEEP_TYPE_MAX) ||
(SleepTypeB > ACPI_SLEEP_TYPE_MAX))
{
REPORT_ERROR (("Sleep values out of range: A=%x B=%x\n",
SleepTypeA, SleepTypeB));
return_ACPI_STATUS (AE_ERROR);
}
/* clear wake status */
AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, WAK_STS, 1);
disable ();
AcpiHwClearAcpiStatus();
/* disable arbitration here? */
AcpiHwDisableNonWakeupGpes();
@ -284,8 +324,8 @@ AcpiEnterSleepState (
/* mask in SLP_TYP */
PM1AControl |= (TypeA << AcpiHwGetBitShift (SLP_TYPE_X_MASK));
PM1BControl |= (TypeB << AcpiHwGetBitShift (SLP_TYPE_X_MASK));
PM1AControl |= (SleepTypeA << AcpiHwGetBitShift (SLP_TYPE_X_MASK));
PM1BControl |= (SleepTypeB << AcpiHwGetBitShift (SLP_TYPE_X_MASK));
/* write #1: fill in SLP_TYP data */
@ -297,10 +337,6 @@ AcpiEnterSleepState (
PM1AControl |= (1 << AcpiHwGetBitShift (SLP_EN_MASK));
PM1BControl |= (1 << AcpiHwGetBitShift (SLP_EN_MASK));
/* flush caches */
wbinvd();
/* write #2: SLP_TYP + SLP_EN */
AcpiHwRegisterWrite (ACPI_MTX_LOCK, PM1A_CONTROL, PM1AControl);
@ -319,8 +355,9 @@ AcpiEnterSleepState (
/* wait until we enter sleep state */
/* spin until we wake */
Retry = 1000;
do
while (!AcpiHwRegisterBitAccess (ACPI_READ, ACPI_MTX_LOCK, WAK_STS))
{
/*
* Some BIOSes don't set WAK_STS at all,
@ -330,11 +367,6 @@ AcpiEnterSleepState (
break; /* giving up */
}
}
while (!AcpiHwRegisterBitAccess (ACPI_READ, ACPI_MTX_LOCK, WAK_STS));
AcpiHwEnableNonWakeupGpes();
enable ();
return_ACPI_STATUS (AE_OK);
}
@ -361,6 +393,8 @@ AcpiLeaveSleepState (
FUNCTION_TRACE ("AcpiLeaveSleepState");
/* Ensure EnterSleepStatePrep -> EnterSleepState ordering */
SleepTypeA = ACPI_SLEEP_TYPE_INVALID;
MEMSET (&ArgList, 0, sizeof(ArgList));
ArgList.Count = 1;

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psparse - Parser top level AML parse routines
* $Revision: 104 $
* $Revision: 109 $
*
*****************************************************************************/
@ -152,7 +152,7 @@ extern UINT32 AcpiGbl_ScopeDepth;
*
******************************************************************************/
static UINT32
UINT32
AcpiPsGetOpcodeSize (
UINT32 Opcode)
{
@ -193,31 +193,15 @@ AcpiPsPeekOpcode (
Aml = ParserState->Aml;
Opcode = (UINT16) GET8 (Aml);
Aml++;
/*
* Original code special cased LNOTEQUAL, LLESSEQUAL, LGREATEREQUAL.
* These opcodes are no longer recognized. Instead, they are broken into
* two opcodes.
*
*
* if (Opcode == AML_EXTOP
* || (Opcode == AML_LNOT
* && (GET8 (Aml) == AML_LEQUAL
* || GET8 (Aml) == AML_LGREATER
* || GET8 (Aml) == AML_LLESS)))
*
* extended Opcode, !=, <=, or >=
*/
if (Opcode == AML_EXTOP)
{
/* Extended opcode */
Aml++;
Opcode = (UINT16) ((Opcode << 8) | GET8 (Aml));
}
return (Opcode);
}
@ -289,7 +273,7 @@ AcpiPsFindObject (
*
******************************************************************************/
static BOOLEAN
BOOLEAN
AcpiPsCompleteThisOp (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op)
@ -304,8 +288,6 @@ AcpiPsCompleteThisOp (
FUNCTION_TRACE_PTR ("PsCompleteThisOp", Op);
/* Delete this op and the subtree below it if asked to */
if (((WalkState->ParseFlags & ACPI_PARSE_TREE_MASK) == ACPI_PARSE_DELETE_TREE) &&
@ -323,23 +305,30 @@ AcpiPsCompleteThisOp (
switch (ParentInfo->Class)
{
case AML_CLASS_CONTROL: /* IF, ELSE, WHILE only */
case AML_CLASS_CONTROL:
break;
case AML_CLASS_NAMED_OBJECT: /* Scope, method, etc. */
case AML_CLASS_CREATE:
/*
* These opcodes contain TermArg operands. The current
* op must be replace by a placeholder return op
*/
ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
if (!ReplacementOp)
{
return_VALUE (FALSE);
}
break;
case AML_CLASS_NAMED_OBJECT:
/*
* These opcodes contain TermArg operands. The current
* 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_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))
(Op->Parent->Opcode == AML_DATA_REGION_OP))
{
ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
if (!ReplacementOp)
@ -347,7 +336,6 @@ AcpiPsCompleteThisOp (
return_VALUE (FALSE);
}
}
break;
default:
@ -404,7 +392,6 @@ AcpiPsCompleteThisOp (
Prev = Next;
}
}
/* Now we can actually delete the subtree rooted at op */
@ -434,7 +421,7 @@ AcpiPsCompleteThisOp (
*
******************************************************************************/
static ACPI_STATUS
ACPI_STATUS
AcpiPsNextParseState (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op,
@ -478,6 +465,7 @@ AcpiPsNextParseState (
case AE_CTRL_TRUE:
/*
* Predicate of an IF was true, and we are at the matching ELSE.
* Just close out this package
@ -714,9 +702,6 @@ AcpiPsParseLoop (
WalkState->Op = NULL;
Status = WalkState->DescendingCallback (WalkState, &Op);
/* TBD: check status here? */
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "During name lookup/catalog, %s\n",
@ -728,6 +713,7 @@ AcpiPsParseLoop (
{
continue;
}
Status = AcpiPsNextParseState (WalkState, Op, Status);
if (Status == AE_CTRL_PENDING)
{
@ -744,7 +730,6 @@ AcpiPsParseLoop (
AcpiPsAppendArg (Op, PreOp.Value.Arg);
AcpiGbl_Depth++;
if (Op->Opcode == AML_REGION_OP)
{
/*
@ -764,7 +749,6 @@ AcpiPsParseLoop (
}
}
else
{
/* Not a named opcode, just allocate Op and append to parent */
@ -776,7 +760,6 @@ AcpiPsParseLoop (
return_ACPI_STATUS (AE_NO_MEMORY);
}
if (WalkState->OpInfo->Flags & AML_CREATE)
{
/*
@ -795,7 +778,7 @@ AcpiPsParseLoop (
* Find the object. This will either insert the object into
* the namespace or simply look it up
*/
WalkState->Op = Op;
WalkState->Op = Op;
Status = WalkState->DescendingCallback (WalkState, &Op);
Status = AcpiPsNextParseState (WalkState, Op, Status);
@ -827,7 +810,6 @@ AcpiPsParseLoop (
WalkState->ArgCount = 0;
if (WalkState->ArgTypes) /* Are there any arguments that must be processed? */
{
/* get arguments */
@ -872,7 +854,6 @@ AcpiPsParseLoop (
INCREMENT_ARG_LIST (WalkState->ArgTypes);
}
/* For a method, save the length and address of the body */
if (Op->Opcode == AML_METHOD_OP)
@ -960,7 +941,6 @@ AcpiPsParseLoop (
CloseThisOp:
/*
* Finished one argument of the containing scope
*/
@ -973,7 +953,6 @@ AcpiPsParseLoop (
Op = NULL;
}
switch (Status)
{
case AE_OK:
@ -1019,8 +998,8 @@ AcpiPsParseLoop (
{
AcpiPsCompleteThisOp (WalkState, Op);
}
AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount);
} while (Op);
return_ACPI_STATUS (Status);
@ -1037,9 +1016,8 @@ AcpiPsParseLoop (
WalkState->PrevArgTypes = WalkState->ArgTypes;
/*
* TEMP:
* TBD: TEMP:
*/
return_ACPI_STATUS (Status);
break;
}
@ -1051,19 +1029,14 @@ AcpiPsParseLoop (
AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount);
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op));
}
else
{
Op = NULL;
}
}
/* ArgCount is non-zero */
else
{
/* ArgCount is non-zero */
/* complex argument, push Op and prepare for argument */
AcpiPsPushScope (ParserState, Op, WalkState->ArgTypes, WalkState->ArgCount);
@ -1156,8 +1129,8 @@ AcpiPsParseAml (
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status;
ACPI_WALK_LIST WalkList;
ACPI_WALK_LIST *PrevWalkList = AcpiGbl_CurrentWalkList;
ACPI_THREAD_STATE *Thread;
ACPI_THREAD_STATE *PrevWalkList = AcpiGbl_CurrentWalkList;
ACPI_WALK_STATE *PreviousWalkState;
ACPI_OPERAND_OBJECT **CallerReturnDesc = WalkState->CallerReturnDesc;
ACPI_OPERAND_OBJECT *EffectiveReturnDesc = NULL;
@ -1170,19 +1143,21 @@ AcpiPsParseAml (
WalkState, WalkState->ParserState.Aml, WalkState->ParserState.AmlSize));
/* Create and initialize a new walk list */
/* Create and initialize a new thread state */
WalkList.WalkState = NULL;
WalkList.AcquiredMutexList.Prev = NULL;
WalkList.AcquiredMutexList.Next = NULL;
Thread = AcpiUtCreateThreadState ();
if (!Thread)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
WalkState->WalkList = &WalkList;
AcpiDsPushWalkState (WalkState, &WalkList);
WalkState->Thread = Thread;
AcpiDsPushWalkState (WalkState, Thread);
/* TBD: [Restructure] TEMP until we pass WalkState to the interpreter
*/
AcpiGbl_CurrentWalkList = &WalkList;
AcpiGbl_CurrentWalkList = Thread;
/*
* Execute the walk loop as long as there is a valid Walk State. This
@ -1211,13 +1186,13 @@ AcpiPsParseAml (
* A method call was detected.
* Transfer control to the called control method
*/
Status = AcpiDsCallControlMethod (&WalkList, WalkState, NULL);
Status = AcpiDsCallControlMethod (Thread, WalkState, NULL);
/*
* If the transfer to the new method method call worked, a new walk
* state was created -- get it
*/
WalkState = AcpiDsGetCurrentWalkState (&WalkList);
WalkState = AcpiDsGetCurrentWalkState (Thread);
continue;
}
@ -1228,7 +1203,7 @@ AcpiPsParseAml (
/* We are done with this walk, move on to the parent if any */
WalkState = AcpiDsPopWalkState (&WalkList);
WalkState = AcpiDsPopWalkState (Thread);
/* Save the last effective return value */
@ -1263,7 +1238,7 @@ AcpiPsParseAml (
/* Check if we have restarted a preempted walk */
WalkState = AcpiDsGetCurrentWalkState (&WalkList);
WalkState = AcpiDsGetCurrentWalkState (Thread);
if (WalkState)
{
if (ACPI_SUCCESS (Status))
@ -1309,11 +1284,11 @@ AcpiPsParseAml (
AcpiDsDeleteWalkState (PreviousWalkState);
}
/* Normal exit */
AcpiUtRemoveReference (EffectiveReturnDesc);
AcpiExReleaseAllMutexes ((ACPI_OPERAND_OBJECT *) &WalkList.AcquiredMutexList);
AcpiExReleaseAllMutexes (Thread);
AcpiUtDeleteGenericState ((ACPI_GENERIC_STATE *) Thread);
AcpiGbl_CurrentWalkList = PrevWalkList;
return_ACPI_STATUS (Status);
}

View File

@ -266,9 +266,9 @@ AcpiRsCreatePciRoutingTable (
if (BufferSizeNeeded > *OutputBufferLength)
{
*OutputBufferLength = BufferSizeNeeded;
return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
}
*OutputBufferLength = BufferSizeNeeded;
/*
* Zero out the return buffer before proceeding

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbget - ACPI Table get* routines
* $Revision: 56 $
* $Revision: 57 $
*
*****************************************************************************/
@ -467,13 +467,6 @@ AcpiTbGetAllTables (
AcpiGbl_DSDT->Length, AcpiGbl_DSDT->Length));
DUMP_BUFFER ((UINT8 *) (AcpiGbl_DSDT + 1), AcpiGbl_DSDT->Length);
/*
* Initialize the capabilities flags.
* Assumes that platform supports ACPI_MODE since we have tables!
*/
AcpiGbl_SystemFlags |= AcpiHwGetModeCapabilities ();
/* Always delete the RSDP mapping, we are done with it */
AcpiTbDeleteAcpiTable (ACPI_TABLE_RSDP);