Resolve conflicts arising from the ACPI CA 20020404 import.

This commit is contained in:
Mitsuru IWASAKI 2002-06-30 17:53:12 +00:00
parent 733e46c474
commit 74fc979a09
15 changed files with 324 additions and 263 deletions

View File

@ -56,7 +56,7 @@ AcpiOsTerminate(void)
ACPI_STATUS
AcpiOsGetRootPointer(
UINT32 Flags,
ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress)
ACPI_POINTER *RsdpPhysicalAddress)
{
/*
* The loader passes the physical address at which it found the

View File

@ -145,7 +145,7 @@
/* Version string */
#define ACPI_CA_VERSION 0x20020308
#define ACPI_CA_VERSION 0x20020403
/* Version of ACPI supported */

View File

@ -139,6 +139,11 @@
#define asm __asm
#define __cli() disable_intr()
#define __sti() enable_intr()
#ifdef __i386__
#define ACPI_FLUSH_CPU_CACHE() wbinvd()
#else
#define ACPI_FLUSH_CPU_CACHE() /* XXX ia64_fc()? */
#endif
#ifdef ACPI_DEBUG
#ifdef DEBUGGER_THREADING
@ -158,6 +163,7 @@
#define __cli()
#define __sti()
#define ACPI_FLUSH_CPU_CACHE()
#endif /* _KERNEL */

View File

@ -121,7 +121,8 @@
#ifdef __ia64__
#define _IA64
#define COMPILER_DEPENDENT_UINT64 unsigned long
#define COMPILER_DEPENDENT_INT64 long
#define COMPILER_DEPENDENT_UINT64 unsigned long
/*
* Calling conventions:
@ -145,10 +146,9 @@
/* Asm macros */
#define ACPI_ASM_MACROS
#define causeinterrupt(level)
#define BREAKPOINT3
#define acpi_disable_irqs() __cli()
#define acpi_enable_irqs() __sti()
#define ACPI_DISABLE_IRQS() __cli()
#define ACPI_ENABLE_IRQS() __sti()
/*! [Begin] no source code translation */
@ -198,7 +198,8 @@
#else /* DO IA32 */
#define COMPILER_DEPENDENT_UINT64 unsigned long long
#define COMPILER_DEPENDENT_INT64 long long
#define COMPILER_DEPENDENT_UINT64 unsigned long long
/*
* Calling conventions:
@ -216,11 +217,9 @@
/* Asm macros */
#define ACPI_ASM_MACROS
#define causeinterrupt(level)
#define BREAKPOINT3
#define acpi_disable_irqs() __cli()
#define acpi_enable_irqs() __sti()
#define halt() __asm__ __volatile__ ("sti; hlt":::"memory")
#define ACPI_DISABLE_IRQS() __cli()
#define ACPI_ENABLE_IRQS() __sti()
/*! [Begin] no source code translation
*

View File

@ -175,10 +175,20 @@ ACPI_STATUS
AcpiOsTerminate (
void);
/*
* ACPI Table interfaces
*/
ACPI_STATUS
AcpiOsGetRootPointer (
UINT32 Flags,
ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress);
ACPI_POINTER *Address);
ACPI_STATUS
AcpiOsTableOverride (
ACPI_TABLE_HEADER *ExistingTable,
ACPI_TABLE_HEADER **NewTable);
/*

View File

@ -187,7 +187,7 @@ AcpiFree (
ACPI_STATUS
AcpiFindRootPointer (
UINT32 Flags,
ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress);
ACPI_POINTER *RsdpAddress);
ACPI_STATUS
AcpiLoadTables (

View File

@ -412,27 +412,14 @@ AeLocalLoadTable (
}
/*******************************************************************************
*
* FUNCTION: AcpiDbLoadAcpiTable
*
* PARAMETERS: Filname - File where table is located
*
* RETURN: Status
*
* DESCRIPTION: Load an ACPI table from a file
*
******************************************************************************/
#ifdef ACPI_APPLICATION
ACPI_STATUS
AcpiDbLoadAcpiTable (
AcpiDbGetAcpiTable (
NATIVE_CHAR *Filename)
{
#ifdef ACPI_APPLICATION
FILE *fp;
ACPI_STATUS Status;
UINT32 TableLength;
ACPI_STATUS Status;
/* Open the file */
@ -456,7 +443,37 @@ AcpiDbLoadAcpiTable (
return (Status);
}
/* Attempt to recognize and install the table */
return (AE_OK);
}
#endif
/*******************************************************************************
*
* FUNCTION: AcpiDbLoadAcpiTable
*
* PARAMETERS: Filname - File where table is located
*
* RETURN: Status
*
* DESCRIPTION: Load an ACPI table from a file
*
******************************************************************************/
ACPI_STATUS
AcpiDbLoadAcpiTable (
NATIVE_CHAR *Filename)
{
#ifdef ACPI_APPLICATION
ACPI_STATUS Status;
Status = AcpiDbGetAcpiTable (Filename);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Attempt to recognize and install the table */
Status = AeLocalLoadTable (AcpiGbl_DbTablePtr);
if (ACPI_FAILURE (Status))

View File

@ -246,7 +246,7 @@ AcpiExAccessRegion (
ACPI_PHYSICAL_ADDRESS Address;
ACPI_FUNCTION_TRACE ("AcpiExAccessRegion");
ACPI_FUNCTION_TRACE ("ExAccessRegion");
/*
@ -800,7 +800,7 @@ AcpiExExtractFromField (
ByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
if (ByteFieldLength > BufferLength)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Field size %X (bytes) too large for buffer (%X)\n",
ByteFieldLength, BufferLength));
@ -812,7 +812,7 @@ AcpiExExtractFromField (
DatumCount = ACPI_ROUND_UP_TO (ByteFieldLength,
ObjDesc->CommonField.AccessByteWidth);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"ByteLen=%x, DatumLen=%x, ByteGran=%x\n",
ByteFieldLength, DatumCount,ObjDesc->CommonField.AccessByteWidth));
@ -991,7 +991,7 @@ AcpiExInsertIntoField (
ByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
if (BufferLength < ByteFieldLength)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Buffer length %X too small for field %X\n",
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Buffer length %X too small for field %X\n",
BufferLength, ByteFieldLength));
return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
@ -1001,7 +1001,7 @@ AcpiExInsertIntoField (
DatumCount = ACPI_ROUND_UP_TO (ByteFieldLength, ObjDesc->CommonField.AccessByteWidth);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"ByteLen=%x, DatumLen=%x, ByteGran=%x\n",
ByteFieldLength, DatumCount, ObjDesc->CommonField.AccessByteWidth));

View File

@ -338,6 +338,7 @@ AcpiEnterSleepState (
PM1BControl |= SleepEnableRegInfo->AccessBitMask;
/* Write #2: SLP_TYP + SLP_EN */
ACPI_FLUSH_CPU_CACHE();
AcpiHwRegisterWrite (ACPI_MTX_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1AControl);
AcpiHwRegisterWrite (ACPI_MTX_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1BControl);

View File

@ -319,7 +319,7 @@ AcpiPsCompleteThisOp (
/*
* These opcodes contain TermArg operands. The current
* op must be replace by a placeholder return op
* op must be replaced by a placeholder return op
*/
ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
if (!ReplacementOp)
@ -332,10 +332,13 @@ AcpiPsCompleteThisOp (
/*
* These opcodes contain TermArg operands. The current
* op must be replace by a placeholder return op
* op must be replaced by a placeholder return op
*/
if ((Op->Parent->Opcode == AML_REGION_OP) ||
(Op->Parent->Opcode == AML_DATA_REGION_OP))
if ((Op->Parent->Opcode == AML_REGION_OP) ||
(Op->Parent->Opcode == AML_DATA_REGION_OP) ||
(Op->Parent->Opcode == AML_BUFFER_OP) ||
(Op->Parent->Opcode == AML_PACKAGE_OP) ||
(Op->Parent->Opcode == AML_VAR_PACKAGE_OP))
{
ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
if (!ReplacementOp)
@ -343,6 +346,27 @@ AcpiPsCompleteThisOp (
return_VALUE (FALSE);
}
}
if ((Op->Parent->Opcode == AML_NAME_OP) &&
(WalkState->DescendingCallback != AcpiDsExecBeginOp))
{
if ((Op->Opcode == AML_BUFFER_OP) ||
(Op->Opcode == AML_PACKAGE_OP) ||
(Op->Opcode == AML_VAR_PACKAGE_OP))
{
ReplacementOp = AcpiPsAllocOp (Op->Opcode);
if (!ReplacementOp)
{
return_VALUE (FALSE);
}
((ACPI_PARSE2_OBJECT *) ReplacementOp)->Data =
((ACPI_PARSE2_OBJECT *) Op)->Data;
((ACPI_PARSE2_OBJECT *) ReplacementOp)->Length =
((ACPI_PARSE2_OBJECT *) Op)->Length;
}
}
break;
default:
@ -364,6 +388,7 @@ AcpiPsCompleteThisOp (
{
ReplacementOp->Parent = Op->Parent;
ReplacementOp->Value.Arg = NULL;
ReplacementOp->Node = Op->Node;
Op->Parent->Value.Arg = ReplacementOp;
ReplacementOp->Next = Op->Next;
}
@ -384,10 +409,11 @@ AcpiPsCompleteThisOp (
{
if (ReplacementOp)
{
ReplacementOp->Parent = Op->Parent;
ReplacementOp->Parent = Op->Parent;
ReplacementOp->Value.Arg = NULL;
Prev->Next = ReplacementOp;
ReplacementOp->Next = Op->Next;
ReplacementOp->Node = Op->Node;
Prev->Next = ReplacementOp;
ReplacementOp->Next = Op->Next;
Next = NULL;
}
else
@ -422,9 +448,10 @@ AcpiPsCompleteThisOp (
*
* PARAMETERS: ParserState - Current parser state object
*
* RETURN:
* RETURN: Status
*
* DESCRIPTION:
* DESCRIPTION: Update the parser state based upon the return exception from
* the parser callback.
*
******************************************************************************/
@ -553,7 +580,7 @@ AcpiPsParseLoop (
ACPI_PARSE_OBJECT *Arg = NULL;
ACPI_PARSE_OBJECT PreOp;
ACPI_PARSE_STATE *ParserState;
UINT8 *AmlOpStart;
UINT8 *AmlOpStart = NULL;
ACPI_FUNCTION_TRACE_PTR ("PsParseLoop", WalkState);
@ -580,7 +607,6 @@ AcpiPsParseLoop (
(WalkState->ControlState->Common.State ==
ACPI_CONTROL_PREDICATE_EXECUTING))
{
/*
* A predicate was just completed, get the value of the
* predicate and branch based on that value
@ -608,7 +634,6 @@ AcpiPsParseLoop (
AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount);
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op));
}
else if (WalkState->PrevOp)
{
/* We were in the middle of an op */
@ -656,8 +681,8 @@ AcpiPsParseLoop (
/* The opcode is unrecognized. Just skip unknown opcodes */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Found unknown opcode %X at AML offset %X, ignoring\n",
WalkState->Opcode, WalkState->AmlOffset));
"Found unknown opcode %X at AML address %p offset %X, ignoring\n",
WalkState->Opcode, ParserState->Aml, WalkState->AmlOffset));
ACPI_DUMP_BUFFER (ParserState->Aml, 128);
@ -673,10 +698,8 @@ AcpiPsParseLoop (
ParserState->Aml += AcpiPsGetOpcodeSize (WalkState->Opcode);
WalkState->ArgTypes = WalkState->OpInfo->ParseArgs;
break;
}
/* Create Op structure and append to parent's argument list */
if (WalkState->OpInfo->Flags & AML_NAMED)
@ -693,7 +716,6 @@ AcpiPsParseLoop (
INCREMENT_ARG_LIST (WalkState->ArgTypes);
}
/* We know that this arg is a name, move to next arg */
INCREMENT_ARG_LIST (WalkState->ArgTypes);
@ -753,7 +775,6 @@ AcpiPsParseLoop (
((ACPI_PARSE2_OBJECT * ) Op)->Length = 0;
}
}
else
{
/* Not a named opcode, just allocate Op and append to parent */
@ -817,7 +838,7 @@ AcpiPsParseLoop (
if (WalkState->ArgTypes) /* Are there any arguments that must be processed? */
{
/* get arguments */
/* Get arguments */
switch (Op->Opcode)
{
@ -827,7 +848,7 @@ AcpiPsParseLoop (
case AML_QWORD_OP: /* AML_QWORDATA_ARG */
case AML_STRING_OP: /* AML_ASCIICHARLIST_ARG */
/* fill in constant or string argument directly */
/* Fill in constant or string argument directly */
AcpiPsGetNextSimpleArg (ParserState,
GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), Op);
@ -859,10 +880,12 @@ AcpiPsParseLoop (
INCREMENT_ARG_LIST (WalkState->ArgTypes);
}
/* For a method, save the length and address of the body */
if (Op->Opcode == AML_METHOD_OP)
switch (Op->Opcode)
{
case AML_METHOD_OP:
/* For a method, save the length and address of the body */
/*
* Skip parsing of control method or opregion body,
* because we don't have enough info in the first pass
@ -871,7 +894,6 @@ AcpiPsParseLoop (
((ACPI_PARSE2_OBJECT * ) Op)->Data = ParserState->Aml;
((ACPI_PARSE2_OBJECT * ) Op)->Length = (UINT32) (ParserState->PkgEnd -
ParserState->Aml);
/*
* Skip body of method. For OpRegions, we must continue
* parsing because the opregion is not a standalone
@ -879,19 +901,44 @@ AcpiPsParseLoop (
*/
ParserState->Aml = ParserState->PkgEnd;
WalkState->ArgCount = 0;
}
else if (Op->Opcode == AML_WHILE_OP)
{
break;
case AML_BUFFER_OP:
case AML_PACKAGE_OP:
case AML_VAR_PACKAGE_OP:
if ((Op->Parent) &&
(Op->Parent->Opcode == AML_NAME_OP) &&
(WalkState->DescendingCallback != AcpiDsExecBeginOp))
{
/*
* Skip parsing of
* because we don't have enough info in the first pass
* to parse them correctly.
*/
((ACPI_PARSE2_OBJECT * ) Op)->Data = AmlOpStart;
((ACPI_PARSE2_OBJECT * ) Op)->Length = (UINT32) (ParserState->PkgEnd -
AmlOpStart);
/*
* Skip body
*/
ParserState->Aml = ParserState->PkgEnd;
WalkState->ArgCount = 0;
}
break;
case AML_WHILE_OP:
if (WalkState->ControlState)
{
WalkState->ControlState->Control.PackageEnd = ParserState->PkgEnd;
}
break;
}
break;
}
}
/* Check for arguments that need to be processed */
if (WalkState->ArgCount)
@ -903,7 +950,6 @@ AcpiPsParseLoop (
continue;
}
/* All arguments have been processed -- Op is complete, prepare for next */
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);

View File

@ -222,8 +222,7 @@ AcpiTbGetTablePtr (
ACPI_STATUS
AcpiTbGetTable (
ACPI_PHYSICAL_ADDRESS PhysicalAddress,
ACPI_TABLE_HEADER *BufferPtr,
ACPI_POINTER *Address,
ACPI_TABLE_DESC *TableInfo)
{
ACPI_TABLE_HEADER *TableHeader = NULL;
@ -236,24 +235,19 @@ AcpiTbGetTable (
ACPI_FUNCTION_TRACE ("TbGetTable");
if (!TableInfo)
if (!TableInfo || !Address)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
if (BufferPtr)
switch (Address->PointerType)
{
case ACPI_LOGICAL_POINTER:
/*
* Getting data from a buffer, not BIOS tables
*/
TableHeader = BufferPtr;
Status = AcpiTbValidateTableHeader (TableHeader);
if (ACPI_FAILURE (Status))
{
/* Table failed verification, map all errors to BAD_DATA */
return_ACPI_STATUS (AE_BAD_DATA);
}
TableHeader = Address->Pointer.Logical;
/* Allocate buffer for the entire table */
@ -266,22 +260,23 @@ AcpiTbGetTable (
/* Copy the entire table (including header) to the local buffer */
Size = TableHeader->Length;
ACPI_MEMCPY (FullTable, BufferPtr, Size);
ACPI_MEMCPY (FullTable, TableHeader, Size);
/* Save allocation type */
Allocation = ACPI_MEM_ALLOCATED;
}
break;
/*
* Not reading from a buffer, just map the table's physical memory
* into our address space.
*/
else
{
case ACPI_PHYSICAL_POINTER:
/*
* Not reading from a buffer, just map the table's physical memory
* into our address space.
*/
Size = SIZE_IN_HEADER;
Status = AcpiTbMapAcpiTable (PhysicalAddress, &Size, &FullTable);
Status = AcpiTbMapAcpiTable (Address->Pointer.Physical, &Size, &FullTable);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -290,6 +285,11 @@ AcpiTbGetTable (
/* Save allocation type */
Allocation = ACPI_MEM_MAPPED;
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Return values */
@ -299,6 +299,12 @@ AcpiTbGetTable (
TableInfo->Allocation = Allocation;
TableInfo->BasePointer = FullTable;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Found table [%4.4s] at %8.8X%8.8X, mapped/copied to %p\n",
FullTable->Signature,
ACPI_HIDWORD (Address->Pointer.Physical),
ACPI_LODWORD (Address->Pointer.Physical), FullTable));
return_ACPI_STATUS (Status);
}
@ -312,9 +318,15 @@ AcpiTbGetTable (
*
* RETURN: Status
*
* DESCRIPTION: Load and validate all tables other than the RSDT. The RSDT must
* DESCRIPTION: Load and validate tables other than the RSDT. The RSDT must
* already be loaded and validated.
*
* Get the minimum set of ACPI tables, namely:
*
* 1) FADT (via RSDT in loop below)
* 2) FACS (via FADT)
* 3) DSDT (via FADT)
*
******************************************************************************/
ACPI_STATUS
@ -325,6 +337,7 @@ AcpiTbGetAllTables (
ACPI_STATUS Status = AE_OK;
UINT32 Index;
ACPI_TABLE_DESC TableInfo;
ACPI_POINTER Address;
ACPI_FUNCTION_TRACE ("TbGetAllTables");
@ -335,7 +348,9 @@ AcpiTbGetAllTables (
/*
* Loop through all table pointers found in RSDT.
* This will NOT include the FACS and DSDT - we must get
* them after the loop
* them after the loop.
*
* The ONLY table we are interested in getting here is the FADT.
*/
for (Index = 0; Index < NumberOfTables; Index++)
{
@ -345,19 +360,10 @@ AcpiTbGetAllTables (
/* Get the table via the XSDT */
Status = AcpiTbGetTable ((ACPI_PHYSICAL_ADDRESS)
ACPI_GET_ADDRESS (AcpiGbl_XSDT->TableOffsetEntry[Index]),
TablePtr, &TableInfo);
/* Ignore a table that failed verification */
if (Status == AE_BAD_DATA)
{
continue;
}
/* However, abort on serious errors */
Address.PointerType = AcpiGbl_TableFlags;
Address.Pointer.Value = ACPI_GET_ADDRESS (AcpiGbl_XSDT->TableOffsetEntry[Index]);
Status = AcpiTbGetTable (&Address, &TableInfo);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -374,6 +380,7 @@ AcpiTbGetAllTables (
* determine if there are enough tables to continue.
*/
AcpiTbUninstallTable (&TableInfo);
Status = AE_OK;
}
}
@ -384,25 +391,21 @@ AcpiTbGetAllTables (
Status = AcpiTbConvertTableFadt ();
if (ACPI_FAILURE (Status))
{
ACPI_REPORT_ERROR (("Could not convert FADT to internal common format\n"));
return_ACPI_STATUS (Status);
}
/*
* Get the minimum set of ACPI tables, namely:
*
* 1) FADT (via RSDT in loop above)
* 2) FACS
* 3) DSDT
*
*/
/*
* Get the FACS (must have the FADT first, from loop above)
* AcpiTbGetTableFacs will fail if FADT pointer is not valid
*/
Status = AcpiTbGetTableFacs (TablePtr, &TableInfo);
Address.PointerType = AcpiGbl_TableFlags;
Address.Pointer.Value = ACPI_GET_ADDRESS (AcpiGbl_FADT->XFirmwareCtrl);
Status = AcpiTbGetTable (&Address, &TableInfo);
if (ACPI_FAILURE (Status))
{
ACPI_REPORT_ERROR (("Could not get the FACS\n"));
return_ACPI_STATUS (Status);
}
@ -411,6 +414,7 @@ AcpiTbGetAllTables (
Status = AcpiTbInstallTable (TablePtr, &TableInfo);
if (ACPI_FAILURE (Status))
{
ACPI_REPORT_ERROR (("Could not install the FACS\n"));
return_ACPI_STATUS (Status);
}
@ -421,18 +425,25 @@ AcpiTbGetAllTables (
Status = AcpiTbBuildCommonFacs (&TableInfo);
if (ACPI_FAILURE (Status))
{
ACPI_REPORT_ERROR (("Could not convert FACS to common internal format\n"));
return_ACPI_STATUS (Status);
}
/*
* Get the DSDT (We know that the FADT is valid now)
*/
Status = AcpiTbGetTable ((ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (AcpiGbl_FADT->XDsdt),
((AcpiGbl_DSDT) ?
AcpiGbl_DSDT: TablePtr), &TableInfo);
Address.PointerType = AcpiGbl_TableFlags;
Address.Pointer.Value = ACPI_GET_ADDRESS (AcpiGbl_FADT->XDsdt);
if (AcpiGbl_DSDT != NULL)
{
Address.PointerType = ACPI_LOGICAL_POINTER;
Address.Pointer.Value = ACPI_GET_ADDRESS ((NATIVE_UINT)AcpiGbl_DSDT);
}
Status = AcpiTbGetTable (&Address, &TableInfo);
if (ACPI_FAILURE (Status))
{
ACPI_REPORT_ERROR (("Could not get the DSDT\n"));
return_ACPI_STATUS (Status);
}
@ -441,20 +452,16 @@ AcpiTbGetAllTables (
Status = AcpiTbInstallTable (TablePtr, &TableInfo);
if (ACPI_FAILURE (Status))
{
ACPI_REPORT_ERROR (("Could not install the DSDT\n"));
return_ACPI_STATUS (Status);
}
/* Dump the DSDT Header */
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Hex dump of DSDT Header:\n"));
ACPI_DUMP_BUFFER ((UINT8 *) AcpiGbl_DSDT, sizeof (ACPI_TABLE_HEADER));
/* Dump the entire DSDT */
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
"Hex dump of DSDT (After header), size %d (%x)\n",
"Hex dump of entire DSDT, size %d (0x%X)\n",
AcpiGbl_DSDT->Length, AcpiGbl_DSDT->Length));
ACPI_DUMP_BUFFER ((UINT8 *) (AcpiGbl_DSDT + 1), AcpiGbl_DSDT->Length);
ACPI_DUMP_BUFFER ((UINT8 *) AcpiGbl_DSDT, AcpiGbl_DSDT->Length);
/* Always delete the RSDP mapping, we are done with it */
@ -477,7 +484,7 @@ AcpiTbGetAllTables (
ACPI_STATUS
AcpiTbVerifyRsdp (
ACPI_PHYSICAL_ADDRESS RsdpPhysicalAddress)
ACPI_POINTER *Address)
{
ACPI_TABLE_DESC TableInfo;
ACPI_STATUS Status;
@ -487,14 +494,27 @@ AcpiTbVerifyRsdp (
ACPI_FUNCTION_TRACE ("TbVerifyRsdp");
/*
* Obtain access to the RSDP structure
*/
Status = AcpiOsMapMemory (RsdpPhysicalAddress, sizeof (RSDP_DESCRIPTOR),
(void **) &Rsdp);
if (ACPI_FAILURE (Status))
switch (Address->PointerType)
{
return_ACPI_STATUS (Status);
case ACPI_LOGICAL_POINTER:
Rsdp = Address->Pointer.Logical;
break;
case ACPI_PHYSICAL_POINTER:
/*
* Obtain access to the RSDP structure
*/
Status = AcpiOsMapMemory (Address->Pointer.Physical, sizeof (RSDP_DESCRIPTOR),
(void **) &Rsdp);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
@ -527,7 +547,6 @@ AcpiTbVerifyRsdp (
}
}
/* The RSDP supplied is OK */
TableInfo.Pointer = (ACPI_TABLE_HEADER *) Rsdp;
@ -552,7 +571,10 @@ AcpiTbVerifyRsdp (
/* Error exit */
Cleanup:
AcpiOsUnmapMemory (Rsdp, sizeof (RSDP_DESCRIPTOR));
if (AcpiGbl_TableFlags & ACPI_PHYSICAL_POINTER)
{
AcpiOsUnmapMemory (Rsdp, sizeof (RSDP_DESCRIPTOR));
}
return_ACPI_STATUS (Status);
}
@ -570,30 +592,28 @@ AcpiTbVerifyRsdp (
*
******************************************************************************/
ACPI_PHYSICAL_ADDRESS
AcpiTbGetRsdtAddress (void)
void
AcpiTbGetRsdtAddress (
ACPI_POINTER *OutAddress)
{
ACPI_PHYSICAL_ADDRESS PhysicalAddress;
ACPI_FUNCTION_ENTRY ();
OutAddress->PointerType = AcpiGbl_TableFlags;
/*
* For RSDP revision 0 or 1, we use the RSDT.
* For RSDP revision 2 (and above), we use the XSDT
*/
if (AcpiGbl_RSDP->Revision < 2)
{
PhysicalAddress = (ACPI_PHYSICAL_ADDRESS) AcpiGbl_RSDP->RsdtPhysicalAddress;
OutAddress->Pointer.Value = AcpiGbl_RSDP->RsdtPhysicalAddress;
}
else
{
PhysicalAddress = (ACPI_PHYSICAL_ADDRESS)
ACPI_GET_ADDRESS (AcpiGbl_RSDP->XsdtPhysicalAddress);
OutAddress->Pointer.Value = ACPI_GET_ADDRESS (AcpiGbl_RSDP->XsdtPhysicalAddress);
}
return (PhysicalAddress);
}
@ -669,27 +689,55 @@ AcpiTbValidateRsdt (
ACPI_STATUS
AcpiTbGetTablePointer (
ACPI_PHYSICAL_ADDRESS PhysicalAddress,
ACPI_POINTER *Address,
UINT32 Flags,
UINT32 *Size,
ACPI_TABLE_HEADER **TablePtr)
{
ACPI_STATUS Status;
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_ENTRY ();
/*
* What mode is the processor in? (Virtual or Physical addressing)
*/
if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING)
{
*Size = SIZE_IN_HEADER;
Status = AcpiTbMapAcpiTable (PhysicalAddress, Size, TablePtr);
/* Incoming pointer can be either logical or physical */
switch (Address->PointerType)
{
case ACPI_PHYSICAL_POINTER:
*Size = SIZE_IN_HEADER;
Status = AcpiTbMapAcpiTable (Address->Pointer.Physical, Size, TablePtr);
break;
case ACPI_LOGICAL_POINTER:
*TablePtr = Address->Pointer.Logical;
*Size = 0;
break;
}
}
else
{
*Size = 0;
*TablePtr = ACPI_PHYSADDR_TO_PTR (PhysicalAddress);
Status = AE_OK;
/* In Physical addressing mode, all pointers must be physical */
switch (Address->PointerType)
{
case ACPI_PHYSICAL_POINTER:
*Size = 0;
*TablePtr = Address->Pointer.Logical;
break;
case ACPI_LOGICAL_POINTER:
Status = AE_BAD_PARAMETER;
break;
}
}
return (Status);
@ -714,7 +762,7 @@ AcpiTbGetTableRsdt (
{
ACPI_TABLE_DESC TableInfo;
ACPI_STATUS Status;
ACPI_PHYSICAL_ADDRESS PhysicalAddress;
ACPI_POINTER Address;
ACPI_FUNCTION_TRACE ("TbGetTableRsdt");
@ -729,11 +777,11 @@ AcpiTbGetTableRsdt (
ACPI_HIDWORD (AcpiGbl_RSDP->RsdtPhysicalAddress),
ACPI_LODWORD (AcpiGbl_RSDP->RsdtPhysicalAddress)));
PhysicalAddress = AcpiTbGetRsdtAddress ();
/* Get the RSDT/XSDT */
Status = AcpiTbGetTable (PhysicalAddress, NULL, &TableInfo);
AcpiTbGetRsdtAddress (&Address);
Status = AcpiTbGetTable (&Address, &TableInfo);
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the RSDT, %s\n",
@ -778,86 +826,3 @@ AcpiTbGetTableRsdt (
}
/******************************************************************************
*
* FUNCTION: AcpiTbGetTableFacs
*
* PARAMETERS: *BufferPtr - If BufferPtr is valid, read data from
* buffer rather than searching memory
* *TableInfo - Where the table info is returned
*
* RETURN: Status
*
* DESCRIPTION: Returns a pointer to the FACS as defined in FADT. This
* function assumes the global variable FADT has been
* correctly initialized. The value of FADT->FirmwareCtrl
* into a far pointer which is returned.
*
*****************************************************************************/
ACPI_STATUS
AcpiTbGetTableFacs (
ACPI_TABLE_HEADER *BufferPtr,
ACPI_TABLE_DESC *TableInfo)
{
ACPI_TABLE_HEADER *TablePtr = NULL;
UINT32 Size;
UINT8 Allocation;
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_TRACE ("TbGetTableFacs");
/* Must have a valid FADT pointer */
if (!AcpiGbl_FADT)
{
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
Size = sizeof (FACS_DESCRIPTOR);
if (BufferPtr)
{
/*
* Getting table from a file -- allocate a buffer and
* read the table.
*/
TablePtr = ACPI_MEM_ALLOCATE (Size);
if(!TablePtr)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
ACPI_MEMCPY (TablePtr, BufferPtr, Size);
/* Save allocation type */
Allocation = ACPI_MEM_ALLOCATED;
}
else
{
/* Just map the physical memory to our address space */
Status = AcpiTbMapAcpiTable ((ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (AcpiGbl_FADT->XFirmwareCtrl),
&Size, &TablePtr);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Save allocation type */
Allocation = ACPI_MEM_MAPPED;
}
/* Return values */
TableInfo->Pointer = TablePtr;
TableInfo->Length = Size;
TableInfo->Allocation = Allocation;
TableInfo->BasePointer = TablePtr;
return_ACPI_STATUS (Status);
}

View File

@ -128,6 +128,7 @@
ACPI_MODULE_NAME ("utglobal")
/******************************************************************************
*
* FUNCTION: AcpiFormatException
@ -148,9 +149,11 @@ AcpiFormatException (
ACPI_STATUS SubStatus;
SubStatus = (Status & ~AE_CODE_MASK);
ACPI_FUNCTION_NAME ("FormatException");
SubStatus = (Status & ~AE_CODE_MASK);
switch (Status & AE_CODE_MASK)
{
case AE_CODE_ENVIRONMENTAL:
@ -158,46 +161,56 @@ AcpiFormatException (
if (SubStatus <= AE_CODE_ENV_MAX)
{
Exception = AcpiGbl_ExceptionNames_Env [SubStatus];
break;
}
break;
goto Unknown;
case AE_CODE_PROGRAMMER:
if (SubStatus <= AE_CODE_PGM_MAX)
{
Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1];
break;
}
break;
goto Unknown;
case AE_CODE_ACPI_TABLES:
if (SubStatus <= AE_CODE_TBL_MAX)
{
Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1];
break;
}
break;
goto Unknown;
case AE_CODE_AML:
if (SubStatus <= AE_CODE_AML_MAX)
{
Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1];
break;
}
break;
goto Unknown;
case AE_CODE_CONTROL:
if (SubStatus <= AE_CODE_CTRL_MAX)
{
Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1];
break;
}
break;
goto Unknown;
default:
break;
goto Unknown;
}
return ((const char *) Exception);
Unknown:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown exception code: 0x%8.8X\n", Status));
return ((const char *) Exception);
}
@ -274,10 +287,10 @@ const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] =
{"_SB_", ACPI_TYPE_DEVICE},
{"_SI_", INTERNAL_TYPE_DEF_ANY},
{"_TZ_", INTERNAL_TYPE_DEF_ANY},
{"_REV", ACPI_TYPE_INTEGER, "2"},
{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
{"_GL_", ACPI_TYPE_MUTEX, "0"},
{NULL, ACPI_TYPE_ANY} /* Table terminator */
{"_REV", ACPI_TYPE_INTEGER, "2"},
{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
{"_GL_", ACPI_TYPE_MUTEX, "0"},
{NULL, ACPI_TYPE_ANY} /* Table terminator */
};
@ -294,16 +307,16 @@ const UINT8 AcpiGbl_NsProperties[] =
ACPI_NS_NORMAL, /* 01 Number */
ACPI_NS_NORMAL, /* 02 String */
ACPI_NS_NORMAL, /* 03 Buffer */
ACPI_NS_LOCAL, /* 04 Package */
ACPI_NS_NORMAL, /* 04 Package */
ACPI_NS_NORMAL, /* 05 FieldUnit */
ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 06 Device */
ACPI_NS_LOCAL, /* 07 AcpiEvent */
ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 08 Method */
ACPI_NS_LOCAL, /* 09 Mutex */
ACPI_NS_LOCAL, /* 10 Region */
ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 11 Power */
ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 12 Processor */
ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 13 Thermal */
ACPI_NS_NEWSCOPE, /* 06 Device */
ACPI_NS_NORMAL, /* 07 Event */
ACPI_NS_NEWSCOPE, /* 08 Method */
ACPI_NS_NORMAL, /* 09 Mutex */
ACPI_NS_NORMAL, /* 10 Region */
ACPI_NS_NEWSCOPE, /* 11 Power */
ACPI_NS_NEWSCOPE, /* 12 Processor */
ACPI_NS_NEWSCOPE, /* 13 Thermal */
ACPI_NS_NORMAL, /* 14 BufferField */
ACPI_NS_NORMAL, /* 15 DdbHandle */
ACPI_NS_NORMAL, /* 16 Debug Object */
@ -859,6 +872,7 @@ AcpiUtInitGlobals (
/* Miscellaneous variables */
AcpiGbl_TableFlags = ACPI_PHYSICAL_POINTER;
AcpiGbl_RsdpOriginalLocation = 0;
AcpiGbl_CmSingleStep = FALSE;
AcpiGbl_DbTerminateThreads = FALSE;
@ -880,7 +894,7 @@ AcpiUtInitGlobals (
AcpiGbl_RootNode = NULL;
AcpiGbl_RootNodeStruct.Name = ACPI_ROOT_NAME;
AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
AcpiGbl_RootNodeStruct.Descriptor = ACPI_DESC_TYPE_NAMED;
AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_ANY;
AcpiGbl_RootNodeStruct.Child = NULL;

View File

@ -79,15 +79,13 @@ AcpiEnterSleepStateS4Bios (
AcpiHwBitRegisterWrite (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_LOCK);
acpi_disable_irqs ();
ACPI_DISABLE_IRQS ();
AcpiHwDisableNonWakeupGpes();
/* flush caches */
#ifdef __i386__
wbinvd();
#endif
ACPI_FLUSH_CPU_CACHE ();
/* write the value to command port and wait until we enter sleep state */
do
@ -99,7 +97,7 @@ AcpiEnterSleepStateS4Bios (
AcpiHwEnableNonWakeupGpes();
acpi_enable_irqs ();
ACPI_ENABLE_IRQS ();
return_ACPI_STATUS (AE_OK);
}

View File

@ -56,7 +56,7 @@ AcpiOsTerminate(void)
ACPI_STATUS
AcpiOsGetRootPointer(
UINT32 Flags,
ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress)
ACPI_POINTER *RsdpPhysicalAddress)
{
/*
* The loader passes the physical address at which it found the

View File

@ -51,13 +51,18 @@ AcpiOsTerminate(void)
}
ACPI_STATUS
AcpiOsGetRootPointer(UINT32 Flags, ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress)
AcpiOsGetRootPointer(UINT32 Flags, ACPI_POINTER *RsdpAddress)
{
if (ia64_efi_acpi20_table)
*RsdpPhysicalAddress = ia64_efi_acpi20_table;
else if (ia64_efi_acpi_table)
*RsdpPhysicalAddress = ia64_efi_acpi_table;
if (ia64_efi_acpi20_table) {
RsdpAddress->PointerType = ACPI_PHYSICAL_POINTER;
RsdpAddress->Pointer.Physical = ia64_efi_acpi20_table;
}
else if (ia64_efi_acpi_table) {
RsdpAddress->PointerType = ACPI_PHYSICAL_POINTER;
RsdpAddress->Pointer.Physical = ia64_efi_acpi_table;
}
else
return(AE_NOT_FOUND);